

<?php $__env->startSection('title', 'Dashboard'); ?>

<?php $__env->startSection('content'); ?>

    <div class="row">
        <div class="col-md-2">
            <div class="card">
                <div class="card-body text-center">

                    <i class="bi bi-hdd-network fs-1 text-primary"></i>

                    <h6 class="mt-2">Total Devices</h6>

                    <h3><?php echo e(number_format($totalDevices)); ?></h3>

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

        <div class="col-md-2">
            <div class="card">
                <div class="card-body text-center">

                    <i class="bi bi-building fs-1 text-success"></i>

                    <h6 class="mt-2">Store Stock</h6>

                    <h3><?php echo e(number_format($storeStock)); ?></h3>

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

        <div class="col-md-2">
            <div class="card">
                <div class="card-body text-center">

                    <i class="bi bi-person-badge fs-1 text-info"></i>

                    <h6 class="mt-2">Sales Stock</h6>

                    <h3><?php echo e(number_format($salesStock)); ?></h3>

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

        <div class="col-md-2">
            <div class="card">
                <div class="card-body text-center">

                    <i class="bi bi-truck fs-1 text-warning"></i>

                    <h6 class="mt-2">Leased</h6>

                    <h3><?php echo e(number_format($leasedDevices)); ?></h3>

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

        <div class="col-md-2">
            <div class="card">
                <div class="card-body text-center">

                    <i class="bi bi-geo-alt fs-1 text-danger"></i>

                    <h6 class="mt-2">Border Stock</h6>

                    <h3><?php echo e(number_format($borderStock)); ?></h3>

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

        <div class="col-md-2">
            <div class="card">
                <div class="card-body text-center">

                    <i class="bi bi-check-circle fs-1 text-success"></i>

                    <h6 class="mt-2">Audited</h6>

                    <h3><?php echo e(number_format($auditedLeases)); ?></h3>

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

        <div class="row">

            <div class="col-md-4">

                <div class="card mb-3">

                    <div class="card-header text-center">

                        <h5 class="mb-0">
                            Monthly Revenue
                        </h5>

                    </div>

                    <div class="card-body text-center py-5">

                        <h1 class="text-success fw-bold">
                            <?php echo e(number_format($monthlyRevenue)); ?>

                        </h1>

                        <small class="text-muted">
                            Tanzanian Shillings (TZS)
                        </small>

                    </div>

                </div>

            </div>
            <div class="col-md-8">

                <div class="card">

                    <div class="card-header">

                        <h5 class="mb-0">
                            Today's Sales Performance
                        </h5>

                    </div>

                    <div class="card-body">

                        <div class="table-responsive">

                            <table class="table table-striped">

                                <thead>

                                    <tr>

                                        <th>#</th>

                                        <th>Sales User</th>

                                        <th>Leases</th>

                                        <th>Revenue</th>

                                    </tr>

                                </thead>

                                <tbody>

                                    <?php $__empty_1 = true; $__currentLoopData = $salesPerformance; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sale): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                        <tr>

                                            <td>
                                                <?php echo e($loop->iteration); ?>

                                            </td>

                                            <td>
                                                <?php echo e($sale->salesUser?->name); ?>

                                            </td>

                                            <td>
                                                <?php echo e(number_format($sale->total_leases)); ?>

                                            </td>

                                            <td>
                                                TZS <?php echo e(number_format($sale->total_amount)); ?>

                                            </td>

                                        </tr>

                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>

                                        <tr>

                                            <td colspan="4" class="text-center">

                                                No audited sales today

                                            </td>

                                        </tr>
                                    <?php endif; ?>

                                </tbody>

                            </table>

                        </div>

                    </div>

                </div>

            </div>

        </div>



        <div class="row">

            <div class="col-md-12">

                <div class="card">

                    <div class="card-header">
                        <h5>Recent Leases</h5>
                    </div>

                    <div class="card-body">

                        <div class="table-responsive">

                            <table class="table table-striped">

                                <thead>

                                    <tr>

                                        <th>Lease No</th>

                                        <th>Device</th>

                                        <th>Customer</th>

                                        <th>Sales</th>

                                        <th>Amount</th>

                                        <th>Status</th>

                                        <th>Date</th>

                                    </tr>

                                </thead>

                                <tbody>

                                    <?php $__empty_1 = true; $__currentLoopData = $recentLeases; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lease): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                        <tr>

                                            <td>
                                                <?php echo e($lease->lease_no); ?>

                                            </td>

                                            <td>
                                                <?php echo e($lease->device?->serial_number); ?>

                                            </td>

                                            <td>
                                                <?php echo e($lease->customer_name); ?>

                                            </td>

                                            <td>
                                                <?php echo e($lease->salesUser?->name); ?>

                                            </td>

                                            <td>
                                                <?php echo e(number_format($lease->amount)); ?>

                                            </td>

                                            <td>

                                                <?php if($lease->status == 'active'): ?>
                                                    <span class="badge bg-warning">
                                                        ACTIVE
                                                    </span>
                                                <?php elseif($lease->status == 'audited'): ?>
                                                    <span class="badge bg-success">
                                                        AUDITED
                                                    </span>
                                                <?php elseif($lease->status == 'cancelled'): ?>
                                                    <span class="badge bg-danger">
                                                        CANCELLED
                                                    </span>
                                                <?php endif; ?>

                                            </td>

                                            <td>
                                                <?php echo e($lease->created_at->format('d M Y H:i')); ?>

                                            </td>

                                        </tr>

                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>

                                        <tr>

                                            <td colspan="7" class="text-center">

                                                No Audited Leases today

                                            </td>

                                        </tr>
                                    <?php endif; ?>


                                </tbody>

                            </table>

                        </div>

                    </div>

                </div>

            </div>

        </div>

    <?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\Projects\lms-ects\resources\views/dashboard/index.blade.php ENDPATH**/ ?>