Rev 33617 | Rev 33658 | 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('change', "#maritalStatus", function () {let maritalStatus = $(this).val();console.log("maritalStatus - " + maritalStatus);if (maritalStatus == 1) {$(".loiAnniversaryDate").removeClass('hide-model');$(".loiAnniversaryDate").addClass('show-model');} else {$(".loiAnniversaryDate").removeClass('show-model');$(".loiAnniversaryDate").addClass('hide-model');}});$(document).on('click', ".submitLoiForm", function () {// Gather input valuesconst referId = $('select[name="referId"]').val();const billingAddress = $('select[name="billingAddress"]').val();const acquiredDate = $('input[name="acquiredDate"]').val();const firstName = $('input[name="firstName"]').val();const lastName = $('input[name="lastName"]').val();const mobile = $('input[name="mobile"]').val();const email = $('input[name="email"]').val();const landline = $('input[name="landline"]').val();const dob = $('input[name="dob"]').val();var today = new Date();var birthDate = new Date(dob);var age = today.getFullYear() - birthDate.getFullYear();var monthDiff = today.getMonth() - birthDate.getMonth();if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {age--;}var maritalStatus = $('select[name="maritalStatus"]').val();const anniversaryDate = $('input[name="anniversaryDate"]').val();const panNo = $('input[name="panNo"]').val();const adharNo = $('input[name="adharNo"]').val();const gstNo = $('input[name="gstNo"]').val();const bankName = $('input[name="bankName"]').val();const ifscCode = $('input[name="ifscCode"]').val();const accountNo = $('input[name="accountNo"]').val();const businessType = $('select[name="businessType"]').val();const companyName = $('input[name="companyName"]').val();const gstPin = $('input[name="gstPin"]').val();const gstState = $('input[name="gstState"]').val();const gstCity = $('input[name="gstCity"]').val();const gstDistrict = $('input[name="gstDistrict"]').val();const agreeWalletValue = $('select[name="agreeWalletValue"]').val();const storeArea = $('input[name="storeArea"]').val();const storePotential = $('input[name="storePotential"]').val();const lessCommitReason = $('input[name="lessCommitReason"]').val();const vivoCommitmentAmount = $('input[name="vivoCommitmentAmount"]').val();const oppoCommitmentAmount = $('input[name="oppoCommitmentAmount"]').val();const samsungCommitmentAmount = $('input[name="samsungCommitmentAmount"]').val();const xiaomiCommitmentAmount = $('input[name="xiaomiCommitmentAmount"]').val();const accessoriesCommitmentAmount = $('input[name="accessoriesCommitmentAmount"]').val();const otherBrandsCommitmentAmount = $('input[name="otherBrandsCommitmentAmount"]').val();const totalCommit = $('input[name="totaCommitmentAmount"]').val();let minCommint = totalCommit >= storePotential * (70 / 100);const agreedBrandFees = $('select[name="agreedBrandFees"]').val();console.log("agreedBrandFees - ", agreedBrandFees);const values = agreedBrandFees.split(/[-]/); // Split the stringconst brandFee = parseFloat(values[1]);const brandFeesCollected = $('input[name="brandFeesCollected"]').val();const paymentMode = $('select[name="paymentMode"]').val();const paymentReferenceNo = $('input[name="paymentReferenceNo"]').val();const feeCollectingDate = $('input[name="feeCollectingDate"]').val();let missingFields = [];if (!firstName) missingFields.push('First Name');if (!lastName) missingFields.push('Last Name');if (mobile.length < 10 || !mobile) {missingFields.push('Mobile number should be 10 digit');}if (!minCommint) {if (!lessCommitReason) missingFields.push('Less Commit Reason');}if (!maritalStatus) missingFields.push('Marital Status');if (maritalStatus == 1) {if (!anniversaryDate) missingFields.push('Anniversary Date');}if (!email) missingFields.push('Email');if (!acquiredDate) missingFields.push('Acquired date');if (!dob) missingFields.push('dob(Date of Birth)');if (age <= 18) missingFields.push('You must be at least 18 years old to Fill LOI FORM. ');if (!panNo) missingFields.push('Pan Number');if (!adharNo) missingFields.push('Aadhar Number');if (!gstNo) missingFields.push('GST Number');if (!bankName) missingFields.push('Bank Name');if (!ifscCode) missingFields.push('IFSC code');if (!accountNo) missingFields.push('Account Number');if (!businessType) missingFields.push('businessType');if (!companyName) missingFields.push('Company Name');if (!agreeWalletValue) missingFields.push('Agree Wallet Value');if (!storeArea) missingFields.push('storeArea');if (!storePotential) missingFields.push('Store Potential');if (!oppoCommitmentAmount) missingFields.push('Oppo Commitment');if (!vivoCommitmentAmount) missingFields.push('Vivo Commitment');if (!samsungCommitmentAmount) missingFields.push('Samsung Commitment');if (!xiaomiCommitmentAmount) missingFields.push('Xiaomi Commitment');if (!accessoriesCommitmentAmount) missingFields.push('Accessories Commitment');if (!otherBrandsCommitmentAmount) missingFields.push('other Brands Commitment');if (!agreedBrandFees) missingFields.push('Agreed Brand Fees');if (!brandFeesCollected) missingFields.push('Brand Fees Collected');if (brandFeesCollected > brandFee) missingFields.push('Payment Brand fee ');if (!paymentMode) missingFields.push('Payment Mode');if (!paymentReferenceNo) missingFields.push('Payment Reference No');if (!feeCollectingDate) missingFields.push('Fee Collecting Date');if (missingFields.length > 0) {alert('The following fields are required: ' + missingFields.join(', '));return;}const loiFormData = {referId: referId,businessType: businessType,acquiredDate: acquiredDate,firstName: firstName,lastName: lastName,mobile: mobile,email: email,landline: landline,dob: dob,anniversaryDate: anniversaryDate,panNo: panNo,adharNo: adharNo,gstNo: gstNo,bankName: bankName,ifscCode: ifscCode,accountNo: accountNo,companyName: companyName,gstPin: gstPin,gstState: gstState,gstCity: gstCity,gstDistrict: gstDistrict,agreeWalletValue: agreeWalletValue,storeArea: storeArea,storePotential: storePotential,lessCommitReason: lessCommitReason,vivoCommitmentAmount: vivoCommitmentAmount,oppoCommitmentAmount: oppoCommitmentAmount,samsungCommitmentAmount: samsungCommitmentAmount,xiaomiCommitmentAmount: xiaomiCommitmentAmount,accessoriesCommitmentAmount: accessoriesCommitmentAmount,otherBrandsCommitmentAmount: otherBrandsCommitmentAmount,agreedBrandFees: agreedBrandFees,brandFeesCollected: brandFeesCollected,paymentMode: paymentMode,paymentReferenceNo: paymentReferenceNo,feeCollectingTimeStamp: feeCollectingDate,billingAddress: billingAddress};console.log("form data - ", loiFormData);if (confirm("Are you sure to submit the form ?")) {doPostAjaxRequestWithJsonHandler(`${context}/submitLoiForm`, JSON.stringify(loiFormData), function (response) {console.log('responsee', 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);});}});}});$(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', ".updateLoiFormData", function () {let loiId = $(this).val();let formData = {};let jsonData = JSON.stringify(objectifyForm($("form[name='Loi_Form']").serializeArray())).trim();doPostAjaxRequestWithJsonHandler(`${context}/updateLoiFormData?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);if (confirm("Are you sure to send OTP ?")) {doPostAjaxRequestHandler(`${context}/loiAcceptanceOtp?loiId=` + loiId,function (response) {alert(response);doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,function (response) {$('#' + 'main-content').html(response);});});} else {alert("OTP not send .");}});$(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();doGetAjaxRequestHandler(`${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);doGetAjaxRequestHandler(`${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', ".CompletedLoiForm", function () {doGetAjaxRequestHandler(`${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 != " ") {doPostAjaxRequestHandler(`${context}/createNewOnboardingPanel?loiId=${loiId}&authId=${authId}`,function (response) {if (response) {doGetAjaxRequestHandler(`${context}/completedLoiForms`,function (response) {$('#' + 'main-content').html(response);});} else {//nothing}});} else {alert("Please choose RBM ");}});$(document).on('click', "#downloadAllLoiForm", function () {const from = $('input[name="from"]').val();const to = $('input[name="to"]').val();let missingFields = [];if (!from) missingFields.push('From date');if (!to) missingFields.push('To date');if (missingFields.length > 0) {alert('Please select : ' + missingFields.join(','));return;}console.log("From - ", from)console.log("To - ", to)window.location.href = `${context}/downloadLoiFromReport?from=${from}&to=${to}`;});function pendingLoiForm(domId) {doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,function (response) {$('#' + domId).html(response);});}