/
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"> <h3 class="card-title">Requested Indent</h3> <div class="row"> <div class="col-lg-3"> <label>Indent Number : <br/><strong><?php echo e($indent->indent_no); ?></strong></label> </div> <div class="col-lg-3"> <label>Indent Date : <br/><strong><?php echo e($indent->indent_date); ?></strong></label> </div> <div class="col-lg-3"> <label>Indent Placed By : <br/><strong><?php echo e($indent->addedBy($indent->indent_placed_by)); ?></strong></label> </div> <div class="col-lg-3"> <label>Indent Status : <br/><strong><?php echo e($indent->status); ?></strong></label> </div> </div> <div class="row"> <div class="col-lg-3"> <label>Business Type : <br/><strong><?php echo e($indent->business_type); ?></strong></label> </div> <div class="col-lg-3"> <label>Customer Code : <br/><strong><?php echo e($indent->customer_code); ?></strong></label> </div> <div class="col-lg-3"> <label>Customer Name : <br/><strong><?php echo e($indent->customer_name); ?></strong></label> </div> <div class="col-lg-3"> <label>Customer PO : <br/><strong><?php echo e($indent->customer_po); ?></strong></label> </div> </div> <div class="row"> <div class="col-lg-3"> <label>Cutomer PO Date : <br/><strong><?php echo e($indent->cutomer_po_date); ?></strong></label> </div> <div class="col-lg-3"> <label>Requested From Warehouse : <br/><strong><?php echo e($indent->ware_house); ?></strong></label> </div> <div class="col-lg-3"> <label>Stock Type : <br/><strong><?php echo e($indent->stock_type); ?></strong></label> </div> </div> <div class="row"> <div class="col-lg-6"> <label>Remarks: <br/><strong><?php echo e($indent->remarks); ?></strong></label> </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">Requested Spare Parts List</h4> </div> <div class="col-lg-6"> <input type="text" class="form-control" id="spareCode" placeholder="Enter Spare Code"> </div> <div class="col-lg-2"> <button type="button" class="btn btn-success btn-fw" onclick="addselectedItem()">Add Into Indent</button> </div> </div> <div class="table-responsive"> <table class="table table-striped table-bordered"> <thead> <tr> <th>Item Code</th> <th>Description</th> <th>Qty</th> </tr> </thead> <tbody id="tbody"> </tbody> <!--tfoot class="footer"> <tr> <td colspan="5">Sub Total</td> <td ><span id="sub_total" style="float: right;">0.00 Rs</span></td> <td></td> </tr> <tr> <td colspan="5">GST Total</td> <td><span id="gst_total" style="float: right;">0.00 Rs</span></td> <td></td> </tr> <tr> <td colspan="5">Grand Total</td> <td><span id="grand_total" style="float: right;">0.00 Rs</span></td> <td></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"><button type="button" id="indentBtn" onclick="Confirm_indent()" class="btn btn-warning btn-fw">Confirm And Authorised The Indent</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 indentData = {}; indentData.indentItems = []; indentData.indent_id = ""; localStorage.setItem('indentData', JSON.stringify(indentData)); getItems(); } init_cart(); function getItems(){ var url = window.location.origin+"/admin/get-all-indent-spare-part" var data = {}; data.indent_id = "<?php echo e($indent->id); ?>"; data._token = "<?php echo e(csrf_token()); ?>"; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: data, success:function(res){ $('#loaderAction').hide(); if(res.success == true){ var indentData = JSON.parse(localStorage.getItem('indentData')); indentData.indent_id = res.indent_id; $.each(res.indentItems,function(key,val){ let spare = val; spare.new_spare = 0; indentData.indentItems.push(spare); }) localStorage.setItem('indentData',JSON.stringify(indentData)); showSelectedItems(); }else{ } }, error:function(error){ console.log(error); }, dataType: 'json' }); } function removeItem(id){ var indentData = JSON.parse(localStorage.getItem('indentData')); var items = indentData.indentItems; $(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. } }); indentData.indentItems = items; localStorage.setItem('indentData',JSON.stringify(indentData)); showSelectedItems(); } function addselectedItem(){ var code = $('#spareCode').val(); if(code != ""){ var url = window.location.origin+"/admin/get-spare-part-from-pant" var data = {}; data.code = code; data._token = "<?php echo e(csrf_token()); ?>"; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: data, success:function(res){ if(res.success == true){ var spare_part = res.spare_part; var indentData = JSON.parse(localStorage.getItem('indentData')); var is_added = false; $.each(indentData.indentItems,function(key,val){ if(parseInt(val.id) == spare_part.id){ is_added = true; } }); if(is_added == false){ var sparts = spare_part; sparts.qty = 0; sparts.new_spare = 1; indentData.indentItems.push(spare_part); } localStorage.setItem('indentData',JSON.stringify(indentData)); showSelectedItems(); }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); }else{ swal("Please Enter Spare Code in Textbox !", { icon: "error", }); } } function showSelectedItems(){ var indentData = JSON.parse(localStorage.getItem('indentData')); var html = ''; var n = 0; $.each(indentData.indentItems,function(key,spare_part){ html +=`<tr class="row_`+spare_part.id+`"> <td class="font-weight-medium">`+spare_part.code+`</td> <td>`+spare_part.description+`</td> <td><input type="text" name="qty" id="qty_`+spare_part.id+`" onkeypress="return onlyCurrency(event)" onblur="check_zero(this)" onkeyup="calculate(`+spare_part.id+`)" style="width: 80px;" value="`+spare_part.qty+`"/></td> <td><a href="#" onclick="removeItem(`+spare_part.id+`)"><i class="mdi mdi-delete-forever"></i></a></td> </tr>`; addCartValueInKey(spare_part.id,'final_qty',spare_part.qty); addCartValueInKey(spare_part.id,'final_rate',spare_part.rate); }); $('#tbody').html(html); } function calculate(id){ var qty = $('#qty_'+id).val(); if(qty != "" && qty !=null){ qty = parseFloat(qty); addCartValueInKey(id,'final_qty',qty); }else{ addCartValueInKey(id,'final_qty',0); } } function onlyCurrency(event){ if(event.which == 8 || event.which == 0){ return true; } if(event.which < 46 || event.which > 59) { return false; //event.preventDefault(); } // prevent if not number/dot if(event.which == 46 && $(this).val().indexOf('.') != -1) { return false; //event.preventDefault(); } // preven } function check_zero(t){ var qty = $(t).val(); if(qty == "" || qty == null){ $(t).val(0); } } function addCartValueInKey(id,key,value){ var indentData = JSON.parse(localStorage.getItem('indentData')); $.each(indentData.indentItems,function(k,val){ if(parseInt(val.id) == id){ indentData.indentItems[k][key] = value; } }); localStorage.setItem('indentData',JSON.stringify(indentData)); } function is_valid(){ var indentData = JSON.parse(localStorage.getItem('indentData')); var check = true; $.each(indentData.indentItems,function(key,val){ if(val.final_qty == 0){ check = false; return false; } }); if(check == false){ return false }else{ return true; } } function Confirm_indent(){ if(is_valid()){ swal({ title: "Do you want to authorised the Indent?", 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/authorised-indent" var indentData = JSON.parse(localStorage.getItem('indentData')); indentData._token = "<?php echo e(csrf_token()); ?>"; $('#loaderAction').show(); var requestTimeout; var ajaxRequest = $.ajax({ type: "POST", url: url, data: indentData, timeout: 15000, // Set the timeout to 5 seconds (5000 milliseconds) success:function(res){ clearTimeout(requestTimeout); console.log(res); if(res.success == true){ swal(res.msg, { icon: "success", }); init_cart(); showSelectedItems(); // Enable the button for re-submit indentBtn.disabled = false; // Reset the button text indentBtn.innerHTML = 'Confirm And Authorised The Indent'; window.location.href = window.location.origin+"/admin/authorised-indents"; }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); indentBtn.disabled = res.success !== true; // placeAmcButton.innerHTML = 'AMC Request Placed !'; }, 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); indentBtn.disabled = true; indentBtn.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 indentBtn.disabled = false; // Reset the button text indentBtn.innerHTML = 'Confirm And Authorised The Indent'; }, 15000); } }); }else{ swal('Zero Not Allow in qty', { 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/admin/indent/viewIndent.blade.php ENDPATH**/ ?>