IMMREX7

aku nok ndi : /home/spdtg/www/gomygps/resources/views/reports/
File Up :
aku nok ndi : /home/spdtg/www/gomygps/resources/views/reports/generate-report.blade.php

@extends('main')
@section('content')
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Generate Report</strong></h2>
            </div>
            <div class="body">
                {!! Form::open(['url' => 'report-generation','method'=>'GET', 'class' => 'form-horizontal']) !!}
                
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Comapny Name</label>
                    </div>
                    <div class="col-sm-3">
                        <input type="hidden" name="type" value="{{$type}}">
                        <div class="form-group">
                            {!! Form::select('idCompany',getCompanies(),null,['class' => 'form-control show-tick ms','required'=>'required']) !!}
                            @if ($errors->has('idCompany'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idCompany') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Branch Name</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::select('idBranch',[],null,['class' => 'form-control show-tick ms','required'=>'required']) !!}
                            @if ($errors->has('idBranch'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idBranch') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Car No</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::select('vehicleNo',['All'=>'All'],null,['class' => 'form-control select2 show-tick ms','required'=>'required']) !!}
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        {!! Form::submit('GENERATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                        {!! Form::close() !!} 
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@if(isset($vehicles))
<div class="row clearfix" id="report_generate_table">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Generating Report Table</strong></h2>
                <p style="color:red;">Note : Please do not reload this page and fetched vehicle details available below</p>
                <button style="float:right;" onclick="getDetails()" class="btn btn-raised btn-primary btn-round waves-effect" id="bt-fetch">Fetch Now</button>
            </div>
            <div class="body">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>S. No.</th>
                    <th>Vehicle Number</th>
                    <th>Fetch Status</th>
                    <th>Fetch Body</th>
                </tr>
                </thead>
                <tbody id="tbody">
        
                </tbody>
            </table>
            </div>
        </div>
    </div>
</div>
@endif
@stop
@section('script')
<script>
$('select[name="idCompany"]').on('change', function() {
    var compID = $(this).val();
    if (compID) {
        $.ajax({
            url: "{{url('/company') }}" + '/' + compID + "/branches",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('select[name="idBranch"]').empty();
                    $('select[name="idBranch"]').append('<option value="">--- Select ---</option>');
                    $.each(data, function(key, value) {
                        $('select[name="idBranch"]').append('<option value="' + key + '">' + value + '</option>');
                    });
                }
        });
    } else{
        $('select[name="idBranch"]').empty();
    }
});
$('select[name="idBranch"]').on('change', function() {
    var branchid = $(this).val();
    if (branchid) {
        $.ajax({
            url: "{{url('/branch') }}" + '/' + branchid + "/vehicles",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('select[name="vehicleNo"]').empty();
                    $('select[name="vehicleNo"]').append('<option value="All">All</option>');
                    $.each(data, function(key, value) {
                        $('select[name="vehicleNo"]').append('<option value="' + key + '">' + value + '</option>');
                    });
                }
        });
    } else{
        $('select[name="vehicleNo"]').empty();
    }
});
@if(isset($vehicles)) 
let vehicles = <?php echo json_encode($vehicles); ?>; 
var currentPos = 0;
function getDetails(){
    var vehicle = vehicles[currentPos];
    $('#bt-fetch').hide();
    $.ajax({
            url: "{{url('/generates') }}" + '/' + vehicle + "/{{$type}}",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    currentPos = currentPos + 1;
                    $('#tbody').append('<tr><td>'+currentPos+'</td><td>'+vehicle+'</td><td>Done</td><td>'+JSON.stringify(data)+'</td></tr>');
                    if(currentPos < vehicles.length - 1)
                    getDetails();
                }
        });
}
getDetails();
@endif
</script>
@stop

Copyright © 2021 - 2025 IMMREX7