<?php $__env->startSection('css'); ?>
<link href="<?php echo e(asset('css/bootstrap-select.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/sweetalert2.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/bootstrap-datepicker.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/icheck-bootstrap.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/tempusdominus-bootstrap-4.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/bootstrap-timepicker.min.css')); ?>" rel="stylesheet" />
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="container-fluid pt-3">
        <div class="row mb-3">
            <div class="col-12">
                <a href="<?php echo e(route('pdf.registration', $student->sid)); ?>" target="_blank" class="btn btn-sm btn-outline-secondary"><i class="fas fa-file-alt"></i> พิมพ์ใบสมัคร</a>
                <a href="<?php echo e(route('pdf.receipt', $student->sid)); ?>" target="_blank" class="btn btn-sm btn-outline-secondary ml-2"><i class="fas fa-print"></i> พิมพ์ใบเสร็จ</a>
                <a href="<?php echo e(route('pdf.schedule', $student->sid)); ?>" target="_blank" class="btn btn-sm btn-outline-secondary ml-2"><i class="fas fa-calendar-alt"></i> พิมพ์ใบนัดหมาย</a>
                <a href="<?php echo e(route('pdf.student', $student->sid)); ?>" target="_blank" class="btn btn-sm btn-outline-secondary ml-2"><i class="fas fa-id-card"></i> พิมพ์บัตรประจำตัว</a>
                <a href="<?php echo e(route('pdf.evaluation', $student->sid)); ?>" target="_blank" class="btn btn-sm btn-outline-secondary ml-2"><i class="fas fa-file-alt"></i> แบบประเมินผู้สอน</a>
            </div>
        </div>
        <div class="row">
            <div class="col-6">
                <div class="card card-outline card-success">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12">
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">เลขที่สมัคร</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->code_no."/".$student->code_month."/".$student->code_branch); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">วันที่สมัคร</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e(formatDateFromDB($student->register_date)); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">สาขาที่สมัคร</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->branchName); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">เพศ</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->gender); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">ชื่อ - นามสกุล</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->title.$student->firstname ." ". $student->lastname); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">ชื่อเล่น</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->nickname); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">บัตรประชาชน</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->idcard); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">วันเกิด</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e(formatDateFromDB($student->birthdate)); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">เชื้อชาติ / สัญชาติ</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->race ." / ". $student->nationality); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">ศาสนา</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->religion); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">ที่อยู่</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->address ." ". $student->district ." ". $student->amphoe ." ". $student->province); ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-3">
                                        <p class="showTitle">หมายเลขโทรศัพท์</p>
                                    </div>
                                    <div class="col-9">
                                        <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->phone_1); ?> <?php if($student->phone_2 != null): ?> , <?php echo e($student->phone_2); ?> <?php endif; ?></p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>  <!-- div card body -->
                </div>
            </div>
            <div class="col-6">
                <div class="row">
                    <div class="col-12">
                        <div class="card card-outline card-success">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-12">
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">บุคคลที่ติดต่อกรณีฉุกเฉิน</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->emergency_name); ?></p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">หมายเลขโทรศัพท์</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->emergency_phone); ?></p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">ใบอนุญาตขับขี่</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->license_status); ?></p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">รู้จักโรงเรียนจาก</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->know_school); ?></p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>  <!-- div card body -->
                        </div>
                    </div>
                    <div class="col-12">
                        <div class="card card-outline card-success">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-12">
                                        <a href="#" data-toggle="modal" data-target="#courseModal">(เปลี่ยนคอร์ส)</a>
                                        
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-12">
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">หลักสูตรที่เรียน</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->courseType . " เกียร์: " . $student->gear ." , ". $student->name); ?></p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">รูปแบบการเรียน</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($student->purpose); ?></p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">ค่าเรียน</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e(number_format($student->course_cost) ." บาท"); ?></p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">ส่วนลด</p>
                                            </div>
                                            <div class="col-9">
                                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e(number_format($student->discount) ." บาท"); ?></p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-3">
                                                <p class="showTitle">ชำระ / คงเหลือ</p>
                                            </div>
                                            <div class="col-9">
                                                <p>
                                                    <i class="fas fa-angle-right mr-3"></i> จ่ายแล้ว &nbsp;&nbsp;<?php echo e(number_format($student->paid). " บาท "); ?>&nbsp;&nbsp;&nbsp;คงเหลือ &nbsp;&nbsp;<span class="text-danger"><?php echo e(number_format( $student->course_cost - $student->discount - $student->paid)); ?></span> บาท
                                                    <?php if(($student->course_cost - $student->discount - $student->paid) > '0'): ?>
                                                    <button type="button" class="btn btn-outline-danger btn-sm float-right" data-toggle="modal" data-target="#paymentModal">
                                                        <i class="fas fa-dollar-sign"></i> ชำระเงิน
                                                    </button>
                                                    
                                                    <?php endif; ?>
                                                </p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>  <!-- div card body -->
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-12">
                <div class="card card-outline card-success">
                    <div class="card-header">
                        <h3 class="card-title">ตารางเรียน</h3>
                        <?php if($student->exam_date!=null || $student->exam_date!=""): ?>
                            <button type="button" class="btn btn-outline-info btn-sm float-right ml-3" data-toggle="modal" data-target="#examDateModal">
                                <i class="fas fa-calendar-day"></i> เลื่อนวันสอบ
                            </button>
                            
                        <?php else: ?>
                            <?php if($student->purpose=="เรียนและสอบ" || $student->purpose=="เก็บชั่วโมงเพื่อสอบ"): ?>
                                <button type="button" class="btn btn-outline-info btn-sm float-right ml-3" data-toggle="modal" data-target="#addExamDateModal">
                                    <i class="fas fa-calendar-day"></i> เพิ่มวันสอบ
                                </button>
                                
                            <?php endif; ?>
                        <?php endif; ?>
                        <?php if($book_hour < $student->hour): ?>
                            <button type="button" class="btn btn-outline-warning edit-outline-btn btn-sm float-right" data-toggle="modal" data-target="#addBookingModal">
                                <i class="fas fa-calendar-alt"></i> เพิ่มตารางเรียน
                            </button>
                            
                        <?php endif; ?>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12">
                            <div class="row">
                                <div class="col-2">
                                    <p class="showTitle">อบรมและสอบใบขับขี่</p>
                                </div>
                                <div class="col-10">
                                    <p><i class="fas fa-angle-right mr-4"></i><?php if(is_null($student->exam_date)): ?> ไม่มีสอบ <?php else: ?> วันที่&nbsp;&nbsp;<?php if($student->exam_date != null): ?> <?php echo e(formatDateFromDB($student->exam_date)); ?> <?php endif; ?>&nbsp;&nbsp;,&nbsp;&nbsp;เวลา <?php if($student->exam_time != null): ?> <?php echo e(formatTimeFromDB($student->exam_time)); ?> <?php else: ?> 06.30 <?php endif; ?> น. <?php endif; ?></p>
                                </div>
                            </div>
                            <input type="hidden" name="countBooking" id="countBooking" value="<?php echo e(count($bookings)); ?>">
                            <table class="table student-table" id="schedule-table">
                                <thead>
                                    <tr>
                                        <th scope="col" width="5%">ครั้งที่</th>
                                        <th scope="col" width="10%">วันที่</th>
                                        <th scope="col" width="15%">เวลา</th>
                                        <th scope="col" width="35%">วิชา</th>
                                        <th scope="col" width="25%">รถ</th>
                                        <th scope="col" width="10%"></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__currentLoopData = $bookings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $booking): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td class="align-middle"><?php echo e(($indexKey + 1)); ?></td>
                                        <td class="align-middle"><?php echo e(formatDateFromDB($booking->date)); ?></td>
                                        <td class="align-middle"><?php echo e(formatTimeFromDB($booking->starttime) ." - ". formatTimeFromDB($booking->endtime)); ?> น.</td>
                                        <td class="align-middle"><?php echo e($booking->module); ?> ( <?php echo e($booking->module_hour); ?> ชั่วโมง )</td>
                                        <td class="align-middle"><?php echo e("คันที่ : ". $booking->number ." , ". $booking->brand ." ". $booking->model . " (" . $booking->registration_class." ".$booking->registration_number.")"); ?> </td>
                                        <td class="align-middle text-center">
                                            <?php if( date('Y-m-d') < $booking->date): ?>
                                                <?php echo $__env->make('student.booking_tool', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                            <?php elseif( (date('Y-m-d') == $booking->date) && (strtotime(date('H:i:s')) < strtotime($booking->starttime))): ?>
                                                <?php echo $__env->make('student.booking_tool', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-12 mb-3">
                <div style="float:left">
                    <a href="<?php echo e(route('student.index')); ?>" class="btn btn-outline-secondary"><i class="fas fa-chevron-left"></i> ย้อนกลับ</a>
                </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/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/bootstrap-timepicker.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/booking.js')); ?>"></script>
<script src="<?php echo e(asset('js/custom.js')); ?>"></script>
<?php $__errorArgs = ['pay'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>

<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
<?php if(session('feedback')): ?>
<script>
    Swal.fire({
                text: '<?php echo e(session('feedback')); ?>',
                icon: 'success',
                confirmButtonText: 'ตกลง',
                confirmButtonColor: '#62966C'
    })
</script>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('student.modal_add_booking', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->make('student.modal_add_exam', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->make('student.modal_exam', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->make('student.modal_payment', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->make('student.modal_course', \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-test.pongpetrdriving.com\resources\views/student/show.blade.php ENDPATH**/ ?>