<?php if (isset($component)) { $__componentOriginala9a83a123d88acdd340fad74fb98f602 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginala9a83a123d88acdd340fad74fb98f602 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.layouts.tenant','data' => ['pageTitle' => 'Horarios']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('layouts.tenant'); ?>
<?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(['pageTitle' => 'Horarios']); ?>
    <?php if (isset($component)) { $__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.page-header','data' => ['title' => 'Horarios','subtitle' => 'Define la disponibilidad de cada empleado.']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('page-header'); ?>
<?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' => 'Horarios','subtitle' => 'Define la disponibilidad de cada empleado.']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e)): ?>
<?php $attributes = $__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e; ?>
<?php unset($__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e)): ?>
<?php $component = $__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e; ?>
<?php unset($__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e); ?>
<?php endif; ?>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
        <script>window.addEventListener('DOMContentLoaded',()=>window.sileo?.success("<?php echo e(session('success')); ?>"))</script>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    <div class="mb-6 bg-white rounded-2xl border border-ink-100 p-5 shadow-sm">
        <p class="text-xs font-semibold text-ink-500 uppercase tracking-wider mb-3">Seleccionar profesional</p>
        <div class="flex flex-wrap gap-3">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php $isSelected = $employee && $employee->id === $emp->id; ?>
                <a href="<?php echo e(route('tenant.schedules.index', ['employee' => $emp->id])); ?>"
                   class="flex items-center gap-2.5 px-4 py-2.5 rounded-xl border-2 transition-all no-underline"
                   style="<?php echo e($isSelected ? 'border-color:#6366f1;background:#eef2ff;' : 'border-color:#e2e8f0;background:#fff;'); ?>">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($emp->photoUrl()): ?>
                        <img src="<?php echo e($emp->photoUrl()); ?>" class="w-7 h-7 rounded-full object-cover flex-shrink-0" alt="<?php echo e($emp->fullName()); ?>">
                    <?php else: ?>
                        <div class="w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-bold flex-shrink-0"
                             style="background:<?php echo e($emp->color ?? '#6366f1'); ?>;">
                            <?php echo e(strtoupper(substr($emp->first_name, 0, 1))); ?>

                        </div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <span class="text-sm font-semibold" style="<?php echo e($isSelected ? 'color:#4338ca;' : 'color:#1e293b;'); ?>">
                        <?php echo e($emp->fullName()); ?>

                    </span>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($isSelected): ?>
                        <svg class="h-4 w-4 flex-shrink-0" style="color:#6366f1;" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
                        </svg>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?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($employee): ?>
    <form method="POST" action="<?php echo e(route('tenant.schedules.store')); ?>">
        <?php echo csrf_field(); ?>
        <input type="hidden" name="employee_id" value="<?php echo e($employee->id); ?>">

        <div class="space-y-3">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = \App\Enums\Weekday::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php $rows = $schedules[$day->value] ?? []; $hasRows = count($rows) > 0; ?>

                <div class="bg-white rounded-2xl border <?php echo e($hasRows ? 'border-ink-100' : 'border-dashed border-ink-200'); ?> overflow-hidden shadow-sm"
                     x-data="{
                         rows: <?php echo e(json_encode(array_values($rows))); ?>,
                         addRow() { this.rows.push({ start: '09:00', end: '18:00', active: true }) },
                         removeRow(i) { this.rows.splice(i, 1) }
                     }">

                    <div class="flex items-center justify-between px-5 py-3.5"
                         :class="rows.length > 0 ? 'border-b border-ink-100 bg-ink-50/50' : ''">
                        <div class="flex items-center gap-3">
                            <div class="w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0"
                                 :class="rows.length > 0 ? 'bg-indigo-100' : 'bg-ink-100'">
                                <svg class="h-4 w-4" :class="rows.length > 0 ? 'text-indigo-600' : 'text-ink-400'" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5" />
                                </svg>
                            </div>
                            <div>
                                <p class="text-sm font-semibold" :class="rows.length > 0 ? 'text-ink-900' : 'text-ink-400'"><?php echo e($day->label()); ?></p>
                                <p x-show="rows.length === 0" class="text-xs text-ink-400">Día no laboral</p>
                            </div>
                        </div>
                        <button type="button" @click="addRow()"
                            class="inline-flex items-center gap-1.5 text-xs font-semibold text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50 px-3 py-1.5 rounded-lg transition-colors">
                            <svg class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
                            </svg>
                            Añadir franja
                        </button>
                    </div>

                    <div x-show="rows.length > 0" class="px-5 py-3 space-y-2.5">
                        <template x-for="(row, i) in rows" :key="i">
                            <div class="flex items-center gap-3">
                                <div class="flex items-center gap-2 flex-1">
                                    <input type="time"
                                           :name="`days[<?php echo e($day->value); ?>][${i}][start]`"
                                           x-model="row.start"
                                           class="text-sm border border-ink-200 rounded-xl px-3 py-2 w-32 focus:border-indigo-400 focus:outline-none bg-ink-50 focus:bg-white transition">
                                    <div class="flex items-center gap-1 text-ink-400">
                                        <div class="h-px w-3 bg-ink-300"></div>
                                        <svg class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
                                            <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" />
                                        </svg>
                                        <div class="h-px w-3 bg-ink-300"></div>
                                    </div>
                                    <input type="time"
                                           :name="`days[<?php echo e($day->value); ?>][${i}][end]`"
                                           x-model="row.end"
                                           class="text-sm border border-ink-200 rounded-xl px-3 py-2 w-32 focus:border-indigo-400 focus:outline-none bg-ink-50 focus:bg-white transition">
                                </div>

                                
                                <label class="flex items-center gap-2 cursor-pointer select-none">
                                    <input type="checkbox"
                                           :name="`days[<?php echo e($day->value); ?>][${i}][active]`"
                                           x-model="row.active"
                                           class="sr-only peer">
                                    <div class="relative w-9 h-5 rounded-full transition-colors cursor-pointer pointer-events-none"
                                         :class="row.active ? 'bg-indigo-500' : 'bg-ink-200'">
                                        <div class="absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-all"
                                             :class="row.active ? 'left-[18px]' : 'left-0.5'"></div>
                                    </div>
                                    <span class="text-xs font-medium" :class="row.active ? 'text-indigo-600' : 'text-ink-500'">Activa</span>
                                </label>

                                <button type="button" @click="removeRow(i)"
                                    class="p-1.5 rounded-lg text-ink-400 hover:text-rose-600 hover:bg-rose-50 transition-colors flex-shrink-0">
                                    <svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
                                        <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
                                    </svg>
                                </button>
                            </div>
                        </template>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>

        <div class="mt-6 flex justify-end">
            <button type="submit"
                class="inline-flex items-center gap-2 px-6 py-2.5 rounded-xl bg-indigo-600 text-white text-sm font-semibold shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition">
                <svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
                </svg>
                Guardar horarios
            </button>
        </div>
    </form>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginala9a83a123d88acdd340fad74fb98f602)): ?>
<?php $attributes = $__attributesOriginala9a83a123d88acdd340fad74fb98f602; ?>
<?php unset($__attributesOriginala9a83a123d88acdd340fad74fb98f602); ?>
<?php endif; ?>
<?php if (isset($__componentOriginala9a83a123d88acdd340fad74fb98f602)): ?>
<?php $component = $__componentOriginala9a83a123d88acdd340fad74fb98f602; ?>
<?php unset($__componentOriginala9a83a123d88acdd340fad74fb98f602); ?>
<?php endif; ?>
<?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/CitasSoft/resources/views/tenant/schedules/index.blade.php ENDPATH**/ ?>