Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: logpackage.js
function savePrices() { $("#hdSavePrices").val('1'); } function calculatePrices() { if($("#id").val() == '0') { convertPrices(); } } function convertPrices() { if (isFloat($("#txtPrice").val())) { var totalCurrencies = $("#totalCurrencies").val(); var price = $("#txtPrice").val(); var conversionRate = 0; var i = 0; for(i = 0; i < totalCurrencies; i++) { var converterPrice = 0; converstionRate = $("#converstionRate"+i).val(); converterPrice = parseFloat(price * converstionRate); $("#txtCurrPrice"+i).val(Round(converterPrice)); } } } function convertCurrPrices(element) { if($('#chkCnvrtPrice').is(':checked')) { var group_id = $(element).data('id'); var group_price = $(element).attr('id'); var totalCurrencies = $("#totalCurrencies").val(); var price = $("#"+group_price).val(); var conversionRate = 0; var i = 0; var j = 0; console.log(group_id); for(i = 0; i < totalCurrencies; i++) { var converterPrice = 0; j = parseInt(i)+parseInt(1); conversionRate = $("#cRt"+group_id+"_"+j).val(); converterPrice = parseFloat(price * conversionRate); $("#txtOtherPrice"+group_id+"_"+j).val(Round(converterPrice)); } } } $(document).on('keyup','#txtCostPrice',function(){ var totalCurrencies = $("#totalCurrencies").val(); var price = $("#txtCostPrice").val(); var conversionRate = 0; var i = 0; for(i = 0; i < totalCurrencies; i++) { var converterPrice = 0; converstionRate = $("#converstionRate"+i).val(); converterPrice = parseFloat(price * converstionRate); $("#txtCurrPrice"+i).val(Round(converterPrice)); } }); $(document).on('keyup','#txtPrice',function(){ if($('#chkCnvrtPrice').prop('checked')){ var totalCurrencies = $("#totalCurrencies").val(); var price = $("#txtPrice").val(); var conversionRate = 0; var i = 0; for(i = 0; i < totalCurrencies; i++) { var converterPrice = 0; converstionRate = $("#converstionRate"+i).val(); converterPrice = parseFloat(price * converstionRate); $("#csCurrPrice"+i).val(Round(converterPrice)); } } }); function showHideNewTpl() { if (document.getElementById('rdNewTplType0').checked) $("#dvNewOrderTpl").hide(); else if (document.getElementById('rdNewTplType1').checked) $("#dvNewOrderTpl").show(); } function showHideSucTpl() { if (document.getElementById('rdSuccessTplType0').checked) $("#dvSucOrderTpl").hide(); else if (document.getElementById('rdSuccessTplType1').checked) $("#dvSucOrderTpl").show(); } function showHideCanTpl() { if (document.getElementById('rdCanTplType0').checked) $("#dvCanOrderTpl").hide(); else if (document.getElementById('rdCanTplType1').checked) $("#dvCanOrderTpl").show(); } function getSupplierServices(apiId) { $('#imgSrvcLoader').ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); $.post(base_url+apanel_name+"/services/ajxpackage", { apiId:apiId, serviceType:2, purpose:'getsuppliersrvcs' }, function(response){ if(response) { $("#supplierPackId").html(response); $('#dvAPIServiceType').hide(); } }); } function getServiceTypes(apiId) { $('#imgSrvcTypeLoader').ajaxStart(function() { $('#imgSrvcTypeLoader').show(); }).ajaxStop(function() { $('#imgSrvcTypeLoader').hide(); }); $.post(base_url+apanel_name+"/services/ajxpackage", { apiId:apiId, serviceType:2, serviceId:$("#supplierPackId").val(), purpose:'getservicetypes' }, function(response){ if(response != '') { //$msg = "<option value='0'>Choose Service Type</option>"; $("#apiServiceTypeId").html("<option value='0'>Choose Service Type</option>"+response); $('#dvAPIServiceType').show(); } else { $('#dvAPIServiceType').hide(); } }); } function validate() { var errors = ''; if ($("#txtTitle").val()=='') errors += "- "+BE_51+"<br />"; if($("#dupSrvcId").val() == '0') { if ($("#categoryId").val() == '0') errors += "- "+BE_4+"<br />"; if ($("#txtPrice").val()=='') errors += "- "+BE_52+"<br />"; if ($("#txtPrice").val()!='') { if (!isFloat($("#txtPrice").val())) errors += "- "+BE_53; } if(document.getElementById('rdServiceType0').checked) { if ($("#txtResDelayTm").val()=='') errors += "- Please Enter Response Delay Time<br />"; if (!isDigit($("#txtResDelayTm").val())) errors += "- Invalid value of Response Delay Time"; } if ($("#txtCancelTime").val() != '') { if (!isDigit($("#txtCancelTime").val())) errors += "- Invalid value for Time to Cancel Orders<br />"; } if ($("#txtVerifyTime").val() != '') { if (!isDigit($("#txtVerifyTime").val())) errors += "- Invalid value for Time to Verfiy Orders"; } } if (errors=='') return true; else { showStickyErrorToast(errors, BE_ERR, 'error'); return false; } } $(document).ready(function() { $("#rdServiceType0").click(function(){ if(document.getElementById('rdServiceType0').checked) { $('#dvDelayTm').show(); } else { $('#dvDelayTm').hide(); } }); $("#rdServiceType1").click(function(){ if(document.getElementById('rdServiceType1').checked) { $('#dvDelayTm').hide(); } else { $('#dvDelayTm').hide(); } }); $("#frm").submit(function(){ return validate(); }); $("#btnPriceEml").click(function() { $('#imgEmlLdr').ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); $.post(base_url+apanel_name+"/services/ajxpackage", { id:$("#id").val(), sc:2, notes:$("#txtUserNotes").val(), groupId:$("#uNplanId").val(), purpose:'sendsrvcemail' }, function(response){ if(response) { showStickyErrorToast(response, '', 'success'); } }); }); $("#dupSrvcId").change(function() { if($("#dupSrvcId").val() == '0') $("#dvGeneral").show(); else $("#dvGeneral").hide(); }); $("#apiId").change(function() { var arr = $("#apiId").val().split('~'); var apiId = arr[0]; var extId = arr[1]; var apiType = arr[2]; $("#dvExtNetworkId").show(); getSupplierServices(apiId); }); $("#supplierPackId").change(function() { var arr = $("#apiId").val().split('~'); var apiId = arr[0]; // $("#dvExtNetworkId").show(); getServiceTypes(apiId); }); $("#chkCnvrtPrice").click(function() { if(document.getElementById('chkCnvrtPrice').checked) { var totalGroups = $("#totalGroups").val(); var currencyCount = $("#currencyCount").val(); // updating default group price (function(){ var price = $("#txtPrice").val(); var conversionRate = 0; var i = 0; for(i = 0; i < currencyCount; i++) { var converterPrice = 0; converstionRate = $("#converstionRate"+i).val(); converterPrice = parseFloat(price * converstionRate); $("#csCurrPrice"+i).val(Round(converterPrice)); } })(); var j = 0; for(j = 0; j < totalGroups; j++) { var price = Trim($("#txtPrice"+j+"_0").val()); for(var z = 1; z <= currencyCount; z++) { var cRate = Trim($("#cRt"+j+"_"+z).val()); if(isFloat(price) && isFloat(cRate)) { var convertedPrice = Round(price * cRate); $("#txtOtherPrice"+j+"_"+z).val(convertedPrice); } } } } }); $("#lnkRmvAltAPI").click(function() { if(confirm ('Are you sure you want to remove alternate API?')) { $('#rmvAltAPILdr').ajaxStart(function() { $('#rmvAltAPILdr').show(); }).ajaxStop(function() { $('#rmvAltAPILdr').hide(); }); $.post(base_url+apanel_name+"/services/ajxaltapi", { id:$('#id').val(), sc:2, purpose:'rmv' }, function(response){ if(response) { showStickyErrorToast(response, '', 'success'); $("#lnkRmvAltAPI").hide(); } }); } else return; }); $('#chkFetchCPr').click(function () { var $this = $(this); var dataId = $(this).data('id'); console.log($(this).prop('checked')); if ($(this).prop('checked')) { $('#imgCPLdr').ajaxStart(function() { $('#imgCPLdr').show(); }).ajaxStop(function() { $('#imgCPLdr').hide(); }); $('span#loading-text').remove(); $this.after('<span id="loading-text"> Loading...</span>'); $.post(base_url+apanel_name+"/settings/ajxcostprice", { apiId:$('#exAPIId').val(), srvcId:$("#exAPIServiceId").val(), packageId:$("#id").val(), serviceType:2, purpose:'getCP' }, function(response){ if(response.status == 1) { $('#txtCostPrice').val(response.price); $('#collapseList_'+dataId).collapse('show'); }else{ showStickyErrorToast(response.message, '', 'error'); } }, 'json').always(function(){ $('span#loading-text').remove(); }); }else{ $('#collapseList_'+dataId).collapse('hide'); } }); var i=1; var field_to_clone = $('#dynamic_field tr').last(); $('#addrow').click(function(){ i++; var new_field_temp = field_to_clone.clone(true, true); new_field_temp.attr({ id: i, class: 'dynamic-added' }); new_field_temp.find('.removeInClone').remove(); new_field_temp.find('td').last().html(`<button type="button" name="btnSave[]" id="row`+i+`" class="btn btn-delete btn_remove"><i class="fa icon-trash"></i></button>`); new_field_temp.find('input:not(:checkbox), select, textarea').val(''); new_field_temp.find('input:checkbox').prop('checked', false); $('#dynamic_field').append(new_field_temp); }); $(document).on('click', '.btn_remove', function(){ $(this).parents('tr').first().remove(); }); $('.addQuantityRang').click(function(e){ $modal.modal('show'); }); }); function getValues(ctrlName, type) { return $(type+"[name='"+ctrlName+"']").map(function(){return $(this).val();}).get(); } $(document).ready(function() { $("#btnAdd").click(function(){ $('#trNR').hide(); var tbl_data = $("#newRow").val(); $("#tblDiscGroups").append(tbl_data); }); $("#tblDisc").on('click','.remCF',function(){ $(this).parent().parent().remove(); }); $(document).on('click','#btnBulkPrices',function(){ $.post(base_url+apanel_name+"/services/server_qty_bulk", { apiId:$('#exAPIId').val(), srvcId:$("#exAPIServiceId").val(), packageId:$("#id").val(), serviceType:2, purpose:'getCP' }, function(response){ if(response.status == 1) { $('#txtCostPrice').val(response.price); }else{ showStickyErrorToast(response.message, '', 'error'); } }, 'json'); }); }); $("#chkCustomPrice").click(function() { if($(this).is(':checked')) { $('.rateCal').each(function(){ var totalCurrencies = $("#totalCurrencies").val(); var price = $(this).val(); var converstionRate = 0; var i = 0; for(i = 0; i < totalCurrencies; i++) { var converterPrice = 0; converstionRate = $("#converstionRate"+i).val(); converterPrice = parseFloat(price * converstionRate); $(this).closest('tr').find('.rateCalEle').eq(i).val(''); } }); } });