IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/0df1f3fd1905cc13e94d68e3d08f36fec3a44994.php

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Download </strong>Excel</h2>
            </div>
            <div class="body">
                <?php echo Form::open(['url' => 'school/exam/export','class'=>'form-horizontal','id'=>'form']); ?>

                
                <div class="row clearfix">
                    <div class="col-sm-8">
                    <table class="table">
                    <thead>
                        <tr>
                            <th></th>
                           
                            <th>Class</th>
                            <th>Section</th>
                            <th>Ec No</th>
                        </tr>
                    </thead>
                    <tbody  id="optional_list">
                      
                        <?php $i =1;?>
                        <tr>
                            <td></td>
                            <td>
                                <?php echo Form::select('idClass',$classes,null,['class' => 'form-control select2 show-tick ms selected-class','required'=>'required']); ?>

                            </td>
                            <td>
                                <div id="idSection" style="border:1px solid #ccc;height: 140px; overflow-y: scroll;">
                                
                                </div>
                            </td>
                            <td>
                                <div id="idStudent" style="border:1px solid #ccc;height: 140px; overflow-y: scroll;">
                                
                                </div>
                            </td>
                       </tr>
                        <?php $i++ ; ?>
                    </tbody>
                </table>
                </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-6 offset-sm-4">
                        <?php echo Form::submit('DOWNLOAD EXCEL',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                        <?php echo Form::close(); ?> 
                    </div>
                    <table class="table table-hover table-bordered" id="studentTable" style="display:none">
                        <thead>
                             <tr>
                                <th>Admission No</th>
                                <th>Ec No</th>
                                <th>Full Name</th>
                                <th>Class</th>
                                <th>Section</th>
                                <th>Contact Number</th>
                                <th>Gender</th>
                                <th>DOB</th>
                                <th>Fathers Name</th>
                                <th>Mothers Name</th>
                             </tr>
                        </thead>
                        <tbody id="studentBody"></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
     
    
   $('select[name="idClass"]').on('change', function() {
        var classID = $(this).val();
        if(classID) {
            $.ajax({
                url: "<?php echo e(url('/school/class')); ?>"+'/' +classID + "/sections",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('#idSection').empty();
                    $('#idSection').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><input type="checkbox" class="select-all" id="selectall"><strong>Select All</label></strong></div>');
                    $.each(data, function(key, value) {
                       $('#idSection').append('<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="sections[]" value="'+key+'" class="sectionclass"><label style="margin-right:100px;">'+value+'</label></div>');
                        
                    });
                }
            });
        }else{
            $('select[name="idSection"]').empty();
        }
    }); 
    
    
     $('select[name="idSection"]').on('change', function() {
        var sectionID = $(this).val();
        if(sectionID) {
            $.ajax({
                    url: "<?php echo e(url('/school/section')); ?>"+'/' +sectionID + "/students",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('#idStudent').empty();
                        $('#idStudent').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><input type="checkbox" class="select-allstd" id="selectallstd"><label style="margin-right:42px;"><strong>Select All</label></strong></div>');
                        $.each(data, function(key, value) {
                           $('#idStudent').append('<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="students[]" value="'+key+'" class="stdallselect"><label>'+value+'</label></div>');

                        });
                    }
                });
            }else{
                $('#idStudent').empty();
            }
    });
});
// Saving form data
$('#form').on('submit',function(e){
    $.ajaxSetup({
    header:$('meta[name="_token"]').attr('content')
    });
    var formData =  new FormData($('#form')[0]);
    $.ajax({
        type:"POST",
        url: "<?php echo e(url('school/exam/export')); ?>",
        processData: false,
        contentType: false,
        data:formData,
        dataType: 'json',
        success:function(data){
            
            var table = $('#studentTable').DataTable({
                dom: 'Bfrtip',
                scrollY:        "500px",
                scrollX:        true,
                scrollCollapse: true,
                fixedColumns:   {
                    left: 1
                },
                buttons: [
                    //'csv'
                   {
                     extend: 'csv',
                     action: function( e, dt, node, config) {
                         $.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
                         setTimeout(function(){
                         window.location = "<?php echo e(url('school/exam/export')); ?>";
                         }, 1000);
                     }
                   }

                ]
            });  
            table.rows.add(data).draw();
            $(".buttons-csv").trigger("click");
            $('#studentTable_wrapper').hide();
        },
        
        error: function(data){
            
        }
    });
    return false;
});
$(document).on('click', '.sectionclass', function(){
    var sectionIds = [];
        $("input:checkbox[name='sections[]']:checked").each(function () {
            sectionIds.push($(this).val());
        });
        if (sectionIds.length > 0) {
                $.ajax({
                    url: "<?php echo e(url('/school/sec')); ?>"+'/' +sectionIds + "/students",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('#idStudent').empty();
                        $('#idStudent').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><input type="checkbox" class="select-allstd" id="selectallstd"><label style="margin-right:42px;"><strong style="padding-left:10px">Select All</label></strong></div>');
                        $.each(data, function(key, value) {
                           $('#idStudent').append('<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="students[]" value="'+key+'" class="stdallselect"><label>'+value+'</label></div>');

                        });
                    }
                });
            }else{
                $('#idStudent').empty();
            }
});
$(document).on('click', '.select-all', function(){
    var checkAll = this.checked;
        if(checkAll === true){
            $("input:checkbox[name='sections[]']").each(function () {
                this.checked = checkAll;
            });
            var sectionIds = [];
            $("input:checkbox[name='sections[]']:checked").each(function () {
                sectionIds.push($(this).val());
            });
            if (sectionIds.length > 0) {
                    $.ajax({
                        url: "<?php echo e(url('/school/sec')); ?>"+'/' +sectionIds + "/students",
                        type: "GET",
                        dataType: "json",
                        success:function(data) {
                            $('#idStudent').empty();
                            $('#idStudent').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><input type="checkbox" class="select-allstd" id="selectallstd"><strong>Select All</label></strong></div>');
                            $.each(data, function(key, value) {
                               $('#idStudent').append('<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="students[]" value="'+key+'" class="stdallselect"><label>'+value+'</label></div>');

                            });
                        }
                    });
                }
        }else{
            $('#idStudent').empty();
            $('input[type=checkbox]').each(function () {
                this.checked = checkAll;
            });
        }
        
    
});
$(document).on('click', '.select-allstd', function(){
    var checkAllstd = this.checked;
        if(checkAllstd === true){
            $("input:checkbox[name='students[]']").each(function () {
               this.checked = checkAllstd;
           });
        }else{
            $('.stdallselect').each(function () {
                this.checked = checkAllstd;
            });
        }
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7