Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: setpriceswithapi.js
function Trim(str) { return str.replace(/^\s+|\s+$/g, ''); } function isFloat(field) { var point=0; var i=0; var beforePoint=0; var afterPoint=0; for(var a=0;a<field.length;a++) { if(!(field.charAt(a)=="." || field.charAt(a)=="0" || field.charAt(a)=="1" || field.charAt(a)=="2" || field.charAt(a)=="3" || field.charAt(a)=="4" || field.charAt(a)=="5" || field.charAt(a)=="6" || field.charAt(a)=="7" || field.charAt(a)=="8" || field.charAt(a)=="9")) return false; if(field.charAt(a)==".") point++; } if(point > 1) return false; if(point == 1) { while(field.charAt(i)!=".") { i++; beforePoint++; } afterPoint=field.length-(beforePoint+1); if(afterPoint==0 && beforePoint==0) return false; } return true; } $(document).ready(function() { $("#btnSavePrice").click(function(){ $('#statusLoader').ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); var allOkay = true; $('div.dynamic-errors').remove(); var groups = $('#ttlGroups').val(); var checkPriceFetch = 0; if($("#chkFetchCPr").prop('checked')){ checkPriceFetch = 1; }else{ checkPriceFetch = 0; } var prices = Trim($('#txtPrice0').val()); if(!prices) { $('#txtPrice0').after('<div class="dynamic-errors">This field is required!</div>'); allOkay = false; } var plans = Trim($('#serviceId').val()); var marginType = Trim($('#marginType0').val()); for(var a=1; a<= groups; a++) { if(Trim($('#txtPrice'+a).val()) && isFloat($('#txtPrice'+a).val())) { prices = prices + ',' + Trim($('#txtPrice'+a).val()); plans = plans + ',' + Trim($('#groupId'+a).val()); marginType = marginType + ',' + $('#marginType'+a).val(); }else{ $('#txtPrice'+a).after('<div class="dynamic-errors">This field is required!</div>'); allOkay = false; } } if(allOkay) { var $this = $(this); $this.text('...'); $this.attr('disabled', true); $.post(base_url+apanel_name+"/services/ajxpriceswithapi", { chkFetchCPr:checkPriceFetch, srvcAPIId:$('#srvcAPIId').val(), serviceId:$('#serviceId').val(), sType:$('#sType').val(), plans:plans, prices:prices, marginType:marginType, dPrice:Trim($('#txtPrice0').val()), dMT:Trim($('#marginType0').val()), costPrice: ($('#txtCostPrice').length ? $('#txtCostPrice').val() : 0), purpose:'save' }, function(response){ if(response) { showStickyErrorToast(response, '', 'success'); setTimeout(function(){ window.location.reload(); }, 1000); } }).always(function(){ $this.text('Update'); $this.attr('disabled', false); }); } }); });