| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?php
- require_once __DIR__ . '/config.php';
- require_once __DIR__ . '/includes/functions.php';
- $pageTitle = 'Reservierung bestätigt';
- $orderNumber = isset($_GET['order_number']) ? sanitize($_GET['order_number']) : '';
- $backorderNumber = isset($_GET['backorder_number']) ? sanitize($_GET['backorder_number']) : '';
- $reservation = null;
- $backorderReservation = null;
- if ($orderNumber) {
- $reservation = getReservationByOrderNumber($orderNumber);
- }
- if ($backorderNumber) {
- $backorderReservation = getReservationByOrderNumber($backorderNumber);
- }
- if (!$reservation && !$backorderReservation) {
- header('Location: index.php');
- exit;
- }
- function buildReservationItems($reservation) {
- $items = [];
- foreach ($reservation['items'] as $item) {
- $product = getProductById($item['product_id']);
- if ($product) {
- $items[] = [
- 'product' => $product,
- 'quantity' => $item['quantity'],
- 'size' => isset($item['size']) ? $item['size'] : null
- ];
- }
- }
- return $items;
- }
- include __DIR__ . '/includes/header.php';
- ?>
- <style media="print">
- header, footer, .btn, nav {
- display: none !important;
- }
- body {
- padding: 20px;
- }
- .order-number {
- page-break-inside: avoid;
- }
- table {
- page-break-inside: avoid;
- }
- </style>
- <?php if ($reservation): ?>
- <?php $items = buildReservationItems($reservation); ?>
- <div class="alert alert-success">
- <h2>Reservierung erfolgreich!</h2>
- <p>Vielen Dank für Ihre Reservierung, <?php echo htmlspecialchars($reservation['customer_name']); ?>.</p>
- </div>
- <div class="order-number">
- <h3>Ihre Bestellnummer:</h3>
- <h2><?php echo htmlspecialchars($reservation['id']); ?></h2>
- <p>Bitte notieren Sie sich diese Bestellnummer und nennen Sie sie bei der Abholung.</p>
- </div>
- <div class="panel" style="padding: 2rem; margin: 2rem 0;">
- <h3>Reservierungsdetails</h3>
-
- <p><strong>Bestellnummer:</strong> <?php echo htmlspecialchars($reservation['id']); ?></p>
- <p><strong>Name:</strong> <?php echo htmlspecialchars($reservation['customer_name']); ?></p>
- <p><strong>E-Mail:</strong> <?php echo htmlspecialchars($reservation['customer_email']); ?></p>
- <p><strong>Erstellt am:</strong> <?php echo formatDate($reservation['created']); ?></p>
- <p><strong>Gültig bis:</strong> <?php echo formatDate($reservation['expires']); ?></p>
-
- <h4 style="margin-top: 1.5rem;">Reservierte Artikel:</h4>
- <table style="margin-top: 1rem;">
- <thead>
- <tr>
- <th>Produkt</th>
- <?php if (array_filter($items, function($i) { return !empty($i['size']); })): ?>
- <th>Größe</th>
- <?php endif; ?>
- <th>Menge</th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($items as $item): ?>
- <tr>
- <td><?php echo htmlspecialchars($item['product']['name']); ?></td>
- <?php if (array_filter($items, function($i) { return !empty($i['size']); })): ?>
- <td><?php echo isset($item['size']) && !empty($item['size']) ? htmlspecialchars($item['size']) : '-'; ?></td>
- <?php endif; ?>
- <td><?php echo $item['quantity']; ?></td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- </div>
- <div class="alert alert-info">
- <p><strong>Wichtig:</strong> Bitte nennen Sie die Bestellnummer bei der Abholung. Die Reservierung ist bis zum <?php echo formatDate($reservation['expires']); ?> gültig.</p>
- </div>
- <?php endif; ?>
- <?php if ($backorderReservation): ?>
- <?php $backorderItems = buildReservationItems($backorderReservation); ?>
- <div class="alert alert-warning" style="margin-top: 2rem;">
- <h2>Vorbestellung bestätigt</h2>
- <p>Vielen Dank für Ihre Vorbestellung, <?php echo htmlspecialchars($backorderReservation['customer_name']); ?>.</p>
- </div>
- <div class="order-number">
- <h3>Ihre Bestellnummer:</h3>
- <h2><?php echo htmlspecialchars($backorderReservation['id']); ?></h2>
- <p>Bitte notieren Sie sich diese Bestellnummer. Wir informieren Sie, sobald die komplette Vorbestellung zur Abholung bereit ist.</p>
- </div>
- <div class="panel" style="padding: 2rem; margin: 2rem 0;">
- <h3>Vorbestellungsdetails</h3>
-
- <p><strong>Bestellnummer:</strong> <?php echo htmlspecialchars($backorderReservation['id']); ?></p>
- <p><strong>Name:</strong> <?php echo htmlspecialchars($backorderReservation['customer_name']); ?></p>
- <p><strong>E-Mail:</strong> <?php echo htmlspecialchars($backorderReservation['customer_email']); ?></p>
- <p><strong>Erstellt am:</strong> <?php echo formatDate($backorderReservation['created']); ?></p>
-
- <h4 style="margin-top: 1.5rem;">Vorbestellte Artikel:</h4>
- <table style="margin-top: 1rem;">
- <thead>
- <tr>
- <th>Produkt</th>
- <?php if (array_filter($backorderItems, function($i) { return !empty($i['size']); })): ?>
- <th>Größe</th>
- <?php endif; ?>
- <th>Menge</th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($backorderItems as $item): ?>
- <tr>
- <td><?php echo htmlspecialchars($item['product']['name']); ?></td>
- <?php if (array_filter($backorderItems, function($i) { return !empty($i['size']); })): ?>
- <td><?php echo isset($item['size']) && !empty($item['size']) ? htmlspecialchars($item['size']) : '-'; ?></td>
- <?php endif; ?>
- <td><?php echo $item['quantity']; ?></td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- </div>
- <div class="alert alert-warning">
- <p><strong>Hinweis:</strong> Lieferzeiten sind nicht bekannt, da die Bestellung in Chargen erfolgt.</p>
- </div>
- <?php endif; ?>
- <div style="text-align: center; margin-top: 2rem;">
- <button onclick="window.print()" class="btn">Reservierung drucken</button>
- <a href="index.php" class="btn btn-secondary" style="margin-left: 1rem;">Zurück zur Startseite</a>
- </div>
- <?php include __DIR__ . '/includes/footer.php'; ?>
|