Subversion Repositories SmartDukaan

Rev

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

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