Subversion Repositories SmartDukaan

Rev

Rev 34107 | Rev 34739 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34107 Rev 34310
Line 6... Line 6...
6
});
6
});
7
 
7
 
8
 
8
 
9
$(document).on('change', "#maritalStatus", function () {
9
$(document).on('change', "#maritalStatus", function () {
10
    let maritalStatus = $(this).val();
10
    let maritalStatus = $(this).val();
11
    console.log("maritalStatus - " + maritalStatus);
-
 
12
    if (maritalStatus == 1) {
11
    if (maritalStatus == 1) {
13
        $(".loiAnniversaryDate").removeClass('hide-model');
12
        $(".loiAnniversaryDate").removeClass('hide-model');
14
        $(".loiAnniversaryDate").addClass('show-model');
13
        $(".loiAnniversaryDate").addClass('show-model');
15
    } else {
14
    } else {
16
        $(".loiAnniversaryDate").removeClass('show-model');
15
        $(".loiAnniversaryDate").removeClass('show-model');
Line 23... Line 22...
23
$(document).on('click', ".mk_submit_loi_form", function () {
22
$(document).on('click', ".mk_submit_loi_form", function () {
24
    // Gather input values
23
    // Gather input values
25
    const referId = $('select[name="referId"]').val();
24
    const referId = $('select[name="referId"]').val();
26
    const stateHead = $('select[name="stateHead"]').val();
25
    const stateHead = $('select[name="stateHead"]').val();
27
    const bdm = $('select[name="bdm"]').val();
26
    const bdm = $('select[name="bdm"]').val();
28
    const billingAddress = $('select[name="billingAddress"]').val();
27
    let billingAddress = $('select[name="billingAddress"]').val();
-
 
28
    if(!billingAddress){
-
 
29
        const addrFieldData = {
-
 
30
            "bno": "",
-
 
31
            "bnm": "",
-
 
32
            "st": "",
-
 
33
            "locality": "",
-
 
34
            "loc": "",
-
 
35
            "dst": "",
-
 
36
            "pncd": "",
-
 
37
            "stcd": ""
-
 
38
        };
-
 
39
 
-
 
40
        // Dynamically create input fields
-
 
41
        let address = [];
-
 
42
        Object.keys(addrFieldData).forEach(function (field) {
-
 
43
             addrFieldData[field] = $('input[name="'+field+'"]').val();
-
 
44
        });
-
 
45
        billingAddress = JSON.stringify(addrFieldData);
-
 
46
 
-
 
47
    }
29
    const acquiredDate = $('input[name="acquiredDate"]').val();
48
    const acquiredDate = $('input[name="acquiredDate"]').val();
30
    const firstName = $('input[name="firstName"]').val();
49
    const firstName = $('input[name="firstName"]').val();
31
    const lastName = $('input[name="lastName"]').val();
50
    const lastName = $('input[name="lastName"]').val();
32
    const mobile = $('input[name="mobile"]').val();
51
    const mobile = $('input[name="mobile"]').val();
33
 
52
 
Line 80... Line 99...
80
                value: commitmentValue
99
                value: commitmentValue
81
            });
100
            });
82
        }
101
        }
83
    });
102
    });
84
    let totalCommitment = brandCommitment.reduce((total, commitment) => total + commitment.value, 0);
103
    let totalCommitment = brandCommitment.reduce((total, commitment) => total + commitment.value, 0);
85
    console.log("Total Commitment Amount:", totalCommitment);
-
 
86
    const lessCommitReason = $('input[name="lessCommitReason"]').val();
104
    const lessCommitReason = $('input[name="lessCommitReason"]').val();
87
    let minCommit = totalCommitment >= storePotential * (70 / 100);
105
    let minCommit = totalCommitment >= storePotential * (70 / 100);
88
    const agreedBrandFees = $('select[name="agreedBrandFees"]').val();
106
    const agreedBrandFees = $('select[name="agreedBrandFees"]').val();
89
    console.log("agreedBrandFees - ", agreedBrandFees);
-
 
90
    const values = agreedBrandFees.split(/[-]/); // Split the string
107
    const values = agreedBrandFees.split(/[-]/); // Split the string
91
    const brandFee = parseFloat(values[1]);
108
    const brandFee = parseFloat(values[1]);
92
    const brandFeesCollected = $('input[name="brandFeesCollected"]').val();
109
    const brandFeesCollected = $('input[name="brandFeesCollected"]').val();
93
    const paymentMode = $('select[name="paymentMode"]').val();
110
    const paymentMode = $('select[name="paymentMode"]').val();
94
    const paymentReferenceNo = $('input[name="paymentReferenceNo"]').val();
111
    const paymentReferenceNo = $('input[name="paymentReferenceNo"]').val();
Line 174... Line 191...
174
        paymentAttachment: paymentAttachment,
191
        paymentAttachment: paymentAttachment,
175
        billingAddress: billingAddress,
192
        billingAddress: billingAddress,
176
        brandCommitment: brandCommitment
193
        brandCommitment: brandCommitment
177
    };
194
    };
178
 
195
 
179
    console.log("form data - ", loiFormData);
-
 
180
    if (confirm("Are you sure to submit the form ?")) {
196
    if (confirm("Are you sure to submit the form ?")) {
181
        doPostAjaxRequestWithJsonHandler(`${context}/submitLoiForm`, JSON.stringify(loiFormData), function (response) {
197
        doPostAjaxRequestWithJsonHandler(`${context}/submitLoiForm`, JSON.stringify(loiFormData), function (response) {
182
            console.log('responsee', response);
198
            console.log('responsee', response);
183
            if (response) {
199
            if (response) {
184
                alert("Your LOI form Submitted successfully ");
200
                alert("Your LOI form Submitted successfully ");
Line 195... Line 211...
195
    }
211
    }
196
});
212
});
197
 
213
 
198
$(document).on('click', ".updateLoiForm", function () {
214
$(document).on('click', ".updateLoiForm", function () {
199
    let loiId = $(this).val();
215
    let loiId = $(this).val();
200
    console.log("form id - ", loiId);
-
 
201
    doGetAjaxRequestHandler(context + "/updateLoiForm?loiId=" + loiId,
216
    doGetAjaxRequestHandler(context + "/updateLoiForm?loiId=" + loiId,
202
        function (response) {
217
        function (response) {
203
            $('#' + 'main-content').html(response);
218
            $('#' + 'main-content').html(response);
204
        });
219
        });
205
});
220
});
Line 207... Line 222...
207
$(document).on('click', ".save_agree_brand_fee", function () {
222
$(document).on('click', ".save_agree_brand_fee", function () {
208
    let loiId = $(this).val();
223
    let loiId = $(this).val();
209
    var $tr = $(this).closest('tr');
224
    var $tr = $(this).closest('tr');
210
    var agreedBrandFee = $tr.find('input[name="brandFee"]').val();
225
    var agreedBrandFee = $tr.find('input[name="brandFee"]').val();
211
    var brandType = $tr.find('select[name="brandType"]').val();
226
    var brandType = $tr.find('select[name="brandType"]').val();
212
    console.log('brandType ', brandType);
-
 
213
    if (confirm("Are you sure to change Agreed brand fee")) {
227
    if (confirm("Are you sure to change Agreed brand fee")) {
214
        doPutAjaxRequestHandler(`${context}/updateAgreedBrandFee?loiId=${loiId}&brandFee=${agreedBrandFee}&storeType=${brandType}`, function (response) {
228
        doPutAjaxRequestHandler(`${context}/updateAgreedBrandFee?loiId=${loiId}&brandFee=${agreedBrandFee}&storeType=${brandType}`, function (response) {
215
            pendingLoiForm("main-content");
229
            pendingLoiForm("main-content");
216
        });
230
        });
217
    } else {
231
    } else {
218
        pendingLoiForm("main-content");
232
        pendingLoiForm("main-content");
219
    }
233
    }
220
});
234
});
221
 
235
 
222
$(document).on('click', ".updateLoiFormDataButton", function () {
236
$(document).on('click', ".updateLoiFormDataButton", function () {
223
    console.log("updateLoiFormDataButton clicked..");
-
 
224
    let loiId = $(this).data('loiid');
237
    let loiId = $(this).data('loiid');
225
    const firstName = $('input[name="firstName"]').val();
238
    const firstName = $('input[name="firstName"]').val();
226
    const lastName = $('input[name="lastName"]').val();
239
    const lastName = $('input[name="lastName"]').val();
227
    const mobile = $('input[name="mobile"]').val();
240
    const mobile = $('input[name="mobile"]').val();
228
    const email = $('input[name="email"]').val();
241
    const email = $('input[name="email"]').val();
Line 252... Line 265...
252
        landline: landline,
265
        landline: landline,
253
        dob: dob,
266
        dob: dob,
254
        panNo: panNo,
267
        panNo: panNo,
255
        adharNo: adharNo
268
        adharNo: adharNo
256
    };
269
    };
257
    console.log("loiFormData - ", loiFormData);
-
 
258
    alert("you want update ..");
270
    alert("you want update ..");
259
    doPostAjaxRequestWithJsonHandler(`${context}/updateLoiFormData?loiId=${loiId}`, JSON.stringify(loiFormData), function (response) {
271
    doPostAjaxRequestWithJsonHandler(`${context}/updateLoiFormData?loiId=${loiId}`, JSON.stringify(loiFormData), function (response) {
260
        pendingLoiForm("main-content");
272
        pendingLoiForm("main-content");
261
    });
273
    });
262
 
274
 
Line 269... Line 281...
269
        });
281
        });
270
});
282
});
271
$(document).on('click', "#addBrandFeePayment", function () {
283
$(document).on('click', "#addBrandFeePayment", function () {
272
    let formData = objectifyForm($("form[name='brandFeeCollectionForm']").serializeArray());
284
    let formData = objectifyForm($("form[name='brandFeeCollectionForm']").serializeArray());
273
    let loiId = $(this).val();
285
    let loiId = $(this).val();
274
    console.log("form id -", loiId);
-
 
275
    for (var key in formData) {
286
    for (var key in formData) {
276
        if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
287
        if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
277
            alert("The (" + key + ") value is blank please fill this field !");
288
            alert("The (" + key + ") value is blank please fill this field !");
278
            return false;
289
            return false;
279
        }
290
        }
Line 294... Line 305...
294
 
305
 
295
});
306
});
296
 
307
 
297
$(document).on('click', ".generateLoi", function () {
308
$(document).on('click', ".generateLoi", function () {
298
    let loiId = $(this).val();
309
    let loiId = $(this).val();
299
    console.log("form id - ", loiId);
-
 
300
    doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
310
    doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
301
        function (response) {
311
        function (response) {
302
            $('#' + 'main-content').html(response);
312
            $('#' + 'main-content').html(response);
303
        });
313
        });
304
});
314
});
Line 314... Line 324...
314
 
324
 
315
$(document).on('click', ".mk-approve-loi", function () {
325
$(document).on('click', ".mk-approve-loi", function () {
316
    let loiId = $(this).val();
326
    let loiId = $(this).val();
317
    let companyName = $(this).data('company');
327
    let companyName = $(this).data('company');
318
    let flag = $(this).data('flag');
328
    let flag = $(this).data('flag');
319
    console.log("form id - ", loiId);
-
 
320
    if (flag === 1) {
329
    if (flag === 1) {
321
        if (confirm(`Are you sure Approve Loi of  ${companyName} `)) {
330
        if (confirm(`Are you sure Approve Loi of  ${companyName} `)) {
322
            console.log("Approval");
-
 
323
            doPutAjaxRequestHandler(`${context}/approve-reject-Loi?loiId=${loiId}&flag=${true}`,
331
            doPutAjaxRequestHandler(`${context}/approve-reject-Loi?loiId=${loiId}&flag=${true}`,
324
                function (response) {
332
                function (response) {
325
                    alert("Loi Approved successfully");
333
                    alert("Loi Approved successfully");
326
                    pendingLoiForm("main-content");
334
                    pendingLoiForm("main-content");
327
                });
335
                });
328
        }
336
        }
329
    } else {
337
    } else {
330
        if (confirm(`Are you sure to Reject "${companyName}" LOI`)) {
338
        if (confirm(`Are you sure to Reject "${companyName}" LOI`)) {
331
            console.log("reject");
-
 
332
            doPutAjaxRequestHandler(`${context}/approve-reject-Loi?loiId=${loiId}&flag=${false}`,
339
            doPutAjaxRequestHandler(`${context}/approve-reject-Loi?loiId=${loiId}&flag=${false}`,
333
                function (response) {
340
                function (response) {
334
                    pendingLoiForm("main-content");
341
                    pendingLoiForm("main-content");
335
                });
342
                });
336
        }
343
        }
337
    }
344
    }
338
});
345
});
339
 
346
 
340
$(document).on('click', "#LOI_otp", function () {
347
$(document).on('click', "#LOI_otp", function () {
341
    let loiId = $(this).val();
348
    let loiId = $(this).val();
342
    console.log("loiId-", loiId);
-
 
343
    if (confirm("Are you sure to send OTP ?")) {
349
    if (confirm("Are you sure to send OTP ?")) {
344
        doPostAjaxRequestHandler(`${context}/loiAcceptanceOtp?loiId=` + loiId,
350
        doPostAjaxRequestHandler(`${context}/loiAcceptanceOtp?loiId=` + loiId,
345
            function (response) {
351
            function (response) {
346
                alert(response);
352
                alert(response);
347
                doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
353
                doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
Line 397... Line 403...
397
    if (confirm('Confirm file upload ?')) {
403
    if (confirm('Confirm file upload ?')) {
398
        var fileSelector = $(this)[0];
404
        var fileSelector = $(this)[0];
399
        if (fileSelector != undefined
405
        if (fileSelector != undefined
400
            && fileSelector.files[0] != undefined) {
406
            && fileSelector.files[0] != undefined) {
401
            var file = this.files[0];
407
            var file = this.files[0];
402
            console.log("file", file);
-
 
403
            let fileInput = $(this);
408
            let fileInput = $(this);
404
            console.log("fileInput", file);
-
 
405
            uploadDocument(file, function (documentId) {
409
            uploadDocument(file, function (documentId) {
406
                console.log("documentIdzzz  : ", documentId);
-
 
407
                fileInput.closest('td').find(".documentId").val(documentId);
410
                fileInput.closest('td').find(".documentId").val(documentId);
408
            });
411
            });
409
        }
412
        }
410
    }
413
    }
411
});
414
});
Line 414... Line 417...
414
    if (confirm('Confirm file upload ?')) {
417
    if (confirm('Confirm file upload ?')) {
415
        var fileSelector = $(this)[0];
418
        var fileSelector = $(this)[0];
416
        if (fileSelector != undefined
419
        if (fileSelector != undefined
417
            && fileSelector.files[0] != undefined) {
420
            && fileSelector.files[0] != undefined) {
418
            var file = this.files[0];
421
            var file = this.files[0];
419
            console.log("file", file);
-
 
420
            let fileInput = $(this);
422
            let fileInput = $(this);
421
            console.log("fileInput", file);
-
 
422
            uploadDocument(file, function (documentId) {
423
            uploadDocument(file, function (documentId) {
423
                console.log("documentIdzzz  : ", documentId);
-
 
424
                fileInput.closest('td').find(".documentId").val(documentId);
424
                fileInput.closest('td').find(".documentId").val(documentId);
425
            });
425
            });
426
        }
426
        }
427
    }
427
    }
428
});
428
});
Line 439... Line 439...
439
 
439
 
440
$(document).on('click', ".mk_docApproval", function () {
440
$(document).on('click', ".mk_docApproval", function () {
441
    let loiId = $(this).data('form_id');
441
    let loiId = $(this).data('form_id');
442
    let docMasterId = $(this).data('doc_master_id');
442
    let docMasterId = $(this).data('doc_master_id');
443
    let flag = $(this).data('flag');
443
    let flag = $(this).data('flag');
444
    console.log("flag -", flag);
-
 
445
    doPutAjaxRequestHandler(`${context}/documentVerify?loiId=${loiId}&docMasterId=${docMasterId}&flag=${flag}`,
444
    doPutAjaxRequestHandler(`${context}/documentVerify?loiId=${loiId}&docMasterId=${docMasterId}&flag=${flag}`,
446
        function (response) {
445
        function (response) {
447
            alert(response);
446
            alert(response);
448
            doGetAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
447
            doGetAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
449
                function (response) {
448
                function (response) {
Line 454... Line 453...
454
});
453
});
455
$(document).on('click', "#uploadDocumentbtn1", function () {
454
$(document).on('click', "#uploadDocumentbtn1", function () {
456
    if (confirm("Are you sure to upload all documents ?")) {
455
    if (confirm("Are you sure to upload all documents ?")) {
457
        var loiId = $(this).val();
456
        var loiId = $(this).val();
458
        var loiDocModels = [];
457
        var loiDocModels = [];
459
        console.log("loiId -", loiId);
-
 
460
        $("#OnboardingDocumentTable > tbody > tr").each(function (rowIndex) {
458
        $("#OnboardingDocumentTable > tbody > tr").each(function (rowIndex) {
461
            var marsterId = $(this).find(".masterId").val();
459
            var marsterId = $(this).find(".masterId").val();
462
            var docId = $(this).find(".documentId").val();
460
            var docId = $(this).find(".documentId").val();
463
            var docName = $(this).find(".documentName").val();
461
            var docName = $(this).find(".documentName").val();
464
            console.log("marsterId -", marsterId);
-
 
465
            var loiDocModel = {
462
            var loiDocModel = {
466
                documentId: docId,
463
                documentId: docId,
467
                documentName: docName,
464
                documentName: docName,
468
                documentMasterId: marsterId
465
                documentMasterId: marsterId
469
            };
466
            };
470
            loiDocModels.push(loiDocModel);
467
            loiDocModels.push(loiDocModel);
471
        });
468
        });
472
        console.log(loiDocModels);
-
 
473
        var loiDocModelData = JSON.stringify(loiDocModels);
469
        var loiDocModelData = JSON.stringify(loiDocModels);
474
        doPostAjaxRequestWithJsonHandler(`${context}/uploadOnboardingDocument?loiId=${loiId}`, loiDocModelData, function (response) {
470
        doPostAjaxRequestWithJsonHandler(`${context}/uploadOnboardingDocument?loiId=${loiId}`, loiDocModelData, function (response) {
475
            console.log('response-', response);
-
 
476
            pendingLoiForm("main-content");
471
            pendingLoiForm("main-content");
477
        });
472
        });
478
    } else {
473
    } else {
479
        //Nothing to do
474
        //Nothing to do
480
    }
475
    }
Line 522... Line 517...
522
    if (!to) missingFields.push('To date');
517
    if (!to) missingFields.push('To date');
523
    if (missingFields.length > 0) {
518
    if (missingFields.length > 0) {
524
        alert('Please select : ' + missingFields.join(','));
519
        alert('Please select : ' + missingFields.join(','));
525
        return;
520
        return;
526
    }
521
    }
527
    console.log("From - ", from)
-
 
528
    console.log("To - ", to)
-
 
529
 
-
 
530
    window.location.href = `${context}/downloadLoiFromReport?from=${from}&to=${to}`;
522
    window.location.href = `${context}/downloadLoiFromReport?from=${from}&to=${to}`;
531
});
523
});
532
$(document).on('click', ".brandFeePaymentEdit", function () {
524
$(document).on('click', ".brandFeePaymentEdit", function () {
533
    var bfcId = $(this).val();
525
    var bfcId = $(this).val();
534
    console.log("bfcId - ", bfcId);
-
 
-
 
526
 
535
    // Get the table row
527
    // Get the table row
536
    var $row = $(this).closest('tr');
528
    var $row = $(this).closest('tr');
537
    console.log("row - ", $row);
-
 
538
    var feeCollectingTimeStamp = $row.find('input[name="feeCollectingTimeStamp"]').val();
529
    var feeCollectingTimeStamp = $row.find('input[name="feeCollectingTimeStamp"]').val();
539
    var collectedAmount = $row.find('input[name="collectedAmount"]').val();
530
    var collectedAmount = $row.find('input[name="collectedAmount"]').val();
540
    var paymentReferenceNo = $row.find('input[name="paymentReferenceNo"]').val();
531
    var paymentReferenceNo = $row.find('input[name="paymentReferenceNo"]').val();
541
    var paymentMode = $row.find('select[name="paymentMode"]').val();
532
    var paymentMode = $row.find('select[name="paymentMode"]').val();
542
    var documentId = $row.find('input[name="documentId"]').val();
533
    var documentId = $row.find('input[name="documentId"]').val();
Line 586... Line 577...
586
 
577
 
587
$(document).on('click', "#confirmSign", function () {
578
$(document).on('click', "#confirmSign", function () {
588
    let loiId = $(this).val();
579
    let loiId = $(this).val();
589
    // let otp = validateOTP();
580
    // let otp = validateOTP();
590
    let otp = prompt("Enter received OTP here");
581
    let otp = prompt("Enter received OTP here");
591
    console.log("loiId-", loiId, ",otp-", otp);
-
 
592
    let validateOtpUrl = `${context}/validateLoiOtp?loiId=${loiId}&provideOtp=${otp}`;
582
    let validateOtpUrl = `${context}/validateLoiOtp?loiId=${loiId}&provideOtp=${otp}`;
593
    if (otp != undefined || otp != null) {
583
    if (otp != undefined || otp != null) {
594
 
584
 
595
        doPutAjaxRequestHandler(validateOtpUrl, function (response) {
585
        doPutAjaxRequestHandler(validateOtpUrl, function (response) {
596
            if (response) {
586
            if (response) {
597
                const element = document.getElementById('loiPDF_content');
587
                const element = document.getElementById('loiPDF_content');
598
                console.log("element- ", element);
-
 
599
                const opt = {
588
                const opt = {
600
                    margin: 0.5,
589
                    margin: 0.5,
601
                    filename: 'document.pdf',
590
                    filename: 'document.pdf',
602
                    image: {type: 'jpeg', quality: 0.98},
591
                    image: {type: 'jpeg', quality: 0.98},
603
                    html2canvas: {scale: 2, logging: true, useCORS: true},
592
                    html2canvas: {scale: 2, logging: true, useCORS: true},
604
                    jsPDF: {unit: 'in', format: 'letter', orientation: 'portrait'}
593
                    jsPDF: {unit: 'in', format: 'letter', orientation: 'portrait'}
605
                };
594
                };
606
                html2pdf().from(element).set(opt).outputPdf("arraybuffer").then(function (pdf) {
595
                html2pdf().from(element).set(opt).outputPdf("arraybuffer").then(function (pdf) {
607
                    console.log("pdf- ", pdf);
-
 
608
                    const file = new Blob([pdf], {type: 'application/pdf'});
596
                    const file = new Blob([pdf], {type: 'application/pdf'});
609
                    uploadDocument(file, function (documentId) {
597
                    uploadDocument(file, function (documentId) {
610
                        console.log("documentIdddd-", documentId);
-
 
611
                        IdempotencyKey = uuidv4();
598
                        IdempotencyKey = uuidv4();
612
                        if (documentId > 0) {
599
                        if (documentId > 0) {
613
                            saveLoiDoc(loiId, documentId);
600
                            saveLoiDoc(loiId, documentId);
614
                        } else {
601
                        } else {
615
                            alert("Something went wrong , please again to confirm otp")
602
                            alert("Something went wrong , please again to confirm otp")
Line 617... Line 604...
617
                    });
604
                    });
618
                });
605
                });
619
            }
606
            }
620
        });
607
        });
621
    } else {
608
    } else {
622
        return false
609
        return false;
623
    }
610
    }
624
});
611
});
625
 
612
 
626
 
613
 
627
function saveLoiDoc(loiId, documentId) {
614
function saveLoiDoc(loiId, documentId) {