design update, div TODOs added
This commit is contained in:
@@ -34,6 +34,32 @@ $locations = $sql->get(
|
||||
$params
|
||||
);
|
||||
|
||||
$buildings = $sql->get(
|
||||
"SELECT b.id, b.location_id, b.name, b.comment
|
||||
FROM buildings b
|
||||
ORDER BY b.location_id, b.name",
|
||||
"",
|
||||
[]
|
||||
);
|
||||
|
||||
$buildingsByLocation = [];
|
||||
foreach ($buildings as $building) {
|
||||
$buildingsByLocation[$building['location_id']][] = $building;
|
||||
}
|
||||
|
||||
$floors = $sql->get(
|
||||
"SELECT f.id, f.building_id, f.name, f.level
|
||||
FROM floors f
|
||||
ORDER BY f.building_id, f.level",
|
||||
"",
|
||||
[]
|
||||
);
|
||||
|
||||
$floorsByBuilding = [];
|
||||
foreach ($floors as $floor) {
|
||||
$floorsByBuilding[$floor['building_id']][] = $floor;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="locations-container">
|
||||
@@ -104,7 +130,83 @@ $locations = $sql->get(
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
//TODO design schlecht, mach es hübscher
|
||||
?>
|
||||
|
||||
<section class="hierarchy-section">
|
||||
<h2>Gebäude & Stockwerke nach Standorten</h2>
|
||||
<?php if (!empty($locations)): ?>
|
||||
<ul class="hierarchy-list">
|
||||
<?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 if (!empty($locationBuildings)): ?>
|
||||
<ul class="hierarchy-sublist">
|
||||
<?php foreach ($locationBuildings as $building): ?>
|
||||
<li class="hierarchy-sublist__item">
|
||||
<div class="hierarchy-building">
|
||||
<div class="hierarchy-building__info">
|
||||
<span class="hierarchy-building__name"><?php echo htmlspecialchars($building['name']); ?></span>
|
||||
<?php if (!empty($building['comment'])): ?>
|
||||
<span class="hierarchy-building__meta"><?php echo htmlspecialchars($building['comment']); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="hierarchy-actions">
|
||||
<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="?module=floors&action=edit&building_id=<?php echo $building['id']; ?>" class="button button-small">+ Stockwerk</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $buildingFloors = $floorsByBuilding[$building['id']] ?? []; ?>
|
||||
<?php if (!empty($buildingFloors)): ?>
|
||||
<ul class="hierarchy-sublist hierarchy-sublist--nested">
|
||||
<?php foreach ($buildingFloors as $floor): ?>
|
||||
<li>
|
||||
<div class="hierarchy-floor">
|
||||
<div class="hierarchy-floor__info">
|
||||
<span class="hierarchy-floor__name"><?php echo htmlspecialchars($floor['name']); ?></span>
|
||||
<?php if ($floor['level'] !== null): ?>
|
||||
<span class="hierarchy-floor__meta">Ebene <?php echo htmlspecialchars($floor['level']); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="hierarchy-actions">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p class="hierarchy-empty">Keine Stockwerke für dieses Gebäude.</p>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p class="hierarchy-empty">Für diesen Standort sind noch keine Gebäude hinterlegt.</p>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p>Keine Standorte gefunden.</p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<?php
|
||||
//TODO style in css file
|
||||
?>
|
||||
<style>
|
||||
.locations-container {
|
||||
padding: 20px;
|
||||
@@ -205,6 +307,97 @@ $locations = $sql->get(
|
||||
border: 1px solid #eee;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.hierarchy-section {
|
||||
padding: 20px;
|
||||
max-width: 1000px;
|
||||
margin: 30px auto;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.hierarchy-section h2 {
|
||||
margin-bottom: 15px;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.hierarchy-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.hierarchy-list__item {
|
||||
padding: 15px;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 8px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.hierarchy-location__meta,
|
||||
.hierarchy-building__meta,
|
||||
.hierarchy-floor__meta {
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.hierarchy-sublist {
|
||||
list-style: none;
|
||||
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 {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.hierarchy-actions .button {
|
||||
padding: 4px 10px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.hierarchy-actions .button-danger {
|
||||
background: #dc3545;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
@@ -214,4 +407,16 @@ function confirmDelete(id) {
|
||||
alert('Löschen noch nicht implementiert');
|
||||
}
|
||||
}
|
||||
|
||||
function confirmBuildingDelete(id) {
|
||||
if (confirm('Dieses Gebäude wirklich löschen? Alle Stockwerke werden gelöscht.')) {
|
||||
alert('Löschen noch nicht implementiert');
|
||||
}
|
||||
}
|
||||
|
||||
function confirmFloorDelete(id) {
|
||||
if (confirm('Dieses Stockwerk wirklich löschen? Alle Räume und Racks werden gelöscht.')) {
|
||||
alert('Löschen noch nicht implementiert');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user