Subversion Repositories SmartDukaan

Rev

Rev 23951 | Rev 23968 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23951 Rev 23966
Line 59... Line 59...
59
					}
59
					}
60
			);
60
			);
61
		}
61
		}
62
	});
62
	});
63
	$('input.downloadtotalIMEI').live('click', function (){
63
	$('input.downloadtotalIMEI').live('click', function (){
64
		priceDropId=$(this).closest('tr').data('pricedropid');
64
		var priceDropId=$(this).closest('tr').data('pricedropid');
65
		console.log(priceDropId);
-
 
66
		doAjaxGetDownload(context+"/downloadtotalPriceDropIMEI/"+priceDropId,
65
		doAjaxGetDownload(context+"/downloadtotalPriceDropIMEI/"+priceDropId,
67
		"totalPriceDropIMEI"+priceDropId+".xlsx");
66
		"totalPriceDropIMEI"+priceDropId+".xlsx");
68
	});
67
	});
69
	
68
	
70
	$('button.download-imeis').live('click', function(){
69
	$('button.download-imeis').live('click', function(){
71
		doAjaxGetDownload(context+"/price-drop/imes/download/?affectedDate="+startDate +"&itemId=" + currentItem.itemId, "pricedrop.csv")
70
		doAjaxGetDownload(context+"/price-drop/imes/download/?affectedDate="+startDate +"&itemId=" + currentItem.itemId, "pricedrop.csv")
72
	});
71
	});
73
	
72
	
74
	
73
	
75
	$('#cashTopartner').live('click', function (){
74
	$('.mk_process_price_drop').live('click', function (){
76
		if (confirm("Are you sure you want to ProcessAmount!") == true) {
75
		if (confirm("Are you sure you want to Process price Drop?")) {
77
			priceDropId=$(this).data('cashback');
76
			var trElement=$(this).closest('tr');
78
		var processedamount=$("#" +priceDropId).val();
77
			var priceDropId = trElement.data('pricedropid');
-
 
78
			var partnerPayout = trElement.find('partner-payout');
79
		console.log("#" + priceDropId);
79
			var priceDropIn = trElement.find('price-drop-in');
-
 
80
	
80
		// alert(processedamount);
81
			if(isNaN(partnerPayout) || partnerPayout == 0) {
81
		if(processedamount)
82
				alert("Partner Payout can't be 0");
82
			{
83
				return false;
83
		console.log(priceDropId);
84
			} else if (isNaN(priceDropIn) || priceDropIn == 0) {
84
		console.log(processedamount);
85
				alert("Price Drop can't be 0");
85
		loadProcessedamount(priceDropId,processedamount);
86
				return false;
86
		}
87
			}
87
		else
88
			else {
88
			{
89
				let priceDropObj = {
89
			console.log(priceDropId);
90
						priceDropIn:parseFloat(priceDropIn), 
90
			console.log(processedamount);
91
						partnerPayout: parseFloat(partnerPayout), 
-
 
92
						priceDropId:parseInt(priceDropId)
-
 
93
				};
91
			alert("ProcessedAmount can't be empty");
94
				processPayout(priceDropObj); 
92
			}
95
			}
93
		}
96
		}
-
 
97
		else {
-
 
98
			return false;
-
 
99
		}
94
	});
100
	});
95
	
-
 
96
});
101
});
-
 
102
 
97
function loadPriceDrop(domId){
103
function loadPriceDrop(domId){
98
	doGetAjaxRequestHandler(context+"/getItemDescription", function(response){
104
	doGetAjaxRequestHandler(context+"/getItemDescription", function(response){
99
		$('#' + domId).html(response);
105
		$('#' + domId).html(response);
100
	});
106
	});
101
}
107
}
102
function loadProcessedamount(priceDropId,amount){
108
function processPayout(priceDropProcessObj){
103
	doPostAjaxRequestHandler(context+"/paymentAgainstPriceDrop/"+priceDropId+"/"+amount,
109
	doPostAjaxRequestWithJsonHandler(context+"/processPriceDrop", priceDropProcessObj, function(response) {
104
		function(response) {
-
 
105
			if (response == 'true') {
110
		if (response == 'true') {
106
				alert("PriceDrop sends successfully");
111
			alert("PriceDrop sends successfully");
107
				loadPriceDrop("main-content");
112
			loadPriceDrop("main-content");
108
			}
113
		}
109
			else
114
		else {
110
				{
-
 
111
				alert("No IMEI is Eligible for PriceDrop");
115
			alert("No IMEI is Eligible for PriceDrop");
112
				loadPriceDrop("main-content");
116
			loadPriceDrop("main-content");
113
				}
117
		}
114
	});
118
	});
115
 
-
 
116
}
119
}
-
 
120