
<?php $__env->startSection('content'); ?>
    <style>
        .male {
            background: #8c85ff;
            text-transform: capitalize;
            color: white;
        }

        .female {
            background: #e16498;
            text-transform: capitalize;
            color: white;
        }
    </style>
    <!-- begin::main content -->
    <main class="main-content">
        <p class="d-none"><?php echo e($card_id=1); ?></p>
        <div class="container">
            <!-- begin::page header -->
            <div class="page-header">
                <h3><?php echo e(__('message.student_id_card')); ?></h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a
                                href="<?php echo e(asset('/dashboard')); ?>"><?php echo e(__('message.dashboard')); ?></a></li>
                        <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('message.student_id_card')); ?>

                            <?php echo e(__('message.list')); ?></li>
                    </ol>
                </nav>
            </div>
            
            <!-- end::page header -->
            <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>
            <div class="card">
                
                
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="shadow-sm p-3 border">
                                <h5 class="mb-3">APPLY CARD DESIGN</h5>
                                <form class="card-apply-form" method="POST" action="<?php echo e(route('student-icard-list')); ?>">
                                    <?php echo csrf_field(); ?>
                                                                   
                                    <div class="form-group mb-3">
                                        <select name="type" class="form-control design-type">
                                            <?php $__currentLoopData = $idcard; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                
                                                <option value="<?php echo e($value->type); ?>">
                                                    <?php if($value->template_type=="V"): ?>
                                                        Vertical
                                                    <?php endif; ?>
                                                    <?php if($value->template_type=="VS"): ?>
                                                        Vertical Smooth
                                                    <?php endif; ?>
                                                    <?php if($value->template_type=="H"): ?>
                                                        Horizontal
                                                    <?php endif; ?>
                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <div class="form-group mb-3">
                                        <button class="btn btn-primary" type="submit">APPLY</button>
                                    </div>
                                </form>
                            </div>
                            <?php if($_SERVER['REQUEST_METHOD'] === 'POST'): ?>
                                <?php echo csrf_field(); ?>
                                <?php
                                if(isset($_POST['type'])) {
                                    $selectedType = $_POST['type'];
                                    // assign card_id
                                    $type = htmlspecialchars($selectedType);
                                    $card_id=$type;
                                }
                                ?>
                            <?php endif; ?>
                        </div>
                        <div class="col-md-8"></div>
                    </div>
                    
                </div>



            </div>
        </div>
        <div class="container">
            <div class="card">
                <div class="card-body">
                        <?php if(isset($students)): ?>
                            <div class="table-responsive">
                                <table id="students" class="table table-striped table-bordered">
                                    <thead>
                                        <tr>
                                            <th>
                                                <input type="checkbox" id="checkAll">
                                            </th>
                                            <th><?php echo e(__('message.rollno')); ?></th>
                                            <th><?php echo e(__('message.photo')); ?></th>
                                            <th><?php echo e(__('message.studentname')); ?></th>
                                            <th><?php echo e(__('message.fathername')); ?></th>
                                            <th><?php echo e(__('message.schoolname')); ?></th>
                                            <th><?php echo e(__('message.class')); ?></th>
                                            <th><?php echo e(__('message.section')); ?></th>
                                            <th><?php echo e(__('message.idcard')); ?></th>
                                            
                                            <th><?php echo e(__('message.action')); ?></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php if(!empty($students)): ?>
                                            <?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr>
                                                    <td>
                                                        <input class="studentids" type="checkbox"
                                                            value="<?php echo e($student->user_unique_id); ?>" name="studentids[]">
                                                    </td>
                                                    <td>
                                                        <button
                                                            class="btn btn-info btn-sm waves-effect waves-button waves-light">
                                                            <?php echo e($student->enrollment_no); ?>

                                                        </button>
                                                    </td>
                                                    <td>
                                                        <?php if(!empty($student->profile_pics)): ?>
                                                            <img class="w-50"
                                                                src="<?php echo e(asset('public/profiles/') . '/' . $student->profile_pics); ?>"
                                                                alt="profile">
                                                        <?php else: ?>
                                                            <img class="w-50"
                                                                src="<?php echo e($student->gender == 'male' ? asset('public/profiles/') . '/male.png' : asset('public/profiles/') . '/female.png'); ?>"
                                                                alt="profile">
                                                        <?php endif; ?>
                                                    </td>
                                                    <td><span class="font-size-13"><?php echo e($student->name); ?></span>
                                                        <span
                                                            class="badge <?php echo e($student->gender); ?>"><?php echo e($student->gender); ?></span>
                                                    </td>

                                                    <td>
                                                        <?php if($student->guardian->count() > 0): ?>
                                                            <?php echo e($student->guardian->first()->father_name); ?>

                                                        <?php endif; ?>
                                                    </td>

                                                    <td>
                                                        <?php if($student->school->count() > 0): ?>
                                                            <?php echo e($student->school->last()->school); ?>

                                                        <?php else: ?>
                                                            NA
                                                        <?php endif; ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            $getClass = App\Helpers\Frontend::getSingledata('classes', ['id' => $student->class_id]);
                                                        ?>
                                                        <?php if(!empty($getClass)): ?>
                                                            <?php echo e($getClass->class); ?>

                                                        <?php else: ?>
                                                            NA
                                                        <?php endif; ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            $getSection = App\Helpers\Frontend::getSingledata('sections', ['id' => $student->section_id]);
                                                        ?>

                                                        <?php if(!empty($getSection)): ?>
                                                            <?php echo e($getSection->section); ?>

                                                        <?php else: ?>
                                                            NA
                                                        <?php endif; ?>
                                                    </td>
                                                    

                                                    <td>
                                                        <div class="btn-group">
                                                           
                                                            <button type="button"
                                                                class="btn btn-dark btn-sm waves-effect waves-button waves-light text-white">
                                                                <a href="<?php echo e(asset('student-id-card/'.$student->id.'/'.$card_id)); ?>" class="id-card-link"><i class="fa fa-id-card-o"></i></a>
                                                            </button>
                                                        </div>
                                                    </td>

                                                    <td>
                                                        
                                                        <div class="dropdown">
                                                            <button class="btn btn-sm btn-dark dropdown-toggle" type="button"
                                                                data-toggle="dropdown">
                                                                <?php echo e(__('message.action')); ?>

                                                            </button>
                                                            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                                                <?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('edit-student')){ ?>
                                                                <a class="dropdown-item"
                                                                    href="<?php echo e(asset('student/edit') . '/' . $student->user_unique_id); ?>"><?php echo e(__('message.edit')); ?></a>
                                                                <?php } ?>

                                                                <?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('delete-student')){ ?>
                                                                <a class="dropdown-item delete-confirm"
                                                                    link="<?php echo e(asset('student/delete') . '/' . $student->user_unique_id); ?>"
                                                                    href="javascript:;"><?php echo e(__('message.delete')); ?></a>
                                                                <?php } ?>


                                                                <?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('change-student-password')){ ?>
                                                                <a class="dropdown-item change-password"
                                                                    data-user_unique_id="<?php echo e($student->user_unique_id); ?>"
                                                                    href="javascript:;">Reset
                                                                    Password</a>
                                                                <?php } ?>

                                                                <?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('promote-student')){ ?>
                                                                <a class="dropdown-item"
                                                                    href="<?php echo e(asset('student/promote/' . $student->user_unique_id)); ?>">Change/Promote</a>
                                                                <?php } ?>

                                                                <?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('promote-student')){ ?>
                                                                <a class="dropdown-item"
                                                                    href="<?php echo e(asset('document-upload/' . $student->id)); ?>">Document
                                                                    Upload</a>
                                                                <?php } ?>

                                                            </div>
                                                        </div>
                                                    </td>


                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php else: ?>
                                            <h1>No Record Found!!</h1>
                                        <?php endif; ?>
                                    </tbody>
                                </table>
                            </div>
                            
                            <div class="pagination-block">
                                <?php echo e($students->appends($_GET)->links('includes.paginationlinks')); ?>

                                <label>Showing total <?php echo $students->total(); ?> results</label>
                            </div>
                        <?php endif; ?>
                </div>
            </div>
        </div>
        
    </main>
   

   

    <!-- end::main content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('footer-script'); ?>
    <script src="<?php echo e(asset('public/admin/vendors/dataTable/jquery.dataTables.min.js')); ?>"></script>
    <script src="<?php echo e(asset('public/admin/vendors/dataTable/dataTables.bootstrap4.min.js')); ?>"></script>
    <script src="<?php echo e(asset('public/admin/vendors/dataTable/dataTables.responsive.min.js')); ?>"></script>

   <script>
        $(document).ready(function(){
            /*$('.card-apply-form').submit(function(e){
                e.preventDefault();
                let design_no = $(".design-type").val();
                
                
                

            });*/
        });
   </script>

    <?php if(!empty(Request::get('school'))): ?>
        <script>
            $("#schools").val("<?php echo e(Request::get('school')); ?>").trigger('change');
        </script>
    <?php endif; ?>

    <?php if(!empty(Request::get('class'))): ?>
        <script>
            $("#class").val("<?php echo e(Request::get('class')); ?>").trigger('change');
        </script>
    <?php endif; ?>

    <?php if(!empty(Request::get('section'))): ?>
        <script>
            $("#section").val("<?php echo e(Request::get('section')); ?>").trigger('change');
        </script>
    <?php endif; ?>

    <?php if(!empty(Request::get('type'))): ?>
        <script>
            $("#type").val("<?php echo e(Request::get('type')); ?>").trigger('change');
        </script>
    <?php endif; ?>

    <!-- end::dataTable -->
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\xampp\htdocs\school_saas_erp\resources\views/template/template_id-list.blade.php ENDPATH**/ ?>