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