IMMREX7
@extends('schools.school_layout')
@section('content')
<style>
.modal-backdrop{
position: relative !important;
}
</style>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12">
<!--<div class="card">-->
<div class="body">
<button class="btn btn-raised btn-warning btn-round waves-effect" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">Advance Search</button>
<div class="collapse" id="collapseExample">
<div class="well">
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="card">
<div class="header">
<h2><strong>Advance Search</strong></h2>
</div>
<div class="body">
{!! Form::open(['method' => 'GET', 'action' => ['School\EmpAttendanceController@index'], 'class' => 'form-horizontal']) !!}
<div class="row clearfix">
<div class="col-sm-4">
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">Departments</label>
</div>
<div class="col-sm-7">
<div class="form-group">
{!! Form::select('idDepartment',$departments,null,['class' => 'form-control show-tick ms']) !!}
@if ($errors->has('idDepartment'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('idDepartment') }}</strong>
</label>
@endif
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">Designation</label>
</div>
<div class="col-sm-7">
<div class="form-group">
<div id="idDesignation" style="border:1px solid #ccc; width:200px; height: 150px; overflow-y: scroll;">
<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-all" id="selectall"></div>
@foreach ($designation as $key =>$value)
<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:100px;">{{$value}}</label><input type="checkbox" name="designations[]" value="{{$key}}" class="designationclass"></div>
@endforeach
</div>
<!--<select name='idSection' id="idSection" class="form-control show-tick ms"></select>-->
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row clearfix">
<div class="col-sm-3 form-control-label">
<label for="classname">EC No.</label>
</div>
<div class="col-sm-7">
<div class="form-group">
<div id="idEmployee" style="border:1px solid #ccc; width:200px; height: 150px; overflow-y: scroll;">
</div>
<!--<select name='idSection' id="idSection" class="form-control show-tick ms"></select>-->
</div>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label">
<label for="classname">Select Date</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('date',null,['class' => 'form-control dateselector']) !!}
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
{!! Form::submit('SHOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--</div>-->
</div>
</div>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="card">
<div class="body">
<div class="body">
<!-- Nav tabs -->
<!-- <ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#home">DAY</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#messages">All Time</a></li>
</ul> -->
<!-- Tab panes -->
<div class="tab-content">
<div> <div class="header"> <h2><strong>Employee Attandance Report (Today)</strong></h2></div>
<div class="body table-responsive">
@if(count($employees)>0)
<div id="aniimated-thumbnials">
<table class="table table-bordered table-striped table-hover dataTable tableexp">
<thead>
<tr>
<th>Date</th>
<th>Enrollment No</th>
<th>Name</th>
<th>Department</th>
<th>Designation</th>
<th>Attendance</th>
@if(auth()->guard('school')->user()->idSchool == 195 || auth()->guard('school')->user()->idSchool == 163)
<th>Photo (IN)</th>
<th>Location (IN)</th>
<th>Photo (OUT)</th>
<th>Location (OUT)</th>
@endif
</tr>
</thead>
<tbody>
<?php
$school = \App\School::where('idSchool', '=', auth()->guard('school')->user()->idSchool)->first();
$total_present = 0;
$total_absent = 0;
?>
@foreach($employees as $var)
<tr>
<td>{{$tdate}}</td>
<td>{{$var->enrollmentNo}}</td>
<td>{{$var->firstName}} {{$var->middleName}} {{$var->lastName}}</td>
<td>{{$var->department->departmentName}}</td>
<td>{{$var->designation->designationName}}</td>
<td>
@php $cdate = \Carbon\Carbon::parse($tdate); @endphp
@if($school->idCountry == 1)
@if(count($var->attandance) == 0)
<span style="color:red;font-weight: bold">A</span>
<?php $total_absent = $total_absent + 1; ?>
@else
@foreach($var->attandance as $det)
@if($det->status == 'IN')
<span style="color:green;font-weight:bold">P</span>
<?php $total_present = $total_present + 1; ?>
@endif
@if($det->idType == 'M')
<span style="color:green;font-weight:bold">P</span>
<?php $total_present = $total_present + 1; ?>
@endif
@if($det->status == 'IN')
<span style="color:green;font-weight: bold">IN: {{explode(" ",$det->TimeStamp)[1]}}</span>
@endif
@if($det->status == 'OUT')
<span style="color:red;font-weight: bold">OUT: {{explode(" ",$det->TimeStamp)[1]}}</span>
@endif
@endforeach
@endif
@else
@if($cdate->dayOfWeek == '5')
<span style="color:green;font-weight:bold">FRIDAY</span>
<?php $total_present = $total_present + 1; ?>
@else
@if(count($var->attandance) == 0)
<span style="color:red;font-weight: bold">A</span>
<?php $total_absent = $total_absent + 1; ?>
@else
@foreach($var->attandance as $det)
@if($det->status == 'IN')
<span style="color:green;font-weight:bold">P</span>
<?php $total_present = $total_present + 1; ?>
@endif
@if($det->idType == 'M')
<span style="color:green;font-weight:bold">P</span>
<?php $total_present = $total_present + 1; ?>
@endif
@if($det->status == 'IN')
<span style="color:green;font-weight: bold">IN: {{explode(" ",$det->TimeStamp)[1]}}</span>
@endif
@if($det->status == 'OUT')
<span style="color:red;font-weight: bold">OUT: {{explode(" ",$det->TimeStamp)[1]}}</span>
@endif
@endforeach
@endif
@endif
@endif
</td>
@if(auth()->guard('school')->user()->idSchool == 195 || auth()->guard('school')->user()->idSchool == 163)
@php $aintime = \App\EmpAttendance::where('Enrollment_Number', '=', $var->enrollmentNo)
->where('Device_ID', '=', $school->Device_ID)
->whereDate('date', '=', $tdate)
->where('status', '=', 'IN')
->where('idType', '=', 'A')
->orderBy('ID','DESC')
->first();
$aouttime = \App\EmpAttendance::where('Enrollment_Number', '=', $var->enrollmentNo)
->where('Device_ID', '=', $school->Device_ID)
->whereDate('date', '=', $tdate)
->where('status', '=', 'OUT')
->where('idType', '=', 'A')
->orderBy('ID','DESC')
->first();
@endphp
<td>
@if($aintime != null)
@if(isset($aintime->photo))
<a href="{{$aintime->photo}}">
<img src="{{$aintime->photo}}" width="80" height="80"/> </a> @endif
@endif
</td>
<td>
@if($aintime != null)
<button type="button" class="btn btn-default" onclick="openMap('{{ $aintime->latitude }}','{{ $aintime->longitude }}')">View Location</button> @endif
</td>
<td>
@if($aouttime != null)
@if(isset($aouttime->photo))
<a href="{{$aouttime->photo}}">
<img src="{{$aouttime->photo}}" width="80" height="80"/> </a> @endif
@endif
</td>
<td>
@if($aouttime != null)
<button type="button" class="btn btn-default" onclick="openMap('{{ $aouttime->latitude }}','{{ $aouttime->longitude }}')">View Location</button> @endif
</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>Total Employee: {{$employees->count()}}</th>
<th colspan="3">Total Present : {{$total_present}} , Total Absent : {{$total_absent}}</th>
</tr>
</tfoot>
</table>
</div>
@else
<p style="color:red;"><strong>To get Attendance Report please go to 'Advance Search' and select Date.</strong></p>
@endif
</div>
</div>
<div role="tabpanel" class="tab-pane" id="messages"> <b></b>
<div class="col-md-12 col-lg-12">
<div class="card">
<div class="header">
<h2><strong>Attendance</strong></h2>
</div>
<div class="body">
<canvas id="bar_chart" height="150"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="defaultModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="title" id="defaultModalLabel">Employee Location</h4>
</div>
<div class="modal-body">
<div id="map" style="height: 300px;"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
@stop
@section('script')
<script>
(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
key: "AIzaSyA-e05D-p1SyTgAKH9_8yxyjjzJrAa-AcE",
v: "weekly",
// Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
// Add other bootstrap parameters as needed, using camel case.
});
let marker;
let map;
async function initMap() {
// Request needed libraries.
const { Map } = await google.maps.importLibrary("maps");
map = new Map(document.getElementById("map"), {
center: { lat: 28.7041, lng: 77.1025 },
zoom: 14,
mapId: "4504f8b37365c3d0",
});
}
initMap();
function openMap(lat,lng){
// Clear any existing marker
if (marker) {
marker.setMap(null);
}
const newLocation = { lat: parseFloat(lat), lng: parseFloat(lng) };
marker = new google.maps.Marker({
position: newLocation,
map: map,
});
// Center the map on the new marker
map.setCenter(newLocation);
$('#defaultModal').modal('show');
}
$('.dateselector').datepicker({
autoclose: true,
autoWidth: false,
format: 'dd-mm-yyyy',
endDate: '+0d',
orientation: 'auto'
});
$(document).ready(function() {
$('#aniimated-thumbnials').lightGallery({
thumbnail: true,
selector: 'a'
});
$('select[name="idDepartment"]').on('change', function() {
var departmentID = $(this).val();
if(departmentID) {
$.ajax({
url: "{{url('/school/departments') }}"+'/' +departmentID + "/designations",
type: "GET",
dataType: "json",
success:function(data) {
$('#idDesignation').empty();
$('#idDesignation').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-all" id="selectall"></div>');
$.each(data, function(key, value) {
$('#idDesignation').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:100px;">'+value+'</label><input type="checkbox" name="designations[]" value="'+key+'" class="designationclass"></div>');
});
}
});
}else{
$('select[name="idDesignation"]').empty();
}
});
});
$(document).on('click', '.select-all', function(){
var checkAll = this.checked;
if(checkAll === true){
$('input[type=checkbox]').each(function () {
this.checked = checkAll;
});
var designationIds = [];
$("input:checkbox[name='designations[]']:checked").each(function () {
designationIds.push($(this).val());
});
if (designationIds.length > 0) {
$.ajax({
url: "{{url('/school/designations') }}"+'/' +designationIds + "/employees",
type: "GET",
dataType: "json",
success:function(data) {
$('#idEmployee').empty();
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-allstd" id="selectallstd"></div>');
$.each(data, function(key, value) {
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:50px;">'+value+'</label><input type="checkbox" name="employees[]" value="'+key+'" class="empallselect"></div>');
});
}
});
}
}else{
$('#idEmployee').empty();
$('input[type=checkbox]').each(function () {
this.checked = checkAll;
});
}
});
$(document).on('click', '.designationclass', function(){
var designationIds = [];
$("input:checkbox[name='designations[]']:checked").each(function () {
designationIds.push($(this).val());
});
if (designationIds.length > 0) {
$.ajax({
url: "{{url('/school/designations') }}"+'/' +designationIds + "/employees",
type: "GET",
dataType: "json",
success:function(data) {
$('#idEmployee').empty();
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-allstd" id="selectallstd"></div>');
$.each(data, function(key, value) {
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:50px;">'+value+'</label><input type="checkbox" name="employees[]" value="'+key+'" class="empallselect"></div>');
});
}
});
}else{
$('#idEmployee').empty();
}
});
$(document).on('click', '.select-allstd', function(){
var checkAllstd = this.checked;
if(checkAllstd === true){
$("input:checkbox[name='employees[]']").each(function () {
this.checked = checkAllstd;
});
}else{
$('.empallselect').each(function () {
this.checked = checkAllstd;
});
}
});
$(function () {
$('.tableexp').DataTable({
'lengthMenu': [[25, 50, 100, - 1], [25, 50, 100, "All"]],
dom: 'Bfrtip',
scrollY: "500px",
scrollX: true,
scrollCollapse: true,
fixedColumns: {
left: 1
},
buttons: [
'csv', 'excel', 'pdf', 'print'
]
});
});
</script>
@stop
Copyright © 2021 -