easyappointments/assets/js/layouts/backend_layout.min.js

1 line
1.6 KiB
JavaScript
Executable File

"use strict";window.App.Layouts.Backend=function(){var $selectLanguage=$("#select-language"),$notification=$("#notification"),$loading=$("#loading"),$footer=$("#footer");return document.addEventListener("DOMContentLoaded",function(){$(document).ajaxStart(function(){$loading.show()}),$(document).ajaxStop(function(){$loading.hide()}),tippy("[data-tippy-content]"),App.Utils.Lang.enableLanguageSelection($selectLanguage)}),{DB_SLUG_ADMIN:"admin",DB_SLUG_PROVIDER:"provider",DB_SLUG_SECRETARY:"secretary",DB_SLUG_CUSTOMER:"customer",PRIV_VIEW:1,PRIV_ADD:2,PRIV_EDIT:4,PRIV_DELETE:8,PRIV_APPOINTMENTS:"appointments",PRIV_CUSTOMERS:"customers",PRIV_SERVICES:"services",PRIV_USERS:"users",PRIV_SYSTEM_SETTINGS:"system_settings",PRIV_USER_SETTINGS:"user_settings",displayNotification:function(message){var actions=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];if(message){var $toast=$("\n <div class=\"toast bg-dark d-flex align-items-center mb-2 fade show position-fixed p-1 m-4 bottom-0 end-0 backend-notification\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\">\n <div class=\"toast-body w-100 text-white\">\n ".concat(message,"\n </div>\n <button type=\"button\" class=\"btn-close btn-close-white me-2\" data-bs-dismiss=\"toast\" aria-label=\"Close\"></button>\n </div>\n ")).appendTo("body");actions.forEach(function(action){$("<button/>",{class:"btn btn-light btn-sm ms-2",text:action.label,on:{click:action["function"]}}).prependTo($toast)});var toast=new bootstrap.Toast($toast[0]);toast.show(),setTimeout(function(){toast.dispose(),$toast.remove()},5e3)}}}}();