
<?php $__env->startSection('title'); ?>
    <?php echo app('translator')->get('academics.courses'); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('mainContent'); ?>
    <section class="sms-breadcrumb mb-20">
        <div class="container-fluid">
            <div class="row justify-content-between">
                <h1><?php echo app('translator')->get('academics.courses'); ?></h1>
                <div class="bc-pages">
                    <a href="<?php echo e(route('dashboard')); ?>"><?php echo app('translator')->get('common.dashboard'); ?></a>
                    <a><?php echo app('translator')->get('academics.academics'); ?></a>
                    <a><?php echo app('translator')->get('academics.courses'); ?></a>
                </div>
            </div>
        </div>
    </section>



    <section class="admin-visitor-area up_admin_visitor up_st_admin_visitor pl_22">
        <div class="container-fluid p-0">
            <div class="row">
                <div class="col-lg-12">
                    <div class="white-box">

                        <div class="table-responsive">
                            <?php if (isset($component)) { $__componentOriginal163c8ba6efb795223894d5ffef5034f5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal163c8ba6efb795223894d5ffef5034f5 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.table','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('table'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
                                <table id="table_id" class="table" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th><?php echo app('translator')->get('academics.id'); ?></th>
                                            <th><?php echo app('translator')->get('academics.course_name_en'); ?></th>
                                            <th><?php echo app('translator')->get('academics.start_date'); ?></th>
                                            <th><?php echo app('translator')->get('academics.end_date'); ?></th>
                                            <th><?php echo app('translator')->get('academics.days_criteria'); ?></th>
                                            <th><?php echo app('translator')->get('academics.track_type'); ?></th>
                                            <th><?php echo app('translator')->get('academics.capicity'); ?></th>
                                            <th><?php echo app('translator')->get('academics.instructor'); ?></th>
                                            <th><?php echo app('translator')->get('academics.track_name'); ?></th>
                                            <th><?php echo app('translator')->get('academics.levels'); ?></th>

                                            <th><?php echo app('translator')->get('common.action'); ?></th>

                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $staffScheduleds; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $scheduled): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            
                                            

                                            <tr>
                                                <td><?php echo e($scheduled->id); ?></td>
                                                <td><?php echo e($scheduled->course_name_en); ?></td>
                                                <td><?php echo e($scheduled->start_date); ?></td>
                                                <td><?php echo e($scheduled->end_date); ?></td>
                                                <td>
                                                    <?php $__currentLoopData = $scheduled->slots->unique('slot_day'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $slot): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php echo e($slot->slot_day); ?><br>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </td>

                                                <td><?php echo e($scheduled->trackType->name); ?></td>
                                                <td><?php echo e($scheduled->trackType->count_of_students); ?></td>
                                                <td><?php echo e($scheduled->staff->full_name); ?></td>
                                                <td><?php echo e($scheduled->track->track_name_en); ?></td>
                                                <td><?php echo e($scheduled->track->level_number); ?></td>

                                                <td>
                                                    <?php if (isset($component)) { $__componentOriginalf5ee9bc45d6af00850b10ff7521278be = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf5ee9bc45d6af00850b10ff7521278be = $attributes; } ?>
<?php $component = App\View\Components\DropDown::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('drop-down'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\DropDown::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
                                                        <?php if(userPermission('view_calendar')): ?>
                                                            <a class="dropdown-item" href="#"><?php echo app('translator')->get('common.view_calendar'); ?></a>
                                                        <?php endif; ?>
                                                        <?php if(userPermission('assigned_students')): ?>
                                                            <a class="dropdown-item"
                                                                onclick="openModalAssigns(<?php echo e($scheduled->id); ?>)">
                                                                <?php echo app('translator')->get('common.request_invoice'); ?>
                                                            </a>
                                                        <?php endif; ?>
                                                        <?php if(userPermission('assigned_students')): ?>
                                                            <a class="dropdown-item"
                                                                href="<?php echo e(route('sm_courses_show', $scheduled->id)); ?>">
                                                                <?php echo app('translator')->get('common.edit'); ?>
                                                            </a>
                                                        <?php endif; ?>

                                                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf5ee9bc45d6af00850b10ff7521278be)): ?>
<?php $attributes = $__attributesOriginalf5ee9bc45d6af00850b10ff7521278be; ?>
<?php unset($__attributesOriginalf5ee9bc45d6af00850b10ff7521278be); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf5ee9bc45d6af00850b10ff7521278be)): ?>
<?php $component = $__componentOriginalf5ee9bc45d6af00850b10ff7521278be; ?>
<?php unset($__componentOriginalf5ee9bc45d6af00850b10ff7521278be); ?>
<?php endif; ?>
                                                </td>
                                            </tr>

                                            <!-- Modal for Assigned Students -->
                                            <div class="modal fade" id="assign_student_modal_<?php echo e($scheduled->id); ?>"
                                                tabindex="-1" aria-labelledby="assignedStudentsLabel_<?php echo e($scheduled->id); ?>"
                                                aria-hidden="true">
                                                <form action="<?php echo e(route('sm_courses_store')); ?>" method="POST">
                                                    <?php echo csrf_field(); ?>
                                                    <div class="modal-dialog">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h1 class="modal-title fs-5"
                                                                    id="assignedStudentsLabel_<?php echo e($scheduled->id); ?>">
                                                                    <?php echo app('translator')->get('common.assigned_students'); ?>
                                                                </h1>
                                                                <button type="button" class="close closeStudentModal"
                                                                    data-bs-dismiss="modal" aria-label="Close">
                                                                    <span aria-hidden="true">&times;</span>
                                                                </button>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="primary_input">
                                                                    <label class="primary_input_label"
                                                                        for="studentDropdown_<?php echo e($scheduled->id); ?>">
                                                                        <?php echo app('translator')->get('common.select_student'); ?> <span
                                                                            class="text-danger">*</span>
                                                                    </label>
                                                                    <select class="primary_select form-control"
                                                                        name="student_id"
                                                                        id="studentDropdown_<?php echo e($scheduled->id); ?>">
                                                                        <?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                            <option value="<?php echo e($student->id); ?>">
                                                                                <?php echo e($student->full_name); ?></option>
                                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                                    </select>
                                                                </div>
                                                                <input type="hidden" id="scheduleId"
                                                                    name="staff_scheduleds_id"
                                                                    value="<?php echo e($scheduled->id); ?>">
                                                                <input type="hidden" id="levelId" name="levels_id"
                                                                    value="<?php echo e($scheduled->track->level_number); ?>">
                                                            </div>
                                                            <div class="modal-footer"
                                                                id="modal_footer_<?php echo e($scheduled->id); ?>">
                                                                <button type="submit"
                                                                    class="primary-btn fix-gr-bg text-nowrap">
                                                                    <?php echo app('translator')->get('common.request_invoice'); ?>
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal163c8ba6efb795223894d5ffef5034f5)): ?>
<?php $attributes = $__attributesOriginal163c8ba6efb795223894d5ffef5034f5; ?>
<?php unset($__attributesOriginal163c8ba6efb795223894d5ffef5034f5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal163c8ba6efb795223894d5ffef5034f5)): ?>
<?php $component = $__componentOriginal163c8ba6efb795223894d5ffef5034f5; ?>
<?php unset($__componentOriginal163c8ba6efb795223894d5ffef5034f5); ?>
<?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('backEnd.partials.data_table_js', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<?php $__env->startPush('script'); ?>
    <script>
        $(document).ready(function() {
            $('[id^="student_modal_btn_"]').click(function(event) {
                event.preventDefault();
                const targetModal = $(this).data('bs-target');
                $(targetModal).modal('show');
            });

            $('.closeStudentModal').click(function(event) {
                event.preventDefault();
                $(this).closest('.modal').modal('hide');
            });
        });


        function openModalAssigns(id) {
            $('#assign_student_modal_' + id).modal('show');

        }
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('backEnd.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\tailors-dev\upedia\resources\views/backEnd/academics/sm_courses/index.blade.php ENDPATH**/ ?>