| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- require_once __DIR__ . '/config.php';
- require_once __DIR__ . '/includes/functions.php';
- $pageTitle = 'Meine Bestellungen';
- $rememberedOrderIds = getRememberedOrderIds();
- $orders = [];
- foreach ($rememberedOrderIds as $orderId) {
- $reservation = getReservationByOrderNumber($orderId);
- if (!$reservation) {
- continue;
- }
- if ((isset($reservation['status']) && $reservation['status'] === 'deleted') || isReservationHidden($reservation)) {
- continue;
- }
- $isBackorder = isset($reservation['type']) && $reservation['type'] === 'backorder';
- $typeLabel = $isBackorder ? 'Vorbestellung' : 'Reservierung';
- if ($isBackorder) {
- if (isset($reservation['backorder_status']) && $reservation['backorder_status'] === 'notified') {
- $statusLabel = 'Informiert';
- $statusClass = 'status-notified';
- } else {
- $statusLabel = 'Offen';
- $statusClass = 'status-open';
- }
- $detailsUrl = SITE_URL . '/reservation.php?backorder_number=' . urlencode($reservation['id']);
- } else {
- if (!empty($reservation['picked_up'])) {
- $statusLabel = 'Abgeholt';
- $statusClass = 'status-picked';
- } elseif (isset($reservation['status']) && $reservation['status'] === 'expired') {
- $statusLabel = 'Abgelaufen';
- $statusClass = 'status-expired';
- } else {
- $statusLabel = 'Offen';
- $statusClass = 'status-open';
- }
- $detailsUrl = SITE_URL . '/reservation.php?order_number=' . urlencode($reservation['id']);
- }
- $orders[] = [
- 'id' => $reservation['id'],
- 'type_label' => $typeLabel,
- 'created_label' => !empty($reservation['created']) ? formatDate($reservation['created']) : '-',
- 'status_label' => $statusLabel,
- 'status_class' => $statusClass,
- 'details_url' => $detailsUrl
- ];
- }
- include __DIR__ . '/includes/header.php';
- ?>
- <h2>Meine Bestellungen</h2>
- <div class="alert alert-info">
- <p>Hier sehen Sie Ihre zuletzt erstellten Bestellungen.</p>
- </div>
- <?php if (empty($orders)): ?>
- <div class="alert alert-info">
- <p>Es wurden noch keine Bestellungen in diesem Browser gefunden.</p>
- </div>
- <?php else: ?>
- <div class="table-responsive">
- <table class="responsive-table">
- <thead>
- <tr>
- <th>Bestellnummer</th>
- <th>Typ</th>
- <th>Erstellt</th>
- <th>Status</th>
- <th>Aktionen</th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($orders as $order): ?>
- <tr>
- <td data-label="Bestellnummer"><strong><?php echo htmlspecialchars($order['id']); ?></strong></td>
- <td data-label="Typ"><?php echo htmlspecialchars($order['type_label']); ?></td>
- <td data-label="Erstellt"><?php echo htmlspecialchars($order['created_label']); ?></td>
- <td data-label="Status"><span class="status <?php echo htmlspecialchars($order['status_class']); ?>"><?php echo htmlspecialchars($order['status_label']); ?></span></td>
- <td data-label="Aktionen"><a href="<?php echo htmlspecialchars($order['details_url']); ?>" class="btn btn-small">Details</a></td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- </div>
- <?php endif; ?>
- <?php include __DIR__ . '/includes/footer.php'; ?>
|