From 5caec63bf3aef743e5cf218232975a2b75c447e4 Mon Sep 17 00:00:00 2001 From: torsten Date: Wed, 18 Nov 2026 21:40:18 +0100 Subject: [PATCH] =?UTF-8?q?=C3=9Cbersicht:=20freie=20Anh=C3=A4nger=20und?= =?UTF-8?q?=20freie=20Truhen=20getrennt=20ausweisen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit „Heute frei" war eine Summe aus Anhängern und Truhen. Jetzt zwei Kennzahlen: „Freie Anhänger x von y" und „Freie Truhen x von y". Truhen erkennt die App an der Bezeichnung (Präfix „Truhe"). - KPI-Raster auf auto-fit umgestellt, damit fünf Karten passen - Cache-Buster auf Version 13 --- app/data.php | 6 ++++++ app/util.php | 2 +- views/dashboard.php | 21 +++++++++++++++++++-- web/assets/app.css | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/data.php b/app/data.php index a3b79ed..96e2f1f 100644 --- a/app/data.php +++ b/app/data.php @@ -20,6 +20,12 @@ function trailers_map(bool $activeOnly = false): array return $out; } +/** Truhen erkennt die App an der Bezeichnung ("Truhe", "Truhe 1", "Truhe 2 (verschrottet)"). */ +function trailer_is_chest(array $trailer): bool +{ + return mb_stripos(trim((string) $trailer['label']), 'truhe') === 0; +} + function trailer_find(int $id): ?array { $stmt = db()->prepare('SELECT * FROM trailers WHERE id = ?'); diff --git a/app/util.php b/app/util.php index a39c679..b2f2847 100644 --- a/app/util.php +++ b/app/util.php @@ -89,7 +89,7 @@ function url(string $path = '/'): string } /** Cache-Buster: bei Änderungen an app.css/app.js erhöhen. */ -const DIC_ASSET_VERSION = '12'; +const DIC_ASSET_VERSION = '13'; function asset(string $path): string { diff --git a/views/dashboard.php b/views/dashboard.php index cd7b214..b356d8b 100644 --- a/views/dashboard.php +++ b/views/dashboard.php @@ -8,12 +8,25 @@ /** @var int $handoverCount */ /** @var int $employeeScope */ $rentedToday = 0; +$freeTrailers = 0; +$freeChests = 0; +$totalTrailers = 0; +$totalChests = 0; foreach ($roadmap as $row) { + $isChest = trailer_is_chest($row['trailer']); + if ($isChest) { + $totalChests++; + } else { + $totalTrailers++; + } if ($row['bookings']) { $rentedToday++; + } elseif ($isChest) { + $freeChests++; + } else { + $freeTrailers++; } } -$freeToday = count($trailers) - $rentedToday; $isEmployeeView = $employeeScope > 0; ?>
@@ -39,7 +52,11 @@ $isEmployeeView = $employeeScope > 0;
-
Heute frei
+
von Freie Anhänger
+
+
+ +
von Freie Truhen
diff --git a/web/assets/app.css b/web/assets/app.css index 0aaebae..17d0cbe 100644 --- a/web/assets/app.css +++ b/web/assets/app.css @@ -324,7 +324,7 @@ a .ico, button .ico { pointer-events: none; } .list-summary { font-size: .84rem; color: var(--muted); margin: -4px 0 16px; } /* --------------------------------------------------------------- KPI + Dashboard */ -.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; } +.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; } .kpi { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);