<?php $__env->startSection('content'); ?>

<style>
    table {
        width: 100%;
    }

</style>

<div class="container">
 <div class="col-sm-12 col-12" id="mainpage">
  <div class="row">

   <div class="col-sm-9 col-12">

      <ul class="list-group p-0">
       <li class="list-group-item">
        <span class="student"><?php echo app('translator')->get('frontend.student_attendance'); ?></span>
      </li>

      <li class="list-group-item">
        <div class="col-12">
            <div class="row">
                <div class="col-lg-4 col-12">
                    <input type="date" class="form-control form-control-sm" name="search_from_date" id="search_from_date">
                </div>
                <div class="col-lg-4 col-12">
                    <button class="btn btn-sm btn-info" id="getDatewiseAttData" onclick="return loadajaxdateattdata()"><?php echo app('translator')->get('frontend.search'); ?></button>
                </div>
            </div>
        </div>
        <br>
        <div class="col-12">
            <table class="table table-borderd">
                <tr>
                    <th><?php echo app('translator')->get('frontend.class'); ?></th>
                    <th><?php echo app('translator')->get('frontend.total_student'); ?></th>
                    <th class="table-success"><?php echo app('translator')->get('frontend.present'); ?></th>
                    <th class="table-danger"><?php echo app('translator')->get('frontend.absent'); ?></th>
                </tr>
                <tbody id="showData">
                <?php if($class): ?>
                <?php $__currentLoopData = $class; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td><a href="/ems/studentsportal/dailyAttendanceSheet.php"><?php echo e($c->class_name); ?></a></td>
                    <td>
                        <?php
                        $total_student = DB::connection('mysql_second')->table('running_student_info')->where('class_id',$c->id)->count();
                        ?>
                        <?php echo e($total_student); ?>

                    </td>
                    <td class="table-success">
                        <?php
                        $total_present = DB::connection('mysql_second')->table('attendance')->where('class_id',$c->id)->where('attendance',1)->where('attend_date',date('Y-m-d'))->count();
                        ?>
                        <?php echo e($total_present); ?>

                    </td>
                    <td class="table-danger"><?php echo e($total_student - $total_present); ?></td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>
            </tbody>
            </table>
        </div>

    </li>
  </ul>
  <br>

</div>



  <?php echo $__env->make('frontend.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>





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


<script>
    function loadajaxdateattdata()
    {
        var from_date = $('#search_from_date').val();

        // alert(from_date);

        if(from_date != '')
        {
            $.ajax({
                headers : {
                    'X-CSRF-TOKEN' : '<?php echo e(csrf_token()); ?>'
                },

                url : '<?php echo e(url('getDateAttData')); ?>',

                type : 'POST',

                data : {from_date},

                success : function(data)
                {
                    $('#showData').html(data);
                }
            });
        }
    }
</script>


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

<?php echo $__env->make('frontend.index', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/gzmcfenigov/public_html/resources/views/frontend/student_attendance.blade.php ENDPATH**/ ?>