IMMREX7
<?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 if(isset($bus)): ?>
<?php echo Form::open(['method' => 'GET', 'action' => ['School\BusAttendanceController@create'], 'class' => 'form-horizontal']); ?>
<?php else: ?>
<?php echo Form::open(['method' => 'GET', 'action' => ['School\AttendanceController@create'], 'class' => 'form-horizontal']); ?>
<?php endif; ?>
<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">Class </label>
</div>
<div class="col-sm-2">
<div class="form-group">
<?php echo Form::select('idClass',$classes,null,['class' => 'form-control show-tick ms select2','required'=>'required']); ?>
<?php if($errors->has('idClass')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idClass')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-1 form-control-label">
<label for="classname">Section</label>
<?php if(isset($_GET['idSection'])){
$sec = $_GET['idSection'];
echo '<input type="hidden" value='.$sec.' id="testsec">'; }?>
</div>
<div class="col-sm-2">
<div class="form-group">
<select id='idSection' name='idSection' class="form-control show-tick ms" required="required"></select>
<?php if($errors->has('idSection')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idSection')); ?></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 if(isset($bus)): ?>
<?php echo Form::open(['url' => 'school/bus-attendance', 'class' => 'form-horizontal']); ?>
<?php else: ?>
<?php echo Form::open(['url' => 'school/attendance', 'class' => 'form-horizontal']); ?>
<?php endif; ?>
<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');
$v = \App\Holiday::where('idSchool','=',Auth::guard('school')->user()->idSchool)
->whereNull('idClass')
->whereDate('fromDate', '<=', $jdate)
->whereDate('toDate', '>=', $jdate)
->first();
$indiv = \App\Holiday::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
->where('idClass',$idClass)
->whereDate('fromDate', '<=', $jdate)
->whereDate('toDate', '>=', $jdate)
->first();
?>
<?php if($school->idCountry == 1): ?>
<?php if($tdate->dayOfWeek == '0'): ?>
<td> <span style="color:green; font-weight: bold;"><?php echo e($i); ?> <br>
SUNDAY</span></td>
<?php elseif($v!=null): ?>
<td><span style="color:green; font-weight: bold;"><?php echo e($i); ?> <br>
<?php echo e($v->holidayName); ?></span></td>
<?php elseif($indiv!=null): ?>
<td><span style="color:green; font-weight: bold;"><?php echo e($i); ?> <br>
<?php echo e($indiv->holidayName); ?></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 else: ?>
<?php if($tdate->dayOfWeek == '5'): ?>
<td> <span style="color:green; font-weight: bold;"><?php echo e($i); ?> <br>
FRIDAY</span></td>
<?php elseif($v!=null): ?>
<td><span style="color:green; font-weight: bold;"><?php echo e($i); ?> <br>
<?php echo e($v->holidayName); ?></span></td>
<?php elseif($indiv!=null): ?>
<td><span style="color:green; font-weight: bold;"><?php echo e($i); ?> <br>
<?php echo e($indiv->holidayName); ?></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 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');
$v = \App\Holiday::where('idSchool','=',$var->idSchool)
->whereNull('idClass')
->whereDate('fromDate', '<=', $jdate)
->whereDate('toDate', '>=', $jdate)
->first();
$indiv = \App\Holiday::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
->where('idClass',$idClass)
->whereDate('fromDate', '<=', $jdate)
->whereDate('toDate', '>=', $jdate)
->first();
if(isset($bus))
$a_exist = \App\BusAttendance::where('enrollmentNo','=',$var->ecNo)
->where('idSchool','=',$var->idSchool)
->whereDate('created_on','=',$jdate)
->where('isAutomatic','=','M')
->first();
else
$a_exist = \App\Attendance::where('Enrollment_Number','=',$var->ecNo)
->where('idSchool','=',$var->idSchool)
->whereDate('date','=',$jdate)
->where('idType','=','M')
->first();
?>
<td>
<?php if($tdate->dayOfWeek == '0'): ?>
<span></span>
<?php elseif($v!=null): ?>
<span></span>
<?php elseif($indiv!=null): ?>
<span></span>
<?php elseif($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
if(isset($bus))
$tp = \App\BusAttendance::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
->where('create_month','=',$month->idMonth)
->where('enrollmentNo','=',$var->ecNo)
->where('isAutomatic','=','M')
->get();
else
$tp = \App\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="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('<option value="">--Select--</option>');
$.each(data, function(key, value) {
$('#idSection').append('<option value="'+key+'">'+value+'</option>');
});
}
});
}else{
$('select[name="idSection"]').empty();
}
});
var cur_class = $('select[name="idClass"]').val();
if (cur_class) {
$.ajax({
url: "<?php echo e(url('/school/class')); ?>"+'/' +cur_class + "/sections",
type: "GET",
dataType: "json",
success:function(data) {
$('#idSection').empty();
$('#idSection').append('<option value="">--Select--</option>');
$.each(data, function(key, value) {
$('#idSection').append('<option value="'+key+'">'+value+'</option>');
});
}
});
}
jQuery(document).ready(function() {
setTimeout(function() {
var j = $('#testsec').val();
console.log(j);
$('select[name="idSection"] option[value="' + j + '"]').attr("selected","selected");
}, 1000);
});
// $('select[name="idSection"]').on('change', function() {
// var monthID = $( "#idMonth option:selected" ).val();
// var sectionID = $( "#idSection option:selected" ).val();
// if(sectionID) {
// $.ajax({
// url: "<?php echo e(url('/school/section')); ?>"+'/' +monthID+'/'+sectionID + "/attendance",
// type: "GET",
// dataType: "json",
// success:function(data) {
// $('#attendanceTable').empty();
// $('#attendanceTable').append('<table class="table"><thead><th>EC No.</th><th>Name</th></thead><tbody id="tbody"></tbody></table>');
// $.each(data, function(key, value) {
// $('#tbody').append('<tr><td>'+value['ecNo']+'</td><td>'+value['firstName']+' '+value['lastName']+'</td>\n\
// <td></td></tr>');
// });
// }
// });
// }
// });
});
//$(document).on('click', '.js-sweetalert', function (e) {
// $.ajaxSetup({
// headers: {
// 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
// }
// });
// e.preventDefault();
// var monthid = $(this).data('monthid');
// var secid = $(this).data('sectionid');
// swal({
// title: "Are you sure?",
// text: "Are You sure you want to send message to all absent students!",
// type: "warning",
// showCancelButton: true,
// confirmButtonColor: "#DD6B55",
// confirmButtonText: "Yes, Send it!",
// closeOnConfirm: true
// },
// function() {
// // console.log('here');
// $.ajax({
// type: "GET",
// url: "<?php echo e(url('/school/smstoabsent/')); ?>" +"/"+monthid+'/'+secid,
// data: {monthid:monthid,secid:secid}
//
// })
// .done(function(data) {
// swal({
// title: "Success",
// text: "SMS has been sent successfully",
// type: "success"
// },function() {
// location.reload();
// });
// })
// .error(function(data) {
// swal("Oops", "We couldn't connect to the server!", "error");
// });
// return false;
// });
//});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -