<?php $__env->startSection('css'); ?>
<link href="<?php echo e(asset('css/dataTables.bootstrap4.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/bootstrap-datepicker.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/bootstrap-select.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/icheck-bootstrap.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/sweetalert2.min.css')); ?>" rel="stylesheet" />
<style>
    .bootstrap-datetimepicker-widget tr:hover {
        background-color: #808080;
    }
    .calendar tr {
        line-height: 12px;
        font-size: 12px;
    }
    .sig {
        border: 2px solid rgb(22, 22, 22);
    }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-3">
    <div class="row">
        <div class="col-4">
            <form action="<?php echo e(route('calendar.submit')); ?>"
            novalidate class="<?php echo e(($errors->any()) ? 'was-validated' : 'needs-validation'); ?>"
            method="get"
            >
            
                <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 datepiacker" id="date" name="date" placeholder="วันที่" autocomplete="off" value="<?php echo e($date); ?>" required>
                        <div class="input-group-append">
                            <span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
                        </div>
                        <button type="submit" class="btn btn-outline-success show-outline-btn ml-2" value="add-student">แสดง</button>
                    </div>
                    <?php $__errorArgs = ['date'];
$__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>
            </form>
        </div>
    </div>
    <div class="row mt-3">
        <div class="col-12">
            <div class="d-flex justify-content-center">
                <?php echo $vehicles->links(); ?>

            </div>
            <?php $__currentLoopData = $vehicles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $keyIndex => $vehicle): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="card">
                    <div class="card-body">
                        <label><?php echo e($vehicle->type . " (" . $vehicle->gear . ") คันที่ : ".$vehicle->number . " , " . $vehicle->brand." ".$vehicle->model. " [ ".$vehicle->registration_class." ".$vehicle->registration_number." ]"); ?></label>
                        <?php for($w=0; $w<count($week); $w++): ?>
                        <div class="row align-items-center mt-2 <?php if(date('Y-m-d')==$week[$w]): ?> bg-today <?php endif; ?>">
                            <div class="col-1">
                                <p style="font-size: 12px;">วันที่ <?php echo e(showDateToCalendar($week[$w])); ?></p>
                            </div>
                            <div class="col-11">
                                <table class="table table-sm calendar" id="vehicle<?php echo e($vehicle->id); ?>">
                                    <thead>
                                        <tr>
                                            <th scope="col" width="16%"></th>
                                            <?php for($i=7; $i<21; $i++): ?>
                                            <th scope="col" colspan="2" width="6%" class="text-center">
                                                <?php if(date('Y-m-d') <= $week[$w]): ?>
                                                    <?php if(date('Y-m-d') == $week[$w]): ?>
                                                        <?php if(date('H') < $i): ?>
                                                            <a href="#" data-toggle="modal" data-target="#vehicleBookingModal"
                                                                data-vehicle="<?php echo e($vehicle->id); ?>"
                                                                data-type="<?php echo e($vehicle->type); ?>"
                                                                data-date="<?php echo e($week[$w]); ?>"
                                                                data-time="<?php echo e($i); ?>"
                                                            ><?php echo e($i .":00"); ?></a>
                                                            
                                                        <?php else: ?>
                                                            <?php echo e($i .":00"); ?>

                                                        <?php endif; ?>
                                                    <?php else: ?>
                                                        <a href="#" data-toggle="modal" data-target="#vehicleBookingModal"
                                                                data-vehicle="<?php echo e($vehicle->id); ?>"
                                                                data-type="<?php echo e($vehicle->type); ?>"
                                                                data-date="<?php echo e($week[$w]); ?>"
                                                                data-time="<?php echo e($i); ?>"
                                                            ><?php echo e($i .":00"); ?></a>
                                                        
                                                    <?php endif; ?>
                                                <?php elseif(date('Y-m-d') > $week[$w]): ?>
                                                <?php echo e($i .":00"); ?>

                                                <?php endif; ?>

                                            </th>
                                            <?php endfor; ?>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td width="16%">เพิ่มประสบการณ์</td>
                                            <?php for($i=0; $i<28; $i++): ?>
                                                <?php if($arr1[$w][$vehicle->id][$i] != '-1'): ?>
                                                <td <?php if($arrSpan1[$w][$vehicle->id][$i] > '1'): ?> colspan="<?php echo e($arrSpan1[$w][$vehicle->id][$i]); ?>" class="bg-primary border-right border-left text-center <?php if($arrSig1[$w][$vehicle->id][$i]=='1'): ?> sig <?php endif; ?>" <?php endif; ?> width="<?php echo e((($arrSpan1[$w][$vehicle->id][$i])*3) ."%"); ?>" >
                                                <?php if('1' == $arr1[$w][$vehicle->id][$i]): ?>
                                                    <a href="#teacherModal1<?php echo e($vehicle->id.$w.$i); ?>" data-toggle="modal" data-target="#teacherModal1<?php echo e($vehicle->id.$w.$i); ?>">
                                                        <?php echo e(getFirstname($arrValue1[$w][$vehicle->id][$i])); ?>

                                                    </a>
                                                    <?php echo $__env->make('calendar.modal_booking_1', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                                <?php endif; ?>
                                                </td>
                                                <?php endif; ?>
                                            <?php endfor; ?>
                                        </tr>
                                        <tr>
                                            <td width="16%">เรียนและสอบ</td>
                                            <?php for($i=0; $i<28; $i++): ?>
                                                <?php if($arr2[$w][$vehicle->id][$i] != '-1'): ?>
                                                <td <?php if( $arrSpan2[$w][$vehicle->id][$i] > '1' ): ?> colspan="<?php echo e($arrSpan2[$w][$vehicle->id][$i]); ?>" class="<?php if($arrGear2[$w][$vehicle->id][$i]=='m'): ?> bg-danger <?php else: ?> bg-success <?php endif; ?> border-right border-left text-center <?php if($arrSig2[$w][$vehicle->id][$i]=='1'): ?> sig <?php endif; ?>" <?php endif; ?> width="<?php echo e((($arrSpan2[$w][$vehicle->id][$i])*3)); ?>%" >
                                                <?php if('1' == $arr2[$w][$vehicle->id][$i]): ?>
                                                    <a href="#teacherModal2<?php echo e($vehicle->id.$w.$i); ?>" data-toggle="modal" data-target="#teacherModal2<?php echo e($vehicle->id.$w.$i); ?>">
                                                        <span class="<?php if($arrSig2[$w][$vehicle->id][$i]=='1'): ?> font-weight-bold font-italic <?php endif; ?>"><?php echo e(wordwrap(getFirstname($arrValue2[$w][$vehicle->id][$i]))); ?></span>
                                                    </a>
                                                    <?php echo $__env->make('calendar.modal_booking_2', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                                <?php endif; ?>
                                                </td>
                                                <?php endif; ?>
                                            <?php endfor; ?>
                                        </tr>
                                        <tr>
                                            <td>เก็บชั่วโมงเพื่อสอบ</td>
                                            <?php for($i=0; $i<28; $i++): ?>
                                                <?php if($arr3[$w][$vehicle->id][$i] != '-1'): ?>
                                                <td <?php if($arrSpan3[$w][$vehicle->id][$i] > '1'): ?> colspan="<?php echo e($arrSpan3[$w][$vehicle->id][$i]); ?>" class="bg-warning border-right border-left text-center <?php if($arrSig3[$w][$vehicle->id][$i]=='1'): ?> sig <?php endif; ?>" <?php endif; ?> width="<?php echo e((((int)$arrSpan3[$w][$vehicle->id][$i])*3) ."%"); ?>" >
                                                <?php if('1' == $arr3[$w][$vehicle->id][$i]): ?>
                                                    <a href="#teacherModal3<?php echo e($vehicle->id.$w.$i); ?>" data-toggle="modal" data-target="#teacherModal3<?php echo e($vehicle->id.$w.$i); ?>">
                                                        <?php echo e(getFirstname($arrValue3[$w][$vehicle->id][$i])); ?>

                                                    </a>
                                                    <?php echo $__env->make('calendar.modal_booking_3', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                                   
                                                <?php endif; ?>
                                                </td>
                                                <?php endif; ?>
                                            <?php endfor; ?>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <?php endfor; ?>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <div class="d-flex justify-content-center">
                <?php echo $vehicles->appends(request()->query())->links(); ?>

            </div>
        </div>

    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('footerscript'); ?>
<script src="<?php echo e(asset('js/sweetalert2.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/bootstrap-select.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/jquery.dataTables.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/dataTables.bootstrap4.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/bootstrap-datepicker.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/bootstrap-datepicker.th.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/calendar.js')); ?>"></script>
<script src="<?php echo e(asset('js/custom.js')); ?>"></script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('calendar.modal_vehicle_booking', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->make('calendar.modal_vehicle_booking', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->make('layouts.web', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\system.pongpetrdriving.com\resources\views/calendar/index.blade.php ENDPATH**/ ?>