IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/teachers/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/teachers/view_attendance.blade.php

@extends('teachers.teacher_layout')
@section('content')
<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" data-toggle="tab" href="#home">DAY</a></li>
                        <li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#profile">Month</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 role="tabpanel" class="tab-pane" id="home"> <b></b>
                            <p>
                            <div class="body table-responsive">
                                {!! Form::open(['method' => 'GET',  'action' => ['Teacher\ViewOnlyController@viewAttendance'], 'class' => 'form-horizontal']) !!}
                                <div class="row clearfix">
                                    <div class="col-sm-1 form-control-label">
                                        <label for="classname">Filter By </label>
                                    </div>
                                    <div class="col-sm-3">
                                        <div class="form-group">
                                            <input type="date" name="attendance_date" class="form-control" value="@if(isset($_GET['attendance_date'])){{$_GET['attendance_date']}}@endif"/>
                                        </div>
                                    </div>
                                    <div class="col-sm-3 form-control-label">
                                        {!! Form::submit('View',['class' => 'btn btn-raised btn-primary btn-round waves-effect','id'=>'submit-btn']) !!}
                                        {!! Form::close() !!}
                                    </div>
                                </div>
                                
                                
                                <table class="table table-bordered" style="margin-top:10px;">
                                    <thead>
                                        <tr>
                                            <th>Employee Name</th>
                                            <th>Attendance Date</th>
                                            <th>Attendance</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>{{$teacher->firstName}} {{$teacher->middleName}} {{$teacher->lastName}}</td>
                                            <?php 
                                                $tdate = Carbon\Carbon::parse(today_date())->format('Y-m-d');
                                                if(isset($_GET['attendance_date'])){
                                                    $tdate = Carbon\Carbon::parse($_GET['attendance_date'])->format('Y-m-d');
                                                }
                                            ?>
                                            <td>{{Carbon\Carbon::parse($tdate)->format('d-m-Y')}}</td>
                                            <td>
                                                <?php 
                                                $intime = \App\EmpAttendance::where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                        ->where('Device_ID','=',$school->Device_ID)
                                                        ->whereDate('date','=',$tdate)
                                                        ->where('status','=','IN')
                                                        ->where('idType','=','A')
                                                        ->first();
                                                $outtime = \App\EmpAttendance::where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                        ->where('Device_ID','=',$school->Device_ID)
                                                        ->whereDate('date','=',$tdate)
                                                        ->where('status','=','OUT')
                                                        ->where('idType','=','A')
                                                        ->first();
                                                $mat =   \App\EmpAttendance::where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                        ->where('idSchool','=',$school->idSchool)
                                                        ->whereDate('date','=',$tdate)
                                                        ->where('idType','=','M')
                                                        ->first();
                                                $leave = DB::table('employee_leaves')->where('idEmployee', '=', $teacher->idEmployee)
                                                        ->whereDate('leave_date', '<=', $tdate)
                                                        ->whereDate('leave_date', '>=', $tdate)
                                                        ->first();
                                                ?>
                                                @if($intime || $outtime)
                                                <span style="color:green;font-weight:bold">P</span><br>

                                                @if($intime)
                                                <span style="color:green;font-weight: bold">IN: {{$intime->TimeStamp->format('h:i:s')}}</span><br>
                                                @endif
                                                @if($outtime)
                                                <span>OUT: {{$outtime->TimeStamp->format('h:i:s')}}</span>
                                                @endif
                                                @elseif($mat)
                                                <span style="color:green;font-weight:bold">P</span>
                                                @elseif($leave)
                                                <span style="color:green;font-weight:bold">L</span>
                                                @else
                                                <span style="color:red;font-weight:bold">A</span>
                                                @endif
                                            </td>
                                        </tr>
                                    </tbody>
                                    
                                </table>
                            </div>
                            </p>
                        </div>
                        <div role="tabpanel" class="tab-pane  in active" id="profile"> <b></b>
                            <div class="body table-responsive">
                                {!! Form::open(['method' => 'GET',  'action' => ['Teacher\ViewOnlyController@viewAttendance'], 'class' => 'form-horizontal']) !!}
                                <div class="row clearfix">
                                    <div class="col-sm-1 form-control-label">
                                        <label for="classname">Filter By </label>
                                    </div>
                                    <div class="col-sm-3">
                                        <div class="form-group">
                                        {!! Form::select('month',getMonths(),null,['class' => 'form-control show-tick ms','required'=>'required']) !!}
                                        </div>
                                    </div>
                                    <div class="col-sm-3">
                                        <div class="form-group">
                                        {!! Form::select('year',['2024' => '2024','2025' => '2025','2023' => '2023','2022' => '2022'],null,['class' => 'form-control show-tick ms','required'=>'required']) !!}
                                        </div>
                                    </div>
                                    <div class="col-sm-3 form-control-label">
                                        {!! Form::submit('View',['class' => 'btn btn-raised btn-primary btn-round waves-effect','id'=>'submit-btn']) !!}
                                        {!! Form::close() !!}
                                    </div>
                                </div>
                                <table class="table table-bordered" style="margin-top:10px;">
                                    <thead>
                                        <tr>

                                            <?php
                                            $noOfdays = $month->noOfDays;
                                            $now = Carbon\Carbon::now();
                                            $m = $now->month;
                                            if(isset($_GET['month'])){
                                                $m = $_GET['month'];
                                            }
                                            $y = $now->year;
                                            if(isset($_GET['year'])){
                                                $y = $_GET['year'];
                                            }
                                            ?>
                                            <th>EC No.</th>
                                            <th>Name</th>
                                            @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', '=', $school->idSchool)
                                                    ->whereDate('fromDate', '<=', $jdate)
                                                    ->whereDate('toDate', '>=', $jdate)
                                                    ->first();
                                            ?>
                                            @if($tdate->dayOfWeek == '0')
                                            <td> <span style="color:green; font-weight: bold;">{{$i}} <br>
                                                    SUNDAY</span></td>
                                            @elseif($v!=null)
                                            <td><span style="color:green; font-weight: bold;">{{$i}} <br>
                                                    {{$v->holidayName}}</span></td>
                                            @else
                                            <td>{{$i . '-' . $m}}</td>
                                            @endif
                                            @endfor
                                            <th>TP  </th>
                                            <th>TA  </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>

                                            <td>{{$teacher->enrollmentNo}}</td>
                                            <td>{{$teacher->firstName}} {{$teacher->middleName}} {{$teacher->lastName}}</td>
                                            @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', '=', $teacher->idSchool)
                                                    ->whereDate('fromDate', '<=', $jdate)
                                                    ->whereDate('toDate', '>=', $jdate)
                                                    ->first();
                                            $aintime = \App\EmpAttendance::where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                        ->where('Device_ID','=',$school->Device_ID)
                                                        ->whereDate('date','=',$jdate)
                                                        ->where('status','=','IN')
                                                        ->where('idType','=','A')
                                                        ->first();
                                            $aouttime = \App\EmpAttendance::where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                        ->where('Device_ID','=',$school->Device_ID)
                                                        ->whereDate('date','=',$jdate)
                                                        ->where('status','=','OUT')
                                                        ->where('idType','=','A')
                                                        ->first();
                                            $a_mat =   \App\EmpAttendance::where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                        ->where('idSchool','=',$school->idSchool)
                                                        ->whereDate('date','=',$jdate)
                                                        ->where('idType','=','M')
                                                        ->first();
                                            $empleave = DB::table('employee_leaves')->where('idEmployee', '=', $teacher->idEmployee)
                                                        ->whereDate('leave_date', '<=', $tdate)
                                                        ->whereDate('leave_date', '>=', $tdate)
                                                        ->first();
                                            ?>
                                            <td>
                                                @if($tdate->dayOfWeek == '0')
                                                <span></span>
                                                @elseif($v!=null)
                                                <span></span>
                                                @elseif($aintime || $aouttime)
                                                <span style="color:green;font-weight:bold">P</span><br>

                                                @if($aintime)
                                                <span style="color:green;font-weight: bold">IN: {{$aintime->TimeStamp->format('h:i:s')}}</span><br>
                                                @endif
                                                @if($aouttime)
                                                <span>OUT: {{$aouttime->TimeStamp->format('h:i:s')}}</span>
                                                @endif
                                                @elseif($a_mat)
                                                <span style="color:green;font-weight:bold">P</span>
                                                @elseif($empleave)
                                                <span style="color:green;font-weight:bold">L</span>
                                                @else
                                                <span style="color:red;font-weight:bold">A</span>
                                                @endif
                                            </td>


                                            @endfor
                                            <td>
                                            <?php $tpa = \App\EmpAttendance::where('idSchool', '=', $school->idSchool)
                                                    ->where('idMonth','=',$month->idMonth)
                                                    ->where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                    ->where('idType','=','M')
                                                    ->get();
                                                $tpm = \App\EmpAttendance::where('idSchool', '=', $school->idSchool)
                                                    ->where('idMonth','=',$month->idMonth)
                                                    ->where('Enrollment_Number','=',$teacher->enrollmentNo)
                                                    ->where('status','=','IN')
                                                    ->where('idType','=','A')
                                                    ->get();
                                            $total_present = $tpa->count() + $tpm->count();
                                            ?>
                                                {{$total_present }}
                                            </td>
                                <td>{{$ta = $month->noOfDays - $total_present}}</td>
                                        </tr>
                                    </tbody>

                                </table>
                            </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">
                                    <div id="m_donut_chart" class="dashboard-donut-chart"></div>
                                </div>
                            </div>               
            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@stop

Copyright © 2021 - 2025 IMMREX7