<!-- Modal -->
<div class="modal fade" style="display:none" id="addBookingModal" tabindex="-1" aria-labelledby="addBookingModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog modal-dialog-centered modal-full">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="addBookingModalLabel">  เพิ่มตารางเรียน</h5>
            </div>
            <form action="{{ route('student.add_booking') }}"
                id="modalAddBookingFrm"
                novalidate class="{{ ($errors->any()) ? 'was-validated' : 'needs-validation' }}"
                method="post">
                @csrf
            <div class="modal-body">
                <input type="hidden" id="sid" name="sid" value="{{ $student->sid }}" >
                <input type="hidden" id="logStudent" name="logStudent" value="{{ $student->title.strip_tags($student->firstname)." ".strip_tags($student->lastname) }}" >
                <input type="hidden" id="vehicleType" value="{{ $student->courseType }}" >
                <input type="hidden" id="purpose" value="{{ $student->purpose }}" >
                <input type="hidden" id="enroll" name=enroll value="{{ $student->eid }}" >
                <input type="hidden" id="vbid" name=vbid value="0" >
                    <div class="row" id="addBookingRow">
                        <div class="col-1">
                            <div class="form-group">
                                <label for="gear">เกียร์ <span class="text-red">*</span></label>
                                <select id="gear" name="gear" class="selectpicker show-menu-arrow form-control" title="--เลือก--" required>
                                  <option value="ออโต้">ออโต้</option>
                                  <option value="ธรรมดา" >ธรรมดา</option>
                                </select>
                                @error('gear')
                                <div class="text-danger">{{  $message }}</div>
                                @enderror
                            </div>
                        </div>
                        <div class="col-2">
                            <div class="form-group">
                                <label for="date">วันที่ <span class="text-red">*</span></label>
                                <div class="input-group mb-3">
                                    <input type="text" class="form-control date" id="date" name="date" placeholder="ครั้งที่ " autocomplete="off"  required>
                                    <div class="input-group-append">
                                        <span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
                                    </div>
                                </div>
                                @error('date')
                                <div class="text-danger">{{  $message }}</div>
                                @enderror
                            </div>
                        </div>
                        <div class="col-1">
                            <div class="form-group">
                                <label for="starttime">เวลาเริ่ม <span class="text-red">*</span></label>
                                <select id="starttime" name="starttime" data-size="10" data-container="body" class="selectpicker show-menu-arrow form-control" title="--เลือก--"  required>
                                    @for ($i = 7; $i < 21; $i++)
                                    <option value="{{$i}}">{{ $i.":00"}}</option>
                                    @endfor
                                </select>
                                @error('starttime')
                                <div class="text-danger">{{  $message }}</div>
                                @enderror
                            </div>
                        </div>
                        <div class="col-4">
                            <div class="form-group">
                                <label for="hour">รายวิชา<span class="text-red">*</span></label>
                                <select id="hour" name="hour" class="selectpicker show-menu-arrow form-control" title="--เลือก--"  required>
                                    {{-- @foreach ($modules as $indexKey => $module)
                                    <option value="{{ $module->id.'-'.$module->module_hour.'-'.$module->drive }}">{{ "[". $module->module_hour ."] ".$module->module}}</option>
                                    @endforeach --}}
                                </select>
                                @error('hour')
                                <div class="text-danger">{{  $message }}</div>
                                @enderror
                            </div>
                        </div>
                        <div class="col-1">
                            <div class="form-group">
                                <label for="endtime">เวลาสิ้นสุด</label>
                                <input type="text" class="form-control" id="endtime" name="endtime" placeholder="เวลาสิ้นสุด" readonly>
                                @error('endtime')
                                <div class="text-danger">{{  $message }}</div>
                                @enderror
                            </div>
                        </div>

                        <div class="col-3">
                            <div class="form-group">
                                <label for="vehicle">รถ <span class="text-red">*</span></label>
                                <select id="vehicle" name="vehicle" data-size="10" data-container="body" class="selectpicker show-menu-arrow form-control" title="--เลือก--"  required>
                                </select>
                                @error('vehicle')
                                <div class="text-danger">{{  $message }}</div>
                                @enderror
                            </div>
                        </div>
                    </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">ปิด</button>
                <button type="submit" class="btn btn-success">เพิ่ม</button>
            </div>
            </form>
        </div>
    </div>
</div>
