location list fix
This commit is contained in:
187
app/assets/css/locations-list.css
Normal file
187
app/assets/css/locations-list.css
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
.locations-container {
|
||||||
|
padding: 20px;
|
||||||
|
max-width: 1000px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locations-filter-form {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locations-filter-add {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locations-list {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 15px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locations-list th {
|
||||||
|
background: #f5f5f5;
|
||||||
|
padding: 12px;
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 2px solid #ddd;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locations-list td {
|
||||||
|
padding: 12px;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locations-list tr:hover {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: #007bff;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
background: #0056b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-primary {
|
||||||
|
background: #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-primary:hover {
|
||||||
|
background: #218838;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-small {
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 0.85em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-danger {
|
||||||
|
background: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-danger:hover {
|
||||||
|
background: #c82333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px 20px;
|
||||||
|
background: #f9f9f9;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-section {
|
||||||
|
padding: 20px;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 30px auto;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-section h2 {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
font-size: 1.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
border: 1px solid #d8dee5;
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-table th {
|
||||||
|
background: #f3f6fa;
|
||||||
|
padding: 10px 12px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 600;
|
||||||
|
border-bottom: 1px solid #d8dee5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-table td {
|
||||||
|
padding: 9px 12px;
|
||||||
|
border-bottom: 1px solid #eef2f6;
|
||||||
|
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: 190px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-cell--room {
|
||||||
|
padding-left: 56px;
|
||||||
|
min-width: 190px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-cell--empty {
|
||||||
|
background: #fafbfd;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-meta {
|
||||||
|
color: #4e5c6b;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-meta--muted {
|
||||||
|
color: #8a94a3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hierarchy-actions .button {
|
||||||
|
padding: 4px 10px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
78
app/assets/js/locations-list.js
Normal file
78
app/assets/js/locations-list.js
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
(() => {
|
||||||
|
function postDelete(url) {
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||||
|
}).then((response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleLocationDelete(id) {
|
||||||
|
if (!confirm('Diesen Standort wirklich loeschen?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
postDelete('?module=locations&action=delete&id=' + encodeURIComponent(id))
|
||||||
|
.then((data) => {
|
||||||
|
if (data && data.success) {
|
||||||
|
window.location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alert((data && data.message) ? data.message : 'Loeschen fehlgeschlagen');
|
||||||
|
})
|
||||||
|
.catch(() => alert('Loeschen fehlgeschlagen'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBuildingDelete() {
|
||||||
|
if (confirm('Dieses Gebaeude wirklich loeschen? Alle Stockwerke werden geloescht.')) {
|
||||||
|
alert('Loeschen noch nicht implementiert');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFloorDelete() {
|
||||||
|
if (confirm('Dieses Stockwerk wirklich loeschen? Alle Raeume und Racks werden geloescht.')) {
|
||||||
|
alert('Loeschen noch nicht implementiert');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRoomDelete(id) {
|
||||||
|
if (!confirm('Diesen Raum wirklich loeschen? Zugeordnete Dosen werden mitgeloescht.')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
postDelete('?module=rooms&action=delete&id=' + encodeURIComponent(id))
|
||||||
|
.then((data) => {
|
||||||
|
if (data && data.success) {
|
||||||
|
window.location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alert((data && data.message) ? data.message : 'Loeschen fehlgeschlagen');
|
||||||
|
})
|
||||||
|
.catch(() => alert('Loeschen fehlgeschlagen'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindDeleteButtons() {
|
||||||
|
document.querySelectorAll('.js-delete-location').forEach((button) => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
handleLocationDelete(Number(button.dataset.locationId || 0));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('.js-delete-building').forEach((button) => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
handleBuildingDelete(Number(button.dataset.buildingId || 0));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('.js-delete-floor').forEach((button) => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
handleFloorDelete(Number(button.dataset.floorId || 0));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('.js-delete-room').forEach((button) => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
handleRoomDelete(Number(button.dataset.roomId || 0));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', bindDeleteButtons);
|
||||||
|
})();
|
||||||
@@ -53,7 +53,10 @@ $rooms = $sql->get(
|
|||||||
FROM rooms r
|
FROM rooms r
|
||||||
LEFT JOIN network_outlets no ON no.room_id = r.id
|
LEFT JOIN network_outlets no ON no.room_id = r.id
|
||||||
GROUP BY r.id
|
GROUP BY r.id
|
||||||
ORDER BY r.floor_id, r.name",
|
ORDER BY r.floor_id,
|
||||||
|
CASE WHEN r.number IS NULL OR r.number = '' THEN 1 ELSE 0 END,
|
||||||
|
r.number,
|
||||||
|
r.name",
|
||||||
'',
|
'',
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
@@ -75,10 +78,13 @@ foreach ($rooms as $room) {
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="locations-container">
|
<div class="locations-container">
|
||||||
|
<link rel="stylesheet" href="/assets/css/locations-list.css">
|
||||||
|
<script src="/assets/js/locations-list.js" defer></script>
|
||||||
|
|
||||||
<h1>Standorte</h1>
|
<h1>Standorte</h1>
|
||||||
|
|
||||||
<div class="filter-form">
|
<div class="filter-form">
|
||||||
<form method="GET" style="display: flex; gap: 10px; flex-wrap: wrap; align-items: center;">
|
<form method="GET" class="locations-filter-form">
|
||||||
<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">
|
||||||
|
|
||||||
@@ -87,7 +93,7 @@ foreach ($rooms as $room) {
|
|||||||
|
|
||||||
<button type="submit" class="button">Filter</button>
|
<button type="submit" class="button">Filter</button>
|
||||||
<a href="?module=locations&action=list" class="button">Reset</a>
|
<a href="?module=locations&action=list" class="button">Reset</a>
|
||||||
<a href="?module=locations&action=edit" class="button button-primary" style="margin-left: auto;">+ Neuer Standort</a>
|
<a href="?module=locations&action=edit" class="button button-primary locations-filter-add">+ Neuer Standort</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -109,7 +115,7 @@ foreach ($rooms as $room) {
|
|||||||
<td><small><?php echo htmlspecialchars((string)($location['comment'] ?? '')); ?></small></td>
|
<td><small><?php echo htmlspecialchars((string)($location['comment'] ?? '')); ?></small></td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a href="?module=locations&action=edit&id=<?php echo (int)$location['id']; ?>" class="button button-small">Bearbeiten</a>
|
<a href="?module=locations&action=edit&id=<?php echo (int)$location['id']; ?>" class="button button-small">Bearbeiten</a>
|
||||||
<a href="#" class="button button-small button-danger" onclick="confirmLocationDelete(<?php echo (int)$location['id']; ?>)">Loeschen</a>
|
<button type="button" class="button button-small button-danger js-delete-location" data-location-id="<?php echo (int)$location['id']; ?>">Loeschen</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -132,7 +138,8 @@ foreach ($rooms as $room) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Standort</th>
|
<th>Standort</th>
|
||||||
<th>Gebaeude</th>
|
<th>Gebaeude</th>
|
||||||
<th>Stockwerk / Raum</th>
|
<th>Stockwerk</th>
|
||||||
|
<th>Raum</th>
|
||||||
<th>Details</th>
|
<th>Details</th>
|
||||||
<th class="actions">Aktionen</th>
|
<th class="actions">Aktionen</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -141,7 +148,7 @@ foreach ($rooms as $room) {
|
|||||||
<?php foreach ($locations as $location): ?>
|
<?php foreach ($locations as $location): ?>
|
||||||
<?php $locationBuildings = $buildingsByLocation[(int)$location['id']] ?? []; ?>
|
<?php $locationBuildings = $buildingsByLocation[(int)$location['id']] ?? []; ?>
|
||||||
<tr class="hierarchy-row hierarchy-row--location">
|
<tr class="hierarchy-row hierarchy-row--location">
|
||||||
<td class="hierarchy-cell hierarchy-cell--location" colspan="3">
|
<td class="hierarchy-cell hierarchy-cell--location" colspan="4">
|
||||||
<strong><?php echo htmlspecialchars((string)$location['name']); ?></strong>
|
<strong><?php echo htmlspecialchars((string)$location['name']); ?></strong>
|
||||||
<span class="hierarchy-meta">(<?php echo (int)$location['building_count']; ?> Gebaeude)</span>
|
<span class="hierarchy-meta">(<?php echo (int)$location['building_count']; ?> Gebaeude)</span>
|
||||||
</td>
|
</td>
|
||||||
@@ -156,7 +163,7 @@ foreach ($rooms as $room) {
|
|||||||
<?php $buildingFloors = $floorsByBuilding[(int)$building['id']] ?? []; ?>
|
<?php $buildingFloors = $floorsByBuilding[(int)$building['id']] ?? []; ?>
|
||||||
<tr class="hierarchy-row hierarchy-row--building">
|
<tr class="hierarchy-row hierarchy-row--building">
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--building" colspan="2"><?php echo htmlspecialchars((string)$building['name']); ?></td>
|
<td class="hierarchy-cell hierarchy-cell--building" colspan="3"><?php echo htmlspecialchars((string)$building['name']); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if (!empty($building['comment'])): ?>
|
<?php if (!empty($building['comment'])): ?>
|
||||||
<span class="hierarchy-meta"><?php echo htmlspecialchars((string)$building['comment']); ?></span>
|
<span class="hierarchy-meta"><?php echo htmlspecialchars((string)$building['comment']); ?></span>
|
||||||
@@ -166,7 +173,7 @@ foreach ($rooms as $room) {
|
|||||||
</td>
|
</td>
|
||||||
<td class="actions hierarchy-actions">
|
<td class="actions hierarchy-actions">
|
||||||
<a href="?module=buildings&action=edit&id=<?php echo (int)$building['id']; ?>" class="button button-small">Bearbeiten</a>
|
<a href="?module=buildings&action=edit&id=<?php echo (int)$building['id']; ?>" class="button button-small">Bearbeiten</a>
|
||||||
<a href="#" class="button button-small button-danger" onclick="confirmBuildingDelete(<?php echo (int)$building['id']; ?>)">Loeschen</a>
|
<button type="button" class="button button-small button-danger js-delete-building" data-building-id="<?php echo (int)$building['id']; ?>">Loeschen</button>
|
||||||
<a href="?module=floors&action=edit&building_id=<?php echo (int)$building['id']; ?>" class="button button-small">+ Stockwerk</a>
|
<a href="?module=floors&action=edit&building_id=<?php echo (int)$building['id']; ?>" class="button button-small">+ Stockwerk</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -177,7 +184,7 @@ foreach ($rooms as $room) {
|
|||||||
<tr class="hierarchy-row hierarchy-row--floor">
|
<tr class="hierarchy-row hierarchy-row--floor">
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--floor"><?php echo htmlspecialchars((string)$floor['name']); ?></td>
|
<td class="hierarchy-cell hierarchy-cell--floor" colspan="2"><?php echo htmlspecialchars((string)$floor['name']); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($floor['level'] !== null): ?>
|
<?php if ($floor['level'] !== null): ?>
|
||||||
<span class="hierarchy-meta">Ebene <?php echo htmlspecialchars((string)$floor['level']); ?></span>
|
<span class="hierarchy-meta">Ebene <?php echo htmlspecialchars((string)$floor['level']); ?></span>
|
||||||
@@ -188,7 +195,7 @@ foreach ($rooms as $room) {
|
|||||||
</td>
|
</td>
|
||||||
<td class="actions hierarchy-actions">
|
<td class="actions hierarchy-actions">
|
||||||
<a href="?module=floors&action=edit&id=<?php echo (int)$floor['id']; ?>" class="button button-small">Bearbeiten</a>
|
<a href="?module=floors&action=edit&id=<?php echo (int)$floor['id']; ?>" class="button button-small">Bearbeiten</a>
|
||||||
<a href="#" class="button button-small button-danger" onclick="confirmFloorDelete(<?php echo (int)$floor['id']; ?>)">Loeschen</a>
|
<button type="button" class="button button-small button-danger js-delete-floor" data-floor-id="<?php echo (int)$floor['id']; ?>">Loeschen</button>
|
||||||
<a href="?module=rooms&action=edit&floor_id=<?php echo (int)$floor['id']; ?>" class="button button-small">+ Raum</a>
|
<a href="?module=rooms&action=edit&floor_id=<?php echo (int)$floor['id']; ?>" class="button button-small">+ Raum</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -196,6 +203,7 @@ foreach ($rooms as $room) {
|
|||||||
<?php if (!empty($floorRooms)): ?>
|
<?php if (!empty($floorRooms)): ?>
|
||||||
<?php foreach ($floorRooms as $room): ?>
|
<?php foreach ($floorRooms as $room): ?>
|
||||||
<tr class="hierarchy-row hierarchy-row--room">
|
<tr class="hierarchy-row hierarchy-row--room">
|
||||||
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--room">
|
<td class="hierarchy-cell hierarchy-cell--room">
|
||||||
@@ -212,7 +220,7 @@ foreach ($rooms as $room) {
|
|||||||
</td>
|
</td>
|
||||||
<td class="actions hierarchy-actions">
|
<td class="actions hierarchy-actions">
|
||||||
<a href="?module=rooms&action=edit&id=<?php echo (int)$room['id']; ?>" class="button button-small">Bearbeiten</a>
|
<a href="?module=rooms&action=edit&id=<?php echo (int)$room['id']; ?>" class="button button-small">Bearbeiten</a>
|
||||||
<a href="#" class="button button-small button-danger" onclick="confirmRoomDelete(<?php echo (int)$room['id']; ?>)">Loeschen</a>
|
<button type="button" class="button button-small button-danger js-delete-room" data-room-id="<?php echo (int)$room['id']; ?>">Loeschen</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -220,7 +228,7 @@ foreach ($rooms as $room) {
|
|||||||
<tr class="hierarchy-row hierarchy-row--empty">
|
<tr class="hierarchy-row hierarchy-row--empty">
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--room hierarchy-meta hierarchy-meta--muted">Keine Raeume</td>
|
<td class="hierarchy-cell hierarchy-cell--room hierarchy-meta hierarchy-meta--muted" colspan="2">Keine Raeume</td>
|
||||||
<td><span class="hierarchy-meta hierarchy-meta--muted">Fuer dieses Stockwerk sind noch keine Raeume angelegt.</span></td>
|
<td><span class="hierarchy-meta hierarchy-meta--muted">Fuer dieses Stockwerk sind noch keine Raeume angelegt.</span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -231,8 +239,7 @@ foreach ($rooms as $room) {
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<tr class="hierarchy-row hierarchy-row--empty">
|
<tr class="hierarchy-row hierarchy-row--empty">
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty"> </td>
|
<td class="hierarchy-cell hierarchy-cell--empty" colspan="3">Keine Gebaeude</td>
|
||||||
<td class="hierarchy-cell hierarchy-cell--empty">Keine Gebaeude</td>
|
|
||||||
<td><span class="hierarchy-meta hierarchy-meta--muted">Fuer diesen Standort sind noch keine Gebaeude vorhanden.</span></td>
|
<td><span class="hierarchy-meta hierarchy-meta--muted">Fuer diesen Standort sind noch keine Gebaeude vorhanden.</span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -244,233 +251,3 @@ foreach ($rooms as $room) {
|
|||||||
<p>Keine Standorte gefunden.</p>
|
<p>Keine Standorte gefunden.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<style>
|
|
||||||
.locations-container {
|
|
||||||
padding: 20px;
|
|
||||||
max-width: 1000px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 250px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.locations-list {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin: 15px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.locations-list th {
|
|
||||||
background: #f5f5f5;
|
|
||||||
padding: 12px;
|
|
||||||
text-align: left;
|
|
||||||
border-bottom: 2px solid #ddd;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.locations-list td {
|
|
||||||
padding: 12px;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.locations-list tr:hover {
|
|
||||||
background: #f9f9f9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 8px 12px;
|
|
||||||
background: #007bff;
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover {
|
|
||||||
background: #0056b3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-primary {
|
|
||||||
background: #28a745;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-primary:hover {
|
|
||||||
background: #218838;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-small {
|
|
||||||
padding: 4px 8px;
|
|
||||||
font-size: 0.85em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-danger {
|
|
||||||
background: #dc3545;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-danger:hover {
|
|
||||||
background: #c82333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-state {
|
|
||||||
text-align: center;
|
|
||||||
padding: 40px 20px;
|
|
||||||
background: #f9f9f9;
|
|
||||||
border: 1px solid #eee;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-section {
|
|
||||||
padding: 20px;
|
|
||||||
max-width: 1200px;
|
|
||||||
margin: 30px auto;
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-section h2 {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
font-size: 1.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: separate;
|
|
||||||
border-spacing: 0;
|
|
||||||
border: 1px solid #d8dee5;
|
|
||||||
border-radius: 10px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-table th {
|
|
||||||
background: #f3f6fa;
|
|
||||||
padding: 10px 12px;
|
|
||||||
text-align: left;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-weight: 600;
|
|
||||||
border-bottom: 1px solid #d8dee5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-table td {
|
|
||||||
padding: 9px 12px;
|
|
||||||
border-bottom: 1px solid #eef2f6;
|
|
||||||
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: 190px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-cell--room {
|
|
||||||
padding-left: 32px;
|
|
||||||
min-width: 190px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-cell--empty {
|
|
||||||
background: #fafbfd;
|
|
||||||
width: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-meta {
|
|
||||||
color: #4e5c6b;
|
|
||||||
font-size: 0.88rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-meta--muted {
|
|
||||||
color: #8a94a3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 6px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hierarchy-actions .button {
|
|
||||||
padding: 4px 10px;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function postDelete(url) {
|
|
||||||
return fetch(url, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
|
||||||
}).then((response) => response.json());
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmLocationDelete(id) {
|
|
||||||
if (!confirm('Diesen Standort wirklich loeschen?')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
postDelete('?module=locations&action=delete&id=' + encodeURIComponent(id))
|
|
||||||
.then((data) => {
|
|
||||||
if (data && data.success) {
|
|
||||||
window.location.reload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
alert((data && data.message) ? data.message : 'Loeschen fehlgeschlagen');
|
|
||||||
})
|
|
||||||
.catch(() => alert('Loeschen fehlgeschlagen'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmBuildingDelete(id) {
|
|
||||||
if (confirm('Dieses Gebaeude wirklich loeschen? Alle Stockwerke werden geloescht.')) {
|
|
||||||
alert('Loeschen noch nicht implementiert');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmFloorDelete(id) {
|
|
||||||
if (confirm('Dieses Stockwerk wirklich loeschen? Alle Raeume und Racks werden geloescht.')) {
|
|
||||||
alert('Loeschen noch nicht implementiert');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmRoomDelete(id) {
|
|
||||||
if (!confirm('Diesen Raum wirklich loeschen? Zugeordnete Dosen werden mitgeloescht.')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
postDelete('?module=rooms&action=delete&id=' + encodeURIComponent(id))
|
|
||||||
.then((data) => {
|
|
||||||
if (data && data.success) {
|
|
||||||
window.location.reload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
alert((data && data.message) ? data.message : 'Loeschen fehlgeschlagen');
|
|
||||||
})
|
|
||||||
.catch(() => alert('Loeschen fehlgeschlagen'));
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user