<?php require_once dirname(__DIR__, 2) . '/dripend/config/config.php'; ?>
<!DOCTYPE html><html lang="en"><head><title>View PO | RiMax</title><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"><style>body{background:#f8fafc;} .main-content{margin-left:300px;padding:20px;}</style></head>
<body>
    <?php include(dirname(__DIR__, 2) . '/dripend/statpages/sidebar.php'); ?>
    <div class="main-content"><div class="container-fluid py-2"><div id="poViewMsg"></div>
        <div class="d-flex justify-content-between mb-4 border-bottom pb-3"><div><h2 class="h4 fw-bold m-0"><i class="fa-solid fa-file-contract text-primary me-2"></i>Purchase Order: <span id="v_po_number" class="font-monospace text-primary">...</span></h2></div><div class="d-flex gap-2"><button class="btn btn-outline-secondary fw-bold" onclick="window.print()">Print</button><a href="listPurchaseOrder.php" class="btn btn-light border fw-bold shadow-sm">Back</a></div></div>
        
        <div class="row g-3 mb-4">
            <div class="col-md-8"><div class="bg-white p-4 border rounded shadow-sm h-100"><h6 class="fw-bold text-secondary mb-3 border-bottom pb-2">Details</h6><div class="row g-3"><div class="col-md-6"><span class="small text-muted d-block">Supplier</span><strong id="v_supplier_name"></strong></div><div class="col-md-6"><span class="small text-muted d-block">Delivery Store</span><strong id="v_store_name"></strong></div><div class="col-md-4"><span class="small text-muted d-block">Order Date</span><strong id="v_order_date"></strong></div><div class="col-md-4"><span class="small text-muted d-block">Expected Delivery</span><strong class="text-danger" id="v_expected_delivery_date"></strong></div><div class="col-md-4"><span class="small text-muted d-block">From Requisition</span><strong class="font-monospace text-primary" id="v_requisition_no"></strong></div></div></div></div>
            <div class="col-md-4"><div class="bg-white p-4 border rounded shadow-sm h-100 text-center d-flex flex-column justify-content-center"><div id="v_status" class="mb-3"></div><span class="small text-muted fw-bold text-uppercase">Grand Total</span><h2 class="text-danger fw-bold m-0">GH₵ <span id="v_grand">0.00</span></h2></div></div>
        </div>

        <div class="bg-white p-4 border rounded shadow-sm mb-4"><h6 class="fw-bold text-secondary mb-3">Line Items</h6>
            <table class="table table-bordered align-middle table-sm m-0"><thead class="table-dark text-center"><tr><th class="text-start">Product</th><th>Ordered Qty</th><th class="text-end">Unit Cost</th><th class="text-end">Total</th></tr></thead><tbody id="v_itemsBody"></tbody></table>
            <div class="row mt-3 justify-content-end"><div class="col-md-4"><table class="table table-sm table-borderless m-0"><tr><td class="text-muted fw-bold">Subtotal:</td><td class="text-end fw-bold">GH₵ <span id="v_sub">0.00</span></td></tr><tr><td class="text-muted fw-bold">Tax:</td><td class="text-end fw-bold">GH₵ <span id="v_tax">0.00</span></td></tr><tr><td class="text-muted fw-bold border-bottom pb-2">Discount:</td><td class="text-end fw-bold text-success border-bottom pb-2">- GH₵ <span id="v_disc">0.00</span></td></tr></table></div></div>
        </div>
    </div></div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script><script src="<?php echo BASE_URL; ?>application/assets/js/purchaseOrder.js?v=<?= time(); ?>"></script>
</body></html>