| 30725 |
amit.gupta |
1 |
$(function () {
|
| 31274 |
amit.gupta |
2 |
//Price change handler
|
| 33149 |
ranu |
3 |
$(document).on('change', "form#cd input.unitPrice, form#cd input.discount", function () {
|
|
|
4 |
var $row = $(this).closest('tr'); // Get the closest <tr> parent of the changed input
|
| 33437 |
ranu |
5 |
var unitPrice = parseFloat($row.find('input.unitPrice').val());
|
| 24440 |
amit.gupta |
6 |
|
| 31274 |
amit.gupta |
7 |
if (isNaN(unitPrice)) {
|
|
|
8 |
unitPrice = 0;
|
|
|
9 |
}
|
| 33149 |
ranu |
10 |
var discount = parseFloat($row.find('input.discount').val());
|
|
|
11 |
var maxDiscount = parseFloat($row.find('input.discount').data('maxdiscount'));
|
| 31274 |
amit.gupta |
12 |
if (isNaN(discount)) {
|
|
|
13 |
discount = 0;
|
|
|
14 |
}
|
|
|
15 |
if (isNaN(maxDiscount)) {
|
|
|
16 |
maxDiscount = 0;
|
|
|
17 |
}
|
|
|
18 |
if (discount > maxDiscount) {
|
| 33149 |
ranu |
19 |
alert("Discount can't be greater than max Discount");
|
|
|
20 |
$row.find('input.discount').val(maxDiscount);
|
| 31274 |
amit.gupta |
21 |
$(this).focus();
|
|
|
22 |
return;
|
|
|
23 |
}
|
|
|
24 |
if (unitPrice < 0 || (unitPrice > 0 && unitPrice - discount < 0)) {
|
|
|
25 |
alert("Invalid unit/discount price");
|
|
|
26 |
$(this).focus();
|
|
|
27 |
return;
|
|
|
28 |
}
|
| 32468 |
amit.gupta |
29 |
let lines = $("#order-items").find('tbody>tr:gt(0)').length;
|
|
|
30 |
if (lines > 3) {
|
| 33149 |
ranu |
31 |
calculateTotalAmount($row);
|
| 32469 |
amit.gupta |
32 |
} else {
|
|
|
33 |
calculateTotalAmount();
|
| 32468 |
amit.gupta |
34 |
}
|
| 33149 |
ranu |
35 |
$row.find('.mk_check_plans').trigger('click', ['manual']); // Trigger the button within the same row
|
| 31274 |
amit.gupta |
36 |
});
|
| 30725 |
amit.gupta |
37 |
|
| 33795 |
ranu |
38 |
$(document).on('click', ".upgrade-offer", function () {
|
|
|
39 |
var itemId = $(this).data('itemid');
|
|
|
40 |
doGetAjaxRequestHandler(`${context}/getItemWiseUpgradeOffer?itemId=` + itemId, function (response) {
|
|
|
41 |
$('#upgradeOfferModal .modal-content').html(response);
|
|
|
42 |
});
|
|
|
43 |
});
|
| 30725 |
amit.gupta |
44 |
|
| 33149 |
ranu |
45 |
|
| 31274 |
amit.gupta |
46 |
$(document).on('change', "form#cd input.insuranceamount", function () {
|
|
|
47 |
calculateTotalAmount();
|
|
|
48 |
});
|
| 30725 |
amit.gupta |
49 |
|
| 31274 |
amit.gupta |
50 |
$(document).on('click', ".create-order", function () {
|
|
|
51 |
checkout("main-content");
|
|
|
52 |
});
|
| 30725 |
amit.gupta |
53 |
|
| 31274 |
amit.gupta |
54 |
$(document).on('click', ".mk_check_plans", function (event, source) {
|
| 35459 |
amit |
55 |
console.log("checkPlansssssss99999");
|
| 32434 |
amit.gupta |
56 |
let lines = $("#order-items").find('tbody>tr:gt(0)').length;
|
| 32414 |
amit.gupta |
57 |
if (lines > 3) {
|
| 35459 |
amit |
58 |
//No need to check plans
|
| 32414 |
amit.gupta |
59 |
return;
|
|
|
60 |
}
|
| 31274 |
amit.gupta |
61 |
$('div.itemdetails').find('input').val('');
|
| 35459 |
amit |
62 |
let price = mop;
|
| 31274 |
amit.gupta |
63 |
var mop = parseFloat($(this).data("mop"));
|
|
|
64 |
var sellingPrice = $(this).val();
|
|
|
65 |
var itemId = $(this).closest(".input-group").find("input.insuranceamount").attr("itemid");
|
|
|
66 |
if (!isNaN(sellingPrice) && parseFloat(sellingPrice) >= mop) {
|
|
|
67 |
price = parseFloat(sellingPrice);
|
|
|
68 |
} else {
|
|
|
69 |
price = mop;
|
|
|
70 |
}
|
| 33437 |
ranu |
71 |
var poiId = parseFloat($(this).closest("tr").find("input.poiId").val());
|
| 31274 |
amit.gupta |
72 |
var discount = parseFloat($(this).closest("tr").find("input.discount").val());
|
|
|
73 |
if (!isNaN(discount)) {
|
|
|
74 |
price = price - discount;
|
|
|
75 |
}
|
|
|
76 |
let that = this;
|
| 33437 |
ranu |
77 |
doGetAjaxRequestHandler(`${context}/checkplans?price=${price}&itemId=${itemId}&poiId=${poiId}`, function (response) {
|
| 31274 |
amit.gupta |
78 |
var obj = JSON.parse(response);
|
|
|
79 |
if (obj != null) {
|
| 34798 |
ranu |
80 |
getInsurancePlansModal(obj, that, price, itemId);
|
| 31274 |
amit.gupta |
81 |
return;
|
|
|
82 |
} else {
|
|
|
83 |
if (typeof source === "undefined") {
|
|
|
84 |
alert("Product is not eligible for insurance");
|
|
|
85 |
}
|
|
|
86 |
}
|
|
|
87 |
});
|
|
|
88 |
});
|
| 30725 |
amit.gupta |
89 |
|
| 22245 |
ashik.ali |
90 |
});
|
| 23343 |
ashik.ali |
91 |
|
| 31274 |
amit.gupta |
92 |
class InsuranceElement extends React.Component {
|
| 35098 |
ranu |
93 |
|
| 31274 |
amit.gupta |
94 |
planChecked;
|
| 23343 |
ashik.ali |
95 |
|
| 31274 |
amit.gupta |
96 |
constructor(props) {
|
|
|
97 |
super(props);
|
| 34798 |
ranu |
98 |
this.state = {
|
|
|
99 |
quotedPlans: {}
|
|
|
100 |
};
|
| 31274 |
amit.gupta |
101 |
}
|
| 24440 |
amit.gupta |
102 |
|
| 31274 |
amit.gupta |
103 |
render() {
|
|
|
104 |
console.log(this.props);
|
|
|
105 |
return <table className="table table-sm">
|
|
|
106 |
<thead>
|
|
|
107 |
<tr>
|
|
|
108 |
<th>Plan Name</th>
|
|
|
109 |
<th>Duration</th>
|
|
|
110 |
<th>DP</th>
|
|
|
111 |
<th>Selling Price</th>
|
|
|
112 |
<th>Action</th>
|
|
|
113 |
</tr>
|
|
|
114 |
</thead>
|
|
|
115 |
<tbody>
|
|
|
116 |
{Object.keys(this.props.plans).map((planName, i) =>
|
| 34798 |
ranu |
117 |
this.props.plans[planName].map((plan, j) => {
|
|
|
118 |
const quoted = this.state.quotedPlans[plan.productId];
|
|
|
119 |
const isQuoted = !!quoted;
|
|
|
120 |
const displayPremium = isQuoted ? quoted.premium : (plan.premium || 0);
|
| 34805 |
ranu |
121 |
const displayDP = isQuoted ? quoted.dp : (plan.dp || 0);
|
| 34798 |
ranu |
122 |
|
|
|
123 |
return (
|
|
|
124 |
<tr key={`${i}-${j}`}>
|
| 35098 |
ranu |
125 |
<td>
|
|
|
126 |
{plan.providerId == 6 ? (
|
| 35192 |
ranu |
127 |
<div style={{textAlign: "center"}}>
|
|
|
128 |
<img
|
|
|
129 |
src="/resources/images/ProtectPlusLogo2.jpg"
|
|
|
130 |
style={{height: "70px"}}
|
|
|
131 |
alt="ProtectPlus"
|
|
|
132 |
/>
|
|
|
133 |
<div style={{fontSize: "13px", marginTop: "4px", color: "#666"}}>
|
|
|
134 |
4% margin
|
|
|
135 |
</div>
|
|
|
136 |
</div>
|
| 35098 |
ranu |
137 |
) : (
|
|
|
138 |
planName
|
|
|
139 |
)}
|
|
|
140 |
|
|
|
141 |
</td>
|
|
|
142 |
|
| 34798 |
ranu |
143 |
<td>{plan.duration}</td>
|
|
|
144 |
<td>{displayDP ? displayDP.toFixed(2) : "-"}</td>
|
|
|
145 |
<td>{displayPremium ? displayPremium.toFixed(2) : "-"}</td>
|
|
|
146 |
|
|
|
147 |
<td>
|
|
|
148 |
{isQuoted || (plan.dp > 0 && plan.premium > 0) ? (
|
|
|
149 |
<button
|
|
|
150 |
className="btn btn-primary"
|
|
|
151 |
data-key={plan.productId}
|
|
|
152 |
data-amount={isQuoted ? quoted.premium.toFixed(2) : plan.premium.toFixed(2)}
|
| 35067 |
ranu |
153 |
data-correlationid={isQuoted ? quoted.correlationId : plan.correlationId}
|
| 34798 |
ranu |
154 |
onClick={this.planChecked}
|
|
|
155 |
>
|
|
|
156 |
Add
|
|
|
157 |
</button>
|
|
|
158 |
) : (
|
| 35002 |
ranu |
159 |
<button className="btn btn-warning"
|
|
|
160 |
onClick={(e) => this.checkQuote(e, plan, planName)}>
|
| 34798 |
ranu |
161 |
Check Quote
|
|
|
162 |
</button>
|
|
|
163 |
)}
|
|
|
164 |
</td>
|
|
|
165 |
</tr>
|
|
|
166 |
);
|
|
|
167 |
})
|
|
|
168 |
)}
|
| 31274 |
amit.gupta |
169 |
</tbody>
|
| 34798 |
ranu |
170 |
|
| 31274 |
amit.gupta |
171 |
</table>;
|
|
|
172 |
}
|
|
|
173 |
|
| 35232 |
ranu |
174 |
/* planChecked = (e) => {
|
|
|
175 |
//debugger;
|
|
|
176 |
let $itemDetails = $('div.itemdetails');
|
|
|
177 |
if ($itemDetails.find('.dgram').val() === '') {
|
|
|
178 |
bootbox.alert('Mobile RAM is required');
|
|
|
179 |
return;
|
|
|
180 |
}
|
|
|
181 |
if ($itemDetails.find('.dgmemory').val() === '') {
|
|
|
182 |
bootbox.alert('Mobile Memory is required');
|
|
|
183 |
return;
|
|
|
184 |
}
|
|
|
185 |
if ($itemDetails.find('#dgmfgdate').val() === '') {
|
|
|
186 |
bootbox.alert('Mobile Mfg Date is required');
|
|
|
187 |
return;
|
|
|
188 |
}
|
|
|
189 |
let $orderItemRow = $(this.props.elePlanCheckedOn).closest('td');
|
|
|
190 |
$orderItemRow.find('.insuranceid').val($(e.target).data('key'));
|
|
|
191 |
$orderItemRow.find('.correlationid').val($(e.target).data('correlationid'));
|
|
|
192 |
$orderItemRow.find('.insuranceamount').val($(e.target).data('amount'));
|
|
|
193 |
$orderItemRow.find('.ram').val($itemDetails.find('.dgram').val());
|
|
|
194 |
$orderItemRow.find('.memory').val($itemDetails.find('.dgmemory').val());
|
|
|
195 |
// $orderItemRow.find('.mfgdate').val(window.mfgDate);
|
|
|
196 |
$orderItemRow.find('.mfgdate').val($itemDetails.find('.dgmfgdate').val());
|
|
|
197 |
$('#mobilePlansModal').modal('hide');
|
|
|
198 |
calculateTotalAmount();
|
|
|
199 |
}*/
|
|
|
200 |
|
| 31274 |
amit.gupta |
201 |
planChecked = (e) => {
|
|
|
202 |
let $itemDetails = $('div.itemdetails');
|
| 35232 |
ranu |
203 |
|
| 31274 |
amit.gupta |
204 |
if ($itemDetails.find('.dgram').val() === '') {
|
|
|
205 |
bootbox.alert('Mobile RAM is required');
|
|
|
206 |
return;
|
|
|
207 |
}
|
|
|
208 |
if ($itemDetails.find('.dgmemory').val() === '') {
|
|
|
209 |
bootbox.alert('Mobile Memory is required');
|
|
|
210 |
return;
|
|
|
211 |
}
|
|
|
212 |
if ($itemDetails.find('#dgmfgdate').val() === '') {
|
|
|
213 |
bootbox.alert('Mobile Mfg Date is required');
|
|
|
214 |
return;
|
|
|
215 |
}
|
| 35232 |
ranu |
216 |
|
| 31274 |
amit.gupta |
217 |
let $orderItemRow = $(this.props.elePlanCheckedOn).closest('td');
|
| 35232 |
ranu |
218 |
|
|
|
219 |
// read existing values
|
|
|
220 |
let existingIds = $orderItemRow.find('.insuranceid').val() || "";
|
|
|
221 |
let existingAmounts = $orderItemRow.find('.insuranceamount').data('all-amounts') || ""; // store individual amounts in data attribute
|
|
|
222 |
let existingCorrelation = $orderItemRow.find('.correlationid').val() || "";
|
|
|
223 |
|
|
|
224 |
// new selected values
|
|
|
225 |
let newId = $(e.target).data('key');
|
|
|
226 |
let newAmount = $(e.target).data('amount');
|
|
|
227 |
let newCorrelation = $(e.target).data('correlationid');
|
|
|
228 |
|
|
|
229 |
// append IDs
|
|
|
230 |
let updatedIds = existingIds ? existingIds + "," + newId : newId;
|
|
|
231 |
|
|
|
232 |
// append individual amounts (for tooltip)
|
|
|
233 |
let updatedAmountsList = existingAmounts ? existingAmounts + "," + newAmount : newAmount;
|
|
|
234 |
|
|
|
235 |
// calculate total
|
|
|
236 |
let totalAmount = updatedAmountsList.split(',').reduce((sum, val) => sum + parseFloat(val || 0), 0);
|
|
|
237 |
|
|
|
238 |
// correlation ID logic
|
|
|
239 |
let updatedCorrelation = existingCorrelation;
|
|
|
240 |
if (newCorrelation && newCorrelation.trim() !== "") {
|
|
|
241 |
updatedCorrelation = newCorrelation;
|
|
|
242 |
}
|
|
|
243 |
|
|
|
244 |
// assign back
|
|
|
245 |
$orderItemRow.find('.insuranceid').val(updatedIds);
|
|
|
246 |
$orderItemRow.find('.insuranceamount').val(totalAmount.toFixed(2)) // sum total
|
|
|
247 |
.data('all-amounts', updatedAmountsList) // save individual amounts
|
|
|
248 |
.attr('title', updatedAmountsList); // tooltip for user
|
|
|
249 |
$orderItemRow.find('.correlationid').val(updatedCorrelation);
|
| 31274 |
amit.gupta |
250 |
$orderItemRow.find('.ram').val($itemDetails.find('.dgram').val());
|
|
|
251 |
$orderItemRow.find('.memory').val($itemDetails.find('.dgmemory').val());
|
| 34798 |
ranu |
252 |
$orderItemRow.find('.mfgdate').val($itemDetails.find('.dgmfgdate').val());
|
| 35232 |
ranu |
253 |
$(e.target).text("Added");
|
|
|
254 |
$(e.target).prop("disabled", true);
|
| 31274 |
amit.gupta |
255 |
calculateTotalAmount();
|
| 35232 |
ranu |
256 |
};
|
| 34798 |
ranu |
257 |
|
| 35232 |
ranu |
258 |
|
|
|
259 |
|
| 35002 |
ranu |
260 |
checkQuote = (e, plan, planName) => {
|
| 34798 |
ranu |
261 |
//debugger;
|
|
|
262 |
let $itemDetails = $('div.itemdetails');
|
|
|
263 |
if ($itemDetails.find('.dgram').val() === '') {
|
|
|
264 |
bootbox.alert('Mobile RAM is required');
|
|
|
265 |
return;
|
|
|
266 |
}
|
|
|
267 |
if ($itemDetails.find('.dgmemory').val() === '') {
|
|
|
268 |
bootbox.alert('Mobile Memory is required');
|
|
|
269 |
return;
|
|
|
270 |
}
|
|
|
271 |
if ($itemDetails.find('#dgmfgdate').val() === '') {
|
|
|
272 |
bootbox.alert('Mobile Mfg Date is required');
|
|
|
273 |
return;
|
|
|
274 |
}
|
|
|
275 |
let planCode = plan.productId;
|
|
|
276 |
let manuFacturedDate = $itemDetails.find('.dgmfgdate').val();
|
| 35002 |
ranu |
277 |
this.calculateQuote(planCode, this.props.itemId, this.props.devicePrice, manuFacturedDate, planName);
|
| 34798 |
ranu |
278 |
|
|
|
279 |
}
|
|
|
280 |
|
| 35002 |
ranu |
281 |
calculateQuote = (planCode, itemId, devicePrice, manuFacturedDate, planName) => {
|
| 34798 |
ranu |
282 |
doGetAjaxRequestHandler(
|
| 35002 |
ranu |
283 |
`${context}/getPlanQuote?planCode=${planCode}&itemId=${itemId}&sumInsured=${devicePrice}&manufacturedDate=${manuFacturedDate}&planName=${planName}`,
|
| 34798 |
ranu |
284 |
(responseText) => {
|
|
|
285 |
const response = JSON.parse(responseText);
|
|
|
286 |
console.log("quote call back", response);
|
|
|
287 |
|
| 35002 |
ranu |
288 |
if (response.afinityQuoteModel.policyStatus === "APPROVE" || response.afinityQuoteModel.message === "Success") {
|
| 34798 |
ranu |
289 |
const updatedPlan = {
|
| 34805 |
ranu |
290 |
premium: response.afinityQuoteModel.totalPremium,
|
|
|
291 |
dp: response.planDp,
|
|
|
292 |
correlationId: response.afinityQuoteModel.correlationId
|
| 34798 |
ranu |
293 |
};
|
|
|
294 |
|
|
|
295 |
this.setState((prevState) => ({
|
|
|
296 |
quotedPlans: {
|
|
|
297 |
...prevState.quotedPlans,
|
|
|
298 |
[planCode]: updatedPlan
|
|
|
299 |
}
|
|
|
300 |
}));
|
|
|
301 |
} else {
|
| 34805 |
ranu |
302 |
bootbox.alert("Quote failed: " + (response.afinityQuoteModel.message || "Unknown error"));
|
| 34798 |
ranu |
303 |
}
|
|
|
304 |
}
|
|
|
305 |
);
|
|
|
306 |
}
|
| 24440 |
amit.gupta |
307 |
}
|
|
|
308 |
|
| 31274 |
amit.gupta |
309 |
let reactRoot = null;
|
| 24440 |
amit.gupta |
310 |
|
| 34798 |
ranu |
311 |
function getInsurancePlansModal(insurancePlans, elePlanCheckedOn, devicePrice, itemId) {
|
| 31274 |
amit.gupta |
312 |
const domContainer = document.querySelector('.insurancedetails');
|
|
|
313 |
reactRoot = ReactDOM.createRoot(domContainer);
|
| 34798 |
ranu |
314 |
reactRoot.render(<InsuranceElement plans={insurancePlans} elePlanCheckedOn={elePlanCheckedOn}
|
|
|
315 |
devicePrice={devicePrice} itemId={itemId}/>)
|
| 31274 |
amit.gupta |
316 |
$('#mobilePlansModal').modal({show: true});
|
|
|
317 |
|
|
|
318 |
}
|
|
|
319 |
|
|
|
320 |
|
| 32468 |
amit.gupta |
321 |
function calculateTotalAmount(inputEle) {
|
|
|
322 |
if (typeof inputEle !== "undefined") {
|
|
|
323 |
let itemId = $(inputEle).attr("itemid");
|
|
|
324 |
let unitPrice = inputEle.value;
|
|
|
325 |
$("#order-items").find(`input.unitPrice[itemid=${itemId}]`).each(function () {
|
|
|
326 |
this.value = unitPrice;
|
|
|
327 |
})
|
|
|
328 |
|
|
|
329 |
}
|
| 31274 |
amit.gupta |
330 |
var netPayableAmount = 0;
|
|
|
331 |
var totaInsuranceAmount = 0;
|
| 32329 |
amit.gupta |
332 |
$("#order-items").find('tbody>tr:gt(0)').each(function (index, el) {
|
| 31274 |
amit.gupta |
333 |
var rowTotal = 0;
|
|
|
334 |
let $tr = $(el);
|
|
|
335 |
var insuranceAmount = $tr.find('input.insuranceamount').val();
|
|
|
336 |
if (isNaN(insuranceAmount)) {
|
|
|
337 |
insuranceAmount = 0;
|
|
|
338 |
} else {
|
|
|
339 |
insuranceAmount = parseFloat(insuranceAmount);
|
|
|
340 |
}
|
| 30725 |
amit.gupta |
341 |
|
| 31274 |
amit.gupta |
342 |
var quantity = parseFloat($(el).find('.unitPrice').attr('quantity'));
|
| 30725 |
amit.gupta |
343 |
|
| 31274 |
amit.gupta |
344 |
var unitPrice = parseFloat($(el).find('.unitPrice').val());
|
|
|
345 |
if (isNaN(unitPrice)) {
|
|
|
346 |
unitPrice = 0;
|
|
|
347 |
}
|
| 30725 |
amit.gupta |
348 |
|
| 31274 |
amit.gupta |
349 |
var discount = $(el).find('.discount').val();
|
|
|
350 |
if (isNaN(discount)) {
|
|
|
351 |
discount = 0;
|
|
|
352 |
}
|
| 23343 |
ashik.ali |
353 |
|
| 32329 |
amit.gupta |
354 |
rowTotal = (unitPrice - discount + insuranceAmount) * quantity;
|
| 31274 |
amit.gupta |
355 |
$tr.find('.totalPrice').val(rowTotal);
|
|
|
356 |
netPayableAmount += rowTotal;
|
|
|
357 |
totaInsuranceAmount += insuranceAmount;
|
|
|
358 |
});
|
|
|
359 |
if (totaInsuranceAmount > 0) {
|
|
|
360 |
$(".mk_insurance_row").show();
|
|
|
361 |
} else {
|
|
|
362 |
$(".mk_insurance_row").hide();
|
|
|
363 |
}
|
|
|
364 |
$('#cd').find('input.netPayableAmount').val(netPayableAmount);
|
| 23343 |
ashik.ali |
365 |
}
|
| 33795 |
ranu |
366 |
|
|
|
367 |
$(document).on('change', '.offerSelect', function () {
|
|
|
368 |
calculateAndUpdatePaymentOptions();
|
|
|
369 |
});
|
|
|
370 |
|
|
|
371 |
function calculateAndUpdatePaymentOptions() {
|
|
|
372 |
let totalSchemePayout = 0;
|
|
|
373 |
let totalPartnerPayout = 0;
|
|
|
374 |
|
|
|
375 |
// Loop through all selected options in each row
|
|
|
376 |
$('.offerSelect').each(function () {
|
|
|
377 |
let selectedOption = $(this).find('option:selected');
|
|
|
378 |
|
|
|
379 |
let schemePayout = parseFloat(selectedOption.data('scheme-payout')) || 0;
|
|
|
380 |
let partnerPayout = parseFloat(selectedOption.data('partner-payout')) || 0;
|
|
|
381 |
|
|
|
382 |
// Accumulate the payouts
|
|
|
383 |
totalSchemePayout += schemePayout;
|
|
|
384 |
totalPartnerPayout += partnerPayout;
|
|
|
385 |
});
|
|
|
386 |
|
|
|
387 |
// Now update the payment options with the accumulated values
|
|
|
388 |
updatePaymentOptions(totalSchemePayout, totalPartnerPayout);
|
|
|
389 |
}
|
|
|
390 |
|
|
|
391 |
function updatePaymentOptions(schemePayout, partnerPayout) {
|
|
|
392 |
$("#payment-option-id-amount-container").find('.paymentOptionAmount').each(function () {
|
|
|
393 |
let paymentOptionName = $(this).closest('.row').find('h5').text().trim();
|
|
|
394 |
|
|
|
395 |
if (paymentOptionName.includes('SAMSUNG UPGRADE')) {
|
|
|
396 |
$(this).val(schemePayout); // Set the total scheme payout
|
|
|
397 |
}
|
|
|
398 |
|
| 35055 |
ranu |
399 |
// if (paymentOptionName.includes('CASH DISCOUNT')) {
|
|
|
400 |
// $(this).val(partnerPayout); // Set the total partner payout
|
|
|
401 |
// }
|
| 33795 |
ranu |
402 |
});
|
|
|
403 |
}
|
|
|
404 |
|
| 34168 |
tejus.loha |
405 |
$(document).on('click', '.reset-irn-generated-panel', function () {
|
|
|
406 |
getResetIrnGeneratedPanel();
|
|
|
407 |
});
|
| 33795 |
ranu |
408 |
|
| 34168 |
tejus.loha |
409 |
$(document).on('click', '#search-invoice-for-irn-reset', function () {
|
|
|
410 |
var invoiceNumber = $("#search-invoice-number").val();
|
|
|
411 |
if (!invoiceNumber) {
|
|
|
412 |
alert("Please enter Invoice Number");
|
|
|
413 |
return;
|
|
|
414 |
}
|
|
|
415 |
doGetAjaxRequestHandler(`${context}/getTransactionForIrnReset?invoiceNumber=${invoiceNumber}`, function (response) {
|
|
|
416 |
$('#transaction-for-reset-irn-container').html(response);
|
|
|
417 |
});
|
|
|
418 |
});
|
| 33795 |
ranu |
419 |
|
| 34168 |
tejus.loha |
420 |
$(document).on('click', '#reset-irn-button', function () {
|
|
|
421 |
if (confirm("Are you sure to Reset IRN")) {
|
|
|
422 |
let invoices = [];
|
|
|
423 |
$('#eligible-irn-order tbody tr').each(function () {
|
|
|
424 |
const invoiceNumber = $(this).find('td:nth-child(3)').text();
|
|
|
425 |
invoices.push(invoiceNumber);
|
|
|
426 |
});
|
|
|
427 |
const invoiceNumbers = invoices.join(', ');
|
|
|
428 |
console.log('invoiceNumbersString - ', invoiceNumbers)
|
|
|
429 |
let url = `${context}/resetOrdersIrn?invoiceNumbers=${invoiceNumbers}`
|
|
|
430 |
doPutAjaxRequestHandler(url, function (response) {
|
|
|
431 |
if (response) {
|
|
|
432 |
alert(`IRN reset successfully for Invoice No - ${invoiceNumbers}`);
|
|
|
433 |
getResetIrnGeneratedPanel();
|
|
|
434 |
}
|
|
|
435 |
});
|
|
|
436 |
}
|
|
|
437 |
});
|
| 33795 |
ranu |
438 |
|
| 34168 |
tejus.loha |
439 |
function getResetIrnGeneratedPanel() {
|
|
|
440 |
doGetAjaxRequestHandler(`${context}/resetIrnGeneratedPanel`, function (response) {
|
|
|
441 |
$('#main-content').html(response);
|
|
|
442 |
});
|
|
|
443 |
}
|
| 33795 |
ranu |
444 |
|
|
|
445 |
|
|
|
446 |
|
| 34168 |
tejus.loha |
447 |
|
|
|
448 |
|
|
|
449 |
|
|
|
450 |
|