| 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() {
|
| 26647 |
tejbeer |
10 |
console.log("Helloo")
|
|
|
11 |
loadPendingOrder("main-content");
|
|
|
12 |
});
|
|
|
13 |
|
| 27755 |
amit.gupta |
14 |
$(document).on('click', "button.pendingOrderDetail",
|
| 27819 |
tejbeer |
15 |
function() {
|
|
|
16 |
doGetAjaxRequestHandler(context
|
|
|
17 |
+ "/getPendingOrderItem?orderId=" + $(this).data('orderid'), function(
|
|
|
18 |
response) {
|
|
|
19 |
$('.pending-order-container').html(response);
|
| 26647 |
tejbeer |
20 |
});
|
| 27819 |
tejbeer |
21 |
});
|
| 26647 |
tejbeer |
22 |
|
| 27755 |
amit.gupta |
23 |
$(document).on('click', ".pendingOrderCancel",
|
| 27819 |
tejbeer |
24 |
function() {
|
| 26721 |
tejbeer |
25 |
|
| 27819 |
tejbeer |
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");
|
| 26721 |
tejbeer |
35 |
}
|
|
|
36 |
});
|
|
|
37 |
|
| 27819 |
tejbeer |
38 |
return false;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
});
|
|
|
42 |
|
| 27755 |
amit.gupta |
43 |
$(document).on('click', ".pendingOrderItemCancel",
|
| 27819 |
tejbeer |
44 |
function() {
|
| 26721 |
tejbeer |
45 |
|
| 27819 |
tejbeer |
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");
|
| 26721 |
tejbeer |
54 |
}
|
|
|
55 |
});
|
|
|
56 |
|
| 27819 |
tejbeer |
57 |
return false;
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
});
|
|
|
61 |
|
| 27754 |
amit.gupta |
62 |
$(document).on('click', ".sale-history", function() {
|
| 23343 |
ashik.ali |
63 |
console.log("Sale History Button Clicked...")
|
| 23973 |
govind |
64 |
saleHistory("main-content", "", "", startDate, endDate);
|
| 23343 |
ashik.ali |
65 |
});
|
| 24880 |
govind |
66 |
|
| 27754 |
amit.gupta |
67 |
$(document).on('click', ".insurance-policy-details", function() {
|
| 24880 |
govind |
68 |
console.log("insurance-policy-details");
|
|
|
69 |
insurancePolicyDetails("main-content");
|
|
|
70 |
});
|
|
|
71 |
|
| 27755 |
amit.gupta |
72 |
$(document).on('click', ".updatePaymentDetails",
|
| 27819 |
tejbeer |
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(
|
| 24105 |
govind |
97 |
function() {
|
| 27819 |
tejbeer |
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;
|
| 24105 |
govind |
109 |
console
|
| 27819 |
tejbeer |
110 |
.log(inputvalues['createdTimeStamp']);
|
|
|
111 |
if (!inputvalues['amount']) {
|
|
|
112 |
inputvalues['amount'] = "0";
|
| 24880 |
govind |
113 |
}
|
| 27819 |
tejbeer |
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);
|
|
|
125 |
if (confirm("Are you sure you want to update paymentTransaction!") == true) {
|
|
|
126 |
doPutAjaxRequestWithJsonHandler(
|
|
|
127 |
context
|
|
|
128 |
+ "/updatePaymentTransaction?referenceId="
|
|
|
129 |
+ referenceId + "&referenceType="
|
|
|
130 |
+ referenceType + "&fofoId="
|
|
|
131 |
+ fofoId,
|
|
|
132 |
JSON
|
|
|
133 |
.stringify(paymentOptionTransactionModels),
|
|
|
134 |
function(response) {
|
|
|
135 |
if (response === 'true') {
|
|
|
136 |
alert("successfully added");
|
|
|
137 |
loadSearchOrderDetails(
|
|
|
138 |
invoiceNumber,
|
|
|
139 |
"search-order-details-container");
|
| 24105 |
govind |
140 |
}
|
|
|
141 |
});
|
| 27819 |
tejbeer |
142 |
}
|
| 24105 |
govind |
143 |
|
| 27819 |
tejbeer |
144 |
});
|
|
|
145 |
|
| 27755 |
amit.gupta |
146 |
$(document).on('change', '#searchType',
|
| 27819 |
tejbeer |
147 |
function() {
|
|
|
148 |
var searchType = $("#searchType option:selected").val();
|
|
|
149 |
var searchTypevalue = $(this).find('option:selected').text();
|
|
|
150 |
;
|
|
|
151 |
saleSearchObj.searchType = searchType;
|
|
|
152 |
console.log("selected searchType = " + searchType);
|
| 24105 |
govind |
153 |
|
| 27819 |
tejbeer |
154 |
saleHistory("main-content", saleSearchObj.searchType, "",
|
|
|
155 |
startDate, endDate);
|
| 24105 |
govind |
156 |
|
| 27819 |
tejbeer |
157 |
$("#sale-history-search-text").val('');
|
|
|
158 |
});
|
| 23973 |
govind |
159 |
|
| 27755 |
amit.gupta |
160 |
$(document).on('click', "#sale-history-search-button",
|
| 27819 |
tejbeer |
161 |
function() {
|
|
|
162 |
var searchType = $("#searchType option:selected").val();
|
|
|
163 |
console.log("searchType = " + searchType);
|
|
|
164 |
$("#searchType").removeClass("border-highlight");
|
|
|
165 |
saleSearchObj.searchText = $(
|
|
|
166 |
"#sale-history-search-text").val();
|
|
|
167 |
saleSearchObj.searchType = searchType;
|
|
|
168 |
saleSearchObj.startTime = startDate;
|
|
|
169 |
saleSearchObj.endTime = endDate;
|
|
|
170 |
if (typeof (saleSearchObj.searchText) == "undefined"
|
|
|
171 |
|| !saleSearchObj.searchText) {
|
|
|
172 |
saleSearchObj.searchText = "";
|
|
|
173 |
}
|
|
|
174 |
saleHistorySearchInfo(saleSearchObj.searchType,
|
|
|
175 |
saleSearchObj.searchText,
|
|
|
176 |
saleSearchObj.startTime, saleSearchObj.endTime);
|
|
|
177 |
});
|
| 27755 |
amit.gupta |
178 |
$(document).on('click', "#invoice-download-button",
|
| 27819 |
tejbeer |
179 |
function() {
|
|
|
180 |
var searchType = $("#searchType option:selected").val();
|
|
|
181 |
console.log("searchType = " + searchType);
|
|
|
182 |
$("#searchType").removeClass("border-highlight");
|
|
|
183 |
saleSearchObj.searchText = $(
|
|
|
184 |
"#sale-history-search-text").val();
|
|
|
185 |
saleSearchObj.searchType = searchType;
|
|
|
186 |
saleSearchObj.startTime = startDate;
|
|
|
187 |
saleSearchObj.endTime = endDate;
|
|
|
188 |
if (typeof (saleSearchObj.searchText) == "undefined"
|
|
|
189 |
|| !saleSearchObj.searchText) {
|
|
|
190 |
saleSearchObj.searchText = "";
|
|
|
191 |
}
|
|
|
192 |
downloadInvoices(saleSearchObj.searchType,
|
|
|
193 |
saleSearchObj.searchText,
|
|
|
194 |
saleSearchObj.startTime, saleSearchObj.endTime);
|
|
|
195 |
});
|
| 23973 |
govind |
196 |
|
| 27754 |
amit.gupta |
197 |
$(document).on('click', ".search-order", function() {
|
| 23584 |
ashik.ali |
198 |
console.log("search-order clicked")
|
|
|
199 |
loadSearchOrder("main-content");
|
| 23973 |
govind |
200 |
});
|
|
|
201 |
|
| 27819 |
tejbeer |
202 |
$(document).on('click', ".invoices-cancel", function() {
|
|
|
203 |
console.log("searc-order clicked")
|
|
|
204 |
loadInvoiceSearchOrder("main-content");
|
|
|
205 |
});
|
|
|
206 |
|
| 27755 |
amit.gupta |
207 |
$(document).on('click', "#search-order-button",
|
| 27819 |
tejbeer |
208 |
function() {
|
|
|
209 |
console.log("search-order-button clicked")
|
|
|
210 |
var invoiceNumber = $("#search-order-text").val();
|
|
|
211 |
loadSearchOrderDetails(invoiceNumber,
|
|
|
212 |
"search-order-details-container");
|
|
|
213 |
});
|
| 23973 |
govind |
214 |
|
| 27819 |
tejbeer |
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);
|
|
|
220 |
loadSearchOrderDetails(invoiceNumber,
|
|
|
221 |
"search-order-details-container");
|
|
|
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 |
});
|
|
|
243 |
|
| 27755 |
amit.gupta |
244 |
$(document).on('click', "#sale-history-paginated .next",
|
| 27819 |
tejbeer |
245 |
function() {
|
|
|
246 |
var params = {};
|
|
|
247 |
params['searchType'] = saleSearchObj.searchType;
|
|
|
248 |
params['searchValue'] = saleSearchObj.searchText;
|
|
|
249 |
params['startTime'] = walletHistory.startTime;
|
|
|
250 |
params['endTime'] = walletHistory.endTime;
|
|
|
251 |
loadPaginatedNextItems('/getPaginatedSaleHistory', params,
|
|
|
252 |
'sale-history-paginated', 'sale-history-table',
|
|
|
253 |
'sale-details-container');
|
|
|
254 |
$(this).blur();
|
|
|
255 |
});
|
| 27755 |
amit.gupta |
256 |
$(document).on('click', "#insurance-paginated .next",
|
| 27819 |
tejbeer |
257 |
function() {
|
|
|
258 |
loadPaginatedNextItems('/insuranceDetailsPaginated', null,
|
|
|
259 |
'insurance-paginated', 'insurance-details-table',
|
|
|
260 |
'insurance-policy-details-container');
|
|
|
261 |
$(this).blur();
|
|
|
262 |
});
|
| 27755 |
amit.gupta |
263 |
$(document).on('click', "#insurance-paginated .previous",
|
| 27819 |
tejbeer |
264 |
function() {
|
|
|
265 |
loadPaginatedNextItems('/insuranceDetailsPaginated', null,
|
|
|
266 |
'insurance-paginated', 'insurance-details-table',
|
|
|
267 |
'insurance-policy-details-container');
|
|
|
268 |
$(this).blur();
|
|
|
269 |
});
|
| 23973 |
govind |
270 |
|
| 27755 |
amit.gupta |
271 |
$(document).on('click', "#sale-history-paginated .previous",
|
| 27819 |
tejbeer |
272 |
function() {
|
|
|
273 |
var params = {};
|
|
|
274 |
params['searchType'] = saleSearchObj.searchType;
|
|
|
275 |
params['searchValue'] = saleSearchObj.searchText;
|
|
|
276 |
params['startTime'] = walletHistory.startTime;
|
|
|
277 |
params['endTime'] = walletHistory.endTime;
|
|
|
278 |
loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
|
|
|
279 |
'sale-history-paginated', 'sale-history-table',
|
|
|
280 |
'sale-details-container');
|
|
|
281 |
$(this).blur();
|
|
|
282 |
});
|
| 23973 |
govind |
283 |
|
|
|
284 |
// grn-details
|
|
|
285 |
|
| 27754 |
amit.gupta |
286 |
$(document).on('click', ".sale-details", function() {
|
| 23654 |
amit.gupta |
287 |
orderId = $(this).attr('data');
|
| 23973 |
govind |
288 |
console.log("orderId = " + orderId);
|
|
|
289 |
loadSaleDetails(orderId, "sale-details-container");
|
| 23343 |
ashik.ali |
290 |
});
|
|
|
291 |
});
|
|
|
292 |
|
| 23973 |
govind |
293 |
function loadSaleDetails(orderId, domId) {
|
|
|
294 |
doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
|
| 27819 |
tejbeer |
295 |
function(response) {
|
|
|
296 |
$('#' + domId).html(response);
|
|
|
297 |
});
|
| 23343 |
ashik.ali |
298 |
}
|
|
|
299 |
|
| 26647 |
tejbeer |
300 |
function loadPendingOrder(domId) {
|
|
|
301 |
doGetAjaxRequestHandler(context + "/pendingOrders", function(response) {
|
|
|
302 |
$('#' + domId).html(response);
|
|
|
303 |
|
|
|
304 |
});
|
|
|
305 |
}
|
|
|
306 |
|
| 23973 |
govind |
307 |
function loadSearchOrder(domId) {
|
|
|
308 |
doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
|
| 23584 |
ashik.ali |
309 |
$('#' + domId).html(response);
|
|
|
310 |
});
|
|
|
311 |
}
|
|
|
312 |
|
| 27819 |
tejbeer |
313 |
function loadInvoiceSearchOrder(domId) {
|
|
|
314 |
console.log("Hello");
|
|
|
315 |
doGetAjaxRequestHandler(context + "/getInvoiceSearchOrder", function(response) {
|
| 23584 |
ashik.ali |
316 |
$('#' + domId).html(response);
|
|
|
317 |
});
|
|
|
318 |
}
|
|
|
319 |
|
| 27819 |
tejbeer |
320 |
function loadSearchOrderDetails(invoiceNumber, domId) {
|
|
|
321 |
doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
|
|
|
322 |
+ invoiceNumber, function(response) {
|
|
|
323 |
$('#' + domId).html(response);
|
|
|
324 |
});
|
|
|
325 |
}
|
|
|
326 |
|
| 23973 |
govind |
327 |
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
|
|
|
328 |
doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
|
| 27819 |
tejbeer |
329 |
+ "&searchValue=" + searchValue + "&startTime=" + startTime
|
|
|
330 |
+ "&endTime=" + endTime, function(response) {
|
|
|
331 |
$('#' + domId).html(response);
|
|
|
332 |
});
|
| 23343 |
ashik.ali |
333 |
}
|
|
|
334 |
|
| 23973 |
govind |
335 |
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
|
| 23343 |
ashik.ali |
336 |
saleHistory("main-content", searchType, searchText, startTime, endTime);
|
| 24105 |
govind |
337 |
|
|
|
338 |
}
|
| 24880 |
govind |
339 |
function insurancePolicyDetails(domId) {
|
|
|
340 |
doGetAjaxRequestHandler(context + "/insuranceDetails", function(response) {
|
|
|
341 |
$('#' + domId).html(response);
|
|
|
342 |
});
|
|
|
343 |
}
|
| 25093 |
amit.gupta |
344 |
|
|
|
345 |
function downloadInvoices(searchType, searchValue, startTime, endTime) {
|
|
|
346 |
doAjaxGetDownload(context + "/downloadInvoices?searchType=" + searchType
|
| 27819 |
tejbeer |
347 |
+ "&searchValue=" + searchValue + "&startTime=" + startTime
|
|
|
348 |
+ "&endTime=" + endTime, "invoices.pdf");
|
| 25093 |
amit.gupta |
349 |
}
|