var login = (function() {
var login_Global = {};
var loginDom = document.getElementById('login-text_login');
var loginDomMob = document.getElementById('mob_icon_login');
var loggedIn = false;
var loggingInOrOut = false;
var openModal = false;
var whatIs = document.querySelector(".woo_whatIsWooID_login");
var forgotPass = document.querySelector(".forgot_pass_login");
function forgotPass_login(){
woo.updateCurrentPage("forgot-password");
}
function whatIsClick_login(){
var note = "What is the Woo ID? With a growing awareness of on-line privacy and security issues, further tightening of the spam laws worldwide and the need for businesses to have more robust collection of data systems in place, Woo has risen to the challenge by creating a universal ID for users on the platform - called a Woo ID.
The Woo ID provides you with the security that Woo is dedicated, and bound by law, to ensure your information is kept private and that all anti-spam laws are adhered to. Every user added to a Woo website gets to verify their email address. This ensures issues with data entry and out-of-date email accounts are spotted early.
The Woo ID universal ID is the market leader: creating a safe and spam free environment for you.
Read more about Woo and their Privacy Policy
";
var message = $("" + note + "
OK
")
.appendTo("body").slideDown('normal');
$(message).click(function(){
$(this).slideUp('normal', function(){
$(this).remove();
});
});
}
function closeButtonPressed_login(){
$(".woo-dialogBox").hide();
loggingInOrOut = false;
openModal = false;
}
function makeModal_login(content){
openModal = true;
var dialogBox = document.createElement('div');
dialogBox.className = "woo-dialogBox";
document.getElementsByClassName("wooMainContent")[0].appendChild(dialogBox);
var closeBox = document.createElement('button');
closeBox.className = 'woo-dialogClose';
closeBox.classList.add('material-symbols-outlined');
closeBox.addEventListener('click', closeButtonPressed_login);
var dialogContent = document.createElement('div');
dialogContent.className = "woo-dialogContent";
dialogContent.appendChild(closeBox);
dialogContent.appendChild(content);
dialogBox.appendChild(dialogContent);
}
function login_login(usernameElem, passwordElem){
woo.execLogin(usernameElem.value, passwordElem.value).then(() => {
$(".woo-dialogBox").hide();
openModal = false;
}).catch((error) => {
loggingInOrOut = false;
//alert("User name or password is incorrect. Please try again.");
$(".wooMainContent #woo_loginErrorMessage").css("display", "block");
});
}
function register_login(){
woo.updateCurrentPage("register");
}
function loginOnClick_login(){
if (loggingInOrOut == false) {
loggingInOrOut = true;
if (!loggedIn){
if ($(".woo-dialogBox").length){
$(".woo-dialogBox").show();
} else {
var signinModal = document.querySelector("#signinModal_login");
var usernameInput = document.querySelector("#wooUsername_login");
var passwordInput = document.querySelector("#wooPassword_login");
document.querySelector(".woo_logIn_login").addEventListener('click', login_login.bind(this, usernameInput, passwordInput));
document.querySelector(".woo_signUp_login").addEventListener('click', register_login.bind(this));
makeModal_login(signinModal);
}
} else {
woo.execLogout();
}
}
}
function changeLoginState_login(loginState){
if(!loginState){
loggedIn = false;
loginDom.innerHTML = "login";
loginDomMob.innerHTML = "lock";
}
else {
loggedIn = true;
loginDom.innerHTML = "logout";
loginDomMob.innerHTML = "lock_open";
}
}
function addEventListeners_login() {
if (woo.sessionData != null){
changeLoginState_login(true);
}
else {
changeLoginState_login(false);
}
loginDomMob.addEventListener('click', loginOnClick_login, false);
loginDom.addEventListener('click', loginOnClick_login, false);
whatIs.addEventListener('click', whatIsClick_login, false);
forgotPass.addEventListener('click', forgotPass_login, false);
}
addEventListeners_login();
login_Global.unload = () => {
//Unload callbacks here
loginDomMob.removeEventListener('click', loginOnClick_login, false);
loginDom.removeEventListener('click', loginOnClick_login, false);
whatIs.removeEventListener('click', whatIsClick_login, false);
forgotPass.removeEventListener('click', forgotPass_login, false);
//document.querySelector(".woo_logIn_login").removeEventListener('click', login_login);
//document.querySelector(".woo_signUp_login").removeEventListener('click', register_login);
console.log("Unloaded login");
}
return login_Global;
})(); var gkxwvsqf_202494191142__309_646 = (function() {
var self = document.getElementById('gkxwvsqf_202494191142__309_646');
var email = document.getElementById('contactEmailAddress');
var number = document.getElementById('contactNumber');
var firstName = document.getElementById('enquiryFirstName');
var lastName = document.getElementById('enquiryLastName');
var formSubmit = document.getElementById('contactSubmit');
var gkxwvsqf_202494191142__309_646_Global = {};
function getExtraData() {
return new Promise((resolve, reject) => {
var inputs = $('#gkxwvsqf_202494191142__309_646 input, #gkxwvsqf_202494191142__309_646 textarea, #gkxwvsqf_202494191142__309_646 select')
.not(':input[type=button], :input[type=submit], :input[type=reset], #contactEmailAddress, #contactNumber, #enquiryFirstName, #enquiryLastName, #enquiryLastName');
var enquiryText = "";
$(inputs).each(function() {
if (this.type == "text" || this.type == "textarea" || this.type == "select-one"){
if ( this.type == "select-one" && this.value == "none"){
alert("Please choose an option for '" + this.name + "'!");
resolve("select option issue");
}
enquiryText = enquiryText + "\n" + this.name + ": " + this.value + "\n";
} else if (this.checked) {
enquiryText = enquiryText + "\n" + this.name + ": " + this.value + "\n";
}
});
resolve(enquiryText);
}).catch((error) => {
console.error("Error in content method:", error);
reject("");
});
}
function submitButtonPressed() {
var emailAddress = email.value;
var numberVal = number.value;
var firstNameVal = firstName.value;
var lastNameVal = lastName.value;
if (emailAddress != "" && numberVal != "" && firstNameVal != "" && lastNameVal != ""){
$("#contactLoadWait").css({"zIndex": "10000000", "display": "flex"});
getExtraData().then((enquiryText) => {
if (enquiryText != "select option issue"){
contact(firstNameVal, lastNameVal, numberVal, emailAddress, enquiryText).then((response) => {
console.log(response);
$("form").hide();
$("#contactLoadWait").hide();
var responseDiv = document.createElement('div');
responseDiv.innerHTML = `Thank you for contacting us.
If you need further help, please do not hesitate to call us.
`;
self.appendChild(responseDiv);
return woo.checkEmail(emailAddress);
}).then((response) => {
console.log(response);
if (response && response.ok == true){
var registerData = {
"name": firstNameVal,
"lastName": lastNameVal,
"email": emailAddress,
"password": "",
"confirmPassword": ""
}
return woo.register(registerData);
} else {
return false;
}
}).then((response) => {
console.log(response);
if (response == false){
console.log("Not Registered");
}
}).catch((error) => {
console.log(error);
$("#contactLoadWait").hide().css("zIndex", "1");
//alert("Something went wrong");
});
} else {
$("#contactLoadWait").hide().css("zIndex", "1");
}
});
} else {
alert("Opps! Its seems you have not filled in all the required fields:\n\nFirst Name\nLast Name\nPhone\nEmail");
}
}
function contact(firstNameVal, lastNameVal, numberVal, emailAddress, enquiryText) {
return $.ajax({
type: "POST",
url: woo.getAuthServer() + "/mailer/enquiry",
headers: {
"Content-Type": "application/json"
},
crossDomain: true,
cache: false,
data: JSON.stringify({
"firstName": firstNameVal,
"lastName": lastNameVal,
"number": numberVal,
"emailAddress": emailAddress,
"enquiryString": enquiryText
}),
timeout: 10000
});
}
function addEventListeners() {
formSubmit.addEventListener('click', submitButtonPressed);
}
addEventListeners();
gkxwvsqf_202494191142__309_646_Global.unload = () => {
//Unload callbacks here
formSubmit.removeEventListener('click', submitButtonPressed);
console.log("Unloaded gkxwvsqf_202494191142__309_646");
}
return gkxwvsqf_202494191142__309_646_Global;
})();