<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Dashboard | <?php echo e(config('app.name')); ?></title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f4f6f9;
            font-family: 'Poppins', sans-serif;
        }
        .sidebar {
            height: 100vh;
            background-color: #0d6efd;
            color: white;
            position: fixed;
            top: 0;
            left: 0;
            width: 230px;
            padding-top: 70px;
        }
        .sidebar a {
            color: #e4e4e4;
            display: block;
            padding: 12px 20px;
            text-decoration: none;
        }
        .sidebar a:hover, .sidebar a.active {
            background-color: #084298;
            color: white;
            border-left: 4px solid #ffc107;
        }
        .content {
            margin-left: 240px;
            padding: 30px;
        }
        .navbar {
            background-color: #fff !important;
            border-bottom: 1px solid #e3e3e3;
        }
        .card {
            border: none;
            border-radius: 12px;
            box-shadow: 0 2px 6px rgba(0,0,0,0.05);
        }
        .card h5 {
            color: #6c757d;
        }
    </style>
</head>
<body>

<nav class="navbar navbar-expand-lg fixed-top shadow-sm">
    <div class="container-fluid">
        <a class="navbar-brand fw-semibold text-primary" href="#">🛍️ <?php echo e(config('app.name', 'Ecommerce')); ?> Admin</a>
        <div class="d-flex">
            <span class="me-3 text-muted"><?php echo e(auth()->user()->name); ?></span>
            <form method="POST" action="<?php echo e(route('admin.logout')); ?>">
                <?php echo csrf_field(); ?>
                <button type="submit" class="btn btn-outline-danger btn-sm">Logout</button>
            </form>
        </div>
    </div>
</nav>

<div class="sidebar">
    <a href="<?php echo e(route('admin.dashboard')); ?>" class="active">🏠 Dashboard</a>
    <a href="<?php echo e(route('admin.products')); ?>">📦 Products</a>
    <a href="<?php echo e(route('admin.categories')); ?>">🗂️ Categories</a>
    <a href="<?php echo e(route('admin.orders')); ?>">🧾 Orders</a>
    <a href="<?php echo e(route('admin.coupons')); ?>">🏷️ Coupons</a>
    <a href="<?php echo e(route('admin.banners')); ?>">🖼️ Banners</a>
    <a href="<?php echo e(route('admin.settings')); ?>">⚙️ Settings</a>
</div>

<div class="content">
    <div class="container-fluid">
        <h2 class="fw-bold mb-4">Dashboard Overview</h2>

        <div class="row g-3">
            <div class="col-md-3">
                <div class="card p-3">
                    <h5>Total Orders</h5>
                    <h3 class="fw-bold text-primary"><?php echo e($totalOrders ?? 0); ?></h3>
                </div>
            </div>
            <div class="col-md-3">
                <div class="card p-3">
                    <h5>Total Products</h5>
                    <h3 class="fw-bold text-success"><?php echo e($totalProducts ?? 0); ?></h3>
                </div>
            </div>
            <div class="col-md-3">
                <div class="card p-3">
                    <h5>Total Customers</h5>
                    <h3 class="fw-bold text-warning"><?php echo e($totalUsers ?? 0); ?></h3>
                </div>
            </div>
            <div class="col-md-3">
                <div class="card p-3">
                    <h5>Revenue</h5>
                    <h3 class="fw-bold text-danger">
                        ₹<?php echo e(number_format($revenue ?? 0, 2)); ?>

                    </h3>
                </div>
            </div>
        </div>

        <div class="card mt-5">
            <div class="card-header bg-white border-bottom d-flex justify-content-between align-items-center">
                <h5 class="mb-0 fw-semibold">Recent Orders</h5>
                <a href="<?php echo e(route('admin.orders')); ?>" class="btn btn-sm btn-outline-primary">View All</a>
            </div>
            <div class="card-body table-responsive">
                <table class="table table-hover align-middle">
                    <thead class="table-light">
                        <tr>
                            <th>Order #</th>
                            <th>Customer</th>
                            <th>Total</th>
                            <th>Status</th>
                            <th>Date</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $orders ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($order->order_number); ?></td>
                                <td><?php echo e(optional($order->user)->name ?? 'Guest'); ?></td>
                                <td>₹<?php echo e(number_format($order->total, 2)); ?></td>
                                <td>
                                    <span class="badge 
                                        <?php if($order->status == 'delivered'): ?> bg-success
                                        <?php elseif($order->status == 'cancelled'): ?> bg-danger
                                        <?php else: ?> bg-warning text-dark <?php endif; ?>">
                                        <?php echo e(ucfirst($order->status)); ?>

                                    </span>
                                </td>
                                <td><?php echo e($order->created_at->format('d M Y')); ?></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="5" class="text-center text-muted">No recent orders found.</td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>

    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
<?php /**PATH /home2/jitrealx/public_html/track/resources/views/admin/dashboard.blade.php ENDPATH**/ ?>