| 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",
|
| 26647 |
tejbeer |
15 |
function() {
|
|
|
16 |
doGetAjaxRequestHandler(context
|
| 26817 |
amit.gupta |
17 |
+ "/getPendingOrderItem?orderId=" + $(this).data('orderid'), function(
|
| 26647 |
tejbeer |
18 |
response) {
|
|
|
19 |
$('.pending-order-container').html(response);
|
|
|
20 |
});
|
|
|
21 |
});
|
|
|
22 |
|
| 27755 |
amit.gupta |
23 |
$(document).on('click', ".pendingOrderCancel",
|
| 26721 |
tejbeer |
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 |
|
|
|
38 |
return false;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
});
|
|
|
42 |
|
| 27755 |
amit.gupta |
43 |
$(document).on('click', ".pendingOrderItemCancel",
|
| 26721 |
tejbeer |
44 |
function() {
|
|
|
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 |
}
|
|
|
55 |
});
|
|
|
56 |
|
|
|
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",
|
| 24105 |
govind |
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');
|
| 24880 |
govind |
80 |
|
|
|
81 |
var totalNumberOfPaymentOptionId = $(this).data(
|
|
|
82 |
'totalnumberofpaymentoptionid');
|
|
|
83 |
console.log("totalNumberOfPaymentOptionId"
|
|
|
84 |
+ totalNumberOfPaymentOptionId);
|
| 24105 |
govind |
85 |
var referenceId = $(this).data('orderid');
|
|
|
86 |
var referenceType = "ORDER";
|
| 24880 |
govind |
87 |
var createdTimeStamp = $(this).data('createddatetime');
|
| 24152 |
govind |
88 |
console.log(createdTimeStamp);
|
| 24105 |
govind |
89 |
console.log(fofoId);
|
|
|
90 |
console.log(referenceId);
|
|
|
91 |
console.log(invoiceNumber);
|
|
|
92 |
console.log(referenceType);
|
|
|
93 |
var paymentOptionTransactionModels = [];
|
|
|
94 |
var inputvalues = {};
|
| 24880 |
govind |
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']);
|
|
|
111 |
if (!inputvalues['amount']) {
|
|
|
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 |
}
|
| 24105 |
govind |
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");
|
|
|
140 |
}
|
|
|
141 |
});
|
|
|
142 |
}
|
| 23973 |
govind |
143 |
|
| 24105 |
govind |
144 |
});
|
|
|
145 |
|
| 27755 |
amit.gupta |
146 |
$(document).on('change', '#searchType',
|
| 23973 |
govind |
147 |
function() {
|
|
|
148 |
var searchType = $("#searchType option:selected").val();
|
|
|
149 |
var searchTypevalue = $(this).find('option:selected').text();
|
|
|
150 |
;
|
| 25093 |
amit.gupta |
151 |
saleSearchObj.searchType = searchType;
|
| 23973 |
govind |
152 |
console.log("selected searchType = " + searchType);
|
| 24105 |
govind |
153 |
|
| 25093 |
amit.gupta |
154 |
saleHistory("main-content", saleSearchObj.searchType, "",
|
| 23973 |
govind |
155 |
startDate, endDate);
|
| 24105 |
govind |
156 |
|
|
|
157 |
$("#sale-history-search-text").val('');
|
| 23973 |
govind |
158 |
});
|
|
|
159 |
|
| 27755 |
amit.gupta |
160 |
$(document).on('click', "#sale-history-search-button",
|
| 26647 |
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",
|
| 26647 |
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 |
|
| 27755 |
amit.gupta |
202 |
$(document).on('click', "#search-order-button",
|
| 23973 |
govind |
203 |
function() {
|
|
|
204 |
console.log("search-order-button clicked")
|
|
|
205 |
var invoiceNumber = $("#search-order-text").val();
|
|
|
206 |
loadSearchOrderDetails(invoiceNumber,
|
|
|
207 |
"search-order-details-container");
|
|
|
208 |
});
|
|
|
209 |
|
| 27755 |
amit.gupta |
210 |
$(document).on('click', "#sale-history-paginated .next",
|
| 23973 |
govind |
211 |
function() {
|
|
|
212 |
var params = {};
|
| 25608 |
tejbeer |
213 |
params['searchType'] = saleSearchObj.searchType;
|
|
|
214 |
params['searchValue'] = saleSearchObj.searchText;
|
| 23973 |
govind |
215 |
params['startTime'] = walletHistory.startTime;
|
|
|
216 |
params['endTime'] = walletHistory.endTime;
|
|
|
217 |
loadPaginatedNextItems('/getPaginatedSaleHistory', params,
|
|
|
218 |
'sale-history-paginated', 'sale-history-table',
|
|
|
219 |
'sale-details-container');
|
|
|
220 |
$(this).blur();
|
|
|
221 |
});
|
| 27755 |
amit.gupta |
222 |
$(document).on('click', "#insurance-paginated .next",
|
| 24880 |
govind |
223 |
function() {
|
|
|
224 |
loadPaginatedNextItems('/insuranceDetailsPaginated', null,
|
|
|
225 |
'insurance-paginated', 'insurance-details-table',
|
|
|
226 |
'insurance-policy-details-container');
|
|
|
227 |
$(this).blur();
|
|
|
228 |
});
|
| 27755 |
amit.gupta |
229 |
$(document).on('click', "#insurance-paginated .previous",
|
| 24880 |
govind |
230 |
function() {
|
|
|
231 |
loadPaginatedNextItems('/insuranceDetailsPaginated', null,
|
|
|
232 |
'insurance-paginated', 'insurance-details-table',
|
|
|
233 |
'insurance-policy-details-container');
|
|
|
234 |
$(this).blur();
|
|
|
235 |
});
|
| 23973 |
govind |
236 |
|
| 27755 |
amit.gupta |
237 |
$(document).on('click', "#sale-history-paginated .previous",
|
| 23973 |
govind |
238 |
function() {
|
|
|
239 |
var params = {};
|
| 25608 |
tejbeer |
240 |
params['searchType'] = saleSearchObj.searchType;
|
|
|
241 |
params['searchValue'] = saleSearchObj.searchText;
|
| 23973 |
govind |
242 |
params['startTime'] = walletHistory.startTime;
|
|
|
243 |
params['endTime'] = walletHistory.endTime;
|
|
|
244 |
loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
|
|
|
245 |
'sale-history-paginated', 'sale-history-table',
|
|
|
246 |
'sale-details-container');
|
|
|
247 |
$(this).blur();
|
|
|
248 |
});
|
|
|
249 |
|
|
|
250 |
// grn-details
|
|
|
251 |
|
| 27754 |
amit.gupta |
252 |
$(document).on('click', ".sale-details", function() {
|
| 23654 |
amit.gupta |
253 |
orderId = $(this).attr('data');
|
| 23973 |
govind |
254 |
console.log("orderId = " + orderId);
|
|
|
255 |
loadSaleDetails(orderId, "sale-details-container");
|
| 23343 |
ashik.ali |
256 |
});
|
|
|
257 |
});
|
|
|
258 |
|
| 23973 |
govind |
259 |
function loadSaleDetails(orderId, domId) {
|
|
|
260 |
doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
|
|
|
261 |
function(response) {
|
|
|
262 |
$('#' + domId).html(response);
|
|
|
263 |
});
|
| 23343 |
ashik.ali |
264 |
}
|
|
|
265 |
|
| 26647 |
tejbeer |
266 |
function loadPendingOrder(domId) {
|
|
|
267 |
doGetAjaxRequestHandler(context + "/pendingOrders", function(response) {
|
|
|
268 |
$('#' + domId).html(response);
|
|
|
269 |
|
|
|
270 |
});
|
|
|
271 |
}
|
|
|
272 |
|
| 23973 |
govind |
273 |
function loadSearchOrder(domId) {
|
|
|
274 |
doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
|
| 23584 |
ashik.ali |
275 |
$('#' + domId).html(response);
|
|
|
276 |
});
|
|
|
277 |
}
|
|
|
278 |
|
| 23973 |
govind |
279 |
function loadSearchOrderDetails(invoiceNumber, domId) {
|
|
|
280 |
doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
|
|
|
281 |
+ invoiceNumber, function(response) {
|
| 23584 |
ashik.ali |
282 |
$('#' + domId).html(response);
|
|
|
283 |
});
|
|
|
284 |
}
|
|
|
285 |
|
| 23973 |
govind |
286 |
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
|
|
|
287 |
doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
|
|
|
288 |
+ "&searchValue=" + searchValue + "&startTime=" + startTime
|
|
|
289 |
+ "&endTime=" + endTime, function(response) {
|
| 23343 |
ashik.ali |
290 |
$('#' + domId).html(response);
|
|
|
291 |
});
|
|
|
292 |
}
|
|
|
293 |
|
| 23973 |
govind |
294 |
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
|
| 23343 |
ashik.ali |
295 |
saleHistory("main-content", searchType, searchText, startTime, endTime);
|
| 24105 |
govind |
296 |
|
|
|
297 |
}
|
| 24880 |
govind |
298 |
function insurancePolicyDetails(domId) {
|
|
|
299 |
doGetAjaxRequestHandler(context + "/insuranceDetails", function(response) {
|
|
|
300 |
$('#' + domId).html(response);
|
|
|
301 |
});
|
|
|
302 |
}
|
| 25093 |
amit.gupta |
303 |
|
|
|
304 |
function downloadInvoices(searchType, searchValue, startTime, endTime) {
|
|
|
305 |
doAjaxGetDownload(context + "/downloadInvoices?searchType=" + searchType
|
|
|
306 |
+ "&searchValue=" + searchValue + "&startTime=" + startTime
|
|
|
307 |
+ "&endTime=" + endTime, "invoices.pdf");
|
|
|
308 |
}
|