IMMREX7

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

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-lg-12 col-md-12 col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Manual</strong> Attendance</h2>
            </div>
            <div class="body">
                <?php echo Form::open(['method' => 'GET',  'action' => ['School\Hostel\AttendanceController@create'], 'class' => 'form-horizontal']); ?>

                
                <div class="row clearfix">
                    <div class="col-sm-1 form-control-label required">
                        <label for="classname">Month</label>
                    </div>
                    <div class="col-sm-2">
                        <div class="form-group">
                            <?php echo Form::select('idMonth',getMonths(),$current_month->idMonth,['class' => 'form-control show-tick ms select2']); ?>

                            <?php if($errors->has('idMonth')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('idMonth')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="col-sm-1 form-control-label required">
                        <label for="classname">Floor </label>
                    </div>
                    <div class="col-sm-2">
                        <div class="form-group">
                            <?php echo Form::select('idFloor',$floor,null,['class' => 'form-control show-tick ms select2','required'=>'required']); ?>

                            <?php if($errors->has('idFloor')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('idFloor')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="col-sm-1 form-control-label">
                    <?php  if(isset($_GET['idRoom'])){
                               $sec =  $_GET['idRoom']; 
                                
                                echo '<input type="hidden" value='.$sec.' id="testsec">'; }?>
                        <label for="classname">Room</label>
                    </div>
                    <div class="col-sm-2">
                        <div class="form-group">
                            <select id='idRoom' name='idRoom' class="form-control show-tick ms" required="required"></select>
                            <?php if($errors->has('idRoom')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('idRoom')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="col-sm-2">
                        <?php echo Form::submit('SHOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                    </div>
                    <?php echo Form::close(); ?> 
                </div>
            </div>
            <?php if($month): ?>
            
            <div class="body table-responsive" style="padding-top: 0px;">
                 <?php echo Form::open(['url' => 'school/hostelattendance',  'class' => 'form-horizontal']); ?>

                 <div style="float:right;">
                 <?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-success btn-round waves-effect']); ?>

                  <!--<a class="btn btn-raised  btn-danger btn-round waves-effect js-sweetalert" href="<?php echo e(url('/school/smstopresent/'.$month->idMonth.'/'.$sec)); ?>">SEND SMS TO PRESENT STUDENTS</a>
                  <a class="btn btn-raised  btn-danger btn-round waves-effect js-sweetalert" href="<?php echo e(url('/school/smstoabsent/'.$month->idMonth.'/'.$sec)); ?>">SEND SMS TO ABSENT STUDENTS</a>-->
                 </div>
                 <input type="hidden" name='idType' value="M">
                 <input type="hidden" name='idMonth' value="<?php echo e($month->idMonth); ?>">
                 <table class="table table-bordered" id="manual-attendance">
                    <thead>
                        <tr>
                   
                            <?php $noOfdays = $month->noOfDays; 
                                $now = Carbon\Carbon::now();
                                $m = $month->idMonth;
                                $y = $now->year;
                                ?>
                            <th>EC No.</th>
                            <th>Name</th>
                            <?php for($i=1; $i<=$noOfdays;$i++): ?>
                            <?php $dt = $i.'-'.$m.'-'.$y;
                                $tdate = Carbon\Carbon::parse($dt);
                                $jdate = $tdate->format('Y-m-d');
                                ?>
                            <?php if($tdate->dayOfWeek == '0'): ?>
                            <td> <span style="color:green; font-weight: bold;"><?php echo e($i); ?> <br>
                                    SUNDAY</span></td>
                            <?php else: ?><td>
                                <?php echo e($i); ?>

                                <br> <input type="checkbox" id="dayselectall<?php echo e($i); ?>" onclick="selectAllStudentOfDay(<?php echo e($i); ?>)">
                            </td>
                            <?php endif; ?>
                            <?php endfor; ?>
                            <th>TP</th>
                            <th>TA</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if(count($students)>0): ?>
                            <?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                
                                <td><?php echo e($var->ecNo); ?></td>
                                <td><?php echo e($var->firstName); ?> <?php echo e($var->middleName); ?> <?php echo e($var->lastName); ?></td>
                                <?php for($i=1; $i<=$noOfdays;$i++): ?>
                                <?php $dt = $i.'-'.$m.'-'.$y;
                                $tdate = Carbon\Carbon::parse($dt);
                                $jdate = $tdate->format('Y-m-d');
                                $a_exist = DB::table('hostel_attendance')->where('Enrollment_Number','=',$var->ecNo)
                                            ->where('idSchool','=',$var->idSchool)
                                            ->whereDate('date','=',$jdate)
                                            ->where('idType','=','M')
                                            ->first();            
                                ?>
                                <td>
                                   <?php if($a_exist !=null): ?>
                                    <input type="hidden" name="students[<?php echo e($dt); ?>][<?php echo e($var->ecNo); ?>][ecNo]" value="<?php echo e($var->ecNo); ?>">
                                    <input type="checkbox" name='students[<?php echo e($dt); ?>][<?php echo e($var->ecNo); ?>][present]' value="<?php echo e($var->ecNo); ?>" checked="checked">
                                    <?php else: ?>
                                    <input type="hidden" name="students[<?php echo e($dt); ?>][<?php echo e($var->ecNo); ?>][ecNo]" value="<?php echo e($var->ecNo); ?>">
                                    <input type="checkbox" name='students[<?php echo e($dt); ?>][<?php echo e($var->ecNo); ?>][present]' value="<?php echo e($var->ecNo); ?>" class="selectchk<?php echo e($i); ?>">
                                    <?php endif; ?>
                                </td>
                               
                               
                                <?php endfor; ?>
                                <td>
                                    <?php 
                                    $tp = DB::table('hostel_attendance')->where('idSchool', '=', Auth::guard('school')->user()->idSchool)
                                                    ->where('idMonth','=',$month->idMonth)
                                                    ->where('Enrollment_Number','=',$var->ecNo)
                                                    ->where('idType','=','M')
                                                    ->get();

                                            $total_present = $tp->count()
                                            ?>
                                    <?php echo e($total_present); ?>

                                </td>
                                <td><?php echo e($ta = $month->noOfDays - $total_present); ?></td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php endif; ?>
                    </tbody>
                    
                </table>
            </div>
              <?php echo Form::close(); ?> 
            <?php endif; ?>
        </div>
        
    </div>
</div>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
     $('#manual-attendance').DataTable({
//        scrollY:        "500px",
        scrollX:        true,
//        scrollCollapse: true,
        paging:false,
        fixedColumns:   {
            left: 2,
//            right: 1
        }
    });
function selectAllStudentOfDay(key) {
    //alert(key);
    var select_all = document.getElementById("dayselectall" + key);
    var checkboxes = document.getElementsByClassName("selectchk" + key);
    select_all.addEventListener("change", function(e){
        for (i = 0; i < checkboxes.length; i++) {
             checkboxes[i].checked = select_all.checked;
        }
    });
    for (var i = 0; i < checkboxes.length; i++) {
        checkboxes[i].addEventListener('change', function(e){ //".checkbox" change 
            //uncheck "select all", if one of the listed checkbox item is unchecked
            if (this.checked == false){
                select_all.checked = false;
            }
            //check "select all" if all checkbox items are checked
            if (document.querySelectorAll('.selectchk:checked').length == checkboxes.length){
                select_all.checked = true;
            }
        });
    }
}
$(document).ready(function() {
    $('select[name="idFloor"]').on('change', function() {
        var roomID = $(this).val();
        if(roomID) {
            $.ajax({
                url: "<?php echo e(url('/school/floor')); ?>"+'/' +roomID + "/rooms",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('#idRoom').empty();
                    $('#idRoom').append('<option value="">--Select--</option>');
                    $.each(data, function(key, value) {
                       $('#idRoom').append('<option value="'+key+'">'+value+'</option>');
                    });
                }
            });
        }else{
            $('select[name="idRoom"]').empty();
        }
    });
    var cur_room = $('select[name="idFloor"]').val();
    if (cur_room) {
        $.ajax({
                url: "<?php echo e(url('/school/floor')); ?>"+'/' +cur_room + "/rooms",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('#idRoom').empty();
                    $('#idRoom').append('<option value="">--Select--</option>');
                    $.each(data, function(key, value) {
                       $('#idRoom').append('<option value="'+key+'">'+value+'</option>');
                    });
                }
            });
    }
    jQuery(document).ready(function() {
         setTimeout(function() {
            var j = $('#testsec').val();
            console.log(j);
            $('select[name="idRoom"] option[value="' + j + '"]').attr("selected","selected");
        }, 1000);
    });
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7