Kalender: Standardansicht auf 4 Kalenderwochen ab aktueller KW umgestellt
This commit is contained in:
parent
b8fe34512d
commit
660cab1001
9 changed files with 38 additions and 25 deletions
|
|
@ -19,7 +19,7 @@ $canCreate = ($user['role'] ?? '') === 'admin';
|
|||
$cols = count($days);
|
||||
$laneWidth = 150;
|
||||
$minWidth = match ($view) {
|
||||
'week' => $laneWidth + 7 * 92,
|
||||
'weeks' => $laneWidth + $cols * 44,
|
||||
'month' => $laneWidth + $cols * 40,
|
||||
default => 0,
|
||||
};
|
||||
|
|
@ -41,7 +41,7 @@ $minWidth = match ($view) {
|
|||
<div class="cal-toolbar">
|
||||
<div class="cal-toolbar__left">
|
||||
<div class="segmented" role="group" aria-label="Ansicht">
|
||||
<?php foreach (['day' => 'Tag', 'week' => 'Woche', 'month' => 'Monat'] as $key => $label): ?>
|
||||
<?php foreach (['day' => 'Tag', 'weeks' => '4 Wochen', 'month' => 'Monat'] as $key => $label): ?>
|
||||
<a href="<?= e(url(calendar_url($date, $key, $employeeId, $showCancelled))) ?>"<?= $view === $key ? ' class="is-active" aria-current="page"' : '' ?>><?= $label ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
|
@ -94,7 +94,7 @@ $minWidth = match ($view) {
|
|||
</div>
|
||||
<div class="cal-head">
|
||||
<?php foreach ($days as $day): ?>
|
||||
<div class="cal-head__day<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?>">
|
||||
<div class="cal-head__day<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?><?= $day['is_week_start'] ? ' is-week-start' : '' ?>">
|
||||
<span class="cal-head__weekday"><?= e($day['weekday']) ?></span>
|
||||
<span class="cal-head__num"><?= (int) $day['day'] ?></span>
|
||||
<?php // Monat in jeder Tagesüberschrift, damit er auch in der Handy-Ansicht
|
||||
|
|
@ -103,6 +103,9 @@ $minWidth = match ($view) {
|
|||
<?php if ($view !== 'day' && $day['is_first_of_month']): ?>
|
||||
<span class="cal-head__year"><?= e(date_obj($day['iso'])->format('Y')) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ($view === 'weeks' && $day['is_week_start']): ?>
|
||||
<span class="cal-head__week">KW <?= e(date_obj($day['iso'])->format('W')) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
|
@ -123,13 +126,13 @@ $minWidth = match ($view) {
|
|||
<div class="cal-cells">
|
||||
<?php foreach ($days as $day): ?>
|
||||
<?php if ($canCreate): ?>
|
||||
<a class="cal-cell<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?>"
|
||||
<a class="cal-cell<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?><?= $day['is_week_start'] ? ' is-week-start' : '' ?>"
|
||||
href="<?= e(url('/bookings/new?trailer=' . (int) $trailer['id'] . '&start=' . $day['iso'] . '&end=' . $day['iso'])) ?>"
|
||||
data-cell="1"
|
||||
data-date="<?= e($day['iso']) ?>"
|
||||
aria-label="Neue Buchung <?= e($trailer['label']) ?> am <?= e(fmt_date($day['iso'])) ?>"></a>
|
||||
<?php else: ?>
|
||||
<span class="cal-cell<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?>"
|
||||
<span class="cal-cell<?= $day['is_today'] ? ' is-today' : '' ?><?= $day['is_weekend'] ? ' is-weekend' : '' ?><?= $day['is_week_start'] ? ' is-week-start' : '' ?>"
|
||||
data-cell="1"
|
||||
data-date="<?= e($day['iso']) ?>"></span>
|
||||
<?php endif; ?>
|
||||
|
|
@ -141,7 +144,7 @@ $minWidth = match ($view) {
|
|||
$geo = $bar['geo'];
|
||||
$cancelled = $booking['status'] === 'cancelled';
|
||||
$showMeta = $view === 'day' || $geo['span'] >= 2;
|
||||
$label = $view === 'month' ? truncate((string) $booking['customer_name'], 18) : (string) $booking['customer_name'];
|
||||
$label = in_array($view, ['month', 'weeks'], true) ? truncate((string) $booking['customer_name'], 18) : (string) $booking['customer_name'];
|
||||
$aria = $booking['customer_name'] . ', ' . $booking['trailer_label'] . ', '
|
||||
. fmt_date_with_time($booking['start_date'], $booking['start_time'] ?? null) . ' bis '
|
||||
. fmt_date_with_time($booking['end_date'], $booking['end_time'] ?? null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue