<?php $__env->startSection('content'); ?>
    <style>
        /* .seat-plan-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
        } */
        .seat-plan-wrapper {
            border: 1px solid #585858;
            font-family: sans-serif;
            padding: 15px 5px 5px;
            box-sizing: border-box;
            height: 287px;
            overflow: hidden;
            position: relative;
        }
        .seat-plan-wrapper h4 {
            color: #222222;
            font-weight: 600;
            font-size: 1.5rem;
            font-family: sans-serif !important;
        }
        .seat-plan-wrapper h5 {
            color: #000000;
            font-weight: 600;
            font-size: 1.1rem;
        }
        .seat-plan-wrapper .roll {
            font-weight: 700;
            font-size: 2rem;
            margin-bottom: 1rem;
            color: #000;
        }
        .seat-plan-wrapper .footer p {
            position: absolute;
            right: 5px;
            bottom: 5px;
        }
    </style>

    <div class="card">
        <div class="card-body card__head">
            <!-- Nav tabs -->
            <ul class="nav nav-tabs">
                <li class="nav-item">
                    <a class="nav-link <?php echo e(request()->input('tab') === 'search' || request()->input('tab') === null ? 'show active' : ''); ?>"
                       data-toggle="tab" href="#search-tab">
                        Search By ID
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link <?php echo e(request()->input('tab') === 'filter' ? 'show active' : ''); ?>"
                       data-toggle="tab" href="#filter-tab">
                        Search by Class
                    </a>
                </li>
            </ul>
            <!-- Tab panes -->
            <div class="tab-content">
                <div id="search-tab"
                     class="tab-pane <?php echo e(request()->input('tab') === 'search' || request()->input('tab') === null ? 'show active' : ''); ?>">
                    <br>
                    <form method="post" action="<?php echo e(route('seat-plan.filter')); ?>" class="row">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="tab" value="search">

                        <div class="form-group col-lg-2 col-md-4 col-sm-6">
                            
                            <select name="exam" class="form-control select2" id="exam" required>
                                <option value="">Exam</option>
                                <?php $__currentLoopData = $exams; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $exam): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php if($exam_id==$exam->id): ?>
                                        <option value="<?php echo e($exam->id); ?>"
                                                selected><?php echo e($exam->exam_name ." ". $exam->academic_year->year); ?></option>
                                    <?php else: ?>
                                        <option
                                            <?php echo e($loop->first ? 'selected' : ''); ?> value="<?php echo e($exam->id); ?>"><?php echo e($exam->exam_name ." ". $exam->academic_year->year); ?></option>
                                    <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>

                        <div class="form-group col-lg-2 col-md-4 col-sm-6">
                            <?php $__env->startComponent('components.search_student', [
                                'student_name' => $student_name ?? '',
                                'student_id_no' => request()->student_id_no ?? '',
                                'required' => '',
                            ]); ?>
                            <?php echo $__env->renderComponent(); ?>
                        </div>

                        <div class="form-group col-lg-2 col-md-4 col-sm-6">
                            <button type="submit" class="btn btn-info">Search</button>
                        </div>
                    </form>
                </div>
                <div id="filter-tab"
                     class="tab-pane fade <?php echo e(request()->input('tab') === 'filter' ? 'show active' : ''); ?>"><br>
                    <form method="post" action="<?php echo e(route('seat-plan.filter')); ?>" class="row">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="tab" value="filter">

                        <div class="form-group col-lg-2 col-md-4 col-sm-6">
                            <select name="exam" class="form-control select2" id="exam" required>
                                <option value="">Exam</option>
                                <?php $__currentLoopData = $exams; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $exam): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php if($exam_id==$exam->id): ?>
                                        <option value="<?php echo e($exam->id); ?>"
                                                selected><?php echo e($exam->exam_name ." ". $exam->academic_year->year); ?></option>
                                    <?php else: ?>
                                        <option
                                            <?php echo e($loop->first ? 'selected' : ''); ?> value="<?php echo e($exam->id); ?>"><?php echo e($exam->exam_name. " " .$exam->academic_year->year); ?></option>
                                    <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>

                        <div class="form-group col-lg-2 col-md-4 col-sm-6">
                            <?php echo e(generateDropdown($studentClasses, 'class="form-control student_class student_class_id select2" id="student_class" name="student_class" required', request()->input('student_class'), "Class")); ?>

                        </div>

                        
                      
                        <?php if (isset($component)) { $__componentOriginal24102f1ac62c394be69e2bc4df251128 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal24102f1ac62c394be69e2bc4df251128 = $attributes; } ?>
<?php $component = App\View\Components\GroupSelector::resolve(['name' => 'group','label' => '','labelText' => 'Group','col' => 'form-group col-lg-2 col-md-6 col-sm-6','required' => (int) request()->input('student_class') >= 11,'selected' => old('group') ?? request()->input('group')] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('group-selector'); ?>
<?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\GroupSelector::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['student_class_id' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute((int) request()->input('student_class'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal24102f1ac62c394be69e2bc4df251128)): ?>
<?php $attributes = $__attributesOriginal24102f1ac62c394be69e2bc4df251128; ?>
<?php unset($__attributesOriginal24102f1ac62c394be69e2bc4df251128); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal24102f1ac62c394be69e2bc4df251128)): ?>
<?php $component = $__componentOriginal24102f1ac62c394be69e2bc4df251128; ?>
<?php unset($__componentOriginal24102f1ac62c394be69e2bc4df251128); ?>
<?php endif; ?>


                        <div class="form-group col-lg-2 col-md-4 col-sm-6">
                            <button type="submit" class="btn btn-info">Search</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <?php if(isset($students) && !empty($students) && $students->count() > 0 ): ?>

        <?php
            $logo_path = get_setting_value(Settings::EXPORT_LOGO) ? get_setting_value(Settings::EXPORT_LOGO) : 'uploads/images/logo.png';
            $institute_name = get_setting_value(Settings::SCHOOL_NAME) ? get_setting_value(Settings::SCHOOL_NAME) : '';
            $branch_info = get_branch_info();
        ?>
        <div class="card mt-4 justify-content-center">
            <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between border-bottom">
                <h6 class="m-0 table__top__txt">Seat Plan (Total Result: <?php echo e(count($students)); ?>)</h6>
                <div class="m-0 float-right">
                    <a class="btn btn-secondary btn__export mr-1" href="#" data-toggle="tooltip"
                       <?php if(count($students) > 0): ?>
                       onclick="prindAdmitCard()"
                       <?php else: ?>
                       onclick="return false;"
                       <?php endif; ?> title="Print">
                        <i class="fas fa-print"></i>
                    </a>
                </div>
            </div>

            <div class="card-body mt-3">
                <div class="seat-plan-container justify-content-center row" id="seat-plan">
                    <?php $__currentLoopData = $students->sortBy('class_roll'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="col-md-4 col-lg-4 items">
                            <div class="seat-plan-wrapper text-center">
                                <h4 class="name"><?php echo e($institute_name); ?></h4>
                                <h6 class="address"><?php echo e($branch_info->address); ?></h6>
                                <h4 class="exam__name"><?php echo e($selected_exam->exam_name ?? 'N/A'); ?>  <?php echo e($academic_year); ?> </h4>
                                <h5>Name: <span class="text-uppercase"><?php echo e(Str::words($student->name,3,'')); ?></span></h5>
                                <div class="dept d-flex align-items-center justify-content-between">
                                    <h4>Class: <?php echo e($student->studentClass->class_name ?? 'N/A'); ?></h4>
                                    <h4>Roll No: <?php echo e($student->class_roll ?? 'N/A'); ?></h4>
                                </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
    <?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <script>
        function prindAdmitCard() {
            let content = document.getElementById('seat-plan').innerHTML;
            let printWindow = window.open('', '', 'height=900,width=1100');
            printWindow.document.write(`
        <html>
            <head>
                <style>
                    @media print {
                        body {
                            font-family: Arial, sans-serif;
                            margin: 0;
                            padding: 0;
                        }
                         .name{
                               margin-bottom: 5px;
                            }
                        .address{
                            margin-top: 5px !important;
                            margin-bottom: 9px;
                        }
                        .exam__name{
                        margin-top: 10px !important;
                        }
                        .dept{
                        margin-top: 16px;
                        }
                        .dept h4{
                        font-weight: 400;
                        }

                        /* Center the container */
                        #seat-plan {
                            text-align: left;
                        }

                        /* Each card item */
                        .items {
                            display: inline-block;
                            width: 32%;
                            vertical-align: top;
                            margin: 3px;
                            padding-top: .20rem;
                            padding-bottom: .20rem;
                            text-align: center;
                            box-sizing: border-box;
                        }

                     .seat-plan-wrapper {
                                border: 1px solid #585858;
                                font-family: sans-serif;
                                padding: 15px 5px 5px;
                                box-sizing: border-box;
                                height: 255px;
                                overflow: hidden;
                                position: relative;
                                display: inline-block;
                            }
                        .align-items-center{
                            -webkit-box-align: center !important;
                            -ms-flex-align: center!important;
                            align-items: center !important;
                        }
                        .justify-content-between {
                            -webkit-box-pack: justify !important;
                            -ms-flex-pack: justify!important;
                            justify-content: space-between !important;
                        }
                        .d-flex {
                            display: -webkit-box !important;
                            display: -ms-flexbox!important;
                            display: flex !important;
                        }

                        .seat-plan-wrapper h4{
                            color: #222222;
                            font-weight: 600;
                            font-size: 1rem;
                            margin:0px;
                            padding-bottom: 3px;

                        }
                        .seat-plan-wrapper h5{
                            color: #000000;
                            font-weight: 600;
                            font-size: 0.8rem;
                            margin:0px;
                            padding-bottom: 3px;
                        }
                        .seat-plan-wrapper h6{
                            font-size: 0.8rem;
                            margin:0px;
                            padding-bottom: 3px;
                        }
                        .seat-plan-wrapper .roll{
                            font-weight: 700;
                            font-size: 24px;
                            margin-top: 0.5rem;
                            margin-bottom: 0.7rem;
                            color: #000;
                            padding: 0px;
                        }
                        .text-right {
                            text-align: right !important;
                        }
                        .mb-0, .my-0 {
                            margin-bottom: 0 !important;
                        }
                        .small, small {
                            font-size: 80%;
                            font-weight: 400;
                        }
                        .footer{
                            color:#757575;
                        }
                        @page {
                            size: A4 portrait;
                            margin-top: 3mm;
                            margin-left: 3mm;
                            margin-right: 3mm;
                            margin-bottom: 3mm;
                        }
                    }
                </style>
            </head>
            <body>
                <div id="seat-plan">${content}</div>
            </body>
        </html>
    `);
            printWindow.document.close();
            printWindow.focus();

            setTimeout(() => {
                printWindow.print();
                printWindow.close();
            }, 500);
        }


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

<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/EdueasyCollege/resources/views/pages/result/seat-plan/index.blade.php ENDPATH**/ ?>