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; ?>