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

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