IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/hostel/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/hostel/monthly_attendance.blade.php

@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
    <div class="col-lg-12 col-md-12 col-sm-12">
        <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\Hostel\AttendanceController@getMonthlyAttendance'], 'class' => 'form-horizontal']) !!}

                                    <div class="row clearfix">
                                        <div class="col-sm-4">
                                            <div class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">Class</label>
                                                </div>
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        <div style="border:1px solid #ccc; width:250px; height: 150px; overflow-y: scroll;">
                                                            @foreach($classes as $key=>$value)
                                                            <div class="checkbox-inline" style="padding-left:10px;padding-top:5px;">
                                                                <input type="checkbox" name="classes[]" value="{{$key}}" class="class_ids">
                                                                <label>{{$value}}</label>
                                                            </div>
                                                            @endforeach
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">Section</label>
                                                </div>
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        <div id="idSection" style="border:1px solid #ccc; width:250px; height: 150px; overflow-y: scroll;">

                                                        </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="idStudent" style="border:1px solid #ccc; width:250px; 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-1 form-control-label required">
                                            <label for="classname">Month</label>
                                        </div>
                                        <div class="col-sm-2">
                                            <div class="form-group">
                                                {!! Form::select('idMonth',getMonths(),$current_month->idMonth,['class' => 'form-control show-tick ms']) !!}
                                                @if ($errors->has('idMonth'))
                                                <label id="minmaxlength-error" class="error" for="minmaxlength">
                                                    <strong>{{ $errors->first('idMonth') }}</strong>
                                                </label>
                                                @endif
                                            </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 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="#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>  <div class="header"><h2><strong>Attandance Report (MONTHLY)</strong></h2></div>
                        <div class="body table-responsive">
                            @if(isset($month))
                            @if(count($students)>0)
                            <table class="table table-bordered table-striped table-hover dataTable tableexp">
                                <thead>
                                    <tr>
                                        <th>EC No.</th>
                                        <th>Name</th>
                                        @foreach($days as $key=>$var)
                                        <th>
                                            @if($var[1] == 'SUNDAY')
                                            <span style="color:green; font-weight: bold;">{{$var[0]}} <br>
                                                    SUNDAY</span>
                                            @elseif($var[1]!=null && $var[1]!='SUNDAY')
                                            <span style="color:green; font-weight: bold;">{{$var[0]}} <br>
                                                    {{$var[1]}}</span>
                                            @else
                                            {{$var[0]}}
                                            @endif
                                        </th>
                                        @endforeach
                                       
                                        <th>TP  </th>
                                        <th>TA  </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach($students as $std)
                                    <tr>
                                        
                                        <td>{{$std->ecNo}}</td>
                                        <td>{{$std->firstName}} {{$std->middleName}} {{$std->lastName}}</td>
                                        @foreach($days as $key=>$var)
                                            <td>
                                               
                                                
                                                 <?php
                                                   $tdate = Carbon\Carbon::parse($var[0]);
                                                   $now = Carbon\Carbon::now();
                                                   $jdate = $tdate->format('Y-m-d');
                                                   $length = $tdate->diffInDays($now);
                                                   
                                                    $aintime = \App\Attendance::where('Enrollment_Number', '=', $std->ecNo)
                                                            ->where('Device_ID', '=', $school->Device_ID)
                                                            ->whereDate('date', '=', $jdate)
                                                            ->where('status', '=', 'IN')
                                                            ->where('idType', '=', 'A')
                                                            ->first();
                                                    $aouttime = \App\Attendance::where('Enrollment_Number', '=', $std->ecNo)
                                                            ->where('Device_ID', '=', $school->Device_ID)
                                                            ->whereDate('date', '=', $jdate)
                                                            ->where('status', '=', 'OUT')
                                                            ->where('idType', '=', 'A')
                                                            ->first();
                                                    $a_mat = \App\Attendance::where('Enrollment_Number', '=', $std->ecNo)
                                                            ->where('idSchool', '=', $school->idSchool)
                                                            ->whereDate('date', '=', $jdate)
                                                            ->where('idType', '=', 'M')
                                                            ->first();
 
                                                   ?>
                                                   @if($var[1] == 'SUNDAY')
                                                    <span></span>
                                                    @elseif($var[1]!=null && $var[1]!='SUNDAY')
                                                    <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 style="color:red;font-weight: bold">OUT: {{$aouttime->TimeStamp->format('h:i:s')}}</span>
                                                    @endif
                                                    @elseif($a_mat)
                                                    <span style="color:green;font-weight:bold">P</span>
                                                    @elseif($jdate <= $todaydate)
                                                    <span style="color:red;font-weight:bold">A</span>
                                                    @else
                                                    <span style="color:red;font-weight:bold"></span>
                                                   @endif
                                            </td>
                                        @endforeach 
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    @endforeach
                                </tbody>

                            </table>
                            @else
                            <p style="color:red;"><strong>To get Attendance Report please go to 'Advance Search' and select Class and Section.</strong></p>
                            @endif
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@stop
@section('script')
<script>
$(document).on('click', '.class_ids', function(){
    //var checkAll = this.checked;
    var classIds = [];
    $("input:checkbox[name='classes[]']:checked").each(function () {
        classIds.push($(this).val());
    });
    if (classIds.length > 0) {
        $.ajax({
                url: "{{url('/school/schclass') }}" + '/' + classIds + "/sections",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('#idSection').empty();
                    $('#idSection').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><input type="checkbox" class="select-all" id="selectall"><label><strong>Select All</label></strong></div>');
                    $.each(data, function(key, value) {
                         $('#idSection').append('<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="sections[]" value="' + key + '" class="sectionclass"><label>' + value + '</label></div>');
                    });
                }
            });
        }
    });
$(document).on('click', '.select-all', function(){
    var checkAll = this.checked;
    if (checkAll === true){
        $('.sectionclass').each(function () {
            this.checked = checkAll;
        });
    } else{
        $('.sectionclass').each(function () {
            this.checked = checkAll;
        });
    }
});
$(document).on('click', '.sectionclass', function(){
    var sectionIds = [];
    $("input:checkbox[name='sections[]']:checked").each(function () {
        sectionIds.push($(this).val());
    });
    if (sectionIds.length > 0) {
        $.ajax({
            url: "{{url('/school/sec') }}" + '/' + sectionIds + "/students",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('#idStudent').empty();
                        $('#idStudent').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) {
                             $('#idStudent').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:50px;">' + value + '</label><input type="checkbox" name="students[]" value="' + key + '" class="stdallselect"></div>');
                        });
                    }
        });
    } else{
            $('#idStudent').empty();
        }
 });
$(document).on('click', '.select-allstd', function(){
        var checkAllstd = this.checked;
            if (checkAllstd === true){
                $("input:checkbox[name='students[]']").each(function () {
                    this.checked = checkAllstd;
                });
            } else{
                $('.stdallselect').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 - 2025 IMMREX7