$(document).ready(function () { /* * This file is used for all the common scripting changes required * throughout the application. */ //for UTM TAG implementation var fullUrl = window.location.href; console.log(fullUrl); $(".legal-popup").load("../QuoteAndBuy/jsp/legal-info.html"); //$(".header-popup").load("../QuoteAndBuy/jsp/header-popup.jsp"); //$(".header-banner").load("../QuoteAndBuy/jsp/header.jsp"); $(".englishButton").on("click", function(){ if(fullUrl.includes("renewPolicyDetails.do")){ window.location.replace(fullUrl.substr(0,fullUrl.lastIndexOf("&"))); } else{ window.location.replace(fullUrl.substr(0,fullUrl.lastIndexOf("?"))); } }); $(".arabicButton").on("click", function(){ if(fullUrl.includes("renewPolicyDetails.do")){ window.location.replace(fullUrl+"&Lang=A"); } // 02.11.2021 UTM tag implementation starts else if(fullUrl.includes("?")) { var index=fullUrl.indexOf("?"); var temp1=fullUrl.substring(0,index); var temp2=fullUrl.substring(index+1); if(temp2=="?Lang=A") { window.location.replace(temp1+"?Lang=A"); } else { window.location.replace(temp1+"?Lang=A&"+temp2); } } else { window.location.replace(fullUrl+"?Lang=A"); } }); $("#requestCallback").click(function() { $("#iconHelp").modal('hide'); $("#requestCallbackModal").modal('show'); $(".modal-backdrop").addClass("modal-bg-backdrop"); }); $("body").on("click", "#icon-help-mob", function() { $(".iconHelp").height(window.innerHeight - 72); }); $("body").on("click", "#icon-help", function() { $(".iconHelp").height(window.innerHeight - 120); }); /*$('.retrieveQuoteButtonMobile').click(function(){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModal').find('.modal-body p').html(navMsg); $('#navigationModal').modal('show'); $('#iconHelp').modal('hide'); return false; }); $("#retrieveQuoteDesktop").click(function(){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModal').find('.modal-body p').html(navMsg); $('#navigationModal').modal('show'); return false; });*/ $('.quoteAndBuyButton').click(function(){ if($("span").hasClass("untrackChanges")){ window.location.href = contextPathUrl+"/BasicInfo.do"; $(".loading-container").show(); $("body").addClass("show-loader"); }else{ if($("span").hasClass("trackChanges")){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModalQuoteAndBuy').find('.modal-body p').html(navMsg); $('#navigationModalQuoteAndBuy').modal('show'); $('#iconHelp').modal('hide'); return false; } } }); $('.retrieveQuoteButton').click(function(){ if($("span").hasClass("untrackChanges")){ window.location.href = contextPathUrl+"/loadRetrieveQuote.do"; $(".loading-container").show(); $("body").addClass("show-loader"); }else{ if($("span").hasClass("trackChanges")){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModal').find('.modal-body p').html(navMsg); $('#navigationModal').modal('show'); $('#iconHelp').modal('hide'); return false; } } }); $("#yes").click(function () { window.location = contextPathUrl+"/loadRetrieveQuote.do"; $(".loading-container").show(); $("body").addClass("show-loader"); }); $('.renewPolicyButton').click(function(){ if($("span").hasClass("untrackChanges")){ window.location.href = "https://motor.livainsurance.om/en/direct/renewal/retrieve/"; $(".loading-container").show(); $("body").addClass("show-loader"); }else{ if($("span").hasClass("trackChanges")){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModalRenewal').find('.modal-body p').html(navMsg); $('#navigationModalRenewal').modal('show'); $('#iconHelp').modal('hide'); return false; } } }); //Kaizen ADM - Release 8.0 - RequestId-#TBA - Transfer Policy changes -- STARTS $('.transferPolicyButton').click(function(){ console.log("Transfer"); window.location.href = contextPathUrl+"/loadTransferPolicy.do"; }); //Kaizen ADM - Release 8.0 - RequestId-#TBA - Transfer Policy changes -- ENDS //Kaizen ADM - Release 8.3 - RequestId-#75073 - Cancel Policy changes -- STARTS $('.cancelPolicyButton').click(function(){ window.location.href = contextPathUrl+"/loadCancelPolicy.do"; }); //Kaizen ADM - Release 8.3 - RequestId-#75073 - Cancel Policy changes -- ENDS /*$('.renewPolicyButtonMob').click(function(){ window.location.href = contextPathUrl+"/loadRenewPolicy.do"; $(".loading-container").show(); $("body").addClass("show-loader"); }); $('.renewPolicyButtonMobile').click(function(){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModalRenewal').find('.modal-body p').html(navMsg); $('#navigationModalRenewal').modal('show'); $('#iconHelp').modal('hide'); return false; }); $("#renewPolicyDesktop").click(function(){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModalRenewal').find('.modal-body p').html(navMsg); $('#navigationModalRenewal').modal('show'); return false; });*/ $("#yesForRenew").click(function () { window.location.href = "https://motor.livainsurance.om/en/direct/renewal/retrieve/"; $(".loading-container").show(); $("body").addClass("show-loader"); }); $("#yesForQuoteAndBuy").click(function () { window.location.href = contextPathUrl+"/BasicInfo.do"; $(".loading-container").show(); $("body").addClass("show-loader"); }); $('.goBackStep1').click(function() { var isPartner = $("#isPartner").val(); var partnerId = $("#partnerId").val(); if(isPartner=='true'){ document.quoteCoverForm.action=contextPathUrl+"/"+partnerId+"/homePage.do"; }else{ document.quoteCoverForm.action=contextPathUrl+"/homePage.do"; } document.quoteCoverForm.submit(); return true; }); $('.goBackMFToStep1').click(function() { var isPartner = $("#isPartner").val(); var partnerId = $("#partnerId").val(); if(isPartner=='true'){ document.yourDetailsForm.action=contextPathUrl+"/"+partnerId+"/homePage.do"; }else{ document.yourDetailsForm.action=contextPathUrl+"/homePage.do"; } document.yourDetailsForm.submit(); return true; }); $('.pageLogo').click(function(){ if($("a").hasClass("homeSite")){ window.location.href = 'https://livainsurance.om/'; }else{ if($("a").hasClass("goTohomeSite")){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModalHome').find('.modal-body p').html(navMsg); $('#navigationModalHome').modal('show'); return false; } } }); $('.pageHome').click(function(){ if($("a").hasClass("homeSite")){ window.location.href = 'https://livainsurance.om/'; }else{ if($("a").hasClass("goTohomeSite")){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModalHome').find('.modal-body p').html(navMsg); $('#navigationModalHome').modal('show'); return false; } } }); /*$('.goTohomeSite').click(function(){ var navMsg = "Are you sure you want to leave this page ? Leaving this page may result in loss of data of all unsaved data."; $('#navigationModalHome').find('.modal-body p').html(navMsg); $('#navigationModalHome').modal('show'); return false; });*/ $("#yesForHome").click(function () { window.location.href = 'https://livainsurance.om/'; }); $('#branchNearYou').click(function() { window.open('https://livainsurance.om/contact-us','_blank'); }); $('#policyWordings').click(function() { var isPartner = $("#isPartner").val(); var policyWordingsURL = $("#partnerPolicyWordings").val(); if(isPartner == 'true'){ window.open(policyWordingsURL,'_blank'); }else{ window.open('https://livainsurance.om/sites/default/files/2023-10/Liva-Unified-Motor-Vehicle-Insurance-Policy-Eng.pdf','_blank'); } }); $('#faqLink').click(function() { window.open('https://livainsurance.om/faq','_blank'); }); });