2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
import{Q as F,a as A,b as E,c as T}from"./QLayout-DZVoSyXn.js";import{f as U,Q as P}from"./logo-DdmK5n0b.js";import{a as q,u as N,b as D,e as R,f as $,o as j,w as O,g as W,h as i,i as u,j as e,k as t,m as c,n as G,p as r,t as n,Q as x,q as J,s as f,v as K,x as y,y as b,z as X,A as Y,B as Z,C as M,D as e0,E as h}from"./index-DAvBaevK.js";import{Q as v,a as d,b as m}from"./format-DaKpMo2W.js";import{Q as t0}from"./QResizeObserver-CenQZ1Fm.js";import{Q as a0,a as l0}from"./QSelect-Bmx_AjWr.js";import{Q as s0}from"./QToolbar-DdNWxglI.js";import{C as k}from"./ClosePopup-DV5_zFD6.js";import{m as o0}from"./api-RGUeM09o.js";import{_ as i0}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./position-engine-BHgB6lrx.js";import"./selection-DrSF90ET.js";const n0="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",r0="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",d0="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",c0="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",f0="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",u0="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",g0=["src"],h0={class:"q-ml-md"},v0=["src","alt"],m0={key:1},p0={class:"q-ml-md"},_0={class:"row items-center no-wrap"},w0=["src","alt"],x0={key:1,class:"lang-fallback"},y0={class:"bold text-white q-ml-md"},b0=["src","alt"],M0={key:1,class:"lang-fallback"},k0=q({__name:"MainLayout",setup(L0){const{t:L}=N(),z=D(),Q=R(),p=$(),o=e0(null),_=h({get:()=>p.language,set:s=>{p.setLanguage(s)}}),H=Object.assign({"../assets/flags/ch.svg":n0,"../assets/flags/de.svg":r0,"../assets/flags/en.svg":d0,"../assets/flags/en_us.svg":c0,"../assets/flags/fr.svg":f0,"../assets/flags/it.svg":u0}),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:L(`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()});j(async()=>{await w()}),O(()=>Q.fullPath,async()=>{await w()});async function w(){if(typeof window>"u"||!window.localStorage.getItem("Auth-Token")){o.value=null;return}const s=await o0();o.value=s.error?null:s.data}async function I(){typeof window<"u"&&window.localStorage.removeItem("Auth-Token"),o.value=null,await z.push("/")}return(s,l)=>{const g=W("router-view");return i(),u(T,{view:"lHh Lpr lFf"},{default:e(()=>[t(F,{elevated:""},{default:e(()=>[t(s0,null,{default:e(()=>[c("img",{"data-v-2373a833":"",class:"brand-logo-tb",src:G(U),alt:"Omnimed logo"},null,8,g0),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",h0,[o.value?(i(),u(x,{key:1,flat:"",round:"",dense:""},{default:e(()=>[t(J,{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,v0)):(i(),f("span",m0,n(V.value),1))]),_:1}),t(a0,{anchor:"bottom right",self:"top right"},{default:e(()=>[t(t0,{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(K),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]]):X("",!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",p0,[t(l0,{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",_0,[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,w0)):(i(),f("span",x0,n(a.opt.value.toUpperCase()),1)),c("span",y0,n(a.opt.short_name),1)])]),option:e(a=>[t(v,Y(Z(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,b0)):(i(),f("span",M0,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(E,null,{default:e(()=>[t(g)]),_:1})]),_:1})}}}),U0=i0(k0,[["__scopeId","data-v-1941e633"]]);export{U0 as default};
|