<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames((['expiringDays' => null]));

foreach ($attributes->all() as $__key => $__value) {
    if (in_array($__key, $__propNames)) {
        $$__key = $$__key ?? $__value;
    } else {
        $__newAttributes[$__key] = $__value;
    }
}

$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);

unset($__propNames);
unset($__newAttributes);

foreach (array_filter((['expiringDays' => null]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
}

$__defined_vars = get_defined_vars();

foreach ($attributes->all() as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
}

unset($__defined_vars, $__key, $__value); ?>

<?php use \App\Models\Domain; ?>
<?php use \App\Models\License; ?>
<?php use \App\Services\LicenseStatsService; ?>

<?php
    /*
    | The licences controller passes only the paginated list, and this redesign
    | is not allowed to change it - so the header figures are resolved here,
    | through the same LicenseStatsService the dashboard already uses. Reusing
    | that service is the point: "active" folds in real-time expiry in SQL, so
    | these cards can never disagree with the dashboard's.
    |
    | Two counts the service does not expose are added alongside it; both are
    | single aggregate queries, no per-row work.
    */
    $overview = app(LicenseStatsService::class)->overview();

    $total    = License::count();
    $domains  = Domain::whereNotNull('license_id')->count();
    $days     = $expiringDays ?? (int) config('licensing.expiring_soon_days', 30);

    $share = fn (int $n) => $total > 0 ? round($n / $total * 100).'% of all licenses' : 'Nothing issued yet';
?>

<div <?php echo e($attributes->merge(['class' => 'grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5'])); ?>>
    <?php if (isset($component)) { $__componentOriginal6d74059c34730cb2c742dae13948a701 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal6d74059c34730cb2c742dae13948a701 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.metric-card','data' => ['label' => 'Total Licenses','value' => number_format($total),'count' => $total,'icon' => 'key','tone' => 'brand','hint' => $total === 1 ? 'The only one issued so far' : 'All licenses issued','href' => route('licenses.index')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('metric-card'); ?>
<?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(['label' => 'Total Licenses','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(number_format($total)),'count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($total),'icon' => 'key','tone' => 'brand','hint' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($total === 1 ? 'The only one issued so far' : 'All licenses issued'),'href' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('licenses.index'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $attributes = $__attributesOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__attributesOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $component = $__componentOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__componentOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>

    <?php if (isset($component)) { $__componentOriginal6d74059c34730cb2c742dae13948a701 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal6d74059c34730cb2c742dae13948a701 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.metric-card','data' => ['label' => 'Active Licenses','value' => number_format($overview['active']),'count' => $overview['active'],'icon' => 'shield-check','tone' => 'ok','hint' => $share($overview['active']),'href' => route('licenses.index', ['status' => 'active'])]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('metric-card'); ?>
<?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(['label' => 'Active Licenses','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(number_format($overview['active'])),'count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($overview['active']),'icon' => 'shield-check','tone' => 'ok','hint' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($share($overview['active'])),'href' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('licenses.index', ['status' => 'active']))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $attributes = $__attributesOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__attributesOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $component = $__componentOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__componentOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>

    <?php if (isset($component)) { $__componentOriginal6d74059c34730cb2c742dae13948a701 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal6d74059c34730cb2c742dae13948a701 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.metric-card','data' => ['label' => 'Expiring Soon','value' => number_format($overview['expiring_soon']),'count' => $overview['expiring_soon'],'icon' => 'calendar','tone' => 'warn','hint' => $overview['expiring_soon'] === 0 ? 'Nothing due' : 'Within '.$days.' days','href' => route('licenses.index', ['status' => 'active', 'refine' => 'expiring'])]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('metric-card'); ?>
<?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(['label' => 'Expiring Soon','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(number_format($overview['expiring_soon'])),'count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($overview['expiring_soon']),'icon' => 'calendar','tone' => 'warn','hint' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($overview['expiring_soon'] === 0 ? 'Nothing due' : 'Within '.$days.' days'),'href' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('licenses.index', ['status' => 'active', 'refine' => 'expiring']))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $attributes = $__attributesOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__attributesOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $component = $__componentOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__componentOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>

    <?php if (isset($component)) { $__componentOriginal6d74059c34730cb2c742dae13948a701 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal6d74059c34730cb2c742dae13948a701 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.metric-card','data' => ['label' => 'Expired','value' => number_format($overview['expired']),'count' => $overview['expired'],'icon' => 'clock','tone' => 'info','hint' => $overview['expired'] === 0 ? 'None expired' : $share($overview['expired']),'href' => route('licenses.index', ['status' => 'expired'])]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('metric-card'); ?>
<?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(['label' => 'Expired','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(number_format($overview['expired'])),'count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($overview['expired']),'icon' => 'clock','tone' => 'info','hint' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($overview['expired'] === 0 ? 'None expired' : $share($overview['expired'])),'href' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('licenses.index', ['status' => 'expired']))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $attributes = $__attributesOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__attributesOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $component = $__componentOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__componentOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>

    <?php if (isset($component)) { $__componentOriginal6d74059c34730cb2c742dae13948a701 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal6d74059c34730cb2c742dae13948a701 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.metric-card','data' => ['label' => 'Domains','value' => number_format($domains),'count' => $domains,'icon' => 'globe','tone' => 'indigo','hint' => $domains === 0 ? 'No installation bound yet' : 'Bound to a license','href' => route('domains.index'),'class' => 'col-span-2 sm:col-span-1']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('metric-card'); ?>
<?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(['label' => 'Domains','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(number_format($domains)),'count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($domains),'icon' => 'globe','tone' => 'indigo','hint' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($domains === 0 ? 'No installation bound yet' : 'Bound to a license'),'href' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('domains.index')),'class' => 'col-span-2 sm:col-span-1']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $attributes = $__attributesOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__attributesOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal6d74059c34730cb2c742dae13948a701)): ?>
<?php $component = $__componentOriginal6d74059c34730cb2c742dae13948a701; ?>
<?php unset($__componentOriginal6d74059c34730cb2c742dae13948a701); ?>
<?php endif; ?>
</div>
<?php /**PATH C:\laragon\www\license-server\resources\views/components/license-stats.blade.php ENDPATH**/ ?>