<div class="tab d-none py-5">
    <div class="row form-group mb-3">
        <label class="col-md-4 col-lg-2 d-flex align-items-center justify-content-end gap-1 form-label">
            {{ _trans('common.Weekend') }} <span class="text-danger">*</span>
        </label>
        <div class="col-md-8 col-lg-10">
            <select name="weekends[]" class="form-control select2" id="weekends" multiple>
                @foreach (@$data['weekends'] ?? [] as $weekend)
                    <option value="{{ $weekend }}"
                        @if (in_array($weekend, $user->weekends ?? [])) selected
                        @elseif (old('weekends') && in_array($weekend, old('weekends') ?? []))
                            selected
                        @elseif (!@$user->weekends && !old('weekends') && in_array($weekend, $data['defaultWeekends'] ?? []))
                            selected @endif>
                        {{ $weekend }}
                    </option>
                @endforeach
            </select>
            @if ($errors->has('weekends'))
                <div class="error">{{ $errors->first('weekends') }}</div>
            @endif
        </div>
    </div>
    <div class="row form-group mb-3">
        <label class="col-md-4 col-lg-2 d-flex align-items-center justify-content-end gap-1 form-label">
            {{ _trans('common.Holiday') }}
        </label>
        <div class="col-md-8 col-lg-10">
            @php
                $employee_holiday_ids = array_values(json_decode(@$user->holidays, true) ?? []);
            @endphp
            <select name="holidays[]" class="form-control select2" id="holidays" multiple>
                @foreach (@$data['holidays'] ?? [] as $holiday)
                    <option value="{{ $holiday->id }}"
                        @if (old('holidays') && in_array($holiday->id, old('holidays') ?? [])) selected
                        @elseif (in_array($holiday->id, $employee_holiday_ids ?? []))
                            selected
                        @elseif (!count($employee_holiday_ids) && !old('holidays'))
                            selected @endif>
                        {{ $holiday->holiday }}
                    </option>
                @endforeach
            </select>
            @if ($errors->has('holidays'))
                <div class="error">{{ $errors->first('holidays') }}</div>
            @endif
        </div>
    </div>
</div>
