Subversion Repositories SmartDukaan

Rev

Rev 27755 | Rev 30017 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
25721 tejbeer 1
$(function() {
27081 tejbeer 2
 
27755 amit.gupta 3
	$(document).on('click', 'button.imeiactivationsupload',
29667 tejbeer 4
		function() {
5
			debugger;
6
			var fileSelector = $('#imeiactivations')[0];
7
			if (fileSelector != undefined
8
				&& fileSelector.files[0] != undefined) {
9
				if (confirm("Confirm Upload?")) {
10
					doAjaxUploadRequestHandler(context + "/imei/upload",
11
						"POST", fileSelector.files[0], function(
12
							response) {
13
						if (response) {
14
							alert("Content updated successfully");
15
						}
16
					});
27081 tejbeer 17
				}
29667 tejbeer 18
			} else {
19
				alert("Please upload file!");
20
			}
21
			return false;
22
		});
25736 tejbeer 23
 
27755 amit.gupta 24
	$(document).on('click', ".focused_model",
29667 tejbeer 25
		function() {
26
			loadModel("main-content");
25736 tejbeer 27
 
29667 tejbeer 28
			$(document).on('click', "#focused-model-paginated .next",
29
				function() {
30
					loadPaginatedNextItems('/getPaginatedFocusedModel',
31
						null, 'focused-model-paginated',
32
						'focused-model-table',
33
						'focused-model-container');
25736 tejbeer 34
 
29667 tejbeer 35
					$(this).blur();
36
				});
25736 tejbeer 37
 
29667 tejbeer 38
			$(document).on('click', "#focused-model-paginated .previous",
39
				function() {
25736 tejbeer 40
 
29667 tejbeer 41
					loadPaginatedPreviousItems(
42
						'/getPaginatedFocusedModel', null,
43
						'focused-model-paginated',
44
						'focused-model-table',
45
						'focused-model-container');
25721 tejbeer 46
 
29667 tejbeer 47
					$(this).blur();
48
				});
27081 tejbeer 49
 
29667 tejbeer 50
		});
27081 tejbeer 51
 
27755 amit.gupta 52
	$(document).on('click', ".add-model",
29667 tejbeer 53
		function() {
54
			var catalogId = itemCatalogId;
55
			var recommended = $('#recommended').val();
56
			var minimumQty = $('#minimumQuantity').val();
25721 tejbeer 57
 
58
 
29667 tejbeer 59
			var obvRecommended = $('#obvrecommended').val();
60
			var obvMinimumQty = $('#obvminimumQuantity').val();
61
 
62
 
63
			var regionId = $('#regionType').val();
64
 
65
 
66
			if (catalogId === null) {
67
				alert("please choose item");
68
				return;
69
			}
70
 
71
			if (recommended != "" && minimumQty == "") {
72
				alert("please fill minimumQty qty");
73
				return;
74
			}
75
 
76
			if (recommended == "" && minimumQty != "") {
77
				alert("please fill recommended qty");
78
				return;
79
			}
80
 
81
 
82
			if (obvRecommended != "" && obvMinimumQty == "") {
83
				alert("please fill obvMinimum qty");
84
				return;
85
			}
86
 
87
			if (obvRecommended == "" && obvMinimumQty != "") {
88
				alert("please fill obvRecommended qty");
89
				return;
90
			}
91
 
92
			if (regionId == "") {
93
				alert("Select Region");
94
				return;
95
			}
96
			var params = {
97
				"catalogId": catalogId,
98
				"recommended": recommended,
99
				"minimumQty": minimumQty,
100
				"obvrecommend": obvRecommended,
101
				"obvminimum": obvMinimumQty,
102
				"regionId": regionId,
103
 
104
			}
105
			if (confirm("Are you sure you want to add item!") == true) {
106
				doPostAjaxRequestWithParamsHandler(context
107
					+ "/focusedModel", params, function(response) {
25721 tejbeer 108
						alert("Add Item Successfully");
109
						loadModel("main-content");
110
					});
29667 tejbeer 111
			}
112
		});
25721 tejbeer 113
 
27755 amit.gupta 114
	$(document).on('click', ".remove-model",
29667 tejbeer 115
		function() {
116
			if (confirm("Are you sure you want to Remove the Item") == true) {
117
				id = $(this).data('requestid');
118
				console.log(id);
119
				doDeleteAjaxRequestHandler(context
120
					+ "/removeItem?id=" + id,
121
					function(response) {
122
						if (response == 'true') {
123
							alert("successfully Removed");
124
							loadModel("main-content");
25721 tejbeer 125
						}
126
 
127
					});
29667 tejbeer 128
			}
129
 
130
		});
25721 tejbeer 131
});
132
 
133
function loadModel(domId) {
134
	doGetAjaxRequestHandler(context + "/getFocusedModel", function(response) {
135
		$('#' + domId).html(response);
136
	});
137
}