Subversion Repositories SmartDukaan

Rev

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