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 echo Form::open(['method' => 'GET', 'action' => ['School\EmpAttendanceController@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']); ?>
<?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">Department </label>
</div>
<div class="col-sm-2">
<div class="form-group">
<?php echo Form::select('idDepartment',$departments,null,['class' => 'form-control show-tick ms']); ?>
<?php if($errors->has('idDepartment')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idDepartment')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-1 form-control-label">
<label for="classname">Designation</label>
<?php if(isset($_GET['idDesignation'])){
$sec = $_GET['idDesignation'];
echo '<input type="hidden" value='.$sec.' id="testsec">'; }?>
</div>
<div class="col-sm-2">
<div class="form-group">
<select id='idDesignation' name='idDesignation' class="form-control show-tick ms"></select>
<?php if($errors->has('idDesignation')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idDesignation')); ?></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/empattendance', 'class' => 'form-horizontal']); ?>
<div style="float:right;">
<?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-success btn-round waves-effect']); ?>
<!--<button class="btn btn-raised btn-danger btn-round waves-effect js-sweetalert" data-monthid="<?php echo e($month->idMonth); ?>" data-sectionid ='<?php echo e($sec); ?>' data-type="confirm">SEND SMS TO ABSENT STUDENTS</button>-->
<!--<a href="<?php echo e(url('/school/smstoabsent/'.$month->idMonth.'/'.$sec.'/')); ?>" class="js-sweetalert btn btn-raised btn-danger btn-round waves-effect">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">
<thead>
<tr>
<?php $noOfdays = $month->noOfDays;
$now = Carbon\Carbon::now();
$m = $now->month;
$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)
->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 else: ?>
<td><?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 else: ?>
<td><?php echo e($i); ?></td>
<?php endif; ?>
<?php endif; ?>
<?php endfor; ?>
<th>TP</th>
<th>TA</th>
</tr>
</thead>
<tbody>
<?php if(count($employees)>0): ?>
<?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($var->enrollmentNo); ?></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)
->whereDate('fromDate', '<=', $jdate)
->whereDate('toDate', '>=', $jdate)
->first();
$intime_exist = \App\EmpAttendance::where('Enrollment_Number','=',$var->enrollmentNo)
->where('idSchool','=',$var->idSchool)
->whereDate('date','=',$jdate)
->where('status','=','IN')
->first();
if($intime_exist !=null){
$intime = $intime_exist->TimeStamp->format('H:i');
}
$outtime_exist = \App\EmpAttendance::where('Enrollment_Number','=',$var->enrollmentNo)
->where('idSchool','=',$var->idSchool)
->whereDate('date','=',$jdate)
->where('status','=','OUT')
->first();
if($outtime_exist !=null){
$outtime = $outtime_exist->TimeStamp->format('H:i');
}
?>
<td class="demo-masked-input" width='200px;'>
<?php if($tdate->dayOfWeek == '0'): ?>
<span></span>
<?php elseif($v!=null): ?>
<span></span>
<?php elseif($intime_exist !=null && $outtime_exist!=null): ?>
<input type="text" name='employees[<?php echo e($var->enrollmentNo); ?>][<?php echo e($dt); ?>][inTime]' value="<?php echo e($intime); ?>">
<input type="text" name='employees[<?php echo e($var->enrollmentNo); ?>][<?php echo e($dt); ?>][outTime]' value="<?php echo e($outtime); ?>">
<?php else: ?>
<!--<input type="checkbox" name='employees[<?php echo e($dt); ?>][]' value="<?php echo e($var->enrollmentNo); ?>">-->
<div class="form-group"> <input type="text" name='employees[<?php echo e($var->enrollmentNo); ?>][<?php echo e($dt); ?>][inTime]' class="time24" placeholder="In Time"></div>
<br><div class="form-group"><input type="text" name='employees[<?php echo e($var->enrollmentNo); ?>][<?php echo e($dt); ?>][outTime]' class="time24" placeholder="Out Time"></div>
<?php endif; ?>
</td>
<?php endfor; ?>
<td>
<?php $tp = \App\EmpAttendance::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
->where('idMonth','=',$month->idMonth)
->where('Enrollment_Number','=',$var->enrollmentNo)
->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>
$(document).ready(function() {
$('select[name="idDepartment"]').on('change', function() {
var deptID = $(this).val();
if(deptID) {
$.ajax({
url: "<?php echo e(url('/school/departments')); ?>"+'/' +deptID + "/designations",
type: "GET",
dataType: "json",
success:function(data) {
$('#idDesignation').empty();
$('#idDesignation').append('<option value="">--Select--</option>');
$.each(data, function(key, value) {
$('#idDesignation').append('<option value="'+key+'">'+value+'</option>');
});
}
});
}else{
$('select[name="idDesignation"]').empty();
}
});
var cur_dept = $('select[name="idDepartment"]').val();
if (cur_dept) {
$.ajax({
url: "<?php echo e(url('/school/departments')); ?>"+'/' +cur_dept + "/designations",
type: "GET",
dataType: "json",
success:function(data) {
$('#idDesignation').empty();
$('#idDesignation').append('<option value="">--Select--</option>');
$.each(data, function(key, value) {
$('#idDesignation').append('<option value="'+key+'">'+value+'</option>');
});
}
});
}
jQuery(document).ready(function() {
setTimeout(function() {
var j = $('#testsec').val();
console.log(j);
$('select[name="idDesignation"] option[value="' + j + '"]').attr("selected","selected");
}, 1000);
});
});
$(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 employees!",
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 -