/
home
/
sjslayjy
/
public_html
/
assets
/
resources
/
views
/
circle-store
/
omc
/
Upload File
HOME
@extends('layout.master') @push('plugin-styles') <!-- {!! Html::style('/assets/plugins/plugin.css') !!} --> {!! Html::style('//cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css') !!} <style type="text/css"> .table th, .table td { white-space: break-spaces !important; } .table-responsive{ margin: 20px 0; } </style> @endpush @section('content') <div class="row"> <div class="col-lg-12 grid-margin"> <div class="card"> <div class="card-body"> <div class="row grid-margin"> <div class="col-lg-10"> <h4 class="card-title">PT Stocks</h4> </div> <div class="col-lg-2"> <select class="form-control mr" onchange="get_spare_of_warehouse(this)"> @foreach($warehouses as $warehouse) <option value="{{$warehouse}}" {{ $current_warehouse == $warehouse ? 'selected' : ''}}>{{$warehouse}}</option> @endforeach </select> </div> </div> <div class="row"> <div class="col-lg-12"> <ul class="nav nav-tabs" id="myTab" role="tablist"> <li class="nav-item waves-effect waves-light"> <a class="nav-link active" id="fresh_qty" data-toggle="tab" href="#fresh" role="tab" aria-controls="fresh" aria-selected="false">Fresh Spares</a> </li> <li class="nav-item waves-effect waves-light"> <a class="nav-link" id="repaired_qty" data-toggle="tab" href="#repaired" role="tab" aria-controls="repaired" aria-selected="false">Repaired Spares</a> </li> </ul> <div class="tab-content" id="myTabContent"> <div class="tab-pane active show fade" id="fresh" role="tabpanel" aria-labelledby="fresh_qty"> <div class="table-responsive"> <table class="table myTable" > <thead> <tr> <th> Item Code </th> <th > Item Description </th> <th> Fresh Qty</th> <th> Rate</th> <th> Fresh Value</th> </tr> </thead> <tbody> @foreach($fresh_stocks as $fresh_stock) <tr> <td> {{ $fresh_stock->spare_code }} </td> <td >{{ $fresh_stock->description}}</td> <td> {{ $fresh_stock->available_qty }}</td> <td> {{ $fresh_stock->rate }}</td> <td> {{ $fresh_stock->rate*$fresh_stock->available_qty }} </td> </tr> @endforeach </tbody> </table> </div> </div> <div class="tab-pane fade" id="repaired" role="tabpanel" aria-labelledby="repaired_qty"> <div class="table-responsive"> <table class="table myTable" > <thead> <tr> <th> Item Code </th> <th > Item Description </th> <th> Fresh Qty</th> <th> Rate</th> <th> Repaired Value</th> </tr> </thead> <tbody> @foreach($repaired_stocks as $repaired_stock) <tr> <td> {{ $repaired_stock->spare_code }} </td> <td >{{ $repaired_stock->description}}</td> <td> {{ $repaired_stock->available_qty }}</td> <td> {{ $repaired_stock->rate }}</td> <td> {{ $repaired_stock->rate*$repaired_stock->available_qty }} </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> <div class="col-lg-12 grid-margin"> <div class="card"> <div class="card-body"> <h4 class="card-title">PT Stocks in Quantity</h4> <div class="table-responsive"> <table class="table myTable table-striped"> <thead> <tr> <th> Item Code </th> <th> Item Description </th> <th> Warehouse </th> <th> Fresh</th> <th> Repaird </th> <th> Total </th> </tr> </thead> <tbody id="stock_list"> @foreach($pt_stocks as $key => $stock) <tr> <td>{{$stock->spare_code}}</td> <td>{{$stock->description}}</td> <td>{{$stock->warehouse}}</td> <td><label class="badge badge-success">{{$stock->fresh_qty}}</label></td> <td><label class="badge badge-warning">{{$stock->repaired_qty}}</label></td> <td><label class="badge">{{$stock->fresh_qty+$stock->repaired_qty}}</label></td> </tr> @endforeach </tbody> </table> </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') !!} {!! Html::script('//cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js') !!} <script type="text/javascript"> $(document).ready( function () { $('.myTable').DataTable(); }); function get_spare_of_warehouse(t) { var warehouse = $(t).val(); var url = window.location.origin+"/circle-store/get-pt-stock-of-warehouse" var data = {}; data._token = "{{ csrf_token() }}"; data.warehouse = warehouse; $.ajax({ type: "POST", url: url, data: data, success:function(res){ console.log(res); if(res.success == true){ var html = ""; $.each(res.stocks,function(k,stock){ html +=`<tr> <td class="font-weight-medium">`+stock.spare_code+`</td> <td class="font-weight-medium">`+stock.description+`</td> <td><label class="badge badge-success">`+stock.fresh_qty+`</label></td> <td><label class="badge badge-success">`+(stock.fresh_qty*stock.rate).toFixed(2)+`</label></td> <td><label class="badge badge-warning">`+stock.repaired_qty+`</label></td> <td> `+((stock.repaired_qty*stock.rate*stock.repaired_rate)/100).toFixed(2)+` </td> <td> `+((stock.fresh_qty*stock.rate)+((stock.repaired_qty*stock.rate*stock.repaired_rate)/100)).toFixed(2)+` </td> </tr>`; }); $('#stock_list').html(html); }else{ swal(res.msg, { icon: "error", }); } // $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); } </script> @endpush