


<div class="row mb-3">
    
    <div class="col-md-3">
        <label class="form-label">Branch</label>
        <select name="branch_id" class="form-control">
            <option value="">All Branches</option>
            <?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($branch->id); ?>"
                    <?php if(old('branch_id', $shiftSegment->branch_id ?? '') == $branch->id): echo 'selected'; endif; ?>>
                    <?php echo e($branch->name); ?>

                </option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
    </div>
    <div class="col-md-4">
        <label class="form-label">Segment Name <span class="text-danger">*</span></label>
        <input type="text"
               name="name"
               class="form-control"
               maxlength="150"
               value="<?php echo e(old('name', $shiftSegment->name ?? '')); ?>"
               required>
    </div>

    <div class="col-md-3">
        <label class="form-label">Effective From <span class="text-danger">*</span></label>
        <input type="date"
               name="effective_from"
               id="effectiveFrom"
               class="form-control"
               value="<?php echo e(old('effective_from', $shiftSegment->effective_from ?? now()->toDateString())); ?>"
               required>
    </div>

    <div class="col-md-2 d-flex align-items-end">
        <div class="form-check">
            <input type="checkbox"
                   name="status"
                   class="form-check-input"
                   value="1"
                   <?php if(old('status', $shiftSegment->status ?? true)): echo 'checked'; endif; ?>>
            <label class="form-check-label">Active</label>
        </div>
    </div>
</div>


<table class="table table-bordered" id="weekdayTable">
    <thead>
        <tr>
            <th width="200">Week Day</th>
            <th>Shift</th>
        </tr>
    </thead>
    <tbody>
        <?php
            $weekDays = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];
        ?>

        <?php $__currentLoopData = $weekDays; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr data-weekday="<?php echo e($day); ?>">
                <td class="text-capitalize fw-semibold">
                    <?php echo e($day); ?>

                </td>
                <td>
                    <select name="days[<?php echo e($day); ?>]" class="form-control" required>
                        <option value="">-- Select --</option>
                        <?php $__currentLoopData = $shifts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $shift): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($shift->id); ?>"
                                <?php if(
                                    isset($shiftSegment) &&
                                    optional(
                                        $shiftSegment->days->where('weekday', $day)->first()
                                    )->shift_id == $shift->id
                                ): echo 'selected'; endif; ?>>
                                <?php echo e($shift->code); ?> - <?php echo e($shift->name); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </tbody>
</table>


<?php /**PATH /home/codeproh/va.laraoffice.com/app/Modules/HR/Core/Providers/../Views/shift_segment/partials/form.blade.php ENDPATH**/ ?>