<?php $__env->startSection('content'); ?>
<div class="bg-gray-100 min-h-full p-4">

    <!-- Main Container -->
    <div class="bg-white p-4 shadow-sm border border-gray-200">
        
        <form action="<?php echo e(route('shifts.update', $shift->id)); ?>" method="POST" id="shiftForm">
            <?php echo csrf_field(); ?>
            <?php echo method_field('PUT'); ?>
            
            <!-- Shift Details Header -->
            <div class="bg-[#ff9800] text-white px-3 py-1.5 font-bold text-sm flex items-center shadow-sm mb-4">
                <i class="fa-solid fa-file mr-2"></i> Edit Shift Details
            </div>
            
            <!-- Basic Details -->
            <div class="grid grid-cols-1 md:grid-cols-6 gap-4 px-2 mb-6">
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Shift Name*</label>
                    <input type="text" name="name" value="<?php echo e(old('name', $shift->name)); ?>" required class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Shift Code *"(3 Char only)":</label>
                    <input type="text" name="shift_code" value="<?php echo e(old('shift_code', $shift->shift_code)); ?>" maxlength="3" class="w-full border border-gray-300 bg-gray-100 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Start Time</label>
                    <input type="time" name="start_time" id="start_time" value="<?php echo e(old('start_time', $shift->start_time)); ?>" required class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">End Time</label>
                    <input type="time" name="end_time" id="end_time" value="<?php echo e(old('end_time', $shift->end_time)); ?>" required class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Shift Duration</label>
                    <input type="text" name="shift_duration" id="shift_duration" value="<?php echo e(old('shift_duration', $shift->shift_duration)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800] bg-gray-50" readonly>
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Is Night Shift</label>
                    <select name="is_night_shift" id="is_night_shift" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                        <option value="No" <?php echo e(old('is_night_shift', $shift->is_night_shift) == 'No' ? 'selected' : ''); ?>>No</option>
                        <option value="Yes" <?php echo e(old('is_night_shift', $shift->is_night_shift) == 'Yes' ? 'selected' : ''); ?>>Yes</option>
                    </select>
                </div>
            </div>

            <!-- Shift Break Detail Section -->
            <div class="mb-6">
                <div class="bg-[#ff9800] text-white px-3 py-1 font-bold text-xs flex items-center shadow-sm mb-2">
                    Shift Break Detail
                </div>
                <div class="bg-gray-50 p-3 flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-8">
                    <!-- Break Times -->
                    <div class="flex-1 space-y-4">
                        <!-- Break 1 -->
                        <div class="grid grid-cols-5 gap-4 items-end border-b border-gray-200 pb-3">
                            <div class="flex items-center space-x-2 mb-2">
                                <input type="checkbox" name="is_break1" value="1" <?php echo e(old('is_break1', $shift->is_break1) ? 'checked' : ''); ?> class="h-3 w-3">
                                <span class="text-xs font-bold text-gray-800">Break1</span>
                            </div>
                            <div>
                                <label class="block text-[10px] font-bold text-gray-800">Begin Time</label>
                                <input type="time" name="break1_start" value="<?php echo e(old('break1_start', $shift->break1_start)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                            </div>
                            <div>
                                <label class="block text-[10px] font-bold text-gray-800">End Time</label>
                                <input type="time" name="break1_end" value="<?php echo e(old('break1_end', $shift->break1_end)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                            </div>
                            <div>
                                <label class="block text-[10px] font-bold text-gray-800">Break1 Duration</label>
                                <input type="text" name="break1_duration" value="<?php echo e(old('break1_duration', $shift->break1_duration)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                            </div>
                            <div class="col-span-5 grid grid-cols-4 gap-4 mt-2">
                                <div class="col-start-2">
                                    <label class="block text-[10px] font-bold text-gray-800">Max.Early Hour For Break out</label>
                                    <input type="time" name="break1_early_out" value="<?php echo e(old('break1_early_out', $shift->break1_early_out)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                                </div>
                                <div>
                                    <label class="block text-[10px] font-bold text-gray-800">Max.Late Hour For Break In</label>
                                    <input type="time" name="break1_late_in" value="<?php echo e(old('break1_late_in', $shift->break1_late_in)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                                </div>
                            </div>
                        </div>

                        <!-- Break 2 -->
                        <div class="grid grid-cols-5 gap-4 items-end">
                            <div class="flex items-center space-x-2 mb-2">
                                <input type="checkbox" name="is_break2" value="1" <?php echo e(old('is_break2', $shift->is_break2) ? 'checked' : ''); ?> class="h-3 w-3">
                                <span class="text-xs font-bold text-gray-800">Break2</span>
                            </div>
                            <div>
                                <label class="block text-[10px] font-bold text-gray-800">Begin Time</label>
                                <input type="time" name="break2_start" value="<?php echo e(old('break2_start', $shift->break2_start)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                            </div>
                            <div>
                                <label class="block text-[10px] font-bold text-gray-800">End Time</label>
                                <input type="time" name="break2_end" value="<?php echo e(old('break2_end', $shift->break2_end)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                            </div>
                            <div>
                                <label class="block text-[10px] font-bold text-gray-800">Break2 Duration</label>
                                <input type="text" name="break2_duration" value="<?php echo e(old('break2_duration', $shift->break2_duration)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                            </div>
                            <div class="col-span-5 grid grid-cols-4 gap-4 mt-2">
                                <div class="col-start-2">
                                    <label class="block text-[10px] font-bold text-gray-800">Max.Early Hour For Break out</label>
                                    <input type="time" name="break2_early_out" value="<?php echo e(old('break2_early_out', $shift->break2_early_out)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                                </div>
                                <div>
                                    <label class="block text-[10px] font-bold text-gray-800">Max.Late Hour For Break In</label>
                                    <input type="time" name="break2_late_in" value="<?php echo e(old('break2_late_in', $shift->break2_late_in)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Second Weekly Off Days Condition -->
            <div class="mb-4">
                <div class="bg-[#ff9800] text-white px-3 py-1 font-bold text-xs flex items-center shadow-sm mb-2">
                    Second Weekly Off Days Condition
                </div>
                <div class="bg-gray-50 p-2 flex space-x-6 px-4">
                    <?php $__currentLoopData = ['I', 'II', 'III', 'IV', 'V']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $daysArray = is_array(old('second_wo_days')) ? old('second_wo_days') : (is_array($shift->second_wo_days) ? $shift->second_wo_days : []);
                    ?>
                    <label class="flex items-center space-x-1 cursor-pointer">
                        <input type="checkbox" name="second_wo_days[]" value="<?php echo e($day); ?>" <?php echo e(in_array($day, $daysArray) ? 'checked' : ''); ?> class="h-3 w-3 bg-white">
                        <span class="text-xs font-bold text-gray-600"><?php echo e($day); ?></span>
                    </label>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>

            <!-- Weekly Off Rules -->
            <div class="grid grid-cols-1 md:grid-cols-4 gap-4 px-2 mb-6 mt-4">
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">First Weekly Off</label>
                    <select name="first_weekly_off" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                        <option value="Sunday" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'Sunday' ? 'selected' : ''); ?>>Sunday</option>
                        <option value="Monday" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'Monday' ? 'selected' : ''); ?>>Monday</option>
                        <option value="Tuesday" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'Tuesday' ? 'selected' : ''); ?>>Tuesday</option>
                        <option value="Wednesday" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'Wednesday' ? 'selected' : ''); ?>>Wednesday</option>
                        <option value="Thursday" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'Thursday' ? 'selected' : ''); ?>>Thursday</option>
                        <option value="Friday" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'Friday' ? 'selected' : ''); ?>>Friday</option>
                        <option value="Saturday" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'Saturday' ? 'selected' : ''); ?>>Saturday</option>
                        <option value="None" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'None' ? 'selected' : ''); ?>>None</option>
                        <option value="All Weeks" <?php echo e(old('first_weekly_off', $shift->first_weekly_off) == 'All Weeks' ? 'selected' : ''); ?>>All Weeks</option>
                    </select>
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Second Weekly Off</label>
                    <select name="second_weekly_off" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                        <option value="Sunday" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'Sunday' ? 'selected' : ''); ?>>Sunday</option>
                        <option value="Monday" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'Monday' ? 'selected' : ''); ?>>Monday</option>
                        <option value="Tuesday" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'Tuesday' ? 'selected' : ''); ?>>Tuesday</option>
                        <option value="Wednesday" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'Wednesday' ? 'selected' : ''); ?>>Wednesday</option>
                        <option value="Thursday" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'Thursday' ? 'selected' : ''); ?>>Thursday</option>
                        <option value="Friday" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'Friday' ? 'selected' : ''); ?>>Friday</option>
                        <option value="Saturday" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'Saturday' ? 'selected' : ''); ?>>Saturday</option>
                        <option value="None" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'None' ? 'selected' : ''); ?>>None</option>
                        <option value="All Weeks" <?php echo e(old('second_weekly_off', $shift->second_weekly_off) == 'All Weeks' ? 'selected' : ''); ?>>All Weeks</option>
                    </select>
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Second WO Type</label>
                    <select name="second_wo_type" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                        <option value="None" <?php echo e(old('second_wo_type', $shift->second_wo_type) == 'None' ? 'selected' : ''); ?>>None</option>
                        <option value="Half" <?php echo e(old('second_wo_type', $shift->second_wo_type) == 'Half' ? 'selected' : ''); ?>>Half</option>
                        <option value="Full" <?php echo e(old('second_wo_type', $shift->second_wo_type) == 'Full' ? 'selected' : ''); ?>>Full</option>
                    </select>
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Half Day Shift</label>
                    <select name="half_day_shift" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                        <option value="None" <?php echo e(old('half_day_shift', $shift->half_day_shift) == 'None' ? 'selected' : ''); ?>>None</option>
                        <?php $__currentLoopData = $allShifts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($s->id); ?>" <?php echo e(old('half_day_shift', $shift->half_day_shift) == $s->id ? 'selected' : ''); ?>><?php echo e($s->name); ?> (<?php echo e($s->shift_code); ?>)</option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Remove Duplicate Punch</label>
                    <input type="text" name="remove_duplicate_punch" value="<?php echo e(old('remove_duplicate_punch', $shift->remove_duplicate_punch)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Max.Early Hour Allow</label>
                    <input type="text" name="max_early_allow" value="<?php echo e(old('max_early_allow', $shift->max_early_allow)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">Max OT Allow</label>
                    <input type="text" name="max_ot_allow" value="<?php echo e(old('max_ot_allow', $shift->max_ot_allow)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
                <div>
                    <label class="block text-[11px] font-bold text-gray-800 mb-1">No. of Present for Weekly Off</label>
                    <input type="text" name="no_of_present_for_wo" value="<?php echo e(old('no_of_present_for_wo', $shift->no_of_present_for_wo)); ?>" class="w-full border border-gray-300 px-2 py-1 text-xs focus:outline-none focus:border-[#ff9800]">
                </div>
            </div>

            <!-- Mark as Absent Section -->
            <div class="mb-4">
                <div class="bg-[#ff9800] text-white px-3 py-1 font-bold text-xs flex items-center shadow-sm mb-2">
                    Mark as Absent as weekly Off as "";
                </div>
                <div class="bg-gray-50 p-2 flex justify-between items-center px-4">
                    <div class="flex space-x-12">
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="checkbox" name="mark_absent_aaa" value="1" <?php echo e(old('mark_absent_aaa', $shift->mark_absent_aaa) ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-xs font-bold text-gray-600">AAA</span>
                        </label>
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="checkbox" name="mark_absent_lwol" value="1" <?php echo e(old('mark_absent_lwol', $shift->mark_absent_lwol) ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-xs font-bold text-gray-600">L-WO-L</span>
                        </label>
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="checkbox" name="mark_absent_hld_abs_hld" value="1" <?php echo e(old('mark_absent_hld_abs_hld', $shift->mark_absent_hld_abs_hld) ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-xs font-bold text-gray-600">Hld-Abs-Hld</span>
                        </label>
                    </div>
                    <div class="flex items-center space-x-2">
                        <span class="text-[11px] font-bold text-gray-800">Single Punch Policy</span>
                        <select name="single_punch_policy" class="border border-gray-300 px-2 py-1 text-xs focus:outline-none w-48 focus:border-[#ff9800]">
                            <option value="None" <?php echo e(old('single_punch_policy', $shift->single_punch_policy) == 'None' ? 'selected' : ''); ?>>None</option>
                            <option value="Absent on Single Punch" <?php echo e(old('single_punch_policy', $shift->single_punch_policy) == 'Absent on Single Punch' ? 'selected' : ''); ?>>Absent on Single Punch</option>
                            <option value="Half Day one Single Punch" <?php echo e(old('single_punch_policy', $shift->single_punch_policy) == 'Half Day one Single Punch' ? 'selected' : ''); ?>>Half Day one Single Punch</option>
                        </select>
                    </div>
                </div>
            </div>

            <!-- Remove Duplicate Punch / Calculation Section -->
            <div class="mb-6">
                <div class="bg-[#ff9800] text-white px-3 py-1 font-bold text-xs flex items-center shadow-sm mb-2">
                    OverTime and Working Hrs Calculation
                </div>
                <div class="bg-gray-100 p-3 grid grid-cols-1 md:grid-cols-4 gap-4">
                    <div class="font-bold text-xs text-gray-800">OT Calculation</div>
                    <div class="col-span-3 flex space-x-6">
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="radio" name="ot_calculation_rule" value="Out Time-Shift End Time" <?php echo e(old('ot_calculation_rule', $shift->ot_calculation_rule) == 'Out Time-Shift End Time' ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-[10px] font-bold text-gray-700">OT = Out Time-Shift End Time</span>
                        </label>
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="radio" name="ot_calculation_rule" value="Working Hrs-Shift Hrs" <?php echo e(old('ot_calculation_rule', $shift->ot_calculation_rule) == 'Working Hrs-Shift Hrs' ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-[10px] font-bold text-gray-700">OT = Working Hrs-Shift Hrs</span>
                        </label>
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="radio" name="ot_calculation_rule" value="Early Coming+Late Departure" <?php echo e(old('ot_calculation_rule', $shift->ot_calculation_rule) == 'Early Coming+Late Departure' ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-[10px] font-bold text-gray-700">OT = Early Coming+Late Departure</span>
                        </label>
                    </div>
                    
                    <div class="font-bold text-xs text-gray-800">Working Calculation</div>
                    <div class="col-span-3 flex space-x-6">
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="radio" name="working_calculation_rule" value="Calculate All In Out" <?php echo e(old('working_calculation_rule', $shift->working_calculation_rule) == 'Calculate All In Out' ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-[10px] font-bold text-gray-700">Calculate All In Out</span>
                        </label>
                        <label class="flex items-center space-x-1 cursor-pointer">
                            <input type="radio" name="working_calculation_rule" value="Calculate First In Last Out" <?php echo e(old('working_calculation_rule', $shift->working_calculation_rule) == 'Calculate First In Last Out' ? 'checked' : ''); ?> class="h-3 w-3">
                            <span class="text-[10px] font-bold text-gray-700">Calculate First In Last Out</span>
                        </label>
                        <label class="flex flex-col space-y-1 cursor-pointer">
                            <div class="flex items-center space-x-1">
                                <input type="radio" name="working_calculation_rule" value="Calculate First In Last Out With Lunch" <?php echo e(old('working_calculation_rule', $shift->working_calculation_rule) == 'Calculate First In Last Out With Lunch' ? 'checked' : ''); ?> class="h-3 w-3">
                                <span class="text-[10px] font-bold text-gray-700">Calculate First In Last Out (Deduct Lunch)</span>
                            </div>
                            <div class="flex items-center space-x-1 ml-4 mt-1">
                                <input type="checkbox" name="deduct_lunch_punch" class="h-3 w-3">
                                <span class="text-[10px] text-gray-700">Lunch Deduct According to punch</span>
                            </div>
                        </label>
                    </div>
                </div>
            </div>

        </form>

        <!-- Form Action Buttons -->
        <div class="mt-6 text-center space-x-2 pb-4">
            <button type="submit" form="shiftForm" name="action" value="update" class="bg-[#4caf50] hover:bg-[#43a047] text-white px-6 py-2 rounded shadow text-sm font-semibold transition">Update</button>
            <button type="submit" form="shiftForm" name="action" value="update_with_master" class="bg-[#4caf50] hover:bg-[#43a047] text-white px-6 py-2 rounded shadow text-sm font-semibold transition">Update With Employee Master</button>
            <a href="<?php echo e(route('shifts.index')); ?>" class="bg-[#e91e63] hover:bg-[#d81b60] text-white px-6 py-2 rounded shadow text-sm font-semibold inline-block transition">Cancel</a>
        </div>
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        const startTimeInput = document.getElementById('start_time');
        const endTimeInput = document.getElementById('end_time');
        const durationInput = document.getElementById('shift_duration');
        const isNightShiftInput = document.getElementById('is_night_shift');

        function calculateDuration() {
            const start = startTimeInput.value;
            const end = endTimeInput.value;

            if (start && end) {
                const [startHours, startMinutes] = start.split(':').map(Number);
                const [endHours, endMinutes] = end.split(':').map(Number);

                let startTotalMinutes = (startHours * 60) + startMinutes;
                let endTotalMinutes = (endHours * 60) + endMinutes;

                // Handle Night Shift logic
                if (isNightShiftInput.value === 'Yes') {
                    // If it's night shift and end time is less than start time, add 24 hours to end time
                    if (endTotalMinutes <= startTotalMinutes) {
                        endTotalMinutes += 24 * 60;
                    }
                } else {
                    // For day shifts, if end time is less than start, something is wrong, we just don't calculate or clamp
                    if (endTotalMinutes < startTotalMinutes) {
                        endTotalMinutes += 24 * 60; 
                        isNightShiftInput.value = 'Yes';
                    }
                }

                let diffMinutes = endTotalMinutes - startTotalMinutes;

                // Recalculate just in case it was a valid day shift
                if (isNightShiftInput.value === 'No' && endTotalMinutes >= startTotalMinutes) {
                     diffMinutes = endTotalMinutes - startTotalMinutes;
                }
                
                if (diffMinutes < 0) diffMinutes = 0;

                const durHours = Math.floor(diffMinutes / 60);
                const durMins = diffMinutes % 60;

                durationInput.value = String(durHours).padStart(2, '0') + ':' + String(durMins).padStart(2, '0');
            }
        }

        startTimeInput.addEventListener('change', calculateDuration);
        endTimeInput.addEventListener('change', calculateDuration);
        isNightShiftInput.addEventListener('change', calculateDuration);
    });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\realtime\resources\views/admin/shifts/edit.blade.php ENDPATH**/ ?>