Subversion Repositories SmartDukaan

Rev

Rev 35458 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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