2 lines
8.7 KiB
JavaScript
2 lines
8.7 KiB
JavaScript
import{u as W}from"./auth-6FPSPboo.js";import{aZ as E,f as x,a_ as R,a$ as K,b0 as D,b1 as z,b2 as ee,k as w,b3 as U,b4 as A,Y as H,aa as F,an as te,b5 as se,b6 as ae,b7 as V,a5 as G,b8 as $,v as oe,L as J,e as re,z as le,r as P,o as v,m as S,w as f,b as a,l as n,_ as ne,c as B,N as L,O as N,J as j,p as I,t as y,a as d,b9 as ue,ba as ie,az as O,K as ce}from"./main-B9dpPbRR.js";import{u as Q}from"./global-1F4OAoew.js";import{N as de}from"./NotificationRoot-VBhW4oOA.js";var pe=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(pe||{});let X=Symbol("DisclosureContext");function M(s){let i=G(X,null);if(i===null){let p=new Error(`<${s} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(p,M),p}return i}let Y=Symbol("DisclosurePanelContext");function fe(){return G(Y,null)}let me=E({name:"Disclosure",props:{as:{type:[Object,String],default:"template"},defaultOpen:{type:[Boolean],default:!1}},setup(s,{slots:i,attrs:p}){let t=x(s.defaultOpen?0:1),e=x(null),g=x(null),r={buttonId:x(`headlessui-disclosure-button-${R()}`),panelId:x(`headlessui-disclosure-panel-${R()}`),disclosureState:t,panel:e,button:g,toggleDisclosure(){t.value=K(t.value,{0:1,1:0})},closeDisclosure(){t.value!==1&&(t.value=1)},close(o){r.closeDisclosure();let m=o?o instanceof HTMLElement?o:o.value instanceof HTMLElement?D(o):D(r.button):D(r.button);m==null||m.focus()}};return z(X,r),ee(w(()=>K(t.value,{0:U.Open,1:U.Closed}))),()=>{let{defaultOpen:o,...m}=s,h={open:t.value===0,close:r.close};return A({theirProps:m,ourProps:{},slot:h,slots:i,attrs:p,name:"Disclosure"})}}}),ve=E({name:"DisclosureButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:null}},setup(s,{attrs:i,slots:p,expose:t}){let e=M("DisclosureButton"),g=fe(),r=w(()=>g===null?!1:g.value===e.panelId.value);H(()=>{r.value||s.id!==null&&(e.buttonId.value=s.id)}),F(()=>{r.value||(e.buttonId.value=null)});let o=x(null);t({el:o,$el:o}),r.value||te(()=>{e.button.value=o.value});let m=se(w(()=>({as:s.as,type:i.type})),o);function h(){var l;s.disabled||(r.value?(e.toggleDisclosure(),(l=D(e.button))==null||l.focus()):e.toggleDisclosure())}function _(l){var c;if(!s.disabled)if(r.value)switch(l.key){case $.Space:case $.Enter:l.preventDefault(),l.stopPropagation(),e.toggleDisclosure(),(c=D(e.button))==null||c.focus();break}else switch(l.key){case $.Space:case $.Enter:l.preventDefault(),l.stopPropagation(),e.toggleDisclosure();break}}function b(l){switch(l.key){case $.Space:l.preventDefault();break}}return()=>{var l;let c={open:e.disclosureState.value===0},{id:T,...k}=s,C=r.value?{ref:o,type:m.value,onClick:h,onKeydown:_}:{id:(l=e.buttonId.value)!=null?l:T,ref:o,type:m.value,"aria-expanded":e.disclosureState.value===0,"aria-controls":e.disclosureState.value===0||D(e.panel)?e.panelId.value:void 0,disabled:s.disabled?!0:void 0,onClick:h,onKeydown:_,onKeyup:b};return A({ourProps:C,theirProps:k,slot:c,attrs:i,slots:p,name:"DisclosureButton"})}}}),ge=E({name:"DisclosurePanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:null}},setup(s,{attrs:i,slots:p,expose:t}){let e=M("DisclosurePanel");H(()=>{s.id!==null&&(e.panelId.value=s.id)}),F(()=>{e.panelId.value=null}),t({el:e.panel,$el:e.panel}),z(Y,e.panelId);let g=ae(),r=w(()=>g!==null?(g.value&U.Open)===U.Open:e.disclosureState.value===0);return()=>{var o;let m={open:e.disclosureState.value===0,close:e.close},{id:h,..._}=s,b={id:(o=e.panelId.value)!=null?o:h,ref:e.panel};return A({ourProps:b,theirProps:_,slot:m,attrs:i,slots:p,features:V.RenderStrategy|V.Static,visible:r.value,name:"DisclosurePanel"})}}});const he={class:"mx-auto px-8"},_e={class:"flex justify-between h-16 w-full"},be={class:"flex"},ye={class:"shrink-0 flex items-center"},xe=["href"],we=["src"],ke={class:"hidden sm:-my-px sm:ml-6 sm:flex sm:space-x-8"},Se={class:"hidden sm:ml-6 sm:flex sm:items-center"},De=a("button",{type:"button",class:"bg-white p-1 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"},null,-1),$e=["src"],Ie={class:"-mr-2 flex items-center sm:hidden"},Be=a("span",{class:"sr-only"},"Open main menu",-1),Ce={class:"pt-2 pb-3 space-y-1"},Oe={class:"pt-4 pb-3 border-t border-gray-200"},Pe={class:"flex items-center px-4"},Ue={class:"shrink-0"},Le=["src"],Ne={class:"ml-3"},je={class:"text-base font-medium text-gray-800"},Ee={class:"text-sm font-medium text-gray-500"},Ae=a("button",{type:"button",class:"ml-auto bg-white shrink-0 p-1 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"},null,-1),Me={class:"mt-3 space-y-1"},Te={__name:"TheSiteHeader",setup(s){const{t:i}=oe.useI18n(),p=J(),t=Q(),e=[{title:i("navigation.logout"),link:`/${t.companySlug}/customer/login`}],g=W(),r=re(),o=x(""),m=w(()=>t.currentUser&&t.currentUser.avatar!==0?t.currentUser.avatar:h());function h(){return new URL("/build/assets/default-avatar-4j3-l2sn.jpg",import.meta.url)}le(p,c=>{o.value=c.path},{immediate:!0});const _=w(()=>window.customer_logo?window.customer_logo:!1);function b(c){return p.path.indexOf(c)>-1}function l(){g.logout(t.companySlug).then(c=>{c&&r.push({name:"customer.login"})})}return(c,T)=>{const k=P("router-link"),C=P("BaseDropdownItem"),Z=P("BaseDropdown");return v(),S(n(me),{as:"nav",class:"bg-white shadow-sm fixed top-0 left-0 z-20 w-full"},{default:f(({open:q})=>[a("div",he,[a("div",_e,[a("div",be,[a("div",ye,[a("a",{href:`/${n(t).companySlug}/customer/dashboard`,class:"float-none text-lg not-italic font-black tracking-wider text-white brand-main md:float-left font-base"},[_.value?(v(),B("img",{key:1,src:_.value,class:"h-6"},null,8,we)):(v(),S(ne,{key:0,class:"h-6"}))],8,xe)]),a("div",ke,[(v(!0),B(L,null,N(n(t).mainMenu,u=>(v(),S(k,{key:u.title,to:`/${n(t).companySlug}${u.link}`,class:j([b(u.link)?"border-primary-500 text-primary-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300","inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium"])},{default:f(()=>[I(y(u.title),1)]),_:2},1032,["to","class"]))),128))])]),a("div",Se,[De,d(n(ue),{as:"div",class:"ml-3 relative"},{default:f(()=>[d(Z,{"width-class":"w-48"},{activator:f(()=>[d(n(ie),{class:"bg-white flex text-sm rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"},{default:f(()=>[a("img",{class:"h-8 w-8 rounded-full",src:m.value,alt:""},null,8,$e)]),_:1})]),default:f(()=>[d(k,{to:{name:"customer.profile"}},{default:f(()=>[d(C,null,{default:f(()=>[d(n(O.CogIcon),{class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500","aria-hidden":"true"}),I(" "+y(c.$t("navigation.settings")),1)]),_:1})]),_:1},8,["to"]),d(C,{onClick:l},{default:f(()=>[d(n(O.LogoutIcon),{class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500","aria-hidden":"true"}),I(" "+y(c.$t("navigation.logout")),1)]),_:1})]),_:1})]),_:1})]),a("div",Ie,[d(n(ve),{class:"bg-white inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"},{default:f(()=>[Be,q?(v(),S(n(O.XIcon),{key:1,class:"block h-6 w-6","aria-hidden":"true"})):(v(),S(n(O.MenuIcon),{key:0,class:"block h-6 w-6","aria-hidden":"true"}))]),_:2},1024)])])]),d(n(ge),{class:"sm:hidden"},{default:f(()=>[a("div",Ce,[(v(!0),B(L,null,N(n(t).mainMenu,u=>(v(),S(k,{key:u.title,to:`/${n(t).companySlug}${u.link}`,class:j([b(u.link)?"bg-primary-50 border-primary-500 text-primary-700":"border-transparent text-gray-600 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-800","block pl-3 pr-4 py-2 border-l-4 text-base font-medium"]),"aria-current":u.current?"page":void 0},{default:f(()=>[I(y(u.title),1)]),_:2},1032,["to","class","aria-current"]))),128))]),a("div",Oe,[a("div",Pe,[a("div",Ue,[a("img",{class:"h-10 w-10 rounded-full",src:m.value,alt:""},null,8,Le)]),a("div",Ne,[a("div",je,y(n(t).currentUser.title),1),a("div",Ee,y(n(t).currentUser.email),1)]),Ae]),a("div",Me,[(v(),B(L,null,N(e,u=>d(k,{key:u.title,to:u.link,class:j([b(u.link)?"bg-primary-50 border-primary-500 text-primary-700":"border-transparent text-gray-600 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-800","block pl-3 pr-4 py-2 border-l-4 text-base font-medium"])},{default:f(()=>[I(y(u.title),1)]),_:2},1032,["to","class"])),64))])])]),_:1})]),_:1})}}},Re={key:0,class:"h-full"},Ke={class:"mt-16 pb-16 h-screen overflow-y-auto min-h-0"},Ge={__name:"LayoutBasic",setup(s){const i=Q(),p=J(),t=w(()=>i.isAppLoaded);e();async function e(){await i.bootstrap(p.params.company)}return(g,r)=>{const o=P("router-view");return t.value?(v(),B("div",Re,[d(de),d(Te),a("main",Ke,[d(o)])])):ce("",!0)}}};export{Ge as default};
|