IMMREX7

aku nok ndi : /home/spdtg/www/gomygps/resources/views/master/
File Up :
aku nok ndi : /home/spdtg/www/gomygps/resources/views/master/vehicles.blade.php

@extends('main')
@section('content')
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>@if(isset($vehicle))Edit @else  Add @endif</strong> Vehicle</h2>
            </div>
            <div class="body">
                @if(isset($vehicle))
                {!! Form::model($vehicle, ['method' => 'PATCH', 'action' => ['VehicleController@update', $vehicle->idVehicle],'files'=>true, 'class' => 'form-horizontal']) !!}
                @else
                {!! Form::open(['url' => 'vehicles', 'class' => 'form-horizontal','files'=>true]) !!}
                @endif

                <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">
                        <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">
                            @if(isset($vehicle))
                            {!! Form::select('idBranch',$branches,null,['class' => 'form-control show-tick ms','required'=>'required']) !!}
                            @else
                            {!! Form::select('idBranch',[],null,['class' => 'form-control show-tick ms','required'=>'required']) !!}
                            @endif
                            @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::text('vehicleNo',null,['class' => 'form-control','required'=>'required']) !!}
                        
                        </div>
                    </div>
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Chesis No</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('chesisNo',null,['class' => 'form-control','required'=>'required']) !!}
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label">
                        <label for="classname">Engine No</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('engineNo',null,['class' => 'form-control']) !!}
                        
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        @if(isset($vehicle))
                        {!! Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                        @else
                        {!! Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                        @endif
                        {!! Form::close() !!} 
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>List Of Vehicles</strong></h2>
            </div>
            <div class="body table-responsive">
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable">
                    <thead>
                        <tr>
                            <th>S. No.</th>
                            <th>Company</th>
                            <th>Branch</th>
                            <th>Vehicle No</th>
                            <th>Chesis No</th>
                            <th>Engine No</th>
                            <th>Action</th>
                            <th>Generated Date</th>
                            <th>Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        @foreach($vehicles as $var)
                        <tr>
                            <th scope="row">{{$i}}</th>
                            <td>{{$var->company->companyName}}</td>
                            <td>{{$var->branch->branchName}}</td>
                            <td>{{$var->vehicleNo}}</td>
                            <td>{{$var->chesisNo}}</td>
                            <td>{{$var->engineNo}}</td>
                            <td><a href="{{url('vehicles/'.$var->idVehicle.'/edit')}}" class="btn btn-sm btn-success">Edit</a></td>
                            <?php 
                               $parivahan = \App\VehicleJobs::where('vehicle', '=', $var->vehicleNo)->where('type', '=', "parivahan")->orderBy('created_at', 'ASC')->first();
                               $maharastra = \App\VehicleJobs::where('vehicle', '=', $var->vehicleNo)->where('type', '=', "maharastra")->orderBy('created_at', 'ASC')->first();
                            ?>
                            @if(isset($parivahan->created_at))
                            <td>{{$parivahan->updated_at}}</td>
                            <td <?php if($parivahan->status == "Failed") echo'style="color:red"';?>>{{$parivahan->status}}</td>
                            @else 
                            @if(isset($maharastra->created_at))
                            <td>{{$maharastra->updated_at}}</td>
                            <td <?php if($maharastra->status == "Failed") echo'style="color:red"'; ?>>{{$maharastra->status}}</td>
                            @else
                            <td>NA</td>
                            <td>NA</td>
                            @endif
                            @endif
                        </tr>
                        <?php $i++; ?>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@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();
    }
});
</script>
@stop

Copyright © 2021 - 2025 IMMREX7