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

<?php $__env->startSection('content'); ?>
<div>
    <div class="mb-5 flex flex-wrap items-center justify-between gap-3">
        <div>
            <h1 class="text-xl font-extrabold text-slate-900 lg:text-2xl">HR Dashboard</h1>
            <p class="text-sm text-slate-500">People, attendance and payroll at a glance.</p>
        </div>
        <div class="flex gap-2">
            <a href="<?php echo e(route('epelcon.hr.employees')); ?>" class="rounded-xl bg-indigo-600 px-4 py-2.5 text-sm font-bold text-white shadow-lg shadow-indigo-600/25 hover:bg-indigo-700">Employees</a>
            <a href="<?php echo e(route('epelcon.payroll.index')); ?>" class="rounded-xl bg-white px-4 py-2.5 text-sm font-bold text-slate-700 ring-1 ring-slate-200 hover:bg-slate-50">Payroll</a>
        </div>
    </div>

    <div class="mb-5 grid grid-cols-2 gap-3 lg:grid-cols-4">
        <div class="rounded-2xl bg-white p-4 shadow-sm ring-1 ring-slate-200"><p class="text-xs font-bold uppercase text-slate-400">Active staff</p><p class="mt-1 text-2xl font-extrabold text-slate-900"><?php echo e($headcount['active']); ?></p><p class="text-[11px] text-slate-400"><?php echo e($headcount['on_leave']); ?> on leave · <?php echo e($headcount['exited']); ?> exited</p></div>
        <div class="rounded-2xl bg-white p-4 shadow-sm ring-1 ring-slate-200"><p class="text-xs font-bold uppercase text-slate-400">Departments</p><p class="mt-1 text-2xl font-extrabold text-indigo-600"><?php echo e($departmentsCount); ?></p></div>
        <div class="rounded-2xl bg-white p-4 shadow-sm ring-1 ring-slate-200"><p class="text-xs font-bold uppercase text-slate-400">Attendance today</p><p class="mt-1 text-2xl font-extrabold text-emerald-600"><?php echo e($presentToday); ?> <span class="text-sm font-bold text-slate-400">present</span></p><p class="text-[11px] text-rose-500"><?php echo e($absentToday); ?> absent</p></div>
        <div class="rounded-2xl bg-white p-4 shadow-sm ring-1 ring-slate-200"><p class="text-xs font-bold uppercase text-slate-400">Pending leave</p><p class="mt-1 text-2xl font-extrabold text-amber-600"><?php echo e($pendingLeave); ?></p></div>
    </div>

    <div class="mb-5 rounded-2xl bg-slate-900 p-5 text-white shadow-sm">
        <p class="text-xs font-bold uppercase text-slate-400">Monthly payroll cost (active salaries)</p>
        <p class="mt-1 text-3xl font-extrabold"><?php echo e($CUR ?? '₦') . number_format((float) ($monthlyPayrollCost), 2); ?></p>
    </div>

    <div class="grid gap-4 lg:grid-cols-3">
        <div class="rounded-2xl bg-white p-5 shadow-sm ring-1 ring-slate-200">
            <div class="mb-3 flex items-center justify-between">
                <h2 class="text-sm font-extrabold text-slate-900">On duty today</h2>
                <a href="<?php echo e(route('epelcon.hr.roster')); ?>" class="text-xs font-bold text-indigo-600">Roster →</a>
            </div>
            <div class="space-y-2.5">
                <?php $__empty_1 = true; $__currentLoopData = $onDutyToday; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $duty): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <div class="flex items-center justify-between rounded-xl bg-slate-50 px-3 py-2.5">
                        <div>
                            <p class="text-sm font-bold text-slate-800"><?php echo e($duty->employee->name ?? '—'); ?></p>
                            <p class="text-[11px] text-slate-500"><?php echo e($duty->shift->name ?? '—'); ?></p>
                        </div>
                        <span class="rounded-full bg-indigo-100 px-2.5 py-1 text-[10px] font-bold text-indigo-700"><?php echo e($duty->shift ? substr($duty->shift->starts_at, 0, 5) . '–' . substr($duty->shift->ends_at, 0, 5) : ''); ?></span>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <p class="py-6 text-center text-sm text-slate-400">No roster entries for today.</p>
                <?php endif; ?>
            </div>
        </div>

        <div class="rounded-2xl bg-white p-5 shadow-sm ring-1 ring-slate-200">
            <div class="mb-3 flex items-center justify-between">
                <h2 class="text-sm font-extrabold text-slate-900">Upcoming leave</h2>
                <a href="<?php echo e(route('epelcon.hr.leave')); ?>" class="text-xs font-bold text-indigo-600">Leave →</a>
            </div>
            <div class="space-y-2.5">
                <?php $__empty_1 = true; $__currentLoopData = $upcomingLeaves; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lv): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <div class="flex items-center justify-between rounded-xl bg-slate-50 px-3 py-2.5">
                        <div>
                            <p class="text-sm font-bold text-slate-800"><?php echo e($lv->employee->name ?? '—'); ?></p>
                            <p class="text-[11px] capitalize text-slate-500"><?php echo e($lv->type); ?> · <?php echo e($lv->start_date->format('j M')); ?> – <?php echo e($lv->end_date->format('j M')); ?></p>
                        </div>
                        <span class="rounded-full bg-emerald-100 px-2.5 py-1 text-[10px] font-bold text-emerald-700"><?php echo e($lv->days); ?>d</span>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <p class="py-6 text-center text-sm text-slate-400">No approved upcoming leave.</p>
                <?php endif; ?>
            </div>
        </div>

        <div class="rounded-2xl bg-white p-5 shadow-sm ring-1 ring-slate-200">
            <div class="mb-3 flex items-center justify-between">
                <h2 class="text-sm font-extrabold text-slate-900">Recent appraisals</h2>
                <a href="<?php echo e(route('epelcon.hr.appraisals')); ?>" class="text-xs font-bold text-indigo-600">All →</a>
            </div>
            <div class="space-y-2.5">
                <?php $__empty_1 = true; $__currentLoopData = $recentAppraisals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $appraisal): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <div class="flex items-center justify-between rounded-xl bg-slate-50 px-3 py-2.5">
                        <div>
                            <p class="text-sm font-bold text-slate-800"><?php echo e($appraisal->employee->name ?? '—'); ?></p>
                            <p class="text-[11px] text-slate-500"><?php echo e($appraisal->period); ?></p>
                        </div>
                        <span class="rounded-full px-2.5 py-1 text-[10px] font-bold <?php echo e($appraisal->score >= 7 ? 'bg-emerald-100 text-emerald-700' : ($appraisal->score >= 4 ? 'bg-amber-100 text-amber-700' : 'bg-rose-100 text-rose-700')); ?>"><?php echo e($appraisal->score); ?>/10</span>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <p class="py-6 text-center text-sm text-slate-400">No appraisals recorded yet.</p>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.epelcon', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\wamp64\www\hms\resources\views/epelcon/hr/dashboard.blade.php ENDPATH**/ ?>