// 'use strict'; // Checkbox Status Check or Uncheck $('input[type=checkbox]').on('change', function () { this.value = this.checked ? 1 : 0; }).change(); // county code $("select").html(` `); // form title var id; $('[data-target][data-toggle=modal]').on('click', function () { id = $(this).attr('data-target'); Title = { 'Homemeeting': "Put your interests in action, get all the details right now.", 'DownloadBrochure': "Mention your whatsapp number to receive Brochure on whatsapp", 'PricePlan': "Get explicit details about the pricing and on spot offers", 'FloorPlan': "You are trying to download a big file, get it on Whatsapp", 'Location': "Due to huge rush at site we would request you to book your sitevisit in advance", 'Video_section': "Get complete 360 view of the project" } $('.modal.form h3').text(Title[id]) $('.modal.form').attr('id', id).modal('show'); }); // Get data Only using ajax get call method var projectId; var RegNo; var city; var is_magnet = 0; var magnet_id; var magnet_number; let apiDataGet = async () => { let data = getProjectData(174) // Change Project_ID Integer Value only Ex:1131 .then((data) => { phone_no = data.result.magnet_id ? data.result.magnet_number : data.result.phone; whatsapp_url = data.result.wp_links_sms; whatsapp_url = whatsapp_url.split("="); whatsapp_url[1] = data.result.magnet_id ? ("+91" + data.result.magnet_number + "&text") : whatsapp_url[1]; whatsapp_url[2] = "I want to know more about " + whatsapp_url[2]; whatsapp_url = whatsapp_url.join("="); projectId = data.result.Project.p_id; is_magnet = data.result.is_magnet; magnet_id = data.result.magnet_id ? data.result.magnet_id : null; city = data.result.Project.Region.city; RegNo = data.result.Project.Region.region_name; $(".phone_url").attr("href", "tel:" + phone_no + ""); $(".whatsapp_url").attr("href", whatsapp_url); $(".phone_no").html(phone_no); }) .catch((error) => { var whatsapp_url = "https://api.whatsapp.com/send?phone=917304412403&text=Hi!" $(".whatsapp_url").attr("href", whatsapp_url); $(".phone_url").attr("href", "tel:" + 917304927701 + ""); $(".phone_no").html("917304927701") }); } apiDataGet(); // UTM Data Call var param_region_id = RegNo; var param_nationality = 1; // main function to store the data and post data to api function OnlyAlphaValidationWithSpace(e) { if (navigator.appName.toLowerCase() == 'netscape') { var key1; var keychar1; key1 = e.which; keychar1 = String.fromCharCode(key1); if ((key1 == null) || (key1 == 0) || (key1 == 8) || (key1 == 9) || (key1 == 27) || (key1 == 46) || (key1 == 22)) { return true; } else if ((("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ").indexOf(keychar1) > -1)) { return true; } else { return false; } } else { key1 = e.keyCode; keychar1 = String.fromCharCode(key1); if ((key1 == null) || (key1 == 0) || (key1 == 8) || (key1 == 9) || (key1 == 27) || (key1 == 46) || (key1 == 22)) { return true; } else if ((("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ").indexOf(keychar1) > -1)) { return true; } else { return false; } } } function OnlyNumberValidationDash(e) { if (navigator.appName.toLowerCase() == 'netscape') { var key1; var keychar1; key1 = e.which; keychar1 = String.fromCharCode(key1); if ((key1 == null) || (key1 == 0) || (key1 == 8) || (key1 == 9) || (key1 == 27) || (key1 == 45)) { return true; } else if ((("0123456789").indexOf(keychar1) > -1)) { return true; } else { return false; } } else { key1 = e.keyCode; keychar1 = String.fromCharCode(key1); if ((key1 == null) || (key1 == 0) || (key1 == 8) || (key1 == 9) || (key1 == 27) || (key1 == 45)) { return true; } else if ((("0123456789").indexOf(keychar1) > -1)) { return true; } else { return false; } } } $('#dropAnEnquiry').on("submit", function () { debugger var name = $('#dropname').val(); var email = "No email"; var number = $('#dropnumber').val(); var country_code = $('#drop_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'top_enquire_form'); return !1 }) $('#HomemeetingForm').on("submit", function () { debugger var name = $('#Homemeetingname').val(); var email = "Noe email"; var number = $('#Homemeetingnumber').val(); var country_code = $('#Homemeeting_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, ' homemeeting_overview_homepage'); return !1 }) $('#BrochureForm').on("submit", function () { debugger var name = $('#Brochurename').val(); var email = "Noe email"; var number = $('#Brochurenumber').val(); var country_code = $('#Brochure_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'downloadbrochure_overview_homepage'); return !1 }) $('#PriceForm').on("submit", function () { debugger var name = $('#Pricename').val(); var email = "Noe email"; var number = $('#Pricenumber').val(); var country_code = $('#Price_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, ' priceplan_overview_homepage'); return !1 }) $('#OfferModalForm').on("submit", function () { debugger var name = $('#OfferModalname').val(); var email = "Noe email"; var number = $('#OfferModalnumber').val(); var country_code = $('#drop_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'gallery_overview_homepage'); return !1 }) $('#AmenitiesForm').on("submit", function () { debugger var name = $('#Amenitiesname').val(); var email = "Noe email"; var number = $('#Amenitiesnumber').val(); var country_code = $('#Amenities_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, ' amenities_overview_homepage'); return !1 }) $('#FloorPlanForm').on("submit", function () { debugger var name = $('#FloorPlanName').val(); var email = "Noe email"; var number = $('#FloorPlanNumber').val(); var country_code = $('#FloorPlan_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, ' floorplan_overview_homepage'); return !1 }) $('#LocationForm').on("submit", function () { debugger; var name = $('#LocationName').val(); var email = "Noe email"; var number = $('#LocationNumber').val(); var country_code = $('#Location_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, ' sitevisit_overview_homepage'); return !1 }) $('#EmiFormModal').on("submit", function () { debugger; var name = $('#EmiFormname').val(); var email = "Noe email"; var number = $('#EmiFormnumber').val(); var country_code = $('#EmiForm_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'emicalculator_overview_homepage'); return !1 }) $('#KnowMoreForm').on("submit", function () { debugger; var name = $('#KnowMoreName').val(); var email = "Noe email"; var number = $('#KnowMoreNumber').val(); var country_code = $('#KnowMore_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'Know_more_details_overview_homepage'); return !1 }) $('#FeatureForm').on("submit", function () { debugger; var name = $('#FeatureName').val(); var email = "Noe email"; var number = $('#FeatureNumber').val(); var country_code = $('#Feature_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'featured_porject_details_overview_homepage'); return !1 }) $('#GalleryForm').on("submit", function () { debugger; var name = $('#Galleryname').val(); var email = "Noe email"; var number = $('#Gallerynumber').val(); var country_code = $('#Gallery_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'video_gallery_overview_homepage'); return !1 }) $('#onloadForm').on("submit", function () { debugger; var name = $('#onloadname').val(); var email = "Noe email"; var number = $('#onloadnumber').val(); var country_code = $('#onload_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, 'featured_porject_details_overview_homepage'); return !1 }) $('#ModalForm').on("submit", function () { debugger; var name = $('#ModalName').val(); var email = "Noe email"; var number = $('#ModalNumber').val(); var country_code = $('#Modal_CountryCode').val(); var checkbox = $('#checkbox').val(); saveLead(name, email, number, country_code, checkbox, '_overview_homepage'); return !1 }) queryForm(); var self = window.location.toString(); var utmContent = self.includes("utm_content=PMAX"); async function saveLead(name, email, number, country_code, checkbox, pref) { debugger; if (utmContent) { $(".showdrop").show(); $(".hidedrop").hide(); $(".mfieldshow").show(); $(".mfieldhide").hide(); $(".pfieldshow").show(); $(".pfieldhide").hide(); $(".pfieldshow1").show(); $(".pfieldhide1").hide(); if ($('.dropnOtp').val() == '' && parseInt(number)) { const otpData = { phone: parseInt(number), }; let baseUrl = window.location.href.includes("file") || window.location.href.includes("localhost") ? "https://staging-api.homesfy.in/" : "https://api.homesfy.in/" $.post("https://api.homesfy.in/api/users/send_otp", otpData, function (data, status) { if (status == "success") { $('.dropnOtp').val(data.otp); } }); } if (($('.dropnOtp').val() != '' && ($('.dropnOtp').val() == $('.FillOtp').val() || $('.dropnOtp').val() == $('.FillOtp1').val() || $('.dropnOtp').val() == $('.FillOtp2').val() || $('.dropnOtp').val() == $('.FillOtp3').val()))) { var getUtmData = queryForm(); var ipAddress = await getIpAddress(); var user_device = deviceData(); var user_browser = browserData(); var obj = {}; obj.name = name; obj.number = number; obj.email = email; obj.country_code = country_code; // obj.is_tc_agree = parseInt(checkbox); // obj.admin_message= message; obj.nationality = param_nationality; // 1 for indian & 2 for NRI (int) // obj.is_magnet = 1 ; // 1 for yes and 0 for no (int), // magnet_id =39603; //if magnet else blank (int) obj.source_id = 31; obj.project_id = projectId; if (getUtmData) { obj.Utm = { utm_medium: getUtmData.utmmedium, utm_source: getUtmData.utmsource, utm_content: getUtmData.utmcontent, utm_term: getUtmData.utmterm }; } obj.Digital = { user_device: user_device, user_browser: user_browser, campaing_type: getUtmData ? getUtmData.utmcampaign : null, launch_name: "", client_ipaddress: ipAddress, client_pref: pref } if (is_magnet === 1) { obj.is_magnet = is_magnet; obj.magnet_id = magnet_id; obj.source_id = 49; } else { obj.source_id = 31; } if (pref == 'DownloadBrochure_overview_homepage') { SendLead(obj, "ThankYou/thankyou.html"); } else { SendLead(obj, "ThankYou/thankyou.html"); } } } else { var getUtmData = queryForm(); var ipAddress = await getIpAddress(); var user_device = deviceData(); var user_browser = browserData(); var obj = {}; obj.name = name; obj.number = number; obj.email = email; obj.country_code = country_code; // obj.is_tc_agree = parseInt(checkbox); // obj.admin_message= message; obj.nationality = param_nationality; // 1 for indian & 2 for NRI (int) // obj.is_magnet = 1 ; // 1 for yes and 0 for no (int), // magnet_id =39603; //if magnet else blank (int) obj.source_id = 31; obj.project_id = projectId; if (getUtmData) { obj.Utm = { utm_medium: getUtmData.utmmedium, utm_source: getUtmData.utmsource, utm_content: getUtmData.utmcontent, utm_term: getUtmData.utmterm }; } obj.Digital = { user_device: user_device, user_browser: user_browser, campaing_type: getUtmData ? getUtmData.utmcampaign : null, launch_name: "", client_ipaddress: ipAddress, client_pref: pref } if (is_magnet === 1) { obj.is_magnet = is_magnet; obj.magnet_id = magnet_id; obj.source_id = 49; } else { obj.source_id = 31; } if (pref == 'DownloadBrochure_overview_homepage') { SendLead(obj, "ThankYou/thankyou.html"); } else { SendLead(obj, "ThankYou/thankyou.html"); } } }