| Line 86... |
Line 86... |
| 86 |
const gstCity = $('input[name="gstCity"]').val();
|
86 |
const gstCity = $('input[name="gstCity"]').val();
|
| 87 |
const gstDistrict = $('input[name="gstDistrict"]').val();
|
87 |
const gstDistrict = $('input[name="gstDistrict"]').val();
|
| 88 |
const agreeWalletValue = $('select[name="agreeWalletValue"]').val();
|
88 |
const agreeWalletValue = $('select[name="agreeWalletValue"]').val();
|
| 89 |
const storeArea = $('input[name="storeArea"]').val();
|
89 |
const storeArea = $('input[name="storeArea"]').val();
|
| 90 |
const storePotential = $('input[name="storePotential"]').val();
|
90 |
const storePotential = $('input[name="storePotential"]').val();
|
| - |
|
91 |
let financeOptions = [];
|
| - |
|
92 |
document.querySelectorAll(".finance-code-input").forEach(function (input) {
|
| 91 |
const finCode = $('input[name="finCode"]').val();
|
93 |
var code = input.value.trim();
|
| - |
|
94 |
if (code) {
|
| - |
|
95 |
financeOptions.push({
|
| - |
|
96 |
paymentOptionId: parseInt(input.getAttribute("data-payment-option-id")),
|
| - |
|
97 |
financeCode: code
|
| - |
|
98 |
});
|
| - |
|
99 |
}
|
| - |
|
100 |
});
|
| 92 |
let brandCommitment = [];
|
101 |
let brandCommitment = [];
|
| 93 |
var brandCommitmentInputs = document.querySelectorAll(".brand-commitment");
|
102 |
var brandCommitmentInputs = document.querySelectorAll(".brand-commitment");
|
| - |
|
103 |
var hasInvalidQty = false;
|
| 94 |
brandCommitmentInputs.forEach(function (input) {
|
104 |
brandCommitmentInputs.forEach(function (input) {
|
| 95 |
var commitmentValue = parseInt(input.value);
|
105 |
var commitmentValue = parseInt(input.value);
|
| 96 |
if (!isNaN(commitmentValue)) {
|
106 |
if (!isNaN(commitmentValue)) {
|
| - |
|
107 |
if (commitmentValue > 1000) {
|
| - |
|
108 |
hasInvalidQty = true;
|
| - |
|
109 |
}
|
| 97 |
brandCommitment.push({
|
110 |
brandCommitment.push({
|
| 98 |
brandName: input.getAttribute("name"),
|
111 |
brandName: input.getAttribute("name"),
|
| 99 |
value: commitmentValue
|
112 |
value: commitmentValue
|
| 100 |
});
|
113 |
});
|
| 101 |
}
|
114 |
}
|
| 102 |
});
|
115 |
});
|
| - |
|
116 |
if (hasInvalidQty) {
|
| - |
|
117 |
alert("Quantity per brand cannot exceed 1000. Please enter valid quantities.");
|
| - |
|
118 |
return;
|
| - |
|
119 |
}
|
| 103 |
let totalCommitment = brandCommitment.reduce((total, commitment) => total + commitment.value, 0);
|
120 |
let totalCommitment = brandCommitment.reduce((total, commitment) => total + commitment.value, 0);
|
| - |
|
121 |
// Calculate estimated value: total qty × 20000 (average smartphone value)
|
| 104 |
const lessCommitReason = $('input[name="lessCommitReason"]').val();
|
122 |
let estimatedValue = totalCommitment * 20000;
|
| 105 |
let minCommit = totalCommitment >= storePotential * (70 / 100);
|
123 |
let minCommit = estimatedValue >= (0.7 * storePotential);
|
| - |
|
124 |
const lessCommitReason = $('textarea[name="lessCommitReason"]').val();
|
| 106 |
const agreedBrandFees = $('select[name="agreedBrandFees"]').val();
|
125 |
const agreedBrandFees = $('select[name="agreedBrandFees"]').val();
|
| 107 |
const values = agreedBrandFees.split(/[-]/); // Split the string
|
126 |
const values = agreedBrandFees.split(/[-]/); // Split the string
|
| 108 |
const brandFee = parseFloat(values[1]);
|
127 |
const brandFee = parseFloat(values[1]);
|
| 109 |
const brandFeesCollected = $('input[name="brandFeesCollected"]').val();
|
128 |
const brandFeesCollected = $('input[name="brandFeesCollected"]').val();
|
| 110 |
const paymentMode = $('select[name="paymentMode"]').val();
|
129 |
const paymentMode = $('select[name="paymentMode"]').val();
|
| Line 179... |
Line 198... |
| 179 |
gstCity: gstCity,
|
198 |
gstCity: gstCity,
|
| 180 |
gstDistrict: gstDistrict,
|
199 |
gstDistrict: gstDistrict,
|
| 181 |
agreeWalletValue: agreeWalletValue,
|
200 |
agreeWalletValue: agreeWalletValue,
|
| 182 |
storeArea: storeArea,
|
201 |
storeArea: storeArea,
|
| 183 |
storePotential: storePotential,
|
202 |
storePotential: storePotential,
|
| 184 |
financeCode: finCode,
|
203 |
financeOptions: financeOptions,
|
| 185 |
lessCommitReason: lessCommitReason,
|
204 |
lessCommitReason: lessCommitReason,
|
| 186 |
agreedBrandFees: agreedBrandFees,
|
205 |
agreedBrandFees: agreedBrandFees,
|
| 187 |
brandFeesCollected: brandFeesCollected,
|
206 |
brandFeesCollected: brandFeesCollected,
|
| 188 |
paymentMode: paymentMode,
|
207 |
paymentMode: paymentMode,
|
| 189 |
paymentReferenceNo: paymentReferenceNo,
|
208 |
paymentReferenceNo: paymentReferenceNo,
|
| Line 279... |
Line 298... |
| 279 |
function (response) {
|
298 |
function (response) {
|
| 280 |
$('#' + 'main-content').html(response);
|
299 |
$('#' + 'main-content').html(response);
|
| 281 |
});
|
300 |
});
|
| 282 |
});
|
301 |
});
|
| 283 |
$(document).on('click', "#addBrandFeePayment", function () {
|
302 |
$(document).on('click', "#addBrandFeePayment", function () {
|
| - |
|
303 |
var $btn = $(this);
|
| - |
|
304 |
if ($btn.prop('disabled')) return false;
|
| 284 |
let formData = objectifyForm($("form[name='brandFeeCollectionForm']").serializeArray());
|
305 |
let formData = objectifyForm($("form[name='brandFeeCollectionForm']").serializeArray());
|
| 285 |
let loiId = $(this).val();
|
306 |
let loiId = $btn.val();
|
| 286 |
for (var key in formData) {
|
307 |
for (var key in formData) {
|
| 287 |
if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
|
308 |
if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
|
| 288 |
alert("The (" + key + ") value is blank please fill this field !");
|
309 |
alert("The (" + key + ") value is blank please fill this field !");
|
| 289 |
return false;
|
310 |
return false;
|
| 290 |
}
|
311 |
}
|
| 291 |
}
|
312 |
}
|
| 292 |
let jsonData = JSON.stringify(formData);
|
313 |
let jsonData = JSON.stringify(formData);
|
| 293 |
if (confirm("Are you sure to add payment ?")) {
|
314 |
if (confirm("Are you sure to add payment ?")) {
|
| - |
|
315 |
$btn.prop('disabled', true);
|
| 294 |
doPostAjaxRequestWithJsonHandler(`${context}/brandfeeCollection?loiId=` + loiId, jsonData, function (response) {
|
316 |
doPostAjaxRequestWithJsonHandler(`${context}/brandfeeCollection?loiId=` + loiId, jsonData, function (response) {
|
| 295 |
if (response) {
|
317 |
if (response) {
|
| 296 |
alert("Payment add successfully...");
|
318 |
alert("Payment add successfully...");
|
| - |
|
319 |
$('#brandFeeCollectionModel').modal('hide');
|
| 297 |
pendingLoiForm("main-content");
|
320 |
pendingLoiForm("main-content");
|
| 298 |
|
- |
|
| 299 |
}
|
321 |
}
|
| - |
|
322 |
$btn.prop('disabled', false);
|
| 300 |
});
|
323 |
});
|
| 301 |
} else {
|
324 |
} else {
|
| 302 |
alert("Payment is not add.");
|
325 |
alert("Payment is not add.");
|
| 303 |
|
- |
|
| 304 |
}
|
326 |
}
|
| 305 |
|
- |
|
| 306 |
});
|
327 |
});
|
| 307 |
|
328 |
|
| 308 |
$(document).on('click', ".generateLoi", function () {
|
329 |
$(document).on('click', ".generateLoi", function () {
|
| 309 |
let loiId = $(this).val();
|
330 |
let loiId = $(this).val();
|
| 310 |
doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
|
331 |
doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
|
| Line 410... |
Line 431... |
| 410 |
doGetAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
|
431 |
doGetAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
|
| 411 |
function (response) {
|
432 |
function (response) {
|
| 412 |
$('#' + 'main-content').html(response);
|
433 |
$('#' + 'main-content').html(response);
|
| 413 |
});
|
434 |
});
|
| 414 |
});
|
435 |
});
|
| 415 |
$(document).on('input', 'table#OnboardingDocumentTable input[type=file]', function () {
|
- |
|
| 416 |
if (confirm('Confirm file upload ?')) {
|
- |
|
| 417 |
var fileSelector = $(this)[0];
|
- |
|
| 418 |
if (fileSelector != undefined
|
- |
|
| 419 |
&& fileSelector.files[0] != undefined) {
|
- |
|
| 420 |
var file = this.files[0];
|
- |
|
| 421 |
let fileInput = $(this);
|
- |
|
| 422 |
uploadDocument(file, function (documentId) {
|
- |
|
| 423 |
fileInput.closest('td').find(".documentId").val(documentId);
|
- |
|
| 424 |
});
|
- |
|
| 425 |
}
|
- |
|
| 426 |
}
|
- |
|
| 427 |
});
|
- |
|
| 428 |
|
- |
|
| 429 |
$(document).on('input', 'table#OnboardingDocumentTable input[type=file],table#mk_brand-fee-collection-details input[type=file]', function () {
|
436 |
$(document).on('input', 'table#OnboardingDocumentTable input[type=file],table#mk_brand-fee-collection-details input[type=file]', function () {
|
| 430 |
if (confirm('Confirm file upload ?')) {
|
437 |
if (confirm('Confirm file upload ?')) {
|
| 431 |
var fileSelector = $(this)[0];
|
438 |
var fileSelector = $(this)[0];
|
| 432 |
if (fileSelector != undefined
|
439 |
if (fileSelector != undefined
|
| 433 |
&& fileSelector.files[0] != undefined) {
|
440 |
&& fileSelector.files[0] != undefined) {
|