/
home
/
sjslayjy
/
public_html
/
assets
/
resources
/
views
/
circle-store
/
Upload File
HOME
@extends('layout.master') @push('plugin-styles') <!-- {!! Html::style('/assets/plugins/plugin.css') !!} --> <style type="text/css"> .table th, .table td { white-space: break-spaces !important; } .table-responsive.small-text > table > tbody > tr > td {font-size: 12px !important;} </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-6"> <h4 class="card-title">Spares Parts At Sites</h4> </div> <div class="col-lg-3"> <small>Select Warehouse</small> <select class="form-control mr" onchange="get_ware_house(this)"> <option value="">-- Select Warehouse --</option> @foreach($warehouses as $warehouse) <option value="{{$warehouse}}">{{$warehouse}}</option> @endforeach </select> </div> <div class="col-lg-3"> <small>Select Site</small> <select class="form-control mr select2" id="site" onchange="getSpareParts(this)"> <option value=""> -- Select Site --</option> @foreach($sites as $key=>$site) <option value="{{$site->Site_id}}::{{$site->product}}">{{$site->Site_id}}({{$site->product}}) - {{$site->Site_Name}}</option> @endforeach </select> </div> </div> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th> Spare Code </th> <th> Description </th> <th> Fresh</th> <th> Repaird </th> <th> Faulty </th> <th> Total </th> </tr> </thead> <tbody id="spare_list"> </tbody> </table> </div> </div> </div> </div> <div class="row grid-margin"> <div class="col-lg-4"> <div class="card"> <div class="card-body"> <h4>Fresh Spare</h4> <div class="table-responsive small-text"> <table class="table table-striped"> <thead> <tr> <th> Spare </th> <th> Qty </th> <th> Rate</th> <th> Total</th> </tr> </thead> <tbody id="fresh_spare_list"> </tbody> </table> </div> </div> </div> </div> <div class="col-lg-4"> <div class="card"> <div class="card-body"> <h4>Repaired Spare</h4> <div class="table-responsive small-text"> <table class="table table-striped"> <thead> <tr> <th> Spare </th> <th> Qty </th> <th> Rate</th> <th> Total</th> </tr> </thead> <tbody id="repaired_spare_list"> </tbody> </table> </div> </div> </div> </div> <div class="col-lg-4"> <div class="card"> <div class="card-body"> <h4>Faulty Spare</h4> <div class="table-responsive small-text"> <table class="table table-striped"> <thead> <tr> <th> Spare </th> <th> Qty </th> <th> Rate</th> <th> Total</th> </tr> </thead> <tbody id="faulty_spare_list"> </tbody> </table> </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"> $(document).ready(function() { $(".select2").select2(); }); // $(".e1").select2(); function get_ware_house(t){ var warehouse = $(t).val(); if(warehouse !=""){ var url = window.location.origin+"/circle-store/get-site-of-warehouse" var data = {}; data._token = "{{ csrf_token() }}"; data.warehouse = warehouse; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: data, success:function(res){ if(res.success == true){ var html = '<option value=""> -- Select Site --</option>'; $.each(res.sites,function(key,val){ html +=`<option value="`+val.Site_id+`::`+val.product+`">`+val.Site_id+`::`+val.product+` - `+val.Site_Name+`</option>`; }); $('#site').html(html); }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); }else{ swal("Please Select warehouse !", { icon: "error", }); } } function getSpareParts(t){ var site_id = $(t).val(); if(site_id != ""){ var url = window.location.origin+"/circle-store/get-spare-part-at-site" var mydata = {}; mydata._token = "{{ csrf_token() }}"; mydata.site_id = site_id; $.ajax({ type: "POST", url: url, data: mydata, success:function(res){ console.log(res); if(res.success == true){ var html = ""; $.each(res.spares,function(key,spare_part){ html +=`<tr class="row_`+spare_part.id+`"> <td>`+spare_part.spare_code+`</td> <td>`+spare_part.description+`</td> <td><label class="badge badge-success">`+spare_part.fresh_qty+`</label></td> <td><label class="badge badge-warning">`+spare_part.repaired_qty+`</label></td> <td><label class="badge badge-danger">`+spare_part.faulty_qty+`</label></td> <td><label class="badge">`+(spare_part.fresh_qty+spare_part.repaired_qty+spare_part.faulty_qty)+`</label></td> </tr>`; }); $('#spare_list').html(html); var fhtml = ''; $.each(res.fresh_items,function(key,fspare){ fhtml +=`<tr class="frow_`+fspare.id+`"> <td>`+fspare.spare_code+`</td> <td>`+fspare.available_qty+`</td> <td>`+fspare.rate+`</td> <td>`+(fspare.available_qty*fspare.rate)+`</td> </tr>`; }); $('#fresh_spare_list').html(fhtml); var rhtml = ''; $.each(res.repaired_items,function(key,rspare){ rhtml +=`<tr class="rrow_`+rspare.id+`"> <td>`+rspare.spare_code+`</td> <td>`+rspare.available_qty+`</td> <td>`+rspare.rate+`</td> <td>`+(rspare.available_qty*rspare.rate)+`</td> </tr>`; }); $('#repaired_spare_list').html(rhtml); var flhtml = ''; $.each(res.faulty_items,function(key,flspare){ flhtml +=`<tr class="frow_`+flspare.id+`"> <td>`+flspare.spare_code+`</td> <td>`+flspare.available_qty+`</td> <td>`+flspare.rate+`</td> <td>`+(flspare.available_qty*flspare.rate)+`</td> </tr>`; }); $('#faulty_spare_list').html(flhtml); }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); }else{ } } </script> @endpush