Subversion Repositories SmartDukaan

Rev

Rev 33400 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33400 Rev 35458
Line 57... Line 57...
57
 
57
 
58
	$(document).on('click', ".online-order-submit",
58
	$(document).on('click', ".online-order-submit",
59
		function() {
59
		function() {
60
			var status = $("#status").val();
60
			var status = $("#status").val();
61
 
61
 
62
			if (status == null) {
62
			if (status === null) {
63
				alert("please select status")
63
				alert("Please select status");
64
				return false;
64
				return false;
65
			}
65
			}
66
 
66
 
67
 
-
 
68
			if (status == "CANCELLED" || status == "FAILED" || status == "DELIVERED" || status == "SETTLED") {
67
			if (status === "CANCELLED" || status === "FAILED" || status === "DELIVERED" || status === "SETTLED") {
69
				let pickerElement = getDatesFromPicker($('input[name="dateRange"]'))
68
				let pickerElement = getDatesFromPicker($('input[name="dateRange"]'))
70
				doGetAjaxRequestHandler(context
69
				doGetAjaxRequestHandler(context
71
					+ "/getAllOrdersByStatus?status=" + status + "&startTime=" + pickerElement.startDate + "&endTime=" + pickerElement.endDate, function(
70
					+ "/getAllOrdersByStatus?status=" + status + "&startTime=" + pickerElement.startDate + "&endTime=" + pickerElement.endDate, function(
72
						response) {
71
						response) {
73
					$('.order-item-detail').html(response);
72
					$('.order-item-detail').html(response);
Line 117... Line 116...
117
			});
116
			});
118
		});
117
		});
119
 
118
 
120
	$(document).on('click', ".pendingOrderCancel",
119
	$(document).on('click', ".pendingOrderCancel",
121
		function() {
120
		function() {
122
 
-
 
123
			var orderId = $(this).data('orderid');
121
			var orderId = $(this).data('orderid');
124
			console.log(orderId);
-
 
125
			if (confirm("Are you sure you want to cancel the order!") == true) {
122
			if (confirm("Are you sure you want to cancel the order!") === true) {
126
				doPostAjaxRequestHandler(context
123
				doPostAjaxRequestHandler(context
127
					+ "/cancelPendingOrder?id=" + orderId,
124
					+ "/cancelPendingOrder?id=" + orderId,
128
					function(response) {
125
					function(response) {
129
						if (response == 'true') {
126
						if (response === 'true') {
130
							alert("successfully Cancel");
127
							alert("Successfully cancelled");
131
							loadPendingOrder("main-content");
128
							loadPendingOrder("main-content");
132
						}
129
						}
133
					});
130
					});
134
 
-
 
135
				return false;
131
				return false;
136
			}
132
			}
137
 
-
 
138
		});
133
		});
139
 
134
 
140
 
135
 
141
	$(document).on('click', ".pendingOrderItemDelivered",
136
	$(document).on('click', ".pendingOrderItemDelivered",
142
		function() {
137
		function() {
143
 
-
 
144
			var orderItemId = $(this).data('poitemid');
138
			var orderItemId = $(this).data('poitemid');
145
			if (confirm("Are you sure you want to delivered the order item!") == true) {
139
			if (confirm("Are you sure you want to deliver the order item!") === true) {
146
				doPostAjaxRequestHandler(context
140
				doPostAjaxRequestHandler(context
147
					+ "/deliveredPendingOrderItem?id="
141
					+ "/deliveredPendingOrderItem?id="
148
					+ orderItemId, function(response) {
142
					+ orderItemId, function(response) {
149
						if (response == 'true') {
143
						if (response === 'true') {
150
							alert("successfully delivered marked");
144
							alert("Successfully marked as delivered");
151
							loadBilledOrder("main-content");
145
							loadBilledOrder("main-content");
152
						}
146
						}
153
					});
147
					});
154
 
-
 
155
				return false;
148
				return false;
156
			}
149
			}
157
 
-
 
158
		});
150
		});
159
 
151
 
160
	$(document).on('click', ".raiseClaim",
152
	$(document).on('click', ".raiseClaim",
161
		function() {
153
		function() {
162
 
-
 
163
			var orderItemId = $(this).data('poitemid');
154
			var orderItemId = $(this).data('poitemid');
164
			if (confirm("Are you sure you want to raise the claim!") == true) {
155
			if (confirm("Are you sure you want to raise the claim!") === true) {
165
				doPostAjaxRequestHandler(context
156
				doPostAjaxRequestHandler(context
166
					+ "/raiseClaimOrderItem?id="
157
					+ "/raiseClaimOrderItem?id="
167
					+ orderItemId, function(response) {
158
					+ orderItemId, function(response) {
168
						if (response == 'true') {
159
						if (response === 'true') {
169
							alert("successfully claim raised");
160
							alert("Claim raised successfully");
170
							loadClaimedOrder("main-content");
161
							loadClaimedOrder("main-content");
171
						}
162
						}
172
					});
163
					});
173
 
-
 
174
				return false;
164
				return false;
175
			}
165
			}
176
 
-
 
177
		});
166
		});
178
 
167
 
179
	$(document).on('click', ".verify-order-item",
168
	$(document).on('click', ".verify-order-item",
180
		function() {
169
		function() {
181
 
-
 
182
			var orderItemId = $(this).data('poitemid');
170
			var orderItemId = $(this).data('poitemid');
183
			if (confirm("Are you sure you want to verify the order!") == true) {
171
			if (confirm("Are you sure you want to verify the order!") === true) {
184
				doPostAjaxRequestHandler(context
172
				doPostAjaxRequestHandler(context
185
					+ "/verifyOrderItem?id="
173
					+ "/verifyOrderItem?id="
186
					+ orderItemId, function(response) {
174
					+ orderItemId, function(response) {
187
						if (response == 'true') {
175
						if (response === 'true') {
188
							alert("successfully verified");
176
							alert("Successfully verified");
189
							$('.online-order-submit').click();
177
							$('.online-order-submit').click();
190
 
-
 
191
						}
178
						}
192
					});
179
					});
193
 
-
 
194
				return false;
180
				return false;
195
			}
181
			}
196
 
-
 
197
		});
182
		});
198
 
183
 
199
	$(document).on('click', ".claimed-payment",
184
	$(document).on('click', ".claimed-payment",
200
		function () {
185
		function () {
201
 
-
 
202
			var orderItemId = $(this).data('poitemid');
186
			var orderItemId = $(this).data('poitemid');
203
			if (confirm("Are you sure you want to add this payment to retailer wallet!!") == true) {
187
			if (confirm("Are you sure you want to add this payment to retailer wallet?") === true) {
204
				doPostAjaxRequestHandler(context
188
				doPostAjaxRequestHandler(context
205
					+ "/onlinePaymentAddToPartnerWallet?id="
189
					+ "/onlinePaymentAddToPartnerWallet?id="
206
					+ orderItemId, function (response) {
190
					+ orderItemId, function (response) {
207
					if (response == 'true') {
191
					if (response === 'true') {
208
						alert("successfully verified");
192
						alert("Successfully added to wallet");
209
						$('.online-order-submit').click();
193
						$('.online-order-submit').click();
210
 
-
 
211
					}
194
					}
212
				});
195
				});
213
 
-
 
214
				return false;
196
				return false;
215
			}
197
			}
216
 
-
 
217
		});
198
		});
218
 
199
 
219
	$(document).on('click', ".cancel-order-item",
200
	$(document).on('click', ".cancel-order-item",
220
		function() {
201
		function() {
221
 
202
 
Line 240... Line 221...
240
 
221
 
241
	$(document).on('click', ".change-partner-po",
222
	$(document).on('click', ".change-partner-po",
242
		function() {
223
		function() {
243
			var orderId = $(this).data('poid');
224
			var orderId = $(this).data('poid');
244
			var fofoId = $("#fofo-users").val();
225
			var fofoId = $("#fofo-users").val();
245
			if (confirm("Are you sure you want to change the partner!") == true) {
226
			if (confirm("Are you sure you want to change the partner!") === true) {
246
				doPostAjaxRequestHandler(context
227
				doPostAjaxRequestHandler(context
247
					+ "/changePendingOrderPartner?id="
228
					+ "/changePendingOrderPartner?id="
248
					+ orderId + "&fofoId=" + fofoId, function(response) {
229
					+ orderId + "&fofoId=" + fofoId, function(response) {
249
						if (response == 'true') {
230
						if (response === 'true') {
250
 
-
 
251
							alert("Partner Successfully Change");
231
							alert("Partner changed successfully");
252
							$('#changePartnerOnlineOrder').modal('hide');
232
							$('#changePartnerOnlineOrder').modal('hide');
253
							$('.modal-backdrop').remove();
233
							$('.modal-backdrop').remove();
254
							$('.online-order-submit').click();
234
							$('.online-order-submit').click();
255
 
-
 
256
						}
235
						}
257
					});
236
					});
258
 
-
 
259
				return false;
237
				return false;
260
 
-
 
261
			}
238
			}
262
 
-
 
263
		});
239
		});
264
 
240
 
265
	$(document).on('click', ".cancel-pending-order",
241
	$(document).on('click', ".cancel-pending-order",
266
		function() {
242
		function() {
267
			var orderItemId = $(this).data('poitemid');
243
			var orderItemId = $(this).data('poitemid');
268
			var reason = $('#selectCancelreason').val();
244
			var reason = $('#selectCancelreason').val();
269
			console.log(reason)
-
 
270
 
245
 
271
			if (reason === "") {
246
			if (!reason) {
272
				alert("Reason is required");
247
				alert("Reason is required");
273
				return false;
248
				return false;
274
			}
249
			}
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) {
250
			if (confirm("Are you sure you want to cancel the order!") === true) {
280
				doPostAjaxRequestHandler(context
251
				doPostAjaxRequestHandler(context
281
					+ "/cancelPendingOrderItem?id="
252
					+ "/cancelPendingOrderItem?id="
282
					+ orderItemId + "&reason=" + reason, function(response) {
253
					+ orderItemId + "&reason=" + reason, function(response) {
283
						if (response == 'true') {
254
						if (response === 'true') {
284
							alert("successfully cancel");
255
							alert("Successfully cancelled");
285
							$('#cancelOnlineOrder').modal('hide');
256
							$('#cancelOnlineOrder').modal('hide');
286
							$('.modal-backdrop').remove();
257
							$('.modal-backdrop').remove();
287
							$('.online-order-submit').click();
258
							$('.online-order-submit').click();
288
 
-
 
289
						}
259
						}
290
					});
260
					});
291
 
-
 
292
				return false;
261
				return false;
293
 
-
 
294
			}
262
			}
295
 
-
 
296
		});
263
		});
297
 
264
 
298
	$(document).on('click', ".sale-history", function() {
265
	$(document).on('click', ".sale-history", function() {
299
		console.log("Sale History Button Clicked...")
-
 
300
		saleHistory("main-content", "", "", "", "");
266
		saleHistory("main-content", "", "", "", "");
301
	});
267
	});
302
 
268
 
303
	$(document).on('click', ".insurance-policy-details", function() {
269
	$(document).on('click', ".insurance-policy-details", function() {
304
		console.log("insurance-policy-details");
-
 
305
		insurancePolicyDetails("main-content");
270
		insurancePolicyDetails("main-content");
306
	});
271
	});
307
 
272
 
308
	$(document).on('change', '.fofoLineItemAmount',
273
	$(document).on('change', '.fofoLineItemAmount',
309
		function() {
274
		function() {
310
			var amount = 0;
275
			var amount = 0;
311
			var oldtotalAmount = 0;
-
 
312
			console.log(oldtotalAmount)
-
 
313
			$('#fofo-item-table')
276
			$('#fofo-item-table').find('tr').each(function() {
314
				.find('tr')
-
 
315
				.each(
-
 
316
					function() {
-
 
317
						var row = $(this);
-
 
318
						console.log(row);
-
 
319
 
-
 
320
						var currentRow = $(this)
277
				var currentRow = $(this).closest("tr");
321
							.closest("tr");
-
 
322
 
-
 
323
						var col5 = currentRow.find(
-
 
324
							"td:eq(3)  input[type='number']").val();
278
				var col5 = currentRow.find("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) {
279
				if (col5 !== undefined && col5 !== 0) {
332
							if (col5 != 0) {
-
 
333
								amount = amount + parseInt(col5, 10);
280
					amount = amount + parseInt(col5, 10);
334
 
-
 
335
							}
-
 
336
						}
281
				}
337
					});
282
			});
338
 
-
 
339
 
-
 
340
 
-
 
341
			$("#totalAmount").text(amount);
283
			$("#totalAmount").text(amount);
342
 
-
 
343
		});
284
		});
344
 
285
 
345
	$(document).on('click', ".updatePaymentDetails",
286
	$(document).on('click', ".updatePaymentDetails",
346
		function() {
287
		function() {
347
			console
-
 
348
				.log("updatePaymentDetails target Button Clicked...");
-
 
349
			var i = 1;
-
 
350
			var paymentOptionsTotalAmount = 0;
288
			var paymentOptionsTotalAmount = 0;
351
			var invoiceNumber = $(this).data('invoicenumber');
289
			var invoiceNumber = $(this).data('invoicenumber');
352
			var fofoId = $(this).data('fofoid');
290
			var fofoId = $(this).data('fofoid');
353
			var totalAmount = $('#editAmount').val();
291
			var totalAmount = $('#editAmount').val();
354
			var totalNumberOfPaymentOptionId = $(this).data(
292
			var totalNumberOfPaymentOptionId = $(this).data(
Line 356... Line 294...
356
			console.log("totalNumberOfPaymentOptionId"
294
			console.log("totalNumberOfPaymentOptionId"
357
				+ totalNumberOfPaymentOptionId);
295
				+ totalNumberOfPaymentOptionId);
358
			var referenceId = $(this).data('orderid');
296
			var referenceId = $(this).data('orderid');
359
			var referenceType = "ORDER";
297
			var referenceType = "ORDER";
360
			var createdTimeStamp = $(this).data('createddatetime');
298
			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 = [];
299
			var paymentOptionTransactionModels = [];
367
			var jsonObject = {};
300
			var jsonObject = {};
368
			var inputvalues = {};
301
			var inputvalues = {};
369
			$('.paymentOptions input')
302
			$('.paymentOptions input').each(function() {
370
				.each(
-
 
371
					function() {
-
 
372
						console.log($(this).val())
-
 
373
						paymentOptionsTotalAmount += parseInt($(this).val(), 10)
303
				paymentOptionsTotalAmount += parseInt($(this).val(), 10);
374
						if (!isFinite($(this).val())) {
304
				if (!isFinite($(this).val())) {
375
							return;
305
					return;
376
						}
306
				}
377
						inputvalues = {};
307
				var inputvalues = {};
378
						inputvalues['paymentOptionId'] = $(
308
				inputvalues['paymentOptionId'] = $(this).data('payment-option-id');
379
							this).data(
-
 
380
								'payment-option-id');
-
 
381
						inputvalues['amount'] = $(this)
309
				inputvalues['amount'] = $(this).val();
382
							.val();
-
 
383
						inputvalues['createdTimeStamp'] = createdTimeStamp;
310
				inputvalues['createdTimeStamp'] = createdTimeStamp;
384
						console
-
 
385
							.log(inputvalues['createdTimeStamp']);
-
 
386
						if (!inputvalues['amount']) {
311
				if (!inputvalues['amount']) {
387
							inputvalues['amount'] = "0";
312
					inputvalues['amount'] = "0";
388
						}
313
				}
389
						console.log("inputvalues['amount']"
-
 
390
							+ inputvalues['amount']);
-
 
391
						paymentOptionTransactionModels
314
				paymentOptionTransactionModels.push(inputvalues);
392
							.push(inputvalues);
-
 
393
					});
315
			});
394
			if (paymentOptionTransactionModels.length != totalNumberOfPaymentOptionId) {
316
			if (paymentOptionTransactionModels.length !== totalNumberOfPaymentOptionId) {
395
				alert("Sending less or more paymentOptionIds for"
317
				alert("Sending less or more paymentOptionIds for"
396
					+ fofoId);
318
					+ fofoId);
397
				return false;
319
				return false;
398
			}
320
			}
399
 
321
 
400
 
322
 
401
 
323
 
402
			var ItemIdsAmountArray = [];
324
			var ItemIdsAmountArray = [];
403
			var itemIdsAmount;
-
 
404
			$('#fofo-item-table')
325
			$('#fofo-item-table').find('tr').each(function() {
405
				.find('tr')
-
 
406
				.each(
-
 
407
					function() {
-
 
408
						var row = $(this);
-
 
409
						console.log(row);
-
 
410
 
-
 
411
 
-
 
412
 
-
 
413
						var currentRow = $(this)
326
				var currentRow = $(this).closest("tr");
414
							.closest("tr");
-
 
415
 
-
 
416
						var itemId = currentRow.find(
327
				var itemId = currentRow.find("td:eq(0)").html();
417
							"td:eq(0)").html();
-
 
418
 
-
 
419
						var col5 = currentRow.find(
-
 
420
							"td:eq(3)  input[type='number']").val();
328
				var col5 = currentRow.find("td:eq(3)  input[type='number']").val();
421
						var fofoItemId = currentRow.find(
-
 
422
							"td:eq(3)  input[type='hidden']").val();
329
				var fofoItemId = currentRow.find("td:eq(3)  input[type='hidden']").val();
423
						console.log(itemId)
-
 
424
 
-
 
425
						console.log(col5);
-
 
426
						if (col5 != undefined) {
330
				if (col5 !== undefined && col5 !== 0) {
427
							if (col5 != 0) {
-
 
428
 
-
 
429
								itemIdsAmount = {
331
					var itemIdsAmount = {
430
									"fofoItemId": fofoItemId,
332
						"fofoItemId": fofoItemId,
431
									"amount": col5,
333
						"amount": col5,
432
									"itemId": itemId
334
						"itemId": itemId
433
 
-
 
434
								}
335
					};
435
								console.log(itemIdsAmount);
-
 
436
								ItemIdsAmountArray.push(itemIdsAmount);
336
					ItemIdsAmountArray.push(itemIdsAmount);
437
 
-
 
438
								console.log(ItemIdsAmountArray)
-
 
439
							}
-
 
440
						}
337
				}
441
					});
338
			});
442
 
339
 
443
 
340
 
444
			var totalAmount = $("#totalAmount").html();
341
			var totalAmount = $("#totalAmount").html();
445
			console.log(totalAmount)
-
 
446
			console.log(paymentOptionsTotalAmount)
-
 
447
			if (paymentOptionsTotalAmount != totalAmount) {
342
			if (paymentOptionsTotalAmount !== parseInt(totalAmount, 10)) {
448
				alert("Payment Options and Total Amount are not Same");
343
				alert("Payment Options and Total Amount are not Same");
449
				return false;
344
				return false;
450
			}
345
			}
451
 
346
 
452
			console.log(paymentOptionTransactionModels);
-
 
453
			jsonObject['paymentOptionTransactionModel'] = paymentOptionTransactionModels;
347
			jsonObject['paymentOptionTransactionModel'] = paymentOptionTransactionModels;
454
			jsonObject['itemAmountModel'] = ItemIdsAmountArray;
348
			jsonObject['itemAmountModel'] = ItemIdsAmountArray;
455
 
349
 
456
			console.log(jsonObject);
-
 
457
			if (confirm("Are you sure you want to update paymentTransaction!") == true) {
350
			if (confirm("Are you sure you want to update payment transaction?") === true) {
458
				doPutAjaxRequestWithJsonHandler(
351
				doPutAjaxRequestWithJsonHandler(
459
					context
352
					context
460
					+ "/updatePaymentTransaction?referenceId="
353
					+ "/updatePaymentTransaction?referenceId="
461
					+ referenceId + "&referenceType="
354
					+ referenceId + "&referenceType="
462
					+ referenceType + "&fofoId="
355
					+ referenceType + "&fofoId="
Line 476... Line 369...
476
		});
369
		});
477
 
370
 
478
	$(document).on('change', '#searchType',
371
	$(document).on('change', '#searchType',
479
		function() {
372
		function() {
480
			var searchType = $("#searchType option:selected").val();
373
			var searchType = $("#searchType option:selected").val();
481
			var searchTypevalue = $(this).find('option:selected').text();
-
 
482
			;
-
 
483
			saleSearchObj.searchType = searchType;
374
			saleSearchObj.searchType = searchType;
484
			console.log("selected searchType = " + searchType);
-
 
485
 
-
 
486
			saleHistory("main-content", saleSearchObj.searchType, "",
375
			saleHistory("main-content", saleSearchObj.searchType, "", "", "");
487
				"", "");
-
 
488
 
-
 
489
			$("#sale-history-search-text").val('');
376
			$("#sale-history-search-text").val('');
490
		});
377
		});
491
 
378
 
492
	$(document).on('click', "#sale-history-search-button",
379
	$(document).on('click', "#sale-history-search-button",
493
		function() {
380
		function() {
494
			var searchType = $("#searchType option:selected").val();
381
			var searchType = $("#searchType option:selected").val();
495
			console.log("searchType = " + searchType);
-
 
496
			$("#searchType").removeClass("border-highlight");
382
			$("#searchType").removeClass("border-highlight");
497
			saleSearchObj.searchText = $(
-
 
498
				"#sale-history-search-text").val();
383
			saleSearchObj.searchText = $("#sale-history-search-text").val();
499
			saleSearchObj.searchType = searchType;
384
			saleSearchObj.searchType = searchType;
500
 
385
 
501
			if (searchType == "Date-Range") {
386
			if (searchType === "Date-Range") {
502
				let saleDuration = getDatesFromPicker("#saleDuration");
387
				let saleDuration = getDatesFromPicker("#saleDuration");
503
				saleSearchObj.startTime = saleDuration.startDate;
388
				saleSearchObj.startTime = saleDuration.startDate;
504
				saleSearchObj.endTime = saleDuration.endDate;
389
				saleSearchObj.endTime = saleDuration.endDate;
505
			} else {
390
			} else {
506
 
391
 
507
				saleSearchObj.startTime = "";
392
				saleSearchObj.startTime = "";
508
				saleSearchObj.endTime = "";
393
				saleSearchObj.endTime = "";
509
 
394
 
510
			}
395
			}
511
			if (typeof (saleSearchObj.searchText) == "undefined"
396
			if (typeof (saleSearchObj.searchText) === "undefined" || !saleSearchObj.searchText) {
512
				|| !saleSearchObj.searchText) {
-
 
513
				saleSearchObj.searchText = "";
397
				saleSearchObj.searchText = "";
514
			}
398
			}
515
			saleHistorySearchInfo(saleSearchObj.searchType,
399
			saleHistorySearchInfo(saleSearchObj.searchType, saleSearchObj.searchText,
516
				saleSearchObj.searchText,
-
 
517
				saleSearchObj.startTime, saleSearchObj.endTime);
400
				saleSearchObj.startTime, saleSearchObj.endTime);
518
		});
401
		});
-
 
402
 
519
	$(document).on('click', "#invoice-download-button",
403
	$(document).on('click', "#invoice-download-button",
520
		function() {
404
		function() {
521
			var searchType = $("#searchType option:selected").val();
405
			var searchType = $("#searchType option:selected").val();
522
			console.log("searchType = " + searchType);
-
 
523
			$("#searchType").removeClass("border-highlight");
406
			$("#searchType").removeClass("border-highlight");
524
			saleSearchObj.searchText = $(
-
 
525
				"#sale-history-search-text").val();
407
			saleSearchObj.searchText = $("#sale-history-search-text").val();
526
			saleSearchObj.searchType = searchType;
408
			saleSearchObj.searchType = searchType;
527
			let saleDuration = getDatesFromPicker("#saleDuration");
409
			var saleDuration = getDatesFromPicker("#saleDuration");
528
			saleSearchObj.startTime = saleDuration.startDate;
410
			saleSearchObj.startTime = saleDuration.startDate;
529
			saleSearchObj.endTime = saleDuration.endDate;
411
			saleSearchObj.endTime = saleDuration.endDate;
530
			if (typeof (saleSearchObj.searchText) == "undefined"
412
			if (typeof (saleSearchObj.searchText) === "undefined" || !saleSearchObj.searchText) {
531
				|| !saleSearchObj.searchText) {
-
 
532
				saleSearchObj.searchText = "";
413
				saleSearchObj.searchText = "";
533
			}
414
			}
534
			downloadInvoices(saleSearchObj.searchType,
415
			downloadInvoices(saleSearchObj.searchType,
535
				saleSearchObj.searchText,
416
				saleSearchObj.searchText,
536
				saleSearchObj.startTime, saleSearchObj.endTime);
417
				saleSearchObj.startTime, saleSearchObj.endTime);
537
		});
418
		});
538
 
419
 
539
	$(document).on('click', ".search-order", function() {
420
	$(document).on('click', ".search-order", function() {
540
		console.log("search-order clicked")
-
 
541
		loadSearchOrder("main-content");
421
		loadSearchOrder("main-content");
542
	});
422
	});
543
 
423
 
544
	$(document).on('click', ".invoices-cancel", function() {
424
	$(document).on('click', ".invoices-cancel", function() {
545
		console.log("searc-order clicked")
-
 
546
		loadInvoiceSearchOrder("main-content");
425
		loadInvoiceSearchOrder("main-content");
547
	});
426
	});
548
 
427
 
549
	$(document).on('click', "#search-order-button",
428
	$(document).on('click', "#search-order-button", function() {
550
		function() {
-
 
551
			console.log("search-order-button clicked")
-
 
552
			var invoiceNumber = $("#search-order-text").val();
429
		var invoiceNumber = $("#search-order-text").val();
553
			loadSearchOrderDetails(invoiceNumber,
430
		loadSearchOrderDetails(invoiceNumber, "search-order-details-container");
554
				"search-order-details-container");
-
 
555
		});
431
	});
556
 
432
 
557
	$(document).on('click', "#search-invoice-button",
433
	$(document).on('click', "#search-invoice-button", function() {
558
		function() {
-
 
559
			console.log("search-order-button clicked")
-
 
560
			var invoiceNumber = $("#search-invoice-text").val();
434
		var invoiceNumber = $("#search-invoice-text").val();
561
			console.log(invoiceNumber);
-
 
562
			loadSearchOrderDetails(invoiceNumber,
435
		loadSearchOrderDetails(invoiceNumber, "search-order-details-container");
563
				"search-order-details-container");
-
 
564
		});
436
	});
565
 
437
 
566
 
438
 
567
 
439
 
568
	$(document).on('click', "#cancel-invoice-button",
440
	$(document).on('click', "#cancel-invoice-button",
569
		function() {
441
		function() {
570
			var invoiceNumber = $("#search-invoice-text").val();
442
			var invoiceNumber = $("#search-invoice-text").val();
571
			console.log(invoiceNumber);
-
 
572
			if (confirm("Are you sure you want to cancel the order !") == true) {
443
			if (confirm("Are you sure you want to cancel the order?") === true) {
573
				doPostAjaxRequestHandler(context
444
				doPostAjaxRequestHandler(context
574
					+ "/cancelOrderByInvoice?invoiceNumbers="
445
					+ "/cancelOrderByInvoice?invoiceNumbers="
575
					+ invoiceNumber, function(response) {
446
					+ invoiceNumber, function(response) {
576
						if (response == 'true') {
447
						if (response === 'true') {
577
							alert("Successfully Cancel");
448
							alert("Successfully cancelled");
578
							loadInvoiceSearchOrder("main-content");
449
							loadInvoiceSearchOrder("main-content");
579
						}
450
						}
580
					});
451
					});
581
 
-
 
582
				return false;
452
				return false;
583
			}
453
			}
584
		});
454
		});
585
 
455
 
586
	$(document).on('click', "#sale-history-paginated .next",
456
	$(document).on('click', "#sale-history-paginated .next",
Line 621... Line 491...
621
				'sale-history-paginated', 'sale-history-table',
491
				'sale-history-paginated', 'sale-history-table',
622
				'sale-details-container');
492
				'sale-details-container');
623
			$(this).blur();
493
			$(this).blur();
624
		});
494
		});
625
 
495
 
626
	// grn-details
-
 
627
 
-
 
628
	$(document).on('click', ".sale-details", function() {
496
	$(document).on('click', ".sale-details", function() {
629
		orderId = $(this).attr('data');
497
		var orderId = $(this).attr('data');
630
		console.log("orderId = " + orderId);
-
 
631
		loadSaleDetails(orderId, "sale-details-container");
498
		loadSaleDetails(orderId, "sale-details-container");
632
	});
499
	});
633
 
500
 
634
	$(document).on('click', "#editamountbutton", function() {
501
	$(document).on('click', "#editamountbutton", function() {
635
		$('#editAmount').show();
502
		$('#editAmount').show();
636
	});
503
	});
637
 
504
 
638
	$(document).on('click', '.downloadB2CList-mk', function () {
505
	$(document).on('click', '.downloadB2CList-mk', function () {
639
		var startDate = $("#startDate-b2c-user").val();
506
		var startDate = $("#startDate-b2c-user").val();
640
 
-
 
641
		var endDate = $("#endDate-b2c-user").val();
507
		var endDate = $("#endDate-b2c-user").val();
642
		if (startDate == "" || startDate == undefined) {
508
		if (!startDate) {
643
			alert("start date is not be empty!!");
509
			alert("Start date cannot be empty");
644
			return;
510
			return;
645
		}
511
		}
646
		if (endDate == "" || endDate == undefined) {
512
		if (!endDate) {
647
 
-
 
648
			alert("end date is not be empty!!");
513
			alert("End date cannot be empty");
649
			return;
514
			return;
650
		}
515
		}
651
 
516
 
652
		let endPoint = `${context}/downloadB2CUsersList?startDate=${startDate}&endDate=${endDate}`;
517
		let endPoint = `${context}/downloadB2CUsersList?startDate=${startDate}&endDate=${endDate}`;
653
 
518
 
Line 686... Line 551...
686
	});
551
	});
687
}
552
}
688
 
553
 
689
function statusChangeAction() {
554
function statusChangeAction() {
690
	var val = $('#status').val();
555
	var val = $('#status').val();
691
	if (val == "CANCELLED" || val == "FAILED" || val == "DELIVERED" || val == "SETTLED") {
556
	if (val === "CANCELLED" || val === "FAILED" || val === "DELIVERED" || val === "SETTLED") {
692
		console.log("show")
-
 
693
		$("#daterangerequ").show();
557
		$("#daterangerequ").show();
694
	} else {
558
	} else {
695
		$("#daterangerequ").hide();
559
		$("#daterangerequ").hide();
696
	}
560
	}
697
 
-
 
698
}
561
}
699
 
562
 
700
 
563
 
701
function loadBilledOrder(domId) {
564
function loadBilledOrder(domId) {
702
	doGetAjaxRequestHandler(context + "/billedOrders", function(response) {
565
	doGetAjaxRequestHandler(context + "/billedOrders", function(response) {
Line 714... Line 577...
714
	});
577
	});
715
}
578
}
716
 
579
 
717
function loadAllB2CUsersListByDate(domId) {
580
function loadAllB2CUsersListByDate(domId) {
718
	var startDate = $("#startDate-b2c-user").val();
581
	var startDate = $("#startDate-b2c-user").val();
719
 
-
 
720
	var endDate = $("#endDate-b2c-user").val();
582
	var endDate = $("#endDate-b2c-user").val();
721
	if (startDate == "" || startDate == undefined) {
583
	if (!startDate) {
722
		alert("start date is not be empty!!");
584
		alert("Start date cannot be empty");
723
		return;
585
		return;
724
	}
586
	}
725
	if (endDate == "" || endDate == undefined) {
587
	if (!endDate) {
726
 
-
 
727
		alert("end date is not be empty!!");
588
		alert("End date cannot be empty");
728
		return;
589
		return;
729
	}
590
	}
730
	doGetAjaxRequestHandler(`${context}/getB2cUserslistByDate?startDate=${startDate}&endDate=${endDate}`, function (response) {
591
	doGetAjaxRequestHandler(`${context}/getB2cUserslistByDate?startDate=${startDate}&endDate=${endDate}`, function (response) {
731
		$('#' + domId).html(response);
592
		$('#' + domId).html(response);
732
 
593
 
Line 753... Line 614...
753
		$('#' + domId).html(response);
614
		$('#' + domId).html(response);
754
	});
615
	});
755
}
616
}
756
 
617
 
757
function loadInvoiceSearchOrder(domId) {
618
function loadInvoiceSearchOrder(domId) {
758
	console.log("Hello");
-
 
759
	doGetAjaxRequestHandler(context + "/getInvoiceSearchOrder", function(response) {
619
	doGetAjaxRequestHandler(context + "/getInvoiceSearchOrder", function(response) {
760
		$('#' + domId).html(response);
620
		$('#' + domId).html(response);
761
	});
621
	});
762
}
622
}
763
 
623
 
Line 793... Line 653...
793
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
653
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
794
		+ "&endTime=" + endTime, "invoices.pdf");
654
		+ "&endTime=" + endTime, "invoices.pdf");
795
}
655
}
796
function mouAcceptance() {
656
function mouAcceptance() {
797
	doGetAjaxRequestHandler(context + "/getMouForm", function(response) {
657
	doGetAjaxRequestHandler(context + "/getMouForm", function(response) {
798
		console.log(response)
-
 
799
		if (response == 'true') {
658
		if (response === 'true') {
800
			loadPendingOrder("main-content");
659
			loadPendingOrder("main-content");
801
		} else {
660
		} else {
802
			bootbox.confirm({
661
			bootbox.confirm({
803
				message: "<h4 style='text-align:center'>MEMORANDUM OF UNDERSTANDING</h4>" +
662
				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>." +
663
					" <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>." +
Line 849... Line 708...
849
						label: 'I disagree',
708
						label: 'I disagree',
850
						className: 'btn-danger'
709
						className: 'btn-danger'
851
					}
710
					}
852
				},
711
				},
853
				callback: function(result) {
712
				callback: function(result) {
854
					if (result == true) {
713
					if (result === true) {
855
						loadPendingOrder("main-content");
714
						loadPendingOrder("main-content");
856
					}
715
					}
857
				}
716
				}
858
			}).find("div.modal-body").css({ "height": "700px", "overflow-y": "auto" });
717
			}).find("div.modal-body").css({ "height": "700px", "overflow-y": "auto" });
859
		}
718
		}