var woo_appProperties = (function() {
var woo_appProperties_Global = {};
var self = document.getElementById('woo_appProperties');
self.classList.add("woo-ui-gadget");
woo_appProperties_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded woo_appProperties");
}
return woo_appProperties_Global;
})();var gkxwvsqf_20248415557__820_857 = (function() {
var self = document.getElementById('gkxwvsqf_20248415557__820_857');
var gkxwvsqf_20248415557__820_857_Global = {};
gkxwvsqf_20248415557__820_857_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_20248415557__820_857");
}
return gkxwvsqf_20248415557__820_857_Global;
})();var gkxwvsqf_202494204618_139 = (function() {
var self = document.getElementById('gkxwvsqf_202494204618_139');
var gkxwvsqf_202494204618_139_Global = {};
gkxwvsqf_202494204618_139_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202494204618_139");
}
return gkxwvsqf_202494204618_139_Global;
})();var gkxwvsqf_202382815548_882_561_699 = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_882_561_699');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_882_561_699_Global = {};
gkxwvsqf_202382815548_882_561_699_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_882_561_699");
}
return gkxwvsqf_202382815548_882_561_699_Global;
})();var gkxwvsqf_2024919134944_840 = (function() {
var self = document.getElementById('gkxwvsqf_2024919134944_840');
var gkxwvsqf_2024919134944_840_Global = {};
gkxwvsqf_2024919134944_840_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2024919134944_840");
}
function handleBreadcrumbClick(event) {
event.preventDefault(); // Prevent the default anchor behavior
var key = this.dataset.key;
var linked = this.dataset.linked; // Access the linked status from data attribute
var linkID = this.dataset.linkID; // Access the linkID from data attribute
var url = this.dataset.url; // Access the URL from data attribute
if (linked === "true") {
if (linkID !== "") {
// If linked is true and linkID is not empty, update the current page
Promise.all([woo.updateCurrentPage(linkID)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0; // Scroll to top
});
} else {
window.location = url; // Fallback navigation if linkID is empty
}
} else {
// If linked is false, just update the current page
Promise.all([woo.updateCurrentPage(key)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0; // Scroll to top
});
}
}
woo.getFullPageStructure().then((response) => {
console.log(response);
const result = findKeyAndParents(response, woo.getCurrentPage());
if (result) {
console.log(result);
var breadcrumbHTML = generateBreadcrumbHTML(result.path);
$(self).html(breadcrumbHTML);
} else {
console.log("Key not found");
}
});
function findKeyAndParents(obj, targetKey, path = []) {
for (var key in obj) {
if (obj.hasOwnProperty(key) && obj[key].props && obj[key].props.name) {
// Add key-name pair and linked-related info to the path
var currentPath = path.concat({
key: key,
name: obj[key].props.name,
linked: obj[key].props.linked || false, // Check if 'linked' is true
linkID: obj[key].props.linked ? obj[key].props.linkID : null, // Return linkID if linked is true
linkURL: obj[key].props.linked ? obj[key].props.linkURL : null // Return linkURL if linked is true
});
// Check if the key matches the targetKey
if (key === targetKey) {
return { value: obj[key].props.name, path: currentPath }; // Return the key-value pair
}
// If 'children' exist, recursively check them (async)
if (obj[key].children) {
var result = findKeyAndParents(obj[key].children, targetKey, currentPath);
if (result) {
return result;
}
}
}
}
return null; // Return null if targetKey is not found
}
function generateBreadcrumbHTML(path) {
if (!path || path.length === 0) return '';
var breadcrumbContainer = document.createElement('div'); // Create a container for breadcrumbs
for (var i = 0; i < path.length; i++) {
var item = path[i];
// If it's the last item, display it without a link
if (i === path.length - 1) {
var finalItem = document.createElement('span'); // Use a span for the final item
finalItem.textContent = item.name; // Just the name for the final item
breadcrumbContainer.appendChild(finalItem);
} else {
var linkElement = document.createElement('a'); // Create an anchor element
linkElement.className = "woo_breadcrumbLink";
linkElement.textContent = item.name; // Set the link text
linkElement.href = "#"; // Set href to '#' to avoid page jumps
linkElement.dataset.key = item.key; // Store linked status in a data attribute
linkElement.dataset.linked = item.linked; // Store linked status in a data attribute
linkElement.dataset.linkID = item.linkID; // Store linkID in a data attribute
linkElement.dataset.url = item.url; // Store url in a data attribute
// Add event listener to handle the click event
linkElement.addEventListener('click', handleBreadcrumbClick);
breadcrumbContainer.appendChild(linkElement); // Add link to the container
// Append separator " > " unless it's the last item
if (i < path.length - 1) { // Avoid adding a separator after the last link
breadcrumbContainer.appendChild(document.createTextNode(' > '));
}
}
}
return breadcrumbContainer; // Return the breadcrumb container element
}
return gkxwvsqf_2024919134944_840_Global;
})();var gkxwvsqf_2024526154916__908_257 = (function() {
var self = document.getElementById('gkxwvsqf_2024526154916__908_257');
var gkxwvsqf_2024526154916__908_257_Global = {};
gkxwvsqf_2024526154916__908_257_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2024526154916__908_257");
}
var imageFileData = "";
var divCount = 0;
function loadImages(){
$("#gkxwvsqf_2024526154916__908_257").empty();
Promise.all([woo.getGadgetProperty("gkxwvsqf_2024518104845", woo.gadgetDB, "imageFileData"), woo.getGadgetProperty("gkxwvsqf_2024526154916__908_257", woo.instanceDB, "imageFileData"), woo.getGadgetProperty("gkxwvsqf_2024526154916__908_257", woo.pageDB, "imageFileData")]).then((results) => {
if (results){
var defaultValues = results[0];
if (defaultValues != ""){
imageFileData = defaultValues;
}
var instanceValues = results[1];
if (instanceValues != ""){
imageFileData = instanceValues;
}
var pageValues = results[2];
if (pageValues != ""){
imageFileData = pageValues;
}
if ("false" == "false"){
} else {
var imageContainerDiv = document.createElement('div');
imageContainerDiv.className = "image_Container_div";
self.appendChild(imageContainerDiv);
}
//console.log(imageFileData);
if (imageFileData != ""){
divCount = Object.keys(imageFileData).length - 1;
Object.entries(imageFileData).map((imageFile) => {
//console.log(imageFile);
if ("false" == "false"){
var imageFileDiv = document.createElement('div');
imageFileDiv.className = "image_File_Div";
imageFileDiv.id = "imageFile_" + imageFile[0];
imageFileDiv.style.backgroundImage= "url('/resources/gatemaster/uploads/" + imageFile[1].name + "')";
imageFileDiv.setAttribute("caption", imageFile[1].caption);
/*var caption = document.createElement('span');
caption.className = "image_caption";
caption.textContent = imageFile[1].caption;
imageFileDiv.appendChild(caption);*/
self.appendChild(imageFileDiv);
} else {
var imageFileDiv = document.createElement('img');
imageFileDiv.className = "image_File_img";
imageFileDiv.id = "imageFile_" + imageFile[0];
imageFileDiv.src= "/resources/gatemaster/uploads/" + imageFile[1].name;
imageFileDiv.setAttribute("caption", imageFile[1].caption);
imageContainerDiv.appendChild(imageFileDiv);
}
imageFileDiv.addEventListener('click', openImage.bind(this, imageFile[0]));
});
}
}
}).catch((err) => {
console.error(err);
});
}
function openImage(imageIndex){
var img = document.querySelector("#gkxwvsqf_2024526154916__908_257 #imageFile_" + imageIndex);
var bi = "";
// Check if the element is an tag or a
if (img.tagName.toLowerCase() === 'img') {
// If it's an img tag, just get the src attribute
bi = img.src;
} else {
// If it's a div, extract the URL from the background-image style
var style = img.currentStyle || window.getComputedStyle(img, false);
bi = style.backgroundImage.slice(4, -1).replace(/"/g, "").replace(/['"]/g, "");
}
console.log(bi);
var imageCaption = img.getAttribute('caption');
$(".woo-dialogBox").remove();
var form = document.createElement('div');
form.id = "image_parent";
var imageFileDiv = document.createElement('img');
imageFileDiv.className = "image_File_Div_modal";
imageFileDiv.src = bi;
form.appendChild(imageFileDiv);
var caption = document.createElement('span');
caption.className = "image_caption";
caption.textContent = imageCaption;
form.appendChild(caption);
var formLeft = document.createElement('div');
formLeft.className = "imageGallery_left";
var formRight = document.createElement('div');
formRight.className = "imageGallery_right";
form.appendChild(formLeft);
form.appendChild(formRight);
var nextImage = parseInt(imageIndex) + 1;
var previousImage = parseInt(imageIndex) - 1;
if (nextImage > divCount){
nextImage = 0;
}
if (previousImage < 0){
previousImage = divCount;
}
formLeft.addEventListener('click', openImage.bind(this, previousImage));
formRight.addEventListener('click', openImage.bind(this, nextImage));
makeModal(form, "woo-dialogContent_gallery");
}
function makeModal(content, extraClass){
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);
var dialogContent = document.createElement('div');
dialogContent.className = "woo-dialogContent";
if (extraClass){
dialogContent.classList.add(extraClass);
}
dialogContent.appendChild(closeBox);
dialogContent.appendChild(content);
dialogBox.appendChild(dialogContent);
}
function closeButtonPressed(){
$(".woo-dialogBox").remove();
}
function updateValues(values){
var saveLevel = property_toolbar.getSaveLevel;
switch (saveLevel){
case "instance":
typeDB = woo.instanceDB;
break;
case "page":
typeDB = woo.pageDB;
break;
case "user":
typeDB = woo.pageDB;
break;
default:
typeDB = woo.pageDB;
}
woo.updateGadgetProperty("gkxwvsqf_2024526154916__908_257", typeDB, "imageFileData", values, woo.getCurrentPage()).then(() => {
loadImages();
}).catch((err) => {
console.log(err);
alert("Images not saved!");
});
}
function updateCaptions(captionNo, valueField){
imageFileData[captionNo]["caption"] = valueField.value;
console.log(imageFileData);
var saveLevel = property_toolbar.getSaveLevel;
switch (saveLevel){
case "instance":
typeDB = woo.instanceDB;
break;
case "page":
typeDB = woo.pageDB;
break;
case "user":
typeDB = woo.userDB;
break;
default:
typeDB = woo.pageDB;
}
woo.updateGadgetProperty("gkxwvsqf_2024526154916__908_257", typeDB, "imageFileData", imageFileData, woo.getCurrentPage()).then(() => {
loadImages();
}).catch((err) => {
console.log(err);
alert("Images not saved!");
});
}
function editCaptions(){
$(".woo-dialogBox").remove();
var form = document.createElement('div');
var title = document.createElement('span');
title.className = "dialog_title";
title.textContent = "Edit Captions";
form.appendChild(title);
if (imageFileData != ""){
Object.entries(imageFileData).map((imageFile) => {
var span1 = document.createElement('span');
form.appendChild(span1);
var label1 = document.createElement('label');
label1.className = "image_caption_input_label";
label1.textContent = "Image " + imageFile[0] + " Caption:";
span1.appendChild(label1);
var idInput = document.createElement('input');
idInput.className = "image_caption_input";
idInput.type = "text";
idInput.value = imageFile[1].caption;
span1.appendChild(idInput);
var imageName = document.createElement('span');
imageName.className = "image_name_label";
imageName.append("Image: " + imageFile[1].name);
span1.appendChild(imageName);
idInput.addEventListener('focusout', updateCaptions.bind(this, imageFile[0], idInput));
idInput.addEventListener('keypress', function (e) {
if (e.key === 'Enter') {
updateCaptions(imageFile[0], idInput);
}
});
});
} else {
var Error = document.createElement('span');
Error.className = "dialog_title";
Error.textContent = "Please upload image first!";
form.appendChild(Error);
}
makeModal(form);
}
function imageFileManager(){
$(".woo-dialogBox").remove();
var form = document.createElement('div');
var title = document.createElement('span');
title.className = "dialog_title";
title.textContent = "Upload Image";
form.appendChild(title);;
var span1 = document.createElement('span');
form.appendChild(span1);
var label1 = document.createElement('label');
label1.textContent = "Select Image:";
span1.appendChild(label1);
var idInput = document.createElement('input');
idInput.className = "file_upload_input";
idInput.type = "file";
idInput.setAttribute("multiple","");
idInput.required = "true";
span1.appendChild(idInput);
var span2 = document.createElement('span');
form.appendChild(span2);
var submitInput = document.createElement('input');
submitInput.type = "button";
submitInput.value = "Upload";
submitInput.addEventListener('click', uploadImage.bind(this, form, idInput));
form.appendChild(submitInput);
makeModal(form);
}
function uploadImage(form, idInput){
var formData = new FormData();
formData.append("name", "Images");
var fileLength = 0;
if (imageFileData != "") {
fileLength = Object.keys(imageFileData).length;
} else {
imageFileData = {};
}
for(let i = fileLength; i < (idInput.files.length + fileLength); i++) {
formData.append("files", idInput.files[i - fileLength]);
imageFileData[i] = {};
imageFileData[i]["name"] = idInput.files[i - fileLength].name;
imageFileData[i]["caption"] = "";
}
uploadFiles(formData).then((response) => {
console.log(response);
updateValues(imageFileData);
alert(response);
$(".woo-dialogBox").remove();
}).catch((error) => {
console.log(error);
alert("Something went wrong");
});
}
function uploadFiles(formData) {
console.log(formData);
return $.ajax({
type: "POST",
url: woo.getAuthServer() + "/app/upload_Files",
headers: {
//"Content-Type": "multipart/form-data",
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
processData: false,
contentType: false,
crossDomain: true,
cache: false,
data: formData,
timeout: 10000
});
}
loadImages();
gkxwvsqf_2024526154916__908_257_Global.imageFileManager = () => {
imageFileManager();
}
gkxwvsqf_2024526154916__908_257_Global.editCaptions = () => {
editCaptions();
}
return gkxwvsqf_2024526154916__908_257_Global;
})();var login_125_594 = (function() {
var login_125_594_Global = {};
var loginDom = document.getElementById('login-text_login_125_594');
var loginDomMob = document.getElementById('mob_icon_login_125_594');
var loggedIn = false;
var loggingInOrOut = false;
var openModal = false;
var whatIs = document.querySelector(".woo_whatIsWooID_login_125_594");
var forgotPass = document.querySelector(".forgot_pass_login_125_594");
function getAppData(){
return new Promise((resolve) => {
var url = woo.getRemoteCouch() + "/gatemaster$public/gatemaster-invoice-settings";
var data = {}
resolve(woo.queryCouch(url, "GET", data));
}).catch((error) => {
return null;
});
}
getAppData().then((data) => {
if (data){
$("#login_125_594 .website_name").html(data.brandName);
$("#login_125_594 #fullLogoImage").attr("src", "/resources/gatemaster/uploads/" + data.logoImage);
}
})
function forgotPass_login_125_594(){
woo.updateCurrentPage("forgot-password");
}
function whatIsClick_login_125_594(){
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.