<?php if (!defined('STORE_ROOT')) { http_response_code(403); exit; } $orderRef = $_SESSION['_last_order'] ?? ''; $orderData = null; if ($orderRef) { try { $orderData = Database::one("SELECT * FROM orders WHERE reference = :ref AND user_id = :uid", [':ref' => $orderRef, ':uid' => $_SESSION['_uid'] ?? 0]); } catch (\Throwable $e) { error_log('[Payment] ' . $e->getMessage()); } } $stages = ['pending' => 'Order Received', 'paid' => 'Payment Confirmed', 'processing' => 'Processing', 'packed' => 'Packed', 'shipped' => 'Out for Delivery', 'delivered' => 'Delivered']; $currentStage = $orderData['status'] ?? 'paid'; $stageKeys = array_keys($stages); $currentIdx = array_search($currentStage, $stageKeys); ?> <div class="page-payment"> <div class="track-card" style="text-align:center;max-width:700px;margin:40px auto"> <div class="rv-separator" style="margin:0 0 28px 0"></div> <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 11-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg> <h2 style="margin:16px 0 8px;font-size:1.3rem"><?= $L('pay_confirmed_title', 'Payment Verified') ?></h2> <p style="color:#666;font-size:0.9rem;margin-bottom:28px"><?= $L('pay_confirmed_desc', 'Your order is being prepared. We aim to have your package out for delivery by early next morning.') ?></p> <?php if ($orderData): ?> <div style="background:#f0f4ee;border-radius:12px;padding:20px;text-align:left;margin-bottom:24px"> <div style="display:flex;justify-content:space-between;margin-bottom:10px;font-size:0.88rem"><span style="color:#666"><?= $L('pay_reference', 'Reference') ?></span><strong><?= htmlspecialchars($orderData['reference']) ?></strong></div> <?php if ($orderData['tracking_number']): ?> <div style="display:flex;justify-content:space-between;margin-bottom:10px;font-size:0.88rem"><span style="color:#666"><?= $L('pay_tracking', 'Tracking #') ?></span><strong><?= htmlspecialchars(Crypt::render($orderData['tracking_number'])) ?></strong></div> <?php endif; ?> <div style="display:flex;justify-content:space-between;margin-bottom:10px;font-size:0.88rem"><span style="color:#666"><?= $L('pay_method', 'Payment') ?></span><strong><?= htmlspecialchars(ucfirst($orderData['payment_method'] ?? 'card')) ?></strong></div> <div style="display:flex;justify-content:space-between;font-size:0.88rem"><span style="color:#666"><?= $L('pay_total', 'Total') ?></span><strong>$<?= number_format((float)($orderData['total'] ?? 0), 2) ?></strong></div> </div> <?php if (($orderData['shipping_method'] ?? '') === 'express'): ?> <div style="padding:10px 18px;background:rgba(201,168,76,0.1);border-radius:10px;font-size:0.84rem;color:var(--accent-gold);margin-bottom:20px;text-align:left"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="vertical-align:-2px;margin-right:4px"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> <?= $L('pay_express_note', 'Express Post selected. Your tracking code will be updated once your package is with our shipping partner.') ?> </div> <?php endif; ?> <div style="display:flex;gap:0;align-items:flex-start;justify-content:center;flex-wrap:wrap;margin-bottom:24px"> <?php foreach ($stageKeys as $i => $key): ?> <?php $done = $i <= $currentIdx; ?> <div style="display:flex;flex-direction:column;align-items:center;gap:6px;flex:1;min-width:60px"> <div class="track-step-num" style="<?= $done ? 'background:var(--accent);color:#fff;border-color:var(--accent)' : '' ?>"><?= $i + 1 ?></div> <div style="font-size:0.68rem;font-weight:600;text-transform:uppercase;color:<?= $done ? 'var(--accent)' : 'var(--text-light)' ?>"><?= $stages[$key] ?></div> </div> <?php if ($i < count($stageKeys) - 1): ?> <div style="width:24px;height:2px;background:<?= $i < $currentIdx ? 'var(--accent)' : 'var(--border)' ?>;margin-top:16px;flex-shrink:0"></div> <?php endif; ?> <?php endforeach; ?> </div> <?php endif; ?> <div style="display:flex;gap:12px;justify-content:center;flex-wrap:wrap"> <a href="#track" data-route="track" class="btn btn-primary" style="font-size:0.85rem"><?= $L('pay_track_btn', 'Track Order') ?></a> <a href="#home" data-route="home" class="btn" style="font-size:0.85rem;border:1px solid var(--border)"><?= $L('pay_continue_btn', 'Continue Shopping') ?></a> </div> </div> </div>
