IMMREX7

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

@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>List Of Students Having Transport</strong></h2>
            </div>
            <div class="body table-responsive">
                
                {!! Form::open(['method' => 'GET',  'action' => ['School\StudentTransportController@index'], 'class' => 'form-horizontal']) !!}
                <div class="row clearfix">
                    <div class="col-sm-2"></div>
                    <div class="col-sm-2 form-control-label">
                        <label for="classname">Financial Year</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                           {!! Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']) !!}
                        </div>
                    </div>
                    <div class="col-sm-2">
                        {!! Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                    </div>
                </div>
                {!! Form::close() !!} 
                <br>
                
                <table class="table table-bordered table-striped table-hover js-route dataTable">
                    <thead>
                        <tr>
                            <th>S. No.</th>
                            <th>EC No.</th>
                            <th>Name</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>Route Name</th>
                            <th>Stop Name</th>
                            <th>Bus No</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        @foreach($stdtransport as $value)
                        @if(isset($value->student))
                        <tr>
                            <th scope="row">{{$i}}</th>
                            <td>{{$value->student->ecNo}}</td>
                            <td>{{$value->student->firstName}} {{$value->student->middleName}} {{$value->student->lastName}}</td>
                            <td>{{$value->student->classM->className}}</td>
                            <td>{{$value->student->section->sectionName}}</td>
                            <td>{{$value->route->routeName}}</td>
                            <td>{{$value->stop->stopName or ''}}</td>
                            @php
                            if($value->idBus != null)
                            $buses = DB::table('buses')->where('idBus','=',$value->idBus)->first();
                            else
                            $buses = DB::table('busroutes')->join('buses','busroutes.idBus','=','buses.idBus')->where('idRoute','=',$value->idRoute)->first();
                            @endphp
                            <td>@if(isset($buses->busNo)) {{$buses->busNo}}  @endif</td>
                            <td>
                                <a href='{{url('/school/stdtransport/'.$value->idStdTransport.'/edit')}}'  class="btn btn-raised btn-info waves-effect btn-round"><i class="fa fa-edit"></i>Edit</a>
                                <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="{{$value->idStdTransport}}" data-type="confirm">DELETE</button>
                            </td>
                        </tr>
                        <?php $i++; ?>
                        @endif
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@stop
@section('script')
<script>
    $(function(){
        $('.js-route').DataTable({
            dom: 'Bfrtip',
            scrollY:        "500px",
            scrollX:        true,
            scrollCollapse: true,
            fixedColumns:   {
                left: 1
            },
            buttons: [
                { extend: 'csv', text: 'Export to Excel',title:'Student Transport List',
                    exportOptions: {
                        columns: [0,1,2,3,4,5,6,7]
                    }
                }
            ]
        });
    });

    $(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');
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to remove this student from Transport Service!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "{{url('/school/stdtransport/')}}" +"/"+id,
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Student  has been successfully removed from Transport Service", 
                    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