drink-it-cold/views/booking_panel.php
torsten d47a72820d Uhrzeiten, Miete und Lieferkosten ergänzen; Server-Stand übernehmen
- bookings um optionale start_time/end_time sowie rent_cents und
  delivery_cents erweitert; Gesamtbetrag ist Miete + Lieferkosten
  (Migration 003, Schema und Doku nachgezogen)
- Formular, Detailansicht, Panel, Kalender und Kopiertext zeigen
  Uhrzeiten und die getrennten Beträge
- Live-Stand nachgezogen: Impressum/Datenschutz, Privacy-Cleanup im
  Cron-Lauf, Löschsperre für Buchungen mit Rechnung
- Cache-Buster auf Version 10 erhöht
2026-11-18 20:59:17 +01:00

94 lines
4.8 KiB
PHP
Raw 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 $canDelete */
$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']) ?> · <?= e($booking['trailer_color_name']) ?>
</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_name']) ?>
<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'] . ' · ' . $booking['trailer_color_name']) ?></dd></div>
<div><dt>Mitarbeiter</dt><dd><?= e($booking['employee_name']) ?></dd></div>
<div><dt>Art</dt><dd><?= e(booking_kind_label((string) $booking['kind'])) ?></dd></div>
<div><dt>Rechnung</dt><dd><?= e(booking_invoice_label($booking['invoice'])) ?></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 ($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 (!$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; ?>
</div>