reservation.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. require_once __DIR__ . '/config.php';
  3. require_once __DIR__ . '/includes/functions.php';
  4. $pageTitle = 'Reservierung bestätigt';
  5. $code = isset($_GET['code']) ? sanitize($_GET['code']) : '';
  6. $reservation = null;
  7. if ($code) {
  8. $reservation = getReservationByCode($code);
  9. }
  10. if (!$reservation) {
  11. header('Location: index.php');
  12. exit;
  13. }
  14. // Get product details for reservation items
  15. $items = [];
  16. foreach ($reservation['items'] as $item) {
  17. $product = getProductById($item['product_id']);
  18. if ($product) {
  19. $items[] = [
  20. 'product' => $product,
  21. 'quantity' => $item['quantity'],
  22. 'size' => isset($item['size']) ? $item['size'] : null
  23. ];
  24. }
  25. }
  26. include __DIR__ . '/includes/header.php';
  27. ?>
  28. <style media="print">
  29. header, footer, .btn, nav {
  30. display: none !important;
  31. }
  32. body {
  33. padding: 20px;
  34. }
  35. .reservation-code {
  36. page-break-inside: avoid;
  37. }
  38. table {
  39. page-break-inside: avoid;
  40. }
  41. </style>
  42. <div class="alert alert-success">
  43. <h2>Reservierung erfolgreich!</h2>
  44. <p>Vielen Dank für Ihre Reservierung, <?php echo htmlspecialchars($reservation['customer_name']); ?>.</p>
  45. </div>
  46. <div class="reservation-code">
  47. <h3>Ihr Abholcode:</h3>
  48. <h2><?php echo htmlspecialchars($reservation['code']); ?></h2>
  49. <p>Bitte notieren Sie sich diesen Code und zeigen Sie ihn bei der Abholung vor.</p>
  50. </div>
  51. <div style="background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin: 2rem 0;">
  52. <h3>Reservierungsdetails</h3>
  53. <p><strong>Reservierungsnummer:</strong> <?php echo htmlspecialchars($reservation['id']); ?></p>
  54. <p><strong>Name:</strong> <?php echo htmlspecialchars($reservation['customer_name']); ?></p>
  55. <p><strong>E-Mail:</strong> <?php echo htmlspecialchars($reservation['customer_email']); ?></p>
  56. <p><strong>Erstellt am:</strong> <?php echo formatDate($reservation['created']); ?></p>
  57. <p><strong>Gültig bis:</strong> <?php echo formatDate($reservation['expires']); ?></p>
  58. <h4 style="margin-top: 1.5rem;">Reservierte Artikel:</h4>
  59. <table style="margin-top: 1rem;">
  60. <thead>
  61. <tr>
  62. <th>Produkt</th>
  63. <?php if (array_filter($items, function($i) { return !empty($i['size']); })): ?>
  64. <th>Größe</th>
  65. <?php endif; ?>
  66. <th>Menge</th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. <?php foreach ($items as $item): ?>
  71. <tr>
  72. <td><?php echo htmlspecialchars($item['product']['name']); ?></td>
  73. <?php if (array_filter($items, function($i) { return !empty($i['size']); })): ?>
  74. <td><?php echo isset($item['size']) && !empty($item['size']) ? htmlspecialchars($item['size']) : '-'; ?></td>
  75. <?php endif; ?>
  76. <td><?php echo $item['quantity']; ?></td>
  77. </tr>
  78. <?php endforeach; ?>
  79. </tbody>
  80. </table>
  81. </div>
  82. <div class="alert alert-info">
  83. <p><strong>Wichtig:</strong> Bitte bringen Sie diesen Abholcode zur Abholung mit. Die Reservierung ist bis zum <?php echo formatDate($reservation['expires']); ?> gültig.</p>
  84. </div>
  85. <div style="text-align: center; margin-top: 2rem;">
  86. <button onclick="window.print()" class="btn">Reservierung drucken</button>
  87. <a href="index.php" class="btn btn-secondary" style="margin-left: 1rem;">Zurück zur Startseite</a>
  88. </div>
  89. <?php include __DIR__ . '/includes/footer.php'; ?>