Übersicht: freie Anhänger und freie Truhen getrennt ausweisen

„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
This commit is contained in:
torsten 2026-11-18 21:40:18 +01:00
parent c89b20b95b
commit 5caec63bf3
4 changed files with 27 additions and 4 deletions

View file

@ -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 = ?');

View file

@ -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
{

View file

@ -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;
?>
<div class="page-head">
@ -39,7 +52,11 @@ $isEmployeeView = $employeeScope > 0;
</article>
<article class="kpi">
<span class="kpi__icon kpi__icon--green"><svg class="ico" aria-hidden="true"><use href="#i-check"/></svg></span>
<div><strong><?= $freeToday ?></strong><span>Heute frei</span></div>
<div><strong><?= $freeTrailers ?> von <?= $totalTrailers ?></strong><span>Freie Anhänger</span></div>
</article>
<article class="kpi">
<span class="kpi__icon kpi__icon--green"><svg class="ico" aria-hidden="true"><use href="#i-snow"/></svg></span>
<div><strong><?= $freeChests ?> von <?= $totalChests ?></strong><span>Freie Truhen</span></div>
</article>
<article class="kpi">
<span class="kpi__icon kpi__icon--amber"><svg class="ico" aria-hidden="true"><use href="#i-clock"/></svg></span>

View file

@ -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);