149 lines
8.4 KiB
PHP
149 lines
8.4 KiB
PHP
<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>
|
|
<h1>Buchung oder Auftrag für Kunden anlegen</h1>
|
|
</div>
|
|
<a class="button-secondary" href="<?= h(url('admin/buchungen')) ?>">Zurück zu den Buchungen</a>
|
|
</div>
|
|
|
|
<?php if (!empty($flashSuccess)): ?>
|
|
<div class="flash flash-success"><?= h((string) $flashSuccess) ?></div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($flashError)): ?>
|
|
<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']) ?>" 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>
|
|
<h3>Kundendaten und Zeitraum</h3>
|
|
</div>
|
|
<p class="form-help">Auch intern gilt: Montag bis Dienstag zählt als 1 Miettag.</p>
|
|
<div class="form-grid">
|
|
<label>
|
|
<span>Name</span>
|
|
<input type="text" name="customer_name" value="<?= h((string) ($old['customer_name'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Firma</span>
|
|
<input type="text" name="company" value="<?= h((string) ($old['company'] ?? '')) ?>">
|
|
</label>
|
|
<label>
|
|
<span>E-Mail</span>
|
|
<input type="email" name="email" value="<?= h((string) ($old['email'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Telefon</span>
|
|
<input type="text" name="phone" value="<?= h((string) ($old['phone'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Straße</span>
|
|
<input type="text" name="street" value="<?= h((string) ($old['street'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>PLZ</span>
|
|
<input type="text" name="postal_code" value="<?= h((string) ($old['postal_code'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Ort</span>
|
|
<input type="text" name="city" value="<?= h((string) ($old['city'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Anlass</span>
|
|
<input type="text" name="event_type" value="<?= h((string) ($old['event_type'] ?? '')) ?>">
|
|
</label>
|
|
<label class="form-grid-span">
|
|
<span>Veranstaltungsort</span>
|
|
<input type="text" name="event_location" value="<?= h((string) ($old['event_location'] ?? '')) ?>">
|
|
</label>
|
|
<label>
|
|
<span>Abholdatum</span>
|
|
<input type="date" name="start_date" data-booking-start value="<?= h((string) ($old['start_date'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Rückgabedatum</span>
|
|
<input type="date" name="end_date" data-booking-end value="<?= h((string) ($old['end_date'] ?? '')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Status</span>
|
|
<select name="status">
|
|
<option value="confirmed" <?= selected((string) ($old['status'] ?? $defaults['status']), 'confirmed') ?>>Bestätigt</option>
|
|
<option value="reserved" <?= selected((string) ($old['status'] ?? ''), 'reserved') ?>>Reserviert</option>
|
|
<option value="requested" <?= selected((string) ($old['status'] ?? ''), 'requested') ?>>Neue Anfrage</option>
|
|
<option value="cancelled" <?= selected((string) ($old['status'] ?? ''), 'cancelled') ?>>Storniert</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
<span>Zahlungsstatus</span>
|
|
<select name="payment_status">
|
|
<option value="unpaid" <?= selected((string) ($old['payment_status'] ?? $defaults['payment_status']), 'unpaid') ?>>Offen</option>
|
|
<option value="paid" <?= selected((string) ($old['payment_status'] ?? ''), 'paid') ?>>Bezahlt</option>
|
|
<option value="refunded" <?= selected((string) ($old['payment_status'] ?? ''), 'refunded') ?>>Erstattet</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
<span>Lieferart</span>
|
|
<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>
|
|
<span>Zahlungsart</span>
|
|
<select name="payment_method">
|
|
<option value="invoice_transfer" <?= selected((string) ($old['payment_method'] ?? $defaults['payment_method']), 'invoice_transfer') ?>>Rechnung / Überweisung</option>
|
|
<option value="paypal" <?= selected((string) ($old['payment_method'] ?? ''), 'paypal') ?>>PayPal</option>
|
|
</select>
|
|
</label>
|
|
<label class="form-grid-span">
|
|
<span>Hinweis für Kunden</span>
|
|
<textarea name="notes_customer" rows="4"><?= h((string) ($old['notes_customer'] ?? '')) ?></textarea>
|
|
</label>
|
|
<label class="form-grid-span">
|
|
<span>Interne Notiz</span>
|
|
<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">
|
|
<div class="summary-line">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit" class="button-primary">Buchung speichern</button>
|
|
</form>
|
|
</section>
|