@oneclick.dev/cms-core-modules 0.0.117 → 0.0.118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("@oneclick.dev/cms-kit"),pe=require("./EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js"),C=require("./index-DtSvAFLL.js"),ne=require("@oneclick.dev/cms-kit/charts"),$=require("lucide-vue-next"),ge=require("./index-CxETuRsG.js"),z=require("./index-D_nfGegA.js"),ve=require("./_plugin-vue_export-helper-BHFhmbuH.js"),te=require("./OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js"),he=require("./NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js");function xe({x:u,y:p,w:a,h:g,tl:m=!1,tr:v=!1,bl:h=!1,br:i=!1,r:l=0}){let c;c=`M${u+l},${p}h${a-2*l}`;let r=v?l:0,d=v?0:l;return c+=`a${r},${r} 0 0 1 ${r},${r}`,c+=`h${d}v${d}`,c+=`v${g-2*l}`,r=i?l:0,d=i?0:l,c+=`a${r},${r} 0 0 1 ${-r},${r}`,c+=`v${d}h${-d}`,c+=`h${2*l-a}`,r=h?l:0,d=h?0:l,c+=`a${r},${r} 0 0 1 ${-r},${-r}`,c+=`h${-d}v${-d}`,c+=`v${2*l-g}`,r=m?l:0,d=m?0:l,c+=`a${r},${r} 0 0 1 ${r},${-r}`,c+=`v${-d}h${d}`,c+="z",c}const ye=Object.assign(Object.assign({},z.XYComponentDefaultConfig),{color:void 0,groupMaxWidth:void 0,groupWidth:void 0,dataStep:void 0,groupPadding:.05,barPadding:0,roundedCorners:2,barMinHeight:2,cursor:null,orientation:z.Orientation.Vertical}),ue=C.css`
2
+ label: grouped-bar-component;
3
+ `,ke=C.injectGlobal`
4
+ :root {
5
+ --vis-grouped-bar-cursor: default;
6
+ --vis-grouped-bar-fill-color: var(--vis-color-main);
7
+ --vis-grouped-bar-stroke-color: none;
8
+ --vis-grouped-bar-stroke-width: 0px;
9
+ --vis-grouped-bar-hover-stroke-width: 1px;
10
+ --vis-grouped-bar-hover-stroke-color: none;
11
+
12
+
13
+ /* Dark Theme */
14
+ --vis-dark-grouped-bar-stroke-color: none;
15
+ }
16
+
17
+ body.theme-dark ${`.${ue}`} {
18
+ --vis-grouped-bar-stroke-color: var(--vis-dark-grouped-bar-stroke-color);
19
+ }
20
+ `,ae=C.css`
21
+ label: bar;
22
+ fill: var(--vis-grouped-bar-fill-color);
23
+ stroke: var(--vis-grouped-bar-stroke-color);
24
+ stroke-width: var(--vis-grouped-bar-stroke-width);
25
+ cursor: var(--vis-grouped-bar-cursor);
26
+
27
+ &:hover {
28
+ stroke-width: var(--vis-grouped-bar-hover-stroke-width);
29
+ stroke: var(--vis-grouped-bar-hover-stroke-color);
30
+ }
31
+ `,re=C.css`
32
+ label: barGroup;
33
+ `,me=C.css`
34
+ label: barGroupExit;
35
+ `,Ce=Object.freeze(Object.defineProperty({__proto__:null,bar:ae,barGroup:re,barGroupExit:me,globalStyles:ke,root:ue},Symbol.toStringTag,{value:"Module"}));class fe extends z.XYComponentCore{constructor(p){super(),this._defaultConfig=ye,this.config=this._defaultConfig,this.getAccessors=()=>C.isArray(this.config.y)?this.config.y:[this.config.y],this.events={},this._barData=[],p&&this.setConfig(p)}get bleed(){if(this._barData=this._getVisibleData(),this._barData.length===0)return{top:0,bottom:0,left:0,right:0};const p=!this.isVertical()&&this.dataScale.range()[0]>this.dataScale.range()[1],a=this.dataScale.domain(),g=this._getGroupWidth()/2,m=this._barData.map((y,B)=>C.getNumber(y,this.config.x,B)),v=C.min(m),h=C.max(m),i=this.dataScale(v),l=this.dataScale(h),c=this.dataScale.invert(i+(p?g:-g)),r=this.dataScale.invert(l+(p?-g:g)),d=c<=a[0]?this.dataScale(a[0])-this.dataScale(c):0,S=r>a[1]?this.dataScale(r)-this.dataScale(a[1]):0;return{top:this.isVertical()?0:p?-S:d,bottom:this.isVertical()?0:p?-d:S,left:this.isVertical()?d:0,right:this.isVertical()?S:0}}get dataScale(){return this.isVertical()?this.xScale:this.yScale}get valueScale(){return this.isVertical()?this.yScale:this.xScale}isVertical(){return this.config.orientation===z.Orientation.Vertical}_render(p){const{config:a}=this,g=C.isNumber(p)?p:a.duration,m=this._getGroupWidth(),v=this.getAccessors(),h=[-m/2,m/2],i=z.band().domain(z.range(v.length)).range(h).paddingInner(a.barPadding).paddingOuter(a.barPadding),l=this.g.selectAll(`.${re}`).data(this._barData,(E,N)=>{var I;return`${(I=C.getString(E,a.id,N))!==null&&I!==void 0?I:N}`}),c=(E,N)=>{const I=this.dataScale(C.getNumber(E,a.x,N)),_=this.isVertical()?I:0,P=this.isVertical()?0:I;return`translate(${_},${P})`},d=l.enter().append("g").attr("class",re).attr("transform",c).style("opacity",1).merge(l);C.smartTransition(d,g).attr("transform",c).style("opacity",1);const S=l.exit().attr("class",me);C.smartTransition(S,g).style("opacity",0).remove(),C.smartTransition(S.selectAll(`.${ae}`),g).attr("transform",(E,N,I)=>this.isVertical()?`translate(0,${this.yScale(0)}) scale(1,0)`:`translate(${this.xScale(0)},0) scale(0,1)`);const y=i.bandwidth(),B=d.selectAll(`.${ae}`).data(E=>v.map(()=>E)),w=this._getValueAxisDirection(),q=B.enter().append("path").attr("class",ae).attr("d",(E,N)=>{const I=i(N),_=this.valueScale(0),P=y;return this._getBarPath(I,_,P,0,!1,w)}).style("fill",(E,N)=>C.getColor(E,a.color,N)).merge(B);C.smartTransition(q,g).attr("d",(E,N)=>{const I=i(N),_=y,P=C.getNumber(E,v[N]),f=P<0;let M=f?this.valueScale(0):this.valueScale(P||0),U=Math.abs(this.valueScale(0)-this.valueScale(P))||0;if(U<a.barMinHeight){const Q=w===z.Direction.North?-1:1;M=this.valueScale(0)+Q*a.barMinHeight,U=a.barMinHeight}return this._getBarPath(I,M,_,U,f,w)}).style("fill",(E,N)=>C.getColor(E,a.color,N)).style("cursor",(E,N)=>C.getString(E,a.cursor,N)),C.smartTransition(B.exit(),g).remove()}_getValueAxisDirection(){return this.valueScale.range()[0]>this.valueScale.range()[1]?z.Direction.North:z.Direction.South}_getVisibleData(){const{config:p,datamodel:{data:a}}=this,g=this._getGroupWidth(),m=a.length<2?0:g/2,v=this.dataScale,h=Math.abs(v.invert(m)-v.invert(0));return a?.filter((l,c)=>{const r=C.getNumber(l,p.x,c),d=v.domain(),S=+d[0],y=+d[1];return r>=S-h&&r<=y+h})}_getBarPath(p,a,g,m,v,h){const{config:i}=this,l=i.roundedCorners?C.isNumber(i.roundedCorners)?+i.roundedCorners:g/2:0,c=C.clamp(l,0,Math.min(m,g)/2),r=h===z.Direction.North,d=this.isVertical()&&v!==r,S=this.isVertical()&&v===r,y=!this.isVertical()&&v,B=!this.isVertical()&&!v;return xe({x:this.isVertical()?p:a+(r?0:-m),y:this.isVertical()?a+(r?0:-m):p,w:this.isVertical()?g:m,h:this.isVertical()?m:g,tl:d||y,tr:d||B,bl:S||y,br:S||B,r:c})}_getGroupWidth(){const{config:p,datamodel:{data:a}}=this;if(C.isEmpty(a))return 0;if(p.groupWidth)return C.min([p.groupWidth,p.groupMaxWidth]);const g=this.dataScale.bandwidth,m=this.dataScale.domain?this.dataScale.domain():[];let h=1+(g?m.length:m[1]-m[0])/p.dataStep||!g&&a.filter((c,r)=>{const d=C.getNumber(c,p.x,r);return d>=m[0]&&d<=m[1]}).length||a.length;!g&&h>=2&&(h+=1);const l=(h<2?1:1-p.groupPadding)*(this.isVertical()?this._width:this._height)/h;return C.min([l,p.groupMaxWidth])}getValueScaleExtent(p){const{datamodel:a}=this,g=this.getAccessors(),m=p?this._getVisibleData():a.data,v=C.getMin(m,...g),h=C.getMax(m,...g);return[v>0?0:v,h<0?0:h]}getDataScaleExtent(){const{config:p,datamodel:a}=this;return C.getExtent(a.data,p.x)}getYDataExtent(p){return this.isVertical()?this.getValueScaleExtent(p):this.getDataScaleExtent()}getXDataExtent(){return this.isVertical()?this.getDataScaleExtent():this.getValueScaleExtent(!1)}}fe.selectors=Ce;const be={"data-vis-component":""},ce=e.defineComponent({__name:"index",props:{color:{},groupWidth:{},groupMaxWidth:{},dataStep:{},groupPadding:{},barPadding:{},roundedCorners:{type:[Number,Boolean]},barMinHeight:{},cursor:{},orientation:{},x:{},y:{},id:{type:Function},xScale:{type:[Object,Function]},yScale:{type:[Object,Function]},excludeFromDomainCalculation:{type:Boolean},duration:{},events:{},attributes:{},data:{}},setup(u,{expose:p}){const a=e.inject(C.o),g=u,m=e.computed(()=>a.data.value??g.data),v=C.m(g),h=e.ref();return e.onMounted(()=>{e.nextTick(()=>{var i;h.value=new fe(v.value),(i=h.value)==null||i.setData(m.value),a.update(h.value)})}),e.onUnmounted(()=>{var i;(i=h.value)==null||i.destroy(),a.destroy()}),e.watch(v,(i,l)=>{var c;C.f(i,l)||(c=h.value)==null||c.setConfig(v.value)}),e.watch(m,()=>{var i;(i=h.value)==null||i.setData(m.value)}),p({component:h}),(i,l)=>(e.openBlock(),e.createElementBlock("div",be))}}),Ve={class:"flex flex-col sm:flex-row"},De=["data-active"],Se={class:"flex items-center gap-2"},we={class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},Ne={class:"block text-lg leading-none font-bold sm:text-3xl"},_e={class:"mx-auto w-full max-w-sm mt-2 mb-8"},Be={class:"text-muted-foreground"},Ee={class:"text-muted-foreground"},$e={class:"grid"},Me={class:"flex gap-1 overflow-hidden max-w-80"},Re={class:"truncate"},Te=e.defineComponent({__name:"ResourceSelector",props:{resources:{type:Array,required:!0},totals:{type:Object,required:!0},viewMode:{type:String,required:!0},activeChart:{type:String,required:!1}},emits:["update:viewMode","update:activeChart"],setup(u,{emit:p}){const a=u,g=p,m=e.computed({get:()=>a.viewMode,set:c=>{g("update:viewMode",c)}}),v=e.computed({get:()=>a.activeChart,set:c=>{g("update:activeChart",c)}}),{width:h}=ge.useWindowSize(),i=e.computed(()=>h.value<640),l=e.ref(!1);return(c,r)=>{const d=e.resolveComponent("DrawerTitle"),S=e.resolveComponent("DrawerDescription"),y=e.resolveComponent("DrawerHeader"),B=e.resolveComponent("Button"),w=e.resolveComponent("DrawerFooter"),L=e.resolveComponent("DrawerContent"),q=e.resolveComponent("Drawer"),E=e.resolveComponent("DropdownMenuTrigger"),N=e.resolveComponent("DropdownMenuLabel"),I=e.resolveComponent("DropdownMenuItem"),_=e.resolveComponent("DropdownMenuContent"),P=e.resolveComponent("DropdownMenu");return e.openBlock(),e.createElementBlock("div",Ve,[u.resources.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,"data-active":u.viewMode==="stacked",class:"hover:bg-muted/50 flex flex-1 flex-col justify-center gap-2 border-t px-4 py-3 text-left sm:border-t-0 sm:border-l sm:px-6 sm:py-6 cursor-pointer select-none",onClick:r[0]||(r[0]=f=>l.value=!0),onContextmenu:r[1]||(r[1]=e.withModifiers(f=>l.value=!0,["prevent"]))},[e.createElementVNode("div",Se,[u.viewMode==="stacked"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref($.Layers),{class:"size-3 text-muted-foreground"}),r[6]||(r[6]=e.createElementVNode("span",{class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},"All Resources",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:"size-3 rounded-full mr-2",style:e.normalizeStyle({backgroundColor:u.resources.find(f=>f.id===u.activeChart)?.color||"#6b7280"})},null,4),e.createElementVNode("span",we,e.toDisplayString(u.resources.find(f=>f.id===u.activeChart)?.name||"Select Resource"),1)],64)),e.createVNode(e.unref($.ChevronDown),{class:"ml-auto size-4"})]),e.createElementVNode("span",Ne,e.toDisplayString(u.viewMode==="stacked"?Object.values(u.totals).reduce((f,M)=>f+M,0).toLocaleString():(u.totals[u.activeChart]||0).toLocaleString()),1)],40,De)):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createBlock(q,{key:1,open:e.unref(l),"onUpdate:open":r[3]||(r[3]=f=>e.isRef(l)?l.value=f:null)},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createElementVNode("div",_e,[e.createVNode(y,null,{default:e.withCtx(()=>[e.createVNode(d,null,{default:e.withCtx(()=>[...r[7]||(r[7]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createVNode(S,null,{default:e.withCtx(()=>[...r[8]||(r[8]=[e.createTextVNode("Select the resources to display on the timeline.",-1)])]),_:1})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(B,{onClick:r[2]||(r[2]=f=>{m.value="stacked",v.value="",l.value=!1}),variant:u.viewMode==="stacked"?"secondary":"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref($.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",Be," All Resources ("+e.toDisplayString(Object.values(u.totals).reduce((f,M)=>f+M,0).toLocaleString())+") ",1)]),_:1},8,["variant"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.resources,f=>(e.openBlock(),e.createBlock(B,{key:f.id,onClick:M=>{m.value="single",v.value=f.id,l.value=!1},variant:u.viewMode==="single"&&u.activeChart===f.id?"secondary":"outline"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:f.color||"#6b7280"})},null,4),e.createElementVNode("span",Ee,e.toDisplayString(f.name)+" ("+e.toDisplayString((u.totals[f.id]||0).toLocaleString())+") ",1)]),_:2},1032,["onClick","variant"]))),128))]),_:1})])]),_:1})]),_:1},8,["open"])):(e.openBlock(),e.createBlock(P,{key:2,open:e.unref(l),"onUpdate:open":r[5]||(r[5]=f=>e.isRef(l)?l.value=f:null)},{default:e.withCtx(()=>[e.createVNode(E,{"as-child":""},{default:e.withCtx(()=>[...r[9]||(r[9]=[e.createElementVNode("button",{tabindex:"-1",class:"size-0 opacity-0 self-end"},null,-1)])]),_:1}),e.createVNode(_,{align:"end"},{default:e.withCtx(()=>[e.createVNode(N,null,{default:e.withCtx(()=>[...r[10]||(r[10]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createElementVNode("div",$e,[e.createVNode(I,{onClick:r[4]||(r[4]=f=>{m.value="stacked",v.value="",l.value=!1}),class:e.normalizeClass(u.viewMode==="stacked"?"bg-input":"")},{default:e.withCtx(()=>[e.createVNode(e.unref($.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",null," All Resources ("+e.toDisplayString(Object.values(u.totals).reduce((f,M)=>f+M,0).toLocaleString())+") ",1)]),_:1},8,["class"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.resources,f=>(e.openBlock(),e.createBlock(I,{key:f.id,onClick:M=>{m.value="single",v.value=f.id,l.value=!1},class:e.normalizeClass(u.viewMode==="single"&&u.activeChart===f.id?"bg-input":"")},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:f.color||"#6b7280"})},null,4),e.createElementVNode("span",Me,[e.createElementVNode("span",Re,e.toDisplayString(f.name),1),e.createElementVNode("span",null,"("+e.toDisplayString((u.totals[f.id]||0).toLocaleString())+")",1)])]),_:2},1032,["onClick","class"]))),128))])]),_:1})]),_:1},8,["open"]))])}}}),ze={class:"flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6"},Ie={class:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3"},Oe={class:"flex items-center gap-1"},Ae={class:"timeline-date-trigger"},Pe={key:1,class:"flex items-center justify-center px-6 py-4 text-muted-foreground text-sm"},je={key:0,class:"flex items-center justify-center h-[250px]"},Fe={key:1,class:"flex items-center justify-center h-[250px]"},Le={key:2,class:"timeline-chart-scroll"},de="#61616180",We=36,qe=e.defineComponent({__name:"Timeline",props:{modelValue:{},selectedResource:{},viewMode:{},agendaData:{},resources:{}},emits:["update:modelValue","update:selectedResource","update:viewMode"],setup(u,{emit:p}){const a=u,g=p,{params:m}=H.useModuleRoute(),{config:v}=H.useModule(),h=H.useFirebaseIntegration(v.project),i=e.ref([]),l=e.ref([]),c=e.ref(!0),r=e.ref(a.viewMode||"stacked"),d=e.ref(a.selectedResource||"");e.watch(r,n=>{g("update:viewMode",n)},{immediate:!0}),e.watch(d,n=>{g("update:selectedResource",r.value==="single"?n:null)}),e.watch(r,n=>{g("update:selectedResource",n==="single"?d.value:null)}),e.watch(()=>a.selectedResource,n=>{r.value==="single"&&n!==d.value&&(d.value=n||"")});const S=new Date,y=e.ref(a.modelValue||new Date),B=e.ref(null);e.watch(()=>a.modelValue,n=>{n&&n.getTime()!==y.value.getTime()&&(y.value=n)}),e.watch(y,n=>{g("update:modelValue",n)},{immediate:!0});const w=e.computed({get:()=>b(y.value),set:n=>{if(!n){y.value=new Date;return}y.value=new Date(`${n}T00:00:00`)}}),L=()=>{const n=B.value;if(n){if(typeof n.showPicker=="function"){n.showPicker();return}n.focus(),n.click()}},q=e.computed(()=>{const n=new Date(S);n.setDate(S.getDate()-1);const t=new Date(S);return t.setDate(S.getDate()+1),y.value.toDateString()===S.toDateString()?"Today":y.value.toDateString()===n.toDateString()?"Yesterday":y.value.toDateString()===t.toDateString()?"Tomorrow":y.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),E=()=>{const n=new Date(y.value);n.setDate(n.getDate()-1),y.value=n},N=()=>{const n=new Date(y.value);n.setDate(n.getDate()+1),y.value=n},I=()=>{y.value=new Date},_=e.computed(()=>(a.resources?.length||0)===0?10:Math.max(...(a.resources||[]).map(n=>n.capacity||10))),P=e.computed(()=>(a.resources?.length||0)===0?10:(a.resources||[]).reduce((n,t)=>n+(t.capacity||10),0)),f=e.computed(()=>(a.resources?.length||0)===0?60:Math.min(...(a.resources||[]).map(n=>n.interval||60))),M=e.computed(()=>{const n={total:{label:"Total Reservations",color:void 0}};return(a.resources||[]).forEach((t,k)=>{n[t.id]={label:t.name,color:t.color||`var(--chart-${k%5+1})`}}),n});e.watch(()=>a.resources,n=>{const t=n?.[0];t&&!d.value&&(d.value=t.id)},{immediate:!0});const U=e.computed(()=>[...a.resources||[]].sort((n,t)=>{const k=ee.value[n.id]||0;return(ee.value[t.id]||0)-k})),Q=e.computed(()=>{const n=[];return f.value,i.value.forEach((t,k)=>{t.time.endsWith(":00")&&n.push(k)}),n}),ee=e.computed(()=>{const n={};return a.resources?.forEach(t=>{n[t.id]=l.value.filter(k=>k.resourceId===t.id).reduce((k,V)=>k+(V.reserved||0),0)}),n}),oe=e.computed(()=>i.value.reduce((n,t)=>Math.max(n,t.total||0),0)),G=e.computed(()=>({minWidth:`max(100%, ${Math.max(i.value.length,1)*We}px)`})),se=e.computed(()=>Math.max(P.value,oe.value,1)),s=(n,t)=>{const k=n[t];return typeof k=="number"?k:0},o=(n,t)=>{const k=U.value[t];return!k||s(n,k.id)<=0?0:U.value.slice(t).reduce((V,O)=>V+s(n,O.id),0)},b=n=>{const t=n.getFullYear(),k=String(n.getMonth()+1).padStart(2,"0"),V=String(n.getDate()).padStart(2,"0");return`${t}-${k}-${V}`},R=n=>{const[t,k]=n.split(":").map(Number);return t*60+k},j=(n,t)=>(a.agendaData?.exceptions||[]).find(V=>t>=V.startDate&&t<=V.endDate?V.resourceIds===null?!0:V.resourceIds?.includes(n):!1)||null,T=e.computed(()=>{const n=b(y.value),t=y.value.getDay();let k=1440,V=0;if((a.resources||[]).forEach(J=>{const A=j(J.id,n);if(A){if(A.isClosed)return;A.timeslots.forEach(W=>{const x=R(W.startTime),D=R(W.endTime);k=Math.min(k,x),V=Math.max(V,D)})}else(J.openingHours?.[t]||[]).forEach(x=>{const D=R(x.start),F=R(x.end);k=Math.min(k,D),V=Math.max(V,F)})}),k>=V)return{startMinutes:540,endMinutes:1020};const O=Math.floor(k/60)*60,K=Math.ceil(V/60)*60;return{startMinutes:O,endMinutes:K}}),Y=()=>{const n=[],t=f.value,{startMinutes:k,endMinutes:V}=T.value;for(let O=k;O<V;O+=t){const K=Math.floor(O/60),J=O%60,A=`${String(K).padStart(2,"0")}:${String(J).padStart(2,"0")}`,W={time:A,label:A,total:0};a.resources?.forEach(x=>{W[x.id]=0}),n.push(W)}return n},X=async()=>{c.value=!0;try{const n=m.value.id,t=b(y.value),k=`${n}_${t}`,V=await h.get(v.reservedSpotsCollection,k);l.value=[];for(const A of a.resources||[]){const W=V?.[A.id]||{};Object.entries(W).forEach(([x,D])=>{const[F,Z]=x.split("-");l.value.push({resourceId:A.id,startTime:F,endTime:Z,reserved:D})})}const O=Y(),K=f.value,{startMinutes:J}=T.value;l.value.forEach(A=>{const W=R(A.startTime),x=R(A.endTime);for(let D=W;D<x;D+=K){const F=Math.floor((D-J)/K);if(F>=0&&F<O.length){const Z=O[F][A.resourceId];if(typeof Z=="number"){const ie=Number(A.reserved)||0;O[F][A.resourceId]=Z+ie,O[F].total+=ie}}}}),i.value=O}catch(n){console.error("Error loading reservation data:",n),i.value=Y(),l.value=[]}finally{c.value=!1}};return(async()=>await X())(),e.watch(y,()=>{X()}),e.watch(()=>a.resources,()=>{(a.resources?.length||0)>0&&X()}),(n,t)=>{const k=e.resolveComponent("CardTitle"),V=e.resolveComponent("Button"),O=e.resolveComponent("CardDescription"),K=e.resolveComponent("CardHeader"),J=e.resolveComponent("ChartContainer"),A=e.resolveComponent("CardContent"),W=e.resolveComponent("Card");return e.openBlock(),e.createBlock(W,{class:"py-4 sm:py-0"},{default:e.withCtx(()=>[e.createVNode(K,{class:"flex flex-col items-stretch border-b !p-0 sm:flex-row"},{default:e.withCtx(()=>[e.createElementVNode("div",ze,[e.createElementVNode("div",Ie,[e.createVNode(k,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createElementVNode("div",Oe,[e.createVNode(V,{variant:"outline",size:"icon",class:"size-8",onClick:E},{default:e.withCtx(()=>[e.createVNode(e.unref($.ChevronLeft),{size:16})]),_:1}),e.createVNode(V,{variant:"outline",size:"sm",class:"h-8 px-3 text-xs",onClick:I},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(V,{variant:"outline",size:"icon",class:"size-8",onClick:N},{default:e.withCtx(()=>[e.createVNode(e.unref($.ChevronRight),{size:16})]),_:1})])]),e.createVNode(O,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ae,[e.createVNode(V,{type:"button",variant:"outline",onClick:L},{default:e.withCtx(()=>[e.createVNode(e.unref($.CalendarIcon),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(q)),1)]),_:1}),e.withDirectives(e.createElementVNode("input",{ref_key:"dateInputRef",ref:B,"onUpdate:modelValue":t[0]||(t[0]=x=>e.isRef(w)?w.value=x:null),type:"date",class:"timeline-date-picker","aria-label":"Select reservation date"},null,512),[[e.vModelText,e.unref(w)]])])]),_:1})]),(u.resources?.length||0)>0?(e.openBlock(),e.createBlock(Te,{key:0,resources:u.resources||[],totals:e.unref(ee),viewMode:e.unref(r),"onUpdate:viewMode":t[1]||(t[1]=x=>e.isRef(r)?r.value=x:null),activeChart:e.unref(d),"onUpdate:activeChart":t[2]||(t[2]=x=>e.isRef(d)?d.value=x:null)},null,8,["resources","totals","viewMode","activeChart"])):(e.openBlock(),e.createElementBlock("div",Pe," No resources configured "))]),_:1}),e.createVNode(A,{class:"px-2 sm:p-6"},{default:e.withCtx(()=>[e.unref(c)?(e.openBlock(),e.createElementBlock("div",je,[...t[5]||(t[5]=[e.createElementVNode("div",{class:"text-muted-foreground"},"Loading...",-1)])])):(u.resources?.length||0)===0?(e.openBlock(),e.createElementBlock("div",Fe,[...t[6]||(t[6]=[e.createElementVNode("div",{class:"text-muted-foreground"},"No resources to display",-1)])])):(e.openBlock(),e.createElementBlock("div",Le,[e.unref(r)==="stacked"?(e.openBlock(),e.createBlock(J,{key:0,config:e.unref(M),style:e.normalizeStyle(e.unref(G)),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(z.$),{data:e.unref(i),margin:{left:-24},"y-domain":[0,e.unref(se)]},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(U),(x,D)=>(e.openBlock(),e.createBlock(e.unref(ce),{key:x.id,x:(F,Z)=>Z,y:F=>o(F,D),color:F=>s(F,x.id)>0?e.unref(M)[x.id]?.color:de,"bar-padding":.1,"rounded-corners":2},null,8,["x","y","color"]))),128)),e.createVNode(e.unref(z.O),{type:"x",x:(x,D)=>D,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(Q),"tick-format":x=>e.unref(i)[x]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(z.O),{type:"y","num-ticks":3,"tick-line":!1,"domain-line":!1}),e.createVNode(e.unref(z.z)),e.createVNode(e.unref(z.A),{template:e.unref(ne.componentToString)(e.unref(M),e.unref(ne.ChartTooltipContent),{labelFormatter(x){if(x instanceof Date)return"";const D=Math.round(x);return D>=0&&D<e.unref(i).length&&e.unref(i)[D]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config","style"])):(e.openBlock(),e.createBlock(J,{key:e.unref(d),config:e.unref(M),style:e.normalizeStyle(e.unref(G)),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(z.$),{data:e.unref(i),margin:{left:-24},"y-domain":[0,e.unref(_)]},{default:e.withCtx(()=>[e.createVNode(e.unref(ce),{x:(x,D)=>D,y:x=>x[e.unref(d)]||0,color:x=>x[e.unref(d)]>0?e.unref(M)[e.unref(d)]?.color:de,"bar-padding":.1,"rounded-corners":!1},null,8,["x","y","color"]),e.createVNode(e.unref(z.O),{type:"x",x:(x,D)=>D,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(Q),"tick-format":x=>e.unref(i)[x]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(z.O),{type:"y","num-ticks":3,"tick-line":!1,"domain-line":!1}),e.createVNode(e.unref(z.z)),e.createVNode(e.unref(z.A),{template:e.unref(ne.componentToString)(e.unref(M),e.unref(ne.ChartTooltipContent),{labelFormatter(x){if(x instanceof Date)return"";const D=Math.round(x);return D>=0&&D<e.unref(i).length&&e.unref(i)[D]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config","style"]))]))]),_:1})]),_:1})}}}),Ge=ve._export_sfc(qe,[["__scopeId","data-v-fa0a6ba8"]]),He={class:"flex flex-row items-center justify-between gap-2"},Ue={class:"relative mb-4"},Ye={class:"flex gap-1 mb-4 flex-wrap select-none"},Xe={key:0,class:"mb-3 text-sm text-muted-foreground"},Je={key:1,class:"flex items-center justify-center py-8"},Ke={key:2,class:"flex flex-col items-center gap-2 text-center py-8 text-muted-foreground"},Qe={key:3,class:"text-center py-8 text-muted-foreground"},Ze={key:4,class:"space-y-2"},et=["onClick"],tt={class:"flex items-start justify-between"},ot={class:"flex-1"},nt={class:"font-medium"},at={class:"text-sm text-muted-foreground"},rt={class:"text-sm text-muted-foreground"},st={class:"flex items-center gap-4 flex-wrap"},lt={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},it={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},ct={key:0,class:"flex items-center gap-1 mt-1 text-xs text-muted-foreground"},dt={class:"text-right"},ut={key:0,class:"inline-block px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},mt={key:1,class:"inline-block px-2 py-1 text-xs rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"},ft={key:2,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},pt={key:3,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},gt={key:4,class:"inline-block px-2 py-1 text-xs rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"},vt={key:5,class:"text-sm font-medium mt-1"},ht=e.defineComponent({__name:"BookingsList",props:{agendaData:{},activeDate:{},selectedResource:{},resources:{}},emits:["resetSelectedResource"],setup(u,{emit:p}){const a=u,g=p,{params:m}=H.useModuleRoute(),{config:v}=H.useModule(),h=H.useFirebaseIntegration(v.project),i=e.ref([]),l=e.ref(!0),c=e.ref(""),r=e.ref(null),d=e.ref(null),S=e.computed(()=>m.value?.id??m.id??a.agendaData?.id??""),{metadataSchema:y}=te.useAgendaMetadataSchema(S),B=e.computed(()=>({date:w(a.activeDate),resource:null}));e.provide("event",B);const w=s=>{const o=s.getFullYear(),b=String(s.getMonth()+1).padStart(2,"0"),R=String(s.getDate()).padStart(2,"0");return`${o}-${b}-${R}`},L=e.computed(()=>{let s=i.value;return a.selectedResource&&(s=s.filter(o=>o.resourceId===a.selectedResource)),c.value.trim()&&(s=new te.Fuse(s,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(c.value).map(b=>b.item)),s}),q=e.computed(()=>L.value.filter(s=>_.value.includes(s.reservationStatus))),E=e.computed(()=>{let s=JSON.parse(JSON.stringify(i.value));return a.selectedResource&&(s=s.filter(o=>o.resourceId===a.selectedResource)),s.some(o=>o.reservationStatus==="approved"||o.reservationStatus==="needs_approval")}),N=e.computed(()=>{const s=i.value.filter(o=>o.reservationStatus==="approved"||o.reservationStatus==="needs_approval");return{spots:s.reduce((o,b)=>o+(b.spots||0),0),bookings:s.length}}),I=()=>{c.value=""},_=e.ref(["needs_approval","approved"]),P=s=>{_.value.includes(s)?_.value=_.value.filter(o=>o!==s):_.value.push(s)},f=(s,o,b=o.date)=>{const R=a.resources.find(T=>T.id===o.resourceId),j=s.id||s.orderId||o.orderId||"";return{customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:o.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:j,res_id:o.id,resourceId:o.resourceId,spots:o.spots,date:b,createdAt:s.createdAt,startTime:o.timeslot?.startTime,endTime:o.timeslot?.endTime,reservationPrice:o.totalPrice,reservationBasePrice:o.basePrice,reservationAddOnsPrice:o.addOnsPrice,orderReservationCount:Array.isArray(s.reservations)?s.reservations.length:void 0,pricingOptionId:o.pricingOptionId,pricingOption:o.pricingOption,resourceName:R?.name,resourceColor:R?.color,metadata:s.metadata||{},reservationMetadata:o.metadata||{},refundStatus:o.refundStatus,refundedAt:o.refundedAt,refundedAmount:o.refundedAmount,refunds:Array.isArray(o.refunds)?o.refunds:[],adjustments:s.adjustments||[],reservationAdjustments:o.adjustments||[]}},M=async()=>{await e.nextTick(),await new Promise(s=>{if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>s());return}s()})},U=async s=>{const o=await h.get(v.reservationsCollection,s);if(!o)return;const b={...o,id:o.id||s},R=(b.reservations||[]).map(j=>f(b,j));R.length&&(await M(),d.value?.openDialog({id:b.id,customerInfo:b.customerInfo,status:b.status,createdAt:b.createdAt,metadata:b.metadata||{},reservations:R,adjustments:b.adjustments||[],totalPrice:typeof b.total=="number"?b.total:R.reduce((j,T)=>j+(T.reservationPrice||0),0),totalSpots:R.reduce((j,T)=>j+(T.spots||0),0)}))},Q=async s=>{await M(),r.value?.openDialog(s)},ee=s=>s.orderReservationCount===1&&typeof s.total=="number"?s.total:typeof s.reservationPrice=="number"?s.reservationPrice:null,oe=s=>{const o=ee(s);return o===null?null:`€${o.toFixed(2)}`},G=async()=>{l.value=!0,i.value=[];try{const s=m.value.id,o=w(a.activeDate),b=new Set;a.resources?.forEach(T=>{const Y=`${T.id}_${o}`;b.add(Y)});const R=await h.find(v.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:s},{field:"status",operator:"==",value:"confirmed"},{field:"flattenedReservationDates",operator:"array-contains-any",value:Array.from(b)}]});let j=[];R.forEach(T=>{(T.reservations?.filter(X=>X.date===o)||[]).forEach(X=>{j.push(f(T,X,o))})}),i.value=j.sort((T,Y)=>T.startTime?.localeCompare(Y.startTime||"")||0)}catch(s){console.error("Error loading orders:",s),i.value=[]}finally{l.value=!1}};return(async()=>await G())(),e.watch(()=>a.activeDate,()=>{G()}),(s,o)=>{const b=e.resolveComponent("Badge"),R=e.resolveComponent("CardTitle"),j=e.resolveComponent("CardDescription"),T=e.resolveComponent("Button"),Y=e.resolveComponent("CardHeader"),X=e.resolveComponent("Input"),le=e.resolveComponent("CardContent"),n=e.resolveComponent("Card");return e.openBlock(),e.createBlock(n,null,{default:e.withCtx(()=>[e.createVNode(Y,null,{default:e.withCtx(()=>[e.createElementVNode("div",He,[e.createElementVNode("div",null,[e.createVNode(R,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[o[9]||(o[9]=e.createTextVNode(" Bookings ",-1)),e.unref(N).bookings>0?(e.openBlock(),e.createBlock(b,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(N).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(j,{class:"flex items-center gap-2 mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref($.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(e.unref(N).spots)+" total spots",1)]),_:1})]),e.createVNode(T,{variant:"ghost",size:"icon",onClick:G,disabled:e.unref(l)},{default:e.withCtx(()=>[e.createVNode(e.unref($.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(l)})},null,8,["class"])]),_:1},8,["disabled"])])]),_:1}),e.createVNode(le,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[e.createVNode(e.unref($.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(X,{modelValue:e.unref(c),"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(c)?c.value=t:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(c)?(e.openBlock(),e.createBlock(T,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:I},{default:e.withCtx(()=>[e.createVNode(e.unref($.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ye,[u.agendaData.needsApproval?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:o[1]||(o[1]=t=>P("needs_approval")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("needs_approval")}])},[e.unref(_).includes("needs_approval")?(e.openBlock(),e.createBlock(e.unref($.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref($.EyeOff),{key:1,size:12})),e.createTextVNode(" Needs Approval ("+e.toDisplayString(e.unref(i).filter(t=>t.reservationStatus==="needs_approval").length)+") ",1)],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:o[2]||(o[2]=t=>P("approved")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("approved")}])},[e.unref(_).includes("approved")?(e.openBlock(),e.createBlock(e.unref($.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref($.EyeOff),{key:1,size:12})),e.createTextVNode(" Approved ("+e.toDisplayString(e.unref(i).filter(t=>t.reservationStatus==="approved").length)+") ",1)],2),u.agendaData.needsApproval?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:o[3]||(o[3]=t=>P("rejected")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("rejected")}])},[e.unref(_).includes("rejected")?(e.openBlock(),e.createBlock(e.unref($.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref($.EyeOff),{key:1,size:12})),e.createTextVNode(" Rejected ("+e.toDisplayString(e.unref(i).filter(t=>t.reservationStatus==="rejected").length)+") ",1)],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:o[4]||(o[4]=t=>P("cancelled")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("cancelled")}])},[e.unref(_).includes("cancelled")?(e.openBlock(),e.createBlock(e.unref($.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref($.EyeOff),{key:1,size:12})),e.createTextVNode(" Cancelled ("+e.toDisplayString(e.unref(i).filter(t=>t.reservationStatus==="cancelled").length)+") ",1)],2)]),e.unref(c)?(e.openBlock(),e.createElementBlock("div",Xe," Showing "+e.toDisplayString(e.unref(q).length)+" of "+e.toDisplayString(e.unref(i).length)+" bookings ",1)):e.createCommentVNode("",!0),e.unref(l)?(e.openBlock(),e.createElementBlock("div",Je,[...o[10]||(o[10]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(q).length===0?(e.openBlock(),e.createElementBlock("div",Ke,[o[13]||(o[13]=e.createTextVNode(" No bookings for this day ",-1)),e.unref(E)?(e.openBlock(),e.createBlock(T,{key:0,onClick:o[5]||(o[5]=t=>{_.value=["needs_approval","approved"],c.value=""})},{default:e.withCtx(()=>[...o[11]||(o[11]=[e.createTextVNode("Reset filters",-1)])]),_:1})):e.createCommentVNode("",!0),u.selectedResource!==null?(e.openBlock(),e.createBlock(T,{key:1,onClick:o[6]||(o[6]=t=>g("resetSelectedResource"))},{default:e.withCtx(()=>[...o[12]||(o[12]=[e.createTextVNode("Reset resource filter",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.unref(q).length===0?(e.openBlock(),e.createElementBlock("div",Qe," No bookings match your search ")):(e.openBlock(),e.createElementBlock("div",Ze,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(q),t=>(e.openBlock(),e.createElementBlock("div",{key:t.res_id||t.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:k=>e.unref(r)?.openDialog(t)},[e.createElementVNode("div",tt,[e.createElementVNode("div",ot,[e.createElementVNode("div",nt,e.toDisplayString(t.customerInfo.firstName+" "+t.customerInfo.lastName||"Unknown Customer"),1),e.createElementVNode("div",at,e.toDisplayString(t.customerInfo?.email),1),e.createElementVNode("div",rt,e.toDisplayString(t.customerInfo?.phone),1),e.createElementVNode("div",st,[e.createElementVNode("div",lt,[e.createVNode(e.unref($.Clock),{size:12}),e.createElementVNode("span",null,e.toDisplayString(t.startTime)+" - "+e.toDisplayString(t.endTime),1)]),e.createElementVNode("div",it,[e.createVNode(e.unref($.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(t.spots)+" "+e.toDisplayString(t.spots===1?"spot":"spots"),1)]),t.resourceName?(e.openBlock(),e.createElementBlock("div",ct,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:t.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(t.resourceName),1)])):e.createCommentVNode("",!0)]),e.createVNode(te._sfc_main,{metadata:{...t.metadata,...t.reservationMetadata},schema:e.unref(y),"display-filter":["highlight","badge"],compact:"",class:"mt-1"},null,8,["metadata","schema"])]),e.createElementVNode("div",dt,[t.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",ut,"Needs Approval")):t.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",mt,"Approved")):t.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",ft,"Rejected")):t.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",pt,"Cancelled")):(e.openBlock(),e.createElementBlock("span",gt,"Pending")),oe(t)?(e.openBlock(),e.createElementBlock("div",vt,e.toDisplayString(oe(t)),1)):e.createCommentVNode("",!0)])])],8,et))),128))]))]),_:1}),e.createVNode(te._sfc_main$1,{ref_key:"reservationDetailDialog",ref:r,agendaData:u.agendaData,resources:u.resources,"show-order-link":"",onCancelled:G,onConfirmed:G,onRejected:G,onTransferred:G,onOpenOrder:o[7]||(o[7]=t=>U(t))},null,8,["agendaData","resources"]),e.createVNode(te._sfc_main$2,{ref_key:"orderDetailDialog",ref:d,agendaData:u.agendaData,resources:u.resources,onOpenReservation:o[8]||(o[8]=t=>Q(t))},null,8,["agendaData","resources"])]),_:1})}}}),xt={class:"space-y-6"},yt={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},kt={class:"text-2xl font-semibold tracking-tight"},Ct={class:"flex flex-col md:flex-row gap-2"},bt={class:"grid gap-6 md:grid-cols-2 lg:grid-cols-3"},Vt={class:"md:col-span-2 lg:col-span-3"},Dt=e.defineComponent({__name:"index",setup(u){const{hasPermission:p}=H.useModulePermissions(),{params:a,resolvePath:g}=H.useModuleRoute(),{config:m}=H.useModule(),v=H.useFirebaseIntegration(m.project),h=e.ref(""),i=e.ref(!0),l=e.ref(new Date),c=e.ref(null),r=e.ref("stacked"),d=e.ref(null),S=e.ref([]);return(async()=>{try{const B=await v.get(m.agendaCollection,a.value.id);h.value=B?.serviceName||"",d.value=B,S.value=B?.resources?.filter(w=>w.isActive)||[]}catch(B){console.error("Error loading data:",B)}finally{i.value=!1}})(),(B,w)=>(e.openBlock(),e.createBlock(pe._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",xt,[e.createElementVNode("div",yt,[e.createElementVNode("div",null,[e.createElementVNode("h1",kt,e.toDisplayString(e.unref(h)||"Dashboard"),1),w[4]||(w[4]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," Overview and analytics for your booking service ",-1))]),e.createElementVNode("div",Ct,[e.unref(p)("manage-reservations")?(e.openBlock(),e.createBlock(he._sfc_main,{key:0,"agenda-data":e.unref(d)},null,8,["agenda-data"])):e.createCommentVNode("",!0)])]),e.createVNode(Ge,{modelValue:e.unref(l),"onUpdate:modelValue":w[0]||(w[0]=L=>e.isRef(l)?l.value=L:null),"view-mode":e.unref(r),"onUpdate:viewMode":w[1]||(w[1]=L=>e.isRef(r)?r.value=L:null),"selected-resource":e.unref(c),"onUpdate:selectedResource":w[2]||(w[2]=L=>e.isRef(c)?c.value=L:null),"agenda-data":e.unref(d),resources:e.unref(S)},null,8,["modelValue","view-mode","selected-resource","agenda-data","resources"]),e.createElementVNode("div",bt,[e.createElementVNode("div",Vt,[e.unref(S).length>0?(e.openBlock(),e.createBlock(ht,{key:0,"agenda-data":e.unref(d),"active-date":e.unref(l),"selected-resource":e.unref(c),resources:e.unref(S),onResetSelectedResource:w[3]||(w[3]=L=>c.value=null)},null,8,["agenda-data","active-date","selected-resource","resources"])):e.createCommentVNode("",!0)])])])]),_:1}))}});exports.default=Dt;