@oneclick.dev/cms-core-modules 0.0.114 → 0.0.116

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 (87) hide show
  1. package/dist/{ContentEditor-MctMvN7D.js → ContentEditor-CsbOFg3a.js} +52 -52
  2. package/dist/{ContentEditor-C5yNNLeV.mjs → ContentEditor-Df5uWpVC.mjs} +10337 -8677
  3. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +1 -0
  4. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +77 -0
  5. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BHeMJ6nr.mjs +1476 -0
  6. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js +1 -0
  7. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +925 -0
  8. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +5021 -0
  9. package/dist/Overview-CBahJviK.js +1 -0
  10. package/dist/Overview-CVQ1pkuD.mjs +527 -0
  11. package/dist/TableView-Csv5Lycy.mjs +6234 -0
  12. package/dist/TableView-Cwal0BPW.js +4 -0
  13. package/dist/agenda-BSdlrfxv.mjs +1253 -0
  14. package/dist/agenda-Bev1mO7E.js +1 -0
  15. package/dist/availability-ClBGVgE9.js +1 -0
  16. package/dist/availability-D8JdA4rP.mjs +274 -0
  17. package/dist/booking-data-Px7XCIfU.mjs +1024 -0
  18. package/dist/booking-data-aMS1p_3g.js +1 -0
  19. package/dist/cms-core-modules.css +1 -1
  20. package/dist/exceptions-CqityDo9.mjs +651 -0
  21. package/dist/exceptions-DXqc0Nza.js +1 -0
  22. package/dist/index-CM4eaK5T.mjs +1245 -0
  23. package/dist/index-DliTZzwI.js +35 -0
  24. package/dist/index.cjs.js +1 -1
  25. package/dist/index.mjs +12 -11
  26. package/dist/orders-1swJVKw2.js +1 -0
  27. package/dist/orders-D41GbzIa.mjs +624 -0
  28. package/dist/payment-BJHgpaeT.js +1 -0
  29. package/dist/payment-D5j-68Ig.mjs +1278 -0
  30. package/dist/refunds-D9nTeD2d.mjs +436 -0
  31. package/dist/refunds-oVB2Opib.js +1 -0
  32. package/dist/resources-8WouFvJe.js +1 -0
  33. package/dist/resources-B-D5MUhV.mjs +975 -0
  34. package/dist/server-handlers.cjs.js +1 -1
  35. package/dist/server-handlers.mjs +626 -515
  36. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +146 -5
  37. package/dist/src/appointments/components/edit/EventDialog/CancelRefundReservationDialog.vue.d.ts +33 -0
  38. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +26 -8
  39. package/dist/src/appointments/components/edit/EventDialog/RefundDetailsDisplay.vue.d.ts +8 -0
  40. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +91 -5
  41. package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +20 -3
  42. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +5 -0
  43. package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +20 -2
  44. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +240 -0
  45. package/dist/src/appointments/composables/useAgendaMetadataSchema.d.ts +37 -0
  46. package/dist/src/appointments/pages/edit/orders.vue.d.ts +225 -0
  47. package/dist/src/appointments/pages/edit/refunds.vue.d.ts +2 -0
  48. package/dist/src/appointments/server.d.ts +2 -0
  49. package/dist/src/appointments/types.d.ts +6 -0
  50. package/dist/src/appointments/utils/printReservation.d.ts +65 -3
  51. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.d.ts +36 -0
  52. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.vue.d.ts +95 -0
  53. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableCell.d.ts +13 -0
  54. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableHeader.d.ts +6 -0
  55. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableRow.d.ts +6 -0
  56. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/index.d.ts +4 -0
  57. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/TableMenu.vue.d.ts +13 -0
  58. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +14 -0
  59. package/package.json +2 -2
  60. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +0 -76
  61. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +0 -1
  62. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +0 -1
  63. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +0 -1263
  64. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +0 -1
  65. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +0 -330
  66. package/dist/Overview-98nkJUWN.mjs +0 -481
  67. package/dist/Overview-Dl8cMlsr.js +0 -1
  68. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +0 -349
  69. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +0 -3077
  70. package/dist/TableView-CVfkyj1k.js +0 -4
  71. package/dist/TableView-zDx0IegJ.mjs +0 -6096
  72. package/dist/agenda-BaJu3-1c.js +0 -1
  73. package/dist/agenda-BwVY_8oM.mjs +0 -1165
  74. package/dist/availability-CMrRa5y2.mjs +0 -269
  75. package/dist/availability-Cf2YfMwM.js +0 -1
  76. package/dist/booking-data-DgJd0BcM.mjs +0 -889
  77. package/dist/booking-data-Di5GmH_8.js +0 -1
  78. package/dist/exceptions-B6P9UiCj.js +0 -1
  79. package/dist/exceptions-De9-FvdP.mjs +0 -646
  80. package/dist/index-DL6orwdK.js +0 -35
  81. package/dist/index-hH3e-IYz.mjs +0 -1187
  82. package/dist/orders-C65SlpJy.mjs +0 -618
  83. package/dist/orders-XVzWAgG1.js +0 -1
  84. package/dist/payment-C3ohkehF.mjs +0 -1080
  85. package/dist/payment-Dfr-Ro-a.js +0 -1
  86. package/dist/resources-CxeFd57z.js +0 -1
  87. package/dist/resources-DwYxn2Vi.mjs +0 -811
@@ -1,35 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),G=require("@oneclick.dev/cms-kit"),le=require("./EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js"),C=require("./index-DtSvAFLL.js"),Q=require("@oneclick.dev/cms-kit/charts"),F=require("lucide-vue-next"),ie=require("./index-CxETuRsG.js"),M=require("./index-D_nfGegA.js"),ce=require("./_plugin-vue_export-helper-BHFhmbuH.js"),ee=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js"),de=require("./OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js"),ue=require("./NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js");function me({x:p,y:f,w:o,h:v,tl:g=!1,tr:h=!1,bl:x=!1,br:i=!1,r=0}){let l;l=`M${p+r},${f}h${o-2*r}`;let n=h?r:0,c=h?0:r;return l+=`a${n},${n} 0 0 1 ${n},${n}`,l+=`h${c}v${c}`,l+=`v${v-2*r}`,n=i?r:0,c=i?0:r,l+=`a${n},${n} 0 0 1 ${-n},${n}`,l+=`v${c}h${-c}`,l+=`h${2*r-o}`,n=x?r:0,c=x?0:r,l+=`a${n},${n} 0 0 1 ${-n},${-n}`,l+=`h${-c}v${-c}`,l+=`v${2*r-v}`,n=g?r:0,c=g?0:r,l+=`a${n},${n} 0 0 1 ${n},${-n}`,l+=`v${-c}h${c}`,l+="z",l}const pe=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}),ae=C.css`
2
- label: grouped-bar-component;
3
- `,fe=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 ${`.${ae}`} {
18
- --vis-grouped-bar-stroke-color: var(--vis-dark-grouped-bar-stroke-color);
19
- }
20
- `,Z=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
- `,te=C.css`
32
- label: barGroup;
33
- `,re=C.css`
34
- label: barGroupExit;
35
- `,ve=Object.freeze(Object.defineProperty({__proto__:null,bar:Z,barGroup:te,barGroupExit:re,globalStyles:fe,root:ae},Symbol.toStringTag,{value:"Module"}));class se extends M.XYComponentCore{constructor(f){super(),this._defaultConfig=pe,this.config=this._defaultConfig,this.getAccessors=()=>C.isArray(this.config.y)?this.config.y:[this.config.y],this.events={},this._barData=[],f&&this.setConfig(f)}get bleed(){if(this._barData=this._getVisibleData(),this._barData.length===0)return{top:0,bottom:0,left:0,right:0};const f=!this.isVertical()&&this.dataScale.range()[0]>this.dataScale.range()[1],o=this.dataScale.domain(),v=this._getGroupWidth()/2,g=this._barData.map((k,S)=>C.getNumber(k,this.config.x,S)),h=C.min(g),x=C.max(g),i=this.dataScale(h),r=this.dataScale(x),l=this.dataScale.invert(i+(f?v:-v)),n=this.dataScale.invert(r+(f?-v:v)),c=l<=o[0]?this.dataScale(o[0])-this.dataScale(l):0,N=n>o[1]?this.dataScale(n)-this.dataScale(o[1]):0;return{top:this.isVertical()?0:f?-N:c,bottom:this.isVertical()?0:f?-c:N,left:this.isVertical()?c:0,right:this.isVertical()?N: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(f){const{config:o}=this,v=C.isNumber(f)?f:o.duration,g=this._getGroupWidth(),h=this.getAccessors(),x=[-g/2,g/2],i=M.band().domain(M.range(h.length)).range(x).paddingInner(o.barPadding).paddingOuter(o.barPadding),r=this.g.selectAll(`.${te}`).data(this._barData,(B,$)=>{var _;return`${(_=C.getString(B,o.id,$))!==null&&_!==void 0?_:$}`}),l=(B,$)=>{const _=this.dataScale(C.getNumber(B,o.x,$)),P=this.isVertical()?_:0,I=this.isVertical()?0:_;return`translate(${P},${I})`},c=r.enter().append("g").attr("class",te).attr("transform",l).style("opacity",1).merge(r);C.smartTransition(c,v).attr("transform",l).style("opacity",1);const N=r.exit().attr("class",re);C.smartTransition(N,v).style("opacity",0).remove(),C.smartTransition(N.selectAll(`.${Z}`),v).attr("transform",(B,$,_)=>this.isVertical()?`translate(0,${this.yScale(0)}) scale(1,0)`:`translate(${this.xScale(0)},0) scale(0,1)`);const k=i.bandwidth(),S=c.selectAll(`.${Z}`).data(B=>h.map(()=>B)),w=this._getValueAxisDirection(),X=S.enter().append("path").attr("class",Z).attr("d",(B,$)=>{const _=i($),P=this.valueScale(0),I=k;return this._getBarPath(_,P,I,0,!1,w)}).style("fill",(B,$)=>C.getColor(B,o.color,$)).merge(S);C.smartTransition(X,v).attr("d",(B,$)=>{const _=i($),P=k,I=C.getNumber(B,h[$]),m=I<0;let j=m?this.valueScale(0):this.valueScale(I||0),Y=Math.abs(this.valueScale(0)-this.valueScale(I))||0;if(Y<o.barMinHeight){const L=w===M.Direction.North?-1:1;j=this.valueScale(0)+L*o.barMinHeight,Y=o.barMinHeight}return this._getBarPath(_,j,P,Y,m,w)}).style("fill",(B,$)=>C.getColor(B,o.color,$)).style("cursor",(B,$)=>C.getString(B,o.cursor,$)),C.smartTransition(S.exit(),v).remove()}_getValueAxisDirection(){return this.valueScale.range()[0]>this.valueScale.range()[1]?M.Direction.North:M.Direction.South}_getVisibleData(){const{config:f,datamodel:{data:o}}=this,v=this._getGroupWidth(),g=o.length<2?0:v/2,h=this.dataScale,x=Math.abs(h.invert(g)-h.invert(0));return o?.filter((r,l)=>{const n=C.getNumber(r,f.x,l),c=h.domain(),N=+c[0],k=+c[1];return n>=N-x&&n<=k+x})}_getBarPath(f,o,v,g,h,x){const{config:i}=this,r=i.roundedCorners?C.isNumber(i.roundedCorners)?+i.roundedCorners:v/2:0,l=C.clamp(r,0,Math.min(g,v)/2),n=x===M.Direction.North,c=this.isVertical()&&h!==n,N=this.isVertical()&&h===n,k=!this.isVertical()&&h,S=!this.isVertical()&&!h;return me({x:this.isVertical()?f:o+(n?0:-g),y:this.isVertical()?o+(n?0:-g):f,w:this.isVertical()?v:g,h:this.isVertical()?g:v,tl:c||k,tr:c||S,bl:N||k,br:N||S,r:l})}_getGroupWidth(){const{config:f,datamodel:{data:o}}=this;if(C.isEmpty(o))return 0;if(f.groupWidth)return C.min([f.groupWidth,f.groupMaxWidth]);const v=this.dataScale.bandwidth,g=this.dataScale.domain?this.dataScale.domain():[];let x=1+(v?g.length:g[1]-g[0])/f.dataStep||!v&&o.filter((l,n)=>{const c=C.getNumber(l,f.x,n);return c>=g[0]&&c<=g[1]}).length||o.length;!v&&x>=2&&(x+=1);const r=(x<2?1:1-f.groupPadding)*(this.isVertical()?this._width:this._height)/x;return C.min([r,f.groupMaxWidth])}getValueScaleExtent(f){const{datamodel:o}=this,v=this.getAccessors(),g=f?this._getVisibleData():o.data,h=C.getMin(g,...v),x=C.getMax(g,...v);return[h>0?0:h,x<0?0:x]}getDataScaleExtent(){const{config:f,datamodel:o}=this;return C.getExtent(o.data,f.x)}getYDataExtent(f){return this.isVertical()?this.getValueScaleExtent(f):this.getDataScaleExtent()}getXDataExtent(){return this.isVertical()?this.getDataScaleExtent():this.getValueScaleExtent(!1)}}se.selectors=ve;const ge={"data-vis-component":""},oe=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(p,{expose:f}){const o=e.inject(C.o),v=p,g=e.computed(()=>o.data.value??v.data),h=C.m(v),x=e.ref();return e.onMounted(()=>{e.nextTick(()=>{var i;x.value=new se(h.value),(i=x.value)==null||i.setData(g.value),o.update(x.value)})}),e.onUnmounted(()=>{var i;(i=x.value)==null||i.destroy(),o.destroy()}),e.watch(h,(i,r)=>{var l;C.f(i,r)||(l=x.value)==null||l.setConfig(h.value)}),e.watch(g,()=>{var i;(i=x.value)==null||i.setData(g.value)}),f({component:x}),(i,r)=>(e.openBlock(),e.createElementBlock("div",ge))}}),he={class:"flex flex-col sm:flex-row"},xe=["data-active"],ye={class:"flex items-center gap-2"},ke={class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},Ce={class:"block text-lg leading-none font-bold sm:text-3xl"},be={class:"mx-auto w-full max-w-sm mt-2 mb-8"},Ve={class:"text-muted-foreground"},we={class:"text-muted-foreground"},_e={class:"grid"},De={class:"flex gap-1 overflow-hidden max-w-80"},Ne={class:"truncate"},Se=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(p,{emit:f}){const o=p,v=f,g=e.computed({get:()=>o.viewMode,set:l=>{v("update:viewMode",l)}}),h=e.computed({get:()=>o.activeChart,set:l=>{v("update:activeChart",l)}}),{width:x}=ie.useWindowSize(),i=e.computed(()=>x.value<640),r=e.ref(!1);return(l,n)=>{const c=e.resolveComponent("DrawerTitle"),N=e.resolveComponent("DrawerDescription"),k=e.resolveComponent("DrawerHeader"),S=e.resolveComponent("Button"),w=e.resolveComponent("DrawerFooter"),A=e.resolveComponent("DrawerContent"),X=e.resolveComponent("Drawer"),B=e.resolveComponent("DropdownMenuTrigger"),$=e.resolveComponent("DropdownMenuLabel"),_=e.resolveComponent("DropdownMenuItem"),P=e.resolveComponent("DropdownMenuContent"),I=e.resolveComponent("DropdownMenu");return e.openBlock(),e.createElementBlock("div",he,[p.resources.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,"data-active":p.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",onClick:n[0]||(n[0]=m=>r.value=!0),onContextmenu:n[1]||(n[1]=e.withModifiers(m=>r.value=!0,["prevent"]))},[e.createElementVNode("div",ye,[p.viewMode==="stacked"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(F.Layers),{class:"size-3 text-muted-foreground"}),n[6]||(n[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:p.resources.find(m=>m.id===p.activeChart)?.color||"#6b7280"})},null,4),e.createElementVNode("span",ke,e.toDisplayString(p.resources.find(m=>m.id===p.activeChart)?.name||"Select Resource"),1)],64)),e.createVNode(e.unref(F.ChevronDown),{class:"ml-auto size-4"})]),e.createElementVNode("span",Ce,e.toDisplayString(p.viewMode==="stacked"?Object.values(p.totals).reduce((m,j)=>m+j,0).toLocaleString():(p.totals[p.activeChart]||0).toLocaleString()),1)],40,xe)):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createBlock(X,{key:1,open:e.unref(r),"onUpdate:open":n[3]||(n[3]=m=>e.isRef(r)?r.value=m:null)},{default:e.withCtx(()=>[e.createVNode(A,null,{default:e.withCtx(()=>[e.createElementVNode("div",be,[e.createVNode(k,null,{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[...n[7]||(n[7]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[...n[8]||(n[8]=[e.createTextVNode("Select the resources to display on the timeline.",-1)])]),_:1})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(S,{onClick:n[2]||(n[2]=m=>{g.value="stacked",h.value="",r.value=!1}),variant:p.viewMode==="stacked"?"secondary":"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(F.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",Ve," All Resources ("+e.toDisplayString(Object.values(p.totals).reduce((m,j)=>m+j,0).toLocaleString())+") ",1)]),_:1},8,["variant"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.resources,m=>(e.openBlock(),e.createBlock(S,{key:m.id,onClick:j=>{g.value="single",h.value=m.id,r.value=!1},variant:p.viewMode==="single"&&p.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",we,e.toDisplayString(m.name)+" ("+e.toDisplayString((p.totals[m.id]||0).toLocaleString())+") ",1)]),_:2},1032,["onClick","variant"]))),128))]),_:1})])]),_:1})]),_:1},8,["open"])):(e.openBlock(),e.createBlock(I,{key:2,open:e.unref(r),"onUpdate:open":n[5]||(n[5]=m=>e.isRef(r)?r.value=m:null)},{default:e.withCtx(()=>[e.createVNode(B,{"as-child":""},{default:e.withCtx(()=>[...n[9]||(n[9]=[e.createElementVNode("button",{tabindex:"-1",class:"size-0 opacity-0 self-end"},null,-1)])]),_:1}),e.createVNode(P,{align:"end"},{default:e.withCtx(()=>[e.createVNode($,null,{default:e.withCtx(()=>[...n[10]||(n[10]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createElementVNode("div",_e,[e.createVNode(_,{onClick:n[4]||(n[4]=m=>{g.value="stacked",h.value="",r.value=!1}),class:e.normalizeClass(p.viewMode==="stacked"?"bg-input":"")},{default:e.withCtx(()=>[e.createVNode(e.unref(F.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",null," All Resources ("+e.toDisplayString(Object.values(p.totals).reduce((m,j)=>m+j,0).toLocaleString())+") ",1)]),_:1},8,["class"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.resources,m=>(e.openBlock(),e.createBlock(_,{key:m.id,onClick:j=>{g.value="single",h.value=m.id,r.value=!1},class:e.normalizeClass(p.viewMode==="single"&&p.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",De,[e.createElementVNode("span",Ne,e.toDisplayString(m.name),1),e.createElementVNode("span",null,"("+e.toDisplayString((p.totals[m.id]||0).toLocaleString())+")",1)])]),_:2},1032,["onClick","class"]))),128))])]),_:1})]),_:1},8,["open"]))])}}}),Ee={class:"flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6"},Be={class:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3"},$e={class:"flex items-center gap-1"},Me={class:"timeline-date-trigger"},Re={key:1,class:"flex items-center justify-center px-6 py-4 text-muted-foreground text-sm"},Te={key:0,class:"flex items-center justify-center h-[250px]"},Ie={key:1,class:"flex items-center justify-center h-[250px]"},ne="#61616180",Oe=e.defineComponent({__name:"Timeline",props:{modelValue:{},selectedResource:{},viewMode:{},agendaData:{},resources:{}},emits:["update:modelValue","update:selectedResource","update:viewMode"],setup(p,{emit:f}){const o=p,v=f,{params:g}=G.useModuleRoute(),{config:h}=G.useModule(),x=G.useFirebaseIntegration(h.project),i=e.ref([]),r=e.ref([]),l=e.ref(!0),n=e.ref(o.viewMode||"stacked"),c=e.ref(o.selectedResource||"");e.watch(n,t=>{v("update:viewMode",t)},{immediate:!0}),e.watch(c,t=>{v("update:selectedResource",n.value==="single"?t:null)}),e.watch(n,t=>{v("update:selectedResource",t==="single"?c.value:null)}),e.watch(()=>o.selectedResource,t=>{n.value==="single"&&t!==c.value&&(c.value=t||"")});const N=new Date,k=e.ref(o.modelValue||new Date),S=e.ref(null);e.watch(()=>o.modelValue,t=>{t&&t.getTime()!==k.value.getTime()&&(k.value=t)}),e.watch(k,t=>{v("update:modelValue",t)},{immediate:!0});const w=e.computed({get:()=>J(k.value),set:t=>{if(!t){k.value=new Date;return}k.value=new Date(`${t}T00:00:00`)}}),A=()=>{const t=S.value;if(t){if(typeof t.showPicker=="function"){t.showPicker();return}t.focus(),t.click()}},X=e.computed(()=>{const t=new Date(N);t.setDate(N.getDate()-1);const u=new Date(N);return u.setDate(N.getDate()+1),k.value.toDateString()===N.toDateString()?"Today":k.value.toDateString()===t.toDateString()?"Yesterday":k.value.toDateString()===u.toDateString()?"Tomorrow":k.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),B=()=>{const t=new Date(k.value);t.setDate(t.getDate()-1),k.value=t},$=()=>{const t=new Date(k.value);t.setDate(t.getDate()+1),k.value=t},_=()=>{k.value=new Date},P=e.computed(()=>o.resources?.length===0?10:Math.max(...(o.resources||[]).map(t=>t.capacity||10))),I=e.computed(()=>(o.resources?.length||0)===0?60:Math.min(...(o.resources||[]).map(t=>t.interval||60))),m=e.computed(()=>{const t={total:{label:"Total Reservations",color:void 0}};return(o.resources||[]).forEach((u,V)=>{t[u.id]={label:u.name,color:u.color||`var(--chart-${V%5+1})`}}),t});e.watch(()=>o.resources,t=>{(t?.length||0)>0&&!c.value&&(c.value=t[0].id)},{immediate:!0});const j=e.computed(()=>[...o.resources||[]].sort((t,u)=>{const V=L.value[t.id]||0;return(L.value[u.id]||0)-V})),Y=e.computed(()=>{const t=[];return I.value,i.value.forEach((u,V)=>{u.time.endsWith(":00")&&t.push(V)}),t}),L=e.computed(()=>{const t={};return o.resources?.forEach(u=>{t[u.id]=r.value.filter(V=>V.resourceId===u.id).reduce((V,D)=>V+(D.reserved||0),0)}),t}),J=t=>{const u=t.getFullYear(),V=String(t.getMonth()+1).padStart(2,"0"),D=String(t.getDate()).padStart(2,"0");return`${u}-${V}-${D}`},s=t=>{const[u,V]=t.split(":").map(Number);return u*60+V},a=(t,u)=>(o.agendaData?.exceptions||[]).find(D=>u>=D.startDate&&u<=D.endDate?D.resourceIds===null?!0:D.resourceIds?.includes(t):!1)||null,E=e.computed(()=>{const t=J(k.value),u=k.value.getDay();let V=1440,D=0;if((o.resources||[]).forEach(U=>{const T=a(U.id,t);if(T){if(T.isClosed)return;T.timeslots.forEach(W=>{const y=s(W.startTime),b=s(W.endTime);V=Math.min(V,y),D=Math.max(D,b)})}else(U.openingHours?.[u]||[]).forEach(y=>{const b=s(y.start),q=s(y.end);V=Math.min(V,b),D=Math.max(D,q)})}),V>=D)return{startMinutes:540,endMinutes:1020};const d=Math.floor(V/60)*60,H=Math.ceil(D/60)*60;return{startMinutes:d,endMinutes:H}}),O=()=>{const t=[],u=I.value,{startMinutes:V,endMinutes:D}=E.value;for(let d=V;d<D;d+=u){const H=Math.floor(d/60),U=d%60,T=`${String(H).padStart(2,"0")}:${String(U).padStart(2,"0")}`,W={time:T,label:T};o.resources?.forEach(y=>{W[y.id]=0}),t.push(W)}return t},z=async()=>{l.value=!0;try{const t=g.value.id,u=J(k.value),V=`${t}_${u}`,D=await x.get(h.reservedSpotsCollection,V);r.value=[];for(const T of o.resources||[]){const W=D?.[T.id]||{};Object.entries(W).forEach(([y,b])=>{const[q,K]=y.split("-");r.value.push({resourceId:T.id,startTime:q,endTime:K,reserved:b})})}const d=O(),H=I.value,{startMinutes:U}=E.value;r.value.forEach(T=>{const W=s(T.startTime),y=s(T.endTime);for(let b=W;b<y;b+=H){const q=Math.floor((b-U)/H);if(q>=0&&q<d.length){const K=d[q][T.resourceId];typeof K=="number"&&(d[q][T.resourceId]=K+(T.reserved||0))}}}),i.value=d}catch(t){console.error("Error loading reservation data:",t),i.value=O(),r.value=[]}finally{l.value=!1}};return(async()=>await z())(),e.watch(k,()=>{z()}),e.watch(()=>o.resources,()=>{(o.resources?.length||0)>0&&z()}),(t,u)=>{const V=e.resolveComponent("CardTitle"),D=e.resolveComponent("Button"),d=e.resolveComponent("CardDescription"),H=e.resolveComponent("CardHeader"),U=e.resolveComponent("ChartContainer"),T=e.resolveComponent("CardContent"),W=e.resolveComponent("Card");return e.openBlock(),e.createBlock(W,{class:"py-4 sm:py-0"},{default:e.withCtx(()=>[e.createVNode(H,{class:"flex flex-col items-stretch border-b !p-0 sm:flex-row"},{default:e.withCtx(()=>[e.createElementVNode("div",Ee,[e.createElementVNode("div",Be,[e.createVNode(V,null,{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createElementVNode("div",$e,[e.createVNode(D,{variant:"outline",size:"icon",class:"size-8",onClick:B},{default:e.withCtx(()=>[e.createVNode(e.unref(F.ChevronLeft),{size:16})]),_:1}),e.createVNode(D,{variant:"outline",size:"sm",class:"h-8 px-3 text-xs",onClick:_},{default:e.withCtx(()=>[...u[4]||(u[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(D,{variant:"outline",size:"icon",class:"size-8",onClick:$},{default:e.withCtx(()=>[e.createVNode(e.unref(F.ChevronRight),{size:16})]),_:1})])]),e.createVNode(d,null,{default:e.withCtx(()=>[e.createElementVNode("div",Me,[e.createVNode(D,{type:"button",variant:"outline",onClick:A},{default:e.withCtx(()=>[e.createVNode(e.unref(F.CalendarIcon),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(X)),1)]),_:1}),e.withDirectives(e.createElementVNode("input",{ref_key:"dateInputRef",ref:S,"onUpdate:modelValue":u[0]||(u[0]=y=>e.isRef(w)?w.value=y:null),type:"date",class:"timeline-date-picker","aria-label":"Select reservation date"},null,512),[[e.vModelText,e.unref(w)]])])]),_:1})]),p.resources.length>0?(e.openBlock(),e.createBlock(Se,{key:0,resources:p.resources,totals:e.unref(L),viewMode:e.unref(n),"onUpdate:viewMode":u[1]||(u[1]=y=>e.isRef(n)?n.value=y:null),activeChart:e.unref(c),"onUpdate:activeChart":u[2]||(u[2]=y=>e.isRef(c)?c.value=y:null)},null,8,["resources","totals","viewMode","activeChart"])):(e.openBlock(),e.createElementBlock("div",Re," No resources configured "))]),_:1}),e.createVNode(T,{class:"px-2 sm:p-6"},{default:e.withCtx(()=>[e.unref(l)?(e.openBlock(),e.createElementBlock("div",Te,[...u[5]||(u[5]=[e.createElementVNode("div",{class:"text-muted-foreground"},"Loading...",-1)])])):p.resources.length===0?(e.openBlock(),e.createElementBlock("div",Ie,[...u[6]||(u[6]=[e.createElementVNode("div",{class:"text-muted-foreground"},"No resources to display",-1)])])):e.unref(n)==="stacked"?(e.openBlock(),e.createBlock(U,{key:2,config:e.unref(m),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(P)]},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(j),y=>(e.openBlock(),e.createBlock(e.unref(oe),{key:y.id,x:(b,q)=>q,y:b=>b[y.id]||0,color:b=>b[y.id]>0?e.unref(m)[y.id]?.color:ne,"bar-padding":.1,"rounded-corners":2},null,8,["x","y","color"]))),128)),e.createVNode(e.unref(M.O),{type:"x",x:(y,b)=>b,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(Y),"tick-format":y=>e.unref(i)[y]?.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(Q.componentToString)(e.unref(m),e.unref(Q.ChartTooltipContent),{labelFormatter(y){const b=Math.round(y);return b>=0&&b<e.unref(i).length&&e.unref(i)[b]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config"])):(e.openBlock(),e.createBlock(U,{key:e.unref(c),config:e.unref(m),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(P)]},{default:e.withCtx(()=>[e.createVNode(e.unref(oe),{x:(y,b)=>b,y:y=>y[e.unref(c)]||0,color:y=>y[e.unref(c)]>0?e.unref(m)[e.unref(c)]?.color:ne,"bar-padding":.1,"rounded-corners":!1},null,8,["x","y","color"]),e.createVNode(e.unref(M.O),{type:"x",x:(y,b)=>b,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(Y),"tick-format":y=>e.unref(i)[y]?.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(Q.componentToString)(e.unref(m),e.unref(Q.ChartTooltipContent),{labelFormatter(y){const b=Math.round(y);return b>=0&&b<e.unref(i).length&&e.unref(i)[b]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config"]))]),_:1})]),_:1})}}}),ze=ce._export_sfc(Oe,[["__scopeId","data-v-62490f67"]]),Pe={class:"flex flex-row items-center justify-between gap-2"},je={class:"relative mb-4"},Ae={class:"flex gap-1 mb-4 flex-wrap"},Fe={key:0,class:"mb-3 text-sm text-muted-foreground"},Le={key:1,class:"flex items-center justify-center py-8"},We={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"},Ge={key:4,class:"space-y-2"},He=["onClick"],Ue={class:"flex items-start justify-between"},Ye={class:"flex-1"},Xe={class:"font-medium"},Je={class:"text-sm text-muted-foreground"},Ke={class:"text-sm text-muted-foreground"},Qe={class:"flex items-center gap-4 flex-wrap"},Ze={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},et={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},tt={key:0,class:"flex items-center gap-1 mt-1 text-xs text-muted-foreground"},ot={class:"text-right"},nt={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"},at={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"},rt={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"},st={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"},lt={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"},it={key:5,class:"text-sm font-medium mt-1"},ct=e.defineComponent({__name:"BookingsList",props:{agendaData:{},activeDate:{},selectedResource:{},resources:{}},emits:["resetSelectedResource"],setup(p,{emit:f}){const o=p,v=f,{params:g}=G.useModuleRoute(),{config:h}=G.useModule(),x=G.useFirebaseIntegration(h.project),i=e.ref([]),r=e.ref(!0),l=e.ref(""),n=e.ref(null),c=e.ref(null),N=e.computed(()=>o.agendaData?.metadataSchema||[]),k=e.computed(()=>({date:S(o.activeDate),resource:null}));e.provide("event",k);const S=s=>{const a=s.getFullYear(),E=String(s.getMonth()+1).padStart(2,"0"),O=String(s.getDate()).padStart(2,"0");return`${a}-${E}-${O}`},w=e.computed(()=>{let s=i.value;return o.selectedResource&&(s=s.filter(a=>a.resourceId===o.selectedResource)),l.value.trim()&&(s=new ee.Fuse(s,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(l.value).map(E=>E.item)),s}),A=e.computed(()=>w.value.filter(s=>_.value.includes(s.reservationStatus))),X=e.computed(()=>{let s=JSON.parse(JSON.stringify(i.value));return o.selectedResource&&(s=s.filter(a=>a.resourceId===o.selectedResource)),s.some(a=>a.reservationStatus==="approved"||a.reservationStatus==="needs_approval")}),B=e.computed(()=>({spots:i.value.reduce((s,a)=>s+(a.spots||0),0),bookings:i.value.length})),$=()=>{l.value=""},_=e.ref(["needs_approval","approved"]),P=s=>{_.value.includes(s)?_.value=_.value.filter(a=>a!==s):_.value.push(s)},I=(s,a,E=a.date)=>{const O=o.resources.find(R=>R.id===a.resourceId),z=s.id||s.orderId||a.orderId||"";return{customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:a.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:z,res_id:a.id,resourceId:a.resourceId,spots:a.spots,date:E,createdAt:s.createdAt,startTime:a.timeslot?.startTime,endTime:a.timeslot?.endTime,reservationPrice:a.totalPrice,reservationBasePrice:a.basePrice,reservationAddOnsPrice:a.addOnsPrice,pricingOptionId:a.pricingOptionId,pricingOption:a.pricingOption,resourceName:O?.name||"Unknown",resourceColor:O?.color,metadata:s.metadata||{},reservationMetadata:a.metadata||{},adjustments:s.adjustments||[],reservationAdjustments:a.adjustments||[]}},m=async()=>{await e.nextTick(),await new Promise(s=>{if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>s());return}s()})},j=async s=>{const a=await x.get(h.reservationsCollection,s);if(!a)return;const E={...a,id:a.id||s},O=(E.reservations||[]).map(z=>I(E,z));O.length&&(await m(),c.value?.openDialog({id:E.id,customerInfo:E.customerInfo,status:E.status,createdAt:E.createdAt,metadata:E.metadata||{},reservations:O,adjustments:E.adjustments||[],totalPrice:typeof E.total=="number"?E.total:O.reduce((z,R)=>z+(R.reservationPrice||0),0),totalSpots:O.reduce((z,R)=>z+(R.spots||0),0)}))},Y=async s=>{await m(),n.value?.openDialog(s)},L=async()=>{r.value=!0,i.value=[];try{const s=g.value.id,a=S(o.activeDate),E=new Set;o.resources?.forEach(R=>{const t=`${R.id}_${a}`;E.add(t)});const O=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(E)}]});let z=[];O.forEach(R=>{(R.reservations?.filter(u=>u.date===a)||[]).forEach(u=>{z.push(I(R,u,a))})}),i.value=z.sort((R,t)=>R.startTime?.localeCompare(t.startTime||"")||0)}catch(s){console.error("Error loading orders:",s),i.value=[]}finally{r.value=!1}};return(async()=>await L())(),e.watch(()=>o.activeDate,()=>{L()}),(s,a)=>{const E=e.resolveComponent("Badge"),O=e.resolveComponent("CardTitle"),z=e.resolveComponent("CardDescription"),R=e.resolveComponent("Button"),t=e.resolveComponent("CardHeader"),u=e.resolveComponent("Input"),V=e.resolveComponent("CardContent"),D=e.resolveComponent("Card");return e.openBlock(),e.createBlock(D,null,{default:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[e.createElementVNode("div",Pe,[e.createElementVNode("div",null,[e.createVNode(O,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[a[9]||(a[9]=e.createTextVNode(" Bookings ",-1)),e.unref(B).bookings>0?(e.openBlock(),e.createBlock(E,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(B).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(z,{class:"flex items-center gap-2 mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(F.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(e.unref(B).spots)+" total spots",1)]),_:1})]),e.createVNode(R,{variant:"ghost",size:"icon",onClick:L,disabled:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(e.unref(F.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(r)})},null,8,["class"])]),_:1},8,["disabled"])])]),_:1}),e.createVNode(V,null,{default:e.withCtx(()=>[e.createElementVNode("div",je,[e.createVNode(e.unref(F.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(u,{modelValue:e.unref(l),"onUpdate:modelValue":a[0]||(a[0]=d=>e.isRef(l)?l.value=d:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(l)?(e.openBlock(),e.createBlock(R,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:$},{default:e.withCtx(()=>[e.createVNode(e.unref(F.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ae,[p.agendaData.needsApproval?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:a[1]||(a[1]=d=>P("needs_approval")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("needs_approval")}])}," Needs Approval ",2)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:a[2]||(a[2]=d=>P("approved")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("approved")}])}," Approved ",2),e.createElementVNode("button",{onClick:a[3]||(a[3]=d=>P("rejected")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("rejected")}])}," Rejected ",2),e.createElementVNode("button",{onClick:a[4]||(a[4]=d=>P("cancelled")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(_).includes("cancelled")}])}," Cancelled ",2)]),e.unref(l)?(e.openBlock(),e.createElementBlock("div",Fe," Showing "+e.toDisplayString(e.unref(w).length)+" of "+e.toDisplayString(e.unref(i).length)+" bookings ",1)):e.createCommentVNode("",!0),e.unref(r)?(e.openBlock(),e.createElementBlock("div",Le,[...a[10]||(a[10]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(A).length===0?(e.openBlock(),e.createElementBlock("div",We,[a[13]||(a[13]=e.createTextVNode(" No bookings for this day ",-1)),e.unref(X)?(e.openBlock(),e.createBlock(R,{key:0,onClick:a[5]||(a[5]=d=>_.value=["needs_approval","approved"])},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("Reset filters",-1)])]),_:1})):e.createCommentVNode("",!0),p.selectedResource!==null?(e.openBlock(),e.createBlock(R,{key:1,onClick:a[6]||(a[6]=d=>v("resetSelectedResource"))},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createTextVNode("Reset resource filter",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.unref(w).length===0?(e.openBlock(),e.createElementBlock("div",qe," No bookings match your search ")):(e.openBlock(),e.createElementBlock("div",Ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),d=>(e.openBlock(),e.createElementBlock("div",{key:d.res_id||d.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:H=>e.unref(n)?.openDialog(d)},[e.createElementVNode("div",Ue,[e.createElementVNode("div",Ye,[e.createElementVNode("div",Xe,e.toDisplayString(d.customerInfo.firstName+" "+d.customerInfo.lastName||"Unknown Customer"),1),e.createElementVNode("div",Je,e.toDisplayString(d.customerInfo?.email),1),e.createElementVNode("div",Ke,e.toDisplayString(d.customerInfo?.phone),1),e.createElementVNode("div",Qe,[e.createElementVNode("div",Ze,[e.createVNode(e.unref(F.Clock),{size:12}),e.createElementVNode("span",null,e.toDisplayString(d.startTime)+" - "+e.toDisplayString(d.endTime),1)]),e.createElementVNode("div",et,[e.createVNode(e.unref(F.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(d.spots)+" spots",1)]),d.resourceName?(e.openBlock(),e.createElementBlock("div",tt,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:d.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(d.resourceName),1)])):e.createCommentVNode("",!0)]),e.createVNode(ee._sfc_main,{metadata:{...d.metadata,...d.reservationMetadata},schema:e.unref(N),"display-filter":["highlight","badge"],compact:"",class:"mt-1"},null,8,["metadata","schema"])]),e.createElementVNode("div",ot,[d.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",nt,"Needs Approval")):d.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",at,"Approved")):d.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",rt,"Rejected")):d.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",st,"Cancelled")):(e.openBlock(),e.createElementBlock("span",lt,"Pending")),d.reservationPrice||d.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",it," €"+e.toDisplayString(d.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,He))),128))]))]),_:1}),e.createVNode(ee._sfc_main$1,{ref_key:"reservationDetailDialog",ref:n,agendaData:p.agendaData,"show-order-link":"",onCancelled:L,onConfirmed:L,onRejected:L,onOpenOrder:a[7]||(a[7]=d=>j(d))},null,8,["agendaData"]),e.createVNode(de._sfc_main,{ref_key:"orderDetailDialog",ref:c,agendaData:p.agendaData,onOpenReservation:a[8]||(a[8]=d=>Y(d))},null,8,["agendaData"])]),_:1})}}}),dt={class:"space-y-6"},ut={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},mt={class:"text-2xl font-semibold tracking-tight"},pt={class:"flex flex-col md:flex-row gap-2"},ft={class:"grid gap-6 md:grid-cols-2 lg:grid-cols-3"},vt={class:"md:col-span-2 lg:col-span-3"},gt=e.defineComponent({__name:"index",setup(p){const{hasPermission:f}=G.useModulePermissions(),{params:o,resolvePath:v}=G.useModuleRoute(),{config:g}=G.useModule(),h=G.useFirebaseIntegration(g.project),x=e.ref(""),i=e.ref(!0),r=e.ref(new Date),l=e.ref(null),n=e.ref("stacked"),c=e.ref(null),N=e.ref([]);return(async()=>{try{const S=await h.get(g.agendaCollection,o.value.id);x.value=S?.serviceName||"",c.value=S,N.value=S?.resources?.filter(w=>w.isActive)||[]}catch(S){console.error("Error loading data:",S)}finally{i.value=!1}})(),(S,w)=>(e.openBlock(),e.createBlock(le._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",dt,[e.createElementVNode("div",ut,[e.createElementVNode("div",null,[e.createElementVNode("h1",mt,e.toDisplayString(e.unref(x)||"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",pt,[e.unref(f)("manage-reservations")?(e.openBlock(),e.createBlock(ue._sfc_main,{key:0,"agenda-data":e.unref(c)},null,8,["agenda-data"])):e.createCommentVNode("",!0)])]),e.createVNode(ze,{modelValue:e.unref(r),"onUpdate:modelValue":w[0]||(w[0]=A=>e.isRef(r)?r.value=A:null),"view-mode":e.unref(n),"onUpdate:viewMode":w[1]||(w[1]=A=>e.isRef(n)?n.value=A:null),"selected-resource":e.unref(l),"onUpdate:selectedResource":w[2]||(w[2]=A=>e.isRef(l)?l.value=A:null),"agenda-data":e.unref(c),resources:e.unref(N)},null,8,["modelValue","view-mode","selected-resource","agenda-data","resources"]),e.createElementVNode("div",ft,[e.createElementVNode("div",vt,[e.unref(N).length>0?(e.openBlock(),e.createBlock(ct,{key:0,"agenda-data":e.unref(c),"active-date":e.unref(r),"selected-resource":e.unref(l),resources:e.unref(N),onResetSelectedResource:w[3]||(w[3]=A=>l.value=null)},null,8,["agenda-data","active-date","selected-resource","resources"])):e.createCommentVNode("",!0)])])])]),_:1}))}});exports.default=gt;