@oneclick.dev/cms-core-modules 0.0.119 → 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.
- package/dist/{ContentEditor-Cm28u_14.mjs → ContentEditor-W4YrQyBW.mjs} +3962 -3700
- package/dist/{ContentEditor-BnOVpmsQ.js → ContentEditor-YFnqVZrX.js} +42 -41
- package/dist/{EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs → EditLayout.vue_vue_type_script_setup_true_lang-BXVf9gZW.mjs} +20 -20
- package/dist/{EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js → EditLayout.vue_vue_type_script_setup_true_lang-CFFZ6r8i.js} +1 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +1 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs +1500 -0
- package/dist/Overview-Tf_ApkWh.js +1 -0
- package/dist/{Overview-CVQ1pkuD.mjs → Overview-usm5gPD1.mjs} +131 -131
- package/dist/{agenda-BtmnpFmi.js → agenda-BusN9-XG.js} +1 -1
- package/dist/{agenda-D0QBOJUy.mjs → agenda-CJXKaIo0.mjs} +7 -7
- package/dist/{availability-D8JdA4rP.mjs → availability-BP6GACqo.mjs} +1 -1
- package/dist/{availability-ClBGVgE9.js → availability-UUKdgidr.js} +1 -1
- package/dist/{booking-data-aMS1p_3g.js → booking-data-BHfLyOlu.js} +1 -1
- package/dist/{booking-data-Px7XCIfU.mjs → booking-data-WCBcpOOo.mjs} +1 -1
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-Dgj54ULn.mjs → exceptions-B8r2psu2.mjs} +1 -1
- package/dist/{exceptions-DXqc0Nza.js → exceptions-BazAiy2s.js} +1 -1
- package/dist/index-BiKWKrEs.js +35 -0
- package/dist/index-DJxex3Dt.mjs +1256 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +11 -11
- package/dist/{orders-C5NT99Fy.mjs → orders-B8C6u4iF.mjs} +229 -234
- package/dist/orders-CAAuDhkQ.js +1 -0
- package/dist/{payment-D5j-68Ig.mjs → payment-BOOJ1O6M.mjs} +1 -1
- package/dist/{payment-BJHgpaeT.js → payment-IxA9qiCV.js} +1 -1
- package/dist/{refunds-D9nTeD2d.mjs → refunds-CI0qpJC0.mjs} +1 -1
- package/dist/{refunds-oVB2Opib.js → refunds-CqGKm1NG.js} +1 -1
- package/dist/{resources-8WouFvJe.js → resources-B75nXreU.js} +1 -1
- package/dist/{resources-CK0oWssj.mjs → resources-dIZDh4Sz.mjs} +1 -1
- package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +2 -0
- package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +1 -0
- package/package.json +2 -2
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CcMEKZzd.mjs +0 -1476
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CkFsdcvP.js +0 -1
- package/dist/Overview-CBahJviK.js +0 -1
- package/dist/index-BnFWz40Q.mjs +0 -1261
- package/dist/index-DcGPR_vt.js +0 -35
- package/dist/orders-lO3dZ5un.js +0 -1
package/dist/index-DcGPR_vt.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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-CkFsdcvP.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;
|
package/dist/orders-lO3dZ5un.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),k=require("@oneclick.dev/cms-kit"),d=require("lucide-vue-next"),v=require("./OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js"),oe=require("./EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.js"),ae={class:"space-y-6"},re={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},se={class:"text-2xl font-semibold tracking-tight flex items-center gap-2"},le={class:"flex gap-1 border rounded-lg p-1 w-fit"},ce={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},de={class:"flex items-center gap-1"},ie={class:"flex items-center gap-1"},ue={class:"flex items-center gap-2"},me={class:"flex items-center gap-1"},fe={class:"mt-2 text-sm text-muted-foreground"},pe={class:"orders-date-trigger"},ge={class:"relative mb-4"},ve={key:0,class:"mb-3 text-sm text-muted-foreground"},xe={key:1,class:"flex items-center justify-center py-8"},ke={key:2,class:"text-center py-8 text-muted-foreground"},_e={key:3,class:"text-center py-8 text-muted-foreground"},ye={key:4,class:"space-y-2"},he=["onClick"],Ne={class:"flex items-start justify-between"},Ve={class:"flex-1"},we={class:"font-medium"},be={class:"text-sm text-muted-foreground"},De={class:"text-sm text-muted-foreground"},Ee={class:"flex items-center gap-4 flex-wrap mt-1"},Ce={class:"flex items-center gap-2 text-xs text-muted-foreground"},Se={class:"flex items-center gap-2 text-xs text-muted-foreground"},Be={key:0,class:"flex items-center gap-1 text-xs text-muted-foreground"},Ie={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},Pe={class:"text-right"},Te={key:0,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"},Ae={key:1,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"},ze={key:2,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"},Oe={key:3,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"},je={key:4,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"},Re={key:5,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"},Fe={key:6,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"},Le={key:7,class:"text-sm font-medium mt-1"},Me=["onClick"],Ue={class:"flex items-start justify-between"},qe={class:"flex-1"},$e={class:"flex items-center gap-2"},He={class:"font-medium"},Ye={class:"text-sm text-muted-foreground"},Ke={class:"text-sm text-muted-foreground"},Qe={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},Xe={class:"text-right"},Ge={key:0,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"},Je={key:1,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"},We={key:2,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"},Ze={class:"text-sm font-medium mt-1"},et=["onClick"],tt={class:"flex items-center justify-between"},ot={class:"flex items-center gap-4 flex-wrap"},nt={class:"flex items-center gap-2 text-xs text-muted-foreground"},at={class:"flex items-center gap-2 text-xs text-muted-foreground"},rt={key:0,class:"flex items-center gap-1 text-xs text-muted-foreground"},st={key:0,class:"text-right flex items-center gap-2"},lt={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"},ct={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"},dt={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"},it={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"},ut={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"},mt={key:5,class:"text-sm font-medium"},ft=e.defineComponent({__name:"orders",setup(gt){const T=k.useRoute();k.useRouter();const A=k.useOverlayParams(),{params:w}=k.useModuleRoute(),{config:N}=k.useModule(),b=k.useFirebaseIntegration(N.project),z=e.computed(()=>w.value?.id??w.id??""),{metadataSchema:D}=v.useAgendaMetadataSchema(z),u=e.ref([]),_=e.ref([]),y=e.ref(!0),E=e.ref(null),f=e.ref(""),h=e.ref(null),C=e.ref(null),x=e.ref("confirmed"),g=new Date,l=e.ref(new Date),O=e.ref(null),q=e.computed(()=>({date:j(l.value),resource:null}));e.provide("event",q);const S=e.computed({get:()=>j(l.value),set:o=>{if(!o){l.value=new Date;return}l.value=new Date(`${o}T00:00:00`)}}),$=()=>{const o=O.value;if(o){if(typeof o.showPicker=="function"){o.showPicker();return}o.focus(),o.click()}},H=e.computed(()=>{const o=new Date(g);o.setDate(g.getDate()-1);const t=new Date(g);return t.setDate(g.getDate()+1),l.value.toDateString()===g.toDateString()?"Today":l.value.toDateString()===o.toDateString()?"Yesterday":l.value.toDateString()===t.toDateString()?"Tomorrow":l.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),Y=()=>{const o=new Date(l.value);o.setDate(o.getDate()-1),l.value=o},K=()=>{const o=new Date(l.value);o.setDate(o.getDate()+1),o<=g&&(l.value=o)},Q=e.computed(()=>{const o=new Date(l.value);return o.setDate(o.getDate()+1),o<=g}),X=()=>{l.value=new Date},j=o=>{const t=o.getFullYear(),a=String(o.getMonth()+1).padStart(2,"0"),s=String(o.getDate()).padStart(2,"0");return`${t}-${a}-${s}`},R=o=>o?new Date(o).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):"",F=o=>o?new Date(o).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):"",L=(o,t)=>{const a=_.value.find(i=>i.id===t.resourceId),s=o.id||o.orderId||t.orderId||"";return{customerInfo:o.customerInfo,amountDue:o.amountDue,amountPaid:o.amountPaid,status:o.status,reservationStatus:t.status,subtotal:o.subtotal,total:o.total,discount:o.discount,id:s,res_id:t.id,resourceId:t.resourceId,spots:t.spots,date:t.date,createdAt:o.createdAt,startTime:t.timeslot?.startTime,endTime:t.timeslot?.endTime,reservationPrice:t.totalPrice,reservationBasePrice:t.basePrice,reservationAddOnsPrice:t.addOnsPrice,pricingOptionId:t.pricingOptionId,pricingOption:t.pricingOption,resourceName:a?.name,resourceColor:a?.color,metadata:o.metadata||{},reservationMetadata:t.metadata||{},refundStatus:t.refundStatus,refundedAt:t.refundedAt,refundedAmount:t.refundedAmount,refunds:Array.isArray(t.refunds)?t.refunds:[],adjustments:o.adjustments||[],reservationAdjustments:t.adjustments||[]}},B=async()=>{await e.nextTick(),await new Promise(o=>{if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>o());return}o()})},I=e.computed(()=>f.value.trim()?new v.Fuse(u.value,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(f.value).map(t=>t.item):u.value),M=e.computed(()=>{const o=new Map;for(const t of I.value){o.has(t.id)||o.set(t.id,{id:t.id,customerInfo:t.customerInfo,status:t.status,createdAt:t.createdAt,metadata:t.metadata||{},reservations:[],adjustments:t.adjustments||[],totalPrice:0,totalSpots:0});const a=o.get(t.id);a.reservations.push(t),a.totalPrice=typeof t.total=="number"?t.total:a.totalPrice+(t.reservationPrice||0),a.totalSpots+=t.spots||0}return Array.from(o.values())}),V=e.computed(()=>(console.log("orderssss",u.value),{spots:u.value.reduce((o,t)=>o+(t.spots||0),0),bookings:u.value.length,revenue:M.value.reduce((o,t)=>o+(t.totalPrice||0),0)})),G=()=>{f.value=""},J=async()=>{try{const o=await b.get(N.agendaCollection,z.value);E.value=o,_.value=o?.resources?.filter(t=>t.isActive)||[]}catch(o){console.error("Error loading resources:",o),_.value=[]}},p=async()=>{y.value=!0,u.value=[];try{const o=w.value.id,t=new Date(l.value);t.setHours(0,0,0,0);const a=new Date(l.value);a.setHours(23,59,59,999);const s=await b.find(N.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:o},{field:"createdAt",operator:">=",value:t.toISOString()},{field:"createdAt",operator:"<=",value:a.toISOString()},{field:"status",operator:"==",value:x.value}]});let i=[];s.forEach(c=>{(c.reservations||[]).forEach(P=>{i.push(L(c,P))})}),u.value=i.sort((c,m)=>(m.createdAt||"").localeCompare(c.createdAt||""))}catch(o){console.error("Error loading orders:",o),u.value=[]}finally{y.value=!1}},W=async()=>{await J(),await p()},U=async(o,t)=>{const a=await b.get(N.reservationsCollection,o);if(!a)return;const s={...a,id:a.id||o},i=(s.reservations||[]).map(c=>L(s,c));if(t){const c=i.find(m=>m.res_id===t);if(!c)return;await B(),h.value?.openDialog(c);return}i.length&&(await B(),C.value?.openDialog({id:s.id,customerInfo:s.customerInfo,status:s.status,createdAt:s.createdAt,metadata:s.metadata||{},reservations:i,adjustments:s.adjustments||[],totalPrice:typeof s.total=="number"?s.total:i.reduce((c,m)=>c+(m.reservationPrice||0),0),totalSpots:i.reduce((c,m)=>c+(m.spots||0),0)}))},Z=async o=>{await B(),h.value?.openDialog(o)};return W(),e.onMounted(async()=>{const o=A.value.orderId||T.query.orderId,t=A.value.reservationId||T.query.reservationId;if(o){const a=new URL(window.location.href);a.searchParams.delete("orderId"),a.searchParams.delete("reservationId"),window.history.replaceState(window.history.state,"",a.toString()),await U(o,t)}}),e.watch(l,()=>{p()}),e.watch(x,()=>{p()}),(o,t)=>{const a=e.resolveComponent("Button"),s=e.resolveComponent("Badge"),i=e.resolveComponent("CardTitle"),c=e.resolveComponent("CardDescription"),m=e.resolveComponent("CardHeader"),P=e.resolveComponent("Input"),ee=e.resolveComponent("CardContent"),te=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(oe._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createElementVNode("div",re,[e.createElementVNode("div",null,[e.createElementVNode("h1",se,[e.createVNode(e.unref(d.ShoppingBag),{class:"size-6"}),t[4]||(t[4]=e.createTextVNode(" Orders ",-1))]),t[5]||(t[5]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," View orders by when they were placed ",-1))])]),e.createElementVNode("div",le,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(["confirmed","pending","cancelled"],n=>e.createVNode(a,{key:n,variant:e.unref(x)===n?"default":"ghost",size:"sm",class:"capitalize",onClick:r=>x.value=n},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n),1)]),_:2},1032,["variant","onClick"])),64))]),e.createVNode(te,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",ce,[e.createElementVNode("div",null,[e.createVNode(i,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[t[6]||(t[6]=e.createTextVNode(" Orders received ",-1)),e.unref(V).bookings>0?(e.openBlock(),e.createBlock(s,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(V).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(c,{class:"flex items-center gap-4 mt-1"},{default:e.withCtx(()=>[e.createElementVNode("span",de,[e.createVNode(e.unref(d.Users),{size:14}),e.createTextVNode(" "+e.toDisplayString(e.unref(V).spots)+" spots ",1)]),e.createElementVNode("span",ie," €"+e.toDisplayString(e.unref(V).revenue.toFixed(2))+e.toDisplayString(e.unref(x)==="pending"?" pending ":e.unref(x)==="cancelled"?" cancelled ":" ")+"revenue ",1)]),_:1})]),e.createElementVNode("div",ue,[e.createElementVNode("div",me,[e.createVNode(a,{variant:"outline",size:"icon",class:"size-8",onClick:Y},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ChevronLeft),{size:16})]),_:1}),e.createVNode(a,{variant:"outline",size:"sm",class:"h-8 px-3 text-xs",onClick:X},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(a,{variant:"outline",size:"icon",class:"size-8",onClick:K,disabled:!e.unref(Q)},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ChevronRight),{size:16})]),_:1},8,["disabled"])]),e.createVNode(a,{variant:"outline",size:"icon",onClick:p,disabled:e.unref(y)},{default:e.withCtx(()=>[e.createVNode(e.unref(d.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(y)})},null,8,["class"])]),_:1},8,["disabled"])])]),e.createElementVNode("div",fe,[e.createElementVNode("div",pe,[e.createVNode(a,{type:"button",variant:"outline",onClick:$},{default:e.withCtx(()=>[e.createVNode(e.unref(d.CalendarIcon),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(H)),1)]),_:1}),e.withDirectives(e.createElementVNode("input",{ref_key:"dateInputRef",ref:O,"onUpdate:modelValue":t[0]||(t[0]=n=>e.isRef(S)?S.value=n:null),type:"date",class:"orders-date-picker","aria-label":"Select order date"},null,512),[[e.vModelText,e.unref(S)]])])])]),_:1}),e.createVNode(ee,null,{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createVNode(e.unref(d.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(P,{modelValue:e.unref(f),"onUpdate:modelValue":t[1]||(t[1]=n=>e.isRef(f)?f.value=n:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(f)?(e.openBlock(),e.createBlock(a,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:G},{default:e.withCtx(()=>[e.createVNode(e.unref(d.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.unref(f)?(e.openBlock(),e.createElementBlock("div",ve," Showing "+e.toDisplayString(e.unref(I).length)+" of "+e.toDisplayString(e.unref(u).length)+" orders ",1)):e.createCommentVNode("",!0),e.unref(y)?(e.openBlock(),e.createElementBlock("div",xe,[...t[8]||(t[8]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(u).length===0?(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(e.unref(d.ShoppingBag),{class:"size-12 mx-auto mb-3 opacity-50"}),t[9]||(t[9]=e.createElementVNode("p",null,"No orders received on this day",-1))])):e.unref(I).length===0?(e.openBlock(),e.createElementBlock("div",_e," No orders match your search ")):(e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(M),n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"border rounded-lg overflow-hidden shadow-sm"},[n.reservations.length===1?(e.openBlock(),e.createElementBlock("div",{key:0,class:"p-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:r=>e.unref(h)?.openDialog(n.reservations[0])},[e.createElementVNode("div",Ne,[e.createElementVNode("div",Ve,[e.createElementVNode("div",we,e.toDisplayString(n.customerInfo?.firstName||n.customerInfo?.lastName?[n.customerInfo?.firstName,n.customerInfo?.lastName].filter(Boolean).join(" "):"Unknown Customer"),1),e.createElementVNode("div",be,e.toDisplayString(n.customerInfo?.email),1),e.createElementVNode("div",De,e.toDisplayString(n.customerInfo?.phone),1),e.createElementVNode("div",Ee,[e.createElementVNode("div",Ce,[e.createVNode(e.unref(d.CalendarIcon),{size:12}),e.createElementVNode("span",null,e.toDisplayString(F(n.reservations[0].date))+" · "+e.toDisplayString(n.reservations[0].startTime)+" - "+e.toDisplayString(n.reservations[0].endTime),1)]),e.createElementVNode("div",Se,[e.createVNode(e.unref(d.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(n.reservations[0].spots)+" spots",1)]),n.reservations[0].resourceName?(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:n.reservations[0].resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(n.reservations[0].resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ie,[e.createVNode(e.unref(d.Clock),{size:12}),e.createElementVNode("span",null,"Ordered at "+e.toDisplayString(R(n.createdAt)),1)]),e.createVNode(v._sfc_main,{metadata:{...n.reservations[0].metadata,...n.reservations[0].reservationMetadata},schema:e.unref(D),"display-filter":["highlight","badge"],compact:"",class:"mt-1"},null,8,["metadata","schema"])]),e.createElementVNode("div",Pe,[n.reservations[0].status==="pending"?(e.openBlock(),e.createElementBlock("span",Te,"Pending")):n.reservations[0].status==="cancelled"?(e.openBlock(),e.createElementBlock("span",Ae,"Cancelled")):n.reservations[0].reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",ze,"Needs Approval")):n.reservations[0].reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",Oe,"Approved")):n.reservations[0].reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",je,"Cancelled")):n.reservations[0].reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",Re,"Rejected")):(e.openBlock(),e.createElementBlock("span",Fe,"Pending")),n.reservations[0].reservationPrice||n.reservations[0].reservationPrice===0?(e.openBlock(),e.createElementBlock("div",Le," €"+e.toDisplayString(n.totalPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,he)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:"p-3 bg-muted/30 hover:bg-muted/50 transition-colors cursor-pointer",onClick:r=>e.unref(C)?.openDialog(n)},[e.createElementVNode("div",Ue,[e.createElementVNode("div",qe,[e.createElementVNode("div",$e,[e.createElementVNode("div",He,e.toDisplayString(n.customerInfo?.firstName||n.customerInfo?.lastName?[n.customerInfo?.firstName,n.customerInfo?.lastName].filter(Boolean).join(" "):"Unknown Customer"),1),e.createVNode(s,{variant:"secondary",class:"text-xs"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.reservations.length)+" reservations ",1)]),_:2},1024)]),e.createElementVNode("div",Ye,e.toDisplayString(n.customerInfo?.email),1),e.createElementVNode("div",Ke,e.toDisplayString(n.customerInfo?.phone),1),e.createElementVNode("div",Qe,[e.createVNode(e.unref(d.Clock),{size:12}),e.createElementVNode("span",null,"Ordered at "+e.toDisplayString(R(n.createdAt)),1)]),e.createVNode(v._sfc_main,{metadata:n.metadata,schema:e.unref(D),"display-filter":["highlight","badge"],compact:"",class:"mt-1"},null,8,["metadata","schema"])]),e.createElementVNode("div",Xe,[n.status==="pending"?(e.openBlock(),e.createElementBlock("span",Ge,"Pending")):n.status==="cancelled"?(e.openBlock(),e.createElementBlock("span",Je,"Cancelled")):(e.openBlock(),e.createElementBlock("span",We,"Confirmed")),e.createElementVNode("div",Ze," €"+e.toDisplayString(n.totalPrice.toFixed(2)),1)])])],8,Me),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.reservations,r=>(e.openBlock(),e.createElementBlock("div",{key:r.res_id,class:"p-3 border-t bg-muted/50 dark:bg-transparent dark:hover:bg-muted/50 transition-colors cursor-pointer",onClick:vt=>e.unref(h)?.openDialog(r)},[e.createElementVNode("div",tt,[e.createElementVNode("div",ot,[e.createElementVNode("div",nt,[e.createVNode(e.unref(d.CalendarIcon),{size:12}),e.createElementVNode("span",null,e.toDisplayString(F(r.date))+" · "+e.toDisplayString(r.startTime)+" - "+e.toDisplayString(r.endTime),1)]),e.createElementVNode("div",at,[e.createVNode(e.unref(d.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(r.spots)+" spots",1)]),r.resourceName?(e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:r.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(r.resourceName),1)])):e.createCommentVNode("",!0)]),r.status==="confirmed"?(e.openBlock(),e.createElementBlock("div",st,[r.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",lt,"Needs Approval")):r.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",ct,"Approved")):r.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",dt,"Cancelled")):r.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",it,"Rejected")):(e.openBlock(),e.createElementBlock("span",ut,"Pending")),r.reservationPrice||r.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",mt," €"+e.toDisplayString(r.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),e.createVNode(v._sfc_main,{metadata:r.reservationMetadata,schema:e.unref(D),"display-filter":["highlight","badge"],compact:"",class:"mt-1"},null,8,["metadata","schema"])],8,et))),128))],64))]))),128))]))]),_:1})]),_:1})])]),_:1}),e.createVNode(v._sfc_main$1,{ref_key:"reservationDetailDialog",ref:h,"agenda-data":e.unref(E),resources:e.unref(_),"show-order-link":"",onCancelled:p,onConfirmed:p,onRejected:p,onTransferred:p,onOpenOrder:t[2]||(t[2]=n=>U(n))},null,8,["agenda-data","resources"]),e.createVNode(v._sfc_main$2,{ref_key:"orderDetailDialog",ref:C,"agenda-data":e.unref(E),resources:e.unref(_),onOpenReservation:t[3]||(t[3]=n=>Z(n))},null,8,["agenda-data","resources"])],64)}}}),pt=ne._export_sfc(ft,[["__scopeId","data-v-3e5d1883"]]);exports.default=pt;
|