go-quasar-partial-ssr/backend/internal/http/static/spa/assets/MainLayout-BlbPIMKP.js

2 lines
7.8 KiB
JavaScript

import{Q as F,a as A,b as T,c as E}from"./QLayout-BeBUeNGB.js";import{Q as P}from"./QTooltip-D2MBGu_Z.js";import{a as U,u as q,b as N,e as D,f as R,o as $,w as j,g as O,h as i,i as u,j as e,k as t,m as c,n as r,t as n,Q as x,p as W,q as f,s as G,v as y,x as b,y as J,z as K,A as X,B as M,C as Y,D as h}from"./index-B9vdjdfJ.js";import{Q as v,a as d,b as m}from"./format-BipdGd1G.js";import{Q as Z}from"./QResizeObserver-CyV47ipF.js";import{Q as e0,a as t0}from"./QSelect-B-H7KBd7.js";import{Q as a0}from"./QToolbar-k3h3juC8.js";import{C as k}from"./ClosePopup-B5ubkw_-.js";import{m as l0}from"./api-RGUeM09o.js";import{_ as s0}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./position-engine-CFuXolvx.js";import"./selection-HrszS3Ie.js";const o0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20id='flag-icons-ch'%20viewBox='0%200%20640%20480'%3e%3cg%20fill-rule='evenodd'%20stroke-width='1pt'%3e%3cpath%20fill='red'%20d='M0%200h640v480H0z'/%3e%3cg%20fill='%23fff'%3e%3cpath%20d='M170%20195h300v90H170z'/%3e%3cpath%20d='M275%2090h90v300h-90z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",i0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20id='flag-icons-de'%20viewBox='0%200%20640%20480'%3e%3cpath%20fill='%23fc0'%20d='M0%20320h640v160H0z'/%3e%3cpath%20fill='%23000001'%20d='M0%200h640v160H0z'/%3e%3cpath%20fill='red'%20d='M0%20160h640v160H0z'/%3e%3c/svg%3e",n0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20id='flag-icons-gb'%20viewBox='0%200%20640%20480'%3e%3cpath%20fill='%23012169'%20d='M0%200h640v480H0z'/%3e%3cpath%20fill='%23FFF'%20d='m75%200%20244%20181L562%200h78v62L400%20241l240%20178v61h-80L320%20301%2081%20480H0v-60l239-178L0%2064V0z'/%3e%3cpath%20fill='%23C8102E'%20d='m424%20281%20216%20159v40L369%20281zm-184%2020%206%2035L54%20480H0zM640%200v3L391%20191l2-44L590%200zM0%200l239%20176h-60L0%2042z'/%3e%3cpath%20fill='%23FFF'%20d='M241%200v480h160V0zM0%20160v160h640V160z'/%3e%3cpath%20fill='%23C8102E'%20d='M0%20193v96h640v-96zM273%200v480h96V0z'/%3e%3c/svg%3e",r0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20id='flag-icons-us'%20viewBox='0%200%20640%20480'%3e%3cpath%20fill='%23bd3d44'%20d='M0%200h640v480H0'/%3e%3cpath%20stroke='%23fff'%20stroke-width='37'%20d='M0%2055.3h640M0%20129h640M0%20203h640M0%20277h640M0%20351h640M0%20425h640'/%3e%3cpath%20fill='%23192f5d'%20d='M0%200h364.8v258.5H0'/%3e%3cmarker%20id='us-a'%20markerHeight='30'%20markerWidth='30'%3e%3cpath%20fill='%23fff'%20d='m14%200%209%2027L0%2010h28L5%2027z'/%3e%3c/marker%3e%3cpath%20fill='none'%20marker-mid='url(%23us-a)'%20d='m0%200%2016%2011h61%2061%2061%2061%2060L47%2037h61%2061%2060%2061L16%2063h61%2061%2061%2061%2060L47%2089h61%2061%2060%2061L16%20115h61%2061%2061%2061%2060L47%20141h61%2061%2060%2061L16%20166h61%2061%2061%2061%2060L47%20192h61%2061%2060%2061L16%20218h61%2061%2061%2061%2060z'/%3e%3c/svg%3e",d0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20id='flag-icons-fr'%20viewBox='0%200%20640%20480'%3e%3cpath%20fill='%23fff'%20d='M0%200h640v480H0z'/%3e%3cpath%20fill='%23000091'%20d='M0%200h213.3v480H0z'/%3e%3cpath%20fill='%23e1000f'%20d='M426.7%200H640v480H426.7z'/%3e%3c/svg%3e",c0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20id='flag-icons-it'%20viewBox='0%200%20640%20480'%3e%3cg%20fill-rule='evenodd'%20stroke-width='1pt'%3e%3cpath%20fill='%23fff'%20d='M0%200h640v480H0z'/%3e%3cpath%20fill='%23009246'%20d='M0%200h213.3v480H0z'/%3e%3cpath%20fill='%23ce2b37'%20d='M426.7%200H640v480H426.7z'/%3e%3c/g%3e%3c/svg%3e",f0={class:"q-ml-md"},u0=["src","alt"],g0={key:1},h0={class:"q-ml-md"},v0={class:"row items-center no-wrap"},m0=["src","alt"],p0={key:1,class:"lang-fallback"},_0={class:"bold text-white q-ml-md"},w0=["src","alt"],x0={key:1,class:"lang-fallback"},y0=U({__name:"MainLayout",setup(b0){const{t:z}=q(),L=N(),Q=D(),p=R(),o=Y(null),_=h({get:()=>p.language,set:s=>{p.setLanguage(s)}}),H=Object.assign({"../assets/flags/ch.svg":o0,"../assets/flags/de.svg":i0,"../assets/flags/en.svg":n0,"../assets/flags/en_us.svg":r0,"../assets/flags/fr.svg":d0,"../assets/flags/it.svg":c0}),S=[{code:"it",short_name:"IT",flag:"it.svg",style:"width:32px;height:22px;"},{code:"en",short_name:"EN",flag:"en.svg",style:"width:32px;height:22px;"},{code:"en_us",short_name:"EN",flag:"en_us.svg",style:"width:32px;height:22px;"},{code:"de",short_name:"DE",flag:"de.svg",style:"width:32px;height:22px;"},{code:"de_ch",short_name:"DE",flag:"ch.svg",style:"width:22px;height:22px;object-fit: cover;"},{code:"fr",short_name:"FR",flag:"fr.svg",style:"width:32px;height:22px;"},{code:"fr_ch",short_name:"FR",flag:"ch.svg",style:"width:22px;height:22px;object-fit: cover;"}],C=h(()=>S.map(s=>({label:z(`language.${s.code}`),value:s.code,flagSrc:H[`../assets/flags/${s.flag}`]??null,flagStyle:s.style,short_name:s.short_name}))),B=h(()=>o.value?.roles.includes("admin")??!1),V=h(()=>{const l=(o.value?.name?.trim()||o.value?.email?.trim()||"?").split(/\s+/).filter(Boolean),g=l[0]??"",a=l[1]??"";return l.length>1?`${g.charAt(0)}${a.charAt(0)}`.toUpperCase():g.slice(0,2).toUpperCase()});$(async()=>{await w()}),j(()=>Q.fullPath,async()=>{await w()});async function w(){if(typeof window>"u"||!window.localStorage.getItem("Auth-Token")){o.value=null;return}const s=await l0();o.value=s.error?null:s.data}async function I(){typeof window<"u"&&window.localStorage.removeItem("Auth-Token"),o.value=null,await L.push("/")}return(s,l)=>{const g=O("router-view");return i(),u(E,{view:"lHh Lpr lFf"},{default:e(()=>[t(F,{elevated:""},{default:e(()=>[t(a0,null,{default:e(()=>[l[5]||(l[5]=c("img",{"data-v-2373a833":"",class:"brand-logo-tb",src:"/src/assets/home/logo.png",alt:"Omnimed logo"},null,-1)),t(A,null,{default:e(()=>[...l[1]||(l[1]=[r(" Omnimed ",-1)])]),_:1}),c("div",null,"Quasar v"+n(s.$q.version),1),c("div",f0,[o.value?(i(),u(x,{key:1,flat:"",round:"",dense:""},{default:e(()=>[t(W,{size:"34px",class:"user-avatar"},{default:e(()=>[o.value.avatar?(i(),f("img",{key:0,src:o.value.avatar,alt:o.value.name},null,8,u0)):(i(),f("span",g0,n(V.value),1))]),_:1}),t(e0,{anchor:"bottom right",self:"top right"},{default:e(()=>[t(Z,{dense:"",style:{"min-width":"190px"}},{default:e(()=>[t(v,null,{default:e(()=>[t(d,null,{default:e(()=>[t(m,null,{default:e(()=>[r(n(o.value.name),1)]),_:1}),t(m,{caption:""},{default:e(()=>[r(n(o.value.email),1)]),_:1})]),_:1})]),_:1}),t(G),B.value?y((i(),u(v,{key:0,clickable:"",to:"/admin"},{default:e(()=>[t(d,{avatar:""},{default:e(()=>[t(b,{name:"admin_panel_settings"})]),_:1}),t(d,null,{default:e(()=>[...l[3]||(l[3]=[r("Admin",-1)])]),_:1})]),_:1})),[[k]]):J("",!0),y((i(),u(v,{clickable:"",onClick:I},{default:e(()=>[t(d,{avatar:""},{default:e(()=>[t(b,{name:"logout"})]),_:1}),t(d,null,{default:e(()=>[...l[4]||(l[4]=[r("Logout",-1)])]),_:1})]),_:1})),[[k]])]),_:1})]),_:1})]),_:1})):(i(),u(x,{key:0,flat:"",round:"",color:"white",icon:"lock",to:"/login"},{default:e(()=>[t(P,null,{default:e(()=>[...l[2]||(l[2]=[r("Login",-1)])]),_:1})]),_:1}))]),c("div",h0,[t(t0,{modelValue:_.value,"onUpdate:modelValue":l[0]||(l[0]=a=>_.value=a),options:C.value,"option-label":"label","option-value":"value","emit-value":"","map-options":"",class:"q-select",dark:""},{"selected-item":e(a=>[c("div",v0,[a.opt.flagSrc?(i(),f("img",{key:0,class:"border",src:a.opt.flagSrc,alt:a.opt.label,style:M(a.opt.flagStyle)},null,12,m0)):(i(),f("span",p0,n(a.opt.value.toUpperCase()),1)),c("span",_0,n(a.opt.short_name),1)])]),option:e(a=>[t(v,K(X(a.itemProps)),{default:e(()=>[t(d,{avatar:""},{default:e(()=>[a.opt.flagSrc?(i(),f("img",{key:0,src:a.opt.flagSrc,alt:a.opt.label,style:M(a.opt.flagStyle)},null,12,w0)):(i(),f("span",x0,n(a.opt.value.toUpperCase()),1))]),_:2},1024),t(d,null,{default:e(()=>[t(m,null,{default:e(()=>[r(n(a.opt.label),1)]),_:2},1024)]),_:2},1024)]),_:2},1040)]),_:1},8,["modelValue","options"])])]),_:1})]),_:1}),t(T,null,{default:e(()=>[t(g)]),_:1})]),_:1})}}}),A0=s0(y0,[["__scopeId","data-v-3669e2f9"]]);export{A0 as default};