feat(calendar): Buchungsnummer im Kalenderbalken

Jeder Balken beginnt mit '#<id>' (Monats-/Wochenansicht mit gekürztem Namen,
Tagesansicht mit vollem Namen), der Tooltip startet mit der Nummer und das
aria-label sagt 'Buchung #148, …'. Anleitung und README ergänzt, ROADMAP
Feature 23.
This commit is contained in:
torsten 2026-11-30 16:49:07 +01:00
parent 6daecf7d41
commit 2fd9b1d226
4 changed files with 16 additions and 5 deletions

View file

@ -184,7 +184,12 @@ $minWidth = match ($view) {
// Buchungen zeigen – die Zeile/Spalte wird dafür höher.
$separateReturn = booking_has_separate_return($booking);
$showMeta = $view === 'day' || $geo['span'] >= 2 || $separateReturn;
$label = in_array($view, ['month', 'weeks'], true) ? truncate((string) $booking['customer_name'], 18) : (string) $booking['customer_name'];
// Buchungsnummer immer sichtbar, Name dahinter (in Monats-
// und Wochenansicht gekürzt).
$number = '#' . (int) $booking['id'];
$label = $number . ' ' . (in_array($view, ['month', 'weeks'], true)
? truncate((string) $booking['customer_name'], 15)
: (string) $booking['customer_name']);
$barClass = 'cal-bar'
. ($cancelled ? ' is-cancelled' : '')
. (!empty($bar['absent']) && $booking['status'] !== 'cancelled' ? ' is-absent-conflict' : '')
@ -192,7 +197,7 @@ $minWidth = match ($view) {
. ($geo['cut_end'] ? ' is-cut-end' : '')
. ($geo['span'] <= 1 ? ' is-tiny' : '')
. ($showMeta ? ' has-meta' : '');
$aria = $booking['customer_name'] . ', ' . $booking['trailer_label'] . ', '
$aria = 'Buchung ' . $number . ', ' . $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)
. ', ' . booking_employee_summary($booking) . ($cancelled ? ', storniert' : '');
@ -208,7 +213,7 @@ $minWidth = match ($view) {
data-days="<?= days_between($booking['start_date'], $booking['end_date']) + 1 ?>"
style="--left: <?= number_format($geo['left'], 5, '.', '') ?>%; --width: <?= number_format($geo['width'], 5, '.', '') ?>%; --top: <?= number_format($geo['top'], 5, '.', '') ?>%; --height: <?= number_format($geo['height'], 5, '.', '') ?>%; --bar: <?= e($booking['trailer_color']) ?>; --bar-text: <?= e(contrast_color($booking['trailer_color'])) ?>;"
aria-label="<?= e($aria) ?>"
title="<?= e($booking['customer_name'] . ' · ' . fmt_date_with_time($booking['start_date'], $booking['start_time'] ?? null) . ' – ' . fmt_date_with_time($booking['end_date'], $booking['end_time'] ?? null) . ' · ' . booking_employee_summary($booking) . ($cancelled ? ' · storniert' : '')) ?>">
title="<?= e($number . ' · ' . $booking['customer_name'] . ' · ' . fmt_date_with_time($booking['start_date'], $booking['start_time'] ?? null) . ' – ' . fmt_date_with_time($booking['end_date'], $booking['end_time'] ?? null) . ' · ' . booking_employee_summary($booking) . ($cancelled ? ' · storniert' : '')) ?>">
<span class="cal-bar__name"><?= e($label) ?></span>
<?php if ($view === 'day'): ?>
<span class="cal-bar__meta"><?= e(fmt_date_with_time($booking['start_date'], $booking['start_time'] ?? null) . ' – ' . fmt_date_with_time($booking['end_date'], $booking['end_time'] ?? null)) ?> · <?= e(booking_employee_summary($booking)) ?></span>