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

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames(([
    'weeks' => [],
    'employeeName' => 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(([
    'weeks' => [],
    'employeeName' => 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
    $weekdayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];

    $statusStyles = [
        'present' => ['bg' => 'bg-emerald-50', 'text' => 'text-emerald-600', 'icon' => 'check-circle-fill'],
        'late' => ['bg' => 'bg-amber-50', 'text' => 'text-amber-600', 'icon' => 'check-circle'],
        'missing_punch_out' => ['bg' => 'bg-red-50', 'text' => 'text-red-600', 'icon' => 'clock-fill'],
        'in_progress' => ['bg' => 'bg-sky-50', 'text' => 'text-sky-600', 'icon' => 'clock-history'],
        'early_out' => ['bg' => 'bg-orange-50', 'text' => 'text-orange-600', 'icon' => 'box-arrow-right'],
        'half_day' => ['bg' => 'bg-amber-50', 'text' => 'text-amber-600', 'icon' => 'circle-half'],
        'leave' => ['bg' => 'bg-fuchsia-50', 'text' => 'text-fuchsia-600', 'icon' => 'calendar-x'],
        'holiday' => ['bg' => 'bg-teal-50', 'text' => 'text-teal-600', 'icon' => 'calendar-event'],
        'weekoff' => ['bg' => 'bg-slate-50', 'text' => 'text-slate-400', 'icon' => 'moon'],
        'absent' => ['bg' => 'bg-red-50', 'text' => 'text-red-500', 'icon' => 'x-circle-fill'],
        'not_joined' => ['bg' => 'bg-white', 'text' => 'text-slate-300', 'icon' => 'dash-circle'],
    ];

    $regBadge = [
        'pending' => ['icon' => 'pencil-square', 'class' => 'text-violet-600 bg-violet-100'],
        'approved' => ['icon' => 'check2-circle', 'class' => 'text-teal-600 bg-teal-100'],
        'rejected' => ['icon' => 'x-circle', 'class' => 'text-rose-600 bg-rose-100'],
    ];

    $legend = [
        ['key' => 'present', 'label' => 'Present'],
        ['key' => 'late', 'label' => 'Late'],
        ['key' => 'missing_punch_out', 'label' => 'Missing Clock-out'],
        ['key' => 'in_progress', 'label' => 'In progress'],
        ['key' => 'early_out', 'label' => 'Early out'],
        ['key' => 'half_day', 'label' => 'Half day'],
        ['key' => 'leave', 'label' => 'On leave'],
        ['key' => 'weekoff', 'label' => 'Week off'],
        ['key' => 'holiday', 'label' => 'Holiday'],
        ['key' => 'absent', 'label' => 'Absent'],
        ['key' => 'not_joined', 'label' => 'Not joined'],
    ];
?>

<div <?php echo e($attributes->merge(['class' => 'space-y-4'])); ?>>
    <div class="flex flex-wrap items-center gap-x-4 gap-y-2 text-xs font-medium text-slate-600">
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $legend; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php $s = $statusStyles[$item['key']] ?? null; ?>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($s): ?>
                <span class="inline-flex items-center gap-1">
                    <i class="bi bi-<?php echo e($s['icon']); ?> <?php echo e($s['text']); ?>"></i>
                    <?php echo e($item['label']); ?>

                </span>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        <span class="inline-flex items-center gap-1"><i class="bi bi-pencil-square text-violet-600"></i> Reg. pending</span>
        <span class="inline-flex items-center gap-1"><i class="bi bi-check2-circle text-teal-600"></i> Reg. approved</span>
        <span class="inline-flex items-center gap-1"><i class="bi bi-x-circle text-rose-600"></i> Reg. rejected</span>
    </div>

    <div class="overflow-hidden rounded-xl border border-slate-200">
        <div class="grid grid-cols-7 border-b border-slate-200 bg-slate-50">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $weekdayLabels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="px-2 py-2 text-center text-xs font-semibold uppercase tracking-wide text-slate-500"><?php echo e($label); ?></div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?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 $__currentLoopData = $weeks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $week): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="grid grid-cols-7 border-b border-slate-200 last:border-b-0">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $week; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cell): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $inMonth = (bool) ($cell['in_month'] ?? false);
                        $isFuture = (bool) ($cell['is_future'] ?? false);
                        $isToday = (bool) ($cell['is_today'] ?? false);
                        $visualStatus = (string) ($cell['visual_status'] ?? '');
                        if ($visualStatus === '' && $inMonth && ! $isFuture) {
                            $visualStatus = (string) ($cell['status'] ?? '');
                        }
                        $styles = $statusStyles[$visualStatus] ?? ['bg' => 'bg-white', 'text' => 'text-slate-400', 'icon' => ''];
                        $icon = (string) ($cell['icon'] ?? $styles['icon']);
                        $bgClass = $inMonth ? $styles['bg'] : 'bg-slate-50/60';
                        if ($isToday && $inMonth) {
                            $bgClass = $styles['bg'] . ' ring-2 ring-primary/30';
                        }
                        $textClass = $inMonth && ! $isFuture ? $styles['text'] : 'text-slate-300';
                        $isClickable = (bool) ($cell['is_clickable'] ?? false);
                        $regStatus = $cell['regularization_status'] ?? null;
                        $reg = $regStatus ? ($regBadge[$regStatus] ?? null) : null;
                    ?>
                    <div
                        class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                            'relative min-h-[92px] border-r border-slate-200 p-2 last:border-r-0',
                            $bgClass,
                            ! $inMonth ? 'opacity-50' : '',
                        ]); ?>"
                    >
                        <div class="flex items-start justify-between gap-1">
                            <span class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                                'text-sm font-semibold',
                                $isToday ? 'text-primary' : ($inMonth ? 'text-slate-900' : 'text-slate-400'),
                            ]); ?>"><?php echo e($cell['day'] ?? ''); ?></span>
                            <div class="flex items-center gap-0.5">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($reg): ?>
                                    <span class="inline-flex h-5 w-5 items-center justify-center rounded-full <?php echo e($reg['class']); ?>" title="Regularization: <?php echo e(ucfirst($regStatus)); ?>">
                                        <i class="bi bi-<?php echo e($reg['icon']); ?> text-[10px]"></i>
                                    </span>
                                <?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($inMonth && ! $isFuture && $icon !== ''): ?>
                                    <i class="bi bi-<?php echo e($icon); ?> text-sm <?php echo e($textClass); ?>" title="<?php echo e($cell['tooltip'] ?? ''); ?>"></i>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </div>
                        </div>

                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($inMonth && ! $isFuture && ($cell['display_status'] ?? '') !== ''): ?>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($isClickable): ?>
                                <button
                                    type="button"
                                    x-data
                                    x-on:click="$dispatch('open-modal', 'attendance-day-<?php echo e($cell['date']); ?>')"
                                    class="mt-2 w-full rounded-lg px-1 py-1 text-left text-[11px] leading-tight text-slate-600 hover:bg-white/70"
                                    title="<?php echo e($cell['tooltip'] ?? ''); ?>"
                                >
                                    <span class="block font-medium <?php echo e($textClass); ?>"><?php echo e($cell['display_status']); ?></span>
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($cell['attendance_type_short'])): ?>
                                        <span class="block truncate text-slate-500"><?php echo e($cell['attendance_type_short']); ?></span>
                                    <?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($cell['clock_in_label'])): ?>
                                        <span class="block truncate">
                                            <?php echo e($cell['clock_in_label']); ?>

                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($cell['clock_out_label'])): ?>
                                                – <?php echo e($cell['clock_out_label']); ?>

                                            <?php elseif($visualStatus === 'missing_punch_out'): ?>
                                                <i class="bi bi-clock-fill text-red-600"></i>
                                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </span>
                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </button>
                            <?php else: ?>
                                <div class="mt-2 px-1 text-[11px] leading-tight text-slate-600">
                                    <span class="block font-medium <?php echo e($textClass); ?>"><?php echo e($cell['display_status']); ?></span>
                                </div>
                            <?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>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>
</div>
<?php /**PATH /var/www/html/kiyohr/v2_version/resources/views/components/attendance-month-calendar.blade.php ENDPATH**/ ?>