Subversion Repositories SmartDukaan

Rev

Rev 28413 | Rev 28422 | 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() {
28420 tejbeer 10
		doGetAjaxRequestHandler(context + "/getMouForm", function(response) {
11
			console.log(response)
12
			if (response == 'true') {
13
				loadPendingOrder("main-content");
14
			} else {
15
				bootbox.confirm({
16
					message: "<h4 style='text-align:center'>MEMORANDUM OF UNDERSTANDING</h4>" +
17
						" <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>." +
18
						"The order booked under the relevant area pin code committed by franchisee shall be executed/fulfilled and delivered by said franchisee." +
19
						"<br> <b>WHEREAS</b> the franchisee has agreed to participate under said scheme on terms and condition mutually accepted as here under:-" +
20
						"<br><br> <b>NOW THIS MOU STATES THE TERMS AND CONDITIONS DETAILED HEREUNDER;</b>" +
21
						" </p>" +
22
						"<ol style='text-align:justify'>" +
23
						"<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>" +
24
						"<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>" +
25
						"<ol type='I' style = 'text-align:justify'>" +
26
						"<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>" +
27
						"<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>" +
28
						"<li>To the fullest extent provided by applicable law, Company has no responsibility or liability for any franchisee, their products, or representations.</li>" +
29
						"<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>" +
30
						"</ol>" +
31
 
32
						"<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>" +
33
						"<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>" +
34
						"<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>" +
35
						"<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>" +
36
						"<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>" +
37
						"<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>" +
38
						"<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>" +
39
						"<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>" +
40
						"<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>" +
41
						"<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>" +
42
						"<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>" +
43
						"<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>" +
44
						"<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>" +
45
						"<li>The franchisee holds sole responsibility to advise the customer on same.</li>" +
46
						"<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>" +
47
						"<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>" +
48
						"<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>" +
49
						"<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>" +
50
						"<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." +
51
						" <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>" +
52
						"<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>" +
53
						"</ol>" +
54
						"<ul><li>I understand and accepted the terms and conditions.</li></ul>"
55
					,
56
					buttons: {
57
						confirm: {
58
							label: 'I agree',
59
							className: 'btn-success'
60
						},
61
						cancel: {
62
							label: 'I disagree',
63
							className: 'btn-danger'
64
						}
65
					},
66
					callback: function(result) {
67
						if (result == true) {
68
							loadPendingOrder("main-content");
69
						}
70
					}
71
				}).find("div.modal-body").css({ "height": "700px", "overflow-y": "auto" });
72
			}
73
		});
74
 
26647 tejbeer 75
	});
76
 
28420 tejbeer 77
 
28413 tejbeer 78
   $(document).on('click', ".pending_order_dashboard", function() {
79
		console.log("Helloo")
80
		loadPendingOrder("main-content");
81
	});
82
 
83
 
28358 tejbeer 84
	$(document).on('click', ".online-order", function() {
85
		loadOnlineOrder("main-content");
86
	});
87
 
28339 tejbeer 88
	$(document).on('click', ".billed_order_item", function() {
89
		console.log("Helloo")
90
		loadBilledOrder("main-content");
91
	});
92
 
93
	$(document).on('click', ".unsettled_order_item", function() {
28350 tejbeer 94
 
28339 tejbeer 95
		loadUnsettledOrder("main-content");
96
	});
97
 
98
	$(document).on('click', ".settled_order_item", function() {
28350 tejbeer 99
 
28339 tejbeer 100
		loadSettledOrder("main-content");
101
	});
28413 tejbeer 102
    $(document).on('click', ".total_sale_dashboard", function() {
28339 tejbeer 103
 
28413 tejbeer 104
		loadSettledOrder("main-content");
105
	});
28339 tejbeer 106
 
28413 tejbeer 107
 
28339 tejbeer 108
	$(document).on('click', ".claim_raised_order_item", function() {
109
		console.log("Helloo")
110
		loadClaimedOrder("main-content");
111
	});
112
 
28358 tejbeer 113
 
114
	$(document).on('click', ".online-order-submit",
115
		function() {
116
			var status = $("#status").val();
117
 
118
			if (status == null) {
119
				alert("please select status")
120
				return false;
121
			}
28420 tejbeer 122
 
123
 
124
			if (status == "CANCELLED" || status == "FAILED" || status == "DELIVERED" || status == "SETTLED") {
125
				console.log(startDate)
126
				console.log(endDate)
127
				doGetAjaxRequestHandler(context
128
					+ "/getAllOrdersByStatus?status=" + status + "&startTime=" + startDate + "&endTime=" + endDate, function(
129
						response) {
130
					$('.order-item-detail').html(response);
131
				});
132
 
133
			} else {
134
 
135
				doGetAjaxRequestHandler(context
136
					+ "/getAllOrdersByStatus?status=" + status, function(
137
						response) {
138
					$('.order-item-detail').html(response);
139
				});
28358 tejbeer 140
			}
141
		});
142
 
143
 
28377 tejbeer 144
	$(document).on('click', ".online-all-order-item",
145
		function() {
146
 
147
 
148
			doGetAjaxRequestHandler(context
149
				+ "/getAllOnlineOrder", function(
150
					response) {
151
				$('#' + "main-content").html(response);
152
			});
153
		});
154
 
155
 
156
	$(document).on('click', ".all-online-order",
157
		function() {
158
 
159
			var date = $(".order-date").val();
160
 
161
 
162
			doGetAjaxRequestHandler(context
163
				+ "/getAllOnlineOrder?date=" + date, function(
164
					response) {
165
				$('#' + "main-content").html(response);
166
			});
167
		});
168
 
27755 amit.gupta 169
	$(document).on('click', "button.pendingOrderDetail",
27819 tejbeer 170
		function() {
171
			doGetAjaxRequestHandler(context
172
				+ "/getPendingOrderItem?orderId=" + $(this).data('orderid'), function(
173
					response) {
174
				$('.pending-order-container').html(response);
26647 tejbeer 175
			});
27819 tejbeer 176
		});
26647 tejbeer 177
 
27755 amit.gupta 178
	$(document).on('click', ".pendingOrderCancel",
27819 tejbeer 179
		function() {
26721 tejbeer 180
 
27819 tejbeer 181
			var orderId = $(this).data('orderid');
182
			console.log(orderId);
183
			if (confirm("Are you sure you want to cancel the order!") == true) {
184
				doPostAjaxRequestHandler(context
185
					+ "/cancelPendingOrder?id=" + orderId,
186
					function(response) {
187
						if (response == 'true') {
188
							alert("successfully Cancel");
189
							loadPendingOrder("main-content");
26721 tejbeer 190
						}
191
					});
192
 
27819 tejbeer 193
				return false;
194
			}
195
 
196
		});
197
 
26721 tejbeer 198
 
28339 tejbeer 199
	$(document).on('click', ".pendingOrderItemDelivered",
200
		function() {
201
 
202
			var orderItemId = $(this).data('poitemid');
203
			if (confirm("Are you sure you want to delivered the order item!") == true) {
204
				doPostAjaxRequestHandler(context
205
					+ "/deliveredPendingOrderItem?id="
206
					+ orderItemId, function(response) {
207
						if (response == 'true') {
208
							alert("successfully delivered marked");
209
							loadBilledOrder("main-content");
210
						}
211
					});
212
 
213
				return false;
214
			}
215
 
216
		});
217
 
218
	$(document).on('click', ".raiseClaim",
219
		function() {
220
 
221
			var orderItemId = $(this).data('poitemid');
222
			if (confirm("Are you sure you want to raise the claim!") == true) {
223
				doPostAjaxRequestHandler(context
224
					+ "/raiseClaimOrderItem?id="
225
					+ orderItemId, function(response) {
226
						if (response == 'true') {
227
							alert("successfully claim raised");
228
							loadClaimedOrder("main-content");
229
						}
230
					});
231
 
232
				return false;
233
			}
234
 
235
		});
236
 
28350 tejbeer 237
	$(document).on('click', ".verify-order-item",
238
		function() {
239
 
240
			var orderItemId = $(this).data('poitemid');
241
			if (confirm("Are you sure you want to verify the order!") == true) {
242
				doPostAjaxRequestHandler(context
243
					+ "/verifyOrderItem?id="
244
					+ orderItemId, function(response) {
245
						if (response == 'true') {
246
							alert("successfully verified");
28362 tejbeer 247
							$('.online-order-submit').click();
248
 
28350 tejbeer 249
						}
250
					});
251
 
252
				return false;
253
			}
254
 
255
		});
256
 
28352 tejbeer 257
	$(document).on('click', ".cancel-order-item",
258
		function() {
259
 
260
			var orderItemId = $(this).data('poitemid');
261
			doGetAjaxRequestHandler(context
262
				+ "/getPendingOrderItemById?id=" + orderItemId, function(response) {
263
					$('.cancel-online-order-container .modal-content').html(response);
264
				});
265
		});
266
 
267
 
268
	$(document).on('click', ".cancel-pending-order",
269
		function() {
270
			var orderItemId = $(this).data('poitemid');
271
			var reason = $('#selectCancelreason').val();
272
			console.log(reason)
273
 
274
			if (reason === "") {
275
				alert("Reason is required");
276
				return false;
277
			}
278
			if (reason == null) {
279
				alert("Reason is required");
280
				return false;
281
			}
282
			if (confirm("Are you sure you want to cancel the order!") == true) {
283
				doPostAjaxRequestHandler(context
284
					+ "/cancelPendingOrderItem?id="
285
					+ orderItemId + "&reason=" + reason, function(response) {
286
						if (response == 'true') {
287
							alert("successfully cancel");
288
							$('#cancelOnlineOrder').modal('hide');
289
							$('.modal-backdrop').remove();
28362 tejbeer 290
							$('.online-order-submit').click();
28352 tejbeer 291
 
292
						}
293
					});
294
 
295
				return false;
296
 
297
			}
298
 
299
		});
300
 
27754 amit.gupta 301
	$(document).on('click', ".sale-history", function() {
23343 ashik.ali 302
		console.log("Sale History Button Clicked...")
23973 govind 303
		saleHistory("main-content", "", "", startDate, endDate);
23343 ashik.ali 304
	});
24880 govind 305
 
27754 amit.gupta 306
	$(document).on('click', ".insurance-policy-details", function() {
24880 govind 307
		console.log("insurance-policy-details");
308
		insurancePolicyDetails("main-content");
309
	});
310
 
27861 tejbeer 311
	$(document).on('change', '.fofoLineItemAmount',
312
		function() {
313
			var amount = 0;
314
			var oldtotalAmount = 0;
315
			console.log(oldtotalAmount)
316
			$('#fofo-item-table')
317
				.find('tr')
318
				.each(
319
					function() {
320
						var row = $(this);
321
						console.log(row);
322
 
323
						var currentRow = $(this)
324
							.closest("tr");
325
 
326
						var col5 = currentRow.find(
327
							"td:eq(3)  input[type='number']").val();
328
 
329
 
330
						oldtotalAmount = currentRow.find(
331
							"td:eq(5)").html();
332
 
333
						console.log(col5);
334
						if (col5 != undefined) {
335
							if (col5 != 0) {
336
								amount = amount + parseInt(col5, 10);
337
 
338
							}
339
						}
340
					});
341
 
342
 
343
 
344
			$("#totalAmount").text(amount);
345
 
346
		});
347
 
27755 amit.gupta 348
	$(document).on('click', ".updatePaymentDetails",
27819 tejbeer 349
		function() {
350
			console
351
				.log("updatePaymentDetails target Button Clicked...");
352
			var i = 1;
27861 tejbeer 353
			var paymentOptionsTotalAmount = 0;
27819 tejbeer 354
			var invoiceNumber = $(this).data('invoicenumber');
355
			var fofoId = $(this).data('fofoid');
27861 tejbeer 356
			var totalAmount = $('#editAmount').val();
27819 tejbeer 357
			var totalNumberOfPaymentOptionId = $(this).data(
358
				'totalnumberofpaymentoptionid');
359
			console.log("totalNumberOfPaymentOptionId"
360
				+ totalNumberOfPaymentOptionId);
361
			var referenceId = $(this).data('orderid');
362
			var referenceType = "ORDER";
363
			var createdTimeStamp = $(this).data('createddatetime');
364
			console.log(createdTimeStamp);
365
			console.log(fofoId);
366
			console.log(referenceId);
367
			console.log(invoiceNumber);
368
			console.log(referenceType);
369
			var paymentOptionTransactionModels = [];
27861 tejbeer 370
			var jsonObject = {};
27819 tejbeer 371
			var inputvalues = {};
372
			$('.paymentOptions input')
373
				.each(
24105 govind 374
					function() {
27819 tejbeer 375
						console.log($(this).val())
27861 tejbeer 376
						paymentOptionsTotalAmount += parseInt($(this).val(), 10)
27819 tejbeer 377
						if (!isFinite($(this).val())) {
378
							return;
379
						}
380
						inputvalues = {};
381
						inputvalues['paymentOptionId'] = $(
382
							this).data(
383
								'payment-option-id');
384
						inputvalues['amount'] = $(this)
385
							.val();
386
						inputvalues['createdTimeStamp'] = createdTimeStamp;
24105 govind 387
						console
27819 tejbeer 388
							.log(inputvalues['createdTimeStamp']);
389
						if (!inputvalues['amount']) {
390
							inputvalues['amount'] = "0";
24880 govind 391
						}
27819 tejbeer 392
						console.log("inputvalues['amount']"
393
							+ inputvalues['amount']);
394
						paymentOptionTransactionModels
395
							.push(inputvalues);
396
					});
397
			if (paymentOptionTransactionModels.length != totalNumberOfPaymentOptionId) {
398
				alert("Sending less or more paymentOptionIds for"
399
					+ fofoId);
400
				return false;
401
			}
27861 tejbeer 402
 
403
 
404
 
405
			var ItemIdsAmountArray = [];
406
			var itemIdsAmount;
407
			$('#fofo-item-table')
408
				.find('tr')
409
				.each(
410
					function() {
411
						var row = $(this);
412
						console.log(row);
413
 
414
 
415
 
416
						var currentRow = $(this)
417
							.closest("tr");
418
 
419
						var itemId = currentRow.find(
420
							"td:eq(0)").html();
421
 
422
						var col5 = currentRow.find(
423
							"td:eq(3)  input[type='number']").val();
424
						var fofoItemId = currentRow.find(
425
							"td:eq(3)  input[type='hidden']").val();
426
						console.log(itemId)
427
 
428
						console.log(col5);
429
						if (col5 != undefined) {
430
							if (col5 != 0) {
431
 
432
								itemIdsAmount = {
433
									"fofoItemId": fofoItemId,
434
									"amount": col5,
435
									"itemId": itemId
436
 
437
								}
438
								console.log(itemIdsAmount);
439
								ItemIdsAmountArray.push(itemIdsAmount);
440
 
441
								console.log(ItemIdsAmountArray)
442
							}
443
						}
444
					});
445
 
446
 
447
			var totalAmount = $("#totalAmount").html();
448
			console.log(totalAmount)
449
			console.log(paymentOptionsTotalAmount)
450
			if (paymentOptionsTotalAmount != totalAmount) {
451
				alert("Payment Options and Total Amount are not Same");
452
				return false;
453
			}
454
 
27819 tejbeer 455
			console.log(paymentOptionTransactionModels);
27861 tejbeer 456
			jsonObject['paymentOptionTransactionModel'] = paymentOptionTransactionModels;
457
			jsonObject['itemAmountModel'] = ItemIdsAmountArray;
458
 
459
			console.log(jsonObject);
27819 tejbeer 460
			if (confirm("Are you sure you want to update paymentTransaction!") == true) {
461
				doPutAjaxRequestWithJsonHandler(
462
					context
463
					+ "/updatePaymentTransaction?referenceId="
464
					+ referenceId + "&referenceType="
465
					+ referenceType + "&fofoId="
27861 tejbeer 466
					+ fofoId + "&totalAmount=" + totalAmount,
27819 tejbeer 467
					JSON
27861 tejbeer 468
						.stringify(jsonObject),
27819 tejbeer 469
					function(response) {
470
						if (response === 'true') {
471
							alert("successfully added");
472
							loadSearchOrderDetails(
473
								invoiceNumber,
474
								"search-order-details-container");
24105 govind 475
						}
476
					});
27819 tejbeer 477
			}
24105 govind 478
 
27819 tejbeer 479
		});
480
 
27755 amit.gupta 481
	$(document).on('change', '#searchType',
27819 tejbeer 482
		function() {
483
			var searchType = $("#searchType option:selected").val();
484
			var searchTypevalue = $(this).find('option:selected').text();
485
			;
486
			saleSearchObj.searchType = searchType;
487
			console.log("selected searchType = " + searchType);
24105 govind 488
 
27819 tejbeer 489
			saleHistory("main-content", saleSearchObj.searchType, "",
490
				startDate, endDate);
24105 govind 491
 
27819 tejbeer 492
			$("#sale-history-search-text").val('');
493
		});
23973 govind 494
 
27755 amit.gupta 495
	$(document).on('click', "#sale-history-search-button",
27819 tejbeer 496
		function() {
497
			var searchType = $("#searchType option:selected").val();
498
			console.log("searchType = " + searchType);
499
			$("#searchType").removeClass("border-highlight");
500
			saleSearchObj.searchText = $(
501
				"#sale-history-search-text").val();
502
			saleSearchObj.searchType = searchType;
503
			saleSearchObj.startTime = startDate;
504
			saleSearchObj.endTime = endDate;
505
			if (typeof (saleSearchObj.searchText) == "undefined"
506
				|| !saleSearchObj.searchText) {
507
				saleSearchObj.searchText = "";
508
			}
509
			saleHistorySearchInfo(saleSearchObj.searchType,
510
				saleSearchObj.searchText,
511
				saleSearchObj.startTime, saleSearchObj.endTime);
512
		});
27755 amit.gupta 513
	$(document).on('click', "#invoice-download-button",
27819 tejbeer 514
		function() {
515
			var searchType = $("#searchType option:selected").val();
516
			console.log("searchType = " + searchType);
517
			$("#searchType").removeClass("border-highlight");
518
			saleSearchObj.searchText = $(
519
				"#sale-history-search-text").val();
520
			saleSearchObj.searchType = searchType;
521
			saleSearchObj.startTime = startDate;
522
			saleSearchObj.endTime = endDate;
523
			if (typeof (saleSearchObj.searchText) == "undefined"
524
				|| !saleSearchObj.searchText) {
525
				saleSearchObj.searchText = "";
526
			}
527
			downloadInvoices(saleSearchObj.searchType,
528
				saleSearchObj.searchText,
529
				saleSearchObj.startTime, saleSearchObj.endTime);
530
		});
23973 govind 531
 
27754 amit.gupta 532
	$(document).on('click', ".search-order", function() {
23584 ashik.ali 533
		console.log("search-order clicked")
534
		loadSearchOrder("main-content");
23973 govind 535
	});
536
 
27819 tejbeer 537
	$(document).on('click', ".invoices-cancel", function() {
538
		console.log("searc-order clicked")
539
		loadInvoiceSearchOrder("main-content");
540
	});
541
 
27755 amit.gupta 542
	$(document).on('click', "#search-order-button",
27819 tejbeer 543
		function() {
544
			console.log("search-order-button clicked")
545
			var invoiceNumber = $("#search-order-text").val();
546
			loadSearchOrderDetails(invoiceNumber,
547
				"search-order-details-container");
548
		});
23973 govind 549
 
27819 tejbeer 550
	$(document).on('click', "#search-invoice-button",
551
		function() {
552
			console.log("search-order-button clicked")
553
			var invoiceNumber = $("#search-invoice-text").val();
554
			console.log(invoiceNumber);
555
			loadSearchOrderDetails(invoiceNumber,
556
				"search-order-details-container");
557
		});
558
 
559
 
560
 
561
	$(document).on('click', "#cancel-invoice-button",
562
		function() {
563
			var invoiceNumber = $("#search-invoice-text").val();
564
			console.log(invoiceNumber);
565
			if (confirm("Are you sure you want to cancel the order !") == true) {
566
				doPostAjaxRequestHandler(context
567
					+ "/cancelOrderByInvoice?invoiceNumbers="
568
					+ invoiceNumber, function(response) {
569
						if (response == 'true') {
570
							alert("Successfully Cancel");
571
							loadInvoiceSearchOrder("main-content");
572
						}
573
					});
574
 
575
				return false;
576
			}
577
		});
578
 
27755 amit.gupta 579
	$(document).on('click', "#sale-history-paginated .next",
27819 tejbeer 580
		function() {
581
			var params = {};
582
			params['searchType'] = saleSearchObj.searchType;
583
			params['searchValue'] = saleSearchObj.searchText;
584
			params['startTime'] = walletHistory.startTime;
585
			params['endTime'] = walletHistory.endTime;
586
			loadPaginatedNextItems('/getPaginatedSaleHistory', params,
587
				'sale-history-paginated', 'sale-history-table',
588
				'sale-details-container');
589
			$(this).blur();
590
		});
27755 amit.gupta 591
	$(document).on('click', "#insurance-paginated .next",
27819 tejbeer 592
		function() {
593
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
594
				'insurance-paginated', 'insurance-details-table',
595
				'insurance-policy-details-container');
596
			$(this).blur();
597
		});
27755 amit.gupta 598
	$(document).on('click', "#insurance-paginated .previous",
27819 tejbeer 599
		function() {
600
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
601
				'insurance-paginated', 'insurance-details-table',
602
				'insurance-policy-details-container');
603
			$(this).blur();
604
		});
23973 govind 605
 
27755 amit.gupta 606
	$(document).on('click', "#sale-history-paginated .previous",
27819 tejbeer 607
		function() {
608
			var params = {};
609
			params['searchType'] = saleSearchObj.searchType;
610
			params['searchValue'] = saleSearchObj.searchText;
611
			params['startTime'] = walletHistory.startTime;
612
			params['endTime'] = walletHistory.endTime;
613
			loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
614
				'sale-history-paginated', 'sale-history-table',
615
				'sale-details-container');
616
			$(this).blur();
617
		});
23973 govind 618
 
619
	// grn-details
620
 
27754 amit.gupta 621
	$(document).on('click', ".sale-details", function() {
23654 amit.gupta 622
		orderId = $(this).attr('data');
23973 govind 623
		console.log("orderId = " + orderId);
624
		loadSaleDetails(orderId, "sale-details-container");
23343 ashik.ali 625
	});
27861 tejbeer 626
 
627
	$(document).on('click', "#editamountbutton", function() {
628
		$('#editAmount').show();
629
	});
630
 
23343 ashik.ali 631
});
632
 
23973 govind 633
function loadSaleDetails(orderId, domId) {
634
	doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
27819 tejbeer 635
		function(response) {
636
			$('#' + domId).html(response);
637
		});
23343 ashik.ali 638
}
639
 
28358 tejbeer 640
function loadOnlineOrder(domId) {
641
	doGetAjaxRequestHandler(context + "/getOnlineOrder", function(response) {
642
		$('#' + domId).html(response);
643
 
644
	});
645
}
646
 
26647 tejbeer 647
function loadPendingOrder(domId) {
648
	doGetAjaxRequestHandler(context + "/pendingOrders", function(response) {
649
		$('#' + domId).html(response);
650
 
651
	});
652
}
653
 
28339 tejbeer 654
function loadClaimedOrder(domId) {
655
	doGetAjaxRequestHandler(context + "/claimedOrders", function(response) {
656
		$('#' + domId).html(response);
657
 
658
	});
659
}
660
 
28420 tejbeer 661
function statusChangeAction() {
662
	var val = $('#status').val();
663
	if (val == "CANCELLED" || val == "FAILED" || val == "DELIVERED" || val == "SETTLED") {
664
		console.log("show")
665
		$("#daterangerequ").show();
666
	} else {
667
		$("#daterangerequ").hide();
668
	}
28339 tejbeer 669
 
28420 tejbeer 670
}
671
 
672
 
28339 tejbeer 673
function loadBilledOrder(domId) {
674
	doGetAjaxRequestHandler(context + "/billedOrders", function(response) {
675
		$('#' + domId).html(response);
676
 
677
	});
678
}
679
 
680
 
681
 
682
function loadUnsettledOrder(domId) {
683
	doGetAjaxRequestHandler(context + "/unsettledOrders", function(response) {
684
		$('#' + domId).html(response);
685
 
686
	});
687
}
688
 
689
 
690
function loadSettledOrder(domId) {
691
	doGetAjaxRequestHandler(context + "/settledOrders", function(response) {
692
		$('#' + domId).html(response);
693
 
694
	});
695
}
23973 govind 696
function loadSearchOrder(domId) {
697
	doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
23584 ashik.ali 698
		$('#' + domId).html(response);
699
	});
700
}
701
 
27819 tejbeer 702
function loadInvoiceSearchOrder(domId) {
703
	console.log("Hello");
704
	doGetAjaxRequestHandler(context + "/getInvoiceSearchOrder", function(response) {
23584 ashik.ali 705
		$('#' + domId).html(response);
706
	});
707
}
708
 
27819 tejbeer 709
function loadSearchOrderDetails(invoiceNumber, domId) {
710
	doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
711
		+ invoiceNumber, function(response) {
712
			$('#' + domId).html(response);
27861 tejbeer 713
			$('#editAmount').hide();
714
 
27819 tejbeer 715
		});
716
}
717
 
23973 govind 718
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
719
	doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
27819 tejbeer 720
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
721
		+ "&endTime=" + endTime, function(response) {
722
			$('#' + domId).html(response);
723
		});
23343 ashik.ali 724
}
725
 
23973 govind 726
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
23343 ashik.ali 727
	saleHistory("main-content", searchType, searchText, startTime, endTime);
24105 govind 728
 
729
}
24880 govind 730
function insurancePolicyDetails(domId) {
731
	doGetAjaxRequestHandler(context + "/insuranceDetails", function(response) {
732
		$('#' + domId).html(response);
733
	});
734
}
25093 amit.gupta 735
 
736
function downloadInvoices(searchType, searchValue, startTime, endTime) {
737
	doAjaxGetDownload(context + "/downloadInvoices?searchType=" + searchType
27819 tejbeer 738
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
739
		+ "&endTime=" + endTime, "invoices.pdf");
25093 amit.gupta 740
}
28350 tejbeer 741
 
28358 tejbeer 742