

<?php $__env->startSection('title', 'Attendance'); ?>
<?php $__env->startSection('heading', 'Attendance'); ?>

<?php $__env->startSection('content'); ?>
<?php echo $__env->make('attendance.top-submenu', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <?php
        $canManageAttendance = (bool) ($canManageAttendance ?? false);
        $markableUsers = $markableUsers ?? collect();
        $dayDetails = $dayDetails ?? [];
        $selectedEmployee = $selectedEmployee ?? null;
        $canRequestRegularization = (bool) ($canRequestRegularization ?? false);
        $regularizationsByDate = $regularizationsByDate ?? collect();
        $selectedYear = $selectedYear ?? now()->year;
        $selectedMonth = $selectedMonth ?? now()->month;
        $selectedEmployeeId = $selectedEmployeeId ?? auth()->id();
    ?>
    <?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('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([]); ?>
        <div class="mb-4 flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between">
            <div>
                <p class="text-slate-600">Monthly attendance calendar</p>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($selectedEmployee): ?>
                    <p class="mt-1 text-sm font-semibold text-slate-900">
                        <?php echo e($selectedEmployee->name); ?>

                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($selectedEmployee->department?->name): ?>
                            <span class="font-normal text-slate-500">· <?php echo e($selectedEmployee->department->name); ?></span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </p>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($weekoffRuleName)): ?>
                        <p class="mt-0.5 text-xs text-slate-500">Weekoff rule: <span class="font-medium text-slate-700"><?php echo e($weekoffRuleName); ?></span></p>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
            <div class="flex flex-wrap items-center gap-2 md:justify-end lg:justify-end">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($canManageAttendance): ?>
                    <button
                        type="button"
                        x-data
                        x-on:click="$dispatch('open-modal', 'attendance-add-new')"
                        class="inline-flex items-center rounded-lg bg-primary px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-95"
                    >
                        Add New Attendance
                    </button>
                    <a
                        href="<?php echo e(route('attendance.bulk')); ?>"
                        class="inline-flex items-center rounded-lg bg-orange-500 px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-95"
                    >
                        Mark Bulk Attendance
                    </a>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </div>

        <form method="GET" action="<?php echo e(route('attendance.index')); ?>" autocomplete="off" data-attendance-employee-id="<?php echo e((int) $selectedEmployeeId); ?>" data-attendance-month="<?php echo e($monthValue); ?>" class="mb-5 flex flex-wrap items-end justify-end gap-3 rounded-lg border border-slate-200 bg-slate-50 p-3">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($canPickEmployee ?? false): ?>
                <div class="justify-end">
                    <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Employee</label>
                    <select name="employee_id" autocomplete="off" class="w-full rounded-lg border border-slate-300 px-3 py-2 text-sm js-select2" onchange="this.form.submit()" style="width: 200px">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $employeeOptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $employee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($employee->id); ?>" <?php if((int) $selectedEmployeeId === (int) $employee->id): echo 'selected'; endif; ?>>
                                <?php echo e($employee->name); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </select>
                </div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            <div>
                <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Month</label>
                <input
                    type="month"
                    name="month_picker"
                    value="<?php echo e($monthValue); ?>"
                    max="<?php echo e(now()->format('Y-m')); ?>"
                    class="rounded-lg border border-slate-300 px-3 py-2 text-sm"
                    autocomplete="off"
                    onchange="syncAttendanceMonthFilter(this)"
                >
                <input type="hidden" name="year" id="attendance-year" value="<?php echo e($selectedYear); ?>">
                <input type="hidden" name="month" id="attendance-month" value="<?php echo e($selectedMonth); ?>">
            </div>
            <div class="flex items-center gap-2">
                <a
                    href="<?php echo e($prevMonthUrl); ?>"
                    class="inline-flex items-center rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50"
                    title="Previous month"
                >
                    <i class="bi bi-chevron-left"></i>
                </a>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($nextMonthUrl): ?>
                    <a
                        href="<?php echo e($nextMonthUrl); ?>"
                        class="inline-flex items-center rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50"
                        title="Next month"
                    >
                        <i class="bi bi-chevron-right"></i>
                    </a>
                <?php else: ?>
                    <span class="inline-flex cursor-not-allowed items-center rounded-lg border border-slate-200 bg-slate-100 px-3 py-2 text-sm text-slate-400">
                        <i class="bi bi-chevron-right"></i>
                    </span>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </form>

        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($canManageAttendance): ?>
            <?php if (isset($component)) { $__componentOriginal9f64f32e90b9102968f2bc548315018c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9f64f32e90b9102968f2bc548315018c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.modal','data' => ['name' => 'attendance-add-new','slideFrom' => 'right','class' => 'ml-auto h-full w-full max-w-3xl overflow-y-auto rounded-none border-l border-slate-200']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('modal'); ?>
<?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(['name' => 'attendance-add-new','slideFrom' => 'right','class' => 'ml-auto h-full w-full max-w-3xl overflow-y-auto rounded-none border-l border-slate-200']); ?>
                 <?php $__env->slot('title', null, []); ?> Add New Attendance <?php $__env->endSlot(); ?>
                <form id="attendance-add-new-form" action="<?php echo e(route('attendance.mark-multi-day')); ?>" method="POST" class="grid gap-3 md:grid-cols-2">
                    <?php echo csrf_field(); ?>
                    <div class="md:col-span-2">
                        <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Users</label>
                        <select name="user_ids[]" multiple required class="h-28 w-full rounded-lg border border-slate-300 px-3 py-2 text-sm">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $markableUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($user->id); ?>" <?php if((int) $selectedEmployeeId === (int) $user->id): echo 'selected'; endif; ?>><?php echo e($user->name); ?> (<?php echo e($user->employee_number ?? 'EMP-'.$user->id); ?>)</option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </select>
                    </div>
                    <div>
                        <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Date</label>
                        <input type="date" name="date" value="<?php echo e(now()->format('Y-m-d')); ?>" required class="w-full rounded-lg border border-slate-300 px-3 py-2 text-sm" max="<?php echo e(now()->format('Y-m-d')); ?>">
                    </div>
                    <div>
                        <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Clock In Time</label>
                        <input type="time" name="clock_in_time" step="1" required class="w-full rounded-lg border border-slate-300 px-3 py-2 text-sm">
                    </div>
                    <div>
                        <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Clock Out Time</label>
                        <input type="time" name="clock_out_time" step="1" class="w-full rounded-lg border border-slate-300 px-3 py-2 text-sm">
                    </div>
                    <div>
                        <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Clock In IP Address</label>
                        <input type="text" name="clock_in_ip_address" class="w-full rounded-lg border border-slate-300 px-3 py-2 text-sm" placeholder="Optional">
                    </div>
                    <div>
                        <label class="mb-1 block text-xs font-medium uppercase text-slate-500">Clock Out IP Address</label>
                        <input type="text" name="clock_out_ip_address" class="w-full rounded-lg border border-slate-300 px-3 py-2 text-sm" placeholder="Optional">
                    </div>
                    <div class="md:col-span-2 flex flex-wrap items-center gap-4 pt-1">
                        <label class="inline-flex items-center gap-2 text-sm text-slate-700">
                            <input type="checkbox" name="is_late" value="1" class="rounded border-slate-300">
                            Is Late
                        </label>
                        <label class="inline-flex items-center gap-2 text-sm text-slate-700">
                            <input type="checkbox" name="is_half_day" value="1" class="rounded border-slate-300">
                            Is Half Day
                        </label>
                    </div>
                    <div class="md:col-span-2 flex items-center justify-end gap-2 pt-2">
                        <input type="hidden" name="overwrite" value="1">
                        <button type="button" x-data x-on:click="$dispatch('close-modal')" class="inline-flex items-center rounded-lg bg-slate-100 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200">Cancel</button>
                        <button type="submit" class="inline-flex items-center rounded-lg bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-95">Create</button>
                    </div>
                </form>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9f64f32e90b9102968f2bc548315018c)): ?>
<?php $attributes = $__attributesOriginal9f64f32e90b9102968f2bc548315018c; ?>
<?php unset($__attributesOriginal9f64f32e90b9102968f2bc548315018c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9f64f32e90b9102968f2bc548315018c)): ?>
<?php $component = $__componentOriginal9f64f32e90b9102968f2bc548315018c; ?>
<?php unset($__componentOriginal9f64f32e90b9102968f2bc548315018c); ?>
<?php endif; ?>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

        <div class="mb-5 grid gap-3 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-6">
            <?php if (isset($component)) { $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.stat-card','data' => ['title' => 'Present','value' => $stats['present'],'iconClass' => 'bg-emerald-100 text-emerald-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('stat-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(['title' => 'Present','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($stats['present']),'iconClass' => 'bg-emerald-100 text-emerald-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']); ?>
                 <?php $__env->slot('icon', null, []); ?> <i class="bi bi-person-check"></i> <?php $__env->endSlot(); ?>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $attributes = $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $component = $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>

            <?php if (isset($component)) { $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.stat-card','data' => ['title' => 'Absent','value' => $stats['absent'],'iconClass' => 'bg-red-100 text-red-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('stat-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(['title' => 'Absent','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($stats['absent']),'iconClass' => 'bg-red-100 text-red-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']); ?>
                 <?php $__env->slot('icon', null, []); ?> <i class="bi bi-person-x"></i> <?php $__env->endSlot(); ?>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $attributes = $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $component = $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>

            <?php if (isset($component)) { $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.stat-card','data' => ['title' => 'On Leave','value' => $stats['on_leave'],'iconClass' => 'bg-sky-100 text-sky-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('stat-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(['title' => 'On Leave','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($stats['on_leave']),'iconClass' => 'bg-sky-100 text-sky-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']); ?>
                 <?php $__env->slot('icon', null, []); ?> <i class="bi bi-calendar-x"></i> <?php $__env->endSlot(); ?>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $attributes = $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $component = $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>

            <?php if (isset($component)) { $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.stat-card','data' => ['title' => 'Late Arrivals','value' => $stats['late'],'iconClass' => 'bg-amber-100 text-amber-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('stat-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(['title' => 'Late Arrivals','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($stats['late']),'iconClass' => 'bg-amber-100 text-amber-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']); ?>
                 <?php $__env->slot('icon', null, []); ?> <i class="bi bi-clock-history"></i> <?php $__env->endSlot(); ?>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $attributes = $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $component = $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>

            <?php if (isset($component)) { $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.stat-card','data' => ['title' => 'Missing Clock-out','value' => $stats['missing_punch_out'] ?? 0,'iconClass' => 'bg-red-100 text-red-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('stat-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(['title' => 'Missing Clock-out','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($stats['missing_punch_out'] ?? 0),'iconClass' => 'bg-red-100 text-red-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']); ?>
                 <?php $__env->slot('icon', null, []); ?> <i class="bi bi-clock-fill"></i> <?php $__env->endSlot(); ?>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $attributes = $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $component = $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>

            <?php if (isset($component)) { $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.stat-card','data' => ['title' => 'Reg. Pending','value' => $stats['regularization_pending'] ?? 0,'iconClass' => 'bg-violet-100 text-violet-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('stat-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(['title' => 'Reg. Pending','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($stats['regularization_pending'] ?? 0),'iconClass' => 'bg-violet-100 text-violet-700','iconWrapperClass' => 'h-10 w-10 rounded-lg flex items-center justify-center']); ?>
                 <?php $__env->slot('icon', null, []); ?> <i class="bi bi-pencil-square"></i> <?php $__env->endSlot(); ?>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $attributes = $__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__attributesOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682)): ?>
<?php $component = $__componentOriginal527fae77f4db36afc8c8b7e9f5f81682; ?>
<?php unset($__componentOriginal527fae77f4db36afc8c8b7e9f5f81682); ?>
<?php endif; ?>
        </div>

        <p class="mb-3 text-sm font-semibold text-slate-900">Attendance Calendar — <?php echo e($monthLabel); ?></p>

        <?php if (isset($component)) { $__componentOriginale10a95b46288cc662f28e46a1d1a71f3 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale10a95b46288cc662f28e46a1d1a71f3 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.attendance-month-calendar','data' => ['weeks' => $calendarWeeks,'employeeName' => $selectedEmployee?->name]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('attendance-month-calendar'); ?>
<?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(['weeks' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($calendarWeeks),'employee-name' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($selectedEmployee?->name)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale10a95b46288cc662f28e46a1d1a71f3)): ?>
<?php $attributes = $__attributesOriginale10a95b46288cc662f28e46a1d1a71f3; ?>
<?php unset($__attributesOriginale10a95b46288cc662f28e46a1d1a71f3); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale10a95b46288cc662f28e46a1d1a71f3)): ?>
<?php $component = $__componentOriginale10a95b46288cc662f28e46a1d1a71f3; ?>
<?php unset($__componentOriginale10a95b46288cc662f28e46a1d1a71f3); ?>
<?php endif; ?>

        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $dayDetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $date => $day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php
                $details = $day['sessions_detailed'] ?? [];
                $clockIn = $day['clock_in'] ?? null;
                $clockOut = $day['clock_out'] ?? null;
                $totalSeconds = (int) (($clockIn && $clockOut) ? $clockIn->diffInSeconds($clockOut) : 0);
                $effectiveSeconds = (int) array_sum(array_map(fn ($d) => (int) ($d['duration_seconds'] ?? 0), $details));
                $totalH = intdiv($effectiveSeconds, 3600);
                $totalM = intdiv($effectiveSeconds % 3600, 60);
                $effectiveLabel = ($totalH > 0) ? "{$totalH} hrs {$totalM} mins" : "{$totalM} mins";
                $prod = $totalSeconds > 0 ? round(($effectiveSeconds / $totalSeconds) * 100, 2) : null;
                $formattedDate = \Carbon\Carbon::parse($date)->format('l, d-m-Y');
                $dayStatus = (string) ($day['status'] ?? '');
                $canDayActions = ! in_array($dayStatus, ['weekoff', 'holiday', 'future', 'outside', 'not_joined'], true);
                $clockInTimeValue = $clockIn ? $clockIn->format('H:i:s') : '';
                $clockOutTimeValue = $clockOut ? $clockOut->format('H:i:s') : '';
                $regularizationClockInValue = $clockIn ? $clockIn->format('H:i') : '';
                $regularizationClockOutValue = $clockOut ? $clockOut->format('H:i') : '';
                $dayRegularization = $regularizationsByDate->get($date);
                $visualStatus = (string) ($day['visual_status'] ?? '');
                $statusIcon = (string) ($day['icon'] ?? '');
                $statusTextClass = match ($visualStatus) {
                    'present' => 'text-emerald-700',
                    'late' => 'text-amber-700',
                    'missing_punch_out' => 'text-red-700',
                    'in_progress' => 'text-sky-700',
                    'early_out' => 'text-orange-700',
                    default => 'text-slate-900',
                };
                $missingOut = $visualStatus === 'missing_punch_out';
            ?>
            <?php if (isset($component)) { $__componentOriginal9f64f32e90b9102968f2bc548315018c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9f64f32e90b9102968f2bc548315018c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.modal','data' => ['name' => 'attendance-day-'.e($date).'','slideFrom' => 'right','class' => 'ml-auto h-full w-full max-w-[800px] overflow-y-auto rounded-none border-l border-slate-200']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('modal'); ?>
<?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(['name' => 'attendance-day-'.e($date).'','slideFrom' => 'right','class' => 'ml-auto h-full w-full max-w-[800px] overflow-y-auto rounded-none border-l border-slate-200']); ?>
                 <?php $__env->slot('title', null, []); ?> Clock In/Out History <?php $__env->endSlot(); ?>
                <div class="space-y-3">
                    <div class="flex flex-col gap-3 border-b border-slate-200 pb-4 sm:flex-row sm:items-start sm:justify-between">
                        <div>
                            <p class="text-sm font-semibold text-slate-900"><?php echo e($selectedEmployee?->name ?? '—'); ?></p>
                            <p class="text-sm text-slate-600"><?php echo e($formattedDate); ?></p>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($day['display_status'] ?? ''): ?>
                                <p class="mt-2 inline-flex items-center gap-1.5 rounded-full bg-slate-100 px-2.5 py-1 text-xs font-semibold <?php echo e($statusTextClass); ?>">
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($statusIcon): ?>
                                        <i class="bi bi-<?php echo e($statusIcon); ?>"></i>
                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    <?php echo e($day['display_status']); ?>

                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($day['regularization_status'] ?? null): ?>
                                        <span class="text-slate-500">· Reg. <?php echo e(ucfirst($day['regularization_status'])); ?></span>
                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </p>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($canDayActions && $canManageAttendance): ?>
                            <div class="flex flex-wrap gap-2">
                                <button
                                    type="button"
                                    class="inline-flex items-center rounded-lg bg-primary px-3 py-2 text-xs font-medium text-white hover:opacity-95 sm:text-sm"
                                    onclick="openAttendanceEditForDay(<?php echo json_encode($date, 15, 512) ?>, <?php echo json_encode((int) $selectedEmployeeId, 15, 512) ?>, <?php echo json_encode($clockInTimeValue, 15, 512) ?>, <?php echo json_encode($clockOutTimeValue, 15, 512) ?>)"
                                >
                                    <i class="bi bi-pencil-square me-1"></i>Update Attendance
                                </button>
                            </div>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>

                    <div class="rounded-xl border border-slate-200 bg-slate-50 p-4">
                        <p class="text-sm font-semibold text-slate-900">Day Summary</p>
                        <div class="mt-3 grid gap-2 text-sm">
                            <div class="flex items-center justify-between">
                                <span class="text-slate-600">Status</span>
                                <span class="font-semibold text-slate-900"><?php echo e($day['display_status'] ?? '—'); ?></span>
                            </div>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($day['attendance_type_label'])): ?>
                                <div class="flex items-center justify-between">
                                    <span class="text-slate-600">Check-in type</span>
                                    <span class="font-semibold text-slate-900">
                                        <?php echo e($day['attendance_type_label']); ?>

                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($day['office_name']) && ($day['attendance_type'] ?? null) === 'office'): ?>
                                            <span class="font-normal text-slate-500">· <?php echo e($day['office_name']); ?></span>
                                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </span>
                                </div>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            <div class="flex items-center justify-between">
                                <span class="text-slate-600">Clock In</span>
                                <span class="font-semibold text-slate-900"><?php echo e($day['clock_in_label'] ?? '--'); ?></span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-slate-600">Clock Out</span>
                                <span class="<?php echo \Illuminate\Support\Arr::toCssClasses(['font-semibold', $missingOut && empty($day['clock_out_label']) ? 'text-red-600' : 'text-slate-900']); ?>">
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($missingOut && empty($day['clock_out_label'])): ?>
                                        <i class="bi bi-clock-fill me-1"></i>Missing
                                    <?php else: ?>
                                        <?php echo e($day['clock_out_label'] ?? '--'); ?>

                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-slate-600">Total Work Hours</span>
                                <span class="font-semibold text-slate-900"><?php echo e($day['hours'] ?? '--'); ?></span>
                            </div>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(($day['biometric_punch_count'] ?? 0) > 0): ?>
                                <div class="flex items-center justify-between">
                                    <span class="text-slate-600">Biometric punches</span>
                                    <span class="font-semibold text-slate-900"><?php echo e($day['biometric_punch_count']); ?></span>
                                </div>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($details)): ?>
                                <div class="flex items-center justify-between">
                                    <span class="text-slate-600">Effective Work Time</span>
                                    <span class="font-semibold text-slate-900"><?php echo e($effectiveLabel); ?></span>
                                </div>
                                <div class="flex items-center justify-between">
                                    <span class="text-slate-600">Productivity Rate</span>
                                    <span class="font-semibold <?php echo e(is_null($prod) ? 'text-slate-500' : 'text-emerald-700'); ?>">
                                        <?php echo e(is_null($prod) ? '--' : ($prod . ' %')); ?>

                                    </span>
                                </div>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                    </div>

                    <?php $bioPunches = $day['biometric_punches'] ?? []; ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($bioPunches)): ?>
                        <details class="rounded-xl border border-slate-200 bg-white open:shadow-sm" open>
                            <summary class="cursor-pointer list-none px-4 py-3 text-sm font-semibold text-slate-900">
                                Biometric punches
                                <span class="ml-1 font-normal text-slate-500">(<?php echo e(count($bioPunches)); ?>)</span>
                            </summary>
                            <div class="border-t border-slate-100 overflow-hidden">
                                <table class="min-w-full divide-y divide-slate-200">
                                    <thead class="bg-slate-50">
                                        <tr>
                                            <th class="px-4 py-2 text-left text-xs font-medium uppercase text-slate-500">Time</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium uppercase text-slate-500">Type</th>
                                        </tr>
                                    </thead>
                                    <tbody class="divide-y divide-slate-100 bg-white">
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $bioPunches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $bp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php
                                                $type = $bp['processed_type'] ?? ($bp['is_duplicate'] ? 'DUPLICATE' : '—');
                                                $typeClass = match ($type) {
                                                    'FIRST_IN' => 'bg-emerald-50 text-emerald-700',
                                                    'LAST_OUT' => 'bg-indigo-50 text-indigo-700',
                                                    'INTERMEDIATE' => 'bg-slate-100 text-slate-600',
                                                    'DUPLICATE' => 'bg-amber-50 text-amber-700',
                                                    default => 'bg-slate-100 text-slate-600',
                                                };
                                                $label = match ($type) {
                                                    'FIRST_IN' => 'First IN',
                                                    'LAST_OUT' => 'Last OUT',
                                                    'INTERMEDIATE' => 'Intermediate',
                                                    'DUPLICATE' => 'Duplicate',
                                                    default => $type,
                                                };
                                            ?>
                                            <tr>
                                                <td class="px-4 py-2.5 text-sm text-slate-700"><?php echo e($bp['time'] ?? '—'); ?></td>
                                                <td class="px-4 py-2.5 text-sm">
                                                    <span class="inline-flex rounded-full px-2 py-0.5 text-xs font-semibold <?php echo e($typeClass); ?>"><?php echo e($label); ?></span>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </tbody>
                                </table>
                            </div>
                        </details>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                    <div>
                        <p class="mb-2 text-sm font-semibold text-slate-900">Session Details</p>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($details)): ?>
                            <div class="overflow-hidden rounded-xl border border-slate-200">
                                <table class="min-w-full divide-y divide-slate-200">
                                    <thead class="bg-slate-50">
                                        <tr>
                                            <th class="px-4 py-3 text-left">Clock In Time</th>
                                            <th class="px-4 py-3 text-left">Clock Out Time</th>
                                            <th class="px-4 py-3 text-left">Duration</th>
                                            <th class="px-4 py-3 text-left">Notes</th>
                                        </tr>
                                    </thead>
                                    <tbody class="divide-y divide-slate-200 bg-white">
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                <td class="px-4 py-3 text-sm text-slate-700"><?php echo e($d['start'] ?? '--'); ?></td>
                                                <td class="px-4 py-3 text-sm text-slate-700"><?php echo e($d['end'] ?? '--'); ?></td>
                                                <td class="px-4 py-3 text-sm text-slate-700"><?php echo e($d['duration_label'] ?? '--'); ?></td>
                                                <td class="px-4 py-3 text-sm text-slate-600"><?php echo e($d['notes'] ?: '—'); ?></td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </tbody>
                                </table>
                            </div>
                        <?php else: ?>
                            <p class="text-sm text-slate-500">No session history for this date.</p>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>

                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($canDayActions && ($canRequestRegularization || $dayRegularization)): ?>
                        <?php echo $__env->make('attendance.partials.day-regularization', [
                            'date' => $date,
                            'regularization' => $dayRegularization,
                            'canRequest' => $canRequestRegularization,
                            'defaultClockIn' => $regularizationClockInValue,
                            'defaultClockOut' => $regularizationClockOutValue,
                            'selectedYear' => $selectedYear,
                            'selectedMonth' => $selectedMonth,
                            'selectedEmployeeId' => $selectedEmployeeId,
                        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                    <div class="flex justify-end pt-2">
                        <button type="button" x-data x-on:click="$dispatch('close-modal')" class="inline-flex items-center rounded-lg bg-slate-100 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200">Close</button>
                    </div>
                </div>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9f64f32e90b9102968f2bc548315018c)): ?>
<?php $attributes = $__attributesOriginal9f64f32e90b9102968f2bc548315018c; ?>
<?php unset($__attributesOriginal9f64f32e90b9102968f2bc548315018c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9f64f32e90b9102968f2bc548315018c)): ?>
<?php $component = $__componentOriginal9f64f32e90b9102968f2bc548315018c; ?>
<?php unset($__componentOriginal9f64f32e90b9102968f2bc548315018c); ?>
<?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>

    <?php $__env->startPush('scripts'); ?>
        <script>
            function restoreAttendanceFiltersFromPage() {
                const form = document.querySelector('form[data-attendance-employee-id]');
                if (!form) {
                    return;
                }

                const employeeId = form.getAttribute('data-attendance-employee-id');
                const select = form.querySelector('select[name="employee_id"]');
                if (select && employeeId) {
                    const option = Array.from(select.options).find((item) => String(item.value) === String(employeeId));
                    const rendered = select.nextElementSibling?.classList.contains('select2-container')
                        ? select.nextElementSibling.querySelector('.select2-selection__rendered')
                        : null;
                    const renderedLabel = (rendered?.getAttribute('title') || rendered?.textContent || '').trim();
                    const optionLabel = (option?.text || '').trim();
                    const filterIsStale = String(select.value) !== String(employeeId)
                        || (optionLabel !== '' && renderedLabel !== '' && renderedLabel !== optionLabel);

                    if (filterIsStale) {
                        const onChange = select.getAttribute('onchange');
                        select.onchange = null;
                        if (onChange) {
                            select.removeAttribute('onchange');
                        }
                        if (window.jQuery && window.jQuery(select).data('select2')) {
                            window.jQuery(select).val(String(employeeId)).trigger('change.select2');
                        } else {
                            select.value = String(employeeId);
                        }
                        if (onChange) {
                            select.setAttribute('onchange', onChange);
                        }
                    }
                }

                const monthValue = form.getAttribute('data-attendance-month');
                if (!monthValue) {
                    return;
                }
                const monthInput = form.querySelector('input[name="month_picker"]');
                if (monthInput && monthInput.value !== monthValue) {
                    monthInput.value = monthValue;
                }
                const [year, month] = monthValue.split('-');
                const yearInput = document.getElementById('attendance-year');
                const monthHidden = document.getElementById('attendance-month');
                if (yearInput) {
                    yearInput.value = year;
                }
                if (monthHidden && month) {
                    monthHidden.value = String(parseInt(month, 10));
                }
            }

            window.addEventListener('pageshow', restoreAttendanceFiltersFromPage);

            function syncAttendanceMonthFilter(input) {
                if (!input.value) {
                    return;
                }
                const [year, month] = input.value.split('-');
                document.getElementById('attendance-year').value = year;
                document.getElementById('attendance-month').value = String(parseInt(month, 10));
                input.form.submit();
            }

            function openAttendanceEditForDay(date, userId, clockIn, clockOut) {
                const form = document.getElementById('attendance-add-new-form');
                if (!form) {
                    return;
                }

                const dateInput = form.querySelector('[name="date"]');
                if (dateInput) {
                    dateInput.value = date;
                }

                const userSelect = form.querySelector('[name="user_ids[]"]');
                if (userSelect) {
                    Array.from(userSelect.options).forEach((option) => {
                        option.selected = String(option.value) === String(userId);
                    });
                    if (window.jQuery && window.jQuery(userSelect).data('select2')) {
                        window.jQuery(userSelect).trigger('change');
                    }
                }

                const clockInInput = form.querySelector('[name="clock_in_time"]');
                const clockOutInput = form.querySelector('[name="clock_out_time"]');
                if (clockInInput) {
                    clockInInput.value = clockIn || '';
                }
                if (clockOutInput) {
                    clockOutInput.value = clockOut || '';
                }

                window.dispatchEvent(new CustomEvent('close-modal'));
                window.dispatchEvent(new CustomEvent('open-modal', { detail: 'attendance-add-new' }));
            }
        </script>
    <?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/kiyohr/v2_version/resources/views/attendance/index.blade.php ENDPATH**/ ?>