| 23973 |
govind |
1 |
var saleHistory = saleHistory || {};
|
|
|
2 |
saleHistory.searchText = "";
|
|
|
3 |
saleHistory.searchType = "";
|
|
|
4 |
saleHistory.startTime = "";
|
|
|
5 |
saleHistory.endTime = "";
|
| 23343 |
ashik.ali |
6 |
|
|
|
7 |
$(function() {
|
| 23973 |
govind |
8 |
|
| 23343 |
ashik.ali |
9 |
$(".sale-history").live('click', function() {
|
|
|
10 |
console.log("Sale History Button Clicked...")
|
| 23973 |
govind |
11 |
saleHistory("main-content", "", "", startDate, endDate);
|
| 23343 |
ashik.ali |
12 |
});
|
| 24880 |
govind |
13 |
|
|
|
14 |
$(".insurance-policy-details").live('click', function() {
|
|
|
15 |
console.log("insurance-policy-details");
|
|
|
16 |
insurancePolicyDetails("main-content");
|
|
|
17 |
});
|
|
|
18 |
|
| 24105 |
govind |
19 |
$(".updatePaymentDetails")
|
|
|
20 |
.live(
|
|
|
21 |
'click',
|
|
|
22 |
function() {
|
|
|
23 |
console
|
|
|
24 |
.log("updatePaymentDetails target Button Clicked...");
|
|
|
25 |
var i = 1;
|
|
|
26 |
var changedTotalAmount = 0;
|
|
|
27 |
var invoiceNumber = $(this).data('invoicenumber');
|
|
|
28 |
var fofoId = $(this).data('fofoid');
|
| 24880 |
govind |
29 |
|
|
|
30 |
var totalNumberOfPaymentOptionId = $(this).data(
|
|
|
31 |
'totalnumberofpaymentoptionid');
|
|
|
32 |
console.log("totalNumberOfPaymentOptionId"
|
|
|
33 |
+ totalNumberOfPaymentOptionId);
|
| 24105 |
govind |
34 |
var referenceId = $(this).data('orderid');
|
|
|
35 |
var referenceType = "ORDER";
|
| 24880 |
govind |
36 |
var createdTimeStamp = $(this).data('createddatetime');
|
| 24152 |
govind |
37 |
console.log(createdTimeStamp);
|
| 24105 |
govind |
38 |
console.log(fofoId);
|
|
|
39 |
console.log(referenceId);
|
|
|
40 |
console.log(invoiceNumber);
|
|
|
41 |
console.log(referenceType);
|
|
|
42 |
var paymentOptionTransactionModels = [];
|
|
|
43 |
var inputvalues = {};
|
| 24880 |
govind |
44 |
$('.paymentOptions input')
|
|
|
45 |
.each(
|
|
|
46 |
function() {
|
|
|
47 |
console.log($(this).val())
|
|
|
48 |
if (!isFinite($(this).val())) {
|
|
|
49 |
return;
|
|
|
50 |
}
|
|
|
51 |
inputvalues = {};
|
|
|
52 |
inputvalues['paymentOptionId'] = $(
|
|
|
53 |
this).data(
|
|
|
54 |
'payment-option-id');
|
|
|
55 |
inputvalues['amount'] = $(this)
|
|
|
56 |
.val();
|
|
|
57 |
inputvalues['createdTimeStamp'] = createdTimeStamp;
|
|
|
58 |
console
|
|
|
59 |
.log(inputvalues['createdTimeStamp']);
|
|
|
60 |
if (!inputvalues['amount']) {
|
|
|
61 |
inputvalues['amount'] = "0";
|
|
|
62 |
}
|
|
|
63 |
console.log("inputvalues['amount']"
|
|
|
64 |
+ inputvalues['amount']);
|
|
|
65 |
paymentOptionTransactionModels
|
|
|
66 |
.push(inputvalues);
|
|
|
67 |
});
|
|
|
68 |
if (paymentOptionTransactionModels.length != totalNumberOfPaymentOptionId) {
|
|
|
69 |
alert("Sending less or more paymentOptionIds for"
|
|
|
70 |
+ fofoId);
|
|
|
71 |
return false;
|
|
|
72 |
}
|
| 24105 |
govind |
73 |
console.log(paymentOptionTransactionModels);
|
|
|
74 |
if (confirm("Are you sure you want to update paymentTransaction!") == true) {
|
|
|
75 |
doPutAjaxRequestWithJsonHandler(
|
|
|
76 |
context
|
|
|
77 |
+ "/updatePaymentTransaction?referenceId="
|
|
|
78 |
+ referenceId + "&referenceType="
|
|
|
79 |
+ referenceType + "&fofoId="
|
|
|
80 |
+ fofoId,
|
|
|
81 |
JSON
|
|
|
82 |
.stringify(paymentOptionTransactionModels),
|
|
|
83 |
function(response) {
|
|
|
84 |
if (response === 'true') {
|
|
|
85 |
alert("successfully added");
|
|
|
86 |
loadSearchOrderDetails(
|
|
|
87 |
invoiceNumber,
|
|
|
88 |
"search-order-details-container");
|
|
|
89 |
}
|
|
|
90 |
});
|
|
|
91 |
}
|
| 23973 |
govind |
92 |
|
| 24105 |
govind |
93 |
});
|
|
|
94 |
|
| 23973 |
govind |
95 |
$('#searchType').live(
|
|
|
96 |
'change',
|
|
|
97 |
function() {
|
|
|
98 |
var searchType = $("#searchType option:selected").val();
|
|
|
99 |
var searchTypevalue = $(this).find('option:selected').text();
|
|
|
100 |
;
|
|
|
101 |
saleHistory.searchType = searchType;
|
|
|
102 |
console.log("selected searchType = " + searchType);
|
| 24105 |
govind |
103 |
|
| 23973 |
govind |
104 |
saleHistory("main-content", saleHistory.searchType, "",
|
|
|
105 |
startDate, endDate);
|
| 24105 |
govind |
106 |
|
|
|
107 |
$("#sale-history-search-text").val('');
|
| 23973 |
govind |
108 |
});
|
|
|
109 |
|
|
|
110 |
$("#sale-history-search-button").live(
|
|
|
111 |
'click',
|
|
|
112 |
function() {
|
|
|
113 |
console.log("sale-history-search-button clicked")
|
|
|
114 |
var searchType = $("#searchType option:selected").val();
|
|
|
115 |
console.log("searchType = " + searchType);
|
|
|
116 |
$("#searchType").removeClass("border-highlight");
|
|
|
117 |
// if(searchType == ""){
|
|
|
118 |
// alert("Please choose Search Type");
|
|
|
119 |
// $("#searchType").addClass("border-highlight");
|
|
|
120 |
// }else{
|
|
|
121 |
saleHistory.searchText = $("#sale-history-search-text").val();
|
|
|
122 |
saleHistory.searchType = searchType;
|
|
|
123 |
saleHistory.startTime = startDate;
|
|
|
124 |
saleHistory.endTime = endDate;
|
|
|
125 |
if (typeof (saleHistory.searchText) == "undefined"
|
|
|
126 |
|| !saleHistory.searchText) {
|
|
|
127 |
saleHistory.searchText = "";
|
|
|
128 |
}
|
|
|
129 |
saleHistorySearchInfo(saleHistory.searchType,
|
|
|
130 |
saleHistory.searchText, saleHistory.startTime,
|
|
|
131 |
saleHistory.endTime);
|
|
|
132 |
// $("#sale-history-search-text").val(saleHistory.searchText);
|
|
|
133 |
// $("#searchType").val(searchType);
|
|
|
134 |
// $('input[name="startDateTime"]').val(saleHistory.startTime);
|
|
|
135 |
// $('input[name="endDateTime"]').val(saleHistory.endTime);
|
|
|
136 |
// }
|
|
|
137 |
});
|
|
|
138 |
|
| 23584 |
ashik.ali |
139 |
$(".search-order").live('click', function() {
|
|
|
140 |
console.log("search-order clicked")
|
|
|
141 |
loadSearchOrder("main-content");
|
| 23973 |
govind |
142 |
});
|
|
|
143 |
|
|
|
144 |
$("#search-order-button").live(
|
|
|
145 |
'click',
|
|
|
146 |
function() {
|
|
|
147 |
console.log("search-order-button clicked")
|
|
|
148 |
var invoiceNumber = $("#search-order-text").val();
|
|
|
149 |
loadSearchOrderDetails(invoiceNumber,
|
|
|
150 |
"search-order-details-container");
|
|
|
151 |
});
|
|
|
152 |
|
|
|
153 |
$("#sale-history-paginated .next").live(
|
|
|
154 |
'click',
|
|
|
155 |
function() {
|
|
|
156 |
var params = {};
|
|
|
157 |
params['searchType'] = saleHistory.searchType;
|
|
|
158 |
params['searchValue'] = saleHistory.searchText;
|
|
|
159 |
params['startTime'] = walletHistory.startTime;
|
|
|
160 |
params['endTime'] = walletHistory.endTime;
|
|
|
161 |
loadPaginatedNextItems('/getPaginatedSaleHistory', params,
|
|
|
162 |
'sale-history-paginated', 'sale-history-table',
|
|
|
163 |
'sale-details-container');
|
|
|
164 |
$(this).blur();
|
|
|
165 |
});
|
| 24880 |
govind |
166 |
$("#insurance-paginated .next").live(
|
|
|
167 |
'click',
|
|
|
168 |
function() {
|
|
|
169 |
loadPaginatedNextItems('/insuranceDetailsPaginated', null,
|
|
|
170 |
'insurance-paginated', 'insurance-details-table',
|
|
|
171 |
'insurance-policy-details-container');
|
|
|
172 |
$(this).blur();
|
|
|
173 |
});
|
|
|
174 |
$("#insurance-paginated .previous").live(
|
|
|
175 |
'click',
|
|
|
176 |
function() {
|
|
|
177 |
loadPaginatedNextItems('/insuranceDetailsPaginated', null,
|
|
|
178 |
'insurance-paginated', 'insurance-details-table',
|
|
|
179 |
'insurance-policy-details-container');
|
|
|
180 |
$(this).blur();
|
|
|
181 |
});
|
| 23973 |
govind |
182 |
|
|
|
183 |
$("#sale-history-paginated .previous").live(
|
|
|
184 |
'click',
|
|
|
185 |
function() {
|
|
|
186 |
var params = {};
|
|
|
187 |
params['searchType'] = saleHistory.searchType;
|
|
|
188 |
params['searchValue'] = saleHistory.searchText;
|
|
|
189 |
params['startTime'] = walletHistory.startTime;
|
|
|
190 |
params['endTime'] = walletHistory.endTime;
|
|
|
191 |
loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
|
|
|
192 |
'sale-history-paginated', 'sale-history-table',
|
|
|
193 |
'sale-details-container');
|
|
|
194 |
$(this).blur();
|
|
|
195 |
});
|
|
|
196 |
|
|
|
197 |
// grn-details
|
|
|
198 |
|
|
|
199 |
$(".sale-details").live('click', function() {
|
| 23654 |
amit.gupta |
200 |
orderId = $(this).attr('data');
|
| 23973 |
govind |
201 |
console.log("orderId = " + orderId);
|
|
|
202 |
loadSaleDetails(orderId, "sale-details-container");
|
| 23343 |
ashik.ali |
203 |
});
|
|
|
204 |
});
|
|
|
205 |
|
| 23973 |
govind |
206 |
function loadSaleDetails(orderId, domId) {
|
|
|
207 |
doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
|
|
|
208 |
function(response) {
|
|
|
209 |
$('#' + domId).html(response);
|
|
|
210 |
});
|
| 23343 |
ashik.ali |
211 |
}
|
|
|
212 |
|
| 23973 |
govind |
213 |
function loadSearchOrder(domId) {
|
|
|
214 |
doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
|
| 23584 |
ashik.ali |
215 |
$('#' + domId).html(response);
|
|
|
216 |
});
|
|
|
217 |
}
|
|
|
218 |
|
| 23973 |
govind |
219 |
function loadSearchOrderDetails(invoiceNumber, domId) {
|
|
|
220 |
doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
|
|
|
221 |
+ invoiceNumber, function(response) {
|
| 23584 |
ashik.ali |
222 |
$('#' + domId).html(response);
|
|
|
223 |
});
|
|
|
224 |
}
|
|
|
225 |
|
| 23973 |
govind |
226 |
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
|
|
|
227 |
doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
|
|
|
228 |
+ "&searchValue=" + searchValue + "&startTime=" + startTime
|
|
|
229 |
+ "&endTime=" + endTime, function(response) {
|
| 23343 |
ashik.ali |
230 |
$('#' + domId).html(response);
|
|
|
231 |
});
|
|
|
232 |
}
|
|
|
233 |
|
| 23973 |
govind |
234 |
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
|
| 23343 |
ashik.ali |
235 |
saleHistory("main-content", searchType, searchText, startTime, endTime);
|
| 24105 |
govind |
236 |
|
|
|
237 |
}
|
| 24880 |
govind |
238 |
function insurancePolicyDetails(domId) {
|
|
|
239 |
doGetAjaxRequestHandler(context + "/insuranceDetails", function(response) {
|
|
|
240 |
$('#' + domId).html(response);
|
|
|
241 |
});
|
|
|
242 |
}
|