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

<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-3">
    <div class="row">
        <div class="col-2">
            <form action="<?php echo e(route('student.graduated_submit')); ?>"
            novalidate class="<?php echo e(($errors->any()) ? 'was-validated' : 'needs-validation'); ?>"
            method="post"
            >
            <?php echo csrf_field(); ?>
                <div class="form-group">
                    <label for="monthYear">นักเรียนในปี <span class="text-red">*</span></label>
                    <div class="input-group mb-3">
                        <input type="text" class="form-control datepiacker" id="year" name="year" placeholder="นักเรียนในปี" autocomplete="off" value="<?php echo e($year); ?>" 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 = ['year'];
$__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">
            <div class="card card-outline card-success">
                <div class="card-body">
                    <table class="table student-table" id="student-table">
                        <thead>
                          <tr>
                            <th scope="col" width="2%">#</th>
                            <th scope="col" width="5%">เลขที่</th>
                            <th scope="col" width="7%">วันที่สมัคร</th>
                            <th scope="col" width="12%">ชื่อ-สกุล</th>
                            <th scope="col" width="7%">เลขที่บัตรประชาชน</th>
                            <th scope="col" width="28%">หลักสูตร</th>
                            <th scope="col" width="7%">วันสอบ</th>
                            <th scope="col" width="5%">ค่าเรียน</th>
                            <th scope="col" width="5%">ส่วนลด</th>
                            <th width="9%"></th>
                          </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr class="hand-hover">
                                <td class="align-middle"><?php echo e($indexKey + 1); ?>.</td>
                                
                                <td class="align-middle"><?php echo e($student->code_no."/".$student->code_month."/".$student->code_branch); ?></td>
                                <td class="align-middle"><?php echo e(formatDateFromDB($student->register_date)); ?></td>
                                <td class="align-middle">
                                    <a class="course-title-link" href="<?php echo e(route('student.show_graduated',$student->sid)); ?>">
                                        <?php echo e($student->firstname ." ". $student->lastname); ?>

                                    </a>
                                </td>
                                <td class="align-middle"><?php echo e($student->idcard); ?></td>
                                <td class="align-middle"><?php echo e("(".$student->type .") ". $student->name); ?></td>
                                <td class="align-middle"><?php echo e(($student->exam_date != "") ? formatDateFromDB($student->exam_date) : " "); ?></td>
                                <td class="align-middle"><?php echo e(number_format($student->course_cost)); ?></td>
                                <td class="align-middle"><?php echo e(($student->discount != "" || $student->discount != "0" ) ? number_format($student->discount) : "-"); ?></td>                                <td class="align-middle text-center">
                                    <a href="<?php echo e(route('student.edit', $student->sid)); ?>" class="edit-btn" title="แก้ไขข้อมูล"><i class="far fa-edit"></i></a>
                                    
                                    <form id="del-frm<?php echo e($indexKey); ?>" class="d-inline"
                                        method="POST"
                                        action="<?php echo e(route('student.destroy_graduated')); ?>"
                                        onsubmit="confirmalert(event, <?php echo e($indexKey); ?>, 'นักเรียน')"
                                    >
                                    <?php echo csrf_field(); ?>

                                        <input type="hidden" name="sid" id="sidDel<?php echo e($indexKey); ?>" value="<?php echo e($student->sid); ?>">
                                        <input type="hidden" name="logStudent" id="logStudent<?php echo e($indexKey); ?>" value="<?php echo e('เลขที่ ' . $student->code_no.'/'.$student->code_month.'/'.$student->code_branch . ', ชื่อ ' . $student->title.strip_tags($student->firstname).' '.strip_tags($student->lastname)); ?>">
                                        <button type="submit" class="btn del-btn btn-sm ml-1" title="ลบข้อมูล">
                                            <i class="far fa-trash-alt"></i>
                                        </button>
                                    </form>
                                </td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </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/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/custom.js')); ?>"></script>
<script>
    $(document).ready(function() {
        $('.student-table').DataTable({
            "lengthChange": false,
            "info": false,
            "pageLength": 20,
            "language": {
                "emptyTable":   "ไม่พบข้อมูล",
                "paginate": {
                    "first":    "หน้าแรก",
                    "last":     "หน้าสุดท้าย",
                    "next":     "ถัดไป",
                    "previous": "ก่อนหน้า"
                },
                "search":       "ค้นหา:",
                "lengthMenu":   "จำนวนนักเรียนทั้งหมด _MENU_ คน",
                "info":         "ทั้งหมด _TOTAL_ คน",
                "infoEmpty":    "ไม่พบนักเรียน",
            }
        });
        $('#student-table tr td:not(:last-child)').click(function () {
            var href = $(this).closest('tr').find('a').attr('href');
            location.href = href;
        });
        $('#year').datepicker({
            format: 'yyyy',
            autoclose: true,
            language: 'th',
            endDate: '+0m',
            orientation: 'bottom',
            startView: 'years',
            minViewMode: 'years',
        });
    });
</script>
<?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('layouts.web', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\system.pongpetrdriving.com\resources\views/student/graduated.blade.php ENDPATH**/ ?>