Subversion Repositories SmartDukaan

Rev

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

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