@oneclick.dev/cms-core-modules 0.0.98 → 0.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/{ContentEditor-BPrZ-yof.mjs → ContentEditor-Cjqgb64R.mjs} +3363 -3201
  2. package/dist/{ContentEditor-CsZDAnGs.js → ContentEditor-YgOS3kxS.js} +249 -101
  3. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-COfCOMsz.js +349 -0
  4. package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CYXkhhdp.mjs} +989 -937
  5. package/dist/{TableView-Bf67F7Hd.mjs → TableView-CIJs118q.mjs} +2105 -1918
  6. package/dist/TableView-DzZYf34i.js +4 -0
  7. package/dist/View-CsudjxCE.mjs +30 -0
  8. package/dist/View-Dw_wA6kK.js +1 -0
  9. package/dist/{agenda-D9bpW3jv.mjs → agenda-DMT75Qfo.mjs} +1 -1
  10. package/dist/{agenda-H1NyBNr2.js → agenda-DxD4RMsy.js} +1 -1
  11. package/dist/{index-DOeXSG47.js → index-BbqRTXuU.js} +1 -1
  12. package/dist/{index-DnH93MgM.mjs → index-D4GsbUId.mjs} +1 -1
  13. package/dist/index.cjs.js +1 -1
  14. package/dist/index.mjs +6 -6
  15. package/dist/{orders-DDrZJHj2.mjs → orders-BRfXlWgV.mjs} +1 -1
  16. package/dist/{orders-BAT2ciXx.js → orders-CrCz1WTR.js} +1 -1
  17. package/dist/src/contentManager/components/content-editor/code-examples.d.ts +2 -1
  18. package/dist/src/table/components/DataTable.vue.d.ts +2 -2
  19. package/dist/src/table/components/DataTableMobileRowActionDrawer.vue.d.ts +1 -1
  20. package/dist/src/table/pages/TableView.vue.d.ts +2 -2
  21. package/package.json +2 -2
  22. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js +0 -349
  23. package/dist/TableView-pK16x94F.js +0 -4
  24. package/dist/View-C8oQG6gI.js +0 -1
  25. package/dist/View-CPMontPz.mjs +0 -28
package/dist/index.mjs CHANGED
@@ -45,7 +45,7 @@ const I = "data:image/webp;base64,UklGRg5VAABXRUJQVlA4WAoAAAAMAAAA4wAA4wAAVlA4IJ
45
45
  default: !1
46
46
  }
47
47
  }), e = [
48
- { path: "", component: () => import("./TableView-Bf67F7Hd.mjs") }
48
+ { path: "", component: () => import("./TableView-CIJs118q.mjs") }
49
49
  ], t = [], IA = {
50
50
  component: () => import("./index-Bkq58CeQ.mjs"),
51
51
  metadata: C,
@@ -153,7 +153,7 @@ const I = "data:image/webp;base64,UklGRg5VAABXRUJQVlA4WAoAAAAMAAAA4wAA4wAAVlA4IJ
153
153
  type: "form"
154
154
  }
155
155
  }), b = [
156
- { path: "", component: () => import("./View-CPMontPz.mjs") }
156
+ { path: "", component: () => import("./View-CsudjxCE.mjs") }
157
157
  ], M = [], oA = {
158
158
  component: () => import("./index-Dpl9sU6a.mjs"),
159
159
  metadata: p,
@@ -548,7 +548,7 @@ const I = "data:image/webp;base64,UklGRg5VAABXRUJQVlA4WAoAAAAMAAAA4wAA4wAAVlA4IJ
548
548
  { path: "", component: () => import("./Overview-C--dq51X.mjs") },
549
549
  { path: "/collections", component: () => import("./Overview-C--dq51X.mjs") },
550
550
  { path: "/collections/:collectionId", component: () => import("./Entries-dLlCrXXe.mjs") },
551
- { path: "/collections/:collectionId/:entryId", component: () => import("./ContentEditor-BPrZ-yof.mjs") },
551
+ { path: "/collections/:collectionId/:entryId", component: () => import("./ContentEditor-Cjqgb64R.mjs") },
552
552
  { path: "/components", component: () => import("./Components-C83O-xlF.mjs") },
553
553
  { path: "/global-styling", component: () => import("./GlobalStyling-C9VthHWK.mjs") }
554
554
  ], K = [
@@ -628,14 +628,14 @@ const I = "data:image/webp;base64,UklGRg5VAABXRUJQVlA4WAoAAAAMAAAA4wAA4wAAVlA4IJ
628
628
  { path: "/create/regular", component: () => import("./regular-_05oq5Tx.mjs") },
629
629
  // { path: '/create/full-day', component: () => import('./pages/create/full-day.vue') },
630
630
  // { path: '/create/multi-day', component: () => import('./pages/create/multi-day.vue') },
631
- { path: "/edit/:id", component: () => import("./index-DnH93MgM.mjs") },
632
- { path: "/edit/:id/agenda", component: () => import("./agenda-D9bpW3jv.mjs") },
631
+ { path: "/edit/:id", component: () => import("./index-D4GsbUId.mjs") },
632
+ { path: "/edit/:id/agenda", component: () => import("./agenda-DMT75Qfo.mjs") },
633
633
  { path: "/edit/:id/regular-slots", component: () => import("./regular-slots-Cc1jmKuC.mjs") },
634
634
  { path: "/edit/:id/exceptions", component: () => import("./exceptions-C97cNZYl.mjs") },
635
635
  { path: "/edit/:id/availability", component: () => import("./availability-B1D4Fyzi.mjs") },
636
636
  { path: "/edit/:id/payment", component: () => import("./payment-Bosr0m3u.mjs") },
637
637
  { path: "/edit/:id/resources", component: () => import("./resources-B7qDBC91.mjs") },
638
- { path: "/edit/:id/orders", component: () => import("./orders-DDrZJHj2.mjs") }
638
+ { path: "/edit/:id/orders", component: () => import("./orders-BRfXlWgV.mjs") }
639
639
  ], _ = [
640
640
  { key: "create-agendas", name: "Create agendas", description: "Team member can create agendas" },
641
641
  { key: "edit-agendas", name: "Edit agendas", description: "Team member can edit agendas" },
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as te, ref as w, computed as b, provide as se, onMounted as oe, watch as ae, resolveComponent as x, openBlock as c, createElementBlock as m, Fragment as j, createVNode as r, withCtx as f, createElementVNode as s, unref as o, createTextVNode as C, createBlock as L, toDisplayString as d, createCommentVNode as I, normalizeClass as ne, isRef as re, renderList as ie, normalizeStyle as le, nextTick as ce } from "vue";
2
2
  import { useRoute as de, useRouter as ue, useOverlayParams as me, useModuleRoute as pe, useModule as fe, useFirebaseIntegration as ge } from "@oneclick.dev/cms-kit";
3
3
  import { ShoppingBag as V, Users as E, ChevronLeft as ve, ChevronRight as _e, RefreshCw as xe, Search as he, X as ye, Calendar as De, Clock as we } from "lucide-vue-next";
4
- import { F as ke, _ as be } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs";
4
+ import { F as ke, _ as be } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CYXkhhdp.mjs";
5
5
  import { _ as Ce } from "./EditLayout.vue_vue_type_script_setup_true_lang-DXa-Xxue.mjs";
6
6
  const Ie = { class: "space-y-6" }, Se = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Pe = { class: "text-2xl font-semibold tracking-tight flex items-center gap-2" }, Oe = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Te = { class: "flex items-center gap-1" }, ze = { class: "flex items-center gap-1" }, Ne = { class: "flex items-center gap-2" }, Ae = { class: "flex items-center gap-1" }, Re = { class: "text-sm text-muted-foreground mt-2" }, Be = { class: "relative mb-4" }, Fe = {
7
7
  key: 0,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("@oneclick.dev/cms-kit"),i=require("lucide-vue-next"),E=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js"),M=require("./EditLayout.vue_vue_type_script_setup_true_lang-ozYrxb2g.js"),H={class:"space-y-6"},$={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Y={class:"text-2xl font-semibold tracking-tight flex items-center gap-2"},K={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Q={class:"flex items-center gap-1"},X={class:"flex items-center gap-1"},G={class:"flex items-center gap-2"},J={class:"flex items-center gap-1"},W={class:"text-sm text-muted-foreground mt-2"},Z={class:"relative mb-4"},ee={key:0,class:"mb-3 text-sm text-muted-foreground"},te={key:1,class:"flex items-center justify-center py-8"},oe={key:2,class:"text-center py-8 text-muted-foreground"},ne={key:3,class:"text-center py-8 text-muted-foreground"},se={key:4,class:"space-y-2"},re=["onClick"],ae={class:"flex items-start justify-between"},le={class:"flex-1"},ce={class:"font-medium"},ie={class:"text-sm text-muted-foreground"},de={class:"text-sm text-muted-foreground"},ue={class:"flex items-center gap-4 flex-wrap mt-1"},me={class:"flex items-center gap-2 text-xs text-muted-foreground"},pe={class:"flex items-center gap-2 text-xs text-muted-foreground"},fe={key:0,class:"flex items-center gap-1 text-xs text-muted-foreground"},ge={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},ve={class:"text-right"},_e={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"},xe={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"},ye={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"},he={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"},ke={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"},Ne={key:5,class:"text-sm font-medium mt-1"},De=e.defineComponent({__name:"orders",setup(we){const C=v.useRoute();v.useRouter();const S=v.useOverlayParams(),{params:b}=v.useModuleRoute(),{config:x}=v.useModule(),N=v.useFirebaseIntegration(x.project),d=e.ref([]),y=e.ref([]),_=e.ref(!0),m=e.ref(""),D=e.ref(null),p=new Date,c=e.ref(new Date),B=e.computed(()=>({date:A(c.value),resource:null}));e.provide("event",B);const I=e.computed(()=>{const t=new Date(p);t.setDate(p.getDate()-1);const o=new Date(p);return o.setDate(p.getDate()+1),c.value.toDateString()===p.toDateString()?"Today":c.value.toDateString()===t.toDateString()?"Yesterday":c.value.toDateString()===o.toDateString()?"Tomorrow":c.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),P=()=>{const t=new Date(c.value);t.setDate(t.getDate()-1),c.value=t},T=()=>{const t=new Date(c.value);t.setDate(t.getDate()+1),t<=p&&(c.value=t)},O=e.computed(()=>{const t=new Date(c.value);return t.setDate(t.getDate()+1),t<=p}),z=()=>{c.value=new Date},A=t=>{const o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${o}-${s}-${r}`},R=t=>t?new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):"",U=t=>t?new Date(t).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):"",w=e.computed(()=>m.value.trim()?new E.Fuse(d.value,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(m.value).map(o=>o.item):d.value),h=e.computed(()=>({spots:d.value.reduce((t,o)=>t+(o.spots||0),0),bookings:d.value.length,revenue:d.value.reduce((t,o)=>t+(o.reservationPrice||0),0)})),j=()=>{m.value=""},F=async()=>{try{const t=b.value.id,o=await N.get(x.agendaCollection,t);y.value=o?.resources?.filter(s=>s.isActive)||[]}catch(t){console.error("Error loading resources:",t),y.value=[]}},f=async()=>{_.value=!0,d.value=[];try{const t=b.value.id,o=new Date(c.value);o.setHours(0,0,0,0);const s=new Date(c.value);s.setHours(23,59,59,999);const r=await N.find(x.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:t},{field:"createdAt",operator:">=",value:o.toISOString()},{field:"createdAt",operator:"<=",value:s.toISOString()}]});let u=[];r.forEach(a=>{(a.reservations||[]).forEach(l=>{const k=y.value.find(V=>V.id===l.resourceId);u.push({customerInfo:a.customerInfo,amountDue:a.amountDue,amountPaid:a.amountPaid,status:a.status,reservationStatus:l.status,subtotal:a.subtotal,total:a.total,discount:a.discount,id:a.id,res_id:l.id,resourceId:l.resourceId,spots:l.spots,date:l.date,createdAt:a.createdAt,startTime:l.timeslot?.startTime,endTime:l.timeslot?.endTime,reservationPrice:l.totalPrice,reservationBasePrice:l.basePrice,reservationAddOnsPrice:l.addOnsPrice,pricingOptionId:l.pricingOptionId,pricingOption:l.pricingOption,resourceName:k?.name||"Unknown",resourceColor:k?.color})})}),d.value=u.sort((a,g)=>(g.createdAt||"").localeCompare(a.createdAt||""))}catch(t){console.error("Error loading orders:",t),d.value=[]}finally{_.value=!1}},L=async()=>{await F(),await f()},q=async(t,o)=>{const s=await N.get(x.reservationsCollection,t),r=s?.reservations?.find(u=>u.id===o);if(r){const u=y.value.find(g=>g.id===r.resourceId),a={customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:r.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:s.id,res_id:r.id,resourceId:r.resourceId,spots:r.spots,date:r.date,createdAt:s.createdAt,startTime:r.timeslot?.startTime,endTime:r.timeslot?.endTime,reservationPrice:r.totalPrice,reservationBasePrice:r.basePrice,reservationAddOnsPrice:r.addOnsPrice,pricingOptionId:r.pricingOptionId,pricingOption:r.pricingOption,resourceName:u?.name||"Unknown",resourceColor:u?.color};await e.nextTick(),D.value?.openDialog(a)}};return L(),e.onMounted(async()=>{const t=S.value.orderId||C.query.orderId,o=S.value.reservationId||C.query.reservationId;if(t){const s=new URL(window.location.href);s.searchParams.delete("orderId"),s.searchParams.delete("reservationId"),window.history.replaceState(window.history.state,"",s.toString()),await q(t,o)}}),e.watch(c,()=>{f()}),(t,o)=>{const s=e.resolveComponent("Badge"),r=e.resolveComponent("CardTitle"),u=e.resolveComponent("CardDescription"),a=e.resolveComponent("Button"),g=e.resolveComponent("CardHeader"),l=e.resolveComponent("Input"),k=e.resolveComponent("CardContent"),V=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(M._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createElementVNode("div",$,[e.createElementVNode("div",null,[e.createElementVNode("h1",Y,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-6"}),o[1]||(o[1]=e.createTextVNode(" Orders ",-1))]),o[2]||(o[2]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," View orders by when they were placed ",-1))])]),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createElementVNode("div",null,[e.createVNode(r,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[o[3]||(o[3]=e.createTextVNode(" Orders received ",-1)),e.unref(h).bookings>0?(e.openBlock(),e.createBlock(s,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{class:"flex items-center gap-4 mt-1"},{default:e.withCtx(()=>[e.createElementVNode("span",Q,[e.createVNode(e.unref(i.Users),{size:14}),e.createTextVNode(" "+e.toDisplayString(e.unref(h).spots)+" spots ",1)]),e.createElementVNode("span",X," €"+e.toDisplayString(e.unref(h).revenue.toFixed(2))+" revenue ",1)]),_:1})]),e.createElementVNode("div",G,[e.createElementVNode("div",J,[e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:P},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronLeft),{size:16})]),_:1}),e.createVNode(a,{variant:"ghost",size:"sm",class:"h-8 px-3 text-xs",onClick:z},{default:e.withCtx(()=>[...o[4]||(o[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:T,disabled:!e.unref(O)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronRight),{size:16})]),_:1},8,["disabled"])]),e.createVNode(a,{variant:"ghost",size:"icon",onClick:f,disabled:e.unref(_)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(_)})},null,8,["class"])]),_:1},8,["disabled"])])]),e.createElementVNode("div",W,e.toDisplayString(e.unref(I)),1)]),_:1}),e.createVNode(k,null,{default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(e.unref(i.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(l,{modelValue:e.unref(m),"onUpdate:modelValue":o[0]||(o[0]=n=>e.isRef(m)?m.value=n:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(m)?(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:j},{default:e.withCtx(()=>[e.createVNode(e.unref(i.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.unref(m)?(e.openBlock(),e.createElementBlock("div",ee," Showing "+e.toDisplayString(e.unref(w).length)+" of "+e.toDisplayString(e.unref(d).length)+" orders ",1)):e.createCommentVNode("",!0),e.unref(_)?(e.openBlock(),e.createElementBlock("div",te,[...o[5]||(o[5]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(d).length===0?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-12 mx-auto mb-3 opacity-50"}),o[6]||(o[6]=e.createElementVNode("p",null,"No orders received on this day",-1))])):e.unref(w).length===0?(e.openBlock(),e.createElementBlock("div",ne," No orders match your search ")):(e.openBlock(),e.createElementBlock("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),n=>(e.openBlock(),e.createElementBlock("div",{key:n.res_id||n.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:Ve=>e.unref(D)?.openDialog(n)},[e.createElementVNode("div",ae,[e.createElementVNode("div",le,[e.createElementVNode("div",ce,e.toDisplayString(n.customerInfo?.firstName)+" "+e.toDisplayString(n.customerInfo?.lastName||"Unknown Customer"),1),e.createElementVNode("div",ie,e.toDisplayString(n.customerInfo?.email),1),e.createElementVNode("div",de,e.toDisplayString(n.customerInfo?.phone),1),e.createElementVNode("div",ue,[e.createElementVNode("div",me,[e.createVNode(e.unref(i.Calendar),{size:12}),e.createElementVNode("span",null,e.toDisplayString(U(n.date))+" · "+e.toDisplayString(n.startTime)+" - "+e.toDisplayString(n.endTime),1)]),e.createElementVNode("div",pe,[e.createVNode(e.unref(i.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(n.spots)+" spots",1)]),n.resourceName?(e.openBlock(),e.createElementBlock("div",fe,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:n.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(n.resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ge,[e.createVNode(e.unref(i.Clock),{size:12}),e.createElementVNode("span",null,"Ordered at "+e.toDisplayString(R(n.createdAt)),1)])]),e.createElementVNode("div",ve,[n.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",_e,"Needs Approval")):n.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",xe,"Approved")):n.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",ye,"Rejected")):n.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",he,"Cancelled")):(e.openBlock(),e.createElementBlock("span",ke,"Pending")),n.reservationPrice||n.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",Ne," €"+e.toDisplayString(n.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,re))),128))]))]),_:1})]),_:1})])]),_:1}),e.createVNode(E._sfc_main,{ref_key:"reservationDetailDialog",ref:D,onCancelled:f,onConfirmed:f,onRejected:f},null,512)],64)}}});exports.default=De;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("@oneclick.dev/cms-kit"),i=require("lucide-vue-next"),E=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-COfCOMsz.js"),M=require("./EditLayout.vue_vue_type_script_setup_true_lang-ozYrxb2g.js"),H={class:"space-y-6"},$={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Y={class:"text-2xl font-semibold tracking-tight flex items-center gap-2"},K={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Q={class:"flex items-center gap-1"},X={class:"flex items-center gap-1"},G={class:"flex items-center gap-2"},J={class:"flex items-center gap-1"},W={class:"text-sm text-muted-foreground mt-2"},Z={class:"relative mb-4"},ee={key:0,class:"mb-3 text-sm text-muted-foreground"},te={key:1,class:"flex items-center justify-center py-8"},oe={key:2,class:"text-center py-8 text-muted-foreground"},ne={key:3,class:"text-center py-8 text-muted-foreground"},se={key:4,class:"space-y-2"},re=["onClick"],ae={class:"flex items-start justify-between"},le={class:"flex-1"},ce={class:"font-medium"},ie={class:"text-sm text-muted-foreground"},de={class:"text-sm text-muted-foreground"},ue={class:"flex items-center gap-4 flex-wrap mt-1"},me={class:"flex items-center gap-2 text-xs text-muted-foreground"},pe={class:"flex items-center gap-2 text-xs text-muted-foreground"},fe={key:0,class:"flex items-center gap-1 text-xs text-muted-foreground"},ge={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},ve={class:"text-right"},_e={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"},xe={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"},ye={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"},he={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"},ke={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"},Ne={key:5,class:"text-sm font-medium mt-1"},De=e.defineComponent({__name:"orders",setup(we){const C=v.useRoute();v.useRouter();const S=v.useOverlayParams(),{params:b}=v.useModuleRoute(),{config:x}=v.useModule(),N=v.useFirebaseIntegration(x.project),d=e.ref([]),y=e.ref([]),_=e.ref(!0),m=e.ref(""),D=e.ref(null),p=new Date,c=e.ref(new Date),B=e.computed(()=>({date:A(c.value),resource:null}));e.provide("event",B);const I=e.computed(()=>{const t=new Date(p);t.setDate(p.getDate()-1);const o=new Date(p);return o.setDate(p.getDate()+1),c.value.toDateString()===p.toDateString()?"Today":c.value.toDateString()===t.toDateString()?"Yesterday":c.value.toDateString()===o.toDateString()?"Tomorrow":c.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),P=()=>{const t=new Date(c.value);t.setDate(t.getDate()-1),c.value=t},T=()=>{const t=new Date(c.value);t.setDate(t.getDate()+1),t<=p&&(c.value=t)},O=e.computed(()=>{const t=new Date(c.value);return t.setDate(t.getDate()+1),t<=p}),z=()=>{c.value=new Date},A=t=>{const o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${o}-${s}-${r}`},R=t=>t?new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):"",U=t=>t?new Date(t).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):"",w=e.computed(()=>m.value.trim()?new E.Fuse(d.value,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(m.value).map(o=>o.item):d.value),h=e.computed(()=>({spots:d.value.reduce((t,o)=>t+(o.spots||0),0),bookings:d.value.length,revenue:d.value.reduce((t,o)=>t+(o.reservationPrice||0),0)})),j=()=>{m.value=""},F=async()=>{try{const t=b.value.id,o=await N.get(x.agendaCollection,t);y.value=o?.resources?.filter(s=>s.isActive)||[]}catch(t){console.error("Error loading resources:",t),y.value=[]}},f=async()=>{_.value=!0,d.value=[];try{const t=b.value.id,o=new Date(c.value);o.setHours(0,0,0,0);const s=new Date(c.value);s.setHours(23,59,59,999);const r=await N.find(x.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:t},{field:"createdAt",operator:">=",value:o.toISOString()},{field:"createdAt",operator:"<=",value:s.toISOString()}]});let u=[];r.forEach(a=>{(a.reservations||[]).forEach(l=>{const k=y.value.find(V=>V.id===l.resourceId);u.push({customerInfo:a.customerInfo,amountDue:a.amountDue,amountPaid:a.amountPaid,status:a.status,reservationStatus:l.status,subtotal:a.subtotal,total:a.total,discount:a.discount,id:a.id,res_id:l.id,resourceId:l.resourceId,spots:l.spots,date:l.date,createdAt:a.createdAt,startTime:l.timeslot?.startTime,endTime:l.timeslot?.endTime,reservationPrice:l.totalPrice,reservationBasePrice:l.basePrice,reservationAddOnsPrice:l.addOnsPrice,pricingOptionId:l.pricingOptionId,pricingOption:l.pricingOption,resourceName:k?.name||"Unknown",resourceColor:k?.color})})}),d.value=u.sort((a,g)=>(g.createdAt||"").localeCompare(a.createdAt||""))}catch(t){console.error("Error loading orders:",t),d.value=[]}finally{_.value=!1}},L=async()=>{await F(),await f()},q=async(t,o)=>{const s=await N.get(x.reservationsCollection,t),r=s?.reservations?.find(u=>u.id===o);if(r){const u=y.value.find(g=>g.id===r.resourceId),a={customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:r.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:s.id,res_id:r.id,resourceId:r.resourceId,spots:r.spots,date:r.date,createdAt:s.createdAt,startTime:r.timeslot?.startTime,endTime:r.timeslot?.endTime,reservationPrice:r.totalPrice,reservationBasePrice:r.basePrice,reservationAddOnsPrice:r.addOnsPrice,pricingOptionId:r.pricingOptionId,pricingOption:r.pricingOption,resourceName:u?.name||"Unknown",resourceColor:u?.color};await e.nextTick(),D.value?.openDialog(a)}};return L(),e.onMounted(async()=>{const t=S.value.orderId||C.query.orderId,o=S.value.reservationId||C.query.reservationId;if(t){const s=new URL(window.location.href);s.searchParams.delete("orderId"),s.searchParams.delete("reservationId"),window.history.replaceState(window.history.state,"",s.toString()),await q(t,o)}}),e.watch(c,()=>{f()}),(t,o)=>{const s=e.resolveComponent("Badge"),r=e.resolveComponent("CardTitle"),u=e.resolveComponent("CardDescription"),a=e.resolveComponent("Button"),g=e.resolveComponent("CardHeader"),l=e.resolveComponent("Input"),k=e.resolveComponent("CardContent"),V=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(M._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createElementVNode("div",$,[e.createElementVNode("div",null,[e.createElementVNode("h1",Y,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-6"}),o[1]||(o[1]=e.createTextVNode(" Orders ",-1))]),o[2]||(o[2]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," View orders by when they were placed ",-1))])]),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createElementVNode("div",null,[e.createVNode(r,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[o[3]||(o[3]=e.createTextVNode(" Orders received ",-1)),e.unref(h).bookings>0?(e.openBlock(),e.createBlock(s,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{class:"flex items-center gap-4 mt-1"},{default:e.withCtx(()=>[e.createElementVNode("span",Q,[e.createVNode(e.unref(i.Users),{size:14}),e.createTextVNode(" "+e.toDisplayString(e.unref(h).spots)+" spots ",1)]),e.createElementVNode("span",X," €"+e.toDisplayString(e.unref(h).revenue.toFixed(2))+" revenue ",1)]),_:1})]),e.createElementVNode("div",G,[e.createElementVNode("div",J,[e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:P},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronLeft),{size:16})]),_:1}),e.createVNode(a,{variant:"ghost",size:"sm",class:"h-8 px-3 text-xs",onClick:z},{default:e.withCtx(()=>[...o[4]||(o[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:T,disabled:!e.unref(O)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronRight),{size:16})]),_:1},8,["disabled"])]),e.createVNode(a,{variant:"ghost",size:"icon",onClick:f,disabled:e.unref(_)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(_)})},null,8,["class"])]),_:1},8,["disabled"])])]),e.createElementVNode("div",W,e.toDisplayString(e.unref(I)),1)]),_:1}),e.createVNode(k,null,{default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(e.unref(i.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(l,{modelValue:e.unref(m),"onUpdate:modelValue":o[0]||(o[0]=n=>e.isRef(m)?m.value=n:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(m)?(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:j},{default:e.withCtx(()=>[e.createVNode(e.unref(i.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.unref(m)?(e.openBlock(),e.createElementBlock("div",ee," Showing "+e.toDisplayString(e.unref(w).length)+" of "+e.toDisplayString(e.unref(d).length)+" orders ",1)):e.createCommentVNode("",!0),e.unref(_)?(e.openBlock(),e.createElementBlock("div",te,[...o[5]||(o[5]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(d).length===0?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-12 mx-auto mb-3 opacity-50"}),o[6]||(o[6]=e.createElementVNode("p",null,"No orders received on this day",-1))])):e.unref(w).length===0?(e.openBlock(),e.createElementBlock("div",ne," No orders match your search ")):(e.openBlock(),e.createElementBlock("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),n=>(e.openBlock(),e.createElementBlock("div",{key:n.res_id||n.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:Ve=>e.unref(D)?.openDialog(n)},[e.createElementVNode("div",ae,[e.createElementVNode("div",le,[e.createElementVNode("div",ce,e.toDisplayString(n.customerInfo?.firstName)+" "+e.toDisplayString(n.customerInfo?.lastName||"Unknown Customer"),1),e.createElementVNode("div",ie,e.toDisplayString(n.customerInfo?.email),1),e.createElementVNode("div",de,e.toDisplayString(n.customerInfo?.phone),1),e.createElementVNode("div",ue,[e.createElementVNode("div",me,[e.createVNode(e.unref(i.Calendar),{size:12}),e.createElementVNode("span",null,e.toDisplayString(U(n.date))+" · "+e.toDisplayString(n.startTime)+" - "+e.toDisplayString(n.endTime),1)]),e.createElementVNode("div",pe,[e.createVNode(e.unref(i.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(n.spots)+" spots",1)]),n.resourceName?(e.openBlock(),e.createElementBlock("div",fe,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:n.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(n.resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ge,[e.createVNode(e.unref(i.Clock),{size:12}),e.createElementVNode("span",null,"Ordered at "+e.toDisplayString(R(n.createdAt)),1)])]),e.createElementVNode("div",ve,[n.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",_e,"Needs Approval")):n.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",xe,"Approved")):n.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",ye,"Rejected")):n.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",he,"Cancelled")):(e.openBlock(),e.createElementBlock("span",ke,"Pending")),n.reservationPrice||n.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",Ne," €"+e.toDisplayString(n.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,re))),128))]))]),_:1})]),_:1})])]),_:1}),e.createVNode(E._sfc_main,{ref_key:"reservationDetailDialog",ref:D,onCancelled:f,onConfirmed:f,onRejected:f},null,512)],64)}}});exports.default=De;
@@ -1,4 +1,5 @@
1
1
  type Framework = 'vue' | 'svelte' | 'react' | 'angular';
2
2
  type DbProvider = 'firebase' | 'supabase';
3
- declare const _default: Record<Framework, Record<DbProvider, string>>;
3
+ type CodeSection = 'setup' | 'page';
4
+ declare const _default: Record<Framework, Record<DbProvider, Record<CodeSection, string>>>;
4
5
  export default _default;
@@ -3,7 +3,7 @@ declare const _default: import('vue').DefineComponent<{}, {
3
3
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
4
4
  dragContainer: unknown;
5
5
  mobileActionDrawer: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {
6
- onRowClick: (e: MouseEvent) => void;
6
+ onRowClick: (e: MouseEvent, rowOriginal?: any, force?: boolean) => void;
7
7
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
8
8
  P: {};
9
9
  B: {};
@@ -12,7 +12,7 @@ declare const _default: import('vue').DefineComponent<{}, {
12
12
  M: {};
13
13
  Defaults: {};
14
14
  }, Readonly<{}> & Readonly<{}>, {
15
- onRowClick: (e: MouseEvent) => void;
15
+ onRowClick: (e: MouseEvent, rowOriginal?: any, force?: boolean) => void;
16
16
  }, {}, {}, {}, {}> | null;
17
17
  }, any>;
18
18
  export default _default;
@@ -1,4 +1,4 @@
1
1
  declare const _default: import('vue').DefineComponent<{}, {
2
- onRowClick: (e: MouseEvent) => void;
2
+ onRowClick: (e: MouseEvent, rowOriginal?: any, force?: boolean) => void;
3
3
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
4
  export default _default;
@@ -17,7 +17,7 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
17
17
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
18
18
  dragContainer: unknown;
19
19
  mobileActionDrawer: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {
20
- onRowClick: (e: MouseEvent) => void;
20
+ onRowClick: (e: MouseEvent, rowOriginal?: any, force?: boolean) => void;
21
21
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
22
22
  P: {};
23
23
  B: {};
@@ -26,7 +26,7 @@ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropType
26
26
  M: {};
27
27
  Defaults: {};
28
28
  }, Readonly<{}> & Readonly<{}>, {
29
- onRowClick: (e: MouseEvent) => void;
29
+ onRowClick: (e: MouseEvent, rowOriginal?: any, force?: boolean) => void;
30
30
  }, {}, {}, {}, {}> | null;
31
31
  }, any, import('vue').ComponentProvideOptions, {
32
32
  P: {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneclick.dev/cms-core-modules",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
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.109",
31
+ "@oneclick.dev/cms-kit": "0.0.111",
32
32
  "@tanstack/vue-table": "^8.21.3",
33
33
  "@vee-validate/zod": "^4.15.0",
34
34
  "@vue-flow/core": "^1.48.1",