Subversion Repositories SmartDukaan

Rev

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

Rev 27755 Rev 27819
Line 10... Line 10...
10
		console.log("Helloo")
10
		console.log("Helloo")
11
		loadPendingOrder("main-content");
11
		loadPendingOrder("main-content");
12
	});
12
	});
13
 
13
 
14
	$(document).on('click', "button.pendingOrderDetail",
14
	$(document).on('click', "button.pendingOrderDetail",
15
			function() {
15
		function() {
16
				doGetAjaxRequestHandler(context
16
			doGetAjaxRequestHandler(context
17
						+ "/getPendingOrderItem?orderId=" + $(this).data('orderid'), function(
17
				+ "/getPendingOrderItem?orderId=" + $(this).data('orderid'), function(
18
						response) {
18
					response) {
19
					$('.pending-order-container').html(response);
19
				$('.pending-order-container').html(response);
20
				});
-
 
21
			});
20
			});
-
 
21
		});
22
 
22
 
23
	$(document).on('click', ".pendingOrderCancel",
23
	$(document).on('click', ".pendingOrderCancel",
24
					function() {
24
		function() {
25
 
-
 
26
						var orderId = $(this).data('orderid');
-
 
27
						console.log(orderId);
-
 
28
						if (confirm("Are you sure you want to cancel the order!") == true) {
-
 
29
							doPostAjaxRequestHandler(context
-
 
30
									+ "/cancelPendingOrder?id=" + orderId,
-
 
31
									function(response) {
-
 
32
										if (response == 'true') {
-
 
33
											alert("successfully Cancel");
-
 
34
											loadPendingOrder("main-content");
-
 
35
										}
-
 
36
									});
-
 
37
 
25
 
-
 
26
			var orderId = $(this).data('orderid');
-
 
27
			console.log(orderId);
-
 
28
			if (confirm("Are you sure you want to cancel the order!") == true) {
-
 
29
				doPostAjaxRequestHandler(context
-
 
30
					+ "/cancelPendingOrder?id=" + orderId,
38
							return false;
31
					function(response) {
-
 
32
						if (response == 'true') {
-
 
33
							alert("successfully Cancel");
-
 
34
							loadPendingOrder("main-content");
39
						}
35
						}
40
 
-
 
41
					});
36
					});
42
 
37
 
43
	$(document).on('click', ".pendingOrderItemCancel",
-
 
44
					function() {
38
				return false;
-
 
39
			}
45
 
40
 
46
						var orderItemId = $(this).data('orderitemid');
-
 
47
						if (confirm("Are you sure you want to cancel the order item!") == true) {
-
 
48
							doPostAjaxRequestHandler(context
-
 
49
									+ "/cancelPendingOrderItem?id="
-
 
50
									+ orderItemId, function(response) {
-
 
51
								if (response == 'true') {
-
 
52
									alert("successfully Cancel");
-
 
53
									loadPendingOrder("main-content");
-
 
54
								}
-
 
55
							});
41
		});
56
 
42
 
57
							return false;
43
	$(document).on('click', ".pendingOrderItemCancel",
58
						}
44
		function() {
59
 
45
 
-
 
46
			var orderItemId = $(this).data('orderitemid');
-
 
47
			if (confirm("Are you sure you want to cancel the order item!") == true) {
-
 
48
				doPostAjaxRequestHandler(context
-
 
49
					+ "/cancelPendingOrderItem?id="
-
 
50
					+ orderItemId, function(response) {
-
 
51
						if (response == 'true') {
-
 
52
							alert("successfully Cancel");
-
 
53
							loadPendingOrder("main-content");
-
 
54
						}
60
					});
55
					});
61
 
56
 
-
 
57
				return false;
-
 
58
			}
-
 
59
 
-
 
60
		});
-
 
61
 
62
	$(document).on('click', ".sale-history", function() {
62
	$(document).on('click', ".sale-history", function() {
63
		console.log("Sale History Button Clicked...")
63
		console.log("Sale History Button Clicked...")
64
		saleHistory("main-content", "", "", startDate, endDate);
64
		saleHistory("main-content", "", "", startDate, endDate);
65
	});
65
	});
66
 
66
 
Line 68... Line 68...
68
		console.log("insurance-policy-details");
68
		console.log("insurance-policy-details");
69
		insurancePolicyDetails("main-content");
69
		insurancePolicyDetails("main-content");
70
	});
70
	});
71
 
71
 
72
	$(document).on('click', ".updatePaymentDetails",
72
	$(document).on('click', ".updatePaymentDetails",
-
 
73
		function() {
-
 
74
			console
-
 
75
				.log("updatePaymentDetails target Button Clicked...");
-
 
76
			var i = 1;
-
 
77
			var changedTotalAmount = 0;
-
 
78
			var invoiceNumber = $(this).data('invoicenumber');
-
 
79
			var fofoId = $(this).data('fofoid');
-
 
80
 
-
 
81
			var totalNumberOfPaymentOptionId = $(this).data(
-
 
82
				'totalnumberofpaymentoptionid');
-
 
83
			console.log("totalNumberOfPaymentOptionId"
-
 
84
				+ totalNumberOfPaymentOptionId);
-
 
85
			var referenceId = $(this).data('orderid');
-
 
86
			var referenceType = "ORDER";
-
 
87
			var createdTimeStamp = $(this).data('createddatetime');
-
 
88
			console.log(createdTimeStamp);
-
 
89
			console.log(fofoId);
-
 
90
			console.log(referenceId);
-
 
91
			console.log(invoiceNumber);
-
 
92
			console.log(referenceType);
-
 
93
			var paymentOptionTransactionModels = [];
-
 
94
			var inputvalues = {};
-
 
95
			$('.paymentOptions input')
-
 
96
				.each(
73
					function() {
97
					function() {
-
 
98
						console.log($(this).val())
-
 
99
						if (!isFinite($(this).val())) {
-
 
100
							return;
-
 
101
						}
-
 
102
						inputvalues = {};
-
 
103
						inputvalues['paymentOptionId'] = $(
-
 
104
							this).data(
-
 
105
								'payment-option-id');
-
 
106
						inputvalues['amount'] = $(this)
-
 
107
							.val();
-
 
108
						inputvalues['createdTimeStamp'] = createdTimeStamp;
74
						console
109
						console
75
								.log("updatePaymentDetails target Button Clicked...");
-
 
76
						var i = 1;
-
 
77
						var changedTotalAmount = 0;
-
 
78
						var invoiceNumber = $(this).data('invoicenumber');
-
 
79
						var fofoId = $(this).data('fofoid');
-
 
80
 
-
 
81
						var totalNumberOfPaymentOptionId = $(this).data(
-
 
82
								'totalnumberofpaymentoptionid');
-
 
83
						console.log("totalNumberOfPaymentOptionId"
-
 
84
								+ totalNumberOfPaymentOptionId);
-
 
85
						var referenceId = $(this).data('orderid');
-
 
86
						var referenceType = "ORDER";
-
 
87
						var createdTimeStamp = $(this).data('createddatetime');
-
 
88
						console.log(createdTimeStamp);
-
 
89
						console.log(fofoId);
-
 
90
						console.log(referenceId);
-
 
91
						console.log(invoiceNumber);
-
 
92
						console.log(referenceType);
-
 
93
						var paymentOptionTransactionModels = [];
-
 
94
						var inputvalues = {};
-
 
95
						$('.paymentOptions input')
-
 
96
								.each(
-
 
97
										function() {
-
 
98
											console.log($(this).val())
-
 
99
											if (!isFinite($(this).val())) {
-
 
100
												return;
-
 
101
											}
-
 
102
											inputvalues = {};
-
 
103
											inputvalues['paymentOptionId'] = $(
-
 
104
													this).data(
-
 
105
													'payment-option-id');
-
 
106
											inputvalues['amount'] = $(this)
-
 
107
													.val();
-
 
108
											inputvalues['createdTimeStamp'] = createdTimeStamp;
-
 
109
											console
-
 
110
													.log(inputvalues['createdTimeStamp']);
110
							.log(inputvalues['createdTimeStamp']);
111
											if (!inputvalues['amount']) {
111
						if (!inputvalues['amount']) {
112
												inputvalues['amount'] = "0";
112
							inputvalues['amount'] = "0";
113
											}
-
 
114
											console.log("inputvalues['amount']"
-
 
115
													+ inputvalues['amount']);
-
 
116
											paymentOptionTransactionModels
-
 
117
													.push(inputvalues);
-
 
118
										});
-
 
119
						if (paymentOptionTransactionModels.length != totalNumberOfPaymentOptionId) {
-
 
120
							alert("Sending less or more paymentOptionIds for"
-
 
121
									+ fofoId);
-
 
122
							return false;
-
 
123
						}
113
						}
-
 
114
						console.log("inputvalues['amount']"
-
 
115
							+ inputvalues['amount']);
-
 
116
						paymentOptionTransactionModels
-
 
117
							.push(inputvalues);
-
 
118
					});
-
 
119
			if (paymentOptionTransactionModels.length != totalNumberOfPaymentOptionId) {
-
 
120
				alert("Sending less or more paymentOptionIds for"
-
 
121
					+ fofoId);
-
 
122
				return false;
-
 
123
			}
124
						console.log(paymentOptionTransactionModels);
124
			console.log(paymentOptionTransactionModels);
125
						if (confirm("Are you sure you want to update paymentTransaction!") == true) {
125
			if (confirm("Are you sure you want to update paymentTransaction!") == true) {
126
							doPutAjaxRequestWithJsonHandler(
126
				doPutAjaxRequestWithJsonHandler(
127
									context
127
					context
128
											+ "/updatePaymentTransaction?referenceId="
128
					+ "/updatePaymentTransaction?referenceId="
129
											+ referenceId + "&referenceType="
129
					+ referenceId + "&referenceType="
130
											+ referenceType + "&fofoId="
130
					+ referenceType + "&fofoId="
131
											+ fofoId,
131
					+ fofoId,
132
									JSON
132
					JSON
133
											.stringify(paymentOptionTransactionModels),
133
						.stringify(paymentOptionTransactionModels),
134
									function(response) {
134
					function(response) {
135
										if (response === 'true') {
135
						if (response === 'true') {
136
											alert("successfully added");
136
							alert("successfully added");
137
											loadSearchOrderDetails(
137
							loadSearchOrderDetails(
138
													invoiceNumber,
138
								invoiceNumber,
139
													"search-order-details-container");
139
								"search-order-details-container");
140
										}
-
 
141
									});
-
 
142
						}
140
						}
143
 
-
 
144
					});
141
					});
-
 
142
			}
-
 
143
 
-
 
144
		});
145
 
145
 
146
	$(document).on('change', '#searchType',
146
	$(document).on('change', '#searchType',
147
			function() {
147
		function() {
148
				var searchType = $("#searchType option:selected").val();
148
			var searchType = $("#searchType option:selected").val();
149
				var searchTypevalue = $(this).find('option:selected').text();
149
			var searchTypevalue = $(this).find('option:selected').text();
150
				;
150
			;
151
				saleSearchObj.searchType = searchType;
151
			saleSearchObj.searchType = searchType;
152
				console.log("selected searchType = " + searchType);
152
			console.log("selected searchType = " + searchType);
153
 
153
 
154
				saleHistory("main-content", saleSearchObj.searchType, "",
154
			saleHistory("main-content", saleSearchObj.searchType, "",
155
						startDate, endDate);
155
				startDate, endDate);
156
 
156
 
157
				$("#sale-history-search-text").val('');
157
			$("#sale-history-search-text").val('');
158
			});
158
		});
159
 
159
 
160
	$(document).on('click', "#sale-history-search-button",
160
	$(document).on('click', "#sale-history-search-button",
161
					function() {
161
		function() {
162
						var searchType = $("#searchType option:selected").val();
162
			var searchType = $("#searchType option:selected").val();
163
						console.log("searchType = " + searchType);
163
			console.log("searchType = " + searchType);
164
						$("#searchType").removeClass("border-highlight");
164
			$("#searchType").removeClass("border-highlight");
165
						saleSearchObj.searchText = $(
165
			saleSearchObj.searchText = $(
166
								"#sale-history-search-text").val();
166
				"#sale-history-search-text").val();
167
						saleSearchObj.searchType = searchType;
167
			saleSearchObj.searchType = searchType;
168
						saleSearchObj.startTime = startDate;
168
			saleSearchObj.startTime = startDate;
169
						saleSearchObj.endTime = endDate;
169
			saleSearchObj.endTime = endDate;
170
						if (typeof (saleSearchObj.searchText) == "undefined"
170
			if (typeof (saleSearchObj.searchText) == "undefined"
171
								|| !saleSearchObj.searchText) {
171
				|| !saleSearchObj.searchText) {
172
							saleSearchObj.searchText = "";
172
				saleSearchObj.searchText = "";
173
						}
173
			}
174
						saleHistorySearchInfo(saleSearchObj.searchType,
174
			saleHistorySearchInfo(saleSearchObj.searchType,
175
								saleSearchObj.searchText,
175
				saleSearchObj.searchText,
176
								saleSearchObj.startTime, saleSearchObj.endTime);
176
				saleSearchObj.startTime, saleSearchObj.endTime);
177
					});
177
		});
178
	$(document).on('click', "#invoice-download-button",
178
	$(document).on('click', "#invoice-download-button",
179
					function() {
179
		function() {
180
						var searchType = $("#searchType option:selected").val();
180
			var searchType = $("#searchType option:selected").val();
181
						console.log("searchType = " + searchType);
181
			console.log("searchType = " + searchType);
182
						$("#searchType").removeClass("border-highlight");
182
			$("#searchType").removeClass("border-highlight");
183
						saleSearchObj.searchText = $(
183
			saleSearchObj.searchText = $(
184
								"#sale-history-search-text").val();
184
				"#sale-history-search-text").val();
185
						saleSearchObj.searchType = searchType;
185
			saleSearchObj.searchType = searchType;
186
						saleSearchObj.startTime = startDate;
186
			saleSearchObj.startTime = startDate;
187
						saleSearchObj.endTime = endDate;
187
			saleSearchObj.endTime = endDate;
188
						if (typeof (saleSearchObj.searchText) == "undefined"
188
			if (typeof (saleSearchObj.searchText) == "undefined"
189
								|| !saleSearchObj.searchText) {
189
				|| !saleSearchObj.searchText) {
190
							saleSearchObj.searchText = "";
190
				saleSearchObj.searchText = "";
191
						}
191
			}
192
						downloadInvoices(saleSearchObj.searchType,
192
			downloadInvoices(saleSearchObj.searchType,
193
								saleSearchObj.searchText,
193
				saleSearchObj.searchText,
194
								saleSearchObj.startTime, saleSearchObj.endTime);
194
				saleSearchObj.startTime, saleSearchObj.endTime);
195
					});
195
		});
196
 
196
 
197
	$(document).on('click', ".search-order", function() {
197
	$(document).on('click', ".search-order", function() {
198
		console.log("search-order clicked")
198
		console.log("search-order clicked")
199
		loadSearchOrder("main-content");
199
		loadSearchOrder("main-content");
200
	});
200
	});
201
 
201
 
-
 
202
	$(document).on('click', ".invoices-cancel", function() {
-
 
203
		console.log("searc-order clicked")
-
 
204
		loadInvoiceSearchOrder("main-content");
-
 
205
	});
-
 
206
 
202
	$(document).on('click', "#search-order-button",
207
	$(document).on('click', "#search-order-button",
203
			function() {
208
		function() {
204
				console.log("search-order-button clicked")
209
			console.log("search-order-button clicked")
205
				var invoiceNumber = $("#search-order-text").val();
210
			var invoiceNumber = $("#search-order-text").val();
-
 
211
			loadSearchOrderDetails(invoiceNumber,
-
 
212
				"search-order-details-container");
-
 
213
		});
-
 
214
 
-
 
215
	$(document).on('click', "#search-invoice-button",
-
 
216
		function() {
-
 
217
			console.log("search-order-button clicked")
-
 
218
			var invoiceNumber = $("#search-invoice-text").val();
-
 
219
			console.log(invoiceNumber);
206
				loadSearchOrderDetails(invoiceNumber,
220
			loadSearchOrderDetails(invoiceNumber,
207
						"search-order-details-container");
221
				"search-order-details-container");
208
			});
222
		});
-
 
223
 
-
 
224
 
-
 
225
 
-
 
226
	$(document).on('click', "#cancel-invoice-button",
-
 
227
		function() {
-
 
228
			var invoiceNumber = $("#search-invoice-text").val();
-
 
229
			console.log(invoiceNumber);
-
 
230
			if (confirm("Are you sure you want to cancel the order !") == true) {
-
 
231
				doPostAjaxRequestHandler(context
-
 
232
					+ "/cancelOrderByInvoice?invoiceNumbers="
-
 
233
					+ invoiceNumber, function(response) {
-
 
234
						if (response == 'true') {
-
 
235
							alert("Successfully Cancel");
-
 
236
							loadInvoiceSearchOrder("main-content");
-
 
237
						}
-
 
238
					});
-
 
239
 
-
 
240
				return false;
-
 
241
			}
-
 
242
		});
209
 
243
 
210
	$(document).on('click', "#sale-history-paginated .next",
244
	$(document).on('click', "#sale-history-paginated .next",
211
			function() {
245
		function() {
212
				var params = {};
246
			var params = {};
213
				params['searchType'] = saleSearchObj.searchType;
247
			params['searchType'] = saleSearchObj.searchType;
214
				params['searchValue'] = saleSearchObj.searchText;
248
			params['searchValue'] = saleSearchObj.searchText;
215
				params['startTime'] = walletHistory.startTime;
249
			params['startTime'] = walletHistory.startTime;
216
				params['endTime'] = walletHistory.endTime;
250
			params['endTime'] = walletHistory.endTime;
217
				loadPaginatedNextItems('/getPaginatedSaleHistory', params,
251
			loadPaginatedNextItems('/getPaginatedSaleHistory', params,
218
						'sale-history-paginated', 'sale-history-table',
252
				'sale-history-paginated', 'sale-history-table',
219
						'sale-details-container');
253
				'sale-details-container');
220
				$(this).blur();
254
			$(this).blur();
221
			});
255
		});
222
	$(document).on('click', "#insurance-paginated .next",
256
	$(document).on('click', "#insurance-paginated .next",
223
			function() {
257
		function() {
224
				loadPaginatedNextItems('/insuranceDetailsPaginated', null,
258
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
225
						'insurance-paginated', 'insurance-details-table',
259
				'insurance-paginated', 'insurance-details-table',
226
						'insurance-policy-details-container');
260
				'insurance-policy-details-container');
227
				$(this).blur();
261
			$(this).blur();
228
			});
262
		});
229
	$(document).on('click', "#insurance-paginated .previous",
263
	$(document).on('click', "#insurance-paginated .previous",
230
			function() {
264
		function() {
231
				loadPaginatedNextItems('/insuranceDetailsPaginated', null,
265
			loadPaginatedNextItems('/insuranceDetailsPaginated', null,
232
						'insurance-paginated', 'insurance-details-table',
266
				'insurance-paginated', 'insurance-details-table',
233
						'insurance-policy-details-container');
267
				'insurance-policy-details-container');
234
				$(this).blur();
268
			$(this).blur();
235
			});
269
		});
236
 
270
 
237
	$(document).on('click', "#sale-history-paginated .previous",
271
	$(document).on('click', "#sale-history-paginated .previous",
238
			function() {
272
		function() {
239
				var params = {};
273
			var params = {};
240
				params['searchType'] = saleSearchObj.searchType;
274
			params['searchType'] = saleSearchObj.searchType;
241
				params['searchValue'] = saleSearchObj.searchText;
275
			params['searchValue'] = saleSearchObj.searchText;
242
				params['startTime'] = walletHistory.startTime;
276
			params['startTime'] = walletHistory.startTime;
243
				params['endTime'] = walletHistory.endTime;
277
			params['endTime'] = walletHistory.endTime;
244
				loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
278
			loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
245
						'sale-history-paginated', 'sale-history-table',
279
				'sale-history-paginated', 'sale-history-table',
246
						'sale-details-container');
280
				'sale-details-container');
247
				$(this).blur();
281
			$(this).blur();
248
			});
282
		});
249
 
283
 
250
	// grn-details
284
	// grn-details
251
 
285
 
252
	$(document).on('click', ".sale-details", function() {
286
	$(document).on('click', ".sale-details", function() {
253
		orderId = $(this).attr('data');
287
		orderId = $(this).attr('data');
Line 256... Line 290...
256
	});
290
	});
257
});
291
});
258
 
292
 
259
function loadSaleDetails(orderId, domId) {
293
function loadSaleDetails(orderId, domId) {
260
	doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
294
	doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
261
			function(response) {
295
		function(response) {
262
				$('#' + domId).html(response);
296
			$('#' + domId).html(response);
263
			});
297
		});
264
}
298
}
265
 
299
 
266
function loadPendingOrder(domId) {
300
function loadPendingOrder(domId) {
267
	doGetAjaxRequestHandler(context + "/pendingOrders", function(response) {
301
	doGetAjaxRequestHandler(context + "/pendingOrders", function(response) {
268
		$('#' + domId).html(response);
302
		$('#' + domId).html(response);
Line 274... Line 308...
274
	doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
308
	doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
275
		$('#' + domId).html(response);
309
		$('#' + domId).html(response);
276
	});
310
	});
277
}
311
}
278
 
312
 
279
function loadSearchOrderDetails(invoiceNumber, domId) {
313
function loadInvoiceSearchOrder(domId) {
-
 
314
	console.log("Hello");
280
	doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
315
	doGetAjaxRequestHandler(context + "/getInvoiceSearchOrder", function(response) {
281
			+ invoiceNumber, function(response) {
-
 
282
		$('#' + domId).html(response);
316
		$('#' + domId).html(response);
283
	});
317
	});
284
}
318
}
285
 
319
 
-
 
320
function loadSearchOrderDetails(invoiceNumber, domId) {
-
 
321
	doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
-
 
322
		+ invoiceNumber, function(response) {
-
 
323
			$('#' + domId).html(response);
-
 
324
		});
-
 
325
}
-
 
326
 
286
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
327
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
287
	doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
328
	doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
288
			+ "&searchValue=" + searchValue + "&startTime=" + startTime
329
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
289
			+ "&endTime=" + endTime, function(response) {
330
		+ "&endTime=" + endTime, function(response) {
290
		$('#' + domId).html(response);
331
			$('#' + domId).html(response);
291
	});
332
		});
292
}
333
}
293
 
334
 
294
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
335
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
295
	saleHistory("main-content", searchType, searchText, startTime, endTime);
336
	saleHistory("main-content", searchType, searchText, startTime, endTime);
296
 
337
 
Line 301... Line 342...
301
	});
342
	});
302
}
343
}
303
 
344
 
304
function downloadInvoices(searchType, searchValue, startTime, endTime) {
345
function downloadInvoices(searchType, searchValue, startTime, endTime) {
305
	doAjaxGetDownload(context + "/downloadInvoices?searchType=" + searchType
346
	doAjaxGetDownload(context + "/downloadInvoices?searchType=" + searchType
306
			+ "&searchValue=" + searchValue + "&startTime=" + startTime
347
		+ "&searchValue=" + searchValue + "&startTime=" + startTime
307
			+ "&endTime=" + endTime, "invoices.pdf");
348
		+ "&endTime=" + endTime, "invoices.pdf");
308
}
349
}