<?php if (isset($component)) { $__componentOriginale0f1cdd055772eb1d4a99981c240763e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0f1cdd055772eb1d4a99981c240763e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin-layout','data' => ['title' => 'Platform Overview']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Platform Overview']); ?>
    <div class="row g-3 mb-4">
        <div class="col-xl-3 col-md-6">
            <div class="stat-card">
                <div>
                    <div class="text-muted small fw-semibold text-uppercase mb-1">Total Companies</div>
                    <div class="fs-3 fw-bold"><?php echo e($stats['total']); ?></div>
                </div>
                <div class="stat-card-icon is-blue"><i class="bi bi-building-fill"></i></div>
            </div>
        </div>
        <div class="col-xl-3 col-md-6">
            <div class="stat-card">
                <div>
                    <div class="text-muted small fw-semibold text-uppercase mb-1">Active</div>
                    <div class="fs-3 fw-bold"><?php echo e($stats['active']); ?></div>
                </div>
                <div class="stat-card-icon is-green"><i class="bi bi-check-circle-fill"></i></div>
            </div>
        </div>
        <div class="col-xl-3 col-md-6">
            <div class="stat-card">
                <div>
                    <div class="text-muted small fw-semibold text-uppercase mb-1">Inactive</div>
                    <div class="fs-3 fw-bold"><?php echo e($stats['inactive']); ?></div>
                </div>
                <div class="stat-card-icon is-violet"><i class="bi bi-pause-circle-fill"></i></div>
            </div>
        </div>
        <div class="col-xl-3 col-md-6">
            <div class="stat-card">
                <div>
                    <div class="text-muted small fw-semibold text-uppercase mb-1">Needs Renewal</div>
                    <div class="fs-3 fw-bold"><?php echo e($stats['needs_renewal']); ?></div>
                </div>
                <div class="stat-card-icon is-amber"><i class="bi bi-hourglass-split"></i></div>
            </div>
        </div>
    </div>

    <?php if($expiredCompanies->isNotEmpty() || $expiringSoonCompanies->isNotEmpty()): ?>
        <div class="card mb-4">
            <div class="card-body">
                <h5 class="fw-bold mb-3"><i class="bi bi-exclamation-triangle-fill text-warning me-1"></i> Companies Needing Renewal</h5>
                <div class="table-responsive">
                    <table class="table align-middle">
                        <thead>
                            <tr>
                                <th>Company</th>
                                <th>Status</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $expiredCompanies->concat($expiringSoonCompanies); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $company): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td>
                                        <a href="<?php echo e(route('admin.companies.edit', $company)); ?>" class="fw-semibold text-decoration-none"><?php echo e($company->name); ?></a>
                                        <div class="text-muted small">Code <?php echo e($company->code); ?></div>
                                    </td>
                                    <td><span class="badge <?php echo e($company->expiryBadge()['class']); ?>"><?php echo e($company->expiryBadge()['label']); ?></span></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <div class="card">
        <div class="card-body">
            <div class="d-flex justify-content-between align-items-center mb-3">
                <h5 class="fw-bold mb-0">All Companies</h5>
                <span class="text-muted small"><?php echo e($companies->count()); ?> companies</span>
            </div>

            <?php if($companies->isEmpty()): ?>
                <div class="text-center text-muted py-5">
                    <i class="bi bi-building fs-1 d-block mb-2"></i>
                    No companies yet.
                </div>
            <?php else: ?>
                <div class="table-responsive">
                    <table class="table align-middle datatable">
                        <thead>
                            <tr>
                                <th>Company</th>
                                <th>Status</th>
                                <th class="text-end">Bookings (This Month)</th>
                                <th class="text-end">Calls (This Month)</th>
                                <th class="text-end">Drivers</th>
                                <th class="text-end">Customers</th>
                                <th class="text-end">Vehicles</th>
                                <th class="text-end">Staff</th>
                                <th>Last Booking</th>
                                <th>Valid Until</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $companies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $company): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td>
                                        <a href="<?php echo e(route('admin.companies.edit', $company)); ?>" class="fw-semibold text-decoration-none"><?php echo e($company->name); ?></a>
                                        <div class="text-muted small">Code <?php echo e($company->code); ?></div>
                                    </td>
                                    <td>
                                        <span class="badge <?php echo e($company->is_active ? 'is-green' : 'is-rose'); ?>">
                                            <?php echo e($company->is_active ? 'Active' : 'Inactive'); ?>

                                        </span>
                                    </td>
                                    <td class="text-end fw-semibold"><?php echo e($company->bookings_this_month); ?></td>
                                    <td class="text-end"><?php echo e($company->calls_this_month); ?></td>
                                    <td class="text-end"><?php echo e($company->active_drivers_count); ?> / <?php echo e($company->drivers_count); ?></td>
                                    <td class="text-end"><?php echo e($company->active_customers_count); ?> / <?php echo e($company->customers_count); ?></td>
                                    <td class="text-end"><?php echo e($company->vehicles_count); ?></td>
                                    <td class="text-end"><?php echo e($company->users_count); ?></td>
                                    <td class="text-muted small">
                                        <?php echo e($company->last_booking_at ? \Illuminate\Support\Carbon::parse($company->last_booking_at)->diffForHumans() : 'Never'); ?>

                                    </td>
                                    <td class="text-muted small">
                                        <span class="badge <?php echo e($company->expiryBadge()['class']); ?>"><?php echo e($company->expiryBadge()['label']); ?></span>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            <?php endif; ?>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $attributes = $__attributesOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $component = $__componentOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__componentOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php /**PATH C:\xampp\htdocs\dispatch-v2\resources\views/admin/platform/index.blade.php ENDPATH**/ ?>