IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/virtualcard/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/virtualcard/view.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="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\VirtualViewController@index'], '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 class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">From Date</label>
                                                </div>
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        {!! Form::text('fromDate',null,['class' => 'form-control datepicker']) !!}
                                                    </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 class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">To Date</label>
                                                </div>
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        {!! Form::text('toDate',null,['class' => 'form-control datepicker']) !!}
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                                                               
                                        <div class="col-sm-4">
                                            
                                        </div>
                                    </div>
                                    <div class="row clearfix">
                                        <div class="col-sm-8 offset-sm-2">
                                            {!! Form::submit('Search',['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-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>View Confirmation</strong></h2>
                <a href="/school/virtual-view/create" class="btn btn-raised btn-primary btn-round waves-effect" style="float: right;">Download Photos</a>
            </div>
            <div class="body table-responsive">
                @if (\Session::has('error'))
                        <div class="alert alert-danger">
                            <ul>
                                <li>{!! \Session::get('error') !!}</li>
                            </ul>
                        </div>
                    @endif
                <table class="table table-bordered table-striped table-hover dataTable" id="tableexp">
                    <thead>
                        <tr>
                            <th>S No.</th>
                            <th>Photo</th>
                            <th>Ec No</th>
                            <th>Name</th>
                            <th>Father Name</th>
                            <th>Grade</th>
                            <th>DIV</th>
                            <th>DOB</th>
                            <th>Contact</th>
                            <th>Contact 2</th>
                            <th>Full Address</th>
                            <th>Verified (Parents)</th>
                            <th>Date</th>
                            <th>Verified (Teacher)</th>
                            <th>Date</th>   
                            <th>Action</th>    
                            <th>File</th>                       
                        </tr>
                    </thead>
                    <tbody>
                        <?php $k =0;?>
                        @foreach($virtualCard as $detail)
                        <?php $k++;?>
                        <tr id="#row{{$k}}">
                            <td>{{$k}}</td>
                            @php
                            $student = \App\AdmEntry::select('ecNo')->where('idStudent', '=', $detail->idStudent)->first();
                            @endphp
                            <td>{{$detail->photo}}</td>
                            <td>@if($student != null) {{$student->ecNo}} @endif</td>
                            <td>{{$detail->studentName}}</td>
                            <td>{{$detail->parentName}}</td>

                            <td>{{$detail->className}}</td>
                            <td>{{$detail->sectionName}}</td>

                            <td>@if(isset($detail->student_dob))
                                @php
                                $dob = "";
                                try{
                                $dob = Carbon\Carbon::parse($detail->student_dob)->format('d-m-Y');
                                }catch(\Exception $e){}
                                 @endphp
                            {{$dob}}
                            @endif</td>
                            <td>{{$detail->contactNo}}</td>
                            <td>{{$detail->contact_alternative}}</td>
                            <td>{{$detail->address}}</td>

                            @if($detail->isVerified == 'Y')
                            <td>YES</td>
                            @else
                            <td>No</td>
                            @endif
                            @if(isset($detail->parentDate))
                            <td>{{Carbon\Carbon::parse($detail->parentDate)->format('d-m-Y')}}</td>
                            @else
                            <td></td>
                            @endif
                            @if($detail->isChecked == 'Y')
                            @php $employeename = '';
                            if($detail->firstName != null)
                            $employeename = $employeename.trim($detail->firstName).' ';
                            if($detail->middleName != null)
                            $employeename = $employeename.trim($detail->middleName).' ';
                            if($detail->lastName != null)
                            $employeename = $employeename.trim($detail->lastName).' ';
                            @endphp
                            <td>YES  | {{ $employeename}}</td>
                            @else
                            <td>No</td>
                            @endif
                            @if(isset($detail->verificationDate))
                            <td>{{Carbon\Carbon::parse($detail->verificationDate)->format('d-m-Y')}}</td>
                            @else
                            <td></td>
                            @endif

                            <td>
                            <a href="{{url('/school/virtual-view').'/'.$detail->id.'/edit'}}" class="btn btn-sm btn-warning waves-effect waves-float waves-red" target="_blank"><i class="zmdi zmdi-edit"></i></a>    
                            <a href="#" class="btn btn-sm btn-danger waves-effect waves-float waves-red js-sweetalert" data-id="{{$detail->id}}" data-type="confirm"><i class="zmdi zmdi-delete"></i></a></td>
                            <td>{{$student->ecNo}}-{{ $detail->photo }}</td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@stop
@section('script')
<script>
var table ;
$(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>');
                    });
                }
            });
        }
});
$(function () {
    table = $('#tableexp').DataTable({
        
        dom: 'Bfrtip',
         scrollY:        "500px",
        scrollX:        true,
        scrollCollapse: true,
        fixedColumns:   {
            left: 1
        },
        columnDefs : [
            //hide the second & fourth column
            { 'visible': false, 'targets': [7,9,10,16] }
        ],
        drawCallback: function( settings ) {
            var api = this.api();
            var myData = api.rows( {page:'current'} ).data();
            console.log(myData);
            for (var i = 0; i < myData.length; i++) { 
                var input = myData[i][1];
                if(!input.includes("img")){
                    myData[i][1] = '<img src="https://online-login.online/storage/schools/'+<?php echo Auth::guard('school')->user()->idSchool; ?>+'/students/'+ input+'" height="60"/>';
                    $('#tableexp').DataTable().row(myData[i][0] - 1).data( myData[i] ).draw();
                }
            }
            
        },
        buttons: [
            { extend: 'csv', footer: true, text: 'Export to Excel',title:'Card View Report',
                exportOptions: {
                    columns: [2,3,4,5,6,7,8,9,10,11,16],
                    format: {
                     body: function (data, row, column, node ) {
                                if(column === 2 )
                                return "\0" + data ;
                                else if( column === 5 )
                                return data.replace( '<br>', '\r\n');
                                else return data;
                               
                                }
                            }
                }}
            
        ]
    });
});
$(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', '.js-sweetalert', function (e) {
    $.ajaxSetup({
        headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    e.preventDefault();
    var id = $(this).data('id');
    var deleteRow =  $(this);
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to delete this virtual card !",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "{{url('/school/virtual-view/')}}" +"/"+id,
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Virtual card has been successfully deleted", 
                    type: "success"
                },function() {
                    location.reload();
                });
            })
            .error(function(data) {
              swal("Oops", "We couldn't connect to the server!", "error");
            });
            return false;
    });
});
</script>
@stop

Copyright © 2021 - 2025 IMMREX7