<!-- Modal -->
<div class="modal fade teacherModal2" id="teacherModal2<?php echo e($vehicle->id.$w.$i); ?>" tabindex="-1" aria-labelledby="teacherModal2<?php echo e($vehicle->id.$w.$i); ?>Label" aria-hidden="true" data-backdrop="static" >
    <div class="modal-dialog modal-dialog-centered">

        <?php if(date('Y-m-d')==$week[$w]): ?>
            <?php if(numberOfStudent($arrValue2[$w][$vehicle->id][$i])==1): ?> <!-- มีผู้เรียนแค่ 1 คนในช่วงเวลา -->
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title-card" id="teacherModal2<?php echo e($vehicle->id.$w.$i); ?>Label">ระบุผู้สอน</h5>
                </div>
                <div class="modal-body">
                    <div class="row mb-3">
                        <div class="col-12 ">
                            <label id="vehicle-name" class="modal-label-card float-left"><?php echo e($vehicle->type ." คันที่ : ".$vehicle->number . " , " . $vehicle->brand." ".$vehicle->model. " [ ".$vehicle->registration_class." ".$vehicle->registration_number." ]"); ?> <?php if($arrGear2[$w][$vehicle->id][$i]=='m'): ?> <?php echo e("(ธรรมดา)"); ?> <?php else: ?> <?php echo e("(ออโต้)"); ?> <?php endif; ?></label>
                        </div>
                    </div>

                    <div class="row mt-2">
                        <div class="col-12 ">
                            <label id="student-name<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">ผู้เรียน : <?php echo e($arrValue2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="module<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">วิชา : <?php echo e($arrModule2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12">
                            <label id="drive-time<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">เวลา : <?php echo e(formatTimeFromDB($arrSchedule2[$w][$vehicle->id][$i]) . " ถึง " . getEndTimeFromHour($arrSchedule2[$w][$vehicle->id][$i], ($arrSpan2[$w][$vehicle->id][$i])/2 ) ." น."); ?></label>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="note<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">หมายเหตุ : <?php echo e($arrStuNote2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <form action="<?php echo e(route('calendar.booking')); ?>"
                            name="teacherBookFrm2"
                            id="teacherBookFrm2<?php echo e($vehicle->id.$w.$i); ?>"
                            novalidate class="teacherBookFrm2 <?php echo e(($errors->any()) ? 'was-validated' : 'needs-validation'); ?>"
                            method="post"
                    >
                    <?php echo csrf_field(); ?>
                        <input type="hidden" name="vehicleBookingID" id="vehicle-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($arrBooking2[$w][$vehicle->id][$i]); ?>">
                        <input type="hidden" name="purpose" value="เรียนและสอบ">
                        <div class="row mt-4">
                            <div class="col-12">
                                <div class="form-group">
                                    <input type="hidden" name="teacherSelected" class="teacherSelected" value="<?php echo e($arrTeacher2[$w][$vehicle->id][$i]); ?>">
                                    <label for="teacher<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left mb-2">ผู้สอน <?php if(date('Y-m-d')==$week[$w]): ?><span class="text-red">*</span><?php endif; ?></label>
                                    <select id="teacher<?php echo e($vehicle->id.$w.$i); ?>" name="teacher" data-size="10" data-container="body" title="--เลือก--" class="selectpicker show-menu-arrow form-control teacher" required>
                                        <?php $__currentLoopData = $teachers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $teacher): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($teacher->type=='t' || $teacher->type=='a'): ?>
                                        <option value="<?php echo e($teacher->id); ?>" <?php if($teacher->id == $arrTeacher2[$w][$vehicle->id][$i]): ?> selected <?php endif; ?>><?php echo e($teacher->title.$teacher->firstname. " " .$teacher->lastname); ?></option>
                                        <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['teacher<?php echo e($vehicle->id.$w.$i); ?>'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                        <div class="row teacherTypeDiv" <?php if(!$arrTeacherScan2[$w][$vehicle->id][$i]): ?>style="display: none;" <?php endif; ?>>
                            <div class="col-12">
                                <div class="form-group d-flex justify-content-start">
                                    <div class="icheck-inline">
                                        <label class="modal-label-card" >ครูสอนกับครูสแกน : </label>
                                    </div>
                                    <div class="icheck-nephritis icheck-inline">
                                        <input type="radio" id="sameTeacher<?php echo e($vehicle->id.$w.$i); ?>" name="teacherType" value="true" <?php if($arrTeacherScan2[$w][$vehicle->id][$i] == $arrTeacher2[$w][$vehicle->id][$i]): ?> checked <?php endif; ?> required>
                                        <label class="modal-label-card" for="sameTeacher<?php echo e($vehicle->id.$w.$i); ?>">คนเดียวกัน</label>
                                    </div>
                                    <div class="icheck-nephritis icheck-inline">
                                        <input type="radio" id="noSameTeacher<?php echo e($vehicle->id.$w.$i); ?>" name="teacherType" value="false" <?php if($arrTeacherScan2[$w][$vehicle->id][$i] != $arrTeacher2[$w][$vehicle->id][$i]): ?> checked <?php endif; ?>>
                                        <label class="modal-label-card" for="noSameTeacher<?php echo e($vehicle->id.$w.$i); ?>">คนละคนกัน</label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row teacherScanDiv" <?php if(!$arrTeacherScan2[$w][$vehicle->id][$i] || $arrTeacherScan2[$w][$vehicle->id][$i]==$arrTeacher2[$w][$vehicle->id][$i]): ?>style="display: none;" <?php endif; ?>>
                            <div class="col-12">
                                <div class="form-group">
                                    <label for="teacherScan<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left mb-2">ผู้สอนสแกน <?php if(date('Y-m-d')==$week[$w]): ?><span class="text-red">*</span><?php endif; ?></label>
                                    <select id="teacherScan<?php echo e($vehicle->id.$w.$i); ?>" name="teacherScan" data-size="10" data-container="body" title="--เลือก--" class="selectpicker show-menu-arrow form-control teacher-scan" required>
                                        <?php $__currentLoopData = $teachers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $teacher): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php if($teacher->type=='s' || $teacher->type=='a'): ?>
                                            <option value="<?php echo e($teacher->id); ?>" <?php if($teacher->id == $arrTeacherScan2[$w][$vehicle->id][$i]): ?> selected <?php endif; ?>><?php echo e($teacher->title.$teacher->firstname. " " .$teacher->lastname); ?></option>
                                            <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['teacherScan<?php echo e($vehicle->id.$w.$i); ?>'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                    </div> <!-- modal-body -->
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">ปิด</button>
                    <button type="submit" id="bookBtn<?php echo e($vehicle->id.$w.$i); ?>" class="btn btn-success" onclick="document.getElementById('teacherBookFrm2<?php echo e($vehicle->id.$w.$i); ?>').submit();">ตกลง</button>
                    </form>
                        <?php if(check_cancel_booking($arrSchedule2[$w][$vehicle->id][$i])): ?> <!--เวลาปัจจุบัน(ทำรายยกเลิกได้) ก่อนเรียน > 4 ชม. -->
                            <form action="<?php echo e(route('calendar.cancel_booking')); ?>"
                                method="post"
                                
                            >
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                                <input type="hidden" name="vehicleBookingID" id="vehicle-cancle-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($arrBooking2[$w][$vehicle->id][$i]); ?>">
                                <div class="clearfix float-right" >
                                    <button type="submit" id="cancelBtn<?php echo e($vehicle->id.$w.$i); ?>" class="btn btn-danger" >ยกเลิกนัด</button>
                                </div>
                            </form>
                        <?php endif; ?>
                </div>
            </div>
            <?php else: ?>   <!-- ผู้เรียนมากกว่า 1 คนในเวลาเดียวกัน -->
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title-card" id="teacherModal2<?php echo e($vehicle->id.$w.$i); ?>Label">ระบุผู้สอน</h5>
                </div>
                <div class="modal-body">
                    <div class="row mb-3">
                        <div class="col-12 ">
                            <label id="vehicle-name" class="modal-label-card float-left"><?php echo e($vehicle->type ." คันที่ : ".$vehicle->number . " , " . $vehicle->brand." ".$vehicle->model. " [ ".$vehicle->registration_class." ".$vehicle->registration_number." ]"); ?> <?php if($arrGear2[$w][$vehicle->id][$i]=='m'): ?> <?php echo e("(ธรรมดา)"); ?> <?php else: ?> <?php echo e("(ออโต้)"); ?> <?php endif; ?></label>
                        </div>
                    </div>
                    <?php if(check_cancel_booking($arrSchedule2[$w][$vehicle->id][$i])): ?> <!--เวลาปัจจุบัน(ทำรายยกเลิกได้) ก่อนเรียน > 4 ชม. -->
                        <?php for($n = 0; $n < numberOfStudent($arrValue2[$w][$vehicle->id][$i]); $n++): ?>
                            <form id="frm<?php echo e($vehicle->id.$w.$i.$n); ?>"
                                action="<?php echo e(route('calendar.cancel_booking')); ?>"
                                method="post"
                                
                            >
                            <?php echo csrf_field(); ?>
                            <?php echo method_field('DELETE'); ?>
                                <input type="hidden" name="date" id="date-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($week[$w]); ?>">
                                <div class="row mt-2">
                                    <input type="hidden" name="vehicleBookingID" id="vehicle-booking<?php echo e($vehicle->id.$w.$i.$n); ?>" value="<?php echo e(getVehicleBookingAtN($arrBooking2[$w][$vehicle->id][$i], $n)); ?>">
                                    <div class="col-9">
                                        <label id="student-name<?php echo e($n); ?>" class="modal-label-card float-left">ผู้เรียน : <?php echo e(getStudentAtN($arrValue2[$w][$vehicle->id][$i], $n)); ?></label>
                                    </div>
                                    <?php if(date('Y-m-d')<$week[$w]): ?>
                                    <div class="col-3">
                                        <button type="submit" id="cancelBtn<?php echo e($vehicle->id.$w.$i.$n); ?>" class="btn btn-sm btn-danger">ยกเลิกนัด</button>
                                    </div>
                                    <?php endif; ?>
                                </div>
                                <div class="row mt-2">
                                    <div class="col-12">
                                        <label id="note<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">หมายเหตุ : <?php echo e($arrStuNote2[$w][$vehicle->id][$i]); ?></label>
                                    </div>
                                </div>
                            </form>
                            <hr style="margin-top: -5px;"/>
                        <?php endfor; ?>
                    <?php else: ?> <!-- เลยเวลา 4 ชม. ไม่สามารถยกเลิกนัดได้ ทำได้แค่ book ผู้สอน -->
                        <?php for($n = 0; $n < numberOfStudent($arrValue2[$w][$vehicle->id][$i]); $n++): ?>
                            <div class="row mt-2">
                                <div class="col-9">
                                    <label id="student-name<?php echo e($n); ?>" class="modal-label-card float-left">ผู้เรียน : <?php echo e(getStudentAtN($arrValue2[$w][$vehicle->id][$i], $n)); ?></label>
                                </div>
                                <hr>
                            </div>
                        <?php endfor; ?>
                    <?php endif; ?>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="module<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">วิชา : <?php echo e($arrModule2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12">
                            <label id="drive-time<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">เวลา : <?php echo e(formatTimeFromDB($arrSchedule2[$w][$vehicle->id][$i]) . " ถึง " . getEndTimeFromHour($arrSchedule2[$w][$vehicle->id][$i], ($arrSpan2[$w][$vehicle->id][$i])/2 ) ." น."); ?></label>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="note<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">หมายเหตุ : <?php echo e($arrStuNote2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <form action="<?php echo e(route('calendar.booking')); ?>"
                        id="teacherBookFrm22<?php echo e($vehicle->id.$w.$i); ?>"
                        novalidate class="teacherBookFrm <?php echo e(($errors->any()) ? 'was-validated' : 'needs-validation'); ?>"
                        method="post">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="vehicleBookingID" id="vehicle-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($arrBooking2[$w][$vehicle->id][$i]); ?>">
                        <input type="hidden" name="purpose" value="เรียนและสอบ">
                    <div class="row mt-4">
                        <div class="col-12">
                            <div class="form-group">
                                <label for="teacher" class="modal-label-card float-left mb-2">ผู้สอน <?php if(date('Y-m-d')==$week[$w]): ?><span class="text-red">*</span><?php endif; ?></label>
                                <select id="teacher<?php echo e($vehicle->id.$w.$i); ?>" name="teacher" data-size="10" data-container="body" class="selectpicker show-menu-arrow form-control teacher-select" <?php if(date('Y-m-d')>$week[$w]): ?> disabled <?php endif; ?> required>
                                    <option value="">--เลือก--</option>
                                    <?php $__currentLoopData = $teachers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $teacher): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($teacher->id); ?>" <?php if($teacher->id == $arrTeacher2[$w][$vehicle->id][$i]): ?> selected <?php endif; ?>><?php echo e($teacher->title.$teacher->firstname. " " .$teacher->lastname); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <?php $__errorArgs = ['teacher<?php echo e($vehicle->id.$w.$i); ?>'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger"><?php echo e($message); ?></div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row teacherTypeDiv" <?php if(!$arrTeacherScan2[$w][$vehicle->id][$i]): ?>style="display: none;" <?php endif; ?>>
                    <div class="col-12">
                        <div class="form-group d-flex justify-content-start">
                            <div class="icheck-inline">
                                <label class="modal-label-card" >ครูสอนกับครูสแกน : </label>
                            </div>
                            <div class="icheck-nephritis icheck-inline">
                                <input type="radio" id="sameTeacher<?php echo e($vehicle->id.$w.$i); ?>" name="teacherType" value="true" <?php if($arrTeacherScan2[$w][$vehicle->id][$i] == $arrTeacher2[$w][$vehicle->id][$i]): ?> checked <?php endif; ?> required>
                                <label class="modal-label-card" for="sameTeacher<?php echo e($vehicle->id.$w.$i); ?>">คนเดียวกัน</label>
                            </div>
                            <div class="icheck-nephritis icheck-inline">
                                <input type="radio" id="noSameTeacher<?php echo e($vehicle->id.$w.$i); ?>" name="teacherType" value="false" <?php if($arrTeacherScan2[$w][$vehicle->id][$i] != $arrTeacher2[$w][$vehicle->id][$i]): ?> checked <?php endif; ?>>
                                <label class="modal-label-card" for="noSameTeacher<?php echo e($vehicle->id.$w.$i); ?>">คนละคนกัน</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row teacherScanDiv" <?php if(!$arrTeacherScan2[$w][$vehicle->id][$i] || $arrTeacherScan2[$w][$vehicle->id][$i]==$arrTeacher2[$w][$vehicle->id][$i]): ?>style="display: none;" <?php endif; ?>>
                    <div class="col-12">
                        <div class="form-group">
                            <label for="teacherScan<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left mb-2">ผู้สอนสแกน <?php if(date('Y-m-d')==$week[$w]): ?><span class="text-red">*</span><?php endif; ?></label>
                            <select id="teacherScan<?php echo e($vehicle->id.$w.$i); ?>" name="teacherScan" data-size="10" data-container="body" title="--เลือก--" class="selectpicker show-menu-arrow form-control teacher-scan" required>
                                <?php $__currentLoopData = $teachers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $teacher): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php if($teacher->type=='s' || $teacher->type=='a'): ?>
                                    <option value="<?php echo e($teacher->id); ?>" <?php if($teacher->id == $arrTeacherScan2[$w][$vehicle->id][$i]): ?> selected <?php endif; ?>><?php echo e($teacher->title.$teacher->firstname. " " .$teacher->lastname); ?></option>
                                    <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            <?php $__errorArgs = ['teacherScan<?php echo e($vehicle->id.$w.$i); ?>'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="text-danger"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">ปิด</button>
                    <button type="submit" id="bookBtn<?php echo e($vehicle->id.$w.$i); ?>" onclick="document.getElementById('teacherBookFrm22<?php echo e($vehicle->id.$w.$i); ?>').submit();" class="btn btn-success">ตกลง</button>
                </div>
                    </form>
            </div>
            <?php endif; ?>
        <?php elseif(date('Y-m-d') < $week[$w]): ?> <!-- ถ้ายังไม่ถึงวันนัดให้ยกเลิกนัดได้อย่างเดียว -->
            <?php if(numberOfStudent($arrValue2[$w][$vehicle->id][$i])==1): ?> <!-- มีผู้เรียนแค่ 1 คนในช่วงเวลา -->
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title-card" id="teacherModal2<?php echo e($vehicle->id.$w.$i); ?>Label">ยกเลิกตารางเรียน</h5>
                </div>
                <div class="modal-body">
                    <div class="row mb-3">
                        <div class="col-12 ">
                            <label id="vehicle-name" class="modal-label-card float-left"><?php echo e($vehicle->type ." คันที่ : ".$vehicle->number . " , " . $vehicle->brand." ".$vehicle->model. " [ ".$vehicle->registration_class." ".$vehicle->registration_number." ]"); ?> <?php if($arrGear2[$w][$vehicle->id][$i]=='m'): ?> <?php echo e("(ธรรมดา)"); ?> <?php else: ?> <?php echo e("(ออโต้)"); ?> <?php endif; ?></label>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <input type="hidden" name="vehicleBookingID" id="vehicle-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($arrBooking2[$w][$vehicle->id][$i]); ?>">
                        <div class="col-12 ">
                            <label id="student-name<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">ผู้เรียน : <?php echo e($arrValue2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="module<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">วิชา : <?php echo e($arrModule2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12">
                            <label id="drive-time<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">เวลา : <?php echo e(formatTimeFromDB($arrSchedule2[$w][$vehicle->id][$i]) . " ถึง " . getEndTimeFromHour($arrSchedule2[$w][$vehicle->id][$i], ($arrSpan2[$w][$vehicle->id][$i])/2 ) ." น."); ?></label>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="note<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">หมายเหตุ : <?php echo e($arrStuNote2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <form id="frm<?php echo e($vehicle->id.$w.$i); ?>"
                        action="<?php echo e(route('calendar.cancel_booking')); ?>"
                        method="post"
                        
                    >
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('DELETE'); ?>
                        <input type="hidden" name="date" id="date-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($week[$w]); ?>">
                        <input type="hidden" name="vehicleBookingID" id="vehicle-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($arrBooking2[$w][$vehicle->id][$i]); ?>">
                        <button type="button" class="btn btn-outline-secondary mr-2" data-dismiss="modal">ปิด</button>
                        <div class="clearfix float-right" >
                            <button type="submit" id="cancelBtn<?php echo e($vehicle->id.$w.$i); ?>" class="btn btn-danger" >ยกเลิกนัด</button>
                        </div>
                    </form>
                </div>
            </div>
            <?php else: ?> <!-- ผู้เรียนมากกว่า 1 คนในเวลาเดียวกัน -->
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title-card" id="teacherModal2<?php echo e($vehicle->id.$w.$i); ?>Label">ยกเลิกตารางเรียน</h5>
                </div>
                <div class="modal-body">
                    <?php for($n = 0; $n < numberOfStudent($arrValue2[$w][$vehicle->id][$i]); $n++): ?>
                    <form id="frm<?php echo e($vehicle->id.$w.$i.$n); ?>"
                        action="<?php echo e(route('calendar.cancel_booking')); ?>"
                        method="post"
                        
                    >
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('DELETE'); ?>
                        <div class="row mt-3">
                            <input type="hidden" name="date" id="date-booking<?php echo e($vehicle->id.$w.$i); ?>" value="<?php echo e($week[$w]); ?>">
                            <input type="hidden" name="vehicleBookingID" id="vehicle-booking<?php echo e($vehicle->id.$w.$i.$n); ?>" value="<?php echo e(getVehicleBookingAtN($arrBooking2[$w][$vehicle->id][$i], $n)); ?>">
                            <div class="col-9">
                                <label id="student-name<?php echo e($n); ?>" class="modal-label-card float-left">ผู้เรียน : <?php echo e(getStudentAtN($arrValue2[$w][$vehicle->id][$i], $n)); ?></label>
                            </div>
                            <div class="col-3">
                                <button type="submit" id="cancelBtn<?php echo e($vehicle->id.$w.$i.$n); ?>" class="btn btn-sm btn-danger" style="margin-top:-8px;">ยกเลิกนัด</button>
                            </div>
                        </div>
                        <div class="row mt-2">
                            <div class="col-12">
                                <label id="note<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">หมายเหตุ : <?php echo e($arrStuNote2[$w][$vehicle->id][$i]); ?></label>
                            </div>
                        </div>
                    </form>
                    <hr style="margin-top: -5px;"/>
                    <?php endfor; ?>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="module<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">วิชา : <?php echo e($arrModule2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12">
                            <label id="drive-time<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">เวลา : <?php echo e(formatTimeFromDB($arrSchedule2[$w][$vehicle->id][$i]) . " ถึง " . getEndTimeFromHour($arrSchedule2[$w][$vehicle->id][$i], ($arrSpan2[$w][$vehicle->id][$i])/2 ) ." น."); ?></label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">ปิด</button>
                </div>
            </div>
            <?php endif; ?>
        <?php else: ?> <!-- รายการของวันที่ผ่านมาแล้ว -->
            <div class="modal-content">
                <div class="modal-body">
                    <div class="row mb-3">
                        <div class="col-12 ">
                            <label class="modal-label-card float-left"><?php echo e($vehicle->type ." คันที่ : ".$vehicle->number . " , " . $vehicle->brand." ".$vehicle->model. " [ ".$vehicle->registration_class." ".$vehicle->registration_number." ]"); ?> <?php if($arrGear2[$w][$vehicle->id][$i]=='m'): ?> <?php echo e("(ธรรมดา)"); ?> <?php else: ?> <?php echo e("(ออโต้)"); ?> <?php endif; ?></label>
                        </div>
                    </div>
                    <?php if(numberOfStudent($arrValue2[$w][$vehicle->id][$i])==1): ?> <!-- มีผู้เรียนแค่ 1 คนในช่วงเวลา -->
                        <div class="row mt-2">
                            <div class="col-12 ">
                                <label class="modal-label-card float-left">ผู้เรียน : <?php echo e($arrValue2[$w][$vehicle->id][$i]); ?></label>
                            </div>
                        </div>
                        <div class="row mt-2">
                            <div class="col-12">
                                <label class="modal-label-card float-left">หมายเหตุ : <?php echo e($arrStuNote2[$w][$vehicle->id][$i]); ?></label>
                            </div>
                        </div>
                    <?php else: ?>
                        <?php for($n = 0; $n < numberOfStudent($arrValue2[$w][$vehicle->id][$i]); $n++): ?>
                            <div class="row mt-2">
                                <div class="col-12">
                                    <label id="student-name<?php echo e($n); ?>" class="modal-label-card float-left">ผู้เรียน : <?php echo e(getStudentAtN($arrValue2[$w][$vehicle->id][$i], $n)); ?></label>
                                </div>
                            </div>
                            <div class="row mt-2">
                                <div class="col-12">
                                    <label class="modal-label-card float-left">หมายเหตุ : <?php echo e($arrStuNote2[$w][$vehicle->id][$i]); ?></label>
                                </div>
                            </div>
                        <?php endfor; ?>
                    <?php endif; ?>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label id="module<?php echo e($vehicle->id.$w.$i); ?>" class="modal-label-card float-left">วิชา : <?php echo e($arrModule2[$w][$vehicle->id][$i]); ?></label>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12">
                            <label class="modal-label-card float-left">เวลา : <?php echo e(formatTimeFromDB($arrSchedule2[$w][$vehicle->id][$i]) . " ถึง " . getEndTimeFromHour($arrSchedule2[$w][$vehicle->id][$i], ($arrSpan2[$w][$vehicle->id][$i])/2 ) ." น."); ?></label>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-12">
                            <label class="modal-label-card float-left">ผู้สอน : <?php echo e(getTeacherName($teachers, $arrTeacher2[$w][$vehicle->id][$i])); ?></label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">ปิด</button>
                </div>
            </div>
        <?php endif; ?>
    </div>

</div>
<!-- End modal -->

<?php /**PATH C:\laragon\www\system.pongpetrdriving.com\resources\views/calendar/modal_booking_2.blade.php ENDPATH**/ ?>