/
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">Request New Indent</h3> <div class="row"> <div class="col-lg-3"> <label>Business Type</label> <select onchange="getBusinessType(this)" class="form-control mr" id="business_type"> <option value="">Select Business Type</option> <option value="Service">Service</option> <option value="PT">PT ( Pull Through )</option> <option value="Supply">Supply</option> <option value="NMS">NMS</option> <option value="SCM">SCM</option> </select> </div> <div class="col-lg-3"> <label>Ware House</label> <select class="form-control mr" id="ware_house" onchange="get_ware_house(this)"> <option value=""> -- Select Warehouse --</option> <?php $__currentLoopData = $assigned_warehouses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $assigned_warehouse): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($assigned_warehouse); ?>"><?php echo e($assigned_warehouse); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <div class="col-lg-3"> <label>Customer Code and Name</label> <select onchange="getCustomerCodeInfo(this)" class="form-control mr" id="customer_code_and_name"> <option value="">Select Customer Code</option> <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($customer->Cust_Code); ?> -- <?php echo e($customer->Cust_Name); ?>"><?php echo e($customer->Cust_Code); ?> -- <?php echo e($customer->Cust_Name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <div class="col-lg-3"> <label>Indent Date</label> <input type="date" id="indent_date" name="indent-date" onchange="get_indent_date(this)" class="form-control"/> </div> </div> <div class="row mt"> <div class="col-lg-2"> <label>Customer PO</label> <input type="text" id="customer_po" name="customer-po" onkeyup="get_cutomer_po(this)" class="form-control"/> </div> <div class="col-lg-3"> <label>Customer PO Date</label> <input type="date" id="cutomer_po_date" name="customer-po-date" onchange="get_cutomer_po_date(this)" class="form-control"/> </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="spareCode" placeholder="Enter Spare Code"> </div> <div class="col-lg-2"> <button type="button" class="btn btn-success btn-fw" onclick="addselectedItem()">Add Indent Item</button> </div> </div> <div class="table-responsive"> <table class="table table-striped table-bordered"> <thead> <tr> <th> Item Code</th> <th> Description</th> <th> UOM</th> <th> Category</th> <th> Qty</th> <th> --- </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-9"> <label>Remarks</label> <textarea class="form-control" onkeyup="get_textarea_data(this)"></textarea> </div> <div class="col-lg-3"><button type="button" onclick="place_indent()" class="btn btn-warning btn-fw">Place 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 requestIndent = {}; requestIndent.items = []; requestIndent.customer_code_and_name = ""; requestIndent.customer_po = ""; requestIndent.cutomer_po_date = ""; requestIndent.ware_house = "SER<?php echo e($userInfo->circleCodes); ?>"; requestIndent.indent_date = ""; requestIndent.business_type = ""; requestIndent.remarks = ""; localStorage.setItem('requestIndent', JSON.stringify(requestIndent)); } if(localStorage.getItem('requestIndent') != null){ $(document).ready(function(){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); $('#referenceNumber').val(requestIndent.reference_number); $('#invoiceNumber').val(requestIndent.invoice_number); if(requestIndent.indent_date != ""){ $('#indent_date').val(requestIndent.indent_date); } if(requestIndent.stock_type != ""){ $('#stock_type').val(requestIndent.stock_type); } if(requestIndent.ware_house != ""){ $('#ware_house').val(requestIndent.ware_house); } if(requestIndent.business_type != ""){ $('#business_type').val(requestIndent.business_type); } if(requestIndent.customer_code_and_name != ""){ $('#customer_code_and_name').val(requestIndent.customer_code_and_name); } if(requestIndent.cutomer_po_date != ""){ $('#cutomer_po_date').val(requestIndent.cutomer_po_date); } if(requestIndent.customer_po != ""){ $('#customer_po').val(requestIndent.customer_po); } showSelectedItems(); }); }else{ init_cart(); } function getCustomerCodeInfo(t){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); requestIndent.customer_code_and_name = $(t).val(); localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); } function get_cutomer_po(t){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); requestIndent.customer_po = $(t).val(); localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); } function get_cutomer_po_date(t){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); requestIndent.cutomer_po_date = $(t).val(); localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); } function get_ware_house(t){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); requestIndent.ware_house = $(t).val(); localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); if(requestIndent.ware_house != ""){ var url = window.location.origin+"/circle-store/get-customers-of-warehouse"; var data = {}; data.warehouse = requestIndent.ware_house; data._token = "<?php echo e(csrf_token()); ?>"; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: data, success:function(res){ if(res.success == true){ var html = '<option value="">-- Select Customer -- </option>'; $.each(res.customers,function(key,val){ html +=`<option value="`+val.Cust_Code+` -- `+val.Cust_Name+`">`+val.Cust_Code+` -- `+val.Cust_Name+`</option>`; }); $('#customer_code_and_name').html(html); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); } } function get_indent_date(t){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); requestIndent.indent_date = $(t).val(); localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); } function removeItem(id){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); var items = requestIndent.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. } }); requestIndent.items = items; localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); showSelectedItems(); } function addselectedItem(){ var code = $('#spareCode').val(); if(code != ""){ var url = window.location.origin+"/admin/get-spare-part" 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 requestIndent = JSON.parse(localStorage.getItem('requestIndent')); var is_added = false; $.each(requestIndent.items,function(key,val){ if(parseInt(val.id) == spare_part.id){ is_added = true; } }); if(is_added == false){ var sparts = spare_part; sparts.qty = 0; requestIndent.items.push(spare_part); } localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); showSelectedItems(); }else{ swal("Invailid Spare Code !", { 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 requestIndent = JSON.parse(localStorage.getItem('requestIndent')); var html = ''; var n = 0; $.each(requestIndent.items,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>`+spare_part.uom+`</td> <td>`+spare_part.category+`</td> <td><input type="text" name="qty" onblur="check_zero(this)" onkeypress="return onlyCurrency(event)" onkeyup="calculate(this,`+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>`; }); $('#tbody').html(html); } function check_zero(t){ var qty = $(t).val(); if(qty == "" || qty == null){ $(t).val(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 calculate(t,id){ var qty = $(t).val(); if(qty != "" && qty != null){ addCartValueInKey(id,'qty',qty); }else{ addCartValueInKey(id,'qty',0); } } function getBusinessType(t){ var businessType = $(t).val(); var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); requestIndent.business_type = businessType; localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); } function get_textarea_data(t){ var remarks = $(t).val(); var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); requestIndent.remarks = remarks; localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); } function addCartValueInKey(id,key,value){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); $.each(requestIndent.items,function(k,val){ if(parseInt(val.id) == id){ requestIndent.items[k][key] = value; } }); localStorage.setItem('requestIndent',JSON.stringify(requestIndent)); } function is_valid(){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); var check = true; $.each(requestIndent.items,function(key,val){ if(val.qty == 0 ){ check = false; return false; } }); if(check == false){ return false }else{ return true; } } function place_indent(){ var requestIndent = JSON.parse(localStorage.getItem('requestIndent')); if(requestIndent.items.length < 1 || requestIndent.business_type == "" || requestIndent.indent_date == "" || requestIndent.ware_house == "" ){ swal("Please Spare Items ,Business Type, Warehouse and Indent Date Is required !!", { icon: "error", }); }else if(!is_valid()){ swal("Zero quantity is not allowed for the Item.", { icon: "error", }); }else{ swal({ title: "Is Your Spare Parts Verified ?", text: "if you verified your items then press 'Ok',otherwise press 'Cancel' and check again.", icon: "warning", buttons: true, dangerMode: true, }).then((willDelete) => { if (willDelete) { var url = window.location.origin+"/circle-store/place-indent" requestIndent._token = "<?php echo e(csrf_token()); ?>"; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: requestIndent, success:function(res){ console.log(res); if(res.success == true){ swal(res.msg, { icon: "success", }); init_cart(); showSelectedItems(); }else{ swal(res.msg, { icon: "error", }); } $('#loaderAction').hide(); }, error:function(error){ console.log(error); }, dataType: 'json' }); } }); } } function formatDate() { var d = new Date(), month = '' + (d.getMonth() + 1), day = '' + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; return [year, month, day].join('-'); } </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/indent/request-indent.blade.php ENDPATH**/ ?>