Files
2026-11-06 10:26:13 +01:00

150 lines
5.7 KiB
HTML

{% extends "base.html" %}
{% block title %}Straßenverwaltung - {{ APP_TITLE }}{% endblock %}
{% block content %}
<p><a href="{{ url_for('admin.dashboard', tenant=session.tenant_code) }}">← Zurück zum Dashboard</a></p>
<h1>Straßenverwaltung</h1>
<div style="display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem;">
<button type="button" id="selectVisibleStreets">Alle sichtbaren auswählen</button>
<button type="button" id="invertStreetSelection" class="secondary">Auswahl invertieren</button>
<button type="button" id="deleteSelectedStreets" class="secondary" disabled>Ausgewählte löschen (0)</button>
<span id="streetSelectionInfo" style="color: var(--muted-color);"></span>
</div>
<div style="display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin-bottom: 0.75rem;">
<label style="margin: 0;">Name filtern
<input type="text" id="streetNameFilter" placeholder="z. B. Haupt" oninput="applyStreetFilters()">
</label>
</div>
<table id="strassenTable">
<thead>
<tr>
<th style="width: 4.5rem;">Auswahl</th>
<th>ID</th>
<th>Name</th>
<th>HN Min</th>
<th>HN Max</th>
<th>BBox</th>
<th>Zusatz</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for strasse in strassen %}
<tr data-id="{{ strasse.id }}" data-bbox="{{ strasse.bbox or '' }}">
<td>
<input type="checkbox" class="street-select" value="{{ strasse.id }}"
aria-label="Straße {{ strasse.name }} auswählen">
</td>
<td>{{ strasse.id }}</td>
<td>{{ strasse.name }}</td>
<td>{{ strasse.hn_min or '-' }}</td>
<td>{{ strasse.hn_max or '-' }}</td>
<td style="word-break: break-all;">{{ strasse.bbox or '-' }}</td>
<td class="street-zusatz">{{ strasse.zusatz or '' }}</td>
<td>
<button onclick="editStrasse({{ strasse.id }})">✎</button>
<button onclick="openSplitStrasse({{ strasse.id }})"
title="Straße an einer Hausnummer in zwei Abschnitte teilen">Schneiden</button>
<button onclick="showStreetHistory({{ strasse.id }})">Historie</button>
<button class="secondary" onclick="deleteStrasse({{ strasse.id }})">🗑</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button onclick="openCreateStrasseModal()">Neue Straße</button>
<button onclick="document.getElementById('csvFile').click()">
Import Straßen + Hausnummern ({{ house_number_count }})
</button>
<input type="file" id="csvFile" accept=".csv,text/csv" style="display:none" onchange="importCSV(this)">
<button type="button" id="generateStr2pl" class="secondary"
title="Erzeugt die mandantenspezifische Polyline-Datei aus allen Straßen der Datenbank"
onclick="generateStr2plFile()">Polyline-Datei erzeugen</button>
<p style="margin-top: 2rem;"><a href="{{ url_for('admin.dashboard', tenant=session.tenant_code) }}">← Zurück zum Dashboard</a></p>
<!-- Create/Edit Strasse Modal -->
<dialog id="strasseModal">
<article>
<header>
<a href="#close" aria-label="Close" class="close" onclick="closeStrasseModal()"></a>
<h3 id="strasseModalTitle">Straße</h3>
</header>
<input type="hidden" id="strasseId">
<label>Name
<input type="text" id="strasseName">
</label>
<label>Zusatz
<input type="text" id="strasseZusatz" placeholder="z. B. Nord">
</label>
<label>Hausnummer minimal
<input type="number" id="strasseHnMin">
</label>
<label>Hausnummer maximal
<input type="number" id="strasseHnMax">
</label>
<label>Bounding Box (JSON Array)
<textarea id="strasseBbox"></textarea>
</label>
<footer>
<button onclick="closeStrasseModal()">Abbrechen</button>
<button onclick="saveStrasse()">Speichern</button>
</footer>
</article>
</dialog>
<!-- History Modal -->
<dialog id="streetHistoryModal">
<article style="max-width: 800px;">
<header>
<a href="#close" aria-label="Close" class="close" onclick="closeStreetHistoryModal()"></a>
<h3>Straßen-Historie</h3>
</header>
<table>
<thead>
<tr>
<th>Datum</th>
<th>Von</th>
<th>Nach</th>
<th>Gruppe</th>
<th>Aktion</th>
</tr>
</thead>
<tbody id="streetHistoryBody">
</tbody>
</table>
<footer>
<button onclick="closeStreetHistoryModal()">Schließen</button>
</footer>
</article>
</dialog>
<!-- Split Modal -->
<dialog id="splitStrasseModal">
<article>
<header>
<a href="#close" aria-label="Close" class="close" onclick="closeSplitStrasseModal()"></a>
<h3>Straße schneiden</h3>
</header>
<p id="splitStrasseInfo"></p>
<label>Hausnummer
<select id="splitHouseNumber"></select>
</label>
<p id="splitStrasseError" style="color: var(--error-color, #b00020);"></p>
<footer>
<button onclick="closeSplitStrasseModal()">Abbrechen</button>
<button onclick="confirmSplitStrasse()">Schneiden</button>
</footer>
</article>
</dialog>
{% endblock %}
{% block scripts %}
<script>window.CMBNET_ADMIN_RELOAD_WATCH = true;</script>
<script src="{{ url_for('static', filename='js/views/admin_strassen.js') }}"></script>
{% endblock %}