<form class="row g-3 auto-width" action="{{ route('appointment-doctor-schedule.update', $doctor_schedule->doctor_id) }}"
    method="POST" enctype='multipart/form-data' id="tax_master_sub_form">
    @csrf
    @method('patch')
    <div class="col-md-12">
        <div>
            <label for="doctor_id" class="form-label">Account<span class="text-danger"><b>*</b></span></label>
        </div>
        <div class="input-group">
            <select class="single-select form-control" name="doctor_id" disabled>
                @foreach ($account as $list)
                    <option value="{{ $list->id }}"
                        {{ $list->id == $doctor_schedule->doctor_id ? 'selected' : '' }}>
                        {{ $list->getAccount->name }}
                    </option>
                @endforeach
            </select>
        </div>
    </div>   
    <!-- Days -->
    {{-- <div class="col-md-12" id="test_items">
        <label for="day" class="form-label">Appointment Day <span class="text-danger"><b>*</b></span></label>
                @php
                    $days = explode(',', $doctor_schedule->day);
                @endphp
        <select class="multi-select-tests" multiple name="day[]" required>
            @foreach (daysOfWeek() as $key => $value)           
           <option  value="{{ $key }}" {{ in_array($key, $days) ? 'selected' : '' }}>{!! $value !!}</option>
            @endforeach
        </select>
        <button class="btn btn-primary select-all-button" style="float: right; margin-top: 2px">Select All</button>
    </div> --}}
    
    <!-- Appointment Shift -->
    <div class="col-md-6">
        <div>
            <label for="shift_id" class="form-label">Appointment Shift <span class="text-danger"><b>*</b></span></label>
        </div>
        <div class="input-group">
            <select class="single-select form-control" name="shift_id">
                @foreach ($shift as $list)
                <option value="{{ $list->id }}" {{ $list->id == $doctor_schedule->shift ? 'selected' : '' }}>
                    {{ $list->name }}
                @endforeach
            </select>
        </div>
        <span class="text-danger error_shift_id" style="display: none;">This field is required.</span>
    </div>    
    <!-- Priority -->
    <div class="col-md-6">
        <label for="priority" class="form-label">Priority <span class="text-danger"><b>*</b></span></label>
        <input type="number" class="form-control" name="priority" aria-describedby="inputGroupPrepend" required
            value="{{ $doctor_schedule->priority }}">
        <span class="text-danger error_priority" style="display:none;">This field is required.</span>
    </div>
</form>
{{-- <script>
    $(document).ready(function() {
        $('.multi-select-tests').select2({
              theme: 'bootstrap4',
              dropdownParent: $("#test_items"),
              placeholder: "Select Test Items",
              width: $(this).data('width') ? $(this).data('width') : $(this).hasClass('w-100') ? '100%' : 'style',
              allowClear: Boolean($(this).data('allow-clear')),
          });
  
        $('.select-all-button').on('click', function(event) {
            event.preventDefault();
            var $multiSelect = $('.multi-select-tests');
            var $options = $multiSelect.find('option');

            // Check if all options are currently selected
            var allSelected = $options.length === $options.filter(':selected').length;

            // If all options are currently selected, unselect them; otherwise, select them all
            $options.prop('selected', !allSelected);
            $multiSelect.trigger('change');

            // Update the button text based on the new state
            $(this).text(allSelected ? 'Select All' : 'Unselect All');
        });
    });
</script> --}}

