Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
33973 tejus.loha 1
let xmlJson;
26053 amit.gupta 2
$(document).on('click', 'a.list-group-item', function() {
26063 amit.gupta 3
	reportTitle = $(this).find('h4').html();
4
	reportUrl = this.href;
26054 amit.gupta 5
	$reportModal = $('#report-modal');
26063 amit.gupta 6
	$reportModal.find('h4.modal-title').html(reportTitle);
31416 tejbeer 7
	if ($(this).data("paramslist") == undefined) {
26054 amit.gupta 8
		return true;
26053 amit.gupta 9
	} else {
10
		var paramsList = $(this).data("paramslist");
11
		paramsMap = {};
12
		renderInputDialog(paramsList);
13
		$reportModal.modal('show');
14
		return false;
15
	}
16
});
30163 manish 17
 
18
 
19
 
20
$(document).on('click', ".invoice-scheme-out-report", function() {
31416 tejbeer 21
 
30163 manish 22
	doGetAjaxRequestHandler(context + "/invoiceSchemeOutSummaryReport",
23
		function(response) {
24
			$('#' + 'main-content').html(response);
25
		});
26
});
27
 
28
 
29
$(document).on('click', ".price-drop-report", function() {
31416 tejbeer 30
 
30163 manish 31
	doGetAjaxRequestHandler(context + "/priceDropReport",
32
		function(response) {
33
			$('#' + 'main-content').html(response);
34
		});
35
});
36
 
33094 shampa 37
$(document).on('click', ".scheme-payout-report", function() {
31416 tejbeer 38
 
30163 manish 39
	doGetAjaxRequestHandler(context + "/schemePayoutReport",
40
		function(response) {
41
			$('#' + 'main-content').html(response);
42
		});
43
});
33094 shampa 44
$(document).on('click', ".offer-payout-dump-report", function() {
33010 shampa 45
console.log('HELLO');
46
	doGetAjaxRequestHandler(context + "/offerPayoutReport",
47
		function(response) {
48
			$('#' + 'main-content').html(response);
49
		});
50
});
30163 manish 51
 
52
$(document).on('click', ".pending-indent", function() {
31416 tejbeer 53
 
30163 manish 54
	doGetAjaxRequestHandler(context + "/pendingIndentReport",
55
		function(response) {
56
			$('#' + 'main-content').html(response);
57
		});
58
});
33067 shampa 59
$(document).on('click', '.pending-indent-fetch-report', function() {
60
	var startDate = $("#startDate-pending-indent-report").val();
30163 manish 61
 
33067 shampa 62
	var endDate = $("#endDate-pending-indent-report").val();
63
 
64
	if (startDate == "" || startDate == undefined) {
65
 
66
		alert("start date is not be empty!!");
67
		return;
68
	}
69
	if (endDate == "" || endDate == undefined) {
70
 
71
		alert("end date is not be empty!!");
72
		return;
73
	}
33092 tejus.loha 74
	let endPoint = `${context}/pendingIndentFetchReportByDate?startDate=${startDate}&endDate=${endDate}`;
75
	if (typeof partnerId != "undefined") {
76
		endPoint = `${endPoint}&fofoId=${partnerId}`;
77
	}
78
 
79
	doGetAjaxRequestHandler(endPoint,
80
		function (response) {
33067 shampa 81
			$('#' + 'main-content').html(response);
82
		});
83
});
84
 
85
 
86
 
30163 manish 87
$(document).on('click', ".wallet_statement", function() {
88
	doGetAjaxRequestHandler(context + "/walletSummaryReport",
89
		function(response) {
90
			$('#' + 'main-content').html(response);
91
		});
92
});
93
 
33775 ranu 94
$(document).on('click', ".account-statement", function () {
95
    doGetAjaxRequestHandler(context + "/account-statement",
96
        function (response) {
97
            $('#' + 'main-content').html(response);
98
        });
99
});
30163 manish 100
 
33775 ranu 101
$(document).on('click', '.download-partner-account-statement-report', function () {
102
    var startDate = getDatesFromPicker('input[name="accountStatementPeriod"]').startDate;
103
    var endDate = getDatesFromPicker('input[name="accountStatementPeriod"]').endDate;
104
 
105
    if (startDate == "" || startDate == undefined) {
106
        alert("start date is not be empty!!");
107
        return;
108
    }
109
    if (endDate == "" || endDate == undefined) {
110
 
111
        alert("end date is not be empty!!");
112
        return;
113
    }
114
    let endPoint = `${context}/account/statement?startDate=${startDate}&endDate=${endDate}`;
115
    if (typeof partnerId != "undefined") {
116
        endPoint = `${endPoint}&fofoId=${partnerId}`;
117
    }
118
    window.location.href = endPoint;
119
});
120
$(document).on('click', '.fetch-partner-account-statement-report', function () {
121
 
122
    var startDate = getDatesFromPicker('input[name="accountStatementPeriod"]').startDate;
123
    var endDate = getDatesFromPicker('input[name="accountStatementPeriod"]').endDate;
124
 
125
    if (startDate == "" || startDate == undefined) {
126
        alert("start date is not be empty!!");
127
        return;
128
    }
129
    if (endDate == "" || endDate == undefined) {
130
 
131
        alert("end date is not be empty!!");
132
        return;
133
    }
134
 
135
    doGetAjaxRequestHandler(context + "/account-statement-report?startDate=" + startDate + "&endDate=" + endDate + "&fofoId=" + partnerId,
136
        function (response) {
137
            $('.account-statement-conatiner').html(response);
138
        });
139
 
140
});
141
 
142
 
33067 shampa 143
$(document).on('click', ".partner-collection-summary", function() {
30163 manish 144
	doGetAjaxRequestHandler(context + "/collectionSummary",
145
		function(response) {
146
			$('#' + 'main-content').html(response);
147
		});
148
});
149
 
150
 
151
$(document).on('click', '.download-collection-summary', function() {
31416 tejbeer 152
	var startDate = $("#startDate-collection-summary").val();
153
 
154
	var endDate = $("#endDate-collection-summary").val();
155
 
156
	if (startDate == "" || startDate == undefined) {
157
 
30163 manish 158
		alert("start date is not be empty!!");
159
		return;
160
	}
31416 tejbeer 161
	if (endDate == "" || endDate == undefined) {
162
 
163
		alert("end date is not be empty!!");
30163 manish 164
		return;
165
	}
33102 tejus.loha 166
	let endPoint = `${context}/downloadCollectionSummary?startDate=${startDate}&endDate=${endDate}`;
167
	if (typeof partnerId != "undefined") {
168
		endPoint = `${endPoint}&fofoId=${partnerId}`;
169
	}
31416 tejbeer 170
 
33102 tejus.loha 171
	window.location.href = endPoint;
172
 
30163 manish 173
});
33010 shampa 174
$(document).on('click', ".collection-summary-fetch-report", function() {
30163 manish 175
 
33010 shampa 176
	var startDate = $("#startDate-collection-summary").val();
30163 manish 177
 
33010 shampa 178
	var endDate = $("#endDate-collection-summary").val();
179
 
180
	if (startDate == "" || startDate == undefined) {
181
		alert("start date is not be empty!!");
182
		return;
183
	}
184
	if (endDate == "" || endDate == undefined) {
185
 
186
		alert("end date is not be empty!!");
187
		return;
188
	}
33092 tejus.loha 189
	let endPoint = `${context}/collectionSummaryFetchReportByDate?startDate=${startDate}&endDate=${endDate}`;
190
	if (typeof partnerId != "undefined") {
191
		endPoint = `${endPoint}&fofoId=${partnerId}`;
192
	}
33010 shampa 193
 
33092 tejus.loha 194
	doGetAjaxRequestHandler(endPoint,
195
		function (response) {
196
			$('#' + 'main-content').html(response);
197
		});
198
 
199
 
33010 shampa 200
});
201
 
202
 
30163 manish 203
$(document).on('click', '.download-price-drop-report', function() {
31416 tejbeer 204
	var startDate = $("#startDate-price-drop-report").val();
205
 
206
	var endDate = $("#endDate-price-drop-report").val();
207
 
208
	if (startDate == "" || startDate == undefined) {
209
 
30163 manish 210
		alert("start date is not be empty!!");
211
		return;
212
	}
31416 tejbeer 213
	if (endDate == "" || endDate == undefined) {
214
 
215
		alert("end date is not be empty!!");
30163 manish 216
		return;
217
	}
33102 tejus.loha 218
	let endPoint = `${context}/downloadPriceDropReport?startDate=${startDate}&endDate=${endDate}`;
219
	if (typeof partnerId != "undefined") {
220
		endPoint = `${endPoint}&fofoId=${partnerId}`;
221
	}
31416 tejbeer 222
 
33102 tejus.loha 223
	window.location.href = endPoint;
224
 
225
 
30163 manish 226
});
33010 shampa 227
$(document).on('click', '.price-drop-fetch-report', function() {
228
	var startDate = $("#startDate-price-drop-report").val();
30163 manish 229
 
33010 shampa 230
	var endDate = $("#endDate-price-drop-report").val();
30163 manish 231
 
33010 shampa 232
	if (startDate == "" || startDate == undefined) {
30163 manish 233
 
33010 shampa 234
		alert("start date is not be empty!!");
235
		return;
236
	}
237
	if (endDate == "" || endDate == undefined) {
30163 manish 238
 
33010 shampa 239
		alert("end date is not be empty!!");
240
		return;
241
	}
33092 tejus.loha 242
	let endPoint = `${context}/priceDropFetchReportByDate?startDate=${startDate}&endDate=${endDate}`;
243
	if (typeof partnerId != "undefined") {
244
		endPoint = `${endPoint}&fofoId=${partnerId}`;
245
	}
33010 shampa 246
 
33092 tejus.loha 247
	doGetAjaxRequestHandler(endPoint,
248
		function (response) {
249
			$('#' + 'main-content').html(response);
250
		});
251
 
33010 shampa 252
});
253
 
254
 
255
 
256
 
30163 manish 257
$(document).on('click', ".smartdukaan-billing-statement", function() {
258
	console.log('HELO');
259
	doGetAjaxRequestHandler(context + "/selectPartnerBillingSummaryReport",
260
		function(response) {
261
			$('#' + 'main-content').html(response);
262
		});
263
});
264
 
265
 
266
$(document).on('click', '.download-invoicewise-scheme-out-report', function() {
31416 tejbeer 267
 
30163 manish 268
	window.location.href = context + "/downloadInvoiceSchemeOutSummaryReport";
31416 tejbeer 269
 
30163 manish 270
});
271
 
272
$(document).on('click', ".download-pending-indent-report", function() {
33067 shampa 273
	var startDate = $("#startDate-pending-indent-report").val();
31416 tejbeer 274
 
33067 shampa 275
	var endDate = $("#endDate-pending-indent-report").val();
30163 manish 276
 
33067 shampa 277
	if (startDate == "" || startDate == undefined) {
278
		alert("start date is not be empty!!");
279
		return;
280
	}
281
	if (endDate == "" || endDate == undefined) {
33010 shampa 282
 
33067 shampa 283
		alert("end date is not be empty!!");
284
		return;
285
	}
33010 shampa 286
 
33102 tejus.loha 287
	let endPoint = `${context}/pendingIndentReportDownload?startDate=${startDate}&endDate=${endDate}`;
288
	if (typeof partnerId != "undefined") {
289
		endPoint = `${endPoint}&fofoId=${partnerId}`;
290
	}
291
 
292
	window.location.href = endPoint;
33010 shampa 293
});
294
 
295
 
33067 shampa 296
 
30163 manish 297
$(document).on('click', ".download-scheme-payout-report", function() {
31416 tejbeer 298
 
299
	var startDate = $("#startDate-scheme-payout").val();
300
 
301
	var endDate = $("#endDate-scheme-payout").val();
302
 
303
	if (startDate == "" || startDate == undefined) {
304
		alert("start date is not be empty!!");
305
		return;
306
	}
307
	if (endDate == "" || endDate == undefined) {
308
 
309
		alert("end date is not be empty!!");
310
		return;
311
	}
33102 tejus.loha 312
	let endPoint = `${context}/schemePayoutReportDownload?startDate=${startDate}&endDate=${endDate}`;
313
	if (typeof partnerId != "undefined") {
314
		endPoint = `${endPoint}&fofoId=${partnerId}`;
315
	}
31416 tejbeer 316
 
33102 tejus.loha 317
	window.location.href = endPoint;
30163 manish 318
});
319
 
33010 shampa 320
$(document).on('click', ".scheme-payout-fetch-report", function() {
321
 
322
	var startDate = $("#startDate-scheme-payout").val();
323
 
324
	var endDate = $("#endDate-scheme-payout").val();
325
 
326
	if (startDate == "" || startDate == undefined) {
327
		alert("start date is not be empty!!");
328
		return;
329
	}
330
	if (endDate == "" || endDate == undefined) {
331
 
332
		alert("end date is not be empty!!");
333
		return;
334
	}
335
 
33091 shampa 336
	let endPoint = `${context}/schemePayoutFetchReportByDate?startDate=${startDate}&endDate=${endDate}`;
337
	   if (typeof partnerId != "undefined") {
338
		        endPoint = `${endPoint}&fofoId=${partnerId}`;
339
		   }
340
 
341
		    doGetAjaxRequestHandler(endPoint,
342
			        function (response) {
343
				            $('#' + 'main-content').html(response);
344
				       });
33010 shampa 345
});
346
 
347
$(document).on('click', ".download-offer-payout-dump-report", function() {
348
 
349
	var startDate = $("#startDate-offer-payout-dump").val();
350
 
351
	var endDate = $("#endDate-offer-payout-dump").val();
352
 
353
	if (startDate == "" || startDate == undefined) {
354
		alert("start date is not be empty!!");
355
		return;
356
	}
357
	if (endDate == "" || endDate == undefined) {
358
 
359
		alert("end date is not be empty!!");
360
		return;
361
	}
33102 tejus.loha 362
	let endPoint = `${context}/offerPayoutDumpReportDownload?startDate=${startDate}&endDate=${endDate}`;
363
	if (typeof partnerId != "undefined") {
364
		endPoint = `${endPoint}&fofoId=${partnerId}`;
365
	}
33010 shampa 366
 
33102 tejus.loha 367
	window.location.href = endPoint;
33010 shampa 368
 
33102 tejus.loha 369
 
370
 
371
 
33010 shampa 372
});
373
$(document).on('click', ".offer-payout-fetch-report", function() {
374
 
375
	var startDate = $("#startDate-offer-payout-dump").val();
376
 
377
	var endDate = $("#endDate-offer-payout-dump").val();
378
 
379
	if (startDate == "" || startDate == undefined) {
380
		alert("start date is not be empty!!");
381
		return;
382
	}
383
	if (endDate == "" || endDate == undefined) {
384
 
385
		alert("end date is not be empty!!");
386
		return;
387
	}
33096 shampa 388
	let endPoint = `${context}/offerPayoutFetchReportByDate?startDate=${startDate}&endDate=${endDate}`;
389
	if (typeof partnerId != "undefined") {
390
		endPoint = `${endPoint}&fofoId=${partnerId}`;
391
	}
33010 shampa 392
 
33091 shampa 393
	doGetAjaxRequestHandler(endPoint,
394
		function (response) {
395
			$('#' + 'main-content').html(response);
396
		});
33010 shampa 397
});
398
 
399
 
30163 manish 400
$(document).on('click', ".franchisee_sales", function() {
33010 shampa 401
	console.log('HELLO');
30163 manish 402
	doGetAjaxRequestHandler(context + "/franchiseeSalesReport",
403
		function(response) {
404
			$('#' + 'main-content').html(response);
405
		});
406
});
33092 tejus.loha 407
$(document).on('click', '.franchisee-sales-fetch-report', function () {
408
	var startDate = $("#startDate-franchisee-sales").val();
30163 manish 409
 
33092 tejus.loha 410
	var endDate = $("#endDate-franchisee-sales").val();
411
 
412
	if (startDate == "" || startDate == undefined) {
413
 
414
		alert("start date is not be empty!!");
415
		return;
416
	}
417
	if (endDate == "" || endDate == undefined) {
418
 
419
		alert("end date is not be empty!!");
420
		return;
421
	}
422
	let endPoint = `${context}/franchiseeSalesFetchReportByDate?startDate=${startDate}&endDate=${endDate}`;
423
	if (typeof partnerId != "undefined") {
424
		endPoint = `${endPoint}&fofoId=${partnerId}`;
425
	}
426
 
427
	doGetAjaxRequestHandler(endPoint,
428
		function (response) {
429
			$('#' + 'main-content').html(response);
430
		});
431
});
432
 
433
 
434
 
30163 manish 435
$(document).on('click', '.download-wallet-summary-report', function() {
31416 tejbeer 436
	var startDate = $("#startDate-wallet-summary-report").val();
437
 
438
	var endDate = $("#endDate-wallet-summary-report").val();
439
 
440
	if (startDate == "" || startDate == undefined) {
441
		alert("start date is not be empty!!");
30163 manish 442
		return;
443
	}
31416 tejbeer 444
	if (endDate == "" || endDate == undefined) {
445
 
30163 manish 446
		alert("end date is not be empty!!");
447
		return;
448
	}
33102 tejus.loha 449
	let endPoint = `${context}/downloadWalletSummaryReport?startDate=${startDate}&endDate=${endDate}`;
450
	if (typeof partnerId != "undefined") {
451
		endPoint = `${endPoint}&fofoId=${partnerId}`;
452
	}
453
	window.location.href = endPoint;
30163 manish 454
});
33010 shampa 455
$(document).on('click', '.wallet-summary-fetch-report', function() {
456
	var startDate = $("#startDate-wallet-summary-report").val();
30163 manish 457
 
33010 shampa 458
	var endDate = $("#endDate-wallet-summary-report").val();
30163 manish 459
 
33010 shampa 460
	if (startDate == "" || startDate == undefined) {
461
		alert("start date is not be empty!!");
462
		return;
463
	}
464
	if (endDate == "" || endDate == undefined) {
465
 
466
		alert("end date is not be empty!!");
467
		return;
468
	}
33092 tejus.loha 469
 
470
	let endPoint = `${context}/walletSummaryFetchReportByDate?startDate=${startDate}&endDate=${endDate}`;
471
	if (typeof partnerId != "undefined") {
472
		endPoint = `${endPoint}&fofoId=${partnerId}`;
473
	}
474
 
475
	doGetAjaxRequestHandler(endPoint,
476
		function (response) {
477
			$('#' + 'main-content').html(response);
478
		});
479
 
480
 
33010 shampa 481
});
482
 
483
 
30163 manish 484
$(document).on('click', '.download-partner-billing-report', function() {
31416 tejbeer 485
	var startDate = $("#startDate-partner-billing-report").val();
486
 
487
	var endDate = $("#endDate-partner-billing-report").val();
488
 
489
	if (startDate == "" || startDate == undefined) {
490
 
30163 manish 491
		alert("start date is not be empty!!");
492
		return;
493
	}
31416 tejbeer 494
	if (endDate == "" || endDate == undefined) {
495
 
30163 manish 496
		alert("end date is not be empty!!");
497
		return;
498
	}
33102 tejus.loha 499
	let endPoint = `${context}/downloadPartnerBillingSummaryReport?startDate=${startDate}&endDate=${endDate}`;
500
	if (typeof partnerId != "undefined") {
501
		endPoint = `${endPoint}&fofoId=${partnerId}`;
502
	}
503
 
504
	window.location.href = endPoint;
30163 manish 505
});
33010 shampa 506
$(document).on('click', '.billing-summary-fetch-report', function() {
507
	var startDate = $("#startDate-partner-billing-report").val();
30163 manish 508
 
33010 shampa 509
	var endDate = $("#endDate-partner-billing-report").val();
510
 
511
	if (startDate == "" || startDate == undefined) {
512
 
513
		alert("start date is not be empty!!");
514
		return;
515
	}
516
	if (endDate == "" || endDate == undefined) {
517
 
518
		alert("end date is not be empty!!");
519
		return;
520
	}
521
	doGetAjaxRequestHandler(context + "/selectPartnerBillingSummaryReport",
522
    		function(response) {
523
    			$('#' + 'main-content').html(response);
524
    		});
525
});
526
 
30163 manish 527
$(document).on('click', '.download-franchisee-sales', function() {
31416 tejbeer 528
	var startDate = $("#startDate-franchisee-sales").val();
529
 
530
	var endDate = $("#endDate-franchisee-sales").val();
531
 
532
	if (startDate == "" || startDate == undefined) {
533
 
30163 manish 534
		alert("start date is not be empty!!");
535
		return;
536
	}
31416 tejbeer 537
	if (endDate == "" || endDate == undefined) {
538
 
30163 manish 539
		alert("end date is not be empty!!");
540
		return;
541
	}
33102 tejus.loha 542
	let endPoint = `${context}/downloadFranchiseeSales?startDate=${startDate}&endDate=${endDate}`;
543
	if (typeof partnerId != "undefined") {
544
		endPoint = `${endPoint}&fofoId=${partnerId}`;
545
	}
546
	window.location.href = endPoint;
30163 manish 547
});
31416 tejbeer 548
$(document).on('click', 'button.download-report', function() {
26054 amit.gupta 549
	var reportParams = {};
26153 amit.gupta 550
	var validated = true;
26134 amit.gupta 551
	$inputContainer.find("input.param,select.param").each(function(idx, inputElement) {
26054 amit.gupta 552
		var inputName = $(inputElement).attr("name");
31416 tejbeer 553
		if (typeof inputName === "undefined" || !(inputName in paramsMap)) {
26089 amit.gupta 554
			console.log(inputName);
555
			return;
556
		}
557
		param = paramsMap[inputName];
31416 tejbeer 558
		if ($(inputElement).val() == "") {
26089 amit.gupta 559
			bootbox.alert(`${param.displayName} is required`);
26153 amit.gupta 560
			validated = false;
26148 amit.gupta 561
			return false;
26054 amit.gupta 562
		}
31416 tejbeer 563
		if (param.type == 'DATE') {
30599 amit.gupta 564
			reportParams[`MANUAL_${inputName}`] = getReporticoDatesFromPicker(inputElement).startDate;
31416 tejbeer 565
		} else if (param.type == 'DATE_RANGE') {
30599 amit.gupta 566
			reportParams[`MANUAL_${inputName}_FROMDATE`] = getReporticoDatesFromPicker(inputElement).startDate;
567
			reportParams[`MANUAL_${inputName}_TODATE`] = getReporticoDatesFromPicker(inputElement).endDate;
26054 amit.gupta 568
		} else {
31416 tejbeer 569
			if (['code', 'warehouseId'].indexOf(param.name) >= 0) {
570
				if (typeof $(inputElement).val() == "string") {
26204 amit.gupta 571
					reportParams[`${inputName}`] = $(inputElement).val();
26167 amit.gupta 572
				} else {
26204 amit.gupta 573
					reportParams[`${inputName}`] = $(inputElement).val().join(",");
26157 amit.gupta 574
				}
26116 amit.gupta 575
 
26089 amit.gupta 576
			} else {
577
				reportParams[`MANUAL_${inputName}`] = $(inputElement).val();
578
			}
26054 amit.gupta 579
		}
580
	});
31416 tejbeer 581
	if (validated) {
26153 amit.gupta 582
		var jsonParams = JSON.stringify(reportParams);
583
		doAjaxPostDownload(reportUrl, jsonParams, `${reportTitle}.csv`);
584
	}
31416 tejbeer 585
 
26054 amit.gupta 586
});
26053 amit.gupta 587
function renderInputDialog(paramsList) {
26054 amit.gupta 588
	$reportModal = $('div#report-modal');
589
	$inputContainer = $reportModal.find('div.modal-body');
590
	//Clear container first
591
	$inputContainer.html('');
26053 amit.gupta 592
	paramsList.forEach(function(value) {
593
		paramsMap[value.name] = value;
594
		renderInput($inputContainer, value);
595
	});
596
}
597
 
26054 amit.gupta 598
function renderInput($inputContainer, param) {
599
	console.log(param.type);
26053 amit.gupta 600
	switch (param.type) {
601
		case "DATE": {
26054 amit.gupta 602
			$inputContainer.append(`<div class="form-group">
26053 amit.gupta 603
									<label>${param.displayText}</label> 
26146 amit.gupta 604
				   	  				<input name="${param.name}" type="text" value="" class="param form-control input-sm">
26053 amit.gupta 605
								</div>`);
30599 amit.gupta 606
			$inputContainer.find(`input[name="${param.name}"]`).daterangepicker(getSingleDatePicker());
26054 amit.gupta 607
			return;
26053 amit.gupta 608
		}
31416 tejbeer 609
		case "DATE_RANGE": {
26054 amit.gupta 610
			$inputContainer.append(`<div class="form-group">
26053 amit.gupta 611
					<label>${param.displayText}</label> 
26134 amit.gupta 612
					<input name="${param.name}" type="text" value="" class="param form-control input-sm">
26053 amit.gupta 613
			</div>`);
30599 amit.gupta 614
			$inputContainer.find(`input[name="${param.name}"]`).daterangepicker(getRangedDatePicker(true));
26054 amit.gupta 615
			return;
26053 amit.gupta 616
		}
617
		case "STRING": {
31416 tejbeer 618
			if (param.name == "authId") {
26154 amit.gupta 619
				$inputContainer.append(`
620
						<input type="hidden" name="${param.name}" type="text" value="${authId}" class="param form-control input-sm">`);
26155 amit.gupta 621
			} else {
622
				$inputContainer.append(`<div class="form-group">
623
						<label>${param.displayText}</label> 
624
						<input name="${param.name}" type="text" value="" class="param form-control input-sm">
625
					</div>`);
26142 amit.gupta 626
			}
26054 amit.gupta 627
			return;
26053 amit.gupta 628
		}
31416 tejbeer 629
		case "LIST": {
630
			if (param.name == "code") {
26089 amit.gupta 631
				var arr = [];
31416 tejbeer 632
				if (retailers.length == 1) {
26157 amit.gupta 633
					$inputContainer.append(`<input type="hidden" name="${param.name}" type="text" value="${authId}" class="param form-control input-sm">`)
634
				} else {
31416 tejbeer 635
					for (var i in retailers) {
26157 amit.gupta 636
						arr.push(`<option value="${retailers[i].code}">${retailers[i].displayName}-${retailers[i].code}</option>`);
637
					}
638
					var options = arr.join("");
639
					$inputContainer.append(`<div class="col-lg-2 form-group">
640
							<label>${param.displayText}</label> 
641
							<select class="param form-control input-sm" id="code" multiple="multiple" name="${param.name}">
26089 amit.gupta 642
							<option value="" disabled selected>Select Franchisee</option>
643
							${options}
26157 amit.gupta 644
							</select>
645
					</div>`);
31416 tejbeer 646
 
26157 amit.gupta 647
					$('#code').multiselect({
648
						includeSelectAllOption: true,
31416 tejbeer 649
						multiple: true,
26157 amit.gupta 650
						maxHeight: 200,
651
						buttonWidth: '180px',
652
						numberDisplayed: 1,
653
						nonSelectedText: 'Franchisee',
654
						nSelectedText: ' - Franchisees Selected',
655
						allSelectedText: 'All Franchisees',
656
						enableFiltering: true,
31416 tejbeer 657
						enableCaseInsensitiveFiltering: true
26157 amit.gupta 658
					});
659
				}
31416 tejbeer 660
			} else if (param.name == "warehouseId") {
26134 amit.gupta 661
				var arr = [];
31416 tejbeer 662
				for (var i in warehouses) {
26134 amit.gupta 663
					arr.push(`<option value="${i}">${warehouses[i]}</option>`);
664
				}
665
				var options = arr.join("");
666
				$inputContainer.append(`<div class="col-lg-2 form-group">
667
						<label>${param.displayText}</label> 
668
						<select class="param form-control input-sm" id="code" multiple="multiple" name="${param.name}">
669
						<option value="" disabled selected>Select Warehouses</option>
670
						${options}
671
						</select>
672
				</div>`);
31416 tejbeer 673
 
26134 amit.gupta 674
				$('#code').multiselect({
675
					includeSelectAllOption: true,
31416 tejbeer 676
					multiple: true,
26134 amit.gupta 677
					maxHeight: 200,
678
					buttonWidth: '180px',
679
					numberDisplayed: 1,
680
					nonSelectedText: 'Warehouses',
681
					nSelectedText: ' - Warehouse Selected',
682
					allSelectedText: 'All Warehouses',
683
					enableFiltering: true,
31416 tejbeer 684
					enableCaseInsensitiveFiltering: true
26134 amit.gupta 685
				});
686
			} else {
26089 amit.gupta 687
				$inputContainer.append(`<div class="form-group">
688
						<label>${param.displayText}(Comma Separated)</label> 
26134 amit.gupta 689
						<input name="${param.name}" type="text" value="" class="param form-control input-sm">
26089 amit.gupta 690
				</div>`);
691
			}
26054 amit.gupta 692
			return;
26053 amit.gupta 693
		}
694
	}
33809 ranu 695
}
696
 
697
 
698
$(document).on('click', ".loan-statement", function () {
699
	doGetAjaxRequestHandler(context + "/loan/loan-statement",
700
		function (response) {
701
			$('#' + 'main-content').html(response);
702
		});
703
});
704
 
705
$(document).on('click', '.partner-loan-statement-report', function () {
706
	var startDate = getDatesFromPicker('input[name="loanStatementPeriod"]').startDate;
707
	var endDate = getDatesFromPicker('input[name="loanStatementPeriod"]').endDate;
708
 
709
	if (startDate == "" || startDate == undefined) {
710
		alert("start date is not be empty!!");
711
		return;
712
	}
713
	if (endDate == "" || endDate == undefined) {
714
 
715
		alert("end date is not be empty!!");
716
		return;
717
	}
718
	if (typeof partnerId != "undefined") {
719
		doGetAjaxRequestHandler(context + "/loan/partner-loan-statement-report?startDate=" + startDate + "&endDate=" + endDate + "&fofoId=" + partnerId,
720
			function (response) {
721
				$('.loan-statement-conatiner').html(response);
34046 aman.kumar 722
				$('#loanStatementSummaryReport').DataTable({
723
					"scrollX": true,
724
					"bPaginate": true,
725
					"bLengthChange": true,
726
					"bFilter": true,
727
					"bInfo": false,
728
					"bAutoWidth": false
729
				});
33809 ranu 730
			});
731
	} else {
732
		doGetAjaxRequestHandler(context + "/loan/partner-loan-statement-report?startDate=" + startDate + "&endDate=" + endDate + "&fofoId=0",
733
			function (response) {
734
				$('.loan-statement-conatiner').html(response);
735
			});
736
	}
737
 
738
});
739
 
740
$(document).on('click', '.download-partner-loan-statement', function () {
741
	var startDate = getDatesFromPicker('input[name="loanStatementPeriod"]').startDate;
742
	var endDate = getDatesFromPicker('input[name="loanStatementPeriod"]').endDate;
743
 
744
	if (startDate == "" || startDate == undefined) {
745
 
746
		alert("start date is not be empty!!");
747
		return;
748
	}
749
	if (endDate == "" || endDate == undefined) {
750
 
751
		alert("end date is not be empty!!");
752
		return;
753
	}
754
	let endPoint = `${context}/loan/download-partner-loan-statement-report?startDate=${startDate}&endDate=${endDate}`;
755
	if (typeof partnerId != "undefined") {
756
		endPoint = `${endPoint}&fofoId=${partnerId}`;
757
	}
758
 
759
	window.location.href = endPoint;
33973 tejus.loha 760
});
761
 
762
$(document).on('click', ".reportico", function() {
763
	doGetAjaxRequestHandler(context + "/reportico", function(response) {
764
		$('#' + 'main-content').html(response);
765
	});
766
});
767
 
768
$(document).on('click', ".getFileContent", function() {
769
	$reportModal = $('#reportico-modal');
770
	const url = $(this).data('url');
771
	doGetAjaxRequestHandler(context + url, function(response) {
772
		console.log('response json',response)
773
		$('#' + 'reportico-content').html(response);
774
		$reportModal = $('#reportico-modal').modal('show');
775
	});
34236 ranu 776
});
777
 
778
$(document).on('click', ".credit-note", function () {
779
    doGetAjaxRequestHandler(context + "/report/credit-note",
780
        function (response) {
781
            $('#' + 'main-content').html(response);
782
        });
783
});
784
 
785
$(document).on('click', '.credit-not-list', function () {
786
    var selectedDate = $('input[name="creditNotePeriod"]').val(); // Get the selected year-month
787
 
788
    if (!selectedDate) {
789
        alert("Month-Year selection cannot be empty!");
790
        return;
791
    }
792
 
793
 
794
    if (typeof partnerId != "undefined") {
795
        doGetAjaxRequestHandler(context + "credit/credit-note-report?yearMonth=" + selectedDate + "&fofoId=" + partnerId,
796
            function (response) {
797
                $('.credit-note-conatiner').html(response);
798
                $('#creditNoteList').DataTable({
799
                    "scrollX": true,
800
                    "bPaginate": true,
801
                    "bLengthChange": true,
802
                    "bFilter": true,
803
                    "bInfo": false,
804
                    "bAutoWidth": false
805
                });
806
            });
807
    } else {
808
        doGetAjaxRequestHandler(context + "credit/credit-note-report?yearMonth=" + selectedDate + "&fofoId=0",
809
            function (response) {
810
                $('.credit-note-conatiner').html(response);
811
                $('#creditNoteList').DataTable({
812
                    "scrollX": true,
813
                    "bPaginate": true,
814
                    "bLengthChange": true,
815
                    "bFilter": true,
816
                    "bInfo": false,
817
                    "bAutoWidth": false
818
                });
819
            });
820
    }
821
 
822
});
823
 
824
$(document).on('click', '.download-credit-note', function () {
825
    var cnNumber = $(this).data("creditnumber");
826
 
827
    if (!cnNumber) {
828
        alert("CN-Number cannot be empty!");
829
        return;
830
    }
831
 
832
    let endPoint = `${context}/credit-note/download?cnNumber=${cnNumber}`;
833
 
834
    window.location.href = endPoint; // Redirect to the download URL
835
});
836
 
34256 ranu 837
$(document).on('click', '.download-credit-note-attachement', function () {
838
    var cnNumber = $(this).data("creditnumber");
34236 ranu 839
 
34256 ranu 840
    if (!cnNumber) {
841
        alert("CN-Number cannot be empty!");
842
        return;
843
    }
844
 
845
    let endPoint = `${context}/credit-note/attachements?cnNumber=${cnNumber}`;
846
 
847
    window.location.href = endPoint; // Redirect to the download URL
848
});
849
 
850