Subversion Repositories SmartDukaan

Rev

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

Rev 23819 Rev 23884
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
	$(".price_drop").live('click', function() {
2
	$(".price_drop").live('click', function() {
3
		loadPriceDrop("main-content");
3
		loadPriceDrop("main-content");
4
	});
4
	});
-
 
5
	$("button.addPriceDrop").live('click', function() {
-
 
6
		if($("#typeaheaditem").val().trim().length == 0){
-
 
7
			alert("Please choose Item");
-
 
8
			return;
-
 
9
		}
-
 
10
		var priceDrop = $("#pd").val();
-
 
11
		var newTp = $("#newTp").val();
-
 
12
		var newMop = $("#newMop").val();
-
 
13
		var newNlc = $("#newNlc").val();
-
 
14
		var affectedOn = $("#affectedDate").val();
-
 
15
		var allColors = $("#allColors").prop('checked');
-
 
16
		if(priceDrop.length == 0 || parseFloat(priceDrop) == 0) {
-
 
17
			alert("Price Drop should not be empty");
-
 
18
			return;
-
 
19
		}
-
 
20
		if(newTp.length == 0 || parseFloat(newTp) == 0) {
-
 
21
			alert("New Tp should not be empty");
-
 
22
			return;
-
 
23
		}
-
 
24
		if(newMop.length == 0 || parseFloat(newMop) == 0) {
-
 
25
			alert("New Mop should not be empty");
-
 
26
			return;
-
 
27
		}
-
 
28
		if(newNlc.length == 0 || parseFloat(newNlc) == 0) {
-
 
29
			alert("New Nlc should not be empty");
-
 
30
			return;
-
 
31
		}
-
 
32
 
-
 
33
		if(affectedOn.length == 0) {
-
 
34
			alert("Affected Date Should not be empty");
-
 
35
			return;
-
 
36
		}
-
 
37
		if(confirm("Are you sure?")) {
-
 
38
			var obj = {
-
 
39
					itemId:currentItem.itemId,
-
 
40
					tp:parseFloat(newTp),
-
 
41
					pd:parseFloat(priceDrop),
-
 
42
					mop:parseFloat(newMop),
-
 
43
					nlc:parseFloat(newNlc),
-
 
44
					allColors:allColors,
-
 
45
					affectedDate:startDate
-
 
46
			}
-
 
47
			doPostAjaxRequestWithJsonHandler(
-
 
48
					context+"/priceDrop", JSON.stringify(obj),
-
 
49
					function(response) {
-
 
50
						if (response == 'true') {
-
 
51
							$('#newPriceDropModal').find('button.close').trigger('click');
-
 
52
							setTimeout(() => {
-
 
53
								alert("PriceDrop added successfully")
-
 
54
								loadPriceDrop("main-content");
-
 
55
							}, 500);
-
 
56
						} else {
-
 
57
							alert("Something went wrong pls try after sometime");
-
 
58
						}
-
 
59
					}
-
 
60
			);
-
 
61
		}
-
 
62
	});
5
	$('#download').live('click', function (){
63
	$('#download').live('click', function (){
6
		if (confirm("Are you sure you want to Download!") == true) {
64
		if (confirm("Are you sure you want to Download!") == true) {
7
			priceDropId=$(this).data('download');
65
			priceDropId=$(this).data('download');
8
		console.log(priceDropId);
66
		console.log(priceDropId);
9
		doAjaxGetDownload(context+"/downloadPriceDropIMEI/"+priceDropId,
67
		doAjaxGetDownload(context+"/downloadPriceDropIMEI/"+priceDropId,
10
		"priceDrop"+priceDropId+".xlsx");
68
		"priceDrop"+priceDropId+".xlsx");
11
		}
69
		}
12
	});
70
	});
13
	$('#downloadtotalIMEI').live('click', function (){
71
	$('input.downloadtotalIMEI').live('click', function (){
14
		if (confirm("Are you sure you want to Download!") == true) {
72
		if (confirm("Are you sure you want to Download!") == true) {
15
		priceDropId=$(this).data('pricedropidfortotalimei');
73
		priceDropId=$(this).closest('tr').data('priceDropId');
16
		console.log(priceDropId);
74
		console.log(priceDropId);
17
		doAjaxGetDownload(context+"/downloadtotalPriceDropIMEI/"+priceDropId,
75
		doAjaxGetDownload(context+"/downloadtotalPriceDropIMEI/"+priceDropId,
18
		"totalPriceDropIMEI"+priceDropId+".xlsx");
76
		"totalPriceDropIMEI"+priceDropId+".xlsx");
19
		}
77
		}
20
	});
78
	});