Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
25093 amit.gupta 1
var saleSearchObj = saleSearchObj || {};
2
saleSearchObj.searchText = "";
3
saleSearchObj.searchType = "";
4
saleSearchObj.startTime = "";
5
saleSearchObj.endTime = "";
23343 ashik.ali 6
 
7
$(function() {
23973 govind 8
 
27754 amit.gupta 9
	$(document).on('click', ".pending_fofo_order", function() {
28422 tejbeer 10
		mouAcceptance()
11
	});
28420 tejbeer 12
 
13
 
28422 tejbeer 14
	$(document).on('click', ".pending_order_dashboard", function() {
15
		mouAcceptance()
26647 tejbeer 16
	});
17
 
28420 tejbeer 18
 
28358 tejbeer 19
	$(document).on('click', ".online-order", function() {
20
		loadOnlineOrder("main-content");
21
	});
22
 
33305 ranu 23
 
24
	$(document).on('click', ".b2c-customer-list", function () {
25
		loadAllB2CUsersList("main-content");
26
	});
27
 
28
	$(document).on('click', ".fetch-data", function () {
29
		loadAllB2CUsersListByDate("main-content");
30
	});
31
 
28339 tejbeer 32
	$(document).on('click', ".billed_order_item", function() {
33
		console.log("Helloo")
34
		loadBilledOrder("main-content");
35
	});
36
 
37
	$(document).on('click', ".unsettled_order_item", function() {
28350 tejbeer 38
 
28339 tejbeer 39
		loadUnsettledOrder("main-content");
40
	});
41
 
42
	$(document).on('click', ".settled_order_item", function() {
28350 tejbeer 43
 
28339 tejbeer 44
		loadSettledOrder("main-content");
45
	});
28422 tejbeer 46
	$(document).on('click', ".total_sale_dashboard", function() {
28339 tejbeer 47
 
28413 tejbeer 48
		loadSettledOrder("main-content");
49
	});
28339 tejbeer 50
 
28413 tejbeer 51
 
28339 tejbeer 52
	$(document).on('click', ".claim_raised_order_item", function() {
53
		console.log("Helloo")
54
		loadClaimedOrder("main-content");
55
	});
56
 
28358 tejbeer 57
 
58
	$(document).on('click', ".online-order-submit",
59
		function() {
60
			var status = $("#status").val();
61
 
62
			if (status == null) {
63
				alert("please select status")
64
				return false;
65
			}
28420 tejbeer 66
 
67
 
68
			if (status == "CANCELLED" || status == "FAILED" || status == "DELIVERED" || status == "SETTLED") {
33233 amit.gupta 69
				let pickerElement = getDatesFromPicker($('input[name="dateRange"]'))
28420 tejbeer 70
				doGetAjaxRequestHandler(context
33233 amit.gupta 71
					+ "/getAllOrdersByStatus?status=" + status + "&startTime=" + pickerElement.startDate + "&endTime=" + pickerElement.endDate, function(
28420 tejbeer 72
						response) {
73
					$('.order-item-detail').html(response);
74
				});
75
 
76
			} else {
77
 
78
				doGetAjaxRequestHandler(context
79
					+ "/getAllOrdersByStatus?status=" + status, function(
80
						response) {
81
					$('.order-item-detail').html(response);
82
				});
28358 tejbeer 83
			}
84
		});
85
 
28377 tejbeer 86
	$(document).on('click', ".online-all-order-item",
87
		function() {
88
 
89
 
90
			doGetAjaxRequestHandler(context
91
				+ "/getAllOnlineOrder", function(
92
					response) {
93
				$('#' + "main-content").html(response);
94
			});
95
		});
96
 
97
 
98
	$(document).on('click', ".all-online-order",
99
		function() {
100
 
101
			var date = $(".order-date").val();
102
 
103
 
104
			doGetAjaxRequestHandler(context
105
				+ "/getAllOnlineOrder?date=" + date, function(
106
					response) {
107
				$('#' + "main-content").html(response);
108
			});
109
		});
110
 
27755 amit.gupta 111
	$(document).on('click', "button.pendingOrderDetail",
27819 tejbeer 112
		function() {
113
			doGetAjaxRequestHandler(context
114
				+ "/getPendingOrderItem?orderId=" + $(this).data('orderid'), function(
115
					response) {
116
				$('.pending-order-container').html(response);
26647 tejbeer 117
			});
27819 tejbeer 118
		});
26647 tejbeer 119
 
27755 amit.gupta 120
	$(document).on('click', ".pendingOrderCancel",
27819 tejbeer 121
		function() {
26721 tejbeer 122
 
27819 tejbeer 123
			var orderId = $(this).data('orderid');
124
			console.log(orderId);
125
			if (confirm("Are you sure you want to cancel the order!") == true) {
126
				doPostAjaxRequestHandler(context
127
					+ "/cancelPendingOrder?id=" + orderId,
128
					function(response) {
129
						if (response == 'true') {
130
							alert("successfully Cancel");
131
							loadPendingOrder("main-content");
26721 tejbeer 132
						}
133
					});
134
 
27819 tejbeer 135
				return false;
136
			}
137
 
138
		});
139
 
26721 tejbeer 140
 
28339 tejbeer 141
	$(document).on('click', ".pendingOrderItemDelivered",
142
		function() {
143
 
144
			var orderItemId = $(this).data('poitemid');
145
			if (confirm("Are you sure you want to delivered the order item!") == true) {
146
				doPostAjaxRequestHandler(context
147
					+ "/deliveredPendingOrderItem?id="
148
					+ orderItemId, function(response) {
149
						if (response == 'true') {
150
							alert("successfully delivered marked");
151
							loadBilledOrder("main-content");
152
						}
153
					});
154
 
155
				return false;
156
			}
157
 
158
		});
159
 
160
	$(document).on('click', ".raiseClaim",
161
		function() {
162
 
163
			var orderItemId = $(this).data('poitemid');
164
			if (confirm("Are you sure you want to raise the claim!") == true) {
165
				doPostAjaxRequestHandler(context
166
					+ "/raiseClaimOrderItem?id="
167
					+ orderItemId, function(response) {
168
						if (response == 'true') {
169
							alert("successfully claim raised");
170
							loadClaimedOrder("main-content");
171
						}
172
					});
173
 
174
				return false;
175
			}
176
 
177
		});
178
 
28350 tejbeer 179
	$(document).on('click', ".verify-order-item",
180
		function() {
181
 
182
			var orderItemId = $(this).data('poitemid');
183
			if (confirm("Are you sure you want to verify the order!") == true) {
184
				doPostAjaxRequestHandler(context
185
					+ "/verifyOrderItem?id="
186
					+ orderItemId, function(response) {
187
						if (response == 'true') {
188
							alert("successfully verified");
28362 tejbeer 189
							$('.online-order-submit').click();
190
 
28350 tejbeer 191
						}
192
					});
193
 
194
				return false;
195
			}
196
 
197
		});
198
 
33400 ranu 199
	$(document).on('click', ".claimed-payment",
200
		function () {
201
 
202
			var orderItemId = $(this).data('poitemid');
203
			if (confirm("Are you sure you want to add this payment to retailer wallet!!") == true) {
204
				doPostAjaxRequestHandler(context
205
					+ "/onlinePaymentAddToPartnerWallet?id="
206
					+ orderItemId, function (response) {
207
					if (response == 'true') {
208
						alert("successfully verified");
209
						$('.online-order-submit').click();
210
 
211
					}
212
				});
213
 
214
				return false;
215
			}
216
 
217
		});
218
 
28352 tejbeer 219
	$(document).on('click', ".cancel-order-item",
220
		function() {
221
 
222
			var orderItemId = $(this).data('poitemid');
223
			doGetAjaxRequestHandler(context
224
				+ "/getPendingOrderItemById?id=" + orderItemId, function(response) {
225
					$('.cancel-online-order-container .modal-content').html(response);
226
				});
227
		});
228
 
28437 tejbeer 229
	$(document).on('click', ".change-partner",
230
		function() {
28352 tejbeer 231
 
28437 tejbeer 232
			var orderId = $(this).data('poid');
33367 ranu 233
            var pinCode = $(this).data('pincode');
28437 tejbeer 234
			doGetAjaxRequestHandler(context
33367 ranu 235
                + "/getPendingOrderChangePartnerById?id=" + orderId + "&&pinCode=" + pinCode, function (response) {
28437 tejbeer 236
					$('.change-partner-online-order-container  .modal-content').html(response);
237
				});
238
		});
239
 
240
 
241
	$(document).on('click', ".change-partner-po",
242
		function() {
243
			var orderId = $(this).data('poid');
244
			var fofoId = $("#fofo-users").val();
245
			if (confirm("Are you sure you want to change the partner!") == true) {
246
				doPostAjaxRequestHandler(context
247
					+ "/changePendingOrderPartner?id="
248
					+ orderId + "&fofoId=" + fofoId, function(response) {
249
						if (response == 'true') {
250
 
251
							alert("Partner Successfully Change");
252
							$('#changePartnerOnlineOrder').modal('hide');
253
							$('.modal-backdrop').remove();
254
							$('.online-order-submit').click();
255
 
256
						}
257
					});
258
 
259
				return false;
260
 
261
			}
262
 
263
		});
264
 
28352 tejbeer 265
	$(document).on('click', ".cancel-pending-order",
266
		function() {
267
			var orderItemId = $(this).data('poitemid');
268
			var reason = $('#selectCancelreason').val();
269
			console.log(reason)
270
 
271
			if (reason === "") {
272
				alert("Reason is required");
273
				return false;
274
			}
275
			if (reason == null) {
276
				alert("Reason is required");
277
				return false;
278
			}
279
			if (confirm("Are you sure you want to cancel the order!") == true) {
280
				doPostAjaxRequestHandler(context
281
					+ "/cancelPendingOrderItem?id="
282
					+ orderItemId + "&reason=" + reason, function(response) {
283
						if (response == 'true') {
284
							alert("successfully cancel");
285
							$('#cancelOnlineOrder').modal('hide');
286
							$('.modal-backdrop').remove();
28362 tejbeer 287
							$('.online-order-submit').click();
28352 tejbeer 288
 
289
						}
290
					});
291
 
292
				return false;
293
 
294
			}
295
 
296
		});
297
 
27754 amit.gupta 298
	$(document).on('click', ".sale-history", function() {
23343 ashik.ali 299
		console.log("Sale History Button Clicked...")
30611 tejbeer 300
		saleHistory("main-content", "", "", "", "");
23343 ashik.ali 301
	});
24880 govind 302
 
27754 amit.gupta 303
	$(document).on('click', ".insurance-policy-details", function() {
24880 govind 304
		console.log("insurance-policy-details");
305
		insurancePolicyDetails("main-content");
306
	});
307
 
27861 tejbeer 308
	$(document).on('change', '.fofoLineItemAmount',
309
		function() {
310
			var amount = 0;
311
			var oldtotalAmount = 0;
312
			console.log(oldtotalAmount)
313
			$('#fofo-item-table')
314
				.find('tr')
315
				.each(
316
					function() {
317
						var row = $(this);
318
						console.log(row);
319
 
320
						var currentRow = $(this)
321
							.closest("tr");
322
 
323
						var col5 = currentRow.find(
324
							"td:eq(3)  input[type='number']").val();
325
 
326
 
327
						oldtotalAmount = currentRow.find(
328
							"td:eq(5)").html();
329
 
330
						console.log(col5);
331
						if (col5 != undefined) {
332
							if (col5 != 0) {
333
								amount = amount + parseInt(col5, 10);
334
 
335
							}
336
						}
337
					});
338
 
339
 
340
 
341
			$("#totalAmount").text(amount);
342
 
343
		});
344
 
27755 amit.gupta 345
	$(document).on('click', ".updatePaymentDetails",
27819 tejbeer 346
		function() {
347
			console
348
				.log("updatePaymentDetails target Button Clicked...");
349
			var i = 1;
27861 tejbeer 350
			var paymentOptionsTotalAmount = 0;
27819 tejbeer 351
			var invoiceNumber = $(this).data('invoicenumber');
352
			var fofoId = $(this).data('fofoid');
27861 tejbeer 353
			var totalAmount = $('#editAmount').val();
27819 tejbeer 354
			var totalNumberOfPaymentOptionId = $(this).data(
355
				'totalnumberofpaymentoptionid');
356
			console.log("totalNumberOfPaymentOptionId"
357
				+ totalNumberOfPaymentOptionId);
358
			var referenceId = $(this).data('orderid');
359
			var referenceType = "ORDER";
360
			var createdTimeStamp = $(this).data('createddatetime');
361
			console.log(createdTimeStamp);
362
			console.log(fofoId);
363
			console.log(referenceId);
364
			console.log(invoiceNumber);
365
			console.log(referenceType);
366
			var paymentOptionTransactionModels = [];
27861 tejbeer 367
			var jsonObject = {};
27819 tejbeer 368
			var inputvalues = {};
369
			$('.paymentOptions input')
370
				.each(
24105 govind 371
					function() {
27819 tejbeer 372
						console.log($(this).val())
27861 tejbeer 373
						paymentOptionsTotalAmount += parseInt($(this).val(), 10)
27819 tejbeer 374
						if (!isFinite($(this).val())) {
375
							return;
376
						}
377
						inputvalues = {};
378
						inputvalues['paymentOptionId'] = $(
379
							this).data(
380
								'payment-option-id');
381
						inputvalues['amount'] = $(this)
382
							.val();
383
						inputvalues['createdTimeStamp'] = createdTimeStamp;
24105 govind 384
						console
27819 tejbeer 385
							.log(inputvalues['createdTimeStamp']);
386
						if (!inputvalues['amount']) {
387
							inputvalues['amount'] = "0";
24880 govind 388
						}
27819 tejbeer 389
						console.log("inputvalues['amount']"
390
							+ inputvalues['amount']);
391
						paymentOptionTransactionModels
392
							.push(inputvalues);
393
					});
394
			if (paymentOptionTransactionModels.length != totalNumberOfPaymentOptionId) {
395
				alert("Sending less or more paymentOptionIds for"
396
					+ fofoId);
397
				return false;
398
			}
27861 tejbeer 399
 
400
 
401
 
402
			var ItemIdsAmountArray = [];
403
			var itemIdsAmount;
404
			$('#fofo-item-table')
405
				.find('tr')
406
				.each(
407
					function() {
408
						var row = $(this);
409
						console.log(row);
410
 
411
 
412
 
413
						var currentRow = $(this)
414
							.closest("tr");
415
 
416
						var itemId = currentRow.find(
417
							"td:eq(0)").html();
418
 
419
						var col5 = currentRow.find(
420
							"td:eq(3)  input[type='number']").val();
421
						var fofoItemId = currentRow.find(
422
							"td:eq(3)  input[type='hidden']").val();
423
						console.log(itemId)
424
 
425
						console.log(col5);
426
						if (col5 != undefined) {
427
							if (col5 != 0) {
428
 
429
								itemIdsAmount = {
430
									"fofoItemId": fofoItemId,
431
									"amount": col5,
432
									"itemId": itemId
433
 
434
								}
435
								console.log(itemIdsAmount);
436
								ItemIdsAmountArray.push(itemIdsAmount);
437
 
438
								console.log(ItemIdsAmountArray)
439
							}
440
						}
441
					});
442
 
443
 
444
			var totalAmount = $("#totalAmount").html();
445
			console.log(totalAmount)
446
			console.log(paymentOptionsTotalAmount)
447
			if (paymentOptionsTotalAmount != totalAmount) {
448
				alert("Payment Options and Total Amount are not Same");
449
				return false;
450
			}
451
 
27819 tejbeer 452
			console.log(paymentOptionTransactionModels);
27861 tejbeer 453
			jsonObject['paymentOptionTransactionModel'] = paymentOptionTransactionModels;
454
			jsonObject['itemAmountModel'] = ItemIdsAmountArray;
455
 
456
			console.log(jsonObject);
27819 tejbeer 457
			if (confirm("Are you sure you want to update paymentTransaction!") == true) {
458
				doPutAjaxRequestWithJsonHandler(
459
					context
460
					+ "/updatePaymentTransaction?referenceId="
461
					+ referenceId + "&referenceType="
462
					+ referenceType + "&fofoId="
27861 tejbeer 463
					+ fofoId + "&totalAmount=" + totalAmount,
27819 tejbeer 464
					JSON
27861 tejbeer 465
						.stringify(jsonObject),
27819 tejbeer 466
					function(response) {
467
						if (response === 'true') {
468
							alert("successfully added");
469
							loadSearchOrderDetails(
470
								invoiceNumber,
471
								"search-order-details-container");
24105 govind 472
						}
473
					});
27819 tejbeer 474
			}
24105 govind 475
 
27819 tejbeer 476
		});
477
 
27755 amit.gupta 478
	$(document).on('change', '#searchType',
27819 tejbeer 479
		function() {
480
			var searchType = $("#searchType option:selected").val();
481
			var searchTypevalue = $(this).find('option:selected').text();
482
			;
483
			saleSearchObj.searchType = searchType;
484
			console.log("selected searchType = " + searchType);
24105 govind 485
 
27819 tejbeer 486
			saleHistory("main-content", saleSearchObj.searchType, "",
30607 amit.gupta 487
				"", "");
24105 govind 488
 
27819 tejbeer 489
			$("#sale-history-search-text").val('');
490
		});
23973 govind 491
 
27755 amit.gupta 492
	$(document).on('click', "#sale-history-search-button",
27819 tejbeer 493
		function() {
494
			var searchType = $("#searchType option:selected").val();
495
			console.log("searchType = " + searchType);
496
			$("#searchType").removeClass("border-highlight");
497
			saleSearchObj.searchText = $(
498
				"#sale-history-search-text").val();
499
			saleSearchObj.searchType = searchType;
30628 tejbeer 500
 
501
			if (searchType == "Date-Range") {
502
				let saleDuration = getDatesFromPicker("#saleDuration");
503
				saleSearchObj.startTime = saleDuration.startDate;
504
				saleSearchObj.endTime = saleDuration.endDate;
505
			} else {
506
 
507
				saleSearchObj.startTime = "";
508
				saleSearchObj.endTime = "";
509
 
510
			}
27819 tejbeer 511
			if (typeof (saleSearchObj.searchText) == "undefined"
512
				|| !saleSearchObj.searchText) {
513
				saleSearchObj.searchText = "";
514
			}
515
			saleHistorySearchInfo(saleSearchObj.searchType,
516
				saleSearchObj.searchText,
517
				saleSearchObj.startTime, saleSearchObj.endTime);
518
		});
27755 amit.gupta 519
	$(document).on('click', "#invoice-download-button",
27819 tejbeer 520
		function() {
521
			var searchType = $("#searchType option:selected").val();
522
			console.log("searchType = " + searchType);
523
			$("#searchType").removeClass("border-highlight");
524
			saleSearchObj.searchText = $(
525
				"#sale-history-search-text").val();
526
			saleSearchObj.searchType = searchType;
30607 amit.gupta 527
			let saleDuration = getDatesFromPicker("#saleDuration");
528
			saleSearchObj.startTime = saleDuration.startDate;
529
			saleSearchObj.endTime = saleDuration.endDate;
27819 tejbeer 530
			if (typeof (saleSearchObj.searchText) == "undefined"
531
				|| !saleSearchObj.searchText) {
532
				saleSearchObj.searchText = "";
533
			}
534
			downloadInvoices(saleSearchObj.searchType,
535
				saleSearchObj.searchText,
536
				saleSearchObj.startTime, saleSearchObj.endTime);
537
		});
23973 govind 538
 
27754 amit.gupta 539
	$(document).on('click', ".search-order", function() {
23584 ashik.ali 540
		console.log("search-order clicked")
541
		loadSearchOrder("main-content");
23973 govind 542
	});
543
 
27819 tejbeer 544
	$(document).on('click', ".invoices-cancel", function() {
545
		console.log("searc-order clicked")
546
		loadInvoiceSearchOrder("main-content");
547
	});
548
 
27755 amit.gupta 549
	$(document).on('click', "#search-order-button",
27819 tejbeer 550
		function() {
551
			console.log("search-order-button clicked")
552
			var invoiceNumber = $("#search-order-text").val();
553
			loadSearchOrderDetails(invoiceNumber,
554
				"search-order-details-container");
555
		});
23973 govind 556
 
27819 tejbeer 557
	$(document).on('click', "#search-invoice-button",
558
		function() {
559
			console.log("search-order-button clicked")
560
			var invoiceNumber = $("#search-invoice-text").val();
561
			console.log(invoiceNumber);
562
			loadSearchOrderDetails(invoiceNumber,
563
				"search-order-details-container");
564
		});
565
 
566
 
567
 
568
	$(document).on('click', "#cancel-invoice-button",
569
		function() {
570
			var invoiceNumber = $("#search-invoice-text").val();
571
			console.log(invoiceNumber);
572
			if (confirm("Are you sure you want to cancel the order !") == true) {
573
				doPostAjaxRequestHandler(context
574
					+ "/cancelOrderByInvoice?invoiceNumbers="
575
					+ invoiceNumber, function(response) {
576
						if (response == 'true') {
577
							alert("Successfully Cancel");
578
							loadInvoiceSearchOrder("main-content");
579
						}
580
					});
581
 
582
				return false;
583
			}
584
		});
585
 
27755 amit.gupta 586
	$(document).on('click', "#sale-history-paginated .next",
27819 tejbeer 587
		function() {
588
			var params = {};
589
			params['searchType'] = saleSearchObj.searchType;
590
			params['searchValue'] = saleSearchObj.searchText;
591
			params['startTime'] = walletHistory.startTime;
592
			params['endTime'] = walletHistory.endTime;
593
			loadPaginatedNextItems('/getPaginatedSaleHistory', params,
594
				'sale-history-paginated', 'sale-history-table',
595
				'sale-details-container');
596
			$(this).blur();
597
		});
27755 amit.gupta 598
	$(document).on('click', "#insurance-paginated .next",
27819 tejbeer 599
		function() {
600
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
601
				'insurance-paginated', 'insurance-details-table',
602
				'insurance-policy-details-container');
603
			$(this).blur();
604
		});
27755 amit.gupta 605
	$(document).on('click', "#insurance-paginated .previous",
27819 tejbeer 606
		function() {
607
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
608
				'insurance-paginated', 'insurance-details-table',
609
				'insurance-policy-details-container');
610
			$(this).blur();
611
		});
23973 govind 612
 
27755 amit.gupta 613
	$(document).on('click', "#sale-history-paginated .previous",
27819 tejbeer 614
		function() {
615
			var params = {};
616
			params['searchType'] = saleSearchObj.searchType;
617
			params['searchValue'] = saleSearchObj.searchText;
618
			params['startTime'] = walletHistory.startTime;
619
			params['endTime'] = walletHistory.endTime;
620
			loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
621
				'sale-history-paginated', 'sale-history-table',
622
				'sale-details-container');
623
			$(this).blur();
624
		});
23973 govind 625
 
626
	// grn-details
627
 
27754 amit.gupta 628
	$(document).on('click', ".sale-details", function() {
23654 amit.gupta 629
		orderId = $(this).attr('data');
23973 govind 630
		console.log("orderId = " + orderId);
631
		loadSaleDetails(orderId, "sale-details-container");
23343 ashik.ali 632
	});
27861 tejbeer 633
 
634
	$(document).on('click', "#editamountbutton", function() {
635
		$('#editAmount').show();
636
	});
637
 
33319 ranu 638
	$(document).on('click', '.downloadB2CList-mk', function () {
639
		var startDate = $("#startDate-b2c-user").val();
640
 
641
		var endDate = $("#endDate-b2c-user").val();
642
		if (startDate == "" || startDate == undefined) {
643
			alert("start date is not be empty!!");
644
			return;
645
		}
646
		if (endDate == "" || endDate == undefined) {
647
 
648
			alert("end date is not be empty!!");
649
			return;
650
		}
651
 
652
		let endPoint = `${context}/downloadB2CUsersList?startDate=${startDate}&endDate=${endDate}`;
653
 
654
		window.location.href = endPoint;
655
 
656
 
657
	});
658
 
23343 ashik.ali 659
});
660
 
23973 govind 661
function loadSaleDetails(orderId, domId) {
662
	doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
27819 tejbeer 663
		function(response) {
664
			$('#' + domId).html(response);
665
		});
23343 ashik.ali 666
}
667
 
28358 tejbeer 668
function loadOnlineOrder(domId) {
669
	doGetAjaxRequestHandler(context + "/getOnlineOrder", function(response) {
670
		$('#' + domId).html(response);
671
 
672
	});
673
}
674
 
26647 tejbeer 675
function loadPendingOrder(domId) {
676
	doGetAjaxRequestHandler(context + "/pendingOrders", function(response) {
677
		$('#' + domId).html(response);
678
 
679
	});
680
}
681
 
28339 tejbeer 682
function loadClaimedOrder(domId) {
683
	doGetAjaxRequestHandler(context + "/claimedOrders", function(response) {
684
		$('#' + domId).html(response);
685
 
686
	});
687
}
688
 
28420 tejbeer 689
function statusChangeAction() {
690
	var val = $('#status').val();
691
	if (val == "CANCELLED" || val == "FAILED" || val == "DELIVERED" || val == "SETTLED") {
692
		console.log("show")
693
		$("#daterangerequ").show();
694
	} else {
695
		$("#daterangerequ").hide();
696
	}
28339 tejbeer 697
 
28420 tejbeer 698
}
699
 
700
 
28339 tejbeer 701
function loadBilledOrder(domId) {
702
	doGetAjaxRequestHandler(context + "/billedOrders", function(response) {
703
		$('#' + domId).html(response);
704
 
705
	});
706
}
707
 
708
 
33305 ranu 709
function loadAllB2CUsersList(domId) {
28339 tejbeer 710
 
33305 ranu 711
	doGetAjaxRequestHandler(`${context}/getB2cUserslist`, function (response) {
712
		$('#' + domId).html(response);
713
 
714
	});
715
}
716
 
717
function loadAllB2CUsersListByDate(domId) {
718
	var startDate = $("#startDate-b2c-user").val();
719
 
720
	var endDate = $("#endDate-b2c-user").val();
721
	if (startDate == "" || startDate == undefined) {
722
		alert("start date is not be empty!!");
723
		return;
724
	}
725
	if (endDate == "" || endDate == undefined) {
726
 
727
		alert("end date is not be empty!!");
728
		return;
729
	}
730
	doGetAjaxRequestHandler(`${context}/getB2cUserslistByDate?startDate=${startDate}&endDate=${endDate}`, function (response) {
731
		$('#' + domId).html(response);
732
 
733
	});
734
}
735
 
736
 
28339 tejbeer 737
function loadUnsettledOrder(domId) {
738
	doGetAjaxRequestHandler(context + "/unsettledOrders", function(response) {
739
		$('#' + domId).html(response);
740
 
741
	});
742
}
743
 
744
 
745
function loadSettledOrder(domId) {
746
	doGetAjaxRequestHandler(context + "/settledOrders", function(response) {
747
		$('#' + domId).html(response);
748
 
749
	});
750
}
23973 govind 751
function loadSearchOrder(domId) {
752
	doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
23584 ashik.ali 753
		$('#' + domId).html(response);
754
	});
755
}
756
 
27819 tejbeer 757
function loadInvoiceSearchOrder(domId) {
758
	console.log("Hello");
759
	doGetAjaxRequestHandler(context + "/getInvoiceSearchOrder", function(response) {
23584 ashik.ali 760
		$('#' + domId).html(response);
761
	});
762
}
763
 
27819 tejbeer 764
function loadSearchOrderDetails(invoiceNumber, domId) {
765
	doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
766
		+ invoiceNumber, function(response) {
767
			$('#' + domId).html(response);
27861 tejbeer 768
			$('#editAmount').hide();
769
 
27819 tejbeer 770
		});
771
}
772
 
23973 govind 773
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
774
	doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
27819 tejbeer 775
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
776
		+ "&endTime=" + endTime, function(response) {
777
			$('#' + domId).html(response);
778
		});
23343 ashik.ali 779
}
780
 
23973 govind 781
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
23343 ashik.ali 782
	saleHistory("main-content", searchType, searchText, startTime, endTime);
24105 govind 783
 
784
}
24880 govind 785
function insurancePolicyDetails(domId) {
786
	doGetAjaxRequestHandler(context + "/insuranceDetails", function(response) {
787
		$('#' + domId).html(response);
788
	});
789
}
25093 amit.gupta 790
 
791
function downloadInvoices(searchType, searchValue, startTime, endTime) {
792
	doAjaxGetDownload(context + "/downloadInvoices?searchType=" + searchType
27819 tejbeer 793
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
794
		+ "&endTime=" + endTime, "invoices.pdf");
25093 amit.gupta 795
}
28422 tejbeer 796
function mouAcceptance() {
797
	doGetAjaxRequestHandler(context + "/getMouForm", function(response) {
798
		console.log(response)
799
		if (response == 'true') {
800
			loadPendingOrder("main-content");
801
		} else {
802
			bootbox.confirm({
803
				message: "<h4 style='text-align:center'>MEMORANDUM OF UNDERSTANDING</h4>" +
804
					" <br> <p style='text-align:justify'>The Smartdukaan has introduced a scheme which shall increase the reach of franchisee partner location by making them accessible online. The Company has started an application of 'smartdukaan online store' whereby the customers can book their products online on website namely <a href=''>store.smartdukaan.com</a>." +
805
					"The order booked under the relevant area pin code committed by franchisee shall be executed/fulfilled and delivered by said franchisee." +
806
					"<br> <b>WHEREAS</b> the franchisee has agreed to participate under said scheme on terms and condition mutually accepted as here under:-" +
807
					"<br><br> <b>NOW THIS MOU STATES THE TERMS AND CONDITIONS DETAILED HEREUNDER;</b>" +
808
					" </p>" +
809
					"<ol style='text-align:justify'>" +
810
					"<li>The Company has launched a web application namely 'smartdukaan online store' whereby the customers can book their products online on website namely <a href=''>store.smartdukaan.com</a>. The products available at the specific store location of franchisee shall be accessible by customer based on area pin code and can be ordered online. The said order once placed shall be duly delivered and executed by respective franchisee with full rigor and spontaneity.</li>" +
811
					"<li>The Company operates an online marketplace program on the its website <a href=''>store.smartdukaan.com</a> which enables franchisee  to sell their products alongside at their store and, once an order is placed, to ship such franchisee' products directly to the customer. Any use of the Company website is subject to the following additional terms:</li>" +
812
					"<ol type='I' style = 'text-align:justify'>" +
813
					"<li>When we say 'franchisee,' we mean an entity or retailer titled as franchisee above that operates a Smartdukaan at designated location and sells goods or services in the through the Company Sites.</li>" +
814
					"<li>By purchasing a product from our website, franchisee acknowledges that all said orders will be fulfilled by the franchisee and not Company. The franchisee (and not Company) will be responsible for all processing, shipping, returns, and customer service related to customer order received online. Products purchased from a franchisee can only be returned to that franchisee in accordance with its return policy. The franchisee shall make the customer aware of same while making due delivery of product. </li>" +
815
					"<li>To the fullest extent provided by applicable law, Company has no responsibility or liability for any franchisee, their products, or representations.</li>" +
816
					"<li>Once order has been placed on Company site by customer for delivery. The Company will send franchisee an order acknowledgment by email setting out what has been ordered. This is not an order confirmation or acceptance from us. Due shipment and delivery times shall be displayed on the website and franchisee shall ensure due fluffiness of order within said timelines. The Company is not responsible for delayed delivery and the same shall be sole responsibility of franchisee.</li>" +
817
					"</ol>" +
28350 tejbeer 818
 
28422 tejbeer 819
					"<li>The franchisee operates a smartdukaan at its location and has agreed to cover services within area PIN Code as per Annexure 1,adjoining its location for fulfilling customer orders received online. </li>" +
820
					"<li>The franchisee holds responsibility to update its stock immediately on execution of customer order so that the website can be duly updated for relevant stock available in particular PIN Code. </li>" +
821
					"<li>The customers are given various payment options online including Cash on delivery and payment via EMI apart from online digital mode of payment Via Credit card, wallet etc. The franchisee agrees that if a customer opts for making payment via 'cash on delivery' against the product ordered online, the same shall be collected by franchisee against due delivery of product at his sole responsibility. </li>" +
822
					"<li>The franchisee holds responsibility to activate the handset at the time of delivery to the customer so as to be eligible for the activation scheme. </li>" +
823
					"<li>The franchisee shall adopt best of practices in customer service and shall not involve itself in erroneous or fraudulent activities which if found shall be sole responsibility of franchisee and NSSPL shall not be help responsibility for same.</li>" +
824
					"<li>The current scheme is merely a visual representation for franchisee to sell its products online and in case there remains any dispute pertaining to product, delivery , poor services or payment dispute etc of whatsoever nature, the same shall be sole responsibility of franchisee and the Company/NSSPL shall not be held responsible for same.The Company/NSSPL may upload and update these Terms of Use from time to time by notifying changes by any reasonable means, including by posting a revised Terms of Use through its website. The franchisee agrees that it his responsibility to regularly check <a href=''>store.smartdukaan.com</a> for any updated Terms of Use and ensure that himself as well customers are regularly advised on said basis. </li>" +
825
					"<li>The product displayed online are for retail use & distribution only to end customer. Website cannot mis utilized to make wholesale to any sub-dealer nor franchisee can use the online mode to make wholesale of its product.</li>" +
826
					"<li>The franchisee agrees that he shall charge the same amount as displayed online by Company on behalf of franchisee. Thus, shall not involve itself in practices of overcharging , blackmarketing or hoarding etc , which if found shall be at sole peril of franchisee and Company disclaims from same.</li>" +
827
					"<li>The franchisee certify that the stock update provided by them on or through the website is accurate and that the information you provide on or through the Smartdukaan online store is complete. Franchisee and customers are solely responsible for maintaining the confidentiality and security of account including username, password, and PIN. The Company/NSSPL is not responsible for any losses arising out of the unauthorized use of your account. </li>" +
828
					"<li>The Company will have the right (but not the obligation), in its sole discretion, to monitor, evaluate, and analyse Content, and any use of and access to the Company websites, including to determine compliance with these Terms of Use and any other operating rules that may be established by Company from time to time.</li>" +
829
					"<li>The company will also have the right (but not the obligation), in its sole discretion, to edit, move, delete, or refuse to make available any Content made available through, the its Sites, for any reason, including violation of these Terms of Use, whether for legal or other reasons. Despite this right of Company, franchiseeis solely responsible for any stock information that and content thathe make available, and agrees to indemnify Company/NSSPL for all claims resulting from any information thathe has made available or services conducted by franchisee post receipt of order on Company website</li>" +
830
					"<li>The <a href=''>store.smartdukaan.com</a> may make available listings, descriptions, and images of goods and services (collectively, “Products”). The Company makes no representations as to the completeness, accuracy, reliability, validity, or timeliness of such listings, descriptions, or images (including any features, specifications, and prices contained on the Sites) and franchisee shall advise the customer about its proper usage, if required. Such information and the availability of any Product are subject to change at any time without notice.</li>" +
831
					"<li>The company have made efforts to accurately display the attributes of Products, including the applicable colors. However, as the actual colors seen will depend on customers monitor, the company cannot guarantee the monitor's display of any color will accurately reflect actual product color or finish. In addition, certain weights, measures, and similar descriptions are approximate and are for convenience only. </li>" +
832
					"<li>The franchisee holds sole responsibility to advise the customer on same.</li>" +
833
					"<li>The Companywebsite and all Materials, and all copyrights, trademarks, trade dress, and other intellectual property rights there (collectively, the 'IP') are owned or controlled by or licensed to Company, and are protected by Indian law and trademark, copyright, and other intellectual property laws. Subject to compliance with this MOU,  Terms of Use, and solely for so long as is permitted by Company to use the Company's Sites, one may access, view, download, and print the Materials for their personal, non-commercial use only; provided, however, that (1) One retains all copyright, trademark, or other proprietary designations contained on all Materials; (2) do not modify or alter the Materials in any way; and (3) do not provide or make available the Materials to any third party in a commercial manner.</li>" +
834
					"<li>No license, right, title, or interest in the websites or any Materials is transferred as a result of use of the Company Sites or one's accessing, viewing, downloading, or printing of the Materials. One may not reproduce (except as noted above), publish, transmit, distribute, display, modify, create derivative works from, sell, or participate in any sale of or exploit in any way, in whole or in part, any of the Materials or the its websites. The Companywebsites and Materials may be used only as a personal shopping resource. Any other use, including the reproduction, modification, distribution, transmission, republication, display, or performance, of the Company websites and the Materials is strictly prohibited.</li>" +
835
					"<li>Pricing for product Pickup and delivery items will be the same prices as if customer has shopped in the store that packs and delivers the items. If an item's price changes between the time customer placestheir order and the day your order is packed for delivery, franchisee will charge customer the lower price.  </li>" +
836
					"<li>Franchisee agree to defend, indemnify, and hold the Company harmless from and against any and all liabilities, claims, damages, costs, and expenses, including attorneys' fees and costs, arising from or related to your misuse of the Company Site or any breach of thus MOU, Terms of Use or from any deficient service claimed by customer against the franchisee& Company while execution of a particular order. </li>" +
837
					"<li> THE WEBSITE, AND ALL CONTENT, MATERIALS, PRODUCTS, SERVICES, FUNCTIONALITY, AND OTHER ITEMS INCLUDED ON OR OTHERWISE MADE AVAILABLE THROUGH THE WEBSITE, AND/OR SMARTDUKAAN STORE LOCATIONS, ARE PROVIDED BY COMPANY ON AN 'AS IS' AND 'AS AVAILABLE' BASIS UPDATED BY FRANCHISEE. THE COMPANY DOES NOT MAKE ANY REPRESENTATIONS OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, AS TO THE OPERATION OF THE WEBSITE OR THE CONTENT, MATERIALS, PRODUCTS, SERVICES, FUNCTIONALITY, OR OTHER ITEMS INCLUDED ON OR OTHERWISE MADE AVAILABLE TO CUSTOMERS. TO THE FULLEST EXTENT PERMISSIBLE BY APPLICABLE LAW, THE COMPANY DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WITHOUT LIMITING THE FOREGOING, THE COMPANY DISCLAIM ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, FOR ANY PRODUCT OFFERED. THE CUSTOMER AND FRANCHISEE ACKNOWLEDGE THAT, TO THE FULLEST EXTENT PROVIDED BY APPLICABLE LAW, THE USE OF THE COMPANY SITES IS AT YOUR SOLE RISK." +
838
					" <br> TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, COMPANY IS NOT IS RESPONSIBLE FOR ANY LOSS OR DAMAGE TO PROPERTY OR DATA THAT RESULTS FROM ANY MATERIALS YOU ACCESS OR DOWNLOAD FROM THE WEBSITE.</li>" +
839
					"<li>This agreement is co terminus with franchisee agreement executed by franchisee with the Company /NSSPL.The parties agree that this MOU shall be governed by standard terms and condition which are mentioned under the franchise agreement executed among the parties and not covered under this MOU.</li>" +
840
					"</ol>" +
841
					"<ul><li>I understand and accepted the terms and conditions.</li></ul>"
842
				,
843
				buttons: {
844
					confirm: {
845
						label: 'I agree',
846
						className: 'btn-success'
847
					},
848
					cancel: {
849
						label: 'I disagree',
850
						className: 'btn-danger'
851
					}
852
				},
853
				callback: function(result) {
854
					if (result == true) {
855
						loadPendingOrder("main-content");
856
					}
857
				}
858
			}).find("div.modal-body").css({ "height": "700px", "overflow-y": "auto" });
859
		}
860
	});
28358 tejbeer 861
 
28422 tejbeer 862
}