jQuery(function ($) { $(document).ready(function () { $(".find-a-service-img").css('display', 'block'); $(".provide-a-service-img").css('display', 'none'); $(".select-job #bookAJob").css({ "font-weight": "700", "color": "#593798", "background-color": "#fff", "border": "1px solid #fff", }); $( "#giftingOrderButton" ).click(function() { $('.modalSetView.screen-one-view').hide(); $('.modalSetView.screen-two-view').show(); }); $( ".cancel_gift_button" ).click(function() { $('.modalSetView.screen-one-view').show(); $('.modalSetView.screen-two-view').hide(); }); $("#monthlyFooter").hide(); $(".tgl-light").click(function () { if ($(this).is(":checked")) { $("#annuallyFooter").show(); $("#monthlyFooter").hide(); } else { $("#annuallyFooter").hide(); $("#monthlyFooter").show(); } }); $(".row1 .priceSelectbtn").click(function () { $(".row1 .priceSelectbtn").toggleClass("selected"); $("tbody tr:nth-child(even) td:nth-child(3), .row1").toggleClass( "highlight" ); $( ".row2 .priceSelectbtn, .row3 .priceSelectbtn, .row4 .priceSelectbtn" ).removeClass("selected"); $( "tbody tr:nth-child(even) td:nth-child(5), .row3, tbody tr:nth-child(even) td:nth-child(4), .row2, tbody tr:nth-child(even) td:nth-child(6), .row4" ).removeClass("highlight"); }); $(".row2 .priceSelectbtn").click(function () { $(".row2 .priceSelectbtn").toggleClass("selected"); $( "tbody tr:nth-child(even) td:nth-child(4), tfoot tr th:nth-child(4), .row2" ).toggleClass("highlight"); $( "tfoot tr th:nth-child(5), tfoot tr th:nth-child(6), tbody tr:nth-child(even) td:nth-child(3), .row1, tbody tr:nth-child(even) td:nth-child(5), .row3, tbody tr:nth-child(even) td:nth-child(6), .row4" ).removeClass("highlight"); $( ".row1 .priceSelectbtn, .row3 .priceSelectbtn, .row4 .priceSelectbtn" ).removeClass("selected"); }); $(".row3 .priceSelectbtn").click(function () { $(".row3 .priceSelectbtn").toggleClass("selected"); $( "tbody tr:nth-child(even) td:nth-child(5), .row3, tfoot tr th:nth-child(5)" ).toggleClass("highlight"); $( "tfoot tr th:nth-child(4), tfoot tr th:nth-child(6), tbody tr:nth-child(even) td:nth-child(3), .row1, tbody tr:nth-child(even) td:nth-child(4), .row2, tbody tr:nth-child(even) td:nth-child(6), .row4" ).removeClass("highlight"); $( ".row2 .priceSelectbtn, .row1 .priceSelectbtn, .row4 .priceSelectbtn" ).removeClass("selected"); }); $(".row4 .priceSelectbtn").click(function () { $(".row4 .priceSelectbtn").toggleClass("selected"); $( "tbody tr:nth-child(even) td:nth-child(6),tfoot tr th:nth-child(6), .row4" ).toggleClass("highlight"); $( "tfoot tr th:nth-child(4), tfoot tr th:nth-child(5), tbody tr:nth-child(even) td:nth-child(3), .row1, tbody tr:nth-child(even) td:nth-child(4), .row2, tbody tr:nth-child(even) td:nth-child(5), .row3" ).removeClass("highlight"); $( ".row2 .priceSelectbtn, .row3 .priceSelectbtn, .row1 .priceSelectbtn" ).removeClass("selected"); }); if (window.location.hash === "#downloadApp") { $(".Download-Modallink").trigger("click"); } if (window.location.pathname === "/pricing/") { console.log(window.location.pathname); $(".pricing-ul li").addClass("current-menu-item"); } ("use strict"); /* $(".newbookBTN").click(function () { $(".widgetModalNew").addClass("active"); });*/ $(".navbar-toggle").click(function () { $(".bodySection").toggleClass("blur-class"); }); // New Fixer Signup Flow data bindings $(".step-2, .step-3").hide(); pricing_plan_selected = localStorage.getItem("pricing_plan_selected"); if (!pricing_plan_selected) { $(".signup-flow-2").hide(); $(".signup-flow-1").show(); } else { $(".signup-flow-1").hide(); $(".signup-flow-2").show(); } if (localStorage.getItem("summaryData") !== null) { var summaryData = JSON.parse(localStorage.getItem("summaryData")); if (summaryData) { $(".total_technicians").val(summaryData.quantity); bindSummaryData( summaryData.plan, summaryData.plan_name_short, summaryData.plan_interval, summaryData.price ); } } // End of New Fixer Signup Flow data bindings Parse.initialize( "dDCLItKaPqINj7AJSVk1k87AybNmVDqa9V1bEkvx", "mmPb4Iwr7f34fPH2Wk0DtzfwPmAYF6XD6fSTFxFT" ); // Parse.serverURL = 'http://localhost:8081/parse'; Parse.serverURL = "https://api.fixitfaster.com/parse"; if ( window.location.pathname === "/Signup-fixer/" || window.location.pathname === "/Signup-fixer/#" || window.location.pathname === "/Signup-fixer" ) { var user = Parse.User.current(), step1 = localStorage.getItem("signup-step1"); if (user && (step1 == "true" || step1 == true)) { localStorage.removeItem("signup-step1"); localStorage.removeItem("pricing_plan_selected"); localStorage.removeItem("summaryData"); window.location.href = window.location.origin + "/console"; } } var type = getURLParam("type"), referralCode = getURLParam("referralCode"), jobDetails = getURLParam("jobDetails"); var newlogin = getURLParam("invite"); var landingService = getURLParam("service"); var landingLocation = getURLParam("location"); if (landingService) { landingService = landingService.replace("%7D", "").replace("%7B", ""); } if (landingLocation) { landingLocation = landingLocation.replace("%7D", "").replace("%7B", ""); } $("#landingPageTradeType").html(landingService); $("#landingPagelocation").html(landingLocation); var currentUrl = window.location.href; if (jobDetails) { console.log("jobDetails", jobDetails); } if (referralCode) { if (currentUrl.includes("https://www.fixitfaster.com/signup.html")) { window.location.href = "https://www.fixitfaster.com/Signup-finder/?referralCode=" + referralCode; } else { if ( currentUrl !== "https://www.fixitfaster.com/Signup-finder/?referralCode=" + referralCode ) { window.location.href = "https://www.fixitfaster.com/Signup-finder/?referralCode=" + referralCode; } $("#referral").val(referralCode); } } if (newlogin) { if ( currentUrl.includes("https://www.fixitfaster.com/login.html?invite=") ) { window.location.href = "https://www.fixitfaster.com/?invite=" + newlogin; console.log("1-", newlogin); } else { var invitesObj = Parse.Object.extend("Invites"), invitesQuery = new Parse.Query(invitesObj); invitesQuery.include("fromUser"); invitesQuery.equalTo("objectId", newlogin); invitesQuery.find().then(function (invites) { if (invites.length > 0) { var userObj = Parse.Object.extend("User"), userquery = new Parse.Query(userObj); userquery.equalTo("email", invites[0].get("email")); userquery.first().then( function (user) { if (user) { if (invites && invites[0] && invites[0].get("email")) { $("#form-field-email").val(invites[0].get("email")); } else { $("#form-field-email").val(""); } } else { if ( currentUrl !== "https://www.fixitfaster.com/Signup-fixer/?invite=" + newlogin && currentUrl !== "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin ) { window.location.href = "https://www.fixitfaster.com/Signup-fixer/?invite=" + newlogin; } setTimeout(function () { if (invites && invites[0] && invites[0].get("email")) { $("#fixer_email").val(invites[0].get("email")); $("#email").val(invites[0].get("email")); console.log(invites[0].get("email")); } else { $("#fixer_email").val(""); } }, 1000); } }, function (error) { showAlertMessage(error.message); return false; } ); } else { var vouchersObj = Parse.Object.extend("Vouchers"), vouchersQuery = new Parse.Query(vouchersObj); vouchersQuery.equalTo("promoCode", newlogin.toUpperCase()); vouchersQuery.containedIn("type", ["credit", "signup", "promo"]); vouchersQuery.equalTo("isActive", true); vouchersQuery.exists("promoLink"); vouchersQuery.find().then( function (vouchers) { if (vouchers.length > 0) { if ( currentUrl !== "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin ) { window.location.href = "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin; } setTimeout(function () { if (newlogin) { $("#referral").val(newlogin.toUpperCase()); } else { $("#referral").val(""); } }, 1000); } else { var userObj = Parse.Object.extend("User"), userObjQuery = new Parse.Query(userObj); userObjQuery.include("user"); userObjQuery.equalTo("referralCode", newlogin); userObjQuery.find().then(function (invites) { $("#finder-signup-new #referral").val(newlogin); setTimeout(function () { if (newlogin) { $("#finder-signup-new #referral").val(newlogin); } }, 9000); $("#fixer_referral").val(newlogin); if ( currentUrl !== "https://www.fixitfaster.com/Signup-fixer/?invite=" + newlogin ) { if ( newlogin === "JACKSON" && currentUrl !== "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin ) { window.location.href = "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin; } else if ( (invites[0].get("userType") !== "Non-trader" && invites[0].get("isCompany") !== true && currentUrl !== "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin) || newlogin === "propertyhq" ) { window.location.href = "https://www.fixitfaster.com/Signup-fixer/?invite=" + newlogin; } else if ( currentUrl !== "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin && currentUrl && !currentUrl.includes( "https://www.fixitfaster.com/Signup-fixer/?invite=" + newlogin ) ) { window.location.href = "https://www.fixitfaster.com/Signup-finder/?invite=" + newlogin; } } }); } }, function (error) { if ( currentUrl !== "https://www.fixitfaster.com/Signup-fixer/?invite=" + newlogin ) { window.location.href = "https://www.fixitfaster.com/Signup-fixer/?invite=" + newlogin; } setTimeout(function () { if (invites && invites[0] && invites[0].get("email")) { $("#fixer_email").val(invites[0].get("email")); console.log(invites[0].get("email")); } else { $("#fixer_email").val(""); } }, 1000); } ); } }); } } const FACEBOOK_APP_ID = "948832961970843"; const SERVER_URL = "https://api.fixitfaster.com/parse"; const PARSE_JAVASCRIPT_KEY = "mmPb4Iwr7f34fPH2Wk0DtzfwPmAYF6XD6fSTFxFT"; Parse.initialize(PARSE_APP_ID, PARSE_JAVASCRIPT_KEY); function checkLoginState() { FB.getLoginStatus(function (response) { statusChangeCallback(response); }); } function statusChangeCallback(response) { if (response.status === "connected") { fb_login(); } else { document.getElementById("status").innerHTML = "Please log " + "into this webpage."; } } window.fbAsyncInit = function () { Parse.FacebookUtils.init({ appId: FACEBOOK_APP_ID, cookie: true, status: true, xfbml: true, version: "v1.0", }); // FB.getLoginStatus(function (response) { // if (response.status === 'connected') { // statusChangeCallback(response); // // getFbUserData(); // } // }); }; (function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) { return; } js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js"; fjs.parentNode.insertBefore(js, fjs); })(document, "script", "facebook-jssdk"); var authRes; jQuery(document).on("click", "#fbLink", function (event) { fb_login(); }); function fb_login() { FB.login( function (response) { if (response.authResponse) { getFbUserData(response.authResponse); } else { document.getElementById("status").innerHTML = "User cancelled login or did not fully authorize."; } }, { scope: "email", auth_type: "reauthorize" } ); } async function fbLogic(response) { var linkedMobile = $("#linkedMobile").val(); if (!linkedMobile) { /*alert("Please provide your Phone Number.");*/ return false; } try { var userObject = Parse.Object.extend("_User"); var userQuery = new Parse.Query(userObject); userQuery.include("user"); userQuery.include("referrer_1"); if (response.email) { userQuery.equalTo("email", response.email); } else { userQuery.equalTo("facebookId", response.id); } var isNewUser = false; var parseUser = await userQuery.first(); var authData = { id: response.id, access_token: response.authResponse.accessToken, expiration_date: response.authResponse.data_access_expiration_time, }; if (!parseUser) { await createNewUser(response, response.authResponse); isNewUser = true; } else if (parseUser && !parseUser.get("facebookId")) { await linkToUser(response, response.authResponse); await Parse.FacebookUtils.logIn(authData); } else { await Parse.FacebookUtils.logIn(authData); } var currentUser = Parse.User.current(); currentUser.set("mobileNumber", linkedMobile); await currentUser.save(); setTimeout(function () { if (currentUser) { $(".loaderSection").css("display", "block"); window.location.href = window.location.origin + "/console"; return; } }, 500); return { user: currentUser && currentUser.toJSON(), isNewUser }; } catch (e) { console.error(e); return; } } function getFbUserData(authResponse) { var currentUser = Parse.User.current(); if (currentUser && currentUser.get("userType") !== "Non-trader") { localStorage.clear(); Parse.User.logOut(); } if (!currentUser) { localStorage.clear(); } var userObject = Parse.Object.extend("_User"); var userQuery = new Parse.Query(userObject); FB.api( "/me", { locale: "en_US", fields: "id,first_name,last_name,email,locale,picture,permissions", }, async function (response) { if ( response.email == "" || response.email == null || response.email == undefined ) { $("#emailModal").modal("show"); fbResponse = response; fbResponse.authResponse = authResponse; } else { $("#linkedEmail").val(response.email); $("#linkedEmail").prop("disabled", true); if (response.phoneNumber) { $("#linkedMobile").val(response.phoneNumber); } else { $("#emailModal").modal("show"); } fbResponse = response; fbResponse.authResponse = authResponse; fbLogic(response); } } ); } $(document).on("submit", "#linkedEmailForm", function (e) { $("#linkedEmailForm .btn-primary").attr("disabled", true); e.preventDefault(); var linkedEmail = $("#linkedEmail").val(), linkedMobile = $("#linkedMobile").val(); setTimeout(function () { $("#linkedEmailForm .btn-primary").attr("disabled", false); }, 1000); if (linkedEmail === "") { alert("email is required."); return false; } if (!validateEmail(linkedEmail)) { alert("please enter a valid email address"); return false; } if (linkedMobile === "") { alert("mobile number is required."); return false; } fbResponse.email = linkedEmail; fbResponse.phoneNumber = linkedMobile; fbLogic(fbResponse); }); async function linkToUser(response, authResponse) { var name = response.first_name + " " + response.last_name; var params = { email: response.email, id: response.id, token: authResponse.accessToken, name: name, expires: authResponse.expiresIn, }; const req = await fetch(SERVER_URL + "/functions/facebook", { method: "POST", headers: { "X-Parse-Application-Id": PARSE_APP_ID, "X-Parse-REST-API-Key": PARSE_REST_API_KEY, "X-Parse-Javascript-Key": PARSE_JAVASCRIPT_KEY, "Content-Type": "application/json", }, body: JSON.stringify(params), }); // const requestResponse = await facebook(response, authResponse); return req; } async function createNewUser(response, authResponse) { var fbrefcode = $("#finder-signup-new #referral").val(); var authData = { id: response.id, access_token: authResponse.accessToken, expiration_date: authResponse.data_access_expiration_time, }, linkedMobile = $("#linkedMobile").val(); try { await Parse.FacebookUtils.logIn(authData); // await Parse.FacebookUtils.logIn(authData); var currentUser = Parse.User.current(); if (currentUser) { try { var name = response.first_name + " " + response.last_name; var username = response.email ? response.email : response.name; /*var fbProfilePicUrl = response.pictute.data.url; console.log(fbProfilePicUrl);*/ console.log(response); currentUser.set("email", response.email); currentUser.set("username", username); currentUser.set("name", name); currentUser.set("facebookId", response.id); /*currentUser.set("profilePhoto", fbProfilePicUrl);*/ currentUser.set("userType", "Non-trader"); currentUser.set("isAppInstalled", true); currentUser.set("deviceType", "pc-google"); currentUser.set("referredBy", "FIX25"); /*if (fbrefcode) { currentUser.set("referredBy", fbrefcode); } else { currentUser.set("referredBy", ""); }*/ currentUser.set("mobileNumber", linkedMobile); localStorage.setItem("isNewUser", true); window.location.href = window.location.origin + "/console"; await currentUser.save(); } catch (e) { console.error(e); alert( e.message ? e.message : "Something went wrong, please try again" ); $("#finder-signup-new #trail-btn").attr("disabled", false); } } } catch (e) { console.error(e); } } $(document).on("click", '#login-form button[type="submit"]', function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); var email = $("#login-form #form-field-email").val(); var password = $("#login-form #form-field-password").val(); // $(this).attr('disabled', true) Parse.User.logIn(email.toLowerCase(), password).then( function (user) { $(this).attr("disabled", false); if (user) { if (user.get("isActive") === false) { logInEmail = email; LogInPassword = password; user = null; Parse.User.logOut(); //alert('Your account is currently deactivated.Please contact administrator.'); $("#deactivateModalalert").modal("show"); $("#login-form #form-field-email").val(""); $("#login-form #form-field-password").val(""); } else { window.location.href = window.location.origin + "/console"; return; } } }, function (e) { $(this).attr("disabled", false); alert( e.message ? e.message : "Something went wrong, please try again" ); } ); }); // helper method to parse url function getURLParam(name, url) { if (!url) { url = window.location.href; } var results = new RegExp("[\\?&]" + name + "=([^&#]*)").exec(url); if (!results) { return undefined; } return results[1] || undefined; } $(document).on("submit", "#login-form", function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); }); $(document).on("click", '#fp-form button[type="submit"]', function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); $(this).attr("disabled", true); var email = $("#fp-form #form-field-email").val(); var userObject = Parse.Object.extend(Parse.User), userquery = new Parse.Query(userObject); userquery.equalTo("email", email); userquery.first().then( function (user) { if (user) { if (user.get("isActive") === false) { user = null; Parse.User.logOut(); alert( "Your account is currently deactivated.Please contact administrator." ); $("#fp-form #form-field-email").val(""); $('#fp-form button[type="submit"]').attr("disabled", false); } else { Parse.User.requestPasswordReset(email, { success: function () { $("#fp-form #form-field-email").val(""); alert( "A link to reset your password has been sent. Please Check your email." ); $('#fp-form button[type="submit"]').attr("disabled", false); }, error: function (error) { alert("User not found with the given Email-Id."); $('#fp-form button[type="submit"]').attr("disabled", false); }, }); } } else { alert("User not found with the given Email-Id."); $('#fp-form button[type="submit"]').attr("disabled", false); } }, function (error) { alert(error.message); $('#fp-form button[type="submit"]').attr("disabled", false); return false; } ); }); $(document).on("submit", "#fp-form", function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); }); if ($("#fixer-form").length > 0) { var Trades = Parse.Object.extend("Trades"), query = new Parse.Query(Trades); query.equalTo("isFeatured", true); query.ascending("name"); query.select("name"); query.limit(1000); query.find().then(function (results) { $("#form-field-fixer-services").find("option").remove(); /*var newOption = new Option('', '', false, false); $('#form-field-fixer-services').append(newOption);*/ for (var i = 0; i < results.length; i++) { var object = results[i]; var newOption = new Option( object.get("name"), object.id, false, false ); $("#form-field-fixer-services").append(newOption).trigger("change"); } $("#form-field-fixer-services option:selected").prop("selected", false); $("#form-field-fixer-services").select2({ placeholder: "Select all that apply", maximumSelectionLength: 10, multiple: true, allowClear: true, }); setTimeout(function () { $("#form-field-fixer_serviceTypes").val(null).trigger("change"); }, 3000); }); } if ($("#fixer-form").length) { $("#fixer-form #form-field-fixer-name").attr("maxlength", 38); $("#fixer-form #form-field-fixer-business-name").attr("maxlength", 38); $("#fixer-form #form-field-fixer-password").attr("minlength", 6); $("#fixer-form #form-field-fixer-password").attr("maxlength", 20); $("#fixer-form #form-field-fixer-mobile-number").attr("minlength", 8); $("#fixer-form #form-field-fixer-mobile-number").attr("maxlength", 10); $("#fixer-form #form-field-fixer-postcode").attr("maxlength", 4); $("#fixer-form #form-field-fixer-postcode").attr("minlength", 4); $(document).on( "keyup", "#fixer-form #form-field-fixer-password, #fixer-form #form-field-fixer-email", function () { var value = $(this).val(); value = value.replace(/\s/g, ""); $(this).val(value); } ); } if ($("#fixer-signup-new").length > 0) { var Trades = Parse.Object.extend("Trades"), query = new Parse.Query(Trades); query.equalTo("isFeatured", true); query.ascending("name"); query.select("name"); query.limit(1000); query.find().then(function (results) { $("#form-field-fixer_serviceTypes").find("option").remove(); for (var i = 0; i < results.length; i++) { var object = results[i]; var newOption = new Option( object.get("name"), object.id, false, false ); $("#form-field-fixer_serviceTypes") .append(newOption) .trigger("change"); } $("#form-field-fixer_serviceTypes option:selected").prop( "selected", false ); $(".elementor-field-group-fixer_serviceTypes").hide(); $("#form-field-fixer_serviceTypes").select2({ placeholder: "Service Type", maximumSelectionLength: 10, multiple: true, allowClear: true, }); }); } if ($("#fixer-signup-new").length) { $("#fixer-signup-new #fixer_name").attr("maxlength", 38); // $('#fixer-signup-new #form-field-fixer-business-name').attr('maxlength', 38); $("#fixer-signup-new #fixer_password").attr("minlength", 6); $("#fixer-signup-new #fixer_password").attr("maxlength", 20); $("#fixer-signup-new #fixer_mobile_number").attr("minlength", 8); $("#fixer-signup-new #fixer_mobile_number").attr("maxlength", 10); //$("#fixer-signup-new #fixer_postcode").attr("maxlength", 4); //$("#fixer-signup-new #fixer_postcode").attr("minlength", 4); $(document).on( "keyup", "#fixer-signup-new #fixer_password, #fixer-signup-new #fixer_email", function () { var value = $(this).val(); value = value.replace(/\s/g, ""); $(this).val(value); } ); $("#fixit_card").attr("minlength", 16); $("#fixit_card").attr("maxlength", 16); $("#fixit_cvc").attr("mixlength", 3); $("#fixit_cvc").attr("maxlength", 3); } if ($("#finder-signup-new").length) { $("#finder-signup-new #password").attr("minlength", 6); $("#finder-signup-new #password").attr("maxlength", 20); $("#finder-signup-new #name").attr("maxlength", 38); $(document).on( "keyup", "#finder-signup-new #password, #finder-signup-new #email", function () { var value = $(this).val(); value = value.replace(/\s/g, ""); $(this).val(value); } ); } $(document).on( "click", '#finder-signup-new button[type="submit"]', function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); var email = $("#finder-signup-new #email").val(); var password = $("#finder-signup-new #password").val(); var refcode = $("#finder-signup-new #referral").val(); var name = $("#finder-signup-new #name").val(); var phonenumber = $('#finder-signup-new #mobileNumber').val(); // var postCode = $('#finder-signup-new #postCode').val(); if (name == "") { alert("Please enter your name"); return false; } if (email == "") { alert("Please enter an email to sign up"); return false; } if (!validateEmail(email)) { alert("please enter a valid email address"); return false; } if (password != "" && password.length < 8) { alert("Password should be atleast 8 characters"); return false; } if (!validatePassword(password)) { alert("*Your Password must be 8 characters long and include one uppercase letter, a number and/or special character."); return false; } if (phonenumber == "") { alert("Please enter a valid mobile number"); return false; } if (phonenumber && phonenumber.length < 8) { alert('Mobile number should be 8-10 characters'); return false; } var userObj = new Parse.User(); userObj.setUsername(email.toLowerCase().trim()); userObj.setPassword(password); userObj.set("name", name); userObj.set("email", email.toLowerCase().trim()); userObj.set("userType", "Non-trader"); if (refcode) { userObj.set("referredBy", refcode); } if(phonenumber){ userObj.set('mobileNumber', '+61' + phonenumber); } // if(postCode) { // userObj.set('postcode', postCode); // } $(this).attr("disabled", true); userObj.signUp(null, { success: function (user) { localStorage.setItem("isNewUser", true); window.location.href = window.location.origin + "/console"; }, error: function (user, e) { console.log(e); alert( e.message ? e.message : "Something went wrong, please try again" ); $("#finder-signup-new #trail-btn").attr("disabled", false); }, }); } ); $(document).on("submit", "#finder-signup-new", function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); }); if ($("#fixer-login-form").length) { $("#fixer-login-form #form-field-fixer-yourname").attr("maxlength", 38); $("#fixer-login-form #form-field-fixer-password").attr("minlength", 6); $("#fixer-login-form #form-field-fixer-password").attr("maxlength", 20); $("#fixer-login-form #form-field-fixer-mobilenumber").attr( "minlength", 8 ); $("#fixer-login-form #form-field-fixer-mobilenumber").attr( "maxlength", 10 ); /*$("#fixer-login-form #form-field-fixer-postcode").attr("maxlength", 4); $("#fixer-login-form #form-field-fixer-postcode").attr("minlength", 4);*/ $(document).on( "keyup", "#fixer-login-form #form-field-fixer-email, #fixer-login-form #form-field-fixer-password", function () { var value = $(this).val(); value = value.replace(/\s/g, ""); $(this).val(value); } ); } $("body").on("paste", "input[type=number][maxlength]", function (event) { //catch copy and paste var ref = $(this); var regex = new RegExp("^[0-9]+$"); var maxlength = ref.attr("maxlength"); var clipboardData = event.originalEvent.clipboardData.getData("text"); var txtVal = ref.val(); //current value var filteredString = ""; var combined_input = txtVal + clipboardData; //dont forget old data for (var i = 0; i < combined_input.length; i++) { if (filteredString.length < maxlength) { if (regex.test(combined_input[i])) { filteredString += combined_input[i]; } } } setTimeout(function () { ref.val("").val(filteredString); }, 100); }); $("body").on("keypress", "input[type=number][maxlength]", function (event) { var key = event.keyCode || event.charCode; var charcodestring = String.fromCharCode(event.which); var txtVal = $(this).val(); var maxlength = $(this).attr("maxlength"); var regex = new RegExp("^[0-9]+$"); // 8 = backspace 46 = Del 13 = Enter 39 = Left 37 = right Tab = 9 if ( key == 8 || key == 46 || key == 13 || key == 37 || key == 39 || key == 9 ) { return true; } // maxlength allready reached if (txtVal.length == maxlength) { event.preventDefault(); return false; } // pressed key have to be a number if (!regex.test(charcodestring)) { event.preventDefault(); return false; } return true; }); $(document).on("click", '#fixer-form button[type="submit"]', function (e) { var businessname = $("#fixer-form #form-field-fixer-business-name").val(), type = $("#fixer-form #form-field-fixer-type").val(), fixername = $("#fixer-form #form-field-fixer_name").val(), email = $("#fixer-form #form-field-fixer-email").val(), services = $("#fixer-form #form-field-fixer-services").val(), phonenumber = $("#fixer-form #form-field-fixer-mobile-number").val(), password = $("#fixer-form #form-field-fixer-password").val(), /*postcode = $("#fixer-form #form-field-fixer-postcode").val(),*/ refcode = $("#fixer-form #form-field-form_field-fixer-refcode").val(), condition = $( '#fixer-form input[name="form_fields[fixer-condition]"]' ).is(":checked"); if (businessname === "") { alert("Please enter business name"); return false; } if (fixername === "") { alert("Please enter your name"); return false; } if (email === "") { alert("Please enter an email to sign up"); return false; } if (!validateEmail(email)) { alert("please enter a valid email address"); return false; } if (phonenumber.length < 8) { alert("Phone number should be 8-10 characters"); return false; } if (condition) { var userObj = new Parse.User(); userObj.setUsername(email.toLowerCase().trim()); userObj.setPassword(password); userObj.set("email", email.toLowerCase().trim()); userObj.set("name", fixername); userObj.set("userType", "Trader"); userObj.set("isVerified", false); userObj.set("status", "Pending"); userObj.set("isCheckedIn", false); userObj.set("mobileNumber", "+61" + phonenumber); userObj.set("companyName", businessname); if (newlogin) { userObj.set("referredBy", newlogin); } else if (refcode) { userObj.set("referredBy", refcode); } userObj.set("postcode", fixerPostCode ? fixerPostCode : '2000'); userObj.set("location", getGeoLocation(fixerPostCode ? fixerPostCode : '2000')); userObj.set("isCompany", true); var trades = []; for (var i = 0; i < services.length; i++) { trades.push({ __type: "Pointer", className: "Trades", objectId: services[i], }); } userObj.set("trades", trades); /* if(referralCode.length !== 0){ if(referralCode === "fif033" || referralCode === "FIF033" || referralCode === "Fif033"){ userObj.set("referredBy","FIF033"); } else if(referralCode === "GLENCO50" || referralCode === "glenco50" || referralCode === "Glenco50"){ userObj.set("referredBy","GLENCO50"); } else if(referralCode === "ENERGY50" || referralCode === "energy50" || referralCode === "Energy50"){ userObj.set("referredBy","ENERGY50"); } else if(referralCode === "G50" || referralCode === "g50"){ userObj.set("referredBy","G50"); } else if(referralCode === "POOLWERX" || referralCode === "poolwerx" || referralCode === "PoolWerx"){ userObj.set("referredBy","POOLWERX"); } else{ userObj.set("referredBy",referralCode.trim()); } } */ $(this).attr("disabled", true); localStorage.setItem("isFirstTimeUser", "true"); userObj.signUp(null, { success: function (data) { localStorage.removeItem("invite"); $(this).attr("disabled", false); if (data.get("location")) { data.set("locationName", getLocationName(data.get("location"))); } data.save(); }, error: function (object, error) { $(this).attr("disabled", false); $("#no-img").attr("disabled", false); if (error.code === 202) { var userquery = new Parse.Query(Parse.User); userquery.equalTo("email", object.get("email")); userquery.find().then(function (currentuser) { if (currentuser.length > 0) { if (currentuser[0].get("isActive") === false) { Parse.User.logOut(); alert( "Your account is deactivated Please contact administrator at team@fixitfaster.com to re-activate." ); } else { alert("An account already exists with this Email-id."); } } }); } else { alert(error.message ? error.message : "Please try again later."); $(this).attr("disabled", false); } }, }); } else { alert("Please read and accept the terms"); } }); $(document).on("submit", "#fixer-form", function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); }); $(document).on("click", ".btn-getStarted", function (e) { /* window.lintrk('track', { conversion_id: 11006828 }); */ window.lintrk('track', { conversion_id: 11106604 }); showSuggestions('fixer_address'); var email = $("#fixer-signup-new #fixer_email").val(), password = $("#fixer-signup-new #fixer_password").val() if (!validatePassword(password)) { alert("*Your Password must be 8 characters long and include one uppercase letter, a number and/or special character."); return false; } if (email === "") { /*alert("Please enter an email to sign up");*/ $("#fixer-signup-new #fixer_email").after("*Please enter an email to sign up."); setTimeout(function(){ $('.emailvalidationMessage').remove(); }, 2000); return false; }else{ $(".emailvalidationMessage").remove(); } if (!validateEmail(email)) { /*alert("please enter a valid email address");*/ $("#fixer-signup-new #fixer_email").after("*Please enter a valid email address."); setTimeout(function(){ $('.patternvalidationMessage').remove(); }, 2000); return false; }else{ $(".patternvalidationMessage").remove(); } var userquery = new Parse.Query("_User"); userquery.equalTo("username", email.toLowerCase().trim()); userquery.first().then( function (user) { if (user) { alert("An account already exists with this Email-id."); return false; } else { $(".signup-step-one").show(); $(".progressContainer").show(); $("#trail-btn").show(); $(".elementor-field-group-fixer_serviceTypes").show(); $(".signup-step-two").hide(); $(".btn-getStarted").hide(); } }, function (error) { alert("Something went wrong, please try again"); return false; } ); }); $(document).on( "click", '#fixer-signup-new button[type="submit"]', function (e) { showSuggestions('fixer_address'); console.log(showSuggestions('fixer_address')); var businessname = $( "#fixer-signup-new #form-field-fixer-business-name" ).val(), fixername = $("#fixer-signup-new #fixer_name").val(), email = $("#fixer-signup-new #fixer_email").val(), services = $( "#fixer-signup-new #form-field-fixer_serviceTypes" ).val(), phonenumber = $("#fixer-signup-new #fixer_mobile_number").val(), password = $("#fixer-signup-new #fixer_password").val(), refcode = $("#fixer-signup-new #fixer_referral").val(), address = $("#fixer-signup-new #fixer_address").val(); /*postcode = $("#fixer-signup-new #fixer_postcode").val();*/ if (fixername === "") { /*alert("Please enter your name");*/ $("#fixer-signup-new #fixer_name").after("*Please enter your name."); setTimeout(function(){ $('.namevalidationMessage').remove(); }, 5000); return false; }else{ $(".namevalidationMessage").remove(); } if (businessname === "") { /*alert("Please enter your business name");*/ $("#fixer-signup-new #form-field-fixer-business-name").after("*Please enter your Business Name."); setTimeout(function(){ $('.businessnamevalidation').remove(); }, 5000); return false; }else{ $(".businessnamevalidation").remove(); } if (services === null) { /*alert("please enter a valid Service Type");*/ $(".elementor-field-group-fixer_serviceTypes").after("*Please enter a valid Service Type."); setTimeout(function(){ $('.servicetypevalidation').remove(); }, 5000); return false; }else{ $(".servicetypevalidation").remove(); } if (phonenumber === "") { /* alert("Phone number should be 8-10 characters");*/ $("#fixer-signup-new #fixer_mobile_number").after("*Please enter a Phone Number."); setTimeout(function(){ $('.phonenumevalidation').remove(); }, 5000); return false; }else{ $(".phonenumevalidation").remove(); } if (phonenumber.length < 8) { /* alert("Phone number should be 8-10 characters");*/ $("#fixer-signup-new #fixer_mobile_number").after("*The number you entered is invalid. Please try again."); setTimeout(function(){ $('.phoneevalidation').remove(); }, 5000); return false; }else{ $(".phoneevalidation").remove(); } if (address === "") { /*alert("Please enter a valid address");*/ $("#fixer-signup-new #fixer_address").after("*Please enter address."); setTimeout(function(){ $('.addressnullvalidation').remove(); }, 5000); return false; }else{ $(".addressnullvalidation").remove(); } if (address.length === 0 ) { /*alert("Please enter a valid address");*/ $("#fixer-signup-new #fixer_address").after("*The address you entered is invalid. Please try again"); setTimeout(function(){ $('.addressvalidation').remove(); }, 5000); return false; }else{ $(".addressvalidation").remove(); } /*if (postcode.length === 0 || isNaN(postcode)) { alert("Please enter a valid postcode"); $("#fixer-signup-new #fixer_postcode").after("*Please enter a valid postcode."); setTimeout(function(){ $('.postcodevalidation').remove(); }, 5000); return false; }else{ $(".postcodevalidation").remove(); }*/ if(address && preferredLocation.length != 0){ preferredLocation[0].addressString = address; }else{ $("#fixer-signup-new #fixer_address").after("*The address you entered is invalid. Please try again"); setTimeout(function(){ $('.addressvalidation').remove(); }, 5000); return false; } var userObj = new Parse.User(); userObj.setUsername(email.toLowerCase().trim()); userObj.setPassword(password); userObj.set("email", email.toLowerCase().trim()); userObj.set("name", fixername); userObj.set("userType", "Trader"); userObj.set("isVerified", false); userObj.set("status", "Pending"); if(preferredLocation) { userObj.set("preferredLocation", preferredLocation); } userObj.set("isCheckedIn", false); userObj.set("mobileNumber", "+61" + phonenumber); userObj.set("companyName", businessname); if (newlogin) { userObj.set("referredBy", newlogin); } else if (refcode) { userObj.set("referredBy", refcode); } userObj.set("postcode", fixerPostCode ? fixerPostCode : "2000"); userObj.set("location", getGeoLocation(fixerPostCode ? fixerPostCode : "2000")); userObj.set("isCompany", true); var trades = []; for (var i = 0; i < services.length; i++) { trades.push({ __type: "Pointer", className: "Trades", objectId: services[i], }); } userObj.set("trades", trades); $(this).attr("disabled", true); preloader.show(); localStorage.setItem("isFirstTimeUser", "true"); userObj.signUp(null, { success: function (data) { localStorage.removeItem("invite"); $("#fixer-signup-new #trail-btn").attr("disabled", false); $(this).attr("disabled", false); preloader.hide(); if (data.get("location")) { data.set("locationName", getLocationName(data.get("location"))); } data.save(); localStorage.setItem("signup-step1", true); if (data) { $(".stripe-contact-name").html(data.get("companyName")); $(".stripe-contact-email").html(data.get("email")); } pricing_plan_selected = localStorage.getItem( "pricing_plan_selected" ); if (!pricing_plan_selected) { // $(".signup-flow-2, .step-1").hide(); // $(".step-2, .signup-flow-1").show(); /* window.location.href = window.location.origin + "/admin/index.html";*/ gtag_report_conversion(window.location.origin + "/console") } else { user_selected_plan = pricing_plan_selected; $(".signup-flow-1, .step-1").hide(); $(".step-3, .signup-flow-2").show(); $("#start-freetrail-btn").prop("disabled", true); } $("html").animate({ scrollTop: 0 }); }, error: function (object, error) { $("#fixer-signup-new #trail-btn").attr("disabled", false); preloader.hide(); if (error.code === 202) { var userquery = new Parse.Query(Parse.User); userquery.equalTo("email", object.get("email")); userquery.find().then(function (currentuser) { if (currentuser.length > 0) { if (currentuser[0].get("isActive") === false) { Parse.User.logOut(); alert( "Your account is deactivated Please contact administrator at team@fixitfaster.com to re-activate." ); } else { alert("An account already exists with this Email-id."); } } }); } else { alert(error.message ? error.message : "Please try again later."); $(this).attr("disabled", false); } }, }); } ); $(document).on("submit", "#fixer-signup-new", function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); }); $(document).on("keyup", ".cc_add_field", function (e) { var card_num = $("#fixit_card").val(), card_name = $("#fixit_cardName").val(), card_month = $("#fixit_expiry_month").val(), card_year = $("#fixit_expiry_year").val(), card_cvc = $("#fixit_cvc").val(); if ( card_num.length == 16 && card_name && card_month && card_year && card_cvc.length == 3 ) { $("#start-freetrail-btn").addClass("active"); $("#start-freetrail-btn").prop("disabled", false); } else { $("#start-freetrail-btn").removeClass("active"); $("#start-freetrail-btn").prop("disabled", true); } }); $(document).on("click", ".breadcrumb li", function () { var step = $(this).data("step"); if (step !== 1) { if (step == 3) { if (!user_selected_plan) { alert("Please select a plan to proceed"); return false; } } $(".step-1, .step-2, .step-3").hide(); $(".step-" + step).show(); } else { alert("Action not allowed."); } }); function onCreditCardSubmit() { var cardNumber = $("#fixit_card").val(), cardholderName = $("#fixit_cardName").val(), card_cvc = $("#fixit_cvc").val(), expiryMonth = $("#fixit_expiry_month").val(), expiryYear = $("#fixit_expiry_year").val(); if (cardNumber.length === 0) { alert("Please enter Card Number"); return false; } if (cardNumber.length !== 16 || !isValidNumber(cardNumber)) { alert("Invalid Card Number"); return false; } if (cardholderName === "") { alert("Please Enter Card Holder Name"); return false; } if (!expiryMonth && !expiryYear) { showAlertMessage("Please select Expiry Month and Year"); return false; } if (!expiryMonth) { showAlertMessage("Please select Expiry Month"); return false; } if (!expiryYear) { showAlertMessage("Please select Expiry Year"); return false; } if (card_cvc.length === 0) { alert("CVV Number cannot be empty"); return false; } if ( card_cvc.length > 3 || card_cvc.length < 3 || !isValidNumber(card_cvc) ) { alert("Invalid CVV Number"); return false; } preloader.show(); Stripe.setPublishableKey("pk_live_CPHXgsFlvGuVRPQfXgWUhctP"); Stripe.card.createToken( { number: cardNumber, cvc: card_cvc, exp_month: expiryMonth, exp_year: expiryYear, name: cardholderName, }, stripeCardResponseHandler ); } $(document).on( "click", '#credit-card-form button[type="submit"]', function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); onCreditCardSubmit(); } ); $(document).on("submit", "#credit-card-form", function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); }); $(document).on("click", "#start-freetrail-btn", function (e) { e.preventDefault(); onCreditCardSubmit(); }); function stripeCardResponseHandler(status, response) { var user = Parse.User.current(); if (user) { user.fetch().then(function (user) { var email = user.get("email"); $.ajax({ headers: { "X-Parse-Application-Id": PARSE_APP_ID, "X-Parse-REST-API-Key": PARSE_REST_API_KEY, "Content-Type": "application/json", }, type: "POST", dataType: "JSON", cache: true, url: Parse.serverURL + "/functions/addCard", data: JSON.stringify({ stripeToken: response.id, customerName: response.name, stripeCustomerId: user.get("stripeCustomerId"), email: email, }), success: function (jsonResult) { // preloader.hide(); // if (user_selected_plan !== "BusinessPlanLarge") { if (user_selected_plan !== "FreeProvider") { saveSubscription(); } else { localStorage.removeItem("signup-step1"); localStorage.removeItem("pricing_plan_selected"); localStorage.removeItem("summaryData"); window.location.href = window.location.origin + "/console"; } // } // else { // localStorage.removeItem("pricing_plan_selected"); // localStorage.removeItem("summaryData"); // localStorage.removeItem("signup-step1"); // window.location.href = window.location.origin + "/admin/index.html"; // } }, error: function (object, error) { preloader.hide(); alert("Your card was declined. Please verify your details"); return false; }, }); }); } } function saveSubscription() { var user = Parse.User.current(); user.fetch().then(function (user) { if (user && user_selected_plan && user_selected_plan !== "") { var amount = 27.5, email = user.get("email"), quantity = null, stripeCustomerId = user.get("stripeCustomerId"); amount = user_selected_plan !== "SoleProvider" ? user_selected_plan === "BusinessPlanSmall" ? 53.9 : 82.5 : 27.5; if ( user_selected_plan == "soleproviderannually" || user_selected_plan == "BusinessPlanSmallAnnually" || user_selected_plan == "BusinessPlanLargeAnnually" ) { amount = user_selected_plan !== "soleproviderannually" ? user_selected_plan === "BusinessPlanSmallAnnually" ? 541.2 : 884.4 : 277.2; } if (user_selected_plan === "BusinessPlanSmall") { user_selected_plan = "GrowthPlanMonthly"; } if (user_selected_plan === "BusinessPlanSmallAnnually") { user_selected_plan = "GrowthPlanAnnually"; } if (user_selected_plan == "BusinessPlanLarge") { user_selected_plan = "BusinessPlanSmall"; var addTechs = parseInt($(".total_technicians").val()) || 4; var total = 75 + (addTechs - 4) * 25, gst = total * 0.1; amount = total + Number(gst.toFixed(1)); } if (user_selected_plan == "BusinessPlanLargeAnnually") { user_selected_plan = "BusinessPlanSmallAnnually"; var addTechs = parseInt($(".total_technicians").val()); var total = (67 + (addTechs - 4) * 25) * 12, gst = total * 0.1; amount = total + Number(gst.toFixed(1)); } quantity = user_selected_plan == "BusinessPlanLargeVolume" || user_selected_plan == "BusinenessPlanTiredAnnually" ? parseInt($(".total_technicians").val()) : null; if (!stripeCustomerId) { alert("Please add a card to subscribe!"); } else { $.ajax({ headers: { "X-Parse-Application-Id": PARSE_APP_ID, "X-Parse-REST-API-Key": PARSE_REST_API_KEY, "Content-Type": "application/json", }, type: "POST", dataType: "JSON", cache: true, url: Parse.serverURL + "/functions/paidSubscription", data: JSON.stringify({ email: email, plan: user_selected_plan, stripeCustomerId: stripeCustomerId, token: "", }), success: function (jsonResult) { var paymentsObj = Parse.Object.extend("Payments"), payments = new paymentsObj(); payments.set("user", user); payments.set("subscriptionId", jsonResult.result.id); payments.set("customerId", jsonResult.result.customer); payments.set("plan", user_selected_plan); payments.set("amount", parseFloat(amount)); payments.save(null, { success: function () { user.set("isSubscriber", true); user.set("subscriberPlan", user_selected_plan); user.set("stripeCustomerId", jsonResult.result.customer); user.set("subscriptionId", jsonResult.result.id); user.save(null, { success: function () { localStorage.removeItem("signup-step1"); localStorage.removeItem("pricing_plan_selected"); localStorage.removeItem("summaryData"); window.location.href = window.location.origin + "/console"; }, error: function (object, error) { handleError(error); alert( e.message ? e.message : "Something went wrong, please try again" ); }, }); }, error: function (object, error) { preloader.hide(); alert("Something went wrong. Please try again later."); }, }); }, error: function (object, error) { preloader.hide(); var message = "Something went wrong. Please try again later."; if (object.responseJSON.error === "Already Subscribed") { message = "Already subscribed to this plan!"; } alert(message); return false; }, }); } } }); } function isValidNumber(number) { for (var i = 0; i <= number.length; i++) { if (isNaN(number[i])) { return true; } } return false; } $(document).on("click", ".skip-now-btn", function (e) { e.preventDefault(); localStorage.removeItem("signup-step1"); localStorage.removeItem("pricing_plan_selected"); localStorage.removeItem("summaryData"); window.location.href = window.location.origin + "/console"; }); $(document).on("click", "#select-plan-btn", function (e) { e.preventDefault(); if (!user_selected_plan) { alert("Please select a plan to proceed"); return false; } var user = Parse.User.current(); if (user) { $(".stripe-contact-name").html(user.get("companyName")); $(".stripe-contact-email").html(user.get("email")); } $(".step-2").hide(); $(".step-3, .signup-flow-1").show(); $("#start-freetrail-btn").prop("disabled", true); $("html").animate({ scrollTop: 0 }); }); $(document).on("click", ".plan-card", function () { var plan = $(this).data("plan"), plan_name_short = $(this).data("planname"), plan_interval = $(this).data("interval"), price = plan !== "SoleProvider" ? plan === "BusinessPlanSmall" ? "$49.00" : "$75.00" : "$25.00"; if (plan_interval == "yearly") { price = plan !== "soleproviderannually" ? plan === "BusinessPlanSmallAnnually" ? "$41.00" : "$67.00" : "$21.00"; } if (plan === "FreeProvider") { price = "$0.00"; } bindSummaryData(plan, plan_name_short, plan_interval, price); }); $(document).on("change", ".total_technicians", function () { $(".total_technicians").val(parseInt($(this).val())); showTotalPlanAmount(); }); function showTotalPlanAmount() { var addTechs = parseInt($(".total_technicians").val()) || 4; $("#tg1").is(":checked") || $("#tg").is(":checked") ? $(".BusinessPlanLarge.plan-header h5").html( "Pro $" + (67 + (addTechs - 4) * 25) + "/monthex GST" ) : $(".BusinessPlanLarge.plan-header h5").html( "Pro $" + (75 + (addTechs - 4) * 25) + "/monthex GST" ); $("#tg1").is(":checked") || $("#tg").is(":checked") ? $(".BusinessPlanLarge.plan-header p.cardCount").html( "$" + (67 + (addTechs - 4) * 25) + "/month" ) : $(".BusinessPlanLarge.plan-header p.cardCount").html( "$" + (75 + (addTechs - 4) * 25) + "/month" ); var price = $("#tg1").is(":checked") || $("#tg").is(":checked") ? 67 + (addTechs - 4) * 25 : 75 + (addTechs - 4) * 25; price = String(price).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); $(".plan-price").html("$" + price); $(".perMonthText").html( $("#tg1").is(":checked") || $("#tg").is(":checked") ? "month" : "month" ); } $(document).on("click", ".free-trail-btn, .priceSelectbtn", function (e) { e.preventDefault(); var plan = $(this).data("plan"), plan_name_short = $(this).data("planname"), plan_interval = $(this).data("interval"), price = plan !== "SoleProvider" ? plan === "BusinessPlanSmall" ? "$49.00" : "$75.00" : "$25.00"; if (plan_interval == "yearly") { price = plan !== "soleproviderannually" ? plan === "BusinessPlanSmallAnnually" ? "$41.00" : "$67.00" : "$21.00"; } if (plan === "FreeProvider") { price = "$0.00"; } if ( window.location.pathname === "/Signup-fixer/" || window.location.pathname === "/Signup-fixer/#" || window.location.pathname === "/Signup-fixer" ) { bindSummaryData(plan, plan_name_short, plan_interval, price); var user = Parse.User.current(); if (user) { $(".stripe-contact-name").html(user.get("companyName")); $(".stripe-contact-email").html(user.get("email")); } $(".step-2").hide(); $(".step-3").show(); $("#start-freetrail-btn").prop("disabled", true); $("html").animate({ scrollTop: 0 }); } else { var obj = { plan: plan, plan_name_short: plan_name_short, plan_interval: plan_interval, price: price, quantity: $(".total_technicians").val(), }; localStorage.setItem("pricing_plan_selected", plan); localStorage.setItem("summaryData", JSON.stringify(obj)); window.location.href = window.location.origin + "/Signup-fixer/"; } }); $(document).on("change", "#tg1", function () { if (!$("#tg1").is(":checked")) { $(".BusinessPlanLarge.plan-header h5").html( "Pro $75/monthex GST" ); $(".BusinessPlanLarge.plan-header p.cardCount").html( "$75/month" ); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("plan", "BusinessPlanLarge"); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("interval", "monthly"); } else { $(".BusinessPlanLarge.plan-header h5").html( "Pro $67/monthex GST" ); $(".BusinessPlanLarge.plan-header p.cardCount").html( "$67/month" ); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("plan", "BusinessPlanLargeAnnually"); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("interval", "yearly"); } var price = $("#tg1").is(":checked") ? "$67.00" : "$75.00"; $(".plan-price").html(price); $(".perMonthText").html($("#tg1").is(":checked") ? "month" : "month"); // if (user_selected_plan == "BusinessPlanLarge" || user_selected_plan == "BusinessPlanLargeAnnually") { // showTotalPlanAmount(); // } }); $(document).on("change", "#tg2", function () { if (!$("#tg2").is(":checked")) { $(".BusinessPlanSmall.plan-header h5").html( "Growth $49/monthex GST" ); $(".BusinessPlanSmall.plan-header p.cardCount").html( "$49/month" ); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("plan", "BusinessPlanSmall"); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("interval", "monthly"); } else { $(".BusinessPlanSmall.plan-header h5").html( "Growth $41/monthex GST" ); $(".BusinessPlanSmall.plan-header p.cardCount").html( "$41/month" ); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("plan", "BusinessPlanSmallAnnually"); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("interval", "yearly"); } var price = $("#tg2").is(":checked") ? "$41.00" : "$49.00"; $(".plan-price").html(price); $(".perMonthText").html($("#tg2").is(":checked") ? "month" : "month"); }); $(document).on("change", "#tg3", function () { if (!$("#tg3").is(":checked")) { $(".SoleProvider.plan-header h5").html( "Starter $25/monthex GST" ); $(".SoleProvider.plan-header p.cardCount").html( "$25/month" ); $( ".SoleProvider.plan-header .free-trail-btn, .SoleProvider.plan-header, .SoleProvider.plan-content" ).data("plan", "SoleProvider"); $( ".SoleProvider.plan-header .free-trail-btn, .SoleProvider.plan-header, .SoleProvider.plan-content" ).data("interval", "monthly"); } else { $(".SoleProvider.plan-header h5").html( "Starter $21/monthex GST" ); $(".SoleProvider.plan-header p.cardCount").html( "$21/month" ); $( ".SoleProvider.plan-header .free-trail-btn,.SoleProvider.plan-header, .SoleProvider.plan-content" ).data("plan", "soleproviderannually"); $( ".SoleProvider.plan-header .free-trail-btn,.SoleProvider.plan-header, .SoleProvider.plan-content" ).data("interval", "yearly"); } var price = $("#tg3").is(":checked") ? "$21.00" : "$25.00"; $(".plan-price").html(price); $(".perMonthText").html($("#tg3").is(":checked") ? "month" : "month"); }); $(document).on("change", "#tg", function () { if (!$("#tg").is(":checked")) { $("#tg1,#tg2,#tg3").prop("checked", false).change(); $(".SoleProvider.plan-header h5").html( "Starter $25/monthex GST" ); $(".SoleProvider.plan-header p.cardCount").html( "$25/month" ); $( ".SoleProvider.plan-header .free-trail-btn, .SoleProvider.plan-header, .SoleProvider.plan-content" ).data("plan", "SoleProvider"); $( ".SoleProvider.plan-header .free-trail-btn, .SoleProvider.plan-header, .SoleProvider.plan-content" ).data("interval", "monthly"); $(".BusinessPlanSmall.plan-header h5").html( "Growth $49/monthex GST" ); $(".BusinessPlanSmall.plan-header p.cardCount").html( "$49/month" ); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("plan", "BusinessPlanSmall"); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("interval", "monthly"); $(".BusinessPlanLarge.plan-header h5").html( "Pro $75/monthex GST" ); $(".BusinessPlanLarge.plan-header p.cardCount").html( "$75/month" ); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("plan", "BusinessPlanLarge"); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("interval", "monthly"); } else { $("#tg1,#tg2,#tg3").prop("checked", true).change(); $(".SoleProvider.plan-header h5").html( "Starter $21/monthex GST" ); $(".SoleProvider.plan-header p.cardCount").html( "$21/month" ); $( ".SoleProvider.plan-header .free-trail-btn,.SoleProvider.plan-header, .SoleProvider.plan-content" ).data("plan", "soleproviderannually"); $( ".SoleProvider.plan-header .free-trail-btn,.SoleProvider.plan-header, .SoleProvider.plan-content" ).data("interval", "yearly"); $(".BusinessPlanSmall.plan-header h5").html( "Growth $41/monthex GST" ); $(".BusinessPlanSmall.plan-header p.cardCount").html( "$41/month" ); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("plan", "BusinessPlanSmallAnnually"); $( ".BusinessPlanSmall.plan-header .free-trail-btn, .BusinessPlanSmall.plan-header, .BusinessPlanSmall.plan-content" ).data("interval", "yearly"); $(".BusinessPlanLarge.plan-header h5").html( "Pro $67/monthex GST" ); $(".BusinessPlanLarge.plan-header p.cardCount").html( "$67/month" ); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("plan", "BusinessPlanLargeAnnually"); $( ".BusinessPlanLarge.plan-header .free-trail-btn, .BusinessPlanLarge.plan-header, .BusinessPlanLarge.plan-content" ).data("interval", "yearly"); } // if (user_selected_plan == "BusinessPlanLarge" || user_selected_plan == "BusinessPlanLargeAnnually") { // showTotalPlanAmount(); // } // else { // var price = (user_selected_plan !== 'SoleProvider' && user_selected_plan !== 'soleproviderannually' ? '$49.00' : '$25.00'); // if ($("#tg").is(":checked")) { // price = (user_selected_plan !== 'soleproviderannually' ? "$41.00" : '$21.00'); // } // $('.plan-price').html(price); // $('.perMonthText').html(($("#tg").is(":checked") ? 'month' : 'month')); // } var price = user_selected_plan !== "SoleProvider" && user_selected_plan !== "soleproviderannually" ? "$49.00" : "$25.00"; if ($("#tg").is(":checked")) { price = user_selected_plan !== "soleproviderannually" ? "$41.00" : "$21.00"; } $(".plan-price").html(price); $(".perMonthText").html($("#tg").is(":checked") ? "month" : "month"); }); function bindSummaryData(plan, plan_name_short, plan_interval, price) { planAmount = ""; const startAt = moment().format("DD MMMM YYYY"), chargeAt = moment().add(1, "month").format("DD MMMM YYYY"); $(".startAt").html(startAt); $(".chargeAt").html(chargeAt); $(".plan-card,.cardTab").removeClass("active"); $(".plan-card.plan-header .free-trail-btn").removeClass("active"); $(".plan-card").removeClass("selected"); $("." + plan + ".plan-header").addClass("active selected"); $("." + plan + ".plan-content").addClass("selected"); $("." + plan + ".plan-header .free-trail-btn,.cardTab." + plan).addClass( "active" ); $(".plan-price").html(price); planAmount = price; $(".planNameLarge").html(plan_name_short + " Plan"); $(".planNameShort").html(plan_name_short); $(".plan-interval").html(plan_interval); $(".perMonthText").html(plan_interval == "yearly" ? "month" : "month"); user_selected_plan = plan; if ( user_selected_plan == "BusinessPlanLarge" || user_selected_plan == "BusinessPlanLargeAnnually" ) { var addTechs = parseInt($(".total_technicians").val()) || 4; price = $("#tg1").is(":checked") || $("#tg").is(":checked") ? 67 + (addTechs - 4) * 25 : 75 + (addTechs - 4) * 25; price = String(price).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); $(".plan-price").html("$" + price); $(".BusinessPlanLarge.plan-header h5").html( "Pro $" + price + "/monthex GST" ); $(".BusinessPlanLarge.plan-header p.cardCount").html( +price + "/month" ); } } function getGeoLocation(postcode) { var point = null; $.ajax({ async: false, url: "https://maps.googleapis.com/maps/api/geocode/json?address=" + postcode + "postcode Australia&key=AIzaSyBPqu5MB9GVqwwV4AjTzwnq9XFwlVcq20s", success: function (response) { if (response.results && response.results.length > 0) { point = new Parse.GeoPoint({ latitude: response.results[0].geometry.location.lat, longitude: response.results[0].geometry.location.lng, }); } }, }); return point; } function getLocationName(location) { if (location) { var address = null, geocodingAPI = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + location.latitude + "," + location.longitude + "&key=AIzaSyBPqu5MB9GVqwwV4AjTzwnq9XFwlVcq20s"; $.ajax({ type: "GET", async: false, url: geocodingAPI, success: function (json) { if (json.status === "OK") { address = json.results[0].formatted_address; return address; } }, }); return address; } else { return ""; } } $(document).on( "click", '#fixer-login-form button[type="submit"]', function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); var name = $("#fixer-login-form #form-field-fixer-yourname").val(); var mobile = $( "#fixer-login-form #form-field-fixer-mobilenumber" ).val(); var email = $("#fixer-login-form #form-field-fixer-email").val(); /*var postcode = $("#fixer-login-form #form-field-fixer-postcode").val();*/ var password = $("#fixer-login-form #form-field-fixer-password").val(); var refcode = $("#fixer-login-form #form-field-fixer-refcode").val(); var terms = $( '#fixer-login-form input[name="form_fields[fixer-terms]"]' ).is(":checked"); if (name == "") { alert("Please enter your name"); return false; } if (email == "") { alert("Please enter an email to sign up"); return false; } if (!validateEmail(email)) { alert("please enter a valid email address"); return false; } if (mobile.length < 8) { alert("Phone number should be 8-10 characters"); return false; } if (terms) { const register = new Parse.User(); register.setUsername(email); register.setPassword(password); register.set("name", name); register.set("email", email); register.set("userType", "Non-trader"); register.set("referredBy", refcode); register.set("postcode", fixerPostCode ? fixerPostCode : '2000'); register.set("mobileNumber", "+61" + mobile); register.set("location", getGeoLocation(fixerPostCode ? fixerPostCode : '2000')); $(this).attr("disabled", true); try { register.signUp(null, {}).then( function (user) { if (user.get("location")) { user.set( "locationName", getLocationName(user.get("location")) ); } user.save(); window.location.href = window.location.origin + "/console"; }, function (e) { console.log(e); alert( e.message ? e.message : "Something went wrong, please try again" ); $("#fixer-login-form #green-button").removeAttr("disabled"); } ); } catch (e) { alert("Something went wrong, please try again"); } } else { alert("Please read and accept the terms"); } } ); $(document).on("submit", "#fixer-login-form", function (e) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); }); $(".fancybox-click").fancybox({ buttons: [ "zoom", "slideShow", "fullScreen", "download", "thumbs", "close", ], }); getTradeTypes("form-field-tradesCheckList1"); // About tabs $(".mission-active").click(function () { $(".tab1").show(); $(".tab2, .tab3, .tab4").hide(); }); $(".about-active").click(function () { $(".tab2").show(); $(".tab1, .tab3, .tab4").hide(); }); $(".team-active").click(function () { $(".tab3").show(); $(".tab1, .tab2, .tab4").hide(); }); $(".whyfif-active").click(function () { $(".tab4").show(); $(".tab1, .tab2, .tab3").hide(); }); // services tabs $(".serviceprovider-tab").click(function () { $(".faq-serviceprovidersection").show(); $(".faq-customersection").hide(); }); $(".customer-tab").click(function () { $(".faq-customersection").show(); $(".faq-serviceprovidersection").hide(); }); $(".active-tabs .active p").addClass("active"); $(".active-tabs p").click(function () { $(".active-tabs p.active").removeClass("active"); $(this).addClass("active"); }); // login-forgot tabs $(".forgot-link").on("click", function () { $(".login-section").hide(); $(".forgot-section").show(); }); $(".login-link").on("click", function () { $(".login-section").show(); $(".forgot-section").hide(); }); // features tabs $(".fspb-active").on("click", function () { $(".fcustomer-section").css("display", "none"); $(".fspb-section").css("display", "inherit"); }); $(".fcustomer-active").on("click", function () { $(".fcustomer-section").css("display", "inherit"); $(".fspb-section").css("display", "none"); }); $(document).on( "click", ".video-player .elementor-custom-embed-image-overlay", function (e) { e.preventDefault(); var video = $(this) .closest(".video-player") .find(".elementor-video-iframe"); var newSourceUrl = video[0].src.replace("&autoplay=0", ""); video[0].src = newSourceUrl + "&autoplay=1"; $(this).hide(); } ); $(document).on("click", "#mobileLink", function (event) { $(".sms-new-message").html("").removeClass("sms-new-message-success"); $(".sms-new-message").removeClass("sms-new-message-error"); $(".textLink").prop("disabled", false); }); $(document).on("click", ".textLink", function (event) { var mobileNumber = $("#mobileLink").val(); var eventId = $(event.currentTarget).attr("id"); console.log("eventId", eventId); if (mobileNumber) { var item = {}; item.mobileNumber = mobileNumber; item.appType = "consumerApp"; console.log(item); var isNumbers = /^[0-9]+$/; if (mobileNumber.match(isNumbers) === null) { $(".sms-new-message") .html( 'icon Please enter a valid mobile phone number' ) .addClass("sms-new-message-error"); $(".textLink").prop("disabled", false); return false; } $(".textLink").prop("disabled", true); $.ajax({ headers: { "X-Parse-Application-Id": PARSE_APP_ID, "X-Parse-REST-API-Key": PARSE_REST_API_KEY, "Content-Type": "application/json", }, type: "POST", dataType: "JSON", cache: true, url: Parse.serverURL + "/functions/inviteViaSms", data: JSON.stringify({ mobileNumber: mobileNumber, appType: "consumerApp", page: eventId && eventId === "googleAdsLink" ? "googleAds" : "signup", }), success: function (e) { $("#mobileLink").val(""); $(".sms-new-message") .html( 'icon Text message has been sent' ) .addClass("sms-new-message-success"); $(".textLink").prop("disabled", false); }, error: function (object, error) { $(".sms-new-message") .html( 'icon Please enter a valid mobile phone number' ) .addClass("sms-new-message-error"); $(".textLink").prop("disabled", false); }, }); } else { $(".sms-new-message") .html( 'icon Please enter a valid mobile phone number' ) .addClass("sms-new-message-error"); $(".textLink").prop("disabled", false); return false; } }); $(".headerContentToggle").removeClass("active"); $("#bookAJob").addClass("active"); $(".provideAService img").hide(); $(document).on("click", ".provideservice.headerContentToggle", function (event) { event.preventDefault(); $("#hideForProvideService").css("display", "none"); }); $(document).on("click", ".bookJob.headerContentToggle", function (event) { event.preventDefault(); $("#hideForProvideService").css("display", "show"); }); $(document).on("click", ".headerContentToggle", function (event) { var id = $(event.currentTarget).attr("id"); $(".provideAService").css("display", "none"); $(".headerContentToggle").removeClass("active"); if (id === "bookAJob") { $("#bookAJob").addClass("active"); $(".bookAJob").show(); $(".provideAService").hide(); $(".home-banner-image").css( "background-image", 'url("https://www.fixitfaster.com/wp-content/uploads/2020/09/Banner1-2x.png")' ); $(".find-a-service-img").css('display', 'block'); $(".find-a-service-btns").css('display', 'block'); $(".provide-a-service-img").css('display', 'none'); $(".select-job #bookAJob").addClass("active"); $(".provideAService img").hide(); $(".bookAJobImg img").show(); $(".select-job #bookAJob").css({ "font-weight": "700", "color": "#593798", "background-color": "#fff", "border": "1px solid #fff", }); } else { $(".home-banner-image").css( "background-image", 'url("https://www.fixitfaster.com/wp-content/uploads/2020/09/Banner2-2x.png")' ); $(".select-job #provideAService").addClass("active"); $(".find-a-service-img").css('display', 'none'); $(".select-job #bookAJob").css({ "font-weight": "inherit", "color": "#fff", "background-color": "inherit", "border": "1px solid #fff", }); $(".provide-a-service-img").css('display', 'block'); $(".find-a-service-btns").css('display', 'none'); $(".provideAService img").show(); $(".bookAJobImg img").hide(); $("#provideAService").addClass("active"); $(".provideAService").show(); $(".bookAJob").hide(); } }); $(document).on("click", ".userSignupType", function () { $(".signupType").show().addClass("active"); }); $(document).on("click", ".userSignupType-close", function () { $(".signupType").hide().removeClass("active"); }); }); function validateEmail(email) { var reg = /^((\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)\s*[,]{0,1}\s*)+$/; return reg.test(email); } function validatePassword(password) { var regEx = /^(?=.*[a-z])(?=.*[A-Z])(?=.{8,})/; return regEx.test(password); } // Common Height $(function () { return $(".common-text-height").matchHeight(); }); $(function () { return $(".advice-article").matchHeight(); }); $(function () { return $(".featres-work-height").matchHeight(); }); $(function () { return $(".block-image").matchHeight(); }); $(function () { return $("#blog-content-section").matchHeight(); }); $(function () { return $(".commonHeight").matchHeight(); }); $(function () { return $(".img-height").matchHeight(); }); $(function () { return $(".video-block").matchHeight(); }); $(function () { return $(".common-img-height").matchHeight(); }); $(function () { return $(".equalheight-text").matchHeight(); }); $(function () { return $(".homedemandText").matchHeight(); }); if ($(window).width() > 768) { $(function () { return $(".testimonial-item").matchHeight(); }); } $(".elementor-tab-title").on("click", function (event) { if ($(event.currentTarget)[0].innerText === "Business") { getTradeTypes("form-field-tradesCheckList1"); } else { getTradeTypes("form-field-tradesCheckList2"); } }); //Preloader var preloader = $(".preloader"); $(window).load(function () { preloader.hide(); if (localStorage.getItem("summaryData") == null) { $("#tg,#tg1,#tg2,#tg3").prop("checked", true).change(); } }); var owl = $(".owl-carousel"); owl.owlCarousel({ stagePadding: 70, margin: 30, nav: true, loop: true, mouseDrag: true, touchDrag: true, pullDrag: true, freeDrag: false, responsiveClass: true, responsive: { 0: { items: 1, }, 600: { items: 1, }, 700: { items: 1, }, 900: { items: 3, }, }, }); //Scroll Menu $(window).on("scroll", function () { if (!$(".main-nav").hasClass("landing-page-nav")) { if ($(window).scrollTop() > 10) { $(".main-nav").addClass("navbar-top"); } else { $(".main-nav").removeClass("navbar-top"); } } }); // Navigation Scroll /* $(window).scroll(function (event) { Scroll(); });*/ $(".navbar-collapse ul li a").on("click", function () { if ($(this.hash).offset()) { $("html, body").animate( { scrollTop: $(this.hash).offset().top - 75 }, 1000 ); return false; } }); $("#tohash").on("click", function () { if ($(this.hash).offset()) { $("html, body").animate( { scrollTop: $(this.hash).offset().top - 75 }, 1000 ); return false; } }); //Download app popup /*$('.Download-Modallink').on('click', function () { $('.getAppBtn a').click(); });*/ $(".Download-Modallink").on("click", function () { $(".downloadModal-section").addClass("active"); $(".sms-new-message").html("").removeClass("sms-new-message-success"); $(".sms-new-message").removeClass("sms-new-message-error"); }); $(".downloadAppDevice").on("click", function () { if ($(window).width() >= 992) { $(".downloadModal-section").addClass("active"); $(".sms-new-message").html("").removeClass("sms-new-message-success"); $(".sms-new-message").removeClass("sms-new-message-error"); } else { window.open("https://pkeb3.app.link/fB2ceQoMqjb"); } }); $(".getAppBtn a, .readysect h2").on("click", function () { $(".downloadModal-section").addClass("active"); }); $(".close-img img").on("click", function () { $(".downloadModal-section").removeClass("active"); $(".textLink").removeAttr("id"); }); $(".simPRO-watch").on("click", function () { $(".simPRO-videolink a").click(); console.log("helo simpor"); }); $(".contenttwo").on("click", function () { $(".imgone, .imgthree").css("display", "none"); $(".imgtwo").css("display", "inherit"); console.log("contenttwo"); }); $(".contentthree").on("click", function () { $(".imgone, .imgtwo").css("display", "none"); $(".imgthree").css("display", "inherit"); console.log("contentthree"); }); $(".contentone").on("click", function () { $(".imgtwo, .imgthree").css("display", "none"); $(".imgone").css("display", "inherit"); console.log("contentone"); }); $(".bannerVideoLink").on("click", function () { $(".geo-videolink a").click(); }); /*$('.geo-watch').on('click', function () { $('.geo-videolink a').click(); console.log('helo geo'); });*/ // User define function /* function Scroll() { let contentTop = []; let contentBottom = []; let winTop = $(window).scrollTop(); let rangeTop = 200; let rangeBottom = 500; $('.navbar-collapse').find('.scroll a').each(function () { if ($($(this).attr('href')).offset().top) { let top = ($($(this).attr('href')).offset() || {"top": NaN}).top; if (isNaN(top)) { contentTop.push($($(this).attr('href')).offset().top); contentBottom.push($($(this).attr('href')).offset().top + $($(this).attr('href')).height()); } } }); $.each(contentTop, function (i) { if (winTop > contentTop[i] - rangeTop) { $('.navbar-collapse li.scroll') .removeClass('active') .eq(i).addClass('active'); } }) };*/ //Initiat WOW JS new WOW().init(); $(".services li").on("click", function () { $(this).parent().find("li.active").removeClass("active"); $(this).addClass("active"); }); $(document).ready(function () { $(".cardTab").click(function () { $(".cardTab").removeClass("active"); // $(".cardTab").addClass("active"); // instead of this do the below $(this).addClass("active"); }); }); /*AnimatedTabs*/ (function () { [].slice.call(document.querySelectorAll(".tabs")).forEach(function (el) { new Animatedtabs(el); }); })(); /*Video Player*/ $(".video-play").on("click", function (e) { e.preventDefault(); let vidWrap = $(this).parent(), iframe = vidWrap.find(".video iframe"), iframeSrc = iframe.attr("src"), iframePlay = (iframeSrc += "?autoplay=1"); vidWrap.children(".video-thumbnail").fadeOut(); vidWrap.children(".video-play").fadeOut(); vidWrap.find(".video iframe").attr("src", iframePlay); }); function getTradeTypes(ele) { var Trades = Parse.Object.extend("Trades"), query = new Parse.Query(Trades); query.ascending("name"); query.select("name"); query.limit(1000); query.find().then( function (results) { tradesResultsObject = results; var tags = []; for (var i = 0; i < results.length; i++) { var object = results[i]; mapObject[object.id] = object.get("name"); tradeObjects[object.get("name")] = object.id; tags.push(object.get("name")); } if (ele) { renderTradesList($("#" + ele)); } }, function (error) { showNetworkConnectionMessage(error); } ); } function renderTradesList(ele) { var tags = []; for (var i = 0; i < tradesResultsObject.length; i++) { var object = tradesResultsObject[i]; tags.push(object.get("name")); } // don't navigate away from the field on tab when selecting an item ele.on("keydown", function (event) { if ( event.keyCode === $.ui.keyCode.TAB && $(this).autocomplete("instance").menu.active ) { event.preventDefault(); } }); ele.autocomplete({ minLength: 0, source: function (request, response) { // delegate back to autocomplete, but extract the last term response($.ui.autocomplete.filter(tags, extractLast(request.term))); }, search: function () { // custom minLength var term = extractLast(this.value); if (term.length < 1) { return false; } }, focus: function () { // prevent value inserted on focus return false; }, select: function (event, ui) { var terms = split(this.value); // remove the current input terms.pop(); // add the selected item if (terms.length < 3) { terms.push(ui.item.value); } else { showAlertMessage("Please select only three trade types!"); } // add placeholder to get the comma-and-space at the end terms.push(""); this.value = terms; return false; }, }); ele.trigger("create"); } function extractLast(term) { return split(term).pop(); } function split(val) { return val.split(/,\s*/); } function getURLParam(name, url) { if (!url) { url = window.location.href; } var results = new RegExp("[\\#&]" + name + "/([^&#]*)").exec(url); if (!results) { return undefined; } return results[1] || undefined; } /*$(document).on('click', '.navbar-toggle', function () { if($(window).width() < 768){ setTimeout(function() { $('.navbar-collapse').css('height',$(window).height()); },400); } });*/ $(document).on("click", "#navToContact", function () { if (logInEmail && LogInPassword) { Parse.User.logIn(logInEmail.toLowerCase(), LogInPassword).then( function (user) { if (user) { if (user.get("isActive") === false) { user.set("isActive", true); user.save(null, { success: function () { window.location.href = window.location.origin + "/console"; }, error: function (object, error) { handleError(error); alert( e.message ? e.message : "Something went wrong, please try again" ); }, }); } else { window.location.href = "https://www.fixitfaster.com/contact/"; } } }, function (e) { alert( e.message ? e.message : "Something went wrong, please try again" ); } ); } //window.location.href = "https://www.fixitfaster.com/contact/"; }); }); function removeSpace(event) { var k = event ? event.which : window.event.keyCode; if (k == 32) return false; } $(document).on("click", '#SignupFacility button[type="submit"]', function (e) { var name = $("#SignupFacility #form-field-fixer-business-name").val(), email = $("#SignupFacility #fixer_email").val(), password = $("#SignupFacility #fixer_password").val(), referral = $("#SignupFacility #fixer_referral").val(), list = []; var reg = /^((\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)\s*[,]{0,1}\s*)+$/; if (name === "") { alert("Please enter your business name"); return false; } if (email === "") { alert("Please enter an email to sign up"); return false; } if (!reg.test(email)) { alert("please enter a valid email address"); return false; } if (password === "") { alert("Password enter your password"); return false; } if (password !== "" && password.length < 6) { alert("Password should be at least 6 characters"); return false; } var userObj = new Parse.User(); userObj.setUsername(email.toLowerCase()); userObj.setPassword(password); userObj.set("email", email.toLowerCase()); userObj.set("name", name); userObj.set("userType", "Non-trader"); if (referral) { userObj.set("referredBy", referral); } userObj.signUp(null, { success: function (user) { if (user) { list.push(user.id); $.ajax({ headers: { "X-Parse-Application-Id": PARSE_APP_ID, "X-Parse-REST-API-Key": PARSE_REST_API_KEY, "Content-Type": "application/json", }, type: "POST", dataType: "JSON", cache: true, url: Parse.serverURL + "/functions/makeModerator", data: JSON.stringify({ usersList: list, isPropertyManager: true, }), success: function () { window.location.href = window.location.origin + "/console"; list = []; }, error: function (jqXHR, textStatus, errorThrown) { alert(errorThrown); return false; }, }); } }, error: function (object, error) { if (error.code === 202) { var userquery = new Parse.Query(Parse.User); userquery.equalTo("email", object.get("email")); userquery.find().then(function (currentuser) { if (currentuser.length > 0) { if (currentuser[0].get("isActive") === false) { Parse.User.logOut(); alert( "Your account is deactivated Please contact administrator at team@fixitfaster.com to re-activate." ); } else { alert("An account already exists with this email address."); } } }); } else { alert(error.message ? error.message : "Please try again later."); $(this).attr("disabled", false); } return false; }, }); }); function showSuggestions(id) { var jobResidencyAddress = document.getElementById(id); var options = { componentRestrictions: { country: "au", }, }; autocomplete = new google.maps.places.Autocomplete( jobResidencyAddress, options ); google.maps.event.addListener(autocomplete, "place_changed", function () { preferredLocation = []; var place = autocomplete.getPlace(); var data = { "id": place.place_id, "addressString": place.formatted_address, "locationLatLng": { "latitude": place.geometry.location.lat(), "longitude": place.geometry.location.lng() }, "type": "Preferred Location" } preferredLocation.push(data) isAddressChanged = !place.geometry; for (var i = 0; i < place.address_components.length; i++) { for (var j = 0; j < place.address_components[i].types.length; j++) { if ( place.address_components[i].types[j] === "postal_code" && place.address_components[i].long_name ) { fixerPostCode = place.address_components[i].long_name; } } for (var j = 0; j < place.address_components[i].types.length; j++) { if ( place.address_components[i].types[j] === "administrative_area_level_1" && place.address_components[i].short_name ) { $("#propertyState").val(place.address_components[i].short_name); } } } }); setTimeout(function () { $(".pac-container").prependTo(".geo-autocomplete"); }, 500); } var PARSE_APP_ID = "dDCLItKaPqINj7AJSVk1k87AybNmVDqa9V1bEkvx", PARSE_REST_API_KEY = "kdMNLpGfphAgPpA5iN4rSnxq4cLKn6WXs74aq3OF", PARSE_JS_KEY = "mmPb4Iwr7f34fPH2Wk0DtzfwPmAYF6XD6fSTFxFT", tradesResultsObject = "", mapObject = [], tradeObjects = [], newlogin = "", userlink = "", planAmount = "", isExistingUser = false, pricing_plan_selected = null, user_selected_plan = null, logInEmail, preferredLocation =[], LogInPassword, fixerPostCode = '';