<?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" />
<link href="<?php echo e(asset('css/calendar.css')); ?>" rel="stylesheet" />
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-3">
    <div class="row">
        <div class="col-3">
            <form action="<?php echo e(route('calendar.submit_day')); ?>"
            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="dateDay" 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="show">แสดง</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">
        <button onclick="topFunction()" id="top-btn" title="กลับขึ้นด้านบน"><i class="fas fa-arrow-up"></i></button>
        <div class="col-12">
            <?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">
                            <div class="col-12">
                                <table class="table table-sm calendar" id="vehicle<?php echo e($vehicle->id); ?>">
                                    <thead>
                                        <tr>
                                            <th scope="col" width="10%"></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="10%">เพิ่มประสบการณ์</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="10%">เรียนและสอบ</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); ?>">
                                                        <?php echo e(wordwrap(getFirstname($arrValue2[$w][$vehicle->id][$i]))); ?>

                                                    </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>

    </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>
<script>
    $(document).ready(function() {
        $('#dateDay').datepicker({
            format: 'dd/mm/yyyy',
            autoclose: true,
            language: 'th',
            orientation: 'bottom',
        });
    });

    var topButton = document.getElementById("top-btn");
    let height = screen.height / 2;
    window.onscroll = function() { scrollFunction() };
    function scrollFunction() {
      if (document.body.scrollTop > height || document.documentElement.scrollTop > height) {
        topButton.style.display = "block";
      } else {
        topButton.style.display = "none";
      }
    }
    function topFunction() {
      document.body.scrollTop = 0;
      document.documentElement.scrollTop = 0;
    }
</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_day.blade.php ENDPATH**/ ?>