<div class="page-inner">
    <?php echo $__env->make('admin.dashboard.components.breadcrumb', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

    <div class="col-md-12">
        <div class="card">
            <div class="card-header d-flex justify-content-between">
                <h4 class="card-title float-left">Số giờ dạy</h4>
                <div class="action">
                    <div class="action">
                        <a href="" class="btn btn-sm btn-primary">Xuất Excel</a>
                    </div>
                </div>
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <div id="basic-datatables_wrapper" class="dataTables_wrapper container-fluid dt-bootstrap4">
                        <div class="row">
                            <div class="col-sm-12 col-md-12">
                                <form action="<?php echo e(route('teacher.time')); ?>" method="GET" id="filter-form">
                                    <div class="form-row">
                                        <div class="col">
                                            <label for="start_date">Ngày bắt đầu</label>
                                            <input type="date" name="start_date" id="start_date" class="form-control" value="<?php echo e(request('start_date')); ?>">
                                        </div>
                                        <div class="col">
                                            <label for="end_date">Ngày kết thúc</label>
                                            <input type="date" name="end_date" id="end_date" class="form-control" value="<?php echo e(request('end_date')); ?>">
                                        </div>
                                        <div class="col">
                                            <label for="teacher_code">Mã giảng viên</label>
                                            <input type="text" name="teacher_code" id="teacher_code" class="form-control" value="<?php echo e(request('teacher_code')); ?>">
                                        </div>
                                        <div class="col">
                                            <label>&nbsp;</label>
                                            <div class="btn-group btn-block d-flex" role="group" aria-label="Filter Actions">
                                                <div class="mr-2">
                                                    <button type="submit" class="btn btn-primary">Lọc</button>
                                                </div>
                                                <div>
                                                    <button type="button" class="btn btn-secondary" onclick="clearFilter()">Xóa Lọc</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="row mt-3">
                            <div class="col-sm-12">
                                <?php if($teachers->isEmpty()): ?>
                                    <div class="alert alert-warning" role="alert">
                                        Không tìm thấy giảng viên nào trong khoảng thời gian này.
                                    </div>
                                <?php else: ?>
                                    <table id="basic-datatables" class="display table table-striped table-hover dataTable" role="grid" aria-describedby="basic-datatables_info">
                                        <thead>
                                            <tr role="row">
                                                <th>Mã giảng viên</th>
                                                <th>Tên giảng viên</th>
                                                <th>Số giờ dạy</th>
                                                <th>Thao tác</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php $__currentLoopData = $teachers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $teacher): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr role="row">
                                                    <td><?php echo e($teacher->code); ?></td>
                                                    <td><?php echo e($teacher->name); ?></td>
                                                    <td><?php echo e($teacher->teaching_hours ?? 0); ?></td>
                                                    <td>
                                                        <a href="<?php echo e(route('teacher.edit', $teacher->id)); ?>" class="btn btn-sm btn-black">
                                                            <i class="fa fa-edit"></i>
                                                        </a>
                                                    </td>
                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </tbody>
                                    </table>
                                    <div class="row">
                                        <div class="col-sm-12 col-md-5">
                                            <?php echo e($teachers->links()); ?>

                                        </div>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function clearFilter() {
        document.getElementById('start_date').value = '';
        document.getElementById('end_date').value = '';
        document.getElementById('teacher_code').value = '';
        document.getElementById('filter-form').submit();
    }
</script>
<?php /**PATH C:\Users\phama\OneDrive\Desktop\Tai_Nguyen_Hoc_Tap\DuAnPHP3\SchoolManagementSystem\resources\views/admin/teacher/teachertime/pages/index.blade.php ENDPATH**/ ?>