Kunden & Lizenzen gehen wieder

Dieser Commit ist enthalten in:
2025-06-18 01:50:39 +02:00
Ursprung 231aa4caed
Commit 6e7df47d82
4 geänderte Dateien mit 84 neuen und 136 gelöschten Zeilen

Datei anzeigen

@@ -18,9 +18,9 @@
<li><a class="dropdown-item" href="{{ url_for('export.export_customers', format='csv', include_test=request.args.get('show_test')) }}">
<i class="bi bi-file-earmark-text"></i> Kunden (CSV)</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{{ url_for('export.export_licenses', format='excel', include_test=request.args.get('show_test'), customer_id=selected_customer_id) }}">
<li><a class="dropdown-item" href="{{ url_for('export.export_licenses', format='excel', include_test=request.args.get('show_test')) }}">
<i class="bi bi-file-earmark-excel text-success"></i> Lizenzen (Excel)</a></li>
<li><a class="dropdown-item" href="{{ url_for('export.export_licenses', format='csv', include_test=request.args.get('show_test'), customer_id=selected_customer_id) }}">
<li><a class="dropdown-item" href="{{ url_for('export.export_licenses', format='csv', include_test=request.args.get('show_test')) }}">
<i class="bi bi-file-earmark-text"></i> Lizenzen (CSV)</a></li>
</ul>
</div>
@@ -55,7 +55,7 @@
<div class="customer-list" style="max-height: 600px; overflow-y: auto;">
{% if customers %}
{% for customer in customers %}
<div class="customer-item p-3 border-bottom {% if customer[0] == selected_customer_id %}active{% endif %}"
<div class="customer-item p-3 border-bottom"
data-customer-id="{{ customer.id }}"
data-customer-name="{{ customer.name|lower }}"
data-customer-email="{{ customer.email|lower }}"
@@ -97,113 +97,14 @@
<div class="col-md-8 col-lg-9">
<div class="card">
<div class="card-header bg-light">
{% if selected_customer %}
<div class="d-flex justify-content-between align-items-center">
<div>
<h5 class="mb-0">{{ selected_customer[1] }}</h5>
<small class="text-muted">{{ selected_customer[2] }}</small>
</div>
<div>
<a href="{{ url_for('customers.edit_customer', customer_id=selected_customer[0], ref='customers-licenses', show_test=request.args.get('show_test')) }}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-pencil"></i> Bearbeiten
</a>
</div>
</div>
{% else %}
<h5 class="mb-0">Wählen Sie einen Kunden aus</h5>
{% endif %}
</div>
<div class="card-body">
<div id="licenseContainer">
{% if selected_customer %}
{% if licenses %}
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Lizenzschlüssel</th>
<th>Typ</th>
<th>Gültig von</th>
<th>Gültig bis</th>
<th>Status</th>
<th>Ressourcen</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for license in licenses %}
<tr>
<td>
<code>{{ license[1] }}</code>
<button class="btn btn-sm btn-link" onclick="copyToClipboard('{{ license[1] }}')">
<i class="bi bi-clipboard"></i>
</button>
</td>
<td>
<span class="badge {% if license[2] == 'full' %}bg-primary{% else %}bg-secondary{% endif %}">
{{ license[2]|upper }}
</span>
</td>
<td>{{ license[3].strftime('%d.%m.%Y') if license[3] else '-' }}</td>
<td>{{ license[4].strftime('%d.%m.%Y') if license[4] else '-' }}</td>
<td>
<span class="badge
{% if license[6] == 'aktiv' %}bg-success
{% elif license[6] == 'läuft bald ab' %}bg-warning
{% elif license[6] == 'abgelaufen' %}bg-danger
{% else %}bg-secondary{% endif %}">
{{ license[6] }}
</span>
</td>
<td>
<div class="resource-info">
<div class="d-inline-block me-2" data-bs-toggle="tooltip" title="Domains">
🌐 {{ license[12] }}
</div>
<div class="d-inline-block me-2" data-bs-toggle="tooltip" title="IPv4-Adressen">
📡 {{ license[13] }}
</div>
<div class="d-inline-block me-2" data-bs-toggle="tooltip" title="Telefonnummern">
📱 {{ license[14] }}
</div>
<div class="d-inline-block" data-bs-toggle="tooltip" title="Geräte (aktiv/limit)">
💻 {{ license[11] }}/{{ license[10] }}
</div>
</div>
</td>
<td>
<div class="btn-group btn-group-sm">
<button class="btn btn-outline-primary" onclick="toggleLicenseStatus({{ license[0] }}, {{ license[5] }})" title="Aktivieren/Deaktivieren">
<i class="bi bi-power"></i>
</button>
<button class="btn btn-outline-info" onclick="showDeviceManagement({{ license[0] }})" title="Geräte verwalten">
<i class="bi bi-laptop"></i>
</button>
<a href="{{ url_for('licenses.edit_license', license_id=license[0], ref='customers-licenses', show_test=request.args.get('show_test')) }}" class="btn btn-outline-secondary" title="Bearbeiten">
<i class="bi bi-pencil"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-5">
<i class="bi bi-inbox text-muted" style="font-size: 3rem;"></i>
<p class="text-muted mt-3">Keine Lizenzen für diesen Kunden vorhanden</p>
<button class="btn btn-success" onclick="showNewLicenseModal({{ selected_customer[0] }})">
<i class="bi bi-plus"></i> Erste Lizenz erstellen
</button>
</div>
{% endif %}
{% else %}
<div class="text-center py-5">
<i class="bi bi-arrow-left text-muted" style="font-size: 3rem;"></i>
<p class="text-muted mt-3">Wählen Sie einen Kunden aus der Liste aus</p>
</div>
{% endif %}
<div class="text-center py-5">
<i class="bi bi-arrow-left text-muted" style="font-size: 3rem;"></i>
<p class="text-muted mt-3">Wählen Sie einen Kunden aus der Liste aus</p>
</div>
</div>
</div>
</div>
@@ -357,7 +258,7 @@ select[multiple] option:hover {
{% block extra_js %}
<script>
// Globale Variablen
let currentCustomerId = {{ selected_customer_id or 'null' }};
let currentCustomerId = null;
// Kundensuche
document.getElementById('customerSearch').addEventListener('input', function(e) {
@@ -393,7 +294,7 @@ function loadCustomerLicenses(customerId) {
const cardHeader = document.querySelector('.card-header.bg-light');
container.innerHTML = '<div class="text-center py-5"><div class="spinner-border text-primary" role="status"></div></div>';
fetch(`/api/customer/${customerId}/licenses`)
fetch(`{{ url_for('customers.api_customer_licenses', customer_id=0) }}`.replace('0', customerId))
.then(response => response.json())
.then(data => {
if (data.success) {
@@ -544,7 +445,7 @@ function updateLicenseView(customerId, licenses) {
function toggleLicenseStatus(licenseId, currentStatus) {
const newStatus = !currentStatus;
fetch(`{{ url_for('api.toggle_license', license_id='') }}${licenseId}`, {
fetch(`/api/license/${licenseId}/toggle`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',