/
home
/
sjslayjy
/
public_html
/
assets
/
storage
/
framework
/
views
/
Upload File
HOME
<?php $__env->startPush('plugin-styles'); ?> <!-- <?php echo Html::style('/assets/plugins/plugin.css'); ?> --> <?php $__env->stopPush(); ?> <?php $__env->startSection('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">Verifing STN</h4> </div> <div class="col-lg-2"> <select class="form-control mr" id="warehouse"> <option value="">-- Select Warehouse --</option> <?php $__currentLoopData = $warehouses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $warehouse): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($warehouse); ?>"><?php echo e($warehouse); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </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">Spare Parts List</h4> </div> <div class="col-lg-6"> <input type="text" class="form-control" id="stn_number" placeholder="Enter STN Number"> </div> <div class="col-lg-2"> <button type="button" class="btn btn-success btn-fw" onclick="get_stn_infomation()">Get Deatils</button> </div> </div> <div class="table-responsive"> <table class="table table-striped table-bordered"> <thead> <tr> <th> Spare Code</th> <th> Description</th> <th> UOM</th> <th> Type</th> <th> Fresh Qty</th> <th> Repaired Qty</th> <th> Faulty Qty</th> <th> Fresh Rate/Spare</th> </tr> </thead> <tbody id="tbody"> </tbody> </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-6"></div> <div class="col-lg-3"></div> <div class="col-lg-3"><button type="button" id="verify" onclick="verify_now()" class="btn btn-warning btn-fw" disabled>Verify Now</button></div> </div> </div> </div> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startPush('plugin-scripts'); ?> <?php echo Html::script('/assets/plugins/chartjs/chart.min.js'); ?> <?php echo Html::script('/assets/plugins/jquery-sparkline/jquery.sparkline.min.js'); ?> <?php $__env->stopPush(); ?> <?php $__env->startPush('custom-scripts'); ?> <?php echo Html::script('/assets/js/dashboard.js'); ?> <script type="text/javascript"> function init_cart(){ var stnDetails = {}; stnDetails.items = []; stnDetails.stn_number = ''; localStorage.setItem('stnDetails', JSON.stringify(stnDetails)); } init_cart(); function removeItem(id){ var stnDetails = JSON.parse(localStorage.getItem('stnDetails')); var items = stnDetails.items; $(items).each(function (index){ if(items[index].id == id){ items.splice(index,1); // This will remove the object that first name equals to Test1 return false; // This will stop the execution of jQuery each loop. } }); stnDetails.items = items; localStorage.setItem('stnDetails',JSON.stringify(stnDetails)); showSelectedItems(); } function get_stn_infomation(){ document.getElementById("verify").disabled = false; var stn_number = $('#stn_number').val(); var warehouse = $('#warehouse').val(); if(stn_number != "" && warehouse != ""){ var stnDetails = JSON.parse(localStorage.getItem('stnDetails')); if(stnDetails.items.length == 0){ var url = window.location.origin+"/circle-store/get-stn-details"; var data = {}; data.stn_number = stn_number; data.warehouse = warehouse; data._token = "<?php echo e(csrf_token()); ?>"; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: data, success:function(res){ console.log(res); if(res.success == true){ var stnDetails = JSON.parse(localStorage.getItem('stnDetails')); $.each(res.items,function(key,val){ val.rqty = val.fresh_qty; stnDetails.items.push(val); }); $('#warehouse').attr('disabled',true); $('#stn_number').attr('readonly',true); localStorage.setItem('stnDetails',JSON.stringify(stnDetails)); showSelectedItems(); }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); } }else{ swal("Please Enter STN Number and Select warehouse !!", { icon: "error", }); } } function showSelectedItems(){ var stnDetails = JSON.parse(localStorage.getItem('stnDetails')); var html = ''; var n = 0; $.each(stnDetails.items,function(key,spare_part){ html +=`<tr class="row_`+spare_part.id+`"> <td class="font-weight-medium">`+spare_part.spare_code+`</td> <td>`+spare_part.description+`</td> <td>`+spare_part.uom+`</td> <td>`+spare_part.type+`</td> <td>`+spare_part.fresh_qty+`</td> <td>`+spare_part.repaired_qty+`</td> <td>`+spare_part.faulty_qty+`</td> <td>`+spare_part.rate+`</td> </tr>`; }); $('#tbody').html(html); } function fcalculate(t,id){ var fqty = parseInt($(t).val()); if(fqty != ""){ addCartValueInKey(id,'fqty',fqty); } } function rcalculate(t,id){ var rqty = parseInt($(t).val()); if(rqty != ""){ addCartValueInKey(id,'rqty',rqty); } } function flcalculate(t,id){ var flqty = parseInt($(t).val()); if(flqty != ""){ addCartValueInKey(id,'flqty',flqty); } } function addCartValueInKey(id,key,value){ var stnDetails = JSON.parse(localStorage.getItem('stnDetails')); $.each(stnDetails.items,function(k,val){ if(parseInt(val.id) == id){ stnDetails.items[k][key] = value; } }); localStorage.setItem('stnDetails',JSON.stringify(stnDetails)); } function getEngineer(t){ var eng_id = $(t).val(); if(eng_id !=""){ var stnDetails = JSON.parse(localStorage.getItem('stnDetails')); stnDetails.engineer_id = eng_id; localStorage.setItem('stnDetails',JSON.stringify(stnDetails)); }else{ swal('Please Select Engineer !!', { icon: "error", }); } } function verify_now(){ var stn_number = $('#stn_number').val(); var warehouse = $('#warehouse').val(); const verify = document.getElementById('verify'); if(stn_number !="" && warehouse != ""){ var url = window.location.origin+"/circle-store/received-stn-now" var stnDetails = JSON.parse(localStorage.getItem('stnDetails')); //token = "<?php echo e(csrf_token()); ?>"; //stnDetails._token = "<?php echo e(csrf_token()); ?>"; stnDetails.stn_number = stn_number; stnDetails.warehouse = warehouse; console.log(stnDetails); $('#loaderAction').show(); var requestTimeout; var ajaxRequest = $.ajax({ type: "POST", url: url, timeout: 15000, // Set the timeout to 5 seconds (5000 milliseconds) //data: stnDetails, data: {_token: '<?php echo e(csrf_token()); ?>', stnDetails: JSON.stringify(stnDetails)}, success:function(res){ clearTimeout(requestTimeout); console.log(res); if(res.success == true){ const button = document.getElementById('verify'); swal(res.msg, { icon: "success", }); $('#warehouse').attr('disabled',false); $('#stn_number').attr('readonly',false); init_cart(); showSelectedItems(); // Enable the button for re-submit verify.disabled = false; // Reset the button text verify.innerHTML = 'Verify Now'; }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); verify.disabled = res.success !== true; }, error:function(xhr, status, error){ var requestTimeout = setTimeout(function () { $('#loaderAction').hide(); swal("Process has been cancelled due to exceeding the execution time!", { icon: "error" }); ajaxRequest.abort(); }, 15000); console.log(error); verify.disabled = true; verify.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> <span class="animated-text">Please wait for 15 seconds, request is under process...</span>'; // Clear the timeout on error clearTimeout(requestTimeout); }, dataType: 'json' }); // Set the timeout for the request requestTimeout = setTimeout(function() { $('#loaderAction').hide(); swal("Process has been cancelled due to exceeding the execution time!", { icon: "error" }); ajaxRequest.abort(); // Enable the button for re-submit verify.disabled = false; // Reset the button text verify.innerHTML = 'Verify Now'; }, 15000); }else{ swal('Please Enter STN Number and Select warehouse !!', { icon: "error", }); } } $(document).ready(function(){ }); </script> <?php $__env->stopPush(); ?> <?php echo $__env->make('layout.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/assets/resources/views/circle-store/stn-verify.blade.php ENDPATH**/ ?>