/
home
/
sjslayjy
/
public_html
/
assets
/
resources
/
views
/
admin
/
amc
/
Upload File
HOME
@extends('layout.master') @push('plugin-styles') <!-- {!! Html::style('/assets/plugins/plugin.css') !!} --> @endpush @section('content') <div class="row"> <div class="col-lg-12 grid-margin"> <div class="card"> <div class="card-body"> <h3 class="card-title">AMCR Details</h3> <div class="row"> <div class="col-lg-3"> <label>MR Number : <br/><strong>{{$amc->mr_no}}</strong></label> </div> <div class="col-lg-3"> <label>Status : <br/> @if( $amc->status == 'authorize') <strong class="badge badge-success">{{$amc->status}}</strong> @else <strong class="badge badge-warning">{{$amc->status}}</strong> @endif </label> </div> <div class="col-lg-3"> <label>Requested BY : <br/><strong>{{$amc->requestedBy($amc->request_by)}}</strong></label> </div> @if($amc->authorize_by != null) <div class="col-lg-3"> <label>Authorize BY : <br/><strong>{{$amc->authorizeBy($amc->authorize_by)}}</strong></label> </div> @endif </div> </div> </div> </div> <div class="col-lg-12 grid-margin"> <div class="card"> <div class="card-body"> <div class="row grid-margin"> <div class="col-lg-4"> <h4 class="card-title">Authorized Spare Parts List</h4> </div> </div> <div class="table-responsive"> <table class="table table-striped table-bordered"> <thead> <tr> <th>Item Code</th> <th>Description</th> <th>Rate(Rs)</th> <th>Type</th> <th>Qty</th> <th>Total</th> </tr> </thead> <tbody id="tbody"> @php $subtotal = 0; $gsttotal = 0; @endphp @foreach($amc_items as $amcitem) @php $total = 0; $rtotal = 0; $rgst = 0; $fgst = 0; @endphp @if($amcitem->fresh_qty != 0) <tr> <td>{{$amcitem->spare_code}}</td> <td>{{$amcitem->description}}</td> <td>{{$amcitem->rate}}</td> <td>Fresh</td> <td>{{$amcitem->fresh_qty}}</td> @php $fgst = (($amcitem->rate*$amcitem->fresh_qty)*$amcitem->gst)/100; @endphp <td style="text-align: right;">{{ $total = $amcitem->rate*$amcitem->fresh_qty}} Rs</td> @php $subtotal = $subtotal + $total; @endphp </tr> @endif @if($amcitem->repaired_qty != 0) <tr> <td>{{$amcitem->spare_code}}</td> <td>{{$amcitem->description}}</td> <td>{{$rate = $amcitem->rate}}</td> <td>Repaired</td> <td>{{$amcitem->repaired_qty}}</td> @php $rgst = (($rate*$amcitem->repaired_qty)*$amcitem->gst)/100; @endphp <td style="text-align: right;">{{ $rtotal = ($rate*$amcitem->repaired_qty) }} Rs</td> @php $subtotal = $subtotal + $rtotal; @endphp </tr> @endif @if($amcitem->faulty_qty != 0) <tr> <td>{{$amcitem->spare_code}}</td> <td>{{$amcitem->description}}</td> <td>{{$rate = $amcitem->rate}}</td> <td>Faulty</td> <td>{{$amcitem->faulty_qty}}</td> @php $rgst = (($rate*$amcitem->faulty_qty)*$amcitem->gst)/100; @endphp <td style="text-align: right;">{{ $rtotal = ($rate*$amcitem->faulty_qty) }} Rs</td> @php $subtotal = $subtotal + $rtotal; @endphp </tr> @endif @endforeach </tbody> <tfoot class="footer"> <tr> <td colspan="5"> Total </td> <td ><span id="sub_total" style="float: right;">{{round($subtotal,2)}} Rs</span></td> </tr> </tfoot> </table> <div id="loaderAction"> <div class="loader"></div> </div> </div> </div> </div> </div> <div class="col-lg-12 grid-margin"> <div class="card"> <div class="card-body"> <div class="row"> <div class="col-lg-8"></div> <div class="col-lg-4"> @if( $amc->status == 'request' && (Auth::user()->role == 17 || Auth::user()->role == 18 || Auth::user()->role == 23)) <a onclick="authorized_amc()" class="btn btn-lg btn-info" style="color: #fff;">Authorize</a> <a onclick="cancle_amc()" class="btn btn-lg btn-info" style="color: #fff;">Reject</a> @endif </div> </div> </div> </div> </div> </div> @endsection @push('plugin-scripts') {!! Html::script('/assets/plugins/chartjs/chart.min.js') !!} {!! Html::script('/assets/plugins/jquery-sparkline/jquery.sparkline.min.js') !!} @endpush @push('custom-scripts') {!! Html::script('/assets/js/dashboard.js') !!} <script type="text/javascript"> function cancle_amc() { swal({ title: "Do you want to Reject the AMCR?", text: "if yes then press 'OK' button otherwise press 'Cancel' button to cancel it.", icon: "warning", buttons: true, dangerMode: true, }).then((willDelete)=>{ if (willDelete) { var url = window.location.origin+"/admin/cancle-amc"; var data = {}; data._token = "{{ csrf_token() }}"; data.amc_id = "{{ $amc->id }}"; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: data, success:function(res){ console.log(res); if(res.success == true){ swal(res.msg, { icon: "success", }); window.location.href = window.location.origin+"/admin/all-amc-requests"; }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); } }); } function authorized_amc(){ swal({ title: "Do you want to authorised the AMCR?", text: "if yes then press 'OK' button otherwise press 'Cancel' button to cancel it.", icon: "warning", buttons: true, dangerMode: true, }).then((willDelete) => { if (willDelete) { var url = window.location.origin+"/admin/authorize-amc" var data = {}; data._token = "{{ csrf_token() }}"; data.amc_id = "{{ $amc->id }}"; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: data, success:function(res){ console.log(res); if(res.success == true){ swal(res.msg, { icon: "success", }); window.location.href = window.location.origin+"/admin/all-amc-requests"; }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); } }); } </script> @endpush