location design

This commit is contained in:
2026-02-13 13:09:12 +01:00
parent 2891f52f84
commit 87ba23cf57

View File

@@ -1,8 +1,8 @@
<?php <?php
/** /**
* app/modules/locations/list.php * app/modules/locations/list.php
* *
* Übersicht aller Standorte * Übersicht aller Standorte
*/ */
// ========================= // =========================
@@ -73,7 +73,7 @@ foreach ($floors as $floor) {
<input type="hidden" name="module" value="locations"> <input type="hidden" name="module" value="locations">
<input type="hidden" name="action" value="list"> <input type="hidden" name="action" value="list">
<input type="text" name="search" placeholder="Suche nach Name" <input type="text" name="search" placeholder="Suche nach Name…"
value="<?php echo htmlspecialchars($search); ?>" class="search-input"> value="<?php echo htmlspecialchars($search); ?>" class="search-input">
<button type="submit" class="button">Filter</button> <button type="submit" class="button">Filter</button>
@@ -90,7 +90,7 @@ foreach ($floors as $floor) {
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Gebäude</th> <th>Gebäude</th>
<th>Beschreibung</th> <th>Beschreibung</th>
<th>Aktionen</th> <th>Aktionen</th>
</tr> </tr>
@@ -112,7 +112,7 @@ foreach ($floors as $floor) {
<td class="actions"> <td class="actions">
<a href="?module=locations&action=edit&id=<?php echo $location['id']; ?>" class="button button-small">Bearbeiten</a> <a href="?module=locations&action=edit&id=<?php echo $location['id']; ?>" class="button button-small">Bearbeiten</a>
<a href="#" class="button button-small button-danger" onclick="confirmDelete(<?php echo $location['id']; ?>)">Löschen</a> <a href="#" class="button button-small button-danger" onclick="confirmDelete(<?php echo $location['id']; ?>)">Löschen</a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
@@ -130,75 +130,85 @@ foreach ($floors as $floor) {
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php
//TODO design schlecht, mach es hübscher
?>
<section class="hierarchy-section"> <section class="hierarchy-section">
<h2>Gebäude &amp; Stockwerke nach Standorten</h2> <h2>Gebäude &amp; Stockwerke nach Standorten</h2>
<?php if (!empty($locations)): ?> <?php if (!empty($locations)): ?>
<ul class="hierarchy-list"> <table class="hierarchy-table">
<thead>
<tr>
<th>Standort</th>
<th>Gebäude</th>
<th>Stockwerk</th>
<th>Details</th>
<th class="actions">Aktionen</th>
</tr>
</thead>
<tbody>
<?php foreach ($locations as $location): ?> <?php foreach ($locations as $location): ?>
<li class="hierarchy-list__item">
<div class="hierarchy-location">
<div class="hierarchy-location__info">
<span class="hierarchy-location__name"><?php echo htmlspecialchars($location['name']); ?></span>
<span class="hierarchy-location__meta"><?php echo $location['building_count']; ?> Gebäude</span>
</div>
<div class="hierarchy-actions">
<a href="?module=buildings&action=edit&location_id=<?php echo $location['id']; ?>" class="button button-small">+ Gebäude</a>
</div>
</div>
<?php $locationBuildings = $buildingsByLocation[$location['id']] ?? []; ?> <?php $locationBuildings = $buildingsByLocation[$location['id']] ?? []; ?>
<tr class="hierarchy-row hierarchy-row--location">
<td class="hierarchy-cell hierarchy-cell--location" colspan="3">
<strong><?php echo htmlspecialchars($location['name']); ?></strong>
<span class="hierarchy-meta">(<?php echo (int) $location['building_count']; ?> Gebäude)</span>
</td>
<td></td>
<td class="actions hierarchy-actions">
<a href="?module=buildings&action=edit&location_id=<?php echo $location['id']; ?>" class="button button-small">+ Gebäude</a>
</td>
</tr>
<?php if (!empty($locationBuildings)): ?> <?php if (!empty($locationBuildings)): ?>
<ul class="hierarchy-sublist">
<?php foreach ($locationBuildings as $building): ?> <?php foreach ($locationBuildings as $building): ?>
<li class="hierarchy-sublist__item"> <?php $buildingFloors = $floorsByBuilding[$building['id']] ?? []; ?>
<div class="hierarchy-building"> <tr class="hierarchy-row hierarchy-row--building">
<div class="hierarchy-building__info"> <td class="hierarchy-cell hierarchy-cell--empty">&nbsp;</td>
<span class="hierarchy-building__name"><?php echo htmlspecialchars($building['name']); ?></span> <td class="hierarchy-cell hierarchy-cell--building" colspan="2"><?php echo htmlspecialchars($building['name']); ?></td>
<td>
<?php if (!empty($building['comment'])): ?> <?php if (!empty($building['comment'])): ?>
<span class="hierarchy-building__meta"><?php echo htmlspecialchars($building['comment']); ?></span> <span class="hierarchy-meta"><?php echo htmlspecialchars($building['comment']); ?></span>
<?php else: ?>
<span class="hierarchy-meta hierarchy-meta--muted">Kein Kommentar</span>
<?php endif; ?> <?php endif; ?>
</div> </td>
<div class="hierarchy-actions"> <td class="actions hierarchy-actions">
<a href="?module=buildings&action=edit&id=<?php echo $building['id']; ?>" class="button button-small">Bearbeiten</a> <a href="?module=buildings&action=edit&id=<?php echo $building['id']; ?>" class="button button-small">Bearbeiten</a>
<a href="#" class="button button-small button-danger" onclick="confirmBuildingDelete(<?php echo $building['id']; ?>)">Löschen</a> <a href="#" class="button button-small button-danger" onclick="confirmBuildingDelete(<?php echo $building['id']; ?>)">Löschen</a>
<a href="?module=floors&action=edit&building_id=<?php echo $building['id']; ?>" class="button button-small">+ Stockwerk</a> <a href="?module=floors&action=edit&building_id=<?php echo $building['id']; ?>" class="button button-small">+ Stockwerk</a>
</div> </td>
</div> </tr>
<?php $buildingFloors = $floorsByBuilding[$building['id']] ?? []; ?>
<?php if (!empty($buildingFloors)): ?> <?php if (!empty($buildingFloors)): ?>
<ul class="hierarchy-sublist hierarchy-sublist--nested">
<?php foreach ($buildingFloors as $floor): ?> <?php foreach ($buildingFloors as $floor): ?>
<li> <tr class="hierarchy-row hierarchy-row--floor">
<div class="hierarchy-floor"> <td class="hierarchy-cell hierarchy-cell--empty">&nbsp;</td>
<div class="hierarchy-floor__info"> <td class="hierarchy-cell hierarchy-cell--empty">&nbsp;</td>
<span class="hierarchy-floor__name"><?php echo htmlspecialchars($floor['name']); ?></span> <td class="hierarchy-cell hierarchy-cell--floor"><?php echo htmlspecialchars($floor['name']); ?></td>
<td>
<?php if ($floor['level'] !== null): ?> <?php if ($floor['level'] !== null): ?>
<span class="hierarchy-floor__meta">Ebene <?php echo htmlspecialchars($floor['level']); ?></span> <span class="hierarchy-meta">Ebene <?php echo htmlspecialchars($floor['level']); ?></span>
<?php else: ?>
<span class="hierarchy-meta hierarchy-meta--muted">Keine Ebene</span>
<?php endif; ?> <?php endif; ?>
</div> </td>
<div class="hierarchy-actions"> <td class="actions hierarchy-actions">
<a href="?module=floors&action=edit&id=<?php echo $floor['id']; ?>" class="button button-small">Bearbeiten</a> <a href="?module=floors&action=edit&id=<?php echo $floor['id']; ?>" class="button button-small">Bearbeiten</a>
<a href="#" class="button button-small button-danger" onclick="confirmFloorDelete(<?php echo $floor['id']; ?>)">Löschen</a> <a href="#" class="button button-small button-danger" onclick="confirmFloorDelete(<?php echo $floor['id']; ?>)">Löschen</a>
</div> </td>
</div> </tr>
</li>
<?php endforeach; ?> <?php endforeach; ?>
</ul>
<?php else: ?>
<p class="hierarchy-empty">Keine Stockwerke für dieses Gebäude.</p>
<?php endif; ?> <?php endif; ?>
</li>
<?php endforeach; ?> <?php endforeach; ?>
</ul>
<?php else: ?> <?php else: ?>
<p class="hierarchy-empty">Für diesen Standort sind noch keine Gebäude hinterlegt.</p> <tr class="hierarchy-row hierarchy-row--empty">
<td class="hierarchy-cell hierarchy-cell--empty">&nbsp;</td>
<td class="hierarchy-cell hierarchy-cell--empty">&nbsp;</td>
<td class="hierarchy-cell hierarchy-cell--empty">Keine Gebäude</td>
<td><span class="hierarchy-meta hierarchy-meta--muted">Für diesen Standort sind noch keine Gebäude vorhanden.</span></td>
<td></td>
</tr>
<?php endif; ?> <?php endif; ?>
</li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </tbody>
</table>
<?php else: ?> <?php else: ?>
<p>Keine Standorte gefunden.</p> <p>Keine Standorte gefunden.</p>
<?php endif; ?> <?php endif; ?>
@@ -320,69 +330,70 @@ foreach ($floors as $floor) {
font-size: 1.3rem; font-size: 1.3rem;
} }
.hierarchy-list { .hierarchy-table {
list-style: none; width: 100%;
padding: 0; border-collapse: separate;
margin: 0; border-spacing: 0;
display: flex; border: 1px solid #d8dee5;
flex-direction: column; border-radius: 10px;
gap: 15px; overflow: hidden;
} }
.hierarchy-list__item { .hierarchy-table th {
padding: 15px; background: #f3f6fa;
border: 1px solid #e0e0e0; padding: 10px 12px;
border-radius: 8px; text-align: left;
background: #fafafa; font-size: 0.9rem;
}
.hierarchy-location,
.hierarchy-building,
.hierarchy-floor {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 10px;
}
.hierarchy-location__info,
.hierarchy-building__info,
.hierarchy-floor__info {
display: flex;
flex-direction: column;
gap: 4px;
}
.hierarchy-location__name,
.hierarchy-building__name,
.hierarchy-floor__name {
font-weight: 600; font-weight: 600;
border-bottom: 1px solid #d8dee5;
} }
.hierarchy-location__meta, .hierarchy-table td {
.hierarchy-building__meta, padding: 9px 12px;
.hierarchy-floor__meta { border-bottom: 1px solid #eef2f6;
color: #666; vertical-align: top;
}
.hierarchy-row:last-child td {
border-bottom: none;
}
.hierarchy-row--empty {
background: #fcfcfc;
}
.hierarchy-cell {
white-space: nowrap;
}
.hierarchy-cell--location {
background: #fbfcfe;
font-weight: 600;
min-width: 170px;
}
.hierarchy-cell--building {
padding-left: 18px;
min-width: 180px;
}
.hierarchy-cell--floor {
padding-left: 24px;
min-width: 160px;
}
.hierarchy-cell--empty {
background: #fafbfd;
width: 20px;
}
.hierarchy-meta {
color: #4e5c6b;
font-size: 0.9rem; font-size: 0.9rem;
} }
.hierarchy-sublist { .hierarchy-meta--muted {
list-style: none; color: #8a94a3;
margin: 10px 0 0 20px;
padding: 0;
display: flex;
flex-direction: column;
gap: 10px;
}
.hierarchy-sublist--nested {
margin-left: 20px;
}
.hierarchy-empty {
margin: 10px 0 0 20px;
color: #888;
font-size: 0.9rem;
} }
.hierarchy-actions { .hierarchy-actions {
display: flex; display: flex;
@@ -402,7 +413,7 @@ foreach ($floors as $floor) {
<script> <script>
function confirmDelete(id) { function confirmDelete(id) {
if (confirm('Diesen Standort wirklich löschen?')) { if (confirm('Diesen Standort wirklich löschen?')) {
fetch('?module=locations&action=delete&id=' + encodeURIComponent(id), { fetch('?module=locations&action=delete&id=' + encodeURIComponent(id), {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -415,24 +426,26 @@ function confirmDelete(id) {
window.location.reload(); window.location.reload();
return; return;
} }
alert((data && data.message) ? data.message : 'Löschen fehlgeschlagen'); alert((data && data.message) ? data.message : 'Löschen fehlgeschlagen');
}) })
.catch(() => { .catch(() => {
alert('Löschen fehlgeschlagen'); alert('Löschen fehlgeschlagen');
}); });
} }
} }
function confirmBuildingDelete(id) { function confirmBuildingDelete(id) {
if (confirm('Dieses Gebäude wirklich löschen? Alle Stockwerke werden gelöscht.')) { if (confirm('Dieses Gebäude wirklich löschen? Alle Stockwerke werden gelöscht.')) {
alert('Löschen noch nicht implementiert'); alert('Löschen noch nicht implementiert');
} }
} }
function confirmFloorDelete(id) { function confirmFloorDelete(id) {
if (confirm('Dieses Stockwerk wirklich löschen? Alle Räume und Racks werden gelöscht.')) { if (confirm('Dieses Stockwerk wirklich löschen? Alle Räume und Racks werden gelöscht.')) {
alert('Löschen noch nicht implementiert'); alert('Löschen noch nicht implementiert');
} }
} }
</script> </script>