Subversion Repositories SmartDukaan

Rev

Rev 33507 | Rev 33577 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(document).on('click', ".onboarding-form1", function () {
    doGetAjaxRequestHandler(`${context}/onboardingForm`,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', ".submitOnboardingForm", function () {
    if (confirm("Are you sure to submit form ?")) {
        let formData = objectifyForm($("form[name='Loi_Form']").serializeArray());
        for (var key in formData) {
            if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
                alert("The (" + key + ") value is blank please fill this field !");
                return false;
            }
        }
        let jsonData = JSON.stringify(formData);
        doPostAjaxRequestWithJsonHandler(`${context}/submitOnboardingForm`, jsonData, function (response) {
            if (response) {
                alert("Your LOI form Submitted successfully ");
                pendingLoiForm("main-content");

            } else {
                alert("Your LOI form not Submitted , try again ");
                doGetAjaxRequestHandler(`${context}/onboardingForm`,
                    function (response) {
                        $('#' + 'main-content').html(response);
                    });
            }
        });
    } else {
        //nothing to do now
    }

});
$(document).on('click', ".updateOnboardingForm", function () {
    let loiId = $(this).val();
    console.log("form id - ", loiId);
    doGetAjaxRequestHandler(context + "/updateOnboardingForm?loiId=" + loiId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', ".updateOnboardingFormData", function () {
    let loiId = $(this).val();
    let formData = {};
    let jsonData = JSON.stringify(objectifyForm($("form[name='Loi_Form']").serializeArray())).trim();
    doPostAjaxRequestWithJsonHandler(`${context}/updateOnboardingFormData?loiId=` + loiId, jsonData, function (response) {
        if (response) {
            alert("LOI Form Updated Successfully..");
        }
        pendingLoiForm("main-content");
    });

});

$(document).on('click', ".pending-onboarding-form", function () {
    doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});
$(document).on('click', "#addBrandFeePayment", function () {
    let formData = objectifyForm($("form[name='brandFeeCollectionForm']").serializeArray());
    let loiId = $(this).val();
    console.log("form id -", loiId);
    for (var key in formData) {
        if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
            alert("The (" + key + ") value is blank please fill this field !");
            return false;
        }
    }
    let jsonData = JSON.stringify(formData);
    if (confirm("Are you sure all payment details are correct ? once payment is add ,you can't able to change details.")) {
        doPostAjaxRequestWithJsonHandler(`${context}/brandfeeCollection?loiId=` + loiId, jsonData, function (response) {
            console.log("brand collection...");
            if (response) {
                alert("Payment add successfully...");
                pendingLoiForm("main-content");

            } else {
                //console
            }
        });
    } else {
        //Do nothing
    }

});

$(document).on('click', ".generateLoi", function () {
    let loiId = $(this).val();
    console.log("form id - ", loiId);
    doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', "#LOI_otp", function () {
    let loiId = $(this).val();
    console.log("loiId-", loiId);
    doPostAjaxRequestHandler(`${context}/loiAcceptanceOtp?loiId=` + loiId,
        function (response) {
            alert(response);
            doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
                function (response) {
                    $('#' + 'main-content').html(response);
                });
        });
});


$(document).on('click', ".onboardingFormDone", function () {
    let loiId = $(this).val();
    var loi = $(document).find(".upload-form-loi input[type=file]").val();
    console.log("form id - ", loiId);
    doPostAjaxRequestHandler(`${context}/uploadLoi?loiId=${loiId}&loi=${loi}`,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

//confirmPayment
$(document).on('click', ".paymentConfirmBtn", function () {
    let approval = $(this).data('approval');
    let bfcId = $(this).val();
    let description = "All details are correct";
    if (confirm("Are you sure to confirm this payment ?")) {
        doPutAjaxRequestHandler(`${context}/feePaymentApproval?bfcId=${bfcId}&feePaymentStatus=${approval}&description=${description}`,
            function (response) {
                if (response) {
                    alert("Payment is confirm successfully");
                }
                pendingLoiForm("main-content");
            });
    } else {
        //do nothing
    }
});

$(document).on('click', ".paymentRejectBtn", function () {
    let approval = $(this).data('approval');
    let bfcId = $(this).val();
    let description;
    description = prompt("Reason for rejection..");
    if (description !== null) {
        if (confirm("Are you sure to Reject this payment ?")) {
            doPutAjaxRequestHandler(`${context}/feePaymentApproval?bfcId=${bfcId}&feePaymentStatus=${approval}&description=${description}`,
                function (response) {
                    if (!response) {
                        alert("Payment is rejected successfully");
                    }
                    pendingLoiForm("main-content");
                });
        } else {
            //do nothing
        }
    } else {
        alert("Please mention the reason as description and try again");
    }
});
$(document).on('click', ".upload-document-form", function () {
    let loiId = $(this).val();
    doPutAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});
$(document).on('input', 'table#OnboardingDocumentTable input[type=file]', function () {
    if (confirm('Confirm file upload ?')) {
        var fileSelector = $(this)[0];
        if (fileSelector != undefined
            && fileSelector.files[0] != undefined) {
            var file = this.files[0];
            console.log("file", file);
            let fileInput = $(this);
            console.log("fileInput", file);
            uploadDocument(file, function (documentId) {
                console.log("documentIdzzz  : ", documentId);
                fileInput.closest('td').find(".documentId").val(documentId);
            });
        }
    }
});
$(document).on('click', ".mk_docApproval", function () {
    let loiId = $(this).data('form_id');
    let docMasterId = $(this).data('doc_master_id');
    let flag = $(this).data('flag');
    console.log("flag -", flag);
    doPutAjaxRequestHandler(`${context}/documentVerify?loiId=${loiId}&docMasterId=${docMasterId}&flag=${flag}`,
        function (response) {
            alert(response);
            doPutAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
                function (response) {
                    $('#' + 'main-content').html(response);
                });

        });
});
$(document).on('click', "#uploadDocumentbtn1", function () {
    if (confirm("Are you sure to upload all documents ?")) {
        var loiId = $(this).val();
        var loiDocModels = [];
        console.log("loiId -", loiId);
        $("#OnboardingDocumentTable > tbody > tr").each(function (rowIndex) {
            var marsterId = $(this).find(".masterId").val();
            var docId = $(this).find(".documentId").val();
            var docName = $(this).find(".documentName").val();
            console.log("marsterId -", marsterId);
            var loiDocModel = {
                documentId: docId,
                documentName: docName,
                documentMasterId: marsterId
            };
            loiDocModels.push(loiDocModel);
        });
        console.log(loiDocModels);
        var loiDocModelData = JSON.stringify(loiDocModels);
        doPostAjaxRequestWithJsonHandler(`${context}/uploadOnboardingDocument?loiId=${loiId}`, loiDocModelData, function (response) {
            console.log('response-', response);
            pendingLoiForm("main-content");
        });
    } else {
        //Nothing to do
    }


});
$(document).on('click', ".documnet-verifed", function () {
    let loiId = $(this).val();
    if (confirm("Are you sure to verify All document ?")) {
        doPutAjaxRequestHandler(`${context}/documentApproved?loiId=${loiId}`,
            function (response) {
                alert(response);
                pendingLoiForm("main-content");
            });
    } else {
        console.log(" All docs not verify");
        //Nothing
    }
});
$(document).on('click', ".loiFormComplete", function () {
    let loiId = $(this).val();
    if (confirm("Are you sure all things are done ?")) {
        doPutAjaxRequestHandler(`${context}/loiFormComplete?loiId=${loiId}`,
            function (response) {
                alert(response);
            });
        pendingLoiForm("main-content");

    } else {
        console.log("Loi form not completed !");
        //Nothing
    }
});
$(document).on('click', ".deleteLoiForm", function () {
    let loiId = $(this).val();
    if (confirm("Are you sure to delete ?")) {
        doPutAjaxRequestHandler(`${context}/deleteLoiForm?loiId=${loiId}`,
            function (response) {
                if (response) {
                    alert("Loi form deleted ");
                } else {
                    //nothing to do
                }
            });
        doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
            function (response) {
                $('#' + 'main-content').html(response);
            });

    } else {
        console.log("");
        //Nothing
    }
});

$(document).on('click', ".CompletedLoiForm", function () {
    doPutAjaxRequestHandler(`${context}/completedLoiForms`,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', "#createNewOnboardingPanel", function () {
    let loiId = $(this).val();
    let authId = $(this).closest('tr').find('.authId').val();
    if (authId != " ") {

        doPutAjaxRequestHandler(`${context}/createNewOnboardingPanel?loiId=${loiId}&authId=${authId}`,
            function (response) {
                if (response) {
                    doPutAjaxRequestHandler(`${context}/completedLoiForms`,
                        function (response) {
                            $('#' + 'main-content').html(response);
                        });
                } else {
                    //nothing
                }

            });
    } else {
        alert("Please choose RBM ");
    }

});

function pendingLoiForm(domId) {
    doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
        function (response) {
            $('#' + domId).html(response);
        });
}