<?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">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-3">
    <div class="row mt-3">
        <div class="col">
            <div class="card card-outline card-success">
                <div class="card-header text-center">
                    ครูสแกนที่ว่างในวันที่ : <?php echo e(date('d/m/Y')); ?>

                </div>
                <div class="card-body table-responsive">
                    <table class="table time-table" id="time-table">
                        <thead>
                          <tr>
                            <th class="text-center" scope="col" width="50%">เวลา</th>
                            <th class="text-center" scope="col" width="50%">จำนวน (คน)</th>
                          </tr>
                        </thead>
                        <tbody>
                            <?php for($i=0; $i<count($data); $i++): ?>
                            <tr class="hand-hover" data-toggle="modal" data-target="#teacherModal<?php echo e($i); ?>">
                                <td class="align-middle text-center">
                                    <a href="#" class="course-title-link"><?php echo e($data[$i]['time']); ?></a>
                                    <!-- Modal -->
                                    <div class="modal fade" style="display:none;" id="teacherModal<?php echo e($i); ?>" tabindex="-1" aria-labelledby="teacherModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
                                        <div class="modal-dialog modal-dialog-centered text-left">
                                            <div class="modal-content">
                                                <div class="modal-body">
                                                    <div class="row">
                                                        <table class="table table-hover teacher-table" id="teacher-table<?php echo e($i); ?>">
                                                            <thead class="thead-light">
                                                                <tr>
                                                                    <th></th>
                                                                    <th>รายชื่อครูที่ว่างเวลา <?php echo e($data[$i]['time']); ?></th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                <?php for($t=0; $t<count($teachers[$i]); $t++): ?>
                                                                    <tr>
                                                                        <td><?php echo e($t+1); ?></td>
                                                                        <td><a href="<?php echo e(route('teacher.show', $teachers[$i][$t]['id'])); ?>" class="course-title-link"><?php echo e($teachers[$i][$t]['title'] . $teachers[$i][$t]['firstname'] . ' ' . $teachers[$i][$t]['lastname']); ?></a></td>
                                                                    </tr>
                                                                <?php endfor; ?>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </td>
                                <td class="align-middle text-center"><?php echo e($data[$i]['amount']); ?></td>
                            </tr>
                            <?php endfor; ?>
                        </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/custom.js')); ?>"></script>
<script>
    $(document).ready(function() {
        $('.time-table tr td:not(:last-child)').click(function () {
            var href = $(this).closest('tr').find('a').attr('href');
            location.href = href;
        });

        $('.teacher-table tr td:not(:last-child)').click(function () {
            var href = $(this).closest('tr').find('a').attr('href');
            location.href = href;
        });
    });
</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 /var/www/html/pongpetch/resources/views/teacher/scan/index.blade.php ENDPATH**/ ?>