Subversion Repositories SmartDukaan

Rev

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

Rev 30054 Rev 30122
Line 1... Line 1...
1
$(function() {
1
$(function () {
2
	$(document).on('click', ".create-scheme", function() {
2
	$(document).on('click', ".create-scheme", function () {
3
		loadScheme("main-content");
3
		loadScheme("main-content");
4
	});
4
	});
5
 
-
 
6
	
-
 
7
	$(document).on('click', "#schemes-paginated .next",
-
 
8
		function() {
-
 
9
			var category = $('#partner-category').val();
-
 
10
			var searchText = $("#scheme-item-search-text").val();
-
 
11
 
-
 
12
			var category = $('#partner-category').val();
-
 
13
			if (typeof (searchText) == "undefined" || !searchText) {
-
 
14
				searchText = "";
-
 
15
			}
-
 
16
			if (typeof (category) == "undefined" || !category) {
-
 
17
				category = "";
-
 
18
			}
-
 
19
 
-
 
20
			if ((searchText) && (category)) {
-
 
21
 
-
 
22
				var params = {};
-
 
23
				params['searchItem'] = currentItem.itemId;
-
 
24
				params['partnerType'] = category
-
 
25
				loadPaginatedNextItems('/getPaginatedSchemes', params,
-
 
26
					'schemes-paginated', 'schemes-table',
-
 
27
					'scheme-details-container');
-
 
28
 
-
 
29
			} else if ((searchText)) {
-
 
30
				var params = {};
-
 
31
				params['searchItem'] = currentItem.itemId;
-
 
32
				loadPaginatedNextItems('/getPaginatedSchemes', params,
-
 
33
					'schemes-paginated', 'schemes-table',
-
 
34
					'scheme-details-container');
-
 
35
 
-
 
36
			} else {
-
 
37
				var params = {};
-
 
38
				params['partnerType'] = category
-
 
39
				loadPaginatedNextItems('/getPaginatedSchemes', params,
-
 
40
					'schemes-paginated', 'schemes-table',
-
 
41
					'scheme-details-container');
-
 
42
			}
-
 
43
			$(this).blur();
-
 
44
		});
-
 
45
 
-
 
46
	$(document).on('click', "#schemes-paginated .previous",
-
 
47
		function() {
-
 
48
			var searchText = $("#scheme-item-search-text").val();
-
 
49
			var category = $('#partner-category').val();
-
 
50
			// var searchTxt=$("#scheme-search-text").val();
-
 
51
			console.log(searchText);
-
 
52
			if (typeof (searchText) == "undefined" || !searchText) {
-
 
53
				searchText = "";
-
 
54
			}
-
 
55
			if (typeof (category) == "undefined" || !category) {
-
 
56
				category = "";
-
 
57
			}
-
 
58
 
-
 
59
			console.log(searchText)
-
 
60
 
-
 
61
			if ((searchText) && (category)) {
-
 
62
 
-
 
63
				var params = {};
-
 
64
				params['searchItem'] = currentItem.itemId;
-
 
65
				params['partnerType'] = category
-
 
66
				loadPaginatedPreviousItems('/getPaginatedSchemes', params,
-
 
67
					'schemes-paginated', 'schemes-table',
-
 
68
					'scheme-details-container');
-
 
69
 
-
 
70
			} else if ((searchText)) {
-
 
71
				var params = {};
-
 
72
				params['searchItem'] = currentItem.itemId;
-
 
73
				loadPaginatedPreviousItems('/getPaginatedSchemes', params,
-
 
74
					'schemes-paginated', 'schemes-table',
-
 
75
					'scheme-details-container');
-
 
76
 
-
 
77
			} else {
-
 
78
				var params = {};
-
 
79
				params['partnerType'] = category
-
 
80
				loadPaginatedPreviousItems('/getPaginatedSchemes', params,
-
 
81
					'schemes-paginated', 'schemes-table',
-
 
82
					'scheme-details-container');
-
 
83
			}
-
 
84
			$(this).blur();
-
 
85
		});
-
 
86
 
-
 
87
	$(document).on('click', ".scheme-details", function() {
5
	$(document).on('click', ".scheme-details", function () {
88
		var schemeId = $(this).attr('data');
6
		var schemeId = $(this).attr('data');
89
		console.log("schemeId = " + schemeId);
7
		console.log("schemeId = " + schemeId);
90
		loadSchemeDetails(schemeId, "scheme-details-container");
8
		loadSchemeDetails(schemeId, "scheme-details-container");
91
	});
9
	});
92
 
-
 
93
	$(document).on('click', ".active-scheme", function() {
10
	$(document).on('click', ".active-scheme", function () {
94
		var schemeId = $(this).attr('data');
11
		var schemeId = $(this).attr('data');
95
		console.log("active-scheme id : " + schemeId);
12
		console.log("active-scheme id : " + schemeId);
96
		var start = $("#schemes-paginated .start").text();
13
		var start = $("#schemes-paginated .start").text();
97
		// var end = $( "#schemes-paginated .end" ).text();
14
		// var end = $( "#schemes-paginated .end" ).text();
98
		var offset = start - 1;
15
		var offset = start - 1;
99
		if (confirm("Are you sure you want to Active Scheme!") == true) {
16
		if (confirm("Are you sure you want to Active Scheme!")) {
100
			activeScheme(schemeId, offset, "schemes-table");
17
			activeScheme(schemeId, offset, "schemes-table");
101
		}
18
		}
102
	});
19
	});
103
 
20
 
104
	$(document).on('click', ".expire-scheme", function() {
21
	$(document).on('click', ".expire-scheme", function () {
105
		var schemeId = $(this).attr('data');
22
		var schemeId = $(this).attr('data');
106
		var expireDate = startDate;
23
		var expireDate = startDate;
107
		var start = $("#schemes-paginated .start").text();
24
		var start = $("#schemes-paginated .start").text();
108
		// var end = $( "#schemes-paginated .end" ).text();
25
		// var end = $( "#schemes-paginated .end" ).text();
109
		var offset = start - 1;
26
		var offset = start - 1;
110
		if (confirm("Are you sure you want to Expire Scheme!") == true) {
27
		if (confirm("Are you sure you want to Expire Scheme!")) {
111
			expireScheme(schemeId, expireDate, offset, "schemes-table");
28
			expireScheme(schemeId, expireDate, offset, "schemes-table");
112
		}
29
		}
113
	});
30
	});
114
	$(document).on('click', "#extendDatetime-button",
31
	$(document).on('click', "#extendDatetime-button",
115
		function() {
32
		function () {
116
			console.log("extendAll button click");
33
			console.log("extendAll button click");
117
			var extendDatetime = $('input[name="extendDatetime"]')
34
			var extendDatetime = $('input[name="extendDatetime"]')
118
				.val();
35
				.val();
119
			console.log("extendDatetime : " + extendDatetime);
36
			console.log("extendDatetime : " + extendDatetime);
120
			if (extendDatetime) {
37
			if (extendDatetime) {
121
				if (confirm("Are you sure you want to Extend expireDateTime for All Scheme!") == true) {
38
				if (confirm("Are you sure you want to Extend expireDateTime for All Scheme!")) {
122
					extendAllScheme(extendDatetime, "schemes-table")
39
					extendAllScheme(extendDatetime, "schemes-table")
123
				}
40
				}
124
			} else {
41
			} else {
125
				alert("feild can't be blank");
42
				alert("feild can't be blank");
126
			}
43
			}
127
		});
44
		});
128
	$(document).on('click', "#extendScheme-button",
45
	$(document).on('click', "#extendScheme-button",
129
		function() {
46
		function () {
130
			console.log("extend button click");
47
			console.log("extend button click");
131
			var extendDatetime = $('input[name="extendScheme"]')
48
			var extendDatetime = $('input[name="extendScheme"]')
132
				.val();
49
				.val();
133
			var schemeId = $('#schemeId').val()
50
			var schemeId = $('#schemeId').val()
134
			console.log("extendDatetime : " + extendDatetime);
51
			console.log("extendDatetime : " + extendDatetime);
Line 137... Line 54...
137
				if (confirm("Are you sure you want to Extend expireDateTime for Scheme!") == true) {
54
				if (confirm("Are you sure you want to Extend expireDateTime for Scheme!") == true) {
138
					extendSchemeById(schemeId)
55
					extendSchemeById(schemeId)
139
				}
56
				}
140
			} else {
57
			} else {
141
				alert("field can't be blank");
58
				alert("field can't be blank");
142
			}	
59
			}
143
		});
60
		});
144
	
61
 
145
	
62
 
146
	$(document).on('click', ".monthy-investment",
63
	$(document).on('click', ".monthy-investment",
147
			function() {
64
		function () {
148
		console.log("hello evaluateActualInvestmentPayout");
65
			console.log("hello evaluateActualInvestmentPayout");
149
		window.location.href = context + "/evaluateActualInvestmentPayout";		
66
			window.location.href = context + "/evaluateActualInvestmentPayout";
150
		
67
 
151
			});
68
		});
152
	
69
 
153
$(document).on('click', ".process-investment", function() {
70
	$(document).on('click', ".process-investment", function () {
154
		if (confirm("Are you sure you want to Process Investment")) {
71
		if (confirm("Are you sure you want to Process Investment")) {
155
			processInvestment();
72
			processInvestment();
156
		}
73
		}
157
	});
74
	});
158
 
75
 
159
	
76
 
160
	$(document).on('click', ".processInvestmentDryRun",
77
	$(document).on('click', ".processInvestmentDryRun",
161
			function() {
78
		function () {
162
		console.log("processInvestmentDryRun");
79
			console.log("processInvestmentDryRun");
163
		window.location.href = context + "/processInvestmentDryRun";		
80
			window.location.href = context + "/processInvestmentDryRun";
164
		
81
 
165
			});
82
		});
166
	
83
 
167
	$(document).on('click', ".brand-wise-income",
84
	$(document).on('click', ".brand-wise-income",
168
			function() {
85
		function () {
169
	var	brand = $(this).data('brand');
86
			var brand = $(this).data('brand');
170
	
87
 
171
	var	status = $(this).data('status');
88
			var status = $(this).data('status');
172
	var month = 	$(this).data('month');
89
			var month = $(this).data('month');
173
	
90
 
174
		brandWiseIncome(brand,month,status);
91
			brandWiseIncome(brand, month, status);
175
		
92
 
176
			});
93
		});
177
	
94
 
178
	$(document).on('click', ".imei_wise_income",
95
	$(document).on('click', ".imei_wise_income",
179
			function() {
96
		function () {
180
		
-
 
181
		
-
 
182
	var	catalogItemId = $(this).data('catalogitemid');
-
 
183
	var month = 	$(this).data('month');
-
 
184
	
-
 
185
  console.log(catalogItemId);
-
 
186
  imeiWiseIncome(catalogItemId,month);
-
 
187
		
-
 
188
			});
-
 
189
	
-
 
190
	 $(document).on('change', "#month-wise-income", function() {
-
 
191
	       	var month = 	$(this).val();
-
 
192
	       	
-
 
193
	        monthWiseIncome(month,"main-content");
-
 
194
	              	});
-
 
195
	
-
 
196
	
-
 
197
	
-
 
198
 
97
 
-
 
98
 
-
 
99
			var catalogItemId = $(this).data('catalogitemid');
-
 
100
			var month = $(this).data('month');
-
 
101
 
-
 
102
			console.log(catalogItemId);
-
 
103
			imeiWiseIncome(catalogItemId, month);
-
 
104
 
-
 
105
		});
-
 
106
 
-
 
107
	$(document).on('change', "#month-wise-income", function () {
-
 
108
		var month = $(this).val();
-
 
109
 
-
 
110
		monthWiseIncome(month, "main-content");
-
 
111
	});
-
 
112
 
-
 
113
 
199
	$(document).on('click', ".schemes", function() {
114
	$(document).on('click', ".schemes", function () {
-
 
115
		schemes("main-content");
200
		console.log("Active Schemes Button Clicked...")
116
		console.log("Active Schemes Button Clicked...")
201
 
117
 
202
		bootbox.confirm({
118
		/*bootbox.confirm({
203
			message: "<div class = 'disclosurehindata'> <img src='resources/images/disclosure.png' style='width:100%'> </div>"
119
			message: "<div class = 'disclosurehindata'> <img src='resources/images/disclosure.png' style='width:100%'> </div>"
204
			,
120
			,
205
			buttons: {
121
			buttons: {
206
				confirm: {
122
				confirm: {
207
					label: 'I agree',
123
					label: 'I agree',
Line 210... Line 126...
210
				cancel: {
126
				cancel: {
211
					label: 'I disagree',
127
					label: 'I disagree',
212
					className: 'btn-danger'
128
					className: 'btn-danger'
213
				}
129
				}
214
			},
130
			},
215
			callback: function(result) {
131
			callback: function (result) {
216
				if (result == true) {
132
				if (result == true) {
217
					schemes("main-content");
-
 
218
				}
133
				}
219
			}
134
			}
220
		});
135
		});*/
221
 
136
 
222
	});
137
	});
223
 
138
 
224
	$(document).on('click', ".margin-calculator", function() {
139
	$(document).on('click', ".margin-calculator", function () {
225
		console.log("Active Schemes Button Clicked...")
140
		console.log("Active Schemes Button Clicked...")
226
		marginCalculator("main-content");
141
		marginCalculator("main-content");
227
	});
142
	});
228
 
143
 
229
	$(document).on('click', ".schemes-download-page", function() {
144
	$(document).on('click', ".schemes-download-page", function () {
230
		console.log("Schemes Download Clicked...")
145
		console.log("Schemes Download Clicked...")
231
		loadSchemesDownloadPage("main-content");
146
		loadSchemesDownloadPage("main-content");
232
	});
147
	});
233
 
148
 
234
	$(document).on('click', ".schemes-update", function() {
149
	$(document).on('click', ".schemes-update", function () {
235
		loadSchemeUpdatePage("main-content");
150
		loadSchemeUpdatePage("main-content");
236
	});
151
	});
237
 
152
 
238
	$(document).on('click', ".add-item", function() {
153
	$(document).on('click', ".add-item", function () {
239
 
154
 
240
		schemeIds = $("#schemeids").val();
155
		schemeIds = $("#schemeids").val();
241
		itemIds = $("#itemids").val();
156
		itemIds = $("#catalogids").val();
242
		console.log(schemeIds);
-
 
243
		console.log(itemIds);
-
 
244
		if (confirm("Are you sure you want to Add Item to Scheme!") == true) {
157
		if (confirm("Are you sure you want to Add Model to Scheme!") == true) {
245
			if (itemIds.trim().length === 0 || schemeIds.trim().length === 0) {
158
			if (catalogIds.trim().length === 0 || schemeIds.trim().length === 0) {
246
				alert("fields shouldn't be blank");
159
				alert("fields shouldn't be blank");
247
				return;
160
				return;
248
			}
161
			}
249
			updateSingleScheme(schemeIds, itemIds);
162
			updateSingleScheme(schemeIds, catalogIds);
250
		}
163
		}
251
	});
164
	});
252
	$(document).on('click', ".add-schemes", function() {
165
	$(document).on('click', ".add-schemes", function () {
-
 
166
 
-
 
167
		let schemeIds = $("#schemeids").val();
-
 
168
		let catalogIds = $("#catalogids").val();
253
 
169
 
254
		schemeIds = $("#schemeids").val();
-
 
255
		itemIds = $("#itemids").val();
-
 
256
		console.log(schemeIds);
-
 
257
		console.log(itemIds);
-
 
258
		if (confirm("Are you sure you want to Add Item to Scheme!") == true) {
170
		if (confirm("Are you sure you want to Add Item to Scheme!") == true) {
259
			if (itemIds.trim().length === 0 || schemeIds.trim().length === 0) {
171
			if (catalogIds.trim().length === 0 || schemeIds.trim().length === 0) {
260
				alert("fields shouldn't be blank");
172
				alert("fields shouldn't be blank");
261
				return;
173
				return;
262
			}
174
			}
263
			updateSchemes(schemeIds, itemIds);
175
			updateSchemes(schemeIds, catalogIds);
264
		}
176
		}
265
	});
177
	});
266
	$(document).on('click', ".delete-schemes", function() {
178
	$(document).on('click', ".delete-schemes", function () {
267
		if (confirm("Are you sure you want to delete Scheme!") == true) {
179
		if (confirm("Delete model from Scheme?") == true) {
268
			schemeId = $(this).data('schemeid');
180
			schemeId = $(this).data('schemeid');
269
			itemId = $(this).data('itemid');
181
			catalogId = $(this).data('catalogid');
270
			console.log(schemeId);
-
 
271
			console.log(itemId);
-
 
272
			deleteScheme(schemeId, itemId);
182
			deleteScheme(schemeId, catalogId);
273
		}
183
		}
274
	});
184
	});
275
 
185
 
276
	$(document).on('click', "#scheme-search-button",
186
	$(document).on('click', "#scheme-search-button",
277
		function() {
187
		function () {
278
			var searchText = $("#scheme-search-text").val();
188
			var searchText = $("#scheme-search-text").val();
279
			if (typeof (searchText) == "undefined" || !searchText) {
189
			if (typeof (searchText) == "undefined" || !searchText) {
280
				searchText = "";
190
				searchText = "";
281
			}
191
			}
282
			doGetAjaxRequestHandler(context + "/getSchemes?searchTerm="
192
			doGetAjaxRequestHandler(context + "/getSchemes?searchScheme="
283
				+ searchText, function(response) {
193
				+ searchText, function (response) {
284
					$('#' + "main-content").html(response);
194
				$('#' + "main-content").html(response);
285
				});
195
			});
286
		});
196
		});
287
 
197
 
288
	$(document).on("keyup", "#scheme-search-text", function(e) {
198
	$(document).on("keyup", "#scheme-search-text", function (e) {
289
		var keyCode = e.keyCode || e.which;
199
		var keyCode = e.keyCode || e.which;
290
		if (keyCode == 13) {
200
		if (keyCode == 13) {
291
			$("#scheme-search-button").click();
201
			$("#scheme-search-button").click();
292
		}
202
		}
293
	});
203
	});
294
	$(document).on('click', "#scheme-item-search-button", function() {
204
	$(document).on('click', "#scheme-item-search-button", function () {
295
		var searchText = $("#scheme-item-search-text").val();
205
		var searchText = $("#scheme-item-search-text").val();
296
		var date = $(".schemes-date").val();
206
		var date = $(".schemes-date").val();
297
		if (typeof (searchText) == "undefined" || !searchText) {
207
		if (typeof (searchText) == "undefined" || !searchText) {
298
			searchText = "";
208
			searchText = "";
299
			alert("please select item");
209
			alert("please select item");
Line 307... Line 217...
307
			alert("Data No Found")
217
			alert("Data No Found")
308
		}
218
		}
309
	});
219
	});
310
 
220
 
311
 
221
 
312
	$(document).on('click', "#scheme-imei-search-button", function() {
222
	$(document).on('click', "#scheme-imei-search-button", function () {
313
		var searchText = $("#scheme-imei-search-text").val();
223
		var searchText = $("#scheme-imei-search-text").val();
314
		var date = $(".schemes-date").val();
224
		var date = $(".schemes-date").val();
315
		if (typeof (searchText) == "undefined" || !searchText) {
225
		if (typeof (searchText) == "undefined" || !searchText) {
316
			searchText = "";
226
			searchText = "";
317
			alert("please select imei");
227
			alert("please select imei");
Line 324... Line 234...
324
			console.log("reeffff")
234
			console.log("reeffff")
325
			alert("Data No Found")
235
			alert("Data No Found")
326
		}
236
		}
327
	});
237
	});
328
	$(document).on('click', ".categoryWiseSchemeHistory",
238
	$(document).on('click', ".categoryWiseSchemeHistory",
329
		function() {
239
		function () {
330
			var category = $('#partner-category').val();
240
			var category = $('#partner-category').val();
331
			console.log(category);
241
			console.log(category);
332
 
242
 
333
			doGetAjaxRequestHandler(context + "/getSchemes?partnerType="
243
			doGetAjaxRequestHandler(context + "/getSchemes?partnerType="
334
				+ category, function(response) {
244
				+ category, function (response) {
335
					$('#' + "main-content").html(response);
245
				$('#' + "main-content").html(response);
336
					$('#partner-category').val(category);
246
				$('#partner-category').val(category);
337
					window.dispatchEvent(new Event('resize'));
247
				window.dispatchEvent(new Event('resize'));
338
				});
248
			});
339
 
249
 
340
		});
250
		});
341
 
251
 
342
	$(document).on("keyup", "#scheme-item-search-text", function(e) {
252
	$(document).on("keyup", "#scheme-item-search-text", function (e) {
343
		var keyCode = e.keyCode || e.which;
253
		var keyCode = e.keyCode || e.which;
344
		if (keyCode == 13) {
254
		if (keyCode == 13) {
345
			$("#scheme-item-search-button").click();
255
			$("#scheme-item-search-button").click();
346
		}
256
		}
347
	});
257
	});
Line 369... Line 279...
369
	console.log("endDateTime : " + endDateTime);
279
	console.log("endDateTime : " + endDateTime);
370
	doAjaxGetDownload(context + "/schemes/download?startDateTime="
280
	doAjaxGetDownload(context + "/schemes/download?startDateTime="
371
		+ startDateTime + "&endDateTime=" + endDateTime,
281
		+ startDateTime + "&endDateTime=" + endDateTime,
372
		"SchemesReport.xlsx");
282
		"SchemesReport.xlsx");
373
}
283
}
-
 
284
 
374
function selectedbrand() {
285
function selectedbrand() {
375
	var brands = $('#tag-listing-brands').val();
286
	var brands = $('#tag-listing-brands').val();
376
	console.log(brands);
287
	console.log(brands);
377
	if (brands) {
288
	if (brands) {
378
		loadTagListingItemsDescriptionByBrand(
289
		loadTagListingItemsDescriptionByBrand(
379
			"tag-listing-items-description-container", brands);
290
			"tag-listing-items-description-container", brands);
380
	}
291
	}
381
}
292
}
-
 
293
 
382
function loadSchemeDetails(schemeId, domId) {
294
function loadSchemeDetails(schemeId, domId) {
383
	doGetAjaxRequestHandler(context + "/getSchemeById?schemeId=" + schemeId,
295
	doGetAjaxRequestHandler(context + "/getSchemeById?schemeId=" + schemeId,
384
		function(response) {
296
		function (response) {
385
			$('#' + domId).html(response);
297
			$('#' + domId).html(response);
386
			window.dispatchEvent(new Event('resize'));
298
			window.dispatchEvent(new Event('resize'));
387
		});
299
		});
388
}
300
}
389
 
301
 
390
function activeScheme(schemeId, offset, domId) {
302
function activeScheme(schemeId, offset, domId) {
391
	doPutAjaxRequestHandler(context + "/activeSchemeById?schemeId=" + schemeId
303
	doPutAjaxRequestHandler(context + "/activeSchemeById?schemeId=" + schemeId
392
		+ "&offset=" + offset, function(response) {
304
		+ "&offset=" + offset, function (response) {
393
			$('#' + domId).html(response);
305
		$('#' + domId).html(response);
394
			$('#scheme-details-container').html('');
306
		$('#scheme-details-container').html('');
395
		});
307
	});
396
 
308
 
397
}
309
}
398
 
310
 
399
function expireScheme(schemeId, expireDate, offset, domId) {
311
function expireScheme(schemeId, expireDate, offset, domId) {
400
	doPutAjaxRequestHandler(context + "/expireSchemeById?schemeId=" + schemeId
312
	doPutAjaxRequestHandler(context + "/expireSchemeById?schemeId=" + schemeId
401
		+ "&offset=" + offset + "&expireTimestamp=" + expireDate, function(
313
		+ "&offset=" + offset + "&expireTimestamp=" + expireDate, function (
402
			response) {
314
		response) {
403
		alert("Scheme - " + schemeId + " marked for expiry successfully!");
315
		alert("Scheme - " + schemeId + " marked for expiry successfully!");
404
		$('#' + domId).html(response);
316
		$('#' + domId).html(response);
405
		$('#scheme-details-container').html('');
317
		$('#scheme-details-container').html('');
406
	});
318
	});
407
}
319
}
-
 
320
 
408
function extendAllScheme(domId) {
321
function extendAllScheme(domId) {
409
	doPostAjaxRequestWithJsonHandler(context + "/extendAllSchemes", JSON
322
	doPostAjaxRequestWithJsonHandler(context + "/extendAllSchemes", JSON
410
		.stringify(startDate), function(response) {
323
		.stringify(startDate), function (response) {
411
			if (response == 'true') {
324
		if (response == 'true') {
412
				alert("Scheme All Extended successfully");
325
			alert("Scheme All Extended successfully");
413
				schemes("main-content");
326
			schemes("main-content");
414
			} else {
327
		} else {
415
				alert("No scheme Activated Currently");
328
			alert("No scheme Activated Currently");
416
				schemes("main-content");
329
			schemes("main-content");
417
			}
330
		}
418
		});
331
	});
419
 
332
 
420
}
333
}
-
 
334
 
421
function extendSchemeById(schemeId) {
335
function extendSchemeById(schemeId) {
422
	doPostAjaxRequestWithJsonHandler(context + "/extendSchemeById?schemeId="
336
	doPostAjaxRequestWithJsonHandler(context + "/extendSchemeById?schemeId="
423
		+ schemeId, JSON.stringify(startDate), function(response) {
337
		+ schemeId, JSON.stringify(startDate), function (response) {
424
			if (response == 'true') {
338
		if (response == 'true') {
425
				alert("Scheme extended successfully");
339
			alert("Scheme extended successfully");
426
				schemes("main-content");
340
			schemes("main-content");
427
			} else {
341
		} else {
428
				alert("Scheme already Expired");
342
			alert("Scheme already Expired");
429
				schemes("main-content");
343
			schemes("main-content");
430
			}
344
		}
431
		});
345
	});
432
 
346
 
433
}
347
}
-
 
348
 
434
function processInvestment() {
349
function processInvestment() {
435
	doPostAjaxRequestWithJsonHandler(context + "/payMonthlyInvestment", function(response) {
350
	doPostAjaxRequestWithJsonHandler(context + "/payMonthlyInvestment", function (response) {
436
		alert("InvestmentPayout processed successfully");
351
		alert("InvestmentPayout processed successfully");
437
	});
352
	});
438
}
353
}
439
 
354
 
440
function loadScheme(domId) {
355
function loadScheme(domId) {
441
	doGetAjaxRequestHandler(context + "/createScheme", function(response) {
356
	doGetAjaxRequestHandler(context + "/createScheme", function (response) {
442
		$('#' + domId).html(response);
357
		$('#' + domId).html(response);
443
	});
358
	});
444
 
359
 
445
}
360
}
446
 
361
 
447
function loadTagListingItemsDescriptionByBrand(domId, brands) {
362
function loadTagListingItemsDescriptionByBrand(domId, brands) {
448
	doPostAjaxRequestWithJsonHandler(context + '/getTagListingItemsByBrand',
363
	doPostAjaxRequestWithJsonHandler(context + '/getTagListingItemsByBrand',
449
		JSON.stringify(brands), function(response) {
364
		JSON.stringify(brands), function (response) {
450
			$('#' + domId).html(response);
365
			$('#' + domId).html(response);
451
			debugger;
366
			debugger;
452
			configureTagListingItemsDescriptionDropDown();
367
			configureTagListingItemsDescriptionDropDown();
453
		});
368
		});
454
 
369
 
455
}
370
}
456
 
371
 
457
function schemes(domId) {
372
function schemes(domId) {
458
	doGetAjaxRequestHandler(context + "/getSchemes", function(response) {
373
	doGetAjaxRequestHandler(context + "/getSchemes", function (response) {
459
		$('#' + domId).html(response);
374
		$('#' + domId).html(response);
460
	});
375
	});
461
}
376
}
-
 
377
 
462
function marginCalculator(domId) {
378
function marginCalculator(domId) {
463
	doGetAjaxRequestHandler(context + "/getMarginCalculator", function(response) {
379
	doGetAjaxRequestHandler(context + "/getMarginCalculator", function (response) {
464
		$('#' + domId).html(response);
380
		$('#' + domId).html(response);
465
	});
381
	});
466
}
382
}
467
 
383
 
468
function loadSchemesDownloadPage(domId) {
384
function loadSchemesDownloadPage(domId) {
469
	doGetAjaxRequestHandler(context + "/schemes/downloadPage", function(
385
	doGetAjaxRequestHandler(context + "/schemes/downloadPage", function (
470
		response) {
386
		response) {
471
		$('#' + domId).html(response);
387
		$('#' + domId).html(response);
472
	});
388
	});
473
}
389
}
474
 
390
 
475
function loadSchemeUpdatePage(domId) {
391
function loadSchemeUpdatePage(domId) {
476
	doGetAjaxRequestHandler(context + "/schemes/update-schemes-page", function(
392
	doGetAjaxRequestHandler(context + "/schemes/update-schemes-page", function (
477
		response) {
393
		response) {
478
		$('#' + domId).html(response);
394
		$('#' + domId).html(response);
479
	});
395
	});
480
}
396
}
481
 
397
 
482
function brandWiseIncome(brand,month,status) {
398
function brandWiseIncome(brand, month, status) {
483
	console.log(brand);
399
	console.log(brand);
484
	console.log(month);
400
	console.log(month);
485
	
401
 
486
	doGetAjaxRequestHandler(context + "/brandWiseIncome?brand=" + brand + "&month=" + month + "&status=" + status, function(
402
	doGetAjaxRequestHandler(context + "/brandWiseIncome?brand=" + brand + "&month=" + month + "&status=" + status, function (
487
		response) {
403
		response) {
488
		$('.imei-wise-income-container').html('');
404
		$('.imei-wise-income-container').html('');
489
		 $('.brand-wise-income-container').html(response);
405
		$('.brand-wise-income-container').html(response);
490
	});
406
	});
491
}
407
}
492
 
408
 
493
function monthWiseIncome(month,domId) {
409
function monthWiseIncome(month, domId) {
494
	console.log(month);
410
	console.log(month);
495
	doGetAjaxRequestHandler(context + "/monthWisePartnerIncome/" + month ,function (response) {
411
	doGetAjaxRequestHandler(context + "/monthWisePartnerIncome/" + month, function (response) {
496
			console.log(response);
412
		console.log(response);
497
			$('#' + domId).html(response);
413
		$('#' + domId).html(response);
498
		})
414
	})
499
}
415
}
-
 
416
 
500
function imeiWiseIncome(catalogItemId,month) {
417
function imeiWiseIncome(catalogItemId, month) {
501
	console.log(catalogItemId);
418
	console.log(catalogItemId);
502
	console.log(month);
419
	console.log(month);
503
	
420
 
504
	doGetAjaxRequestHandler(context + "/getLastMonthImeiWiseIncome?catalogItemId=" + catalogItemId + "&month=" + month, function(
421
	doGetAjaxRequestHandler(context + "/getLastMonthImeiWiseIncome?catalogItemId=" + catalogItemId + "&month=" + month, function (
505
		response) {
422
		response) {
506
		 $('.imei-wise-income-container').html(response);
423
		$('.imei-wise-income-container').html(response);
507
	});
424
	});
508
}
425
}
509
 
426
 
510
function updateSingleScheme(shcemeIds, itemIds) {
427
function updateSingleScheme(shcemeIds, catalogIds) {
511
	doPostAjaxRequestWithJsonHandler(context + '/addItemToScheme', JSON
428
	doPostAjaxRequestWithJsonHandler(context + '/addItemToScheme', JSON
512
		.stringify({
429
		.stringify({
513
			"itemIds": itemIds.split(",").map(Number),
430
			"catalogIds": catalogIds.split(",").map(Number),
514
			"schemeIds": schemeIds.split(",").map(Number)
431
			"schemeIds": schemeIds.split(",").map(Number)
515
		}), function(response) {
432
		}), function (response) {
516
			if (response == 'true') {
433
		if (response == 'true') {
517
				alert("Item Added to scheme successfully");
434
			alert("Item Added to scheme successfully");
518
				// $('#newItemToSchemeModal').modal('hide');
435
			// $('#newItemToSchemeModal').modal('hide');
519
				loadSchemeDetails(shcemeIds, "scheme-details-container");
436
			loadSchemeDetails(shcemeIds, "scheme-details-container");
520
			} else {
437
		} else {
521
				alert("Item already present");
438
			alert("Item already present");
522
				loadSchemeDetails(shcemeIds, "scheme-details-container");
439
			loadSchemeDetails(shcemeIds, "scheme-details-container");
523
			}
440
		}
524
		});
441
	});
525
}
442
}
-
 
443
 
526
function updateSchemes(shcemeIds, itemIds) {
444
function updateSchemes(schemeIds, catalogIds) {
527
	doPostAjaxRequestWithJsonHandler(context + '/schemes/update', JSON
445
	doPostAjaxRequestWithJsonHandler(context + '/schemes/update', JSON
528
		.stringify({
446
		.stringify({
529
			"itemIds": itemIds.split(",").map(Number),
447
			"catalogIds": catalogIds.split(",").map(Number),
530
			"schemeIds": schemeIds.split(",").map(Number)
448
			"schemeIds": schemeIds.split(",").map(Number)
531
		}), function(response) {
449
		}), function (response) {
532
			if (response == 'true') {
450
		if (response == 'true') {
533
				alert("Item Added to scheme successfully");
451
			alert("Item Added to scheme successfully");
534
				// $('#newItemToSchemeModal').modal('hide');
452
			// $('#newItemToSchemeModal').modal('hide');
535
				loadSchemeUpdatePage("main-content");
453
			loadSchemeUpdatePage("main-content");
536
			}
-
 
537
		});
-
 
538
}
-
 
539
function deleteScheme(shcemeId, itemId) {
-
 
540
	doDeleteAjaxRequestHandler(context + "/schemes/delete?schemeId=" + shcemeId
-
 
541
		+ "&itemId=" + itemId, function(response) {
-
 
542
			if (response == 'true') {
-
 
543
				alert("ItemId Deleted successfully from Scheme");
-
 
544
				loadSchemeDetails(shcemeId, "scheme-details-container");
-
 
545
			}
454
		}
546
		});
455
	});
547
}
456
}
-
 
457
 
548
function loadSearchScheme(domId, search_text) {
458
function deleteScheme(schemeId, catalogId) {
549
	doGetAjaxRequestHandler(context + "/searchScheme?searchTerm="
459
	doDeleteAjaxRequestHandler(context + "/schemes/delete?schemeId=" + schemeId
550
		+ search_text, function(response) {
460
		+ "&catalogId=" + catalogId, function (response) {
551
			$('#' + domId).html(response);
461
		if (response == 'true') {
-
 
462
			alert("Model Deleted successfully from Scheme");
-
 
463
			loadSchemeDetails(schemeId, "scheme-details-container");
-
 
464
		}
552
		});
465
	});
553
}
466
}
554
function loadSearchItemScheme(domId, selected_item, date) {
-
 
555
	var category = $('#partner-category').val();
-
 
556
	var searchText = $("#scheme-item-search-text").val();
-
 
557
 
467
 
558
	var category = $('#partner-category').val();
-
 
559
 
468
 
-
 
469
function loadSearchItemScheme(domId, selectedModel, date) {
-
 
470
	var searchText = $("#scheme-item-search-text").val();
560
	console.log(category)
471
	var category = $('#partner-category').val();
561
 
472
 
562
	if (typeof (searchText) == "undefined" || !searchText) {
473
	if (typeof (searchText) == "undefined" || !searchText) {
563
		searchText = "";
474
		searchText = "";
564
	}
475
	}
565
	if (typeof (category) == "undefined" || !category) {
476
	if (typeof (category) == "undefined" || !category) {
566
		category = "";
477
		category = "";
567
	}
478
	}
568
	if ((searchText) && (category)) {
479
	if (searchText && category) {
569
		doGetAjaxRequestHandler(context + "/getSchemes?searchItem="
480
		doGetAjaxRequestHandler(`${context}/getSchemes?searchModel=${selectedModel}&partnerType=${category}&date=${date}`, function (response) {
570
			+ selected_item.itemId + "&partnerType=" + category, function(
-
 
571
				response) {
-
 
572
			$('#' + domId).html(response);
481
			$('#' + domId).html(response);
573
			$('#partner-category').val(category);
482
			$('#partner-category').val(category);
574
			$('#scheme-item-search-text').val(selected_item.itemDescription);
-
 
575
 
-
 
576
		});
483
		});
577
	} else if ((searchText)) {
484
	} else if (searchText) {
578
		doGetAjaxRequestHandler(`${context}/getSchemes?searchItem=${selected_item.itemId}&date=${date}`, function(response) {
485
		doGetAjaxRequestHandler(`${context}/getSchemes?searchItem=${selectedModel.itemId}&date=${date}`, function (response) {
579
			$('#' + domId).html(response);
486
			$('#' + domId).html(response);
580
			$('#scheme-item-search-text').val(selected_item.itemDescription);
-
 
581
 
-
 
582
		});
487
		});
583
 
488
 
584
	}
489
	}
585
 
490
 
586
}
491
}
Line 599... Line 504...
599
	if (typeof (category) == "undefined" || !category) {
504
	if (typeof (category) == "undefined" || !category) {
600
		category = "";
505
		category = "";
601
	}
506
	}
602
	if ((searchText) && (category)) {
507
	if ((searchText) && (category)) {
603
		doGetAjaxRequestHandler(context + "/getSchemes?searchImei="
508
		doGetAjaxRequestHandler(context + "/getSchemes?searchImei="
604
			+ selected_imei + "&partnerType=" + category, function(
509
			+ selected_imei + "&partnerType=" + category, function (
605
				response) {
510
			response) {
606
			$('#' + domId).html(response);
511
			$('#' + domId).html(response);
607
 
512
 
608
			$('#partner-category').val(category);
513
			$('#partner-category').val(category);
609
			$('#scheme-imei-search-text').val(selected_imei);
514
			$('#scheme-imei-search-text').val(selected_imei);
610
		});
515
		});
611
	} else if ((searchText)) {
516
	} else if ((searchText)) {
612
		doGetAjaxRequestHandler(`${context}/getSchemes?searchImei=${selected_imei}&date=${date}`, function(response) {
517
		doGetAjaxRequestHandler(`${context}/getSchemes?searchImei=${selected_imei}&date=${date}`, function (response) {
613
			$('#' + domId).html(response);
518
			$('#' + domId).html(response);
614
			$('#scheme-imei-search-text').val(selected_imei);
519
			$('#scheme-imei-search-text').val(selected_imei);
615
 
520
 
616
		});
521
		});
617
 
522
 
618
	}
523
	}
619
 
524
 
620
}
525
}
621
function loadSchemeSearchInfo(search_text) {
-
 
622
	loadSearchScheme("main-content", search_text);
-
 
623
}
526
 
624
function loadSchemeItemSearchInfo(selectedItem, date) {
527
function loadSchemeItemSearchInfo(selectedModel, date) {
625
	loadSearchItemScheme("main-content", selectedItem, date);
528
	loadSearchItemScheme("main-content", selectedModel, date);
626
}
529
}
627
 
530
 
628
function loadSchemeImeiSearchInfo(selectedImei, date) {
531
function loadSchemeImeiSearchInfo(selectedImei, date) {
629
 
532
 
630
	loadSearchImeiScheme("main-content", selectedImei, date);
533
	loadSearchImeiScheme("main-content", selectedImei, date);