2026-11-13 00:35:39 +01:00
|
|
|
|
<?php
|
|
|
|
|
|
/** @var string $today */
|
|
|
|
|
|
/** @var array $trailers */
|
|
|
|
|
|
/** @var array $roadmap */
|
|
|
|
|
|
/** @var array $upcoming */
|
|
|
|
|
|
/** @var array $reminders */
|
|
|
|
|
|
/** @var int $openReminderCount */
|
|
|
|
|
|
/** @var int $handoverCount */
|
|
|
|
|
|
/** @var int $employeeScope */
|
2026-11-19 10:48:32 +01:00
|
|
|
|
/** @var array $user */
|
|
|
|
|
|
$canCreate = ($user['role'] ?? '') === 'admin';
|
2026-11-18 21:41:32 +01:00
|
|
|
|
$rentedTrailers = 0;
|
|
|
|
|
|
$rentedChests = 0;
|
2026-11-18 21:40:18 +01:00
|
|
|
|
$freeTrailers = 0;
|
|
|
|
|
|
$freeChests = 0;
|
|
|
|
|
|
$totalTrailers = 0;
|
|
|
|
|
|
$totalChests = 0;
|
2026-11-13 00:35:39 +01:00
|
|
|
|
foreach ($roadmap as $row) {
|
2026-11-18 21:40:18 +01:00
|
|
|
|
$isChest = trailer_is_chest($row['trailer']);
|
|
|
|
|
|
if ($isChest) {
|
|
|
|
|
|
$totalChests++;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$totalTrailers++;
|
|
|
|
|
|
}
|
2026-11-13 00:35:39 +01:00
|
|
|
|
if ($row['bookings']) {
|
2026-11-18 21:41:32 +01:00
|
|
|
|
if ($isChest) {
|
|
|
|
|
|
$rentedChests++;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$rentedTrailers++;
|
|
|
|
|
|
}
|
2026-11-18 21:40:18 +01:00
|
|
|
|
} elseif ($isChest) {
|
|
|
|
|
|
$freeChests++;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$freeTrailers++;
|
2026-11-13 00:35:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$isEmployeeView = $employeeScope > 0;
|
|
|
|
|
|
?>
|
|
|
|
|
|
<div class="page-head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<p class="eyebrow"><?= e(fmt_date_long($today)) ?></p>
|
|
|
|
|
|
<h1><?= e(greeting()) ?><?= isset($user) ? ', ' . e($user['first_name']) : '' ?></h1>
|
|
|
|
|
|
<p class="page-head__lede">Was heute ansteht – und wer sich um welche Übergabe kümmert.</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="page-head__actions">
|
2026-11-18 21:45:10 +01:00
|
|
|
|
<a class="btn" href="<?= e(url('/availability')) ?>">
|
|
|
|
|
|
<svg class="ico" aria-hidden="true"><use href="#i-search"/></svg> Verfügbarkeit
|
|
|
|
|
|
</a>
|
2026-11-19 10:48:32 +01:00
|
|
|
|
<?php if ($canCreate): ?>
|
|
|
|
|
|
<a class="btn primary" href="<?= e(url('/bookings/new')) ?>">
|
|
|
|
|
|
<svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Neue Buchung
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php endif; ?>
|
2026-11-13 00:35:39 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="kpi-grid" aria-label="Kennzahlen">
|
|
|
|
|
|
<article class="kpi">
|
|
|
|
|
|
<span class="kpi__icon kpi__icon--blue"><svg class="ico" aria-hidden="true"><use href="#i-truck"/></svg></span>
|
2026-11-18 21:41:32 +01:00
|
|
|
|
<div><strong><?= $rentedTrailers ?> von <?= $totalTrailers ?></strong><span>Vermietete Anhänger</span></div>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
<article class="kpi">
|
|
|
|
|
|
<span class="kpi__icon kpi__icon--blue"><svg class="ico" aria-hidden="true"><use href="#i-snow"/></svg></span>
|
|
|
|
|
|
<div><strong><?= $rentedChests ?> von <?= $totalChests ?></strong><span>Vermietete Truhen</span></div>
|
2026-11-13 00:35:39 +01:00
|
|
|
|
</article>
|
|
|
|
|
|
<article class="kpi">
|
|
|
|
|
|
<span class="kpi__icon kpi__icon--green"><svg class="ico" aria-hidden="true"><use href="#i-check"/></svg></span>
|
2026-11-18 21:40:18 +01:00
|
|
|
|
<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>
|
2026-11-13 00:35:39 +01:00
|
|
|
|
</article>
|
|
|
|
|
|
<article class="kpi">
|
|
|
|
|
|
<span class="kpi__icon kpi__icon--amber"><svg class="ico" aria-hidden="true"><use href="#i-clock"/></svg></span>
|
|
|
|
|
|
<div><strong><?= $handoverCount ?></strong><span>Übergaben (7 Tage)</span></div>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
<article class="kpi">
|
|
|
|
|
|
<span class="kpi__icon kpi__icon--red"><svg class="ico" aria-hidden="true"><use href="#i-bell"/></svg></span>
|
|
|
|
|
|
<div><strong><?= $openReminderCount ?></strong><span>Offene Erinnerungen</span></div>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="dash-grid">
|
|
|
|
|
|
<div class="dash-main">
|
|
|
|
|
|
<section class="panel">
|
|
|
|
|
|
<div class="panel__head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2>Heute im Einsatz</h2>
|
2026-11-13 01:19:05 +01:00
|
|
|
|
<p>Alle Anhänger auf einen Blick<?= $isEmployeeView ? ' – mit Ihren Buchungen hervorgehoben' : '' ?>.</p>
|
2026-11-13 00:35:39 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
<a class="link-arrow" href="<?= e(url('/calendar?view=day')) ?>">Tagesansicht <svg class="ico" aria-hidden="true"><use href="#i-right"/></svg></a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="trailer-grid">
|
|
|
|
|
|
<?php foreach ($roadmap as $row): ?>
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$trailer = $row['trailer'];
|
|
|
|
|
|
$bookings = $row['bookings'];
|
|
|
|
|
|
$own = false;
|
|
|
|
|
|
foreach ($bookings as $b) {
|
|
|
|
|
|
if ($isEmployeeView && (int) $b['employee_id'] === $employeeScope) {
|
|
|
|
|
|
$own = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
<article class="trailer-card<?= $bookings ? ' is-rented' : ' is-free' ?><?= $own ? ' is-own' : '' ?>"
|
|
|
|
|
|
style="--trailer: <?= e($trailer['color_hex']) ?>; --trailer-text: <?= e(contrast_color($trailer['color_hex'])) ?>">
|
|
|
|
|
|
<div class="trailer-card__head">
|
|
|
|
|
|
<span class="trailer-dot"></span>
|
|
|
|
|
|
<div class="trailer-card__name">
|
|
|
|
|
|
<strong><?= e($trailer['label']) ?></strong>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span class="pill <?= $bookings ? 'pill--red' : 'pill--green' ?>"><?= $bookings ? 'vermietet' : 'frei' ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php if ($bookings): ?>
|
|
|
|
|
|
<ul class="trailer-card__bookings">
|
|
|
|
|
|
<?php foreach ($bookings as $booking): ?>
|
|
|
|
|
|
<li>
|
|
|
|
|
|
<a href="<?= e(url('/bookings/' . (int) $booking['id'])) ?>" data-panel="<?= (int) $booking['id'] ?>">
|
|
|
|
|
|
<strong><?= e($booking['customer_name']) ?></strong>
|
|
|
|
|
|
<span><?= e(fmt_date_range($booking['start_date'], $booking['end_date'])) ?> · <?= e($booking['employee_name']) ?></span>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
|
<p class="trailer-card__free">Frei – neue Buchung möglich.</p>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="panel">
|
|
|
|
|
|
<div class="panel__head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2>Nächste Übergaben & Rücknahmen</h2>
|
|
|
|
|
|
<p>Die kommenden 14 Tage.</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<a class="link-arrow" href="<?= e(url('/calendar')) ?>">Im Kalender <svg class="ico" aria-hidden="true"><use href="#i-right"/></svg></a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php if (!$upcoming): ?>
|
|
|
|
|
|
<div class="empty-state">
|
|
|
|
|
|
<svg class="ico" aria-hidden="true"><use href="#i-calendar"/></svg>
|
|
|
|
|
|
<h3>Keine Übergaben in den nächsten zwei Wochen</h3>
|
|
|
|
|
|
<p>Neue Buchungen erscheinen hier automatisch mit Übergabe- und Rücknahmetermin.</p>
|
2026-11-19 10:48:32 +01:00
|
|
|
|
<?php if ($canCreate): ?>
|
|
|
|
|
|
<a class="btn primary" href="<?= e(url('/bookings/new')) ?>">Buchung anlegen</a>
|
|
|
|
|
|
<?php endif; ?>
|
2026-11-13 00:35:39 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
|
<ul class="event-list">
|
|
|
|
|
|
<?php foreach ($upcoming as $event): ?>
|
|
|
|
|
|
<?php $b = $event['booking']; ?>
|
|
|
|
|
|
<li class="event-row">
|
|
|
|
|
|
<span class="event-row__icon <?= $event['type'] === 'handover' ? 'is-handover' : 'is-return' ?>">
|
|
|
|
|
|
<svg class="ico" aria-hidden="true"><use href="#<?= $event['type'] === 'handover' ? 'i-truck' : 'i-return' ?>"/></svg>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<div class="event-row__date">
|
|
|
|
|
|
<strong><?= e(fmt_weekday_short($event['date'])) ?>, <?= e(fmt_date($event['date'])) ?></strong>
|
|
|
|
|
|
<span class="<?= $event['date'] === $today ? 'is-today' : '' ?>"><?= e(relative_day($event['date'])) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="event-row__main">
|
|
|
|
|
|
<strong><?= e($b['customer_name']) ?></strong>
|
|
|
|
|
|
<span><?= $event['type'] === 'handover' ? 'Übergabe' : 'Rücknahme' ?> · <?= e($b['trailer_label']) ?> · <?= e($b['employee_name']) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<a class="btn small" href="<?= e(url('/bookings/' . (int) $b['id'])) ?>" data-panel="<?= (int) $b['id'] ?>">Details</a>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<aside class="dash-side">
|
|
|
|
|
|
<section class="panel panel--reminders">
|
|
|
|
|
|
<div class="panel__head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2>Erinnerungen</h2>
|
|
|
|
|
|
<p>Fällig bis <?= e(fmt_date(add_days($today, 7))) ?>.</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<a class="link-arrow" href="<?= e(url('/reminders')) ?>">Alle <svg class="ico" aria-hidden="true"><use href="#i-right"/></svg></a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php if (($user['role'] ?? '') !== 'admin' && $employeeScope === 0): ?>
|
|
|
|
|
|
<div class="empty-state small"><p>Ihrem Konto ist noch kein Mitarbeiter zugeordnet.</p></div>
|
|
|
|
|
|
<?php elseif (!$reminders): ?>
|
|
|
|
|
|
<div class="empty-state small">
|
|
|
|
|
|
<svg class="ico" aria-hidden="true"><use href="#i-check"/></svg>
|
|
|
|
|
|
<h3>Alles erledigt</h3>
|
|
|
|
|
|
<p>Keine offenen Erinnerungen in den nächsten Tagen.</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
|
<ul class="mini-reminders">
|
|
|
|
|
|
<?php foreach ($reminders as $reminder): ?>
|
|
|
|
|
|
<?php $b = $reminder['booking']; $overdue = $reminder['due_date'] < $today; ?>
|
|
|
|
|
|
<li class="mini-reminder<?= $overdue ? ' is-overdue' : '' ?>">
|
|
|
|
|
|
<div class="mini-reminder__top">
|
|
|
|
|
|
<span class="mini-reminder__date"><?= e(fmt_date($reminder['due_date'])) ?></span>
|
|
|
|
|
|
<span class="pill <?= $overdue ? 'pill--red' : 'pill--blue' ?>"><?= e(relative_day($reminder['due_date'])) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<strong><?= e($reminder['label']) ?></strong>
|
|
|
|
|
|
<p><?= e($reminder['message']) ?></p>
|
|
|
|
|
|
<div class="mini-reminder__meta">
|
|
|
|
|
|
<span><?= e($b['customer_name']) ?> · <?= e($b['trailer_label']) ?></span>
|
|
|
|
|
|
<span><?= e($b['employee_name']) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mini-reminder__actions">
|
|
|
|
|
|
<a href="<?= e(url('/bookings/' . (int) $b['id'])) ?>" data-panel="<?= (int) $b['id'] ?>">Buchung öffnen</a>
|
|
|
|
|
|
<form method="post" action="<?= e(url('/reminders/done')) ?>">
|
|
|
|
|
|
<?= csrf_field() ?>
|
|
|
|
|
|
<input type="hidden" name="booking_id" value="<?= (int) $b['id'] ?>">
|
|
|
|
|
|
<input type="hidden" name="kind" value="<?= e($reminder['kind']) ?>">
|
|
|
|
|
|
<input type="hidden" name="done" value="1">
|
|
|
|
|
|
<input type="hidden" name="return_to" value="/">
|
|
|
|
|
|
<button class="link-button" type="submit"><svg class="ico" aria-hidden="true"><use href="#i-check"/></svg> Erledigt</button>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="panel panel--quick">
|
|
|
|
|
|
<h2>Kurz zugreifen</h2>
|
2026-11-19 10:48:32 +01:00
|
|
|
|
<?php if ($canCreate): ?>
|
|
|
|
|
|
<a class="quick-link" href="<?= e(url('/bookings/new')) ?>">
|
|
|
|
|
|
<span class="quick-link__icon"><svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg></span>
|
|
|
|
|
|
<span><strong>Neue Buchung</strong><small>Zeitraum und Kunde erfassen</small></span>
|
|
|
|
|
|
<svg class="ico chev" aria-hidden="true"><use href="#i-right"/></svg>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php endif; ?>
|
2026-11-13 00:35:39 +01:00
|
|
|
|
<a class="quick-link" href="<?= e(url('/search')) ?>">
|
|
|
|
|
|
<span class="quick-link__icon"><svg class="ico" aria-hidden="true"><use href="#i-search"/></svg></span>
|
|
|
|
|
|
<span><strong>Kunde suchen</strong><small>Buchung nach Name finden</small></span>
|
|
|
|
|
|
<svg class="ico chev" aria-hidden="true"><use href="#i-right"/></svg>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<a class="quick-link" href="<?= e(url('/reminders?range=all')) ?>">
|
|
|
|
|
|
<span class="quick-link__icon"><svg class="ico" aria-hidden="true"><use href="#i-bell"/></svg></span>
|
|
|
|
|
|
<span><strong>Alle Erinnerungen</strong><small>Offene Aufgaben prüfen</small></span>
|
|
|
|
|
|
<svg class="ico chev" aria-hidden="true"><use href="#i-right"/></svg>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
</div>
|