let appGlobalVars = { "website_url": "https:\/\/artavolo.com", "api_call_url": "https:\/\/artavolo.com\/api\/call", "auth_token": "", "template_assets": "https:\/\/artavolo.com\/site\/templates\/default\/assets\/", "config_domain": "artavolo.com", "current_language": "en", "add_records_through_email": { "enabled": "1", "user": "record@artavolo.com" }, "websocket": { "enabled": true, "type": "pusher", "domain": "artavolo.com", "port": "8000", "integrations": { "pusher": { "key": "936c123943c93a714ed5", "cluster": "eu" } } }, "integrations": { "google_recaptcha_site_key": "6LfOJf0oAAAAAP5FQuH8WvEZzhlaDpnwyGLUJomr" }, "developer_mode": false, "time_zone": { "utc": "Europe\/London", "abbr": "GMT" } } const website_url = appGlobalVars.website_url; const api_call_url = appGlobalVars.api_call_url; const template_assets = appGlobalVars.template_assets; const developer_mode = appGlobalVars.developer_mode; function page(page) { return website_url + '/' + page; } var pt = {}; pt.version = '1767596329'; String.prototype.contains = function (a) { return !!~this.indexOf(a); }; pt.required = typeof pt.required === 'undefined' ? [] : pt.required; pt.require = function (url, inHead, module = false, key) { if (!url) return; if (typeof inHead === 'boolean' || typeof inHead === 'undefined') { inHead = inHead || false; } var keyString; if (typeof inHead === 'string') { keyString = '' + inHead; inHead = key || false; } if (typeof key === 'string') { keyString = key; } var toPush = url, urlModified = false; if (!!keyString) { toPush = keyString; urlModified = true } var t = url.split('.').pop(); if (!urlModified) toPush = url; if (!~pt.required.indexOf(toPush)) { pt.required.push(toPush); url = url.contains("?") ? url + '&v=' + pt.version : url + "?v=" + pt.version; if (document.querySelector('link[href="proxy.php?url=' + url + '"],script[src="proxy.php?url=' + url + '"]') !== null) { return } ptd = document; pthead = ptd.head || ptd.getElementsByTagName('head')[0]; var string = t !== "css" ? "" : ""; if (module || string.includes("source-dev")) { string = string.replaceAll('text/javascript', 'module'); } if ((ptd.readyState === 'loading'/* || ptd.readyState === 'interactive'*/) && !inHead && !!window.CanvasRenderingContext2D && self === parent) { (document.body || document.head).appendChild(document.createRange().createContextualFragment(string)) } else { if (typeof $ === 'function') { $(pthead).append(string); } else { var el; if (t !== "css") { el = ptd.createElement('script'); el.src = url; if (module || string.includes("source-dev")) { el.setAttribute('type', 'module'); } else { el.setAttribute('type', 'text/javascript'); } pthead.appendChild(el); } else { el = ptd.createElement('link'); el.rel = 'stylesheet'; el.type = 'text/css'; el.href = url; pthead.appendChild(el); } } } } }; pt.libs = { jquery: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/jquery/jquery-3.6.0.min.js', true); } ], bootstrap_select: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/bootstrap-select/js/bootstrap-select.min.js'); pt.require('https://artavolo.com/modules/system/api/libraries/bootstrap-select/css/bootstrap-select.min.css', true); } ], bootstrap_scrollable_tabs: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/bootstrap-scrollable-tabs/dist/move.min.js'); pt.require('https://artavolo.com/modules/system/api/libraries/bootstrap-scrollable-tabs/dist/scrollable-tabs.js'); } ], underscore: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/underscore/underscore-min.js', true); } ], transliteration: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/transliteration/translitbg.js'); } ], jquery_mentions_input: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/underscore/underscore-min.js', true); pt.require('https://artavolo.com/modules/system/api/libraries/jquery-mentions-input/lib/jquery.elastic.js'); pt.require('https://artavolo.com/modules/system/api/libraries/jquery-mentions-input/jquery.mentionsInput.js'); pt.require('https://artavolo.com/modules/system/api/libraries/jquery-mentions-input/jquery.mentionsInput.css', true); } ], material_design_icons: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/npm/node_modules/@mdi/font/css/materialdesignicons.min.css', true); } ], dropzone: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/dropzone/min/dropzone.min.css', true); pt.require('https://artavolo.com/modules/system/api/libraries/dropzone/min/dropzone.min.js'); } ], skypecon: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/skypecon/dist/css/skypecon.min.css', true); } ], grapesjs: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/grapesjs/css/grapes.min.css', true); pt.require('https://artavolo.com/modules/system/api/libraries/grapesjs/grapes.min.js'); pt.lib.whenAvailable('grapesjs', function () { pt.require('https://artavolo.com/modules/system/api/libraries/grapesjs/old/css/grapesjs-preset-newsletter.css', true); pt.require('https://artavolo.com/modules/system/api/libraries/grapesjs/grapesjs-preset-newsletter.min.js'); pt.require('https://artavolo.com/modules/system/api/libraries/grapesjs/grapesjs-component-code-editor.min.css', true); pt.require('https://artavolo.com/modules/system/api/libraries/grapesjs/grapesjs-component-code-editor.min.js'); pt.require('https://artavolo.com/modules/system/api/libraries/grapesjs/grapesjs-parser-postcss.min.js'); }); } ], steptip: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/steptip/steptip.js'); pt.require('https://artavolo.com/modules/system/api/libraries/steptip/steptip.css', true); } ], i18n_phone_numbers: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/phoneNumbers/i18n.phonenumbers.min.js'); } ], simple_lightbox: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/simplelightbox/dist/simple-lightbox.jquery.min.js'); pt.require('https://artavolo.com/modules/system/api/libraries/simplelightbox/dist/simple-lightbox.min.css', true); } ], slick: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/slick/slick/slick.min.js'); pt.require('https://artavolo.com/modules/system/api/libraries/slick/slick/slick.css', true); pt.require('https://artavolo.com/modules/system/api/libraries/slick/slick/slick-theme.css', true); } ], alertify: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/alertify/alertify.min.js'); pt.require('https://artavolo.com/modules/system/api/libraries/alertify/css/alertify.min.css', true); pt.require('https://artavolo.com/modules/system/api/libraries/alertify/css/themes/bootstrap.min.css', true); } ], smart_default: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/styles/smart.default.css', true); //pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/styles/bootstrap/light/smart.bootstrap.css', true); } ], smart_toast: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.toast.js'); } ], smart_button: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.button.js'); } ], smart_button_group: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.buttongroup.js'); } ], smart_grid: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.grid.js', false, true); pt.require('https://artavolo.com/modules/system/api/libraries/smart/scripts/jszip.min.js', false, false); } ], smart_scheduler: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.scheduler.js', false, true); } ], smart_pivot_table: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.pivottable.js', false, true); } ], smart_kanban: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.kanban.js', false, true); } ], smart_table: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.table.js', false, true); } ], smart_gantt_chart: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.ganttchart.js', false, true); } ], smart_sortable: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.sortable.js'); } ], smart_drop_down_button: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.dropdownbutton.js'); } ], smart_drop_down_list: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.dropdownlist.js'); } ], smart_tree: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.tree.js'); } ], smart_color_picker: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.colorpicker.js'); } ], smart_tabs: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.tabs.js'); } ], smart_input: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.input.js'); pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.multicomboinput.js'); } ], smart_date: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/smart.date.js'); } ], smart_rating: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.rating.js'); } ], smart_tooltip: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.tooltip.js'); } ], smart_file_upload: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.fileupload.js'); } ], smart_editor: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.editor.js', false, true); } ], smart_data: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/smart.element.js', false, true); pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/smart.data.js', false, true); } ], smart_progress_bar: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.progressbar.js', false, true); } ], smart_chart: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.chart.js', false, true); } ], smart_cardview: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.cardview.js', false, true); pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.slider.js', false, true); } ], smart_slider: [ function () { pt.require('https://artavolo.com/modules/system/api/libraries/smart/source/modules/smart.slider.js', false, true); } ] }; pt.lib = { _required: [], require: function (name) { if (pt.lib._required.indexOf(name) !== -1) { return false; } pt.lib._required.push(name); if (typeof pt.libs[name] === 'undefined') return false; if (pt.libs[name].constructor !== [].constructor) return false; var path = pt.libs_url + name + '/', arr = pt.libs[name], l = arr.length, i = 0, c = 0; for (; i < l; i++) { (typeof arr[i] === 'string') ? pt.require(path + arr[i], true) : (typeof arr[i] === 'function') ? arr[i].call() : ''; } }, get: function (name, done, error) { if (pt.lib._required.indexOf(name) !== -1) { if (typeof done === 'function') { done.call(); } return false; } if (typeof pt.libs[name] === 'undefined') return false; if (pt.libs[name].constructor !== [].constructor) return false; pt.lib._required.push(name); var path = pt.libs_url + name + '/', arr = pt.libs[name], l = arr.length, i = 0, c = 1; for (; i < l; i++) { var xhr = $.cachedScript(path + arr[i]); xhr.done(function () { c++; if (c === l) { if (typeof done === 'function') { done.call(); } } }); xhr.fail(function (jqxhr, settings, exception) { if (typeof error === 'function') { error.call(jqxhr, settings, exception); } }); } }, init: function (libInit, beforeDOMContentLoaded) { if (typeof beforeDOMContentLoaded === 'boolean' || typeof beforeDOMContentLoaded === 'undefined') { beforeDOMContentLoaded = beforeDOMContentLoaded || false; } if (beforeDOMContentLoaded) { libInit(); } else { let tid = setInterval(function () { if (document.readyState !== 'complete') return; clearInterval(tid); // Load the scripts libInit(); }, 10); // document.addEventListener('DOMContentLoaded', function () { // libInit(); // }, false); } }, whenAvailable: function (name, callback) { const interval = 10; // ms const checkForLib = setInterval(function () { if (typeof window[name] === 'undefined' && typeof $.fn[name] === 'undefined') { return; } clearInterval(checkForLib); console.log(name + ' is available'); if (window[name]) { callback(window[name]); } else if ($.fn[name]) { callback($.fn[name]); } }, interval); } }; pt.scripts = { _required: [], load: function (scriptLoad, beforeDOMContentLoaded) { if (typeof beforeDOMContentLoaded === 'boolean' || typeof beforeDOMContentLoaded === 'undefined') { beforeDOMContentLoaded = beforeDOMContentLoaded || false; } if (beforeDOMContentLoaded) { scriptLoad(); } else { let tid = setInterval(function () { if (document.readyState !== 'complete') return; clearInterval(tid); // Load the scripts scriptLoad(); }, 10); } } }; pt.events = { _required: [], listener: function (listenEvent, listenSelector, callback) { const listenSelectorArray = document.body.querySelectorAll(listenSelector); if (listenEvent === 'click') { Array.from(listenSelectorArray).forEach(function (element) { element.addEventListener('click', callback); }); } else if (listenEvent === 'input') { Array.from(listenSelectorArray).forEach(function (element) { element.addEventListener('input', callback); }); } else if (listenEvent === 'doubleClick') { Array.from(listenSelectorArray).forEach(function (element) { element.addEventListener('dblclick', callback); }); } else if (listenEvent === 'change') { Array.from(listenSelectorArray).forEach(function (element) { element.addEventListener('change', callback); }); } else if (listenEvent === 'submit') { Array.from(listenSelectorArray).forEach(function (element) { element.addEventListener('submit', callback); }); } } } pt.lib.require('jquery'); pt.api = { _required: [], exec: function (arg, callback) { if (typeof arg === 'undefined' || typeof arg.object === 'undefined' || typeof arg.data === 'undefined') { return; } const object = arg.object, action = arg.action, data = arg.data; let postURL = 'https://artavolo.com/api/call'; if (typeof arg.url !== 'undefined') { postURL = arg.url; } request = $.ajax({ url: postURL, type: "post", data: { 'object': object, 'action': action, 'data': data }, dataType: "json", headers: { "Authorization": "Basic " + appGlobalVars['auth_token'] + "" }, success: function (data) { //console.log(data); if (data && Array.isArray(data)) { data.forEach(function (element) { if (typeof (element.response) !== 'undefined' && element.response !== null) { if (element.response == 'error') { console.log('AJAX ERROR!'); } else if (element.response == 'success') { // console.log('AJAX SUCCESS!'); } } if (typeof (element.msg) !== 'undefined' && typeof (element.msg.console) !== 'undefined' && typeof (element.msg) !== null && typeof (element.msg.console) !== null) { // console.log(element.msg.console); } }) } else if (data && !Array.isArray(data)) { if (typeof (data.response) !== 'undefined' && data.response !== null) { if (data.response == 'error') { console.log('AJAX ERROR!'); } else if (data.response == 'success') { // console.log('AJAX SUCCESS!'); } } if (typeof (data.msg) !== 'undefined' && typeof (data.msg.console) !== 'undefined' && typeof (data.msg) !== null && typeof (data.msg.console) !== null) { // console.log(data.msg.console); } } if (data) { callback(data); } }, error: function (error) { console.log(error); } }); }, exec_custom: function (arg, callback) { if (typeof arg === 'undefined' || typeof arg.object === 'undefined' || typeof arg.data === 'undefined') { return; } const url = arg.url, object = arg.object, action = arg.action, data = arg.data; const postURL = url; request = $.ajax({ url: postURL, type: "post", data: { 'object': object, 'action': action, 'data': data }, dataType: "json", headers: { "Authorization": "Basic " + appGlobalVars['auth_token'] + "" }, success: function (data) { // console.log(data); if (data && Array.isArray(data)) { data.forEach(function (element) { if (typeof (element.response) !== 'undefined' && element.response !== null) { if (element.response == 'error') { console.log('AJAX ERROR!'); } else if (element.response == 'success') { // console.log('AJAX SUCCESS!'); } } if (typeof (element.msg) !== 'undefined' && typeof (element.msg.console) !== 'undefined' && typeof (element.msg) !== null && typeof (element.msg.console) !== null) { // console.log(element.msg.console); } }) } else if (data && !Array.isArray(data)) { if (typeof (data.response) !== 'undefined' && data.response !== null) { if (data.response == 'error') { console.log('AJAX ERROR!'); } else if (data.response == 'success') { // console.log('AJAX SUCCESS!'); } } if (typeof (data.msg) !== 'undefined' && typeof (data.msg.console) !== 'undefined' && typeof (data.msg) !== null && typeof (data.msg.console) !== null) { // console.log(data.msg.console); } } if (data) { callback(data); } } }); }, upload: function (arg, callback) { // if (typeof arg === 'undefined' || typeof arg.object === 'undefined' || typeof arg.data === 'undefined') { // return; // } const postURL = 'https://artavolo.com/api/upload'; request = $.ajax({ url: postURL, type: "post", headers: { "Authorization": "Basic " + appGlobalVars['auth_token'] + "" }, data: arg, contentType: false, cache: false, processData: false, success: function (data) { data = JSON.parse(data); if (data && Array.isArray(data)) { data.forEach(function (element) { if (typeof (element.response) !== 'undefined' && element.response !== null) { if (element.response == 'error') { console.log('AJAX ERROR!'); } else if (element.response == 'success') { // console.log('AJAX SUCCESS!'); } } if (typeof (element.msg) !== 'undefined' && typeof (element.msg.console) !== 'undefined' && typeof (element.msg) !== null && typeof (element.msg.console) !== null) { // console.log(element.msg.console); } }); } else if (data && !Array.isArray(data)) { if (typeof (data.response) !== 'undefined' && data.response !== null) { if (data.response == 'error') { console.log('AJAX ERROR!'); } else if (data.response == 'success') { // console.log('AJAX SUCCESS!'); } } if (typeof (data.msg) !== 'undefined' && typeof (data.msg.console) !== 'undefined' && typeof (data.msg) !== null && typeof (data.msg.console) !== null) { // console.log(data.msg.console); } } if (data) { callback(data); } } }); } } function redirectTo(url, ms = '2000') { setTimeout(function () { if (url == 'currentPage') { window.location = window.location.href; } else if (url == 'homepage') { window.location = '/'; } else { window.location = url; } }, ms); } function getAppDomain() { return window.location.origin; } function templateRender(templateID, itemData) { const template = document.getElementById(templateID); //Item generate let templateItem = template.innerHTML; const dataKeys = Object.keys(itemData); dataKeys.forEach(element => { templateItem = templateItem.replaceAll('{{' + element + '}}', itemData[element]); }); return templateItem; } function templateRenderNodeByClass(templateID, itemData) { const template = document.getElementById(templateID); //Item generate const templateItem = document.importNode(template.content, true); const dataKeys = Object.keys(itemData); dataKeys.forEach(element => { let currentNode = templateItem.querySelector('.' + element); if (currentNode) { currentNode.textContent = itemData[element]; } }); return templateItem; } function showAlert(element, type) { const toast = document.querySelector('.smart-toast-alert'); toast.open(); let msgText = ''; if (typeof element == 'string') { msgText = element; } else { msgText = element.msg.content; } if (type == 'success') { toast.value = ' ' + msgText; toast.itemTemplate = 'smart-toast-alert-success'; } else { toast.value = ' ' + msgText; toast.itemTemplate = 'smart-toast-alert-error'; } } pt.functions = { translationsRemoveString: function (event, key, keyword) { event.preventDefault(); const postData = { key: key, keyword: keyword }; const arg = { object: 'admin', action: 'delete-language-word', data: JSON.stringify(postData) }; const target = event.target; pt.api.exec(arg, function (data) { const element = data; if (typeof (element.msg.type) !== 'undefined' && element.msg.type == 'danger') { showAlert(element, 'danger'); } else if (typeof (element.msg.type) !== 'undefined' && element.msg.type == 'success') { showAlert(element, 'success'); if (typeof target.getAttribute('data-refresh-on-success') !== 'undefined' && target.getAttribute('data-refresh-on-success') == 'true') { redirectTo('currentPage', 0); } } else if (typeof (element.msg.type) !== 'undefined' && element.msg.type == 'info') { showAlert(element, 'success'); if (typeof target.getAttribute('data-refresh-on-success') !== 'undefined' && target.getAttribute('data-refresh-on-success') == 'true') { redirectTo('currentPage', 0); } } }); } }