drink-it-cold/views/booking_panel.php
torsten 7e462d84a1 Kundenmail 26.11.: Feiertage NRW, Abwesenheitsfilter, Von/Bis-Automatik, Navigation, zweiter Mitarbeiter im Kalender, Bearbeitungsrechte, Bemerkungsfeld, Frei-bis
- Feiertage NRW im Kalender markiert (eigene Osterformel, keine Extra-Extension)
- Abwesenheiten: Zeitraeume 'Naechster Monat'/'Alle' plus Mitarbeiterfilter
- 'Bis' folgt 'Von' per data-date-pair; Kalender waehlt Zeitraum mit zwei Klicks
- Hauptnavigation: Uebersicht - Erinnerungen - Kalender - Abwesenheiten - Verwaltung
- Kalender zeigt abweichenden Ruecknahme-Mitarbeiter auch bei kurzen Buchungen
- Buchungen bearbeiten/verschieben fuer alle Mitarbeiter; Anlegen, Storno, Loeschen
  und Betraege/Rechnungsdaten bleiben beim Admin (serverseitig erzwungen)
- Bemerkungsfeld je Buchung (Migration 008_booking_note.sql, nicht im Kundentext)
- Uebersicht: 'Frei bis <Datum>' bei freien Anhaengern
2026-11-29 12:24:59 +01:00

107 lines
5.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/** @var array $booking */
/** @var array $reminders */
/** @var array $doneMap */
/** @var string $copyText */
/** @var bool $canCancel */
/** @var bool $isAdmin */
$cancelled = $booking['status'] === 'cancelled';
$lines = explode("\n", $copyText);
$due = due_cents((int) $booking['total_cents'], (int) $booking['deposit_cents']);
$bookingUrl = '/bookings/' . (int) $booking['id'];
$openReminder = null;
foreach ($reminders as $reminder) {
$key = reminder_done_key($booking, $reminder['kind'], $reminder['due_date']);
if (!isset($doneMap[$key]) && !$cancelled) {
$openReminder = $reminder;
break;
}
}
?>
<div class="panel-head">
<div class="panel-head__main">
<div class="panel-head__trailer">
<span class="trailer-dot" style="--trailer: <?= e($booking['trailer_color']) ?>"></span>
<?= e($booking['trailer_label']) ?>
</div>
<h2><?= e($booking['customer_name']) ?></h2>
<p>
<?= e(fmt_date_with_time($booking['start_date'], $booking['start_time'] ?? null)) ?>
– <?= e(fmt_date_with_time($booking['end_date'], $booking['end_time'] ?? null)) ?>
· <?= e(booking_employee_summary($booking)) ?>
<span class="pill <?= $cancelled ? 'pill--grey' : 'pill--green' ?>"><?= $cancelled ? 'storniert' : 'aktiv' ?></span>
</p>
</div>
<button class="icon-btn" type="button" data-close-dialog aria-label="Dialog schließen"><svg class="ico" aria-hidden="true"><use href="#i-close"/></svg></button>
</div>
<div class="panel-body">
<section class="panel-copy" data-copy-wrap>
<div class="panel-copy__head">
<h3>Buchungsinformation</h3>
<button class="btn small primary" type="button" data-copy>
<svg class="ico" aria-hidden="true"><use href="#i-copy"/></svg> Kopieren
</button>
</div>
<textarea class="copy-source" readonly aria-hidden="true" tabindex="-1"><?= e($copyText) ?></textarea>
<dl class="copy-list copy-list--compact">
<?php foreach ($lines as $line): ?>
<?php $parts = explode(': ', $line, 2); ?>
<div class="copy-list__row<?= ($parts[0] ?? '') === 'Noch zu zahlen' ? ' is-strong' : '' ?>">
<dt><?= e($parts[0] ?? $line) ?></dt>
<dd><?= e($parts[1] ?? '') ?></dd>
</div>
<?php endforeach; ?>
</dl>
</section>
<section class="panel-meta">
<dl class="meta-list meta-list--compact">
<div><dt>Anhänger</dt><dd><?= e($booking['trailer_label']) ?></dd></div>
<div><dt>Übergabe</dt><dd><?= e($booking['employee_name']) ?></dd></div>
<div><dt>Rücknahme</dt><dd><?= e(booking_return_employee_name($booking)) ?></dd></div>
<div><dt>Art</dt><dd><?= e(booking_kind_label((string) $booking['kind'])) ?></dd></div>
<div><dt>Rechnung</dt><dd><?= e(booking_invoice_display($booking)) ?></dd></div>
<div><dt>Miete</dt><dd><?= e(fmt_money((int) $booking['rent_cents'])) ?></dd></div>
<div><dt>Lieferkosten</dt><dd><?= e(fmt_money((int) $booking['delivery_cents'])) ?></dd></div>
<div><dt>Gesamt</dt><dd><?= e(fmt_money((int) $booking['total_cents'])) ?></dd></div>
<div><dt>Anzahlung</dt><dd><?= e(fmt_money((int) $booking['deposit_cents'])) ?></dd></div>
<div class="is-strong"><dt>Noch zu zahlen</dt><dd><?= e(fmt_money($due)) ?></dd></div>
</dl>
<?php if (trim((string) ($booking['note'] ?? '')) !== ''): ?>
<div class="next-reminder next-reminder--note">
<span>Bemerkung</span>
<p class="note-text"><?= nl2br(e((string) $booking['note'])) ?></p>
</div>
<?php endif; ?>
<?php if ($openReminder): ?>
<div class="next-reminder<?= $openReminder['due_date'] < today_iso() ? ' is-overdue' : '' ?>">
<span>Nächste Erinnerung</span>
<strong><?= e(fmt_date($openReminder['due_date'])) ?> · <?= e(relative_day($openReminder['due_date'])) ?></strong>
<p><?= e($openReminder['label']) ?></p>
</div>
<?php endif; ?>
</section>
</div>
<div class="panel-actions">
<a class="btn primary" href="<?= e(url($bookingUrl . '/edit')) ?>"><svg class="ico" aria-hidden="true"><use href="#i-edit"/></svg> Bearbeiten</a>
<a class="btn" href="<?= e(url($bookingUrl)) ?>">Vollständige Buchung</a>
<?php if (!empty($isAdmin)): ?>
<a class="btn" href="<?= e(url('/bookings/new')) ?>"><svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Neue Buchung</a>
<?php endif; ?>
<?php if (!empty($canCancel)): ?>
<?php if (!$cancelled): ?>
<form method="post" action="<?= e(url($bookingUrl . '/cancel')) ?>" data-confirm="Buchung von <?= e($booking['customer_name']) ?> wirklich stornieren?">
<?= csrf_field() ?>
<input type="hidden" name="return_to" value="<?= e($bookingUrl) ?>">
<button class="btn danger-ghost" type="submit">Stornieren</button>
</form>
<?php else: ?>
<form method="post" action="<?= e(url($bookingUrl . '/restore')) ?>" data-confirm="Buchung wieder aktivieren?">
<?= csrf_field() ?>
<button class="btn" type="submit">Wiederherstellen</button>
</form>
<?php endif; ?>
<?php endif; ?>
</div>