Buchungskalender eingefügt

This commit is contained in:
2026-05-05 19:18:05 +02:00
parent 4a4517c514
commit c1f07343e3
21 changed files with 931 additions and 187 deletions
+27 -10
View File
@@ -1,4 +1,10 @@
<section class="admin-section narrow-section">
<?php
$priceRates = [];
foreach ($deliveryZoneOptions as $zoneKey => $zone) {
$priceRates[$zoneKey] = (int) $zone['price_cents'];
}
?>
<div class="section-header">
<div>
<p class="eyebrow">Manuelle Buchung</p>
@@ -14,8 +20,9 @@
<div class="flash flash-error"><?= h((string) $flashError) ?></div>
<?php endif; ?>
<form method="post" action="<?= h(url('admin/create')) ?>" class="booking-form admin-form" data-day-rate="<?= h((string) $defaults['price_per_day_cents']) ?>">
<form method="post" action="<?= h(url('admin/create')) ?>" class="booking-form admin-form" data-day-rate="<?= h((string) $defaults['price_per_day_cents']) ?>" data-price-rates="<?= h((string) json_encode($priceRates, JSON_THROW_ON_ERROR)) ?>">
<?= csrfField() ?>
<input type="hidden" name="price_per_day_cents" value="<?= h((string) ($old['price_per_day_cents'] ?? $defaults['price_per_day_cents'])) ?>">
<div class="form-section">
<div class="form-section-header">
<span class="form-step">Verwaltung</span>
@@ -67,10 +74,6 @@
<span>Rückgabedatum</span>
<input type="date" name="end_date" data-booking-end value="<?= h((string) ($old['end_date'] ?? '')) ?>" required>
</label>
<label>
<span>Preis pro Miettag in Cent</span>
<input type="number" name="price_per_day_cents" min="0" value="<?= h((string) ($old['price_per_day_cents'] ?? $defaults['price_per_day_cents'])) ?>" required>
</label>
<label>
<span>Status</span>
<select name="status">
@@ -90,10 +93,20 @@
</label>
<label>
<span>Lieferart</span>
<select name="delivery_mode">
<option value="self_pickup" <?= selected((string) ($old['delivery_mode'] ?? $defaults['delivery_mode']), 'self_pickup') ?>>Selbstabholung</option>
<option value="delivery_setup" <?= selected((string) ($old['delivery_mode'] ?? ''), 'delivery_setup') ?>>Lieferung und Aufbau</option>
<option value="on_site_support" <?= selected((string) ($old['delivery_mode'] ?? ''), 'on_site_support') ?>>Lieferung, Aufbau und Vor-Ort-Betreuung</option>
<select name="delivery_mode" data-delivery-mode>
<?php foreach ($deliveryModeOptions as $value => $label): ?>
<option value="<?= h($value) ?>" <?= selected((string) ($old['delivery_mode'] ?? $defaults['delivery_mode']), $value) ?>><?= h($label) ?></option>
<?php endforeach; ?>
</select>
</label>
<label>
<span>Liefergebiet</span>
<select name="delivery_zone" data-delivery-zone>
<?php foreach ($deliveryZoneOptions as $value => $zone): ?>
<option value="<?= h($value) ?>" <?= selected((string) ($old['delivery_zone'] ?? $defaults['delivery_zone']), $value) ?>>
<?= h($zone['label']) ?> · <?= h(formatCurrency((int) $zone['price_cents'])) ?>
</option>
<?php endforeach; ?>
</select>
</label>
<label>
@@ -112,6 +125,7 @@
<textarea name="internal_notes" rows="4"><?= h((string) ($old['internal_notes'] ?? '')) ?></textarea>
</label>
</div>
<p class="form-help">Preislogik: Abholung <?= h(formatCurrency((int) $deliveryZoneOptions['self_pickup']['price_cents'])) ?>, Hannover <?= h(formatCurrency((int) $deliveryZoneOptions['hannover']['price_cents'])) ?>, Region Hannover <?= h(formatCurrency((int) $deliveryZoneOptions['region_hannover']['price_cents'])) ?>, Hameln/Braunschweig/Hildesheim/Celle <?= h(formatCurrency((int) $deliveryZoneOptions['extended_region']['price_cents'])) ?> pro Miettag.</p>
</div>
<div class="booking-summary-card">
@@ -119,6 +133,10 @@
<span>Mietdauer</span>
<strong data-summary-days>Noch nicht gewählt</strong>
</div>
<div class="summary-line">
<span>Preis pro Miettag</span>
<strong data-summary-rate><?= h(formatCurrency((int) ($old['price_per_day_cents'] ?? $defaults['price_per_day_cents']))) ?></strong>
</div>
<div class="summary-line summary-line-total">
<span>Gesamtpreis</span>
<strong data-summary-total><?= h(formatCurrency((int) $defaults['price_per_day_cents'])) ?></strong>
@@ -128,4 +146,3 @@
<button type="submit" class="button-primary">Buchung speichern</button>
</form>
</section>
+1 -1
View File
@@ -28,6 +28,7 @@
<div><dt>Mietzeitraum</dt><dd><?= h(formatDate($booking['start_date'])) ?> bis <?= h(formatDate($booking['end_date'])) ?></dd></div>
<div><dt>Miettage</dt><dd><?= h((string) $booking['total_days']) ?></dd></div>
<div><dt>Leistung</dt><dd><?= h($booking['delivery_mode_label']) ?></dd></div>
<div><dt>Liefergebiet</dt><dd><?= h($booking['delivery_zone_label'] ?? '-') ?></dd></div>
<div><dt>Zahlungsart</dt><dd><?= h($booking['payment_method_label']) ?></dd></div>
<div><dt>Gesamt</dt><dd><?= h(formatCurrency((int) $booking['subtotal_cents'])) ?></dd></div>
</dl>
@@ -106,4 +107,3 @@
</article>
</div>
</section>