Files
Sternsinger/CMBNet/templates/admin/gruppen.html
T
2026-10-23 00:05:06 +02:00

110 lines
4.2 KiB
HTML

{% extends "base.html" %}
{% block title %}Gruppenverwaltung - CMBNet{% endblock %}
{% block content %}
<h1>Gruppenverwaltung</h1>
<p><a href="{{ url_for('admin.accounts', tenant=session.tenant_code) }}">← Zurück zur Accountverwaltung</a></p>
<table id="gruppenTable">
<thead>
<tr>
<th>ID</th>
<th>Aliasname</th>
<th>State</th>
<th>Account</th>
<th>Position</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for gruppe in gruppen %}
<tr data-id="{{ gruppe.id }}">
<td>{{ gruppe.id }}</td>
<td><input type="text" value="{{ gruppe.aliasname or '' }}" onchange="updateGruppe({{ gruppe.id }}, {aliasname: this.value})"></td>
<td>
<select onchange="updateGruppe({{ gruppe.id }}, {state: this.value})">
<option value="offen" {% if gruppe.state == 'offen' %}selected{% endif %}>offen</option>
<option value="unterwegs" {% if gruppe.state == 'unterwegs' %}selected{% endif %}>unterwegs</option>
<option value="online" {% if gruppe.state == 'online' %}selected{% endif %}>online</option>
<option value="pausierend" {% if gruppe.state == 'pausierend' %}selected{% endif %}>pausierend</option>
<option value="fertig" {% if gruppe.state == 'fertig' %}selected{% endif %}>fertig</option>
</select>
</td>
<td>
<select onchange="updateGruppe({{ gruppe.id }}, {account_id: this.value})">
<option value="">-</option>
{% for acc in accounts %}
<option value="{{ acc.id }}" {% if gruppe.account_id == acc.id %}selected{% endif %}>{{ acc.name }}</option>
{% endfor %}
</select>
</td>
<td class="group-position">{% if gruppe.last_lat is not none and gruppe.last_lon is not none %}{{ gruppe.last_lat }}, {{ gruppe.last_lon }}{% else %}unbekannt{% endif %}</td>
<td>
<button onclick="showHistory({{ gruppe.id }})">Historie</button>
<button class="secondary delete-position" onclick="deleteGroupPosition({{ gruppe.id }})" {% if gruppe.last_lat is none or gruppe.last_lon is none %}disabled{% endif %}>Position löschen</button>
<button class="secondary" onclick="deleteGruppe({{ gruppe.id }})">Löschen</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button onclick="openCreateGruppeModal()">Neue Gruppe</button>
<!-- Create Gruppe Modal -->
<dialog id="createGruppeModal">
<article>
<header>
<a href="#close" aria-label="Close" class="close" onclick="closeCreateGruppeModal()"></a>
<h3>Neue Gruppe</h3>
</header>
<label>Aliasname
<input type="text" id="gruppeAlias">
</label>
<label>Account (Rolle Gruppe)
<select id="gruppeAccount">
<option value="">-</option>
{% for acc in accounts %}
<option value="{{ acc.id }}">{{ acc.name }}</option>
{% endfor %}
</select>
</label>
<footer>
<button onclick="closeCreateGruppeModal()">Abbrechen</button>
<button onclick="createGruppe()">Anlegen</button>
</footer>
</article>
</dialog>
<!-- History Modal -->
<dialog id="historyModal">
<article style="max-width: 800px;">
<header>
<a href="#close" aria-label="Close" class="close" onclick="closeHistoryModal()"></a>
<h3>Gruppen-Historie</h3>
</header>
<table>
<thead>
<tr>
<th>Datum</th>
<th>Von</th>
<th>Nach</th>
<th>Position</th>
<th>Aktion</th>
</tr>
</thead>
<tbody id="historyBody">
</tbody>
</table>
<footer>
<button onclick="closeHistoryModal()">Schließen</button>
</footer>
</article>
</dialog>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/views/admin_gruppen.js') }}"></script>
{% endblock %}