Rev 23819 | Rev 23946 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(".price_drop").live('click', function() {loadPriceDrop("main-content");});$("button.addPriceDrop").live('click', function() {if($("#typeaheaditem").val().trim().length == 0){alert("Please choose Item");return;}var priceDrop = $("#pd").val();var newTp = $("#newTp").val();var newMop = $("#newMop").val();var newNlc = $("#newNlc").val();var affectedOn = $("#affectedDate").val();var allColors = $("#allColors").prop('checked');if(priceDrop.length == 0 || parseFloat(priceDrop) == 0) {alert("Price Drop should not be empty");return;}if(newTp.length == 0 || parseFloat(newTp) == 0) {alert("New Tp should not be empty");return;}if(newMop.length == 0 || parseFloat(newMop) == 0) {alert("New Mop should not be empty");return;}if(newNlc.length == 0 || parseFloat(newNlc) == 0) {alert("New Nlc should not be empty");return;}if(affectedOn.length == 0) {alert("Affected Date Should not be empty");return;}if(confirm("Are you sure?")) {var obj = {itemId:currentItem.itemId,tp:parseFloat(newTp),pd:parseFloat(priceDrop),mop:parseFloat(newMop),nlc:parseFloat(newNlc),allColors:allColors,affectedDate:startDate}doPostAjaxRequestWithJsonHandler(context+"/priceDrop", JSON.stringify(obj),function(response) {if (response == 'true') {$('#newPriceDropModal').find('button.close').trigger('click');setTimeout(() => {alert("PriceDrop added successfully")loadPriceDrop("main-content");}, 500);} else {alert("Something went wrong pls try after sometime");}});}});$('#download').live('click', function (){if (confirm("Are you sure you want to Download!") == true) {priceDropId=$(this).data('download');console.log(priceDropId);doAjaxGetDownload(context+"/downloadPriceDropIMEI/"+priceDropId,"priceDrop"+priceDropId+".xlsx");}});$('input.downloadtotalIMEI').live('click', function (){if (confirm("Are you sure you want to Download!") == true) {priceDropId=$(this).closest('tr').data('priceDropId');console.log(priceDropId);doAjaxGetDownload(context+"/downloadtotalPriceDropIMEI/"+priceDropId,"totalPriceDropIMEI"+priceDropId+".xlsx");}});$('#cashTopartner').live('click', function (){if (confirm("Are you sure you want to ProcessAmount!") == true) {priceDropId=$(this).data('cashback');var processedamount=$("#" +priceDropId).val();console.log("#" + priceDropId);//alert(processedamount);if(processedamount){console.log(priceDropId);console.log(processedamount);loadProcessedamount(priceDropId,processedamount);}else{console.log(priceDropId);console.log(processedamount);alert("ProcessedAmount can't be empty");}}});});function loadPriceDrop(domId){doGetAjaxRequestHandler(context+"/getItemDescription", function(response){$('#' + domId).html(response);});}function loadProcessedamount(priceDropId,amount){doPostAjaxRequestHandler(context+"/paymentAgainstPriceDrop/"+priceDropId+"/"+amount,function(response) {if (response == 'true') {alert("PriceDrop sends successfully");loadPriceDrop("main-content");}else{alert("No IMEI is Eligible for PriceDrop");loadPriceDrop("main-content");}});}