@oneclick.dev/cms-core-modules 0.0.90 → 0.0.92
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-BrhHT4t0.js → ContentEditor-ClYwiqvs.js} +40 -40
- package/dist/{ContentEditor-B-lB0fES.mjs → ContentEditor-fwvAAH_A.mjs} +4017 -3985
- package/dist/{EditLayout.vue_vue_type_script_setup_true_lang-CcysXzmW.mjs → EditLayout.vue_vue_type_script_setup_true_lang-DXa-Xxue.mjs} +30 -31
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-ozYrxb2g.js +1 -0
- package/dist/{agenda-C5grvzSa.mjs → agenda-D9bpW3jv.mjs} +1 -1
- package/dist/{agenda-DXMwVWpN.js → agenda-H1NyBNr2.js} +1 -1
- package/dist/{availability-C1NqOFsQ.mjs → availability-B1D4Fyzi.mjs} +1 -1
- package/dist/{availability-D_wnfLsH.js → availability-DxrUcYbW.js} +1 -1
- package/dist/{exceptions-Cn7zooEu.js → exceptions-Bp5BSvxO.js} +1 -1
- package/dist/{exceptions-BIwMhYa4.mjs → exceptions-C97cNZYl.mjs} +1 -1
- package/dist/index-DOeXSG47.js +35 -0
- package/dist/{index-MwjeLHPP.mjs → index-DnH93MgM.mjs} +232 -231
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +9 -9
- package/dist/{orders-V1pch_ih.js → orders-BAT2ciXx.js} +1 -1
- package/dist/{orders-DhQ2EFXS.mjs → orders-DDrZJHj2.mjs} +1 -1
- package/dist/{payment-BbWByERf.mjs → payment-Bosr0m3u.mjs} +1 -1
- package/dist/{payment-BQaAqQ5q.js → payment-DDnC03jb.js} +1 -1
- package/dist/{regular-slots-C2NYxLPn.mjs → regular-slots-Cc1jmKuC.mjs} +1 -1
- package/dist/{regular-slots-Bs3WJB3U.js → regular-slots-DBs1XVeN.js} +1 -1
- package/dist/{resources-CFR_s89Z.mjs → resources-B7qDBC91.mjs} +1 -1
- package/dist/{resources-eb0pivDL.js → resources-BtF5RUUq.js} +1 -1
- package/package.json +2 -2
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js +0 -1
- package/dist/index-C9pSS15N.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Z=require("./EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js"),u=require("lucide-vue-next"),M=require("@oneclick.dev/cms-kit"),ee=require("./index-CxETuRsG.js"),te={class:"space-y-5 py-4"},oe={class:"flex flex-wrap gap-2 mt-2"},ne=["onClick"],le={class:"space-y-2"},ae={class:"flex items-center justify-between mb-2"},se={class:"text-sm font-medium"},re={class:"flex items-center gap-1"},de={class:"space-y-2"},ie={key:0,class:"text-sm text-muted-foreground italic py-1"},ce={class:"flex items-center justify-between rounded-lg border p-4"},ue={class:"space-y-0.5"},me={class:"text-xs text-muted-foreground"},pe={class:"w-full flex justify-between items-center gap-4 flex-col @sm/dialog-footer:flex-row"},ve={class:"flex items-center gap-2 ml-auto w-full @sm/dialog-footer:w-auto flex-col-reverse @sm/dialog-footer:flex-row"},fe=e.defineComponent({__name:"ResourceEditorDialog",emits:["add-resource","update-resource","remove-resource"],setup(Q,{expose:R,emit:y}){const C=y,i=e.ref(!1),p=e.ref("add"),d=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e"],g=[{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"},{value:0,label:"Sunday"}],n=e.reactive({id:"",name:"",publicLabel:"",avatarLabel:"",description:"",capacity:1,interval:30,openingHours:{0:[],1:[{start:"09:00",end:"17:00"}],2:[{start:"09:00",end:"17:00"}],3:[{start:"09:00",end:"17:00"}],4:[{start:"09:00",end:"17:00"}],5:[{start:"09:00",end:"17:00"}],6:[]},color:"blue",isActive:!0}),w=r=>{p.value=r?"edit":"add",n.id=r?.id||"",n.name=r?.name||"",n.publicLabel=r?.publicLabel||"",n.avatarLabel=r?.avatarLabel||"",n.description=r?.description||"",n.capacity=r?.capacity||1,n.interval=r?.interval||30,n.openingHours=r?.openingHours||{0:[],1:[{start:"09:00",end:"17:00"}],2:[{start:"09:00",end:"17:00"}],3:[{start:"09:00",end:"17:00"}],4:[{start:"09:00",end:"17:00"}],5:[{start:"09:00",end:"17:00"}],6:[]},n.color=r?.color||"blue",n.isActive=r?.isActive!==void 0?r.isActive:!0,i.value=!0},N=()=>{i.value=!1},k=()=>{C("add-resource",{...n}),i.value=!1},A=()=>{C("update-resource",{...n}),i.value=!1},f=()=>{C("remove-resource",n.id),i.value=!1},E=e.computed(()=>n.name.trim().length>0),z=r=>{n.openingHours[r]||(n.openingHours[r]=[]),n.openingHours[r].push({start:"09:00",end:"17:00"})},h=(r,t)=>{n.openingHours[r].splice(t,1)},L=r=>{const t=n.openingHours[r];g.forEach(x=>{n.openingHours[x.value]=JSON.parse(JSON.stringify(t))})},$=r=>{n.openingHours[r]=[]};return R({openDialog:w}),(r,t)=>{const x=e.resolveComponent("DialogTitle"),I=e.resolveComponent("DialogDescription"),D=e.resolveComponent("DialogHeader"),l=e.resolveComponent("Label"),o=e.resolveComponent("Input"),c=e.resolveComponent("NumberFieldDecrement"),U=e.resolveComponent("NumberFieldInput"),F=e.resolveComponent("NumberFieldIncrement"),b=e.resolveComponent("NumberFieldContent"),H=e.resolveComponent("NumberField"),j=e.resolveComponent("SelectValue"),q=e.resolveComponent("SelectTrigger"),V=e.resolveComponent("SelectItem"),O=e.resolveComponent("SelectContent"),B=e.resolveComponent("Select"),m=e.resolveComponent("Button"),P=e.resolveComponent("DropdownMenuTrigger"),S=e.resolveComponent("DropdownMenuItem"),Y=e.resolveComponent("DropdownMenuContent"),J=e.resolveComponent("DropdownMenu"),W=e.resolveComponent("Textarea"),s=e.resolveComponent("Switch"),_=e.resolveComponent("DialogFooter"),G=e.resolveComponent("DialogScrollContent"),X=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(X,{open:i.value,"onUpdate:open":t[7]||(t[7]=a=>i.value=a)},{default:e.withCtx(()=>[e.createVNode(G,{class:"sm:max-w-xl lg:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value==="add"?"Add New Resource":"Edit Resource"),1)]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value==="add"?"Define a new bookable resource such as staff member, room, or equipment.":"Update the details of this resource."),1)]),_:1})]),_:1}),e.createElementVNode("div",te,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-name"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode(" Resource Name ",-1),e.createElementVNode("span",{class:"text-destructive"},"*",-1)])]),_:1}),e.createVNode(o,{modelValue:n.name,"onUpdate:modelValue":t[0]||(t[0]=a=>n.name=a),id:"resource-name",placeholder:"e.g., James, Box 1, Meeting Room A"},null,8,["modelValue"]),t[9]||(t[9]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Internal name visible to your team. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-public-label"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode(" Public Label ",-1)])]),_:1}),e.createVNode(o,{modelValue:n.publicLabel,"onUpdate:modelValue":t[1]||(t[1]=a=>n.publicLabel=a),id:"resource-public-label",placeholder:"Name shown to customers"},null,8,["modelValue"]),t[11]||(t[11]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," If empty, the internal name will be displayed to customers. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-avatar-label"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode(" Avatar Label ",-1)])]),_:1}),e.createVNode(o,{modelValue:n.avatarLabel,"onUpdate:modelValue":t[2]||(t[2]=a=>n.avatarLabel=a),id:"resource-avatar-label",placeholder:"e.g., B1, 1, JD",maxlength:"3"},null,8,["modelValue"]),t[13]||(t[13]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Short text shown in the colored circle (max 3 characters). If empty, first letter of name is used. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Color",-1)])]),_:1}),e.createElementVNode("div",oe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(d,a=>e.createElementVNode("button",{key:a,type:"button",class:e.normalizeClass(["size-7 rounded-full transition-all ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",[n.color===a?"ring-2 ring-ring ring-offset-2":"hover:scale-110"]]),style:e.normalizeStyle({background:a}),onClick:v=>n.color=a},null,14,ne)),64))]),t[15]||(t[15]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," Used for visual identification in the calendar. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-capacity"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Capacity ",-1)])]),_:1}),e.createVNode(H,{id:"resource-capacity",modelValue:n.capacity,"onUpdate:modelValue":t[3]||(t[3]=a=>n.capacity=a),min:1,max:999},{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(c),e.createVNode(U),e.createVNode(F)]),_:1})]),_:1},8,["modelValue"]),t[17]||(t[17]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Maximum simultaneous bookings allowed for this resource. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-interval"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Booking Interval ",-1)])]),_:1}),e.createVNode(B,{modelValue:n.interval,"onUpdate:modelValue":t[4]||(t[4]=a=>n.interval=a),modelModifiers:{number:!0}},{default:e.withCtx(()=>[e.createVNode(q,{id:"resource-interval"},{default:e.withCtx(()=>[e.createVNode(j,{placeholder:"Select interval"})]),_:1}),e.createVNode(O,null,{default:e.withCtx(()=>[e.createVNode(V,{value:5},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("5 minutes",-1)])]),_:1}),e.createVNode(V,{value:10},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("10 minutes",-1)])]),_:1}),e.createVNode(V,{value:15},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("15 minutes",-1)])]),_:1}),e.createVNode(V,{value:30},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("30 minutes",-1)])]),_:1}),e.createVNode(V,{value:60},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("1 hour",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue"]),t[24]||(t[24]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Time slots will be generated at this interval within operating hours. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-2 flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Clock),{class:"w-4 h-4"}),t[25]||(t[25]=e.createTextVNode(" Operating Hours ",-1))]),_:1}),e.createElementVNode("div",le,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(g,a=>e.createElementVNode("div",{key:a.value,class:"rounded-md bg-muted/30 p-2 sm:p-3"},[e.createElementVNode("div",ae,[e.createElementVNode("span",se,e.toDisplayString(a.label),1),e.createElementVNode("div",re,[e.createVNode(m,{variant:"outline",size:"sm",class:"h-7 px-2 text-xs",onClick:v=>z(a.value)},{default:e.withCtx(()=>[...t[26]||(t[26]=[e.createTextVNode(" Add ",-1)])]),_:1},8,["onClick"]),e.createVNode(J,null,{default:e.withCtx(()=>[e.createVNode(P,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,{variant:"ghost",size:"icon",class:"size-7"},{default:e.withCtx(()=>[e.createVNode(e.unref(u.MoreHorizontal),{class:"w-4 h-4"})]),_:1})]),_:1}),e.createVNode(Y,{align:"end"},{default:e.withCtx(()=>[e.createVNode(S,{onClick:v=>L(a.value)},{default:e.withCtx(()=>[...t[27]||(t[27]=[e.createTextVNode(" Copy to all days ",-1)])]),_:1},8,["onClick"]),e.createVNode(S,{onClick:v=>$(a.value),variant:"destructive"},{default:e.withCtx(()=>[...t[28]||(t[28]=[e.createTextVNode(" Set as closed ",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])]),e.createElementVNode("div",de,[n.openingHours[a.value]?.length===0?(e.openBlock(),e.createElementBlock("div",ie," Closed ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.openingHours[a.value],(v,K)=>(e.openBlock(),e.createElementBlock("div",{key:K,class:"flex items-center gap-1.5 sm:gap-2"},[e.createVNode(o,{modelValue:v.start,"onUpdate:modelValue":T=>v.start=T,type:"time",class:"flex-1 min-w-0 h-8 text-sm"},null,8,["modelValue","onUpdate:modelValue"]),t[29]||(t[29]=e.createElementVNode("span",{class:"text-muted-foreground text-xs sm:text-sm shrink-0"},"to",-1)),e.createVNode(o,{modelValue:v.end,"onUpdate:modelValue":T=>v.end=T,type:"time",class:"flex-1 min-w-0 h-8 text-sm"},null,8,["modelValue","onUpdate:modelValue"]),e.createVNode(m,{variant:"ghost",size:"icon",class:"size-7 shrink-0",onClick:T=>h(a.value,K)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Trash2),{class:"w-3.5 h-3.5 text-destructive"})]),_:1},8,["onClick"])]))),128))])])),64))]),t[30]||(t[30]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," Define when this resource is available. You can add multiple time ranges per day for split shifts. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-description"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" Description ",-1)])]),_:1}),e.createVNode(W,{modelValue:n.description,"onUpdate:modelValue":t[5]||(t[5]=a=>n.description=a),id:"resource-description",placeholder:"Internal notes about this resource...",rows:"3"},null,8,["modelValue"]),t[32]||(t[32]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Admin-only notes. Not shown to customers. ",-1))]),e.createElementVNode("div",ce,[e.createElementVNode("div",ue,[e.createVNode(l,{class:"text-sm font-medium"},{default:e.withCtx(()=>[...t[33]||(t[33]=[e.createTextVNode("Active",-1)])]),_:1}),e.createElementVNode("p",me,e.toDisplayString(n.isActive?"Resource can be used for new slots and bookings.":"Existing bookings stay, but no new ones can be created."),1)]),e.createVNode(s,{modelValue:n.isActive,"onUpdate:modelValue":t[6]||(t[6]=a=>n.isActive=a)},null,8,["modelValue"])])]),e.createVNode(_,{class:"@container/dialog-footer gap-2"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[p.value==="edit"?(e.openBlock(),e.createBlock(m,{key:0,variant:"destructive",onClick:f,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Delete Resource ",-1)])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",ve,[e.createVNode(m,{variant:"outline",onClick:N,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[35]||(t[35]=[e.createTextVNode(" Cancel ",-1)])]),_:1}),p.value==="add"?(e.openBlock(),e.createBlock(m,{key:0,onClick:k,disabled:!E.value,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[36]||(t[36]=[e.createTextVNode(" Add Resource ",-1)])]),_:1},8,["disabled"])):(e.openBlock(),e.createBlock(m,{key:1,onClick:A,disabled:!E.value,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[37]||(t[37]=[e.createTextVNode(" Save Changes ",-1)])]),_:1},8,["disabled"]))])])]),_:1})]),_:1})]),_:1},8,["open"])}}}),xe={class:"@container/resources"},Ve={class:"flex flex-col @lg/resources:flex-row @lg/resources:items-center @lg/resources:justify-between gap-4 mb-6"},ge={class:"space-y-6"},Ne={key:0,class:"flex flex-col @md/resources:flex-row gap-4 items-start @md/resources:items-center justify-between"},Ce={class:"relative w-full @md/resources:w-64"},we={class:"text-sm text-muted-foreground"},be={key:1,class:"grid grid-cols-1 @2xl/resources:grid-cols-2 @4xl/resources:grid-cols-3 gap-4"},_e={class:"p-4 pl-5"},ye={class:"flex items-start gap-3"},ke={class:"flex-1 min-w-0"},Ee={class:"flex items-center gap-2"},he={class:"font-semibold truncate text-base"},De={key:0},Be={key:0,class:"text-sm text-muted-foreground truncate"},Se={key:0,class:"text-sm text-muted-foreground mt-3 line-clamp-2"},Te={class:"flex items-center flex-wrap gap-3 mt-4 pt-3 border-t"},Me={class:"flex items-center gap-1.5 text-xs text-muted-foreground"},Re={class:"flex items-center gap-1.5 text-xs text-muted-foreground"},Ae={class:"flex items-center gap-2"},ze={class:"text-xs text-muted-foreground"},Le={key:1,class:"flex items-center gap-1.5 text-xs text-orange-500"},$e={key:2,class:"text-center py-8 text-muted-foreground"},Ie={key:3,class:"flex justify-center py-12"},Ue={key:5,class:"fixed bottom-4 right-4 bg-background border rounded-lg px-4 py-2 shadow-lg flex items-center gap-2"},Fe=e.defineComponent({__name:"resources",setup(Q){const{width:R}=ee.useWindowSize(),{params:y}=M.useModuleRoute(),{confirm:C}=M.useConfirmation(),{config:i}=M.useModule(),p=M.useFirebaseIntegration(i.project),d=e.ref([]),g=e.ref(!1),n=e.ref(!0),w=e.ref(),N=e.ref(""),k=()=>Date.now().toString(36)+Math.random().toString(36).substr(2),A=async()=>{try{n.value=!0;const l=await p.get(i.agendaCollection,y.value.id);d.value=l.resources||[]}catch(l){console.error("Error loading resources:",l)}finally{n.value=!1}},f=async()=>{g.value=!0;try{await p.update(i.agendaCollection,y.value.id,{resources:d.value})}catch(l){console.error("Error saving resources:",l)}finally{g.value=!1}},E=l=>{const o={...l,id:k()};d.value.push(o),f()},z=l=>{const o=d.value.findIndex(c=>c.id===l.id);o!==-1&&(d.value[o]=l),f()},h=async l=>{await C("Are you sure you want to delete this resource? This action cannot be undone.","Delete Resource","Delete")&&(d.value=d.value.filter(c=>c.id!==l),f())},L=async l=>{const o=d.value.findIndex(c=>c.id===l.id);o!==-1&&(d.value[o].isActive=!d.value[o].isActive,await f())},$=l=>{const o={...l,id:k(),name:`${l.name} (Copy)`,publicLabel:l.publicLabel?`${l.publicLabel} (Copy)`:""};d.value.push(o),f()},r=()=>{w.value?.openDialog()},t=l=>{w.value?.openDialog(l)},x=e.computed(()=>{if(!N.value.trim())return d.value;const l=N.value.toLowerCase();return d.value.filter(o=>o.name.toLowerCase().includes(l)||o.publicLabel?.toLowerCase().includes(l))}),I=e.computed(()=>d.value.filter(l=>l.isActive).length),D=e.computed(()=>d.value.length);return A(),(l,o)=>{const c=e.resolveComponent("Button"),U=e.resolveComponent("Input"),F=e.resolveComponent("DropdownMenuTrigger"),b=e.resolveComponent("DropdownMenuItem"),H=e.resolveComponent("DropdownMenuSeparator"),j=e.resolveComponent("DropdownMenuContent"),q=e.resolveComponent("DropdownMenu"),V=e.resolveComponent("Switch"),O=e.resolveComponent("Card"),B=e.resolveComponent("Spinner"),m=e.resolveComponent("EmptyMedia"),P=e.resolveComponent("EmptyTitle"),S=e.resolveComponent("EmptyDescription"),Y=e.resolveComponent("EmptyHeader"),J=e.resolveComponent("EmptyContent"),W=e.resolveComponent("Empty");return e.openBlock(),e.createBlock(Z._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",xe,[e.createElementVNode("div",Ve,[o[2]||(o[2]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-lg font-medium"},"Resource Management"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," Define the rooms, boxes, or staff that can be booked in this agenda. ")],-1)),d.value.length>0?(e.openBlock(),e.createBlock(c,{key:0,onClick:r},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Plus),{class:"size-4 mr-1.5"}),o[1]||(o[1]=e.createTextVNode(" Add Resource ",-1))]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",ge,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("div",Ce,[e.createVNode(U,{modelValue:N.value,"onUpdate:modelValue":o[0]||(o[0]=s=>N.value=s),placeholder:"Search resources...",class:"pl-9"},null,8,["modelValue"]),o[3]||(o[3]=e.createElementVNode("svg",{class:"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1))]),e.createElementVNode("div",we,e.toDisplayString(I.value)+" active of "+e.toDisplayString(D.value)+" resource"+e.toDisplayString(D.value!==1?"s":""),1)])):e.createCommentVNode("",!0),x.value.length>0?(e.openBlock(),e.createElementBlock("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,s=>(e.openBlock(),e.createBlock(O,{key:s.id,class:e.normalizeClass(["group relative overflow-hidden transition-all duration-200 hover:shadow-md",s.isActive?"":"opacity-60 grayscale-[30%]"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"absolute inset-y-0 left-0 w-1 transition-all duration-200 group-hover:w-1.5",style:e.normalizeStyle({background:s.color})},null,4),e.createElementVNode("div",_e,[e.createElementVNode("div",ye,[e.createElementVNode("div",{class:"size-11 rounded-xl flex-shrink-0 flex items-center justify-center text-white font-semibold text-sm shadow-sm",style:e.normalizeStyle({background:s.color})},e.toDisplayString(s.avatarLabel||s.name.charAt(0).toUpperCase()),5),e.createElementVNode("div",ke,[e.createElementVNode("div",Ee,[e.createElementVNode("h3",he,[e.createTextVNode(e.toDisplayString(s.name)+" ",1),s.isActive?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",De,"(Inactive)"))])]),s.publicLabel&&s.publicLabel!==s.name?(e.openBlock(),e.createElementBlock("p",Be,e.toDisplayString(s.publicLabel),1)):e.createCommentVNode("",!0)]),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(c,{variant:"ghost",size:"icon",class:"size-8"},{default:e.withCtx(()=>[...o[4]||(o[4]=[e.createElementVNode("svg",{class:"size-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"})],-1)])]),_:1})]),_:1}),e.createVNode(j,{align:"end"},{default:e.withCtx(()=>[e.createVNode(b,{onClick:_=>t(s)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Pencil),{class:"size-4 mr-2"}),o[5]||(o[5]=e.createTextVNode(" Edit ",-1))]),_:1},8,["onClick"]),e.createVNode(b,{onClick:_=>$(s)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Copy),{class:"size-4 mr-2"}),o[6]||(o[6]=e.createTextVNode(" Duplicate ",-1))]),_:1},8,["onClick"]),e.createVNode(H),e.createVNode(b,{variant:"destructive",onClick:_=>h(s.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Trash2),{class:"size-4 mr-2"}),o[7]||(o[7]=e.createTextVNode(" Delete ",-1))]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),s.description?(e.openBlock(),e.createElementBlock("p",Se,e.toDisplayString(s.description),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Te,[e.createElementVNode("div",Me,[e.createVNode(e.unref(u.Users),{class:"size-3.5"}),e.createElementVNode("span",null,e.toDisplayString(s.capacity)+" "+e.toDisplayString(s.capacity===1?"slot":"slots"),1)]),e.createElementVNode("div",Re,[o[8]||(o[8]=e.createElementVNode("svg",{class:"size-3.5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e.createElementVNode("span",null,e.toDisplayString(s.interval)+" min",1)]),e.unref(R)>=640?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o[9]||(o[9]=e.createElementVNode("div",{class:"flex-1"},null,-1)),e.createElementVNode("div",Ae,[e.createElementVNode("span",ze,e.toDisplayString(s.isActive?"Active":"Inactive"),1),e.createVNode(V,{defaultValue:s.isActive,"onUpdate:modelValue":_=>L(s),class:"scale-90"},null,8,["defaultValue","onUpdate:modelValue"])])],64)):s.isActive?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(e.unref(u.CircleAlert),{class:"size-3.5"}),o[10]||(o[10]=e.createElementVNode("span",null,"Inactive",-1))]))])])]),_:2},1032,["class"]))),128))])):d.value.length>0&&x.value.length===0?(e.openBlock(),e.createElementBlock("div",$e,[...o[11]||(o[11]=[e.createElementVNode("p",null,"No resources match your search.",-1)])])):n.value?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(B,{class:"size-8"})])):(e.openBlock(),e.createBlock(W,{key:4,class:"border border-dashed"},{default:e.withCtx(()=>[e.createVNode(Y,null,{default:e.withCtx(()=>[e.createVNode(m,{variant:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Users),{class:"size-6"})]),_:1}),e.createVNode(P,null,{default:e.withCtx(()=>[...o[12]||(o[12]=[e.createTextVNode("No Resources Yet",-1)])]),_:1}),e.createVNode(S,null,{default:e.withCtx(()=>[...o[13]||(o[13]=[e.createTextVNode(" You haven't added any bookable resources yet. Define your staff, rooms, or equipment to start configuring availability. ",-1)])]),_:1})]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[e.createVNode(c,{variant:"outline",onClick:r},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Plus),{class:"size-4 mr-1.5"}),o[14]||(o[14]=e.createTextVNode(" Add Your First Resource ",-1))]),_:1})]),_:1})]),_:1})),g.value?(e.openBlock(),e.createElementBlock("div",Ue,[e.createVNode(B,{class:"size-4"}),o[15]||(o[15]=e.createElementVNode("span",{class:"text-sm"},"Saving...",-1))])):e.createCommentVNode("",!0)])]),e.createVNode(fe,{ref_key:"resourceDialogRef",ref:w,onAddResource:E,onUpdateResource:z,onRemoveResource:h},null,512)]),_:1})}}});exports.default=Fe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Z=require("./EditLayout.vue_vue_type_script_setup_true_lang-ozYrxb2g.js"),u=require("lucide-vue-next"),M=require("@oneclick.dev/cms-kit"),ee=require("./index-CxETuRsG.js"),te={class:"space-y-5 py-4"},oe={class:"flex flex-wrap gap-2 mt-2"},ne=["onClick"],le={class:"space-y-2"},ae={class:"flex items-center justify-between mb-2"},se={class:"text-sm font-medium"},re={class:"flex items-center gap-1"},de={class:"space-y-2"},ie={key:0,class:"text-sm text-muted-foreground italic py-1"},ce={class:"flex items-center justify-between rounded-lg border p-4"},ue={class:"space-y-0.5"},me={class:"text-xs text-muted-foreground"},pe={class:"w-full flex justify-between items-center gap-4 flex-col @sm/dialog-footer:flex-row"},ve={class:"flex items-center gap-2 ml-auto w-full @sm/dialog-footer:w-auto flex-col-reverse @sm/dialog-footer:flex-row"},fe=e.defineComponent({__name:"ResourceEditorDialog",emits:["add-resource","update-resource","remove-resource"],setup(Q,{expose:R,emit:y}){const C=y,i=e.ref(!1),p=e.ref("add"),d=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e"],g=[{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"},{value:0,label:"Sunday"}],n=e.reactive({id:"",name:"",publicLabel:"",avatarLabel:"",description:"",capacity:1,interval:30,openingHours:{0:[],1:[{start:"09:00",end:"17:00"}],2:[{start:"09:00",end:"17:00"}],3:[{start:"09:00",end:"17:00"}],4:[{start:"09:00",end:"17:00"}],5:[{start:"09:00",end:"17:00"}],6:[]},color:"blue",isActive:!0}),w=r=>{p.value=r?"edit":"add",n.id=r?.id||"",n.name=r?.name||"",n.publicLabel=r?.publicLabel||"",n.avatarLabel=r?.avatarLabel||"",n.description=r?.description||"",n.capacity=r?.capacity||1,n.interval=r?.interval||30,n.openingHours=r?.openingHours||{0:[],1:[{start:"09:00",end:"17:00"}],2:[{start:"09:00",end:"17:00"}],3:[{start:"09:00",end:"17:00"}],4:[{start:"09:00",end:"17:00"}],5:[{start:"09:00",end:"17:00"}],6:[]},n.color=r?.color||"blue",n.isActive=r?.isActive!==void 0?r.isActive:!0,i.value=!0},N=()=>{i.value=!1},k=()=>{C("add-resource",{...n}),i.value=!1},A=()=>{C("update-resource",{...n}),i.value=!1},f=()=>{C("remove-resource",n.id),i.value=!1},E=e.computed(()=>n.name.trim().length>0),z=r=>{n.openingHours[r]||(n.openingHours[r]=[]),n.openingHours[r].push({start:"09:00",end:"17:00"})},h=(r,t)=>{n.openingHours[r].splice(t,1)},L=r=>{const t=n.openingHours[r];g.forEach(x=>{n.openingHours[x.value]=JSON.parse(JSON.stringify(t))})},$=r=>{n.openingHours[r]=[]};return R({openDialog:w}),(r,t)=>{const x=e.resolveComponent("DialogTitle"),I=e.resolveComponent("DialogDescription"),D=e.resolveComponent("DialogHeader"),l=e.resolveComponent("Label"),o=e.resolveComponent("Input"),c=e.resolveComponent("NumberFieldDecrement"),U=e.resolveComponent("NumberFieldInput"),F=e.resolveComponent("NumberFieldIncrement"),b=e.resolveComponent("NumberFieldContent"),H=e.resolveComponent("NumberField"),j=e.resolveComponent("SelectValue"),q=e.resolveComponent("SelectTrigger"),V=e.resolveComponent("SelectItem"),O=e.resolveComponent("SelectContent"),B=e.resolveComponent("Select"),m=e.resolveComponent("Button"),P=e.resolveComponent("DropdownMenuTrigger"),S=e.resolveComponent("DropdownMenuItem"),Y=e.resolveComponent("DropdownMenuContent"),J=e.resolveComponent("DropdownMenu"),W=e.resolveComponent("Textarea"),s=e.resolveComponent("Switch"),_=e.resolveComponent("DialogFooter"),G=e.resolveComponent("DialogScrollContent"),X=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(X,{open:i.value,"onUpdate:open":t[7]||(t[7]=a=>i.value=a)},{default:e.withCtx(()=>[e.createVNode(G,{class:"sm:max-w-xl lg:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value==="add"?"Add New Resource":"Edit Resource"),1)]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value==="add"?"Define a new bookable resource such as staff member, room, or equipment.":"Update the details of this resource."),1)]),_:1})]),_:1}),e.createElementVNode("div",te,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-name"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode(" Resource Name ",-1),e.createElementVNode("span",{class:"text-destructive"},"*",-1)])]),_:1}),e.createVNode(o,{modelValue:n.name,"onUpdate:modelValue":t[0]||(t[0]=a=>n.name=a),id:"resource-name",placeholder:"e.g., James, Box 1, Meeting Room A"},null,8,["modelValue"]),t[9]||(t[9]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Internal name visible to your team. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-public-label"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode(" Public Label ",-1)])]),_:1}),e.createVNode(o,{modelValue:n.publicLabel,"onUpdate:modelValue":t[1]||(t[1]=a=>n.publicLabel=a),id:"resource-public-label",placeholder:"Name shown to customers"},null,8,["modelValue"]),t[11]||(t[11]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," If empty, the internal name will be displayed to customers. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-avatar-label"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode(" Avatar Label ",-1)])]),_:1}),e.createVNode(o,{modelValue:n.avatarLabel,"onUpdate:modelValue":t[2]||(t[2]=a=>n.avatarLabel=a),id:"resource-avatar-label",placeholder:"e.g., B1, 1, JD",maxlength:"3"},null,8,["modelValue"]),t[13]||(t[13]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Short text shown in the colored circle (max 3 characters). If empty, first letter of name is used. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Color",-1)])]),_:1}),e.createElementVNode("div",oe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(d,a=>e.createElementVNode("button",{key:a,type:"button",class:e.normalizeClass(["size-7 rounded-full transition-all ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",[n.color===a?"ring-2 ring-ring ring-offset-2":"hover:scale-110"]]),style:e.normalizeStyle({background:a}),onClick:v=>n.color=a},null,14,ne)),64))]),t[15]||(t[15]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," Used for visual identification in the calendar. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-capacity"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Capacity ",-1)])]),_:1}),e.createVNode(H,{id:"resource-capacity",modelValue:n.capacity,"onUpdate:modelValue":t[3]||(t[3]=a=>n.capacity=a),min:1,max:999},{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(c),e.createVNode(U),e.createVNode(F)]),_:1})]),_:1},8,["modelValue"]),t[17]||(t[17]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Maximum simultaneous bookings allowed for this resource. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-interval"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Booking Interval ",-1)])]),_:1}),e.createVNode(B,{modelValue:n.interval,"onUpdate:modelValue":t[4]||(t[4]=a=>n.interval=a),modelModifiers:{number:!0}},{default:e.withCtx(()=>[e.createVNode(q,{id:"resource-interval"},{default:e.withCtx(()=>[e.createVNode(j,{placeholder:"Select interval"})]),_:1}),e.createVNode(O,null,{default:e.withCtx(()=>[e.createVNode(V,{value:5},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("5 minutes",-1)])]),_:1}),e.createVNode(V,{value:10},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("10 minutes",-1)])]),_:1}),e.createVNode(V,{value:15},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("15 minutes",-1)])]),_:1}),e.createVNode(V,{value:30},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("30 minutes",-1)])]),_:1}),e.createVNode(V,{value:60},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("1 hour",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue"]),t[24]||(t[24]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Time slots will be generated at this interval within operating hours. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-2 flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Clock),{class:"w-4 h-4"}),t[25]||(t[25]=e.createTextVNode(" Operating Hours ",-1))]),_:1}),e.createElementVNode("div",le,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(g,a=>e.createElementVNode("div",{key:a.value,class:"rounded-md bg-muted/30 p-2 sm:p-3"},[e.createElementVNode("div",ae,[e.createElementVNode("span",se,e.toDisplayString(a.label),1),e.createElementVNode("div",re,[e.createVNode(m,{variant:"outline",size:"sm",class:"h-7 px-2 text-xs",onClick:v=>z(a.value)},{default:e.withCtx(()=>[...t[26]||(t[26]=[e.createTextVNode(" Add ",-1)])]),_:1},8,["onClick"]),e.createVNode(J,null,{default:e.withCtx(()=>[e.createVNode(P,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,{variant:"ghost",size:"icon",class:"size-7"},{default:e.withCtx(()=>[e.createVNode(e.unref(u.MoreHorizontal),{class:"w-4 h-4"})]),_:1})]),_:1}),e.createVNode(Y,{align:"end"},{default:e.withCtx(()=>[e.createVNode(S,{onClick:v=>L(a.value)},{default:e.withCtx(()=>[...t[27]||(t[27]=[e.createTextVNode(" Copy to all days ",-1)])]),_:1},8,["onClick"]),e.createVNode(S,{onClick:v=>$(a.value),variant:"destructive"},{default:e.withCtx(()=>[...t[28]||(t[28]=[e.createTextVNode(" Set as closed ",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])]),e.createElementVNode("div",de,[n.openingHours[a.value]?.length===0?(e.openBlock(),e.createElementBlock("div",ie," Closed ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.openingHours[a.value],(v,K)=>(e.openBlock(),e.createElementBlock("div",{key:K,class:"flex items-center gap-1.5 sm:gap-2"},[e.createVNode(o,{modelValue:v.start,"onUpdate:modelValue":T=>v.start=T,type:"time",class:"flex-1 min-w-0 h-8 text-sm"},null,8,["modelValue","onUpdate:modelValue"]),t[29]||(t[29]=e.createElementVNode("span",{class:"text-muted-foreground text-xs sm:text-sm shrink-0"},"to",-1)),e.createVNode(o,{modelValue:v.end,"onUpdate:modelValue":T=>v.end=T,type:"time",class:"flex-1 min-w-0 h-8 text-sm"},null,8,["modelValue","onUpdate:modelValue"]),e.createVNode(m,{variant:"ghost",size:"icon",class:"size-7 shrink-0",onClick:T=>h(a.value,K)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Trash2),{class:"w-3.5 h-3.5 text-destructive"})]),_:1},8,["onClick"])]))),128))])])),64))]),t[30]||(t[30]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," Define when this resource is available. You can add multiple time ranges per day for split shifts. ",-1))]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-sm font-normal mb-1.5",for:"resource-description"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" Description ",-1)])]),_:1}),e.createVNode(W,{modelValue:n.description,"onUpdate:modelValue":t[5]||(t[5]=a=>n.description=a),id:"resource-description",placeholder:"Internal notes about this resource...",rows:"3"},null,8,["modelValue"]),t[32]||(t[32]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"}," Admin-only notes. Not shown to customers. ",-1))]),e.createElementVNode("div",ce,[e.createElementVNode("div",ue,[e.createVNode(l,{class:"text-sm font-medium"},{default:e.withCtx(()=>[...t[33]||(t[33]=[e.createTextVNode("Active",-1)])]),_:1}),e.createElementVNode("p",me,e.toDisplayString(n.isActive?"Resource can be used for new slots and bookings.":"Existing bookings stay, but no new ones can be created."),1)]),e.createVNode(s,{modelValue:n.isActive,"onUpdate:modelValue":t[6]||(t[6]=a=>n.isActive=a)},null,8,["modelValue"])])]),e.createVNode(_,{class:"@container/dialog-footer gap-2"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[p.value==="edit"?(e.openBlock(),e.createBlock(m,{key:0,variant:"destructive",onClick:f,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Delete Resource ",-1)])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",ve,[e.createVNode(m,{variant:"outline",onClick:N,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[35]||(t[35]=[e.createTextVNode(" Cancel ",-1)])]),_:1}),p.value==="add"?(e.openBlock(),e.createBlock(m,{key:0,onClick:k,disabled:!E.value,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[36]||(t[36]=[e.createTextVNode(" Add Resource ",-1)])]),_:1},8,["disabled"])):(e.openBlock(),e.createBlock(m,{key:1,onClick:A,disabled:!E.value,class:"w-full @sm/dialog-footer:w-auto"},{default:e.withCtx(()=>[...t[37]||(t[37]=[e.createTextVNode(" Save Changes ",-1)])]),_:1},8,["disabled"]))])])]),_:1})]),_:1})]),_:1},8,["open"])}}}),xe={class:"@container/resources"},Ve={class:"flex flex-col @lg/resources:flex-row @lg/resources:items-center @lg/resources:justify-between gap-4 mb-6"},ge={class:"space-y-6"},Ne={key:0,class:"flex flex-col @md/resources:flex-row gap-4 items-start @md/resources:items-center justify-between"},Ce={class:"relative w-full @md/resources:w-64"},we={class:"text-sm text-muted-foreground"},be={key:1,class:"grid grid-cols-1 @2xl/resources:grid-cols-2 @4xl/resources:grid-cols-3 gap-4"},_e={class:"p-4 pl-5"},ye={class:"flex items-start gap-3"},ke={class:"flex-1 min-w-0"},Ee={class:"flex items-center gap-2"},he={class:"font-semibold truncate text-base"},De={key:0},Be={key:0,class:"text-sm text-muted-foreground truncate"},Se={key:0,class:"text-sm text-muted-foreground mt-3 line-clamp-2"},Te={class:"flex items-center flex-wrap gap-3 mt-4 pt-3 border-t"},Me={class:"flex items-center gap-1.5 text-xs text-muted-foreground"},Re={class:"flex items-center gap-1.5 text-xs text-muted-foreground"},Ae={class:"flex items-center gap-2"},ze={class:"text-xs text-muted-foreground"},Le={key:1,class:"flex items-center gap-1.5 text-xs text-orange-500"},$e={key:2,class:"text-center py-8 text-muted-foreground"},Ie={key:3,class:"flex justify-center py-12"},Ue={key:5,class:"fixed bottom-4 right-4 bg-background border rounded-lg px-4 py-2 shadow-lg flex items-center gap-2"},Fe=e.defineComponent({__name:"resources",setup(Q){const{width:R}=ee.useWindowSize(),{params:y}=M.useModuleRoute(),{confirm:C}=M.useConfirmation(),{config:i}=M.useModule(),p=M.useFirebaseIntegration(i.project),d=e.ref([]),g=e.ref(!1),n=e.ref(!0),w=e.ref(),N=e.ref(""),k=()=>Date.now().toString(36)+Math.random().toString(36).substr(2),A=async()=>{try{n.value=!0;const l=await p.get(i.agendaCollection,y.value.id);d.value=l.resources||[]}catch(l){console.error("Error loading resources:",l)}finally{n.value=!1}},f=async()=>{g.value=!0;try{await p.update(i.agendaCollection,y.value.id,{resources:d.value})}catch(l){console.error("Error saving resources:",l)}finally{g.value=!1}},E=l=>{const o={...l,id:k()};d.value.push(o),f()},z=l=>{const o=d.value.findIndex(c=>c.id===l.id);o!==-1&&(d.value[o]=l),f()},h=async l=>{await C("Are you sure you want to delete this resource? This action cannot be undone.","Delete Resource","Delete")&&(d.value=d.value.filter(c=>c.id!==l),f())},L=async l=>{const o=d.value.findIndex(c=>c.id===l.id);o!==-1&&(d.value[o].isActive=!d.value[o].isActive,await f())},$=l=>{const o={...l,id:k(),name:`${l.name} (Copy)`,publicLabel:l.publicLabel?`${l.publicLabel} (Copy)`:""};d.value.push(o),f()},r=()=>{w.value?.openDialog()},t=l=>{w.value?.openDialog(l)},x=e.computed(()=>{if(!N.value.trim())return d.value;const l=N.value.toLowerCase();return d.value.filter(o=>o.name.toLowerCase().includes(l)||o.publicLabel?.toLowerCase().includes(l))}),I=e.computed(()=>d.value.filter(l=>l.isActive).length),D=e.computed(()=>d.value.length);return A(),(l,o)=>{const c=e.resolveComponent("Button"),U=e.resolveComponent("Input"),F=e.resolveComponent("DropdownMenuTrigger"),b=e.resolveComponent("DropdownMenuItem"),H=e.resolveComponent("DropdownMenuSeparator"),j=e.resolveComponent("DropdownMenuContent"),q=e.resolveComponent("DropdownMenu"),V=e.resolveComponent("Switch"),O=e.resolveComponent("Card"),B=e.resolveComponent("Spinner"),m=e.resolveComponent("EmptyMedia"),P=e.resolveComponent("EmptyTitle"),S=e.resolveComponent("EmptyDescription"),Y=e.resolveComponent("EmptyHeader"),J=e.resolveComponent("EmptyContent"),W=e.resolveComponent("Empty");return e.openBlock(),e.createBlock(Z._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",xe,[e.createElementVNode("div",Ve,[o[2]||(o[2]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-lg font-medium"},"Resource Management"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," Define the rooms, boxes, or staff that can be booked in this agenda. ")],-1)),d.value.length>0?(e.openBlock(),e.createBlock(c,{key:0,onClick:r},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Plus),{class:"size-4 mr-1.5"}),o[1]||(o[1]=e.createTextVNode(" Add Resource ",-1))]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",ge,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("div",Ce,[e.createVNode(U,{modelValue:N.value,"onUpdate:modelValue":o[0]||(o[0]=s=>N.value=s),placeholder:"Search resources...",class:"pl-9"},null,8,["modelValue"]),o[3]||(o[3]=e.createElementVNode("svg",{class:"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1))]),e.createElementVNode("div",we,e.toDisplayString(I.value)+" active of "+e.toDisplayString(D.value)+" resource"+e.toDisplayString(D.value!==1?"s":""),1)])):e.createCommentVNode("",!0),x.value.length>0?(e.openBlock(),e.createElementBlock("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,s=>(e.openBlock(),e.createBlock(O,{key:s.id,class:e.normalizeClass(["group relative overflow-hidden transition-all duration-200 hover:shadow-md",s.isActive?"":"opacity-60 grayscale-[30%]"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"absolute inset-y-0 left-0 w-1 transition-all duration-200 group-hover:w-1.5",style:e.normalizeStyle({background:s.color})},null,4),e.createElementVNode("div",_e,[e.createElementVNode("div",ye,[e.createElementVNode("div",{class:"size-11 rounded-xl flex-shrink-0 flex items-center justify-center text-white font-semibold text-sm shadow-sm",style:e.normalizeStyle({background:s.color})},e.toDisplayString(s.avatarLabel||s.name.charAt(0).toUpperCase()),5),e.createElementVNode("div",ke,[e.createElementVNode("div",Ee,[e.createElementVNode("h3",he,[e.createTextVNode(e.toDisplayString(s.name)+" ",1),s.isActive?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",De,"(Inactive)"))])]),s.publicLabel&&s.publicLabel!==s.name?(e.openBlock(),e.createElementBlock("p",Be,e.toDisplayString(s.publicLabel),1)):e.createCommentVNode("",!0)]),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(c,{variant:"ghost",size:"icon",class:"size-8"},{default:e.withCtx(()=>[...o[4]||(o[4]=[e.createElementVNode("svg",{class:"size-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"})],-1)])]),_:1})]),_:1}),e.createVNode(j,{align:"end"},{default:e.withCtx(()=>[e.createVNode(b,{onClick:_=>t(s)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Pencil),{class:"size-4 mr-2"}),o[5]||(o[5]=e.createTextVNode(" Edit ",-1))]),_:1},8,["onClick"]),e.createVNode(b,{onClick:_=>$(s)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Copy),{class:"size-4 mr-2"}),o[6]||(o[6]=e.createTextVNode(" Duplicate ",-1))]),_:1},8,["onClick"]),e.createVNode(H),e.createVNode(b,{variant:"destructive",onClick:_=>h(s.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Trash2),{class:"size-4 mr-2"}),o[7]||(o[7]=e.createTextVNode(" Delete ",-1))]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),s.description?(e.openBlock(),e.createElementBlock("p",Se,e.toDisplayString(s.description),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Te,[e.createElementVNode("div",Me,[e.createVNode(e.unref(u.Users),{class:"size-3.5"}),e.createElementVNode("span",null,e.toDisplayString(s.capacity)+" "+e.toDisplayString(s.capacity===1?"slot":"slots"),1)]),e.createElementVNode("div",Re,[o[8]||(o[8]=e.createElementVNode("svg",{class:"size-3.5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e.createElementVNode("span",null,e.toDisplayString(s.interval)+" min",1)]),e.unref(R)>=640?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o[9]||(o[9]=e.createElementVNode("div",{class:"flex-1"},null,-1)),e.createElementVNode("div",Ae,[e.createElementVNode("span",ze,e.toDisplayString(s.isActive?"Active":"Inactive"),1),e.createVNode(V,{defaultValue:s.isActive,"onUpdate:modelValue":_=>L(s),class:"scale-90"},null,8,["defaultValue","onUpdate:modelValue"])])],64)):s.isActive?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(e.unref(u.CircleAlert),{class:"size-3.5"}),o[10]||(o[10]=e.createElementVNode("span",null,"Inactive",-1))]))])])]),_:2},1032,["class"]))),128))])):d.value.length>0&&x.value.length===0?(e.openBlock(),e.createElementBlock("div",$e,[...o[11]||(o[11]=[e.createElementVNode("p",null,"No resources match your search.",-1)])])):n.value?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(B,{class:"size-8"})])):(e.openBlock(),e.createBlock(W,{key:4,class:"border border-dashed"},{default:e.withCtx(()=>[e.createVNode(Y,null,{default:e.withCtx(()=>[e.createVNode(m,{variant:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Users),{class:"size-6"})]),_:1}),e.createVNode(P,null,{default:e.withCtx(()=>[...o[12]||(o[12]=[e.createTextVNode("No Resources Yet",-1)])]),_:1}),e.createVNode(S,null,{default:e.withCtx(()=>[...o[13]||(o[13]=[e.createTextVNode(" You haven't added any bookable resources yet. Define your staff, rooms, or equipment to start configuring availability. ",-1)])]),_:1})]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[e.createVNode(c,{variant:"outline",onClick:r},{default:e.withCtx(()=>[e.createVNode(e.unref(u.Plus),{class:"size-4 mr-1.5"}),o[14]||(o[14]=e.createTextVNode(" Add Your First Resource ",-1))]),_:1})]),_:1})]),_:1})),g.value?(e.openBlock(),e.createElementBlock("div",Ue,[e.createVNode(B,{class:"size-4"}),o[15]||(o[15]=e.createElementVNode("span",{class:"text-sm"},"Saving...",-1))])):e.createCommentVNode("",!0)])]),e.createVNode(fe,{ref_key:"resourceDialogRef",ref:w,onAddResource:E,onUpdateResource:z,onRemoveResource:h},null,512)]),_:1})}}});exports.default=Fe;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneclick.dev/cms-core-modules",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.92",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@formkit/drag-and-drop": "^0.5.3",
|
|
30
30
|
"@internationalized/date": "^3.8.0",
|
|
31
|
-
"@oneclick.dev/cms-kit": "0.0.
|
|
31
|
+
"@oneclick.dev/cms-kit": "0.0.103",
|
|
32
32
|
"@tanstack/vue-table": "^8.21.3",
|
|
33
33
|
"@vee-validate/zod": "^4.15.0",
|
|
34
34
|
"@vue-flow/core": "^1.48.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),s=require("@oneclick.dev/cms-kit"),n=require("lucide-vue-next"),C={key:1,class:"@container mt-4 w-full"},k={class:"flex flex-col space-y-8 @5xl:flex-row @5xl:space-x-8 @5xl:space-y-0 w-full"},x={key:0,class:"hidden @5xl:block @5xl:w-1/4 @7xl:w-1/5"},h={class:"flex flex-col flex-1"},N={key:0,class:"@5xl:hidden"},b=e.defineComponent({__name:"EditLayout",setup(w){const{params:t,resolvePath:o}=s.useModuleRoute(),{hasPermission:a}=s.useModulePermissions(),d=s.useRoute();s.useModuleBreadcrumbs(()=>[{text:"Edit"}]);const{config:l}=s.useModule(),u=s.useFirebaseIntegration(l.project),m=e.ref(null);(async()=>{let i=await u.get(l.agendaCollection,t.value.id);m.value=i})();const r=[{to:o(`/edit/${t.value.id}/`),title:"Overview",icon:n.ClipboardClock,subtitle:"General info and quick details"},{to:o(`/edit/${t.value.id}/resources`),title:"Resource Management",icon:n.User,subtitle:"Manage resources"},{to:o(`/edit/${t.value.id}/agenda`),title:"Agenda",icon:n.Calendar,subtitle:"Manage scheduled events and sessions"},{to:o(`/edit/${t.value.id}/regular-slots`),title:"Slot Configuration",icon:n.CalendarClock,subtitle:"Define recurring time slots and patterns"},{to:o(`/edit/${t.value.id}/exceptions`),title:"Override Slots",icon:n.CalendarCog,subtitle:"Adjust or block times"},{to:o(`/edit/${t.value.id}/availability`),title:"Availability Settings",icon:n.Tickets,subtitle:"Booking rules & limits"},{to:o(`/edit/${t.value.id}/payment`),title:"Payment Settings",icon:n.HandCoins,subtitle:"Payment options & policies"},{to:o(`/edit/${t.value.id}/orders`),title:"Orders",icon:n.Receipt,subtitle:"Manage orders and payments"}];return(i,c)=>{const p=e.resolveComponent("NuxtLink"),v=e.resolveComponent("VerticalNav"),g=e.resolveComponent("DrawerNav"),_=e.resolveComponent("CardContent"),f=e.resolveComponent("Card");return!e.unref(a)("edit-agendas")&&!e.unref(d).fullPath.endsWith("/agenda")?(e.openBlock(),e.createBlock(p,{key:0,class:"group",to:e.unref(o)(`/edit/${e.unref(t).id}/agenda`)},{default:e.withCtx(()=>[...c[0]||(c[0]=[e.createTextVNode("You have no access to this page. ",-1),e.createElementVNode("span",{class:"group-hover:underline"},"View agenda",-1)])]),_:1},8,["to"])):(e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",k,[e.unref(a)("edit-agendas")?(e.openBlock(),e.createElementBlock("div",x,[e.createVNode(v,{links:r})])):e.createCommentVNode("",!0),e.createElementVNode("div",h,[e.unref(a)("edit-agendas")?(e.openBlock(),e.createElementBlock("div",N,[e.createVNode(g,{links:r})])):e.createCommentVNode("",!0),e.createVNode(f,{class:"flex-1 w-full"},{default:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3})]),_:3})])])]))}}});exports._sfc_main=b;
|
package/dist/index-C9pSS15N.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),W=require("@oneclick.dev/cms-kit"),A=require("lucide-vue-next"),ne=require("./EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js"),y=require("./index-BuzLn4Km.js"),X=require("@oneclick.dev/cms-kit/charts"),ae=require("./index-CxETuRsG.js"),M=require("./index-DQYBP8Js.js"),J=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js"),re=require("./NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js");function se({x:h,y:l,w:o,h:u,tl:f=!1,tr:c=!1,bl:g=!1,br:r=!1,r:a=0}){let m;m=`M${h+a},${l}h${o-2*a}`;let t=c?a:0,s=c?0:a;return m+=`a${t},${t} 0 0 1 ${t},${t}`,m+=`h${s}v${s}`,m+=`v${u-2*a}`,t=r?a:0,s=r?0:a,m+=`a${t},${t} 0 0 1 ${-t},${t}`,m+=`v${s}h${-s}`,m+=`h${2*a-o}`,t=g?a:0,s=g?0:a,m+=`a${t},${t} 0 0 1 ${-t},${-t}`,m+=`h${-s}v${-s}`,m+=`v${2*a-u}`,t=f?a:0,s=f?0:a,m+=`a${t},${t} 0 0 1 ${t},${-t}`,m+=`v${-s}h${s}`,m+="z",m}const le=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}),ee=y.css`
|
|
2
|
-
label: grouped-bar-component;
|
|
3
|
-
`,ie=y.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 ${`.${ee}`} {
|
|
18
|
-
--vis-grouped-bar-stroke-color: var(--vis-dark-grouped-bar-stroke-color);
|
|
19
|
-
}
|
|
20
|
-
`,K=y.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
|
-
`,Q=y.css`
|
|
32
|
-
label: barGroup;
|
|
33
|
-
`,te=y.css`
|
|
34
|
-
label: barGroupExit;
|
|
35
|
-
`,ce=Object.freeze(Object.defineProperty({__proto__:null,bar:K,barGroup:Q,barGroupExit:te,globalStyles:ie,root:ee},Symbol.toStringTag,{value:"Module"}));class oe extends M.XYComponentCore{constructor(l){super(),this._defaultConfig=le,this.config=this._defaultConfig,this.getAccessors=()=>y.isArray(this.config.y)?this.config.y:[this.config.y],this.events={},this._barData=[],l&&this.setConfig(l)}get bleed(){if(this._barData=this._getVisibleData(),this._barData.length===0)return{top:0,bottom:0,left:0,right:0};const l=!this.isVertical()&&this.dataScale.range()[0]>this.dataScale.range()[1],o=this.dataScale.domain(),u=this._getGroupWidth()/2,f=this._barData.map((C,S)=>y.getNumber(C,this.config.x,S)),c=y.min(f),g=y.max(f),r=this.dataScale(c),a=this.dataScale(g),m=this.dataScale.invert(r+(l?u:-u)),t=this.dataScale.invert(a+(l?-u:u)),s=m<=o[0]?this.dataScale(o[0])-this.dataScale(m):0,N=t>o[1]?this.dataScale(t)-this.dataScale(o[1]):0;return{top:this.isVertical()?0:l?-N:s,bottom:this.isVertical()?0:l?-s:N,left:this.isVertical()?s: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(l){const{config:o}=this,u=y.isNumber(l)?l:o.duration,f=this._getGroupWidth(),c=this.getAccessors(),g=[-f/2,f/2],r=M.band().domain(M.range(c.length)).range(g).paddingInner(o.barPadding).paddingOuter(o.barPadding),a=this.g.selectAll(`.${Q}`).data(this._barData,(k,E)=>{var i;return`${(i=y.getString(k,o.id,E))!==null&&i!==void 0?i:E}`}),m=(k,E)=>{const i=this.dataScale(y.getNumber(k,o.x,E)),p=this.isVertical()?i:0,$=this.isVertical()?0:i;return`translate(${p},${$})`},s=a.enter().append("g").attr("class",Q).attr("transform",m).style("opacity",1).merge(a);y.smartTransition(s,u).attr("transform",m).style("opacity",1);const N=a.exit().attr("class",te);y.smartTransition(N,u).style("opacity",0).remove(),y.smartTransition(N.selectAll(`.${K}`),u).attr("transform",(k,E,i)=>this.isVertical()?`translate(0,${this.yScale(0)}) scale(1,0)`:`translate(${this.xScale(0)},0) scale(0,1)`);const C=r.bandwidth(),S=s.selectAll(`.${K}`).data(k=>c.map(()=>k)),B=this._getValueAxisDirection(),j=S.enter().append("path").attr("class",K).attr("d",(k,E)=>{const i=r(E),p=this.valueScale(0),$=C;return this._getBarPath(i,p,$,0,!1,B)}).style("fill",(k,E)=>y.getColor(k,o.color,E)).merge(S);y.smartTransition(j,u).attr("d",(k,E)=>{const i=r(E),p=C,$=y.getNumber(k,c[E]),d=$<0;let R=d?this.valueScale(0):this.valueScale($||0),_=Math.abs(this.valueScale(0)-this.valueScale($))||0;if(_<o.barMinHeight){const L=B===M.Direction.North?-1:1;R=this.valueScale(0)+L*o.barMinHeight,_=o.barMinHeight}return this._getBarPath(i,R,p,_,d,B)}).style("fill",(k,E)=>y.getColor(k,o.color,E)).style("cursor",(k,E)=>y.getString(k,o.cursor,E)),y.smartTransition(S.exit(),u).remove()}_getValueAxisDirection(){return this.valueScale.range()[0]>this.valueScale.range()[1]?M.Direction.North:M.Direction.South}_getVisibleData(){const{config:l,datamodel:{data:o}}=this,u=this._getGroupWidth(),f=o.length<2?0:u/2,c=this.dataScale,g=Math.abs(c.invert(f)-c.invert(0));return o?.filter((a,m)=>{const t=y.getNumber(a,l.x,m),s=c.domain(),N=+s[0],C=+s[1];return t>=N-g&&t<=C+g})}_getBarPath(l,o,u,f,c,g){const{config:r}=this,a=r.roundedCorners?y.isNumber(r.roundedCorners)?+r.roundedCorners:u/2:0,m=y.clamp(a,0,Math.min(f,u)/2),t=g===M.Direction.North,s=this.isVertical()&&c!==t,N=this.isVertical()&&c===t,C=!this.isVertical()&&c,S=!this.isVertical()&&!c;return se({x:this.isVertical()?l:o+(t?0:-f),y:this.isVertical()?o+(t?0:-f):l,w:this.isVertical()?u:f,h:this.isVertical()?f:u,tl:s||C,tr:s||S,bl:N||C,br:N||S,r:m})}_getGroupWidth(){const{config:l,datamodel:{data:o}}=this;if(y.isEmpty(o))return 0;if(l.groupWidth)return y.min([l.groupWidth,l.groupMaxWidth]);const u=this.dataScale.bandwidth,f=this.dataScale.domain?this.dataScale.domain():[];let g=1+(u?f.length:f[1]-f[0])/l.dataStep||!u&&o.filter((m,t)=>{const s=y.getNumber(m,l.x,t);return s>=f[0]&&s<=f[1]}).length||o.length;!u&&g>=2&&(g+=1);const a=(g<2?1:1-l.groupPadding)*(this.isVertical()?this._width:this._height)/g;return y.min([a,l.groupMaxWidth])}getValueScaleExtent(l){const{datamodel:o}=this,u=this.getAccessors(),f=l?this._getVisibleData():o.data,c=y.getMin(f,...u),g=y.getMax(f,...u);return[c>0?0:c,g<0?0:g]}getDataScaleExtent(){const{config:l,datamodel:o}=this;return y.getExtent(o.data,l.x)}getYDataExtent(l){return this.isVertical()?this.getValueScaleExtent(l):this.getDataScaleExtent()}getXDataExtent(){return this.isVertical()?this.getDataScaleExtent():this.getValueScaleExtent(!1)}}oe.selectors=ce;const de={"data-vis-component":""},Z=e.defineComponent({__name:"index",props:{color:{type:[Function,String,Array,null]},groupWidth:{},groupMaxWidth:{},dataStep:{},groupPadding:{},barPadding:{},roundedCorners:{type:[Number,Boolean]},barMinHeight:{},cursor:{type:[Function,String,null]},orientation:{},x:{type:[Function,Number,null]},y:{type:[Function,Number,null,Array]},id:{type:Function},xScale:{type:[Object,Function]},yScale:{type:[Object,Function]},excludeFromDomainCalculation:{type:Boolean},duration:{},events:{},attributes:{},data:{}},setup(h,{expose:l}){const o=e.inject(y.o),u=h,f=e.computed(()=>o.data.value??u.data),c=y.m(u),g=e.ref();return e.onMounted(()=>{e.nextTick(()=>{var r;g.value=new oe(c.value),(r=g.value)==null||r.setData(f.value),o.update(g.value)})}),e.onUnmounted(()=>{var r;(r=g.value)==null||r.destroy(),o.destroy()}),e.watch(c,(r,a)=>{var m;y.f(r,a)||(m=g.value)==null||m.setConfig(c.value)}),e.watch(f,()=>{var r;(r=g.value)==null||r.setData(f.value)}),l({component:g}),(r,a)=>(e.openBlock(),e.createElementBlock("div",de))}}),ue={class:"flex flex-col sm:flex-row"},me=["data-active"],pe={class:"flex items-center gap-2"},fe={class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},ge={class:"block text-lg leading-none font-bold sm:text-3xl"},ve={class:"mx-auto w-full max-w-sm mt-2 mb-8"},he={class:"text-muted-foreground"},xe={class:"text-muted-foreground"},ye={class:"grid"},ke={class:"flex gap-1 overflow-hidden max-w-80"},Ce={class:"truncate"},be=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(h,{emit:l}){const o=h,u=l,f=e.computed({get:()=>o.viewMode,set:m=>{u("update:viewMode",m)}}),c=e.computed({get:()=>o.activeChart,set:m=>{u("update:activeChart",m)}}),{width:g}=ae.useWindowSize(),r=e.computed(()=>g.value<640),a=e.ref(!1);return(m,t)=>{const s=e.resolveComponent("DrawerTitle"),N=e.resolveComponent("DrawerDescription"),C=e.resolveComponent("DrawerHeader"),S=e.resolveComponent("Button"),B=e.resolveComponent("DrawerFooter"),z=e.resolveComponent("DrawerContent"),j=e.resolveComponent("Drawer"),k=e.resolveComponent("DropdownMenuTrigger"),E=e.resolveComponent("DropdownMenuLabel"),i=e.resolveComponent("DropdownMenuItem"),p=e.resolveComponent("DropdownMenuContent"),$=e.resolveComponent("DropdownMenu");return e.openBlock(),e.createElementBlock("div",ue,[h.resources.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,"data-active":h.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:t[0]||(t[0]=d=>a.value=!0)},[e.createElementVNode("div",pe,[h.viewMode==="stacked"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(A.Layers),{class:"size-3 text-muted-foreground"}),t[5]||(t[5]=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:h.resources.find(d=>d.id===h.activeChart)?.color||"#6b7280"})},null,4),e.createElementVNode("span",fe,e.toDisplayString(h.resources.find(d=>d.id===h.activeChart)?.name||"Select Resource"),1)],64)),e.createVNode(e.unref(A.ChevronDown),{class:"ml-auto size-4"})]),e.createElementVNode("span",ge,e.toDisplayString(h.viewMode==="stacked"?Object.values(h.totals).reduce((d,R)=>d+R,0).toLocaleString():(h.totals[h.activeChart]||0).toLocaleString()),1)],8,me)):e.createCommentVNode("",!0),e.unref(r)?(e.openBlock(),e.createBlock(j,{key:1,open:e.unref(a),"onUpdate:open":t[2]||(t[2]=d=>e.isRef(a)?a.value=d:null)},{default:e.withCtx(()=>[e.createVNode(z,null,{default:e.withCtx(()=>[e.createElementVNode("div",ve,[e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Select the resources to display on the timeline.",-1)])]),_:1})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(S,{onClick:t[1]||(t[1]=d=>{f.value="stacked",c.value="",a.value=!1}),variant:h.viewMode==="stacked"?"secondary":"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(A.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",he," All Resources ("+e.toDisplayString(Object.values(h.totals).reduce((d,R)=>d+R,0).toLocaleString())+") ",1)]),_:1},8,["variant"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.resources,d=>(e.openBlock(),e.createBlock(S,{key:d.id,onClick:R=>{f.value="single",c.value=d.id,a.value=!1},variant:h.viewMode==="single"&&h.activeChart===d.id?"secondary":"outline"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:d.color||"#6b7280"})},null,4),e.createElementVNode("span",xe,e.toDisplayString(d.name)+" ("+e.toDisplayString((h.totals[d.id]||0).toLocaleString())+") ",1)]),_:2},1032,["onClick","variant"]))),128))]),_:1})])]),_:1})]),_:1},8,["open"])):(e.openBlock(),e.createBlock($,{key:2,open:e.unref(a),"onUpdate:open":t[4]||(t[4]=d=>e.isRef(a)?a.value=d:null)},{default:e.withCtx(()=>[e.createVNode(k,{"as-child":""},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createElementVNode("button",{tabindex:"-1",class:"size-0 opacity-0 self-end"},null,-1)])]),_:1}),e.createVNode(p,{align:"start"},{default:e.withCtx(()=>[e.createVNode(E,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createElementVNode("div",ye,[e.createVNode(i,{onClick:t[3]||(t[3]=d=>{f.value="stacked",c.value="",a.value=!1}),class:e.normalizeClass(h.viewMode==="stacked"?"bg-input":"")},{default:e.withCtx(()=>[e.createVNode(e.unref(A.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",null," All Resources ("+e.toDisplayString(Object.values(h.totals).reduce((d,R)=>d+R,0).toLocaleString())+") ",1)]),_:1},8,["class"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.resources,d=>(e.openBlock(),e.createBlock(i,{key:d.id,onClick:R=>{f.value="single",c.value=d.id,a.value=!1},class:e.normalizeClass(h.viewMode==="single"&&h.activeChart===d.id?"bg-input":"")},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:d.color||"#6b7280"})},null,4),e.createElementVNode("span",ke,[e.createElementVNode("span",Ce,e.toDisplayString(d.name),1),e.createElementVNode("span",null,"("+e.toDisplayString((h.totals[d.id]||0).toLocaleString())+")",1)])]),_:2},1032,["onClick","class"]))),128))])]),_:1})]),_:1},8,["open"]))])}}}),_e={class:"flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6"},Ve={class:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3"},we={class:"flex items-center gap-1"},Ne={key:1,class:"flex items-center justify-center px-6 py-4 text-muted-foreground text-sm"},Se={key:0,class:"flex items-center justify-center h-[250px]"},De={key:1,class:"flex items-center justify-center h-[250px]"},Ee=e.defineComponent({__name:"Timeline",props:{modelValue:{},selectedResource:{},viewMode:{},agendaData:{},resources:{}},emits:["update:modelValue","update:selectedResource","update:viewMode"],setup(h,{emit:l}){const o=h,u=l,{params:f}=W.useModuleRoute(),{config:c}=W.useModule(),g=W.useFirebaseIntegration(c.project),r=e.ref([]),a=e.ref([]),m=e.ref(!0),t=e.ref(o.viewMode||"stacked"),s=e.ref(o.selectedResource||"");e.watch(t,n=>{u("update:viewMode",n)},{immediate:!0}),e.watch(s,n=>{u("update:selectedResource",t.value==="single"?n:null)}),e.watch(t,n=>{u("update:selectedResource",n==="single"?s.value:null)});const N=new Date,C=e.ref(o.modelValue||new Date);e.watch(()=>o.modelValue,n=>{n&&n.getTime()!==C.value.getTime()&&(C.value=n)}),e.watch(C,n=>{u("update:modelValue",n)},{immediate:!0});const S=e.computed(()=>{const n=new Date(N);n.setDate(N.getDate()-1);const v=new Date(N);return v.setDate(N.getDate()+1),C.value.toDateString()===N.toDateString()?"Today":C.value.toDateString()===n.toDateString()?"Yesterday":C.value.toDateString()===v.toDateString()?"Tomorrow":C.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),B=()=>{const n=new Date(C.value);n.setDate(n.getDate()-1),C.value=n},z=()=>{const n=new Date(C.value);n.setDate(n.getDate()+1),C.value=n},j=()=>{C.value=new Date},k=e.computed(()=>o.resources?.length===0?10:Math.max(...(o.resources||[]).map(n=>n.capacity||10))),E=e.computed(()=>(o.resources?.length||0)===0?60:Math.min(...(o.resources||[]).map(n=>n.interval||60))),i=e.computed(()=>{const n={total:{label:"Total Reservations",color:void 0}};return(o.resources||[]).forEach((v,w)=>{n[v.id]={label:v.name,color:v.color||`var(--chart-${w%5+1})`}}),n});e.watch(()=>o.resources,n=>{(n?.length||0)>0&&!s.value&&(s.value=n[0].id)},{immediate:!0});const p=e.computed(()=>[...o.resources||[]].sort((n,v)=>{const w=d.value[n.id]||0;return(d.value[v.id]||0)-w})),$=e.computed(()=>{const n=[];return E.value,r.value.forEach((v,w)=>{v.time.endsWith(":00")&&n.push(w)}),n}),d=e.computed(()=>{const n={};return o.resources?.forEach(v=>{n[v.id]=a.value.filter(w=>w.resourceId===v.id).reduce((w,D)=>w+(D.reserved||0),0)}),n}),R=n=>{const v=n.getFullYear(),w=String(n.getMonth()+1).padStart(2,"0"),D=String(n.getDate()).padStart(2,"0");return`${v}-${w}-${D}`},_=n=>{const[v,w]=n.split(":").map(Number);return v*60+w},L=(n,v)=>(o.agendaData?.exceptions||[]).find(D=>v>=D.startDate&&v<=D.endDate?D.resourceIds===null?!0:D.resourceIds?.includes(n):!1)||null,T=e.computed(()=>{const n=R(C.value),v=C.value.getDay();let w=1440,D=0;if((o.resources||[]).forEach(G=>{const I=L(G.id,n);if(I){if(I.isClosed)return;I.timeslots.forEach(O=>{const x=_(O.startTime),b=_(O.endTime);w=Math.min(w,x),D=Math.max(D,b)})}else(G.openingHours?.[v]||[]).forEach(x=>{const b=_(x.start),F=_(x.end);w=Math.min(w,b),D=Math.max(D,F)})}),w>=D)return{startMinutes:540,endMinutes:1020};const P=Math.floor(w/60)*60,q=Math.ceil(D/60)*60;return{startMinutes:P,endMinutes:q}}),H=()=>{const n=[],v=E.value,{startMinutes:w,endMinutes:D}=T.value;for(let P=w;P<D;P+=v){const q=Math.floor(P/60),G=P%60,I=`${String(q).padStart(2,"0")}:${String(G).padStart(2,"0")}`,O={time:I,label:I};o.resources?.forEach(x=>{O[x.id]=0}),n.push(O)}return n},U=async()=>{m.value=!0;try{const n=f.value.id,v=R(C.value),w=`${n}_${v}`,D=await g.get(c.reservedSpotsCollection,w);a.value=[];for(const I of o.resources||[]){const O=D?.[I.id]||{};Object.entries(O).forEach(([x,b])=>{const[F,Y]=x.split("-");a.value.push({resourceId:I.id,startTime:F,endTime:Y,reserved:b})})}const P=H(),q=E.value,{startMinutes:G}=T.value;a.value.forEach(I=>{const O=_(I.startTime),x=_(I.endTime);for(let b=O;b<x;b+=q){const F=Math.floor((b-G)/q);if(F>=0&&F<P.length){const Y=P[F][I.resourceId];typeof Y=="number"&&(P[F][I.resourceId]=Y+(I.reserved||0))}}}),r.value=P}catch(n){console.error("Error loading reservation data:",n),r.value=H(),a.value=[]}finally{m.value=!1}};return(async()=>await U())(),e.watch(C,()=>{U()}),e.watch(()=>o.resources,()=>{(o.resources?.length||0)>0&&U()}),(n,v)=>{const w=e.resolveComponent("CardTitle"),D=e.resolveComponent("Button"),P=e.resolveComponent("CardDescription"),q=e.resolveComponent("CardHeader"),G=e.resolveComponent("ChartContainer"),I=e.resolveComponent("CardContent"),O=e.resolveComponent("Card");return e.openBlock(),e.createBlock(O,{class:"py-4 sm:py-0"},{default:e.withCtx(()=>[e.createVNode(q,{class:"flex flex-col items-stretch border-b !p-0 sm:flex-row"},{default:e.withCtx(()=>[e.createElementVNode("div",_e,[e.createElementVNode("div",Ve,[e.createVNode(w,null,{default:e.withCtx(()=>[...v[2]||(v[2]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createElementVNode("div",we,[e.createVNode(D,{variant:"ghost",size:"icon",class:"size-8",onClick:B},{default:e.withCtx(()=>[e.createVNode(e.unref(A.ChevronLeft),{size:16})]),_:1}),e.createVNode(D,{variant:"ghost",size:"sm",class:"h-8 px-3 text-xs",onClick:j},{default:e.withCtx(()=>[...v[3]||(v[3]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(D,{variant:"ghost",size:"icon",class:"size-8",onClick:z},{default:e.withCtx(()=>[e.createVNode(e.unref(A.ChevronRight),{size:16})]),_:1})])]),e.createVNode(P,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(S)),1)]),_:1})]),h.resources.length>0?(e.openBlock(),e.createBlock(be,{key:0,resources:h.resources,totals:e.unref(d),viewMode:e.unref(t),"onUpdate:viewMode":v[0]||(v[0]=x=>e.isRef(t)?t.value=x:null),activeChart:e.unref(s),"onUpdate:activeChart":v[1]||(v[1]=x=>e.isRef(s)?s.value=x:null)},null,8,["resources","totals","viewMode","activeChart"])):(e.openBlock(),e.createElementBlock("div",Ne," No resources configured "))]),_:1}),e.createVNode(I,{class:"px-2 sm:p-6"},{default:e.withCtx(()=>[e.unref(m)?(e.openBlock(),e.createElementBlock("div",Se,[...v[4]||(v[4]=[e.createElementVNode("div",{class:"text-muted-foreground"},"Loading...",-1)])])):h.resources.length===0?(e.openBlock(),e.createElementBlock("div",De,[...v[5]||(v[5]=[e.createElementVNode("div",{class:"text-muted-foreground"},"No resources to display",-1)])])):e.unref(t)==="stacked"?(e.openBlock(),e.createBlock(G,{key:2,config:e.unref(i),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(M.S),{data:e.unref(r),margin:{left:-24},"y-domain":[0,e.unref(k)]},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),x=>(e.openBlock(),e.createBlock(e.unref(Z),{key:x.id,x:(b,F)=>F,y:b=>b[x.id]||0,color:b=>b[x.id]>0?e.unref(i)[x.id]?.color:"#61616180","bar-padding":.1,"rounded-corners":2},null,8,["x","y","color"]))),128)),e.createVNode(e.unref(M.C),{type:"x",x:(x,b)=>b,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref($),"tick-format":x=>e.unref(r)[x]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(M.C),{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(X.componentToString)(e.unref(i),e.unref(X.ChartTooltipContent),{labelFormatter(x){const b=Math.round(x);return b>=0&&b<e.unref(r).length&&e.unref(r)[b]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config"])):(e.openBlock(),e.createBlock(G,{key:3,config:e.unref(i),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(M.S),{data:e.unref(r),margin:{left:-24},"y-domain":[0,e.unref(k)]},{default:e.withCtx(()=>[e.createVNode(e.unref(Z),{x:(x,b)=>b,y:x=>x[e.unref(s)]||0,color:x=>x[e.unref(s)]>0?e.unref(i)[e.unref(s)]?.color:"hsl(var(--muted))","bar-padding":.1,"rounded-corners":!1},null,8,["x","y","color"]),e.createVNode(e.unref(M.C),{type:"x",x:(x,b)=>b,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref($),"tick-format":x=>e.unref(r)[x]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(M.C),{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(X.componentToString)(e.unref(i),e.unref(X.ChartTooltipContent),{labelFormatter(x){const b=Math.round(x);return b>=0&&b<e.unref(r).length&&e.unref(r)[b]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config"]))]),_:1})]),_:1})}}}),Be={class:"flex flex-row items-center justify-between gap-2"},$e={class:"relative mb-4"},Me={class:"flex gap-1 mb-4 flex-wrap"},Te={key:0,class:"mb-3 text-sm text-muted-foreground"},Re={key:1,class:"flex items-center justify-center py-8"},ze={key:2,class:"flex flex-col items-center gap-2 text-center py-8 text-muted-foreground"},Ie={key:3,class:"text-center py-8 text-muted-foreground"},Pe={key:4,class:"space-y-2"},Ae=["onClick"],je={class:"flex items-start justify-between"},Oe={class:"flex-1"},Le={class:"font-medium"},Fe={class:"text-sm text-muted-foreground"},We={class:"text-sm text-muted-foreground"},Ge={class:"flex items-center gap-4 flex-wrap"},qe={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},He={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},Ue={key:0,class:"flex items-center gap-1 mt-1 text-xs text-muted-foreground"},Ye={class:"text-right"},Xe={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"},Ke={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"},Qe={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"},Je={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"},Ze={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"},et={key:5,class:"text-sm font-medium mt-1"},tt=e.defineComponent({__name:"BookingsList",props:{activeDate:{},selectedResource:{},resources:{}},setup(h){const l=h,{params:o}=W.useModuleRoute(),{config:u}=W.useModule(),f=W.useFirebaseIntegration(u.project),c=e.ref([]),g=e.ref(!0),r=e.ref(""),a=e.ref(null),m=e.computed(()=>({date:t(l.activeDate),resource:null}));e.provide("event",m);const t=i=>{const p=i.getFullYear(),$=String(i.getMonth()+1).padStart(2,"0"),d=String(i.getDate()).padStart(2,"0");return`${p}-${$}-${d}`},s=e.computed(()=>{let i=c.value;return l.selectedResource&&(i=i.filter(p=>p.resourceId===l.selectedResource)),r.value.trim()&&(i=new J.Fuse(i,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(r.value).map($=>$.item)),i}),N=e.computed(()=>s.value.filter(i=>z.value.includes(i.reservationStatus))),C=e.computed(()=>c.value.some(i=>i.reservationStatus==="approved"||i.reservationStatus==="needs_approval")),S=e.computed(()=>({spots:c.value.reduce((i,p)=>i+(p.spots||0),0),bookings:c.value.length})),B=()=>{r.value=""},z=e.ref(["needs_approval","approved"]),j=i=>{z.value.includes(i)?z.value=z.value.filter(p=>p!==i):z.value.push(i)},k=async()=>{g.value=!0,c.value=[];try{const i=o.value.id,p=t(l.activeDate),$=new Set;l.resources?.forEach(_=>{const L=`${_.id}_${p}`;$.add(L)});const d=await f.find(u.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:i},{field:"status",operator:"==",value:"confirmed"},{field:"flattenedReservationDates",operator:"array-contains-any",value:Array.from($)}]});let R=[];d.forEach(_=>{(_.reservations?.filter(T=>T.date===p)||[]).forEach(T=>{const H=l.resources.find(U=>U.id===T.resourceId);R.push({customerInfo:_.customerInfo,amountDue:_.amountDue,amountPaid:_.amountPaid,status:_.status,reservationStatus:T.status,subtotal:_.subtotal,total:_.total,discount:_.discount,id:_.id,res_id:T.id,resourceId:T.resourceId,spots:T.spots,date:p,startTime:T.timeslot?.startTime,endTime:T.timeslot?.endTime,reservationPrice:T.totalPrice,reservationBasePrice:T.basePrice,reservationAddOnsPrice:T.addOnsPrice,pricingOptionId:T.pricingOptionId,pricingOption:T.pricingOption,resourceName:H?.name||"Unknown",resourceColor:H?.color})})}),c.value=R.sort((_,L)=>_.startTime?.localeCompare(L.startTime||"")||0)}catch(i){console.error("Error loading orders:",i),c.value=[]}finally{g.value=!1}};return(async()=>await k())(),e.watch(()=>l.activeDate,()=>{k()}),(i,p)=>{const $=e.resolveComponent("Badge"),d=e.resolveComponent("CardTitle"),R=e.resolveComponent("CardDescription"),_=e.resolveComponent("Button"),L=e.resolveComponent("CardHeader"),T=e.resolveComponent("Input"),H=e.resolveComponent("CardContent"),U=e.resolveComponent("Card");return e.openBlock(),e.createBlock(U,null,{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createElementVNode("div",Be,[e.createElementVNode("div",null,[e.createVNode(d,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[p[6]||(p[6]=e.createTextVNode(" Bookings ",-1)),e.unref(S).bookings>0?(e.openBlock(),e.createBlock($,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(S).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(R,{class:"flex items-center gap-2 mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(A.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(e.unref(S).spots)+" total spots",1)]),_:1})]),e.createVNode(_,{variant:"ghost",size:"icon",onClick:k,disabled:e.unref(g)},{default:e.withCtx(()=>[e.createVNode(e.unref(A.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(g)})},null,8,["class"])]),_:1},8,["disabled"])])]),_:1}),e.createVNode(H,null,{default:e.withCtx(()=>[e.createElementVNode("div",$e,[e.createVNode(e.unref(A.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(T,{modelValue:e.unref(r),"onUpdate:modelValue":p[0]||(p[0]=V=>e.isRef(r)?r.value=V:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(r)?(e.openBlock(),e.createBlock(_,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:B},{default:e.withCtx(()=>[e.createVNode(e.unref(A.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Me,[e.createElementVNode("button",{onClick:p[1]||(p[1]=V=>j("needs_approval")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(z).includes("needs_approval")}])}," Needs Approval ",2),e.createElementVNode("button",{onClick:p[2]||(p[2]=V=>j("approved")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(z).includes("approved")}])}," Approved ",2),e.createElementVNode("button",{onClick:p[3]||(p[3]=V=>j("rejected")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(z).includes("rejected")}])}," Rejected ",2),e.createElementVNode("button",{onClick:p[4]||(p[4]=V=>j("cancelled")),class:e.normalizeClass(["px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(z).includes("cancelled")}])}," Cancelled ",2)]),e.unref(r)?(e.openBlock(),e.createElementBlock("div",Te," Showing "+e.toDisplayString(e.unref(s).length)+" of "+e.toDisplayString(e.unref(c).length)+" bookings ",1)):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("div",Re,[...p[7]||(p[7]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(N).length===0?(e.openBlock(),e.createElementBlock("div",ze,[p[9]||(p[9]=e.createTextVNode(" No bookings for this day ",-1)),e.unref(C)?(e.openBlock(),e.createBlock(_,{key:0,onClick:p[5]||(p[5]=V=>z.value=["needs_approval","approved"])},{default:e.withCtx(()=>[...p[8]||(p[8]=[e.createTextVNode("Reset filters",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.unref(s).length===0?(e.openBlock(),e.createElementBlock("div",Ie," No bookings match your search ")):(e.openBlock(),e.createElementBlock("div",Pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),V=>(e.openBlock(),e.createElementBlock("div",{key:V.res_id||V.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:n=>e.unref(a)?.openDialog(V)},[e.createElementVNode("div",je,[e.createElementVNode("div",Oe,[e.createElementVNode("div",Le,e.toDisplayString(V.customerInfo?.firstName)+" "+e.toDisplayString(V.customerInfo?.lastName||"Unknown Customer"),1),e.createElementVNode("div",Fe,e.toDisplayString(V.customerInfo?.email),1),e.createElementVNode("div",We,e.toDisplayString(V.customerInfo?.phone),1),e.createElementVNode("div",Ge,[e.createElementVNode("div",qe,[e.createVNode(e.unref(A.Clock),{size:12}),e.createElementVNode("span",null,e.toDisplayString(V.startTime)+" - "+e.toDisplayString(V.endTime),1)]),e.createElementVNode("div",He,[e.createVNode(e.unref(A.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(V.spots)+" spots",1)]),V.resourceName?(e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:V.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(V.resourceName),1)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ye,[V.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",Xe,"Needs Approval")):V.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",Ke,"Approved")):V.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",Qe,"Rejected")):V.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",Je,"Cancelled")):(e.openBlock(),e.createElementBlock("span",Ze,"Pending")),V.reservationPrice||V.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",et," €"+e.toDisplayString(V.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,Ae))),128))]))]),_:1}),e.createVNode(J._sfc_main,{ref_key:"reservationDetailDialog",ref:a,onCancelled:k,onConfirmed:k,onRejected:k},null,512)]),_:1})}}}),ot={class:"space-y-6"},nt={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},at={class:"text-2xl font-semibold tracking-tight"},rt={class:"flex flex-col md:flex-row gap-2"},st={class:"grid gap-6 md:grid-cols-2 lg:grid-cols-3"},lt={class:"md:col-span-2 lg:col-span-3"},it=e.defineComponent({__name:"index",setup(h){const{hasPermission:l}=W.useModulePermissions(),{params:o,resolvePath:u}=W.useModuleRoute(),{config:f}=W.useModule(),c=W.useFirebaseIntegration(f.project),g=e.ref(""),r=e.ref(!0),a=e.ref(new Date),m=e.ref(null),t=e.ref("stacked"),s=e.ref(null),N=e.ref([]);return(async()=>{try{const S=await c.get(f.agendaCollection,o.value.id);g.value=S?.serviceName||"",s.value=S,N.value=S?.resources?.filter(B=>B.isActive)||[]}catch(S){console.error("Error loading data:",S)}finally{r.value=!1}})(),e.provide("agendaData",s),(S,B)=>{const z=e.resolveComponent("Button"),j=e.resolveComponent("NuxtLink");return e.openBlock(),e.createBlock(ne._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",ot,[e.createElementVNode("div",nt,[e.createElementVNode("div",null,[e.createElementVNode("h1",at,e.toDisplayString(e.unref(g)||"Dashboard"),1),B[3]||(B[3]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," Overview and analytics for your booking service ",-1))]),e.createElementVNode("div",rt,[e.unref(l)("manage-reservations")?(e.openBlock(),e.createBlock(re._sfc_main,{key:0})):e.createCommentVNode("",!0),e.createVNode(j,{to:e.unref(u)(`/edit/${e.unref(o).id}/agenda`)},{default:e.withCtx(()=>[e.createVNode(z,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(A.Calendar),{class:"size-4"}),B[4]||(B[4]=e.createTextVNode(" View Agenda ",-1))]),_:1})]),_:1},8,["to"])])]),e.createVNode(Ee,{modelValue:e.unref(a),"onUpdate:modelValue":B[0]||(B[0]=k=>e.isRef(a)?a.value=k:null),"view-mode":e.unref(t),"onUpdate:viewMode":B[1]||(B[1]=k=>e.isRef(t)?t.value=k:null),"onUpdate:selectedResource":B[2]||(B[2]=k=>m.value=k),"agenda-data":e.unref(s),resources:e.unref(N)},null,8,["modelValue","view-mode","agenda-data","resources"]),e.createElementVNode("div",st,[e.createElementVNode("div",lt,[e.unref(N).length>0?(e.openBlock(),e.createBlock(tt,{key:0,"active-date":e.unref(a),"selected-resource":e.unref(m),resources:e.unref(N)},null,8,["active-date","selected-resource","resources"])):e.createCommentVNode("",!0)])])])]),_:1})}}});exports.default=it;
|