div TODOs

This commit is contained in:
2026-02-16 13:56:01 +01:00
parent 12141485ae
commit 510a248edb
36 changed files with 1500 additions and 1533 deletions

View File

@@ -8,17 +8,17 @@
// =========================
// Filter einlesen
// =========================
$search = trim($_GET['search'] ?? '');
$search = trim($_GET['search'] ?? ');
$locationId = (int)($_GET['location_id'] ?? 0);
// =========================
// WHERE-Clause bauen
// =========================
$where = [];
$types = '';
$types = ';
$params = [];
if ($search !== '') {
if ($search !== ') {
$where[] = "b.name LIKE ? OR b.comment LIKE ?";
$types .= "ss";
$params[] = "%$search%";
@@ -70,7 +70,7 @@ $locations = $sql->get("SELECT id, name FROM locations ORDER BY name", "", []);
<option value="">- Alle Standorte -</option>
<?php foreach ($locations as $loc): ?>
<option value="<?php echo $loc['id']; ?>"
<?php echo $loc['id'] === $locationId ? 'selected' : ''; ?>>
<?php echo $loc['id'] === $locationId ? 'selected' : '; ?>>
<?php echo htmlspecialchars($loc['name']); ?>
</option>
<?php endforeach; ?>
@@ -112,7 +112,7 @@ $locations = $sql->get("SELECT id, name FROM locations ORDER BY name", "", []);
</td>
<td>
<small><?php echo htmlspecialchars($building['comment'] ?? ''); ?></small>
<small><?php echo htmlspecialchars($building['comment'] ?? '); ?></small>
</td>
<td class="actions">
@@ -241,9 +241,24 @@ $locations = $sql->get("SELECT id, name FROM locations ORDER BY name", "", []);
<script>
function confirmDelete(id) {
if (confirm('Dieses Gebäude wirklich löschen?')) {
// TODO: AJAX-Delete implementieren
alert('Löschen noch nicht implementiert');
if (confirm('Dieses Gebaeude wirklich loeschen?')) {
fetch('?module=buildings&action=delete', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
body: 'id=' + encodeURIComponent(id)
})
.then((res) => res.json())
.then((data) => {
if (data && data.status === 'ok') {
window.location.reload();
return;
}
alert((data && data.error) ? data.error : 'Loeschen fehlgeschlagen');
})
.catch(() => {
alert('Loeschen fehlgeschlagen');
});
}
}
</script>