Subversion Repositories SmartDukaan

Rev

Rev 33233 | Rev 33319 | 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
 
28352 tejbeer 199
	$(document).on('click', ".cancel-order-item",
200
		function() {
201
 
202
			var orderItemId = $(this).data('poitemid');
203
			doGetAjaxRequestHandler(context
204
				+ "/getPendingOrderItemById?id=" + orderItemId, function(response) {
205
					$('.cancel-online-order-container .modal-content').html(response);
206
				});
207
		});
208
 
28437 tejbeer 209
	$(document).on('click', ".change-partner",
210
		function() {
28352 tejbeer 211
 
28437 tejbeer 212
			var orderId = $(this).data('poid');
213
			doGetAjaxRequestHandler(context
214
				+ "/getPendingOrderChangePartnerById?id=" + orderId, function(response) {
215
					$('.change-partner-online-order-container  .modal-content').html(response);
216
				});
217
		});
218
 
219
 
220
	$(document).on('click', ".change-partner-po",
221
		function() {
222
			var orderId = $(this).data('poid');
223
			var fofoId = $("#fofo-users").val();
224
			if (confirm("Are you sure you want to change the partner!") == true) {
225
				doPostAjaxRequestHandler(context
226
					+ "/changePendingOrderPartner?id="
227
					+ orderId + "&fofoId=" + fofoId, function(response) {
228
						if (response == 'true') {
229
 
230
							alert("Partner Successfully Change");
231
							$('#changePartnerOnlineOrder').modal('hide');
232
							$('.modal-backdrop').remove();
233
							$('.online-order-submit').click();
234
 
235
						}
236
					});
237
 
238
				return false;
239
 
240
			}
241
 
242
		});
243
 
28352 tejbeer 244
	$(document).on('click', ".cancel-pending-order",
245
		function() {
246
			var orderItemId = $(this).data('poitemid');
247
			var reason = $('#selectCancelreason').val();
248
			console.log(reason)
249
 
250
			if (reason === "") {
251
				alert("Reason is required");
252
				return false;
253
			}
254
			if (reason == null) {
255
				alert("Reason is required");
256
				return false;
257
			}
258
			if (confirm("Are you sure you want to cancel the order!") == true) {
259
				doPostAjaxRequestHandler(context
260
					+ "/cancelPendingOrderItem?id="
261
					+ orderItemId + "&reason=" + reason, function(response) {
262
						if (response == 'true') {
263
							alert("successfully cancel");
264
							$('#cancelOnlineOrder').modal('hide');
265
							$('.modal-backdrop').remove();
28362 tejbeer 266
							$('.online-order-submit').click();
28352 tejbeer 267
 
268
						}
269
					});
270
 
271
				return false;
272
 
273
			}
274
 
275
		});
276
 
27754 amit.gupta 277
	$(document).on('click', ".sale-history", function() {
23343 ashik.ali 278
		console.log("Sale History Button Clicked...")
30611 tejbeer 279
		saleHistory("main-content", "", "", "", "");
23343 ashik.ali 280
	});
24880 govind 281
 
27754 amit.gupta 282
	$(document).on('click', ".insurance-policy-details", function() {
24880 govind 283
		console.log("insurance-policy-details");
284
		insurancePolicyDetails("main-content");
285
	});
286
 
27861 tejbeer 287
	$(document).on('change', '.fofoLineItemAmount',
288
		function() {
289
			var amount = 0;
290
			var oldtotalAmount = 0;
291
			console.log(oldtotalAmount)
292
			$('#fofo-item-table')
293
				.find('tr')
294
				.each(
295
					function() {
296
						var row = $(this);
297
						console.log(row);
298
 
299
						var currentRow = $(this)
300
							.closest("tr");
301
 
302
						var col5 = currentRow.find(
303
							"td:eq(3)  input[type='number']").val();
304
 
305
 
306
						oldtotalAmount = currentRow.find(
307
							"td:eq(5)").html();
308
 
309
						console.log(col5);
310
						if (col5 != undefined) {
311
							if (col5 != 0) {
312
								amount = amount + parseInt(col5, 10);
313
 
314
							}
315
						}
316
					});
317
 
318
 
319
 
320
			$("#totalAmount").text(amount);
321
 
322
		});
323
 
27755 amit.gupta 324
	$(document).on('click', ".updatePaymentDetails",
27819 tejbeer 325
		function() {
326
			console
327
				.log("updatePaymentDetails target Button Clicked...");
328
			var i = 1;
27861 tejbeer 329
			var paymentOptionsTotalAmount = 0;
27819 tejbeer 330
			var invoiceNumber = $(this).data('invoicenumber');
331
			var fofoId = $(this).data('fofoid');
27861 tejbeer 332
			var totalAmount = $('#editAmount').val();
27819 tejbeer 333
			var totalNumberOfPaymentOptionId = $(this).data(
334
				'totalnumberofpaymentoptionid');
335
			console.log("totalNumberOfPaymentOptionId"
336
				+ totalNumberOfPaymentOptionId);
337
			var referenceId = $(this).data('orderid');
338
			var referenceType = "ORDER";
339
			var createdTimeStamp = $(this).data('createddatetime');
340
			console.log(createdTimeStamp);
341
			console.log(fofoId);
342
			console.log(referenceId);
343
			console.log(invoiceNumber);
344
			console.log(referenceType);
345
			var paymentOptionTransactionModels = [];
27861 tejbeer 346
			var jsonObject = {};
27819 tejbeer 347
			var inputvalues = {};
348
			$('.paymentOptions input')
349
				.each(
24105 govind 350
					function() {
27819 tejbeer 351
						console.log($(this).val())
27861 tejbeer 352
						paymentOptionsTotalAmount += parseInt($(this).val(), 10)
27819 tejbeer 353
						if (!isFinite($(this).val())) {
354
							return;
355
						}
356
						inputvalues = {};
357
						inputvalues['paymentOptionId'] = $(
358
							this).data(
359
								'payment-option-id');
360
						inputvalues['amount'] = $(this)
361
							.val();
362
						inputvalues['createdTimeStamp'] = createdTimeStamp;
24105 govind 363
						console
27819 tejbeer 364
							.log(inputvalues['createdTimeStamp']);
365
						if (!inputvalues['amount']) {
366
							inputvalues['amount'] = "0";
24880 govind 367
						}
27819 tejbeer 368
						console.log("inputvalues['amount']"
369
							+ inputvalues['amount']);
370
						paymentOptionTransactionModels
371
							.push(inputvalues);
372
					});
373
			if (paymentOptionTransactionModels.length != totalNumberOfPaymentOptionId) {
374
				alert("Sending less or more paymentOptionIds for"
375
					+ fofoId);
376
				return false;
377
			}
27861 tejbeer 378
 
379
 
380
 
381
			var ItemIdsAmountArray = [];
382
			var itemIdsAmount;
383
			$('#fofo-item-table')
384
				.find('tr')
385
				.each(
386
					function() {
387
						var row = $(this);
388
						console.log(row);
389
 
390
 
391
 
392
						var currentRow = $(this)
393
							.closest("tr");
394
 
395
						var itemId = currentRow.find(
396
							"td:eq(0)").html();
397
 
398
						var col5 = currentRow.find(
399
							"td:eq(3)  input[type='number']").val();
400
						var fofoItemId = currentRow.find(
401
							"td:eq(3)  input[type='hidden']").val();
402
						console.log(itemId)
403
 
404
						console.log(col5);
405
						if (col5 != undefined) {
406
							if (col5 != 0) {
407
 
408
								itemIdsAmount = {
409
									"fofoItemId": fofoItemId,
410
									"amount": col5,
411
									"itemId": itemId
412
 
413
								}
414
								console.log(itemIdsAmount);
415
								ItemIdsAmountArray.push(itemIdsAmount);
416
 
417
								console.log(ItemIdsAmountArray)
418
							}
419
						}
420
					});
421
 
422
 
423
			var totalAmount = $("#totalAmount").html();
424
			console.log(totalAmount)
425
			console.log(paymentOptionsTotalAmount)
426
			if (paymentOptionsTotalAmount != totalAmount) {
427
				alert("Payment Options and Total Amount are not Same");
428
				return false;
429
			}
430
 
27819 tejbeer 431
			console.log(paymentOptionTransactionModels);
27861 tejbeer 432
			jsonObject['paymentOptionTransactionModel'] = paymentOptionTransactionModels;
433
			jsonObject['itemAmountModel'] = ItemIdsAmountArray;
434
 
435
			console.log(jsonObject);
27819 tejbeer 436
			if (confirm("Are you sure you want to update paymentTransaction!") == true) {
437
				doPutAjaxRequestWithJsonHandler(
438
					context
439
					+ "/updatePaymentTransaction?referenceId="
440
					+ referenceId + "&referenceType="
441
					+ referenceType + "&fofoId="
27861 tejbeer 442
					+ fofoId + "&totalAmount=" + totalAmount,
27819 tejbeer 443
					JSON
27861 tejbeer 444
						.stringify(jsonObject),
27819 tejbeer 445
					function(response) {
446
						if (response === 'true') {
447
							alert("successfully added");
448
							loadSearchOrderDetails(
449
								invoiceNumber,
450
								"search-order-details-container");
24105 govind 451
						}
452
					});
27819 tejbeer 453
			}
24105 govind 454
 
27819 tejbeer 455
		});
456
 
27755 amit.gupta 457
	$(document).on('change', '#searchType',
27819 tejbeer 458
		function() {
459
			var searchType = $("#searchType option:selected").val();
460
			var searchTypevalue = $(this).find('option:selected').text();
461
			;
462
			saleSearchObj.searchType = searchType;
463
			console.log("selected searchType = " + searchType);
24105 govind 464
 
27819 tejbeer 465
			saleHistory("main-content", saleSearchObj.searchType, "",
30607 amit.gupta 466
				"", "");
24105 govind 467
 
27819 tejbeer 468
			$("#sale-history-search-text").val('');
469
		});
23973 govind 470
 
27755 amit.gupta 471
	$(document).on('click', "#sale-history-search-button",
27819 tejbeer 472
		function() {
473
			var searchType = $("#searchType option:selected").val();
474
			console.log("searchType = " + searchType);
475
			$("#searchType").removeClass("border-highlight");
476
			saleSearchObj.searchText = $(
477
				"#sale-history-search-text").val();
478
			saleSearchObj.searchType = searchType;
30628 tejbeer 479
 
480
			if (searchType == "Date-Range") {
481
				let saleDuration = getDatesFromPicker("#saleDuration");
482
				saleSearchObj.startTime = saleDuration.startDate;
483
				saleSearchObj.endTime = saleDuration.endDate;
484
			} else {
485
 
486
				saleSearchObj.startTime = "";
487
				saleSearchObj.endTime = "";
488
 
489
			}
27819 tejbeer 490
			if (typeof (saleSearchObj.searchText) == "undefined"
491
				|| !saleSearchObj.searchText) {
492
				saleSearchObj.searchText = "";
493
			}
494
			saleHistorySearchInfo(saleSearchObj.searchType,
495
				saleSearchObj.searchText,
496
				saleSearchObj.startTime, saleSearchObj.endTime);
497
		});
27755 amit.gupta 498
	$(document).on('click', "#invoice-download-button",
27819 tejbeer 499
		function() {
500
			var searchType = $("#searchType option:selected").val();
501
			console.log("searchType = " + searchType);
502
			$("#searchType").removeClass("border-highlight");
503
			saleSearchObj.searchText = $(
504
				"#sale-history-search-text").val();
505
			saleSearchObj.searchType = searchType;
30607 amit.gupta 506
			let saleDuration = getDatesFromPicker("#saleDuration");
507
			saleSearchObj.startTime = saleDuration.startDate;
508
			saleSearchObj.endTime = saleDuration.endDate;
27819 tejbeer 509
			if (typeof (saleSearchObj.searchText) == "undefined"
510
				|| !saleSearchObj.searchText) {
511
				saleSearchObj.searchText = "";
512
			}
513
			downloadInvoices(saleSearchObj.searchType,
514
				saleSearchObj.searchText,
515
				saleSearchObj.startTime, saleSearchObj.endTime);
516
		});
23973 govind 517
 
27754 amit.gupta 518
	$(document).on('click', ".search-order", function() {
23584 ashik.ali 519
		console.log("search-order clicked")
520
		loadSearchOrder("main-content");
23973 govind 521
	});
522
 
27819 tejbeer 523
	$(document).on('click', ".invoices-cancel", function() {
524
		console.log("searc-order clicked")
525
		loadInvoiceSearchOrder("main-content");
526
	});
527
 
27755 amit.gupta 528
	$(document).on('click', "#search-order-button",
27819 tejbeer 529
		function() {
530
			console.log("search-order-button clicked")
531
			var invoiceNumber = $("#search-order-text").val();
532
			loadSearchOrderDetails(invoiceNumber,
533
				"search-order-details-container");
534
		});
23973 govind 535
 
27819 tejbeer 536
	$(document).on('click', "#search-invoice-button",
537
		function() {
538
			console.log("search-order-button clicked")
539
			var invoiceNumber = $("#search-invoice-text").val();
540
			console.log(invoiceNumber);
541
			loadSearchOrderDetails(invoiceNumber,
542
				"search-order-details-container");
543
		});
544
 
545
 
546
 
547
	$(document).on('click', "#cancel-invoice-button",
548
		function() {
549
			var invoiceNumber = $("#search-invoice-text").val();
550
			console.log(invoiceNumber);
551
			if (confirm("Are you sure you want to cancel the order !") == true) {
552
				doPostAjaxRequestHandler(context
553
					+ "/cancelOrderByInvoice?invoiceNumbers="
554
					+ invoiceNumber, function(response) {
555
						if (response == 'true') {
556
							alert("Successfully Cancel");
557
							loadInvoiceSearchOrder("main-content");
558
						}
559
					});
560
 
561
				return false;
562
			}
563
		});
564
 
27755 amit.gupta 565
	$(document).on('click', "#sale-history-paginated .next",
27819 tejbeer 566
		function() {
567
			var params = {};
568
			params['searchType'] = saleSearchObj.searchType;
569
			params['searchValue'] = saleSearchObj.searchText;
570
			params['startTime'] = walletHistory.startTime;
571
			params['endTime'] = walletHistory.endTime;
572
			loadPaginatedNextItems('/getPaginatedSaleHistory', params,
573
				'sale-history-paginated', 'sale-history-table',
574
				'sale-details-container');
575
			$(this).blur();
576
		});
27755 amit.gupta 577
	$(document).on('click', "#insurance-paginated .next",
27819 tejbeer 578
		function() {
579
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
580
				'insurance-paginated', 'insurance-details-table',
581
				'insurance-policy-details-container');
582
			$(this).blur();
583
		});
27755 amit.gupta 584
	$(document).on('click', "#insurance-paginated .previous",
27819 tejbeer 585
		function() {
586
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
587
				'insurance-paginated', 'insurance-details-table',
588
				'insurance-policy-details-container');
589
			$(this).blur();
590
		});
23973 govind 591
 
27755 amit.gupta 592
	$(document).on('click', "#sale-history-paginated .previous",
27819 tejbeer 593
		function() {
594
			var params = {};
595
			params['searchType'] = saleSearchObj.searchType;
596
			params['searchValue'] = saleSearchObj.searchText;
597
			params['startTime'] = walletHistory.startTime;
598
			params['endTime'] = walletHistory.endTime;
599
			loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
600
				'sale-history-paginated', 'sale-history-table',
601
				'sale-details-container');
602
			$(this).blur();
603
		});
23973 govind 604
 
605
	// grn-details
606
 
27754 amit.gupta 607
	$(document).on('click', ".sale-details", function() {
23654 amit.gupta 608
		orderId = $(this).attr('data');
23973 govind 609
		console.log("orderId = " + orderId);
610
		loadSaleDetails(orderId, "sale-details-container");
23343 ashik.ali 611
	});
27861 tejbeer 612
 
613
	$(document).on('click', "#editamountbutton", function() {
614
		$('#editAmount').show();
615
	});
616
 
23343 ashik.ali 617
});
618
 
23973 govind 619
function loadSaleDetails(orderId, domId) {
620
	doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
27819 tejbeer 621
		function(response) {
622
			$('#' + domId).html(response);
623
		});
23343 ashik.ali 624
}
625
 
28358 tejbeer 626
function loadOnlineOrder(domId) {
627
	doGetAjaxRequestHandler(context + "/getOnlineOrder", function(response) {
628
		$('#' + domId).html(response);
629
 
630
	});
631
}
632
 
26647 tejbeer 633
function loadPendingOrder(domId) {
634
	doGetAjaxRequestHandler(context + "/pendingOrders", function(response) {
635
		$('#' + domId).html(response);
636
 
637
	});
638
}
639
 
28339 tejbeer 640
function loadClaimedOrder(domId) {
641
	doGetAjaxRequestHandler(context + "/claimedOrders", function(response) {
642
		$('#' + domId).html(response);
643
 
644
	});
645
}
646
 
28420 tejbeer 647
function statusChangeAction() {
648
	var val = $('#status').val();
649
	if (val == "CANCELLED" || val == "FAILED" || val == "DELIVERED" || val == "SETTLED") {
650
		console.log("show")
651
		$("#daterangerequ").show();
652
	} else {
653
		$("#daterangerequ").hide();
654
	}
28339 tejbeer 655
 
28420 tejbeer 656
}
657
 
658
 
28339 tejbeer 659
function loadBilledOrder(domId) {
660
	doGetAjaxRequestHandler(context + "/billedOrders", function(response) {
661
		$('#' + domId).html(response);
662
 
663
	});
664
}
665
 
666
 
33305 ranu 667
function loadAllB2CUsersList(domId) {
28339 tejbeer 668
 
33305 ranu 669
	doGetAjaxRequestHandler(`${context}/getB2cUserslist`, function (response) {
670
		$('#' + domId).html(response);
671
 
672
	});
673
}
674
 
675
function loadAllB2CUsersListByDate(domId) {
676
	var startDate = $("#startDate-b2c-user").val();
677
 
678
	var endDate = $("#endDate-b2c-user").val();
679
	if (startDate == "" || startDate == undefined) {
680
		alert("start date is not be empty!!");
681
		return;
682
	}
683
	if (endDate == "" || endDate == undefined) {
684
 
685
		alert("end date is not be empty!!");
686
		return;
687
	}
688
	doGetAjaxRequestHandler(`${context}/getB2cUserslistByDate?startDate=${startDate}&endDate=${endDate}`, function (response) {
689
		$('#' + domId).html(response);
690
 
691
	});
692
}
693
 
694
 
28339 tejbeer 695
function loadUnsettledOrder(domId) {
696
	doGetAjaxRequestHandler(context + "/unsettledOrders", function(response) {
697
		$('#' + domId).html(response);
698
 
699
	});
700
}
701
 
702
 
703
function loadSettledOrder(domId) {
704
	doGetAjaxRequestHandler(context + "/settledOrders", function(response) {
705
		$('#' + domId).html(response);
706
 
707
	});
708
}
23973 govind 709
function loadSearchOrder(domId) {
710
	doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
23584 ashik.ali 711
		$('#' + domId).html(response);
712
	});
713
}
714
 
27819 tejbeer 715
function loadInvoiceSearchOrder(domId) {
716
	console.log("Hello");
717
	doGetAjaxRequestHandler(context + "/getInvoiceSearchOrder", function(response) {
23584 ashik.ali 718
		$('#' + domId).html(response);
719
	});
720
}
721
 
27819 tejbeer 722
function loadSearchOrderDetails(invoiceNumber, domId) {
723
	doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
724
		+ invoiceNumber, function(response) {
725
			$('#' + domId).html(response);
27861 tejbeer 726
			$('#editAmount').hide();
727
 
27819 tejbeer 728
		});
729
}
730
 
23973 govind 731
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
732
	doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
27819 tejbeer 733
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
734
		+ "&endTime=" + endTime, function(response) {
735
			$('#' + domId).html(response);
736
		});
23343 ashik.ali 737
}
738
 
23973 govind 739
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
23343 ashik.ali 740
	saleHistory("main-content", searchType, searchText, startTime, endTime);
24105 govind 741
 
742
}
24880 govind 743
function insurancePolicyDetails(domId) {
744
	doGetAjaxRequestHandler(context + "/insuranceDetails", function(response) {
745
		$('#' + domId).html(response);
746
	});
747
}
25093 amit.gupta 748
 
749
function downloadInvoices(searchType, searchValue, startTime, endTime) {
750
	doAjaxGetDownload(context + "/downloadInvoices?searchType=" + searchType
27819 tejbeer 751
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
752
		+ "&endTime=" + endTime, "invoices.pdf");
25093 amit.gupta 753
}
28422 tejbeer 754
function mouAcceptance() {
755
	doGetAjaxRequestHandler(context + "/getMouForm", function(response) {
756
		console.log(response)
757
		if (response == 'true') {
758
			loadPendingOrder("main-content");
759
		} else {
760
			bootbox.confirm({
761
				message: "<h4 style='text-align:center'>MEMORANDUM OF UNDERSTANDING</h4>" +
762
					" <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>." +
763
					"The order booked under the relevant area pin code committed by franchisee shall be executed/fulfilled and delivered by said franchisee." +
764
					"<br> <b>WHEREAS</b> the franchisee has agreed to participate under said scheme on terms and condition mutually accepted as here under:-" +
765
					"<br><br> <b>NOW THIS MOU STATES THE TERMS AND CONDITIONS DETAILED HEREUNDER;</b>" +
766
					" </p>" +
767
					"<ol style='text-align:justify'>" +
768
					"<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>" +
769
					"<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>" +
770
					"<ol type='I' style = 'text-align:justify'>" +
771
					"<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>" +
772
					"<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>" +
773
					"<li>To the fullest extent provided by applicable law, Company has no responsibility or liability for any franchisee, their products, or representations.</li>" +
774
					"<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>" +
775
					"</ol>" +
28350 tejbeer 776
 
28422 tejbeer 777
					"<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>" +
778
					"<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>" +
779
					"<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>" +
780
					"<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>" +
781
					"<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>" +
782
					"<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>" +
783
					"<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>" +
784
					"<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>" +
785
					"<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>" +
786
					"<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>" +
787
					"<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>" +
788
					"<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>" +
789
					"<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>" +
790
					"<li>The franchisee holds sole responsibility to advise the customer on same.</li>" +
791
					"<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>" +
792
					"<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>" +
793
					"<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>" +
794
					"<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>" +
795
					"<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." +
796
					" <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>" +
797
					"<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>" +
798
					"</ol>" +
799
					"<ul><li>I understand and accepted the terms and conditions.</li></ul>"
800
				,
801
				buttons: {
802
					confirm: {
803
						label: 'I agree',
804
						className: 'btn-success'
805
					},
806
					cancel: {
807
						label: 'I disagree',
808
						className: 'btn-danger'
809
					}
810
				},
811
				callback: function(result) {
812
					if (result == true) {
813
						loadPendingOrder("main-content");
814
					}
815
				}
816
			}).find("div.modal-body").css({ "height": "700px", "overflow-y": "auto" });
817
		}
818
	});
28358 tejbeer 819
 
28422 tejbeer 820
}