

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

<div class="dashboard-page">

    

    <div class="dashboard-header">

        <div>
            <h2>
                <i class="bi bi-grid-1x2-fill me-2"></i>
                Dashboard
            </h2>

            <p>
                High Court of Madhya Pradesh — Case Management
            </p>
        </div>

        <div class="dashboard-date">
            <i class="bi bi-calendar3 me-2"></i>
            <?php echo e(now()->format('d M Y')); ?>

        </div>

    </div>


    

    <div class="row g-4 mb-4">

        

        <div class="col-xl-3 col-md-6">

            <a href="<?php echo e(url('/cases')); ?>" class="dashboard-stat-link">

                <div class="dashboard-stat-card">

                    <div class="stat-content">

                        <span class="stat-label">
                            Total Cases
                        </span>

                        <h2>
                            <?php echo e(number_format($totalCases)); ?>

                        </h2>

                        <span class="stat-info">
                            <i class="bi bi-folder2-open me-1"></i>
                            All registered cases
                        </span>

                    </div>

                    <div class="stat-icon total">
                        <i class="bi bi-folder2-open"></i>
                    </div>

                </div>

            </a>

        </div>


        

        <div class="col-xl-3 col-md-6">

            <a href="<?php echo e(url('/cases')); ?>" class="dashboard-stat-link">

                <div class="dashboard-stat-card">

                    <div class="stat-content">

                        <span class="stat-label">
                            Pending Cases
                        </span>

                        <h2>
                            <?php echo e(number_format($pendingCases)); ?>

                        </h2>

                        <span class="stat-info">
                            <i class="bi bi-hourglass-split me-1"></i>
                            <?php echo e($pendingPercentage); ?>% of total
                        </span>

                    </div>

                    <div class="stat-icon pending">
                        <i class="bi bi-hourglass-split"></i>
                    </div>

                </div>

            </a>

        </div>


        

        <div class="col-xl-3 col-md-6">

            <a href="<?php echo e(url('/cases')); ?>" class="dashboard-stat-link">

                <div class="dashboard-stat-card">

                    <div class="stat-content">

                        <span class="stat-label">
                            Disposed Cases
                        </span>

                        <h2>
                            <?php echo e(number_format($disposedCases)); ?>

                        </h2>

                        <span class="stat-info">
                            <i class="bi bi-check2-circle me-1"></i>
                            <?php echo e($disposedPercentage); ?>% of total
                        </span>

                    </div>

                    <div class="stat-icon disposed">
                        <i class="bi bi-check2-circle"></i>
                    </div>

                </div>

            </a>

        </div>


        

        <div class="col-xl-3 col-md-6">

            <a href="<?php echo e(url('/cases')); ?>" class="dashboard-stat-link">

                <div class="dashboard-stat-card">

                    <div class="stat-content">

                        <span class="stat-label">
                            Today's Cases
                        </span>

                        <h2>
                            <?php echo e(number_format($todayCases)); ?>

                        </h2>

                        <span class="stat-info">
                            <i class="bi bi-calendar-event me-1"></i>
                            Filed today
                        </span>

                    </div>

                    <div class="stat-icon today">
                        <i class="bi bi-calendar-event"></i>
                    </div>

                </div>

            </a>

        </div>

    </div>


    

    <div class="row g-4 mb-4">

        

        <div class="col-lg-8">

            <div class="dashboard-panel">

                <div class="panel-header">

                    <div>

                        <h5>
                            <i class="bi bi-bar-chart-fill me-2"></i>
                            Case Status Overview
                        </h5>

                        <p>
                            Current distribution of cases
                        </p>

                    </div>

                    <span class="panel-badge">
                        <?php echo e(number_format($totalCases)); ?> Total
                    </span>

                </div>


                <div class="status-list">

                    

                    <div class="status-row">

                        <div class="status-title">

                            <span class="status-dot pending-dot"></span>

                            <span>
                                Pending Cases
                            </span>

                            <strong>
                                <?php echo e(number_format($pendingCases)); ?>

                            </strong>

                        </div>

                        <div class="status-progress">

                            <div
                                class="progress-bar pending-bar"
                                style="width: <?php echo e($pendingPercentage); ?>%">
                            </div>

                        </div>

                        <span class="status-percent">
                            <?php echo e($pendingPercentage); ?>%
                        </span>

                    </div>


                    

                    <div class="status-row">

                        <div class="status-title">

                            <span class="status-dot disposed-dot"></span>

                            <span>
                                Disposed Cases
                            </span>

                            <strong>
                                <?php echo e(number_format($disposedCases)); ?>

                            </strong>

                        </div>

                        <div class="status-progress">

                            <div
                                class="progress-bar disposed-bar"
                                style="width: <?php echo e($disposedPercentage); ?>%">
                            </div>

                        </div>

                        <span class="status-percent">
                            <?php echo e($disposedPercentage); ?>%
                        </span>

                    </div>


                    

                    <div class="status-row">

                        <div class="status-title">

                            <span class="status-dot other-dot"></span>

                            <span>
                                Other Status
                            </span>

                            <strong>
                                <?php echo e(number_format($otherCases)); ?>

                            </strong>

                        </div>

                        <div class="status-progress">

                            <div
                                class="progress-bar other-bar"
                                style="width: <?php echo e($otherPercentage); ?>%">
                            </div>

                        </div>

                        <span class="status-percent">
                            <?php echo e($otherPercentage); ?>%
                        </span>

                    </div>

                </div>

            </div>

        </div>


        

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

            <div class="dashboard-panel year-panel">

                <div class="year-icon">
                    <i class="bi bi-calendar3"></i>
                </div>

                <div class="year-label">
                    Current Year
                </div>

                <div class="year-number">
                    <?php echo e(number_format($currentYearCases)); ?>

                </div>

                <div class="year-title">
                    Cases registered in <?php echo e($currentYear); ?>

                </div>

                <a href="<?php echo e(url('/cases')); ?>" class="year-link">
                    View Case List
                    <i class="bi bi-arrow-right ms-1"></i>
                </a>

            </div>

        </div>

    </div>


    

    <div class="dashboard-panel">

        <div class="panel-header">

            <div>

                <h5>
                    <i class="bi bi-clock-history me-2"></i>
                    Recent Cases
                </h5>

                <p>
                    Latest registered cases
                </p>

            </div>

            <a href="<?php echo e(url('/cases')); ?>" class="view-all-btn">
                View All
                <i class="bi bi-arrow-right ms-1"></i>
            </a>

        </div>


        <div class="table-responsive">

            <table class="table dashboard-case-table mb-0">

                <thead>

                    <tr>

                        <th>
                            Case No.
                        </th>

                        <th>
                            CINO
                        </th>

                        <th>
                            Petitioner
                        </th>

                        <th>
                            Respondent
                        </th>

                        <th>
                            Case Type
                        </th>

                        <th>
                            Year
                        </th>

                        <th class="text-center">
                            Status
                        </th>

                    </tr>

                </thead>


                <tbody>

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

                        <tr>

                            <td>

                                <strong>
                                    <?php echo e(trim($case->caseType->skey ?? '')); ?>

                                    -
                                    <?php echo e($case->caseno); ?>

                                    -
                                    <?php echo e($case->caseyear); ?>

                                </strong>

                            </td>

                            <td>
                                <?php echo e($case->cino ?? '-'); ?>

                            </td>

                            <td>
                                <?php echo e($case->pet_name ?? '-'); ?>

                            </td>

                            <td>
                                <?php echo e($case->res_name ?? '-'); ?>

                            </td>

                            <td>
                                <?php echo e($case->caseType->casename ?? '-'); ?>

                            </td>

                            <td>
                                <?php echo e($case->caseyear ?? '-'); ?>

                            </td>

                            <td class="text-center">

                                <?php if($case->c_status === 'P'): ?>

                                    <span class="dashboard-status pending-status">
                                        Pending
                                    </span>

                                <?php elseif($case->c_status === 'D'): ?>

                                    <span class="dashboard-status disposed-status">
                                        Disposed
                                    </span>

                                <?php else: ?>

                                    <span class="dashboard-status other-status">
                                        <?php echo e($case->c_status ?? 'N/A'); ?>

                                    </span>

                                <?php endif; ?>

                            </td>

                        </tr>

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

                        <tr>

                            <td colspan="7" class="text-center py-4 text-muted">

                                No cases found.

                            </td>

                        </tr>

                    <?php endif; ?>

                </tbody>

            </table>

        </div>

    </div>

</div>




<style>

.dashboard-page {
    padding: 30px;
    background: #f6f7f9;
    min-height: calc(100vh - 120px);
}


/* HEADER */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.dashboard-header h2 {
    font-weight: 700;
    margin: 0;
    color: #17212b;
}

.dashboard-header p {
    margin: 5px 0 0;
    color: #718096;
}

.dashboard-date {
    color: #64748b;
    font-size: 14px;
}


/* STAT CARDS */

.dashboard-stat-link {
    text-decoration: none;
    color: inherit;
}

.dashboard-stat-card {
    background: #ffffff;
    border: 1px solid #e8ebef;
    border-radius: 14px;
    padding: 24px;
    min-height: 150px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all .2s ease;
}

.dashboard-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,.08);
}

.stat-label {
    display: block;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-content h2 {
    font-size: 31px;
    font-weight: 700;
    color: #17212b;
    margin-bottom: 7px;
}

.stat-info {
    color: #8793a1;
    font-size: 12px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 13px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 23px;
}

.stat-icon.total {
    background: #eef3f7;
    color: #34495e;
}

.stat-icon.pending {
    background: #fff5dc;
    color: #b77900;
}

.stat-icon.disposed {
    background: #e9f8f0;
    color: #16804a;
}

.stat-icon.today {
    background: #edf4ff;
    color: #1769aa;
}


/* PANEL */

.dashboard-panel {
    background: #ffffff;
    border: 1px solid #e8ebef;
    border-radius: 14px;
    overflow: hidden;
}

.panel-header {
    padding: 20px 22px;
    border-bottom: 1px solid #edf0f2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h5 {
    margin: 0;
    font-weight: 700;
    color: #17212b;
}

.panel-header p {
    margin: 5px 0 0;
    color: #8994a2;
    font-size: 13px;
}

.panel-badge {
    background: #f1f3f5;
    color: #5d6874;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}


/* STATUS */

.status-list {
    padding: 24px;
}

.status-row {
    display: grid;
    grid-template-columns: 230px 1fr 55px;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.status-row:last-child {
    margin-bottom: 0;
}

.status-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: #475569;
}

.status-title strong {
    margin-left: auto;
    color: #17212b;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.pending-dot {
    background: #e5a800;
}

.disposed-dot {
    background: #1b9a59;
}

.other-dot {
    background: #64748b;
}

.status-progress {
    height: 9px;
    background: #edf0f2;
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 20px;
}

.pending-bar {
    background: #e5a800;
}

.disposed-bar {
    background: #1b9a59;
}

.other-bar {
    background: #64748b;
}

.status-percent {
    font-size: 12px;
    color: #64748b;
    text-align: right;
}


/* YEAR PANEL */

.year-panel {
    padding: 25px;
    height: 100%;
}

.year-icon {
    width: 48px;
    height: 48px;
    background: #f0f4f7;
    color: #34495e;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 18px;
}

.year-label {
    color: #64748b;
    font-size: 14px;
}

.year-number {
    font-size: 40px;
    font-weight: 700;
    color: #17212b;
    margin-top: 5px;
}

.year-title {
    color: #8793a1;
    font-size: 13px;
    margin-bottom: 20px;
}

.year-link,
.view-all-btn {
    text-decoration: none;
    color: #34495e;
    font-size: 13px;
    font-weight: 600;
}


/* TABLE */

.dashboard-case-table thead th {
    background: #f8f9fa;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.dashboard-case-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    color: #475569;
    border-bottom: 1px solid #edf0f2;
}

.dashboard-case-table tbody tr:hover {
    background: #fafbfc;
}


/* STATUS BADGES */

.dashboard-status {
    display: inline-block;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.pending-status {
    background: #fff5dc;
    color: #a56b00;
}

.disposed-status {
    background: #e9f8f0;
    color: #16804a;
}

.other-status {
    background: #edf0f2;
    color: #64748b;
}


/* RESPONSIVE */

@media (max-width: 768px) {

    .dashboard-page {
        padding: 18px;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .status-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .status-percent {
        text-align: left;
    }

}

</style>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\abhay\erp-system\resources\views/dashboard.blade.php ENDPATH**/ ?>