<?php require_once __DIR__ . '/_sidebar.php'; ?>
<main class="flex-1 py-16 md:py-0 md:pl-64">
    <div class="max-w-7xl mx-auto px-4 py-8 md:py-16">
        <div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4">
            <div>
                <h1 class="text-3xl font-bold text-slate-950">Quotations</h1>
                <p class="mt-2 text-slate-600">Manage quotations, line items, discounts and approval status.</p>
            </div>
            <a href="<?= htmlspecialchars($baseUrl) ?>/admin" class="rounded-full border border-slate-300 px-5 py-3 text-sm text-slate-950 hover:bg-slate-100">Back to Dashboard</a>
        </div>
        <div class="mt-10 overflow-x-auto rounded-3xl border border-slate-200 bg-white shadow-lg">
            <table class="min-w-full divide-y divide-slate-200 text-sm">
                <thead class="bg-charcoal text-white">
                    <tr>
                        <th class="px-6 py-4 text-left">Quotation #</th>
                        <th class="px-6 py-4 text-left">Client</th>
                        <th class="px-6 py-4 text-left">Total</th>
                        <th class="px-6 py-4 text-left">Status</th>
                        <th class="px-6 py-4 text-left">Date</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-slate-200">
                    <?php foreach ($quotations as $quotation): ?>
                    <tr>
                        <td class="px-6 py-4 text-slate-700"><?= htmlspecialchars($quotation['quotation_number']) ?></td>
                        <td class="px-6 py-4 text-slate-700"><?= htmlspecialchars($quotation['client_name']) ?></td>
                        <td class="px-6 py-4 text-slate-700">GHS <?= number_format($quotation['total_amount'], 2) ?></td>
                        <td class="px-6 py-4 text-slate-700"><span class="inline-flex rounded-full bg-slate-100 px-3 py-1 text-xs font-semibold text-slate-800"><?= htmlspecialchars($quotation['status']) ?></span></td>
                        <td class="px-6 py-4 text-slate-500"><?= htmlspecialchars($quotation['created_at']) ?></td>
                    </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </div>
</main>
</div>
