@oneclick.dev/cms-core-modules 0.0.59 → 0.0.60
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/{Components-D9yIIosM.mjs → Components-C83O-xlF.mjs} +1 -1
- package/dist/{ContentEditor-DCmt_y_R.js → ContentEditor-BAepN3Yd.js} +51 -34
- package/dist/{ContentEditor-CtGeIzC4.mjs → ContentEditor-BPjWW3d1.mjs} +12341 -10099
- package/dist/Create-Bh4g6QW4.js +1 -0
- package/dist/{Create-Bwf1RXdG.mjs → Create-Cf7pvh5G.mjs} +38 -39
- package/dist/DateFormatter-BPPBZp1j.js +1 -0
- package/dist/{CalendarDate-CRT2Viyt.mjs → DateFormatter-DsmlAuYV.mjs} +353 -256
- package/dist/{Detail-CpfOQChd.mjs → Detail-B4b_FLDa.mjs} +2 -2
- package/dist/{Detail-B-PnkcXD.mjs → Detail-BGD75ul4.mjs} +2 -2
- package/dist/{Detail-Dd_OkpcN.js → Detail-BayNaAg9.js} +1 -1
- package/dist/{Detail-C4E1T87K.mjs → Detail-Byk781b4.mjs} +3 -3
- package/dist/{Detail-Cd5CBVN0.js → Detail-CnK-qbhE.js} +1 -1
- package/dist/Detail-CtbWzq-R.js +1 -0
- package/dist/{Detail-CNfTDUE5.js → Detail-Cxd2VMOl.js} +1 -1
- package/dist/{Detail-BVlGSjOq.mjs → Detail-D10shmpK.mjs} +6 -7
- package/dist/{Detail-CwagT6gQ.mjs → Detail-U0mgLKt6.mjs} +2 -2
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-CcysXzmW.mjs +75 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js +1 -0
- package/dist/{Entries-zyhycw1M.mjs → Entries-C6Di46My.mjs} +1 -1
- package/dist/{Find-BPR0uU-Z.mjs → Find-B4sAEx0B.mjs} +2 -2
- package/dist/{Find-BidEQJxT.js → Find-Ds6OvuH6.js} +1 -1
- package/dist/{GlobalStyling-BLQ_1W2y.mjs → GlobalStyling-C9VthHWK.mjs} +1 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BJitmbPE.mjs +396 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-D50uTpZY.js +1 -0
- package/dist/Overview-B-8TLLjh.js +1 -0
- package/dist/{Overview-CDN88OSM.mjs → Overview-BCpJNiEB.mjs} +1 -1
- package/dist/Overview-B_99j5eA.js +1 -0
- package/dist/{Overview-BLsZMHNW.mjs → Overview-CIa1E-HH.mjs} +1 -1
- package/dist/{Overview-D1nJLBe1.mjs → Overview-CgViRnNc.mjs} +1 -1
- package/dist/Overview-DtWvKB3W.mjs +327 -0
- package/dist/Overview-HvlDEgqi.mjs +862 -0
- package/dist/{Overview-BH3NwvNX.mjs → Overview-Su8ZUbMs.mjs} +3 -3
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CI8YgHdU.js +345 -0
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-P-MWwcVh.mjs +2093 -0
- package/dist/{TableView-CS13LLxk.mjs → TableView-B8iLWWcP.mjs} +48394 -36321
- package/dist/TableView-BxK6R8v3.js +312 -0
- package/dist/{TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs → TemplateList.vue_vue_type_script_setup_true_lang-Cmovy7kk.mjs} +5 -5
- package/dist/{View-C7axVP9t.mjs → View-DDXN0tKD.mjs} +7 -7
- package/dist/View-DfzaVOzS.js +1 -0
- package/dist/agenda-D81m29_4.mjs +1135 -0
- package/dist/agenda-uzPPxgsW.js +1 -0
- package/dist/availability-B-tRp8hB.mjs +629 -0
- package/dist/availability-BiBbzEIM.js +1 -0
- package/dist/{exceptions-D3b18TiY.mjs → exceptions-BFchkR06.mjs} +70 -71
- package/dist/exceptions-C-DPRNQa.js +1 -0
- package/dist/index-4tjmIans.js +1 -0
- package/dist/index-AmUV8LZQ.mjs +176 -0
- package/dist/index-BDaVYdkD.mjs +7763 -0
- package/dist/{index-DT1wWnUk.mjs → index-BWDwEd8D.mjs} +1 -1
- package/dist/{index-CImCyE3L.mjs → index-BfBBm9uY.mjs} +1 -1
- package/dist/{index-DMoyoaks.mjs → index-Bkq58CeQ.mjs} +2 -2
- package/dist/{index-DI6mydpm.mjs → index-CABh6Qn6.mjs} +2 -2
- package/dist/{index-CQiY-oTN.mjs → index-CQkOH2_3.mjs} +1 -1
- package/dist/{index-Bwi1mtkq.mjs → index-CU-tbS5W.mjs} +1 -1
- package/dist/{index-BzuHN-r8.mjs → index-Cpnn_Pxd.mjs} +1 -1
- package/dist/index-CxETuRsG.js +1 -0
- package/dist/{index-DyCHxFp3.mjs → index-DRqJOqUR.mjs} +502 -449
- package/dist/index-DTago6vW-Bhr8E1Y6.js +88 -0
- package/dist/index-DTago6vW-CnomHQ_S.mjs +4123 -0
- package/dist/index-DfV8-6ON.js +245 -0
- package/dist/index-Dnn2SCSl.js +1 -0
- package/dist/{index-BEGU8Kme.mjs → index-Dpl9sU6a.mjs} +2 -2
- package/dist/index-Uf7TwBuW.mjs +110 -0
- package/dist/index-YMaY4uuk-BgpTtr73.js +1 -0
- package/dist/{index-CKPshlZ8-BQiiP6r_.mjs → index-YMaY4uuk-C_xV5K9Z.mjs} +399 -363
- package/dist/{index--jjEzba7.mjs → index-cOnxXTbF.mjs} +1 -1
- package/dist/index-hlylYYgy.mjs +24 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +98 -81
- package/dist/orders-Bh8w0ueq.mjs +346 -0
- package/dist/orders-Dt0zMz97.js +1 -0
- package/dist/payment-BQaAqQ5q.js +1 -0
- package/dist/payment-BbWByERf.mjs +1080 -0
- package/dist/regular-1LXNPviB.js +1 -0
- package/dist/regular-_05oq5Tx.mjs +1101 -0
- package/dist/regular-slots-Bs3WJB3U.js +1 -0
- package/dist/regular-slots-C2NYxLPn.mjs +222 -0
- package/dist/resources-DgPnEv76.mjs +811 -0
- package/dist/resources-eb0pivDL.js +1 -0
- package/dist/src/appointments/components/edit/EditLayout.vue.d.ts +2 -2
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +92 -0
- package/dist/src/appointments/components/edit/EventDialog/CancelReservationDialog.vue.d.ts +8 -0
- package/dist/src/appointments/components/edit/EventDialog/EventDialog.vue.d.ts +10 -0
- package/dist/src/appointments/components/edit/{EventDialog.vue.d.ts → EventDialog/ResendConfirmationDialog.vue.d.ts} +1 -1
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +51 -0
- package/dist/src/appointments/components/edit/EventDialog/TimelineChart.vue.d.ts +24 -0
- package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +4 -0
- package/dist/src/appointments/components/edit/EventTimeline.vue.d.ts +15 -7
- package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +2 -0
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +68 -0
- package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +15 -0
- package/dist/src/appointments/components/edit/dashboard/timeline/ResourceSelector.vue.d.ts +50 -0
- package/dist/src/appointments/config.d.ts +30 -0
- package/dist/src/appointments/index.d.ts +32 -5
- package/dist/src/appointments/pages/edit/agenda.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/availability.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/index.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +64 -0
- package/dist/src/appointments/pages/edit/payment.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/regular-slots.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/resources.vue.d.ts +1 -1
- package/dist/src/appointments/routes.d.ts +2 -5
- package/dist/src/appointments/types.d.ts +16 -0
- package/dist/src/appointments/utils/printReservation.d.ts +45 -0
- package/dist/src/content-manager/components/content-editor/ContentStructuredContentSections.vue.d.ts +4 -0
- package/dist/src/content-manager/components/content-editor/PageSettings.vue.d.ts +2 -0
- package/dist/src/content-manager/components/content-editor/SidebarSectionWrapper.vue.d.ts +11 -1
- package/dist/src/content-manager/types.d.ts +5 -0
- package/dist/{vee-validate-zod-BPQyEfpF.js → vee-validate-zod-ByykgYKJ.js} +1 -1
- package/dist/{vee-validate-zod-IXkfh-6Q.mjs → vee-validate-zod-CcOwoF6y.mjs} +4 -4
- package/package.json +4 -2
- package/dist/CalendarDate-CWtpXgpD.js +0 -1
- package/dist/Create-BP8TX6rj.js +0 -1
- package/dist/DateFormatter-BbcSwTs4.js +0 -1
- package/dist/DateFormatter-CbO0PVUK.mjs +0 -99
- package/dist/Detail-DUo6qKqO.js +0 -1
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +0 -1
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +0 -55
- package/dist/Overview-BNMZ9MUK.js +0 -1
- package/dist/Overview-CEPodGCn.mjs +0 -311
- package/dist/Overview-CvquDPhB.js +0 -1
- package/dist/Overview-D67UjG6n.mjs +0 -947
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +0 -1
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +0 -392
- package/dist/TableView-Dv4YXBD1.js +0 -111
- package/dist/View-7qb_ohVo.js +0 -1
- package/dist/agenda-B49oKGeh.mjs +0 -706
- package/dist/agenda-DipQ5IWP.js +0 -1
- package/dist/availability-C7q9tq6l.js +0 -1
- package/dist/availability-DeCkqiu8.mjs +0 -613
- package/dist/exceptions-DJ9zWX3k.js +0 -1
- package/dist/index-CKPshlZ8-CIz1tDwX.js +0 -1
- package/dist/index-DUeFrD-B.js +0 -1
- package/dist/index-DsnoK4ia.mjs +0 -579
- package/dist/index-WL1P6d3j.js +0 -1
- package/dist/index-_mG-aU3Z.mjs +0 -87
- package/dist/index-_sQDF1pH.js +0 -1
- package/dist/index-klI238nT.mjs +0 -24
- package/dist/payment-kTjsV0Jj.js +0 -1
- package/dist/payment-zpCM0LD-.mjs +0 -981
- package/dist/regular-C4_3YXqx.mjs +0 -602
- package/dist/regular-DFwPEbZO.js +0 -1
- package/dist/regular-slots-4ooEpICB.mjs +0 -67
- package/dist/regular-slots-BAVGbomI.js +0 -1
- package/dist/resources-MpQkSstv.mjs +0 -563
- package/dist/resources-iM28T3dD.js +0 -1
- package/dist/src/appointments/components/edit/RegularSlotEditor.vue.d.ts +0 -16
package/dist/Create-BP8TX6rj.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("lucide-vue-next"),w=require("@oneclick.dev/cms-kit"),h=require("./utils-D6CaKJbp.js"),M=require("./CalendarDate-CWtpXgpD.js"),I=require("./DateFormatter-BbcSwTs4.js"),T=require("./index-ijdf0d9-.js"),L=e.defineComponent({__name:"SingleCode",setup(b){const n=e.inject("newCoupon");return(_,a)=>{const s=e.resolveComponent("Label"),i=e.resolveComponent("Input");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(s,{class:"text-muted-foreground mb-2",for:"code"},{default:e.withCtx(()=>[...a[1]||(a[1]=[e.createTextVNode("Enter the coupon code",-1)])]),_:1}),e.createVNode(i,{modelValue:e.unref(n).code,"onUpdate:modelValue":a[0]||(a[0]=o=>e.unref(n).code=o),id:"code"},null,8,["modelValue"])],64)}}}),z={class:"flex items-center space-x-2"},O={class:"flex items-center space-x-2"},j={key:0,class:"flex items-end w-full gap-4"},G={class:"relative w-full"},R={key:1},q=e.defineComponent({__name:"MultiCodes",setup(b){const n=e.inject("newCoupon");return(_,a)=>{const s=e.resolveComponent("RadioGroupItem"),i=e.resolveComponent("Label"),o=e.resolveComponent("RadioGroup"),m=e.resolveComponent("NumberFieldDecrement"),g=e.resolveComponent("NumberFieldInput"),u=e.resolveComponent("NumberFieldIncrement"),l=e.resolveComponent("NumberFieldContent"),p=e.resolveComponent("NumberField"),V=e.resolveComponent("Input"),r=e.resolveComponent("Textarea");return e.openBlock(),e.createElementBlock(e.Fragment,null,[a[8]||(a[8]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-2"},"How do you want to create the codes?",-1)),e.createVNode(o,{modelValue:e.unref(n).generationMode,"onUpdate:modelValue":a[0]||(a[0]=N=>e.unref(n).generationMode=N),orientation:"vertical",class:"mb-6"},{default:e.withCtx(()=>[e.createElementVNode("div",z,[e.createVNode(s,{id:"generation_mode_generate",value:"generate"}),e.createVNode(i,{for:"generation_mode_generate"},{default:e.withCtx(()=>[...a[3]||(a[3]=[e.createTextVNode("Generate random codes",-1)])]),_:1})]),e.createElementVNode("div",O,[e.createVNode(s,{id:"generation_mode_input",value:"input"}),e.createVNode(i,{for:"generation_mode_input"},{default:e.withCtx(()=>[...a[4]||(a[4]=[e.createTextVNode("Provide specific codes",-1)])]),_:1})])]),_:1},8,["modelValue"]),e.unref(n).generationMode=="generate"?(e.openBlock(),e.createElementBlock("div",j,[e.createVNode(p,{id:"age","default-value":1,min:1,class:"w-full"},{default:e.withCtx(()=>[e.createVNode(i,{for:"age",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...a[5]||(a[5]=[e.createTextVNode("Number of codes to generate",-1)])]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(m),e.createVNode(g),e.createVNode(u)]),_:1})]),_:1}),e.createElementVNode("div",G,[e.createVNode(V,{modelValue:e.unref(n).prefix,"onUpdate:modelValue":a[1]||(a[1]=N=>e.unref(n).prefix=N),placeholder:"Prefix",class:"pr-42"},null,8,["modelValue"]),a[6]||(a[6]=e.createElementVNode("span",{class:"absolute right-2 top-1/2 transform -translate-y-1/2 text-muted-foreground/80 pointer-events-none"},"- GENERATED CODE",-1))])])):(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(i,{class:"text-muted-foreground mb-2",for:"codes"},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode("Enter the codes you want to create (one per line)",-1)])]),_:1}),e.createVNode(r,{modelValue:e.unref(n).codes,"onUpdate:modelValue":a[2]||(a[2]=N=>e.unref(n).codes=N),id:"codes",class:"max-h-48"},null,8,["modelValue"])]))],64)}}}),J={class:"grid gap-6 py-4"},H={class:"flex items-center"},Y={class:"flex items-center gap-2"},K={class:"flex items-center gap-2"},W={class:"flex items-center gap-2"},Q={class:"flex items-center gap-2"},X={class:"flex items-center space-x-2 mb-2"},Z={key:0,class:"text-xs text-blue-600 bg-blue-500/10 p-2 rounded border border-blue-500 mt-1 flex items-start gap-1"},ee={class:"flex items-center space-x-2 mb-2"},te=e.defineComponent({__name:"TypeDetailDialog",setup(b,{expose:n}){const{isAdmin:_}=w.useModulePermissions(),{getModuleData:a,setModuleData:s}=w.useModuleStorage(),i=e.inject("promoTypes",e.ref([])),o=e.ref({id:"",label:"",key:"",allowUnlimitedUses:!1,hasValueField:!1,valueLabel:"",valuePrefix:"",valueSuffix:""}),m=e.ref(!1),g=e.ref("add"),u=e.ref(!1),l=f=>{m.value=!0,u.value=!1,f?(g.value="edit",o.value=JSON.parse(JSON.stringify(f))):(g.value="add",o.value={id:crypto.randomUUID(),label:"",key:"",allowUnlimitedUses:!1,hasValueField:!1,valueLabel:"",valuePrefix:"",valueSuffix:""})},p=f=>{m.value=!0,u.value=!1,g.value="add",N(f)},V=async()=>{u.value=!0;let f=await a("promo-types")||[];f.push(JSON.parse(JSON.stringify(o.value))),s("promo-types",f),i.value=JSON.parse(JSON.stringify(f)),m.value=!1},r=async()=>{u.value=!0;let f=await a("promo-types")||[];f=f.map(t=>t.id===o.value.id?o.value:t),s("promo-types",f),i.value=JSON.parse(JSON.stringify(f)),m.value=!1},N=f=>{switch(f){case"fixed":o.value={id:crypto.randomUUID(),label:"Fixed Amount",key:"fixed",allowUnlimitedUses:!1,hasValueField:!0,valueLabel:"Amount",valuePrefix:"$",valueSuffix:""};break;case"percentage":o.value={id:crypto.randomUUID(),label:"Percentage",key:"percentage",allowUnlimitedUses:!1,hasValueField:!0,valueLabel:"Percentage",valuePrefix:"",valueSuffix:"%"};break;case"free_shipping":o.value={id:crypto.randomUUID(),label:"Free Shipping",key:"free_shipping",allowUnlimitedUses:!1,hasValueField:!1,valueLabel:"",valuePrefix:"",valueSuffix:""};break}};return n({open:l,openFromTemplate:p}),(f,t)=>{const x=e.resolveComponent("DialogTitle"),c=e.resolveComponent("DialogHeader"),k=e.resolveComponent("Button"),U=e.resolveComponent("DropdownMenuTrigger"),y=e.resolveComponent("DropdownMenuItem"),E=e.resolveComponent("DropdownMenuContent"),S=e.resolveComponent("DropdownMenu"),C=e.resolveComponent("Label"),D=e.resolveComponent("Input"),B=e.resolveComponent("Switch"),$=e.resolveComponent("DialogFooter"),P=e.resolveComponent("DialogScrollContent"),F=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(F,{open:m.value,"onUpdate:open":t[11]||(t[11]=d=>m.value=d)},{default:e.withCtx(()=>[e.unref(_)()?(e.openBlock(),e.createBlock(P,{key:0,class:"sm:max-w-[475px]"},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.value==="add"?"Add Promo Type":"Edit Promo Type"),1)]),_:1})]),_:1}),e.createElementVNode("div",J,[e.createElementVNode("div",H,[g.value==="add"?(e.openBlock(),e.createBlock(S,{key:0},{default:e.withCtx(()=>[e.createVNode(U,null,{default:e.withCtx(()=>[e.createVNode(k,{variant:"outline"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.createVNode(e.unref(v.Import),{class:"size-4"}),t[12]||(t[12]=e.createTextVNode(" Load pre-defined type ",-1))])]),_:1})]),_:1}),e.createVNode(E,null,{default:e.withCtx(()=>[e.createVNode(y,{onClick:t[0]||(t[0]=d=>N("fixed"))},{default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createVNode(e.unref(v.DollarSign),{class:"size-4"}),t[13]||(t[13]=e.createTextVNode(" Fixed Amount ",-1))])]),_:1}),e.createVNode(y,{onClick:t[1]||(t[1]=d=>N("percentage"))},{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(e.unref(v.Percent),{class:"size-4"}),t[14]||(t[14]=e.createTextVNode(" Percentage ",-1))])]),_:1}),e.createVNode(y,{onClick:t[2]||(t[2]=d=>N("free_shipping"))},{default:e.withCtx(()=>[e.createElementVNode("div",Q,[e.createVNode(e.unref(v.Truck),{class:"size-4"}),t[15]||(t[15]=e.createTextVNode(" Free Shipping ",-1))])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createVNode(C,{for:"label",class:"mb-2"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("Display Name",-1)])]),_:1}),e.createVNode(D,{modelValue:o.value.label,"onUpdate:modelValue":t[3]||(t[3]=d=>o.value.label=d),id:"label"},null,8,["modelValue"]),t[17]||(t[17]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},'Shown in the Studio UI. e.g. "VIP Shipping"',-1))]),e.createElementVNode("div",null,[e.createVNode(C,{for:"key",class:"mb-2"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Internal Key",-1)])]),_:1}),e.createVNode(D,{modelValue:o.value.key,"onUpdate:modelValue":t[4]||(t[4]=d=>o.value.key=d),id:"key"},null,8,["modelValue"]),t[19]||(t[19]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},[e.createTextVNode("Used in logic. Must be unique, lowercase, no spaces. e.g. "),e.createElementVNode("span",{class:"font-mono bg-muted-foreground/20 px-1 py-0.5 rounded"},"vip_shipping")],-1))]),e.createElementVNode("div",null,[e.createVNode(C,{for:"allowUnlimitedUses",class:"mb-4"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Allow Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",X,[e.createVNode(B,{id:"allowUnlimitedUses",modelValue:o.value.allowUnlimitedUses,"onUpdate:modelValue":t[5]||(t[5]=d=>o.value.allowUnlimitedUses=d)},null,8,["modelValue"]),e.createVNode(C,{for:"allowUnlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.allowUnlimitedUses?"Yes":"No"),1)]),_:1})]),t[22]||(t[22]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},'Show the "Unlimited uses" toggle when creating a promo code.',-1)),o.value.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("p",Z,[e.createVNode(e.unref(v.Info),{class:"size-4"}),t[21]||(t[21]=e.createTextVNode(" This option is always hidden when generating multiple codes. ",-1))])):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createVNode(C,{for:"hasValueField",class:"mb-4"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Has Value Field",-1)])]),_:1}),e.createElementVNode("div",ee,[e.createVNode(B,{id:"hasValueField",modelValue:o.value.hasValueField,"onUpdate:modelValue":t[6]||(t[6]=d=>o.value.hasValueField=d)},null,8,["modelValue"]),e.createVNode(C,{for:"hasValueField"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.hasValueField?"Yes":"No"),1)]),_:1})]),t[24]||(t[24]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},"Show a numeric value input when using this type.",-1))]),e.createElementVNode("div",null,[e.createVNode(C,{for:"valueLabel",class:"mb-2"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode("Value Field Label",-1)])]),_:1}),e.createVNode(D,{modelValue:o.value.valueLabel,"onUpdate:modelValue":t[7]||(t[7]=d=>o.value.valueLabel=d),id:"valueLabel"},null,8,["modelValue"]),t[26]||(t[26]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},'e.g. "Gift amount", "Shipping cost"',-1))]),e.createElementVNode("div",null,[e.createVNode(C,{for:"valuePrefix",class:"mb-2"},{default:e.withCtx(()=>[...t[27]||(t[27]=[e.createTextVNode("Value Field Prefix",-1)])]),_:1}),e.createVNode(D,{modelValue:o.value.valuePrefix,"onUpdate:modelValue":t[8]||(t[8]=d=>o.value.valuePrefix=d),id:"valuePrefix"},null,8,["modelValue"]),t[28]||(t[28]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},"e.g. € or $",-1))]),e.createElementVNode("div",null,[e.createVNode(C,{for:"valueSuffix",class:"mb-2"},{default:e.withCtx(()=>[...t[29]||(t[29]=[e.createTextVNode("Value Field Suffix",-1)])]),_:1}),e.createVNode(D,{modelValue:o.value.valueSuffix,"onUpdate:modelValue":t[9]||(t[9]=d=>o.value.valueSuffix=d),id:"valueSuffix"},null,8,["modelValue"]),t[30]||(t[30]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},"e.g. %, credits",-1))])]),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(k,{variant:"outline",onClick:t[10]||(t[10]=d=>m.value=!1)},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode("Cancel",-1)])]),_:1}),g.value==="add"?(e.openBlock(),e.createBlock(k,{key:0,disabled:u.value,onClick:V},{default:e.withCtx(()=>[u.value?(e.openBlock(),e.createBlock(e.unref(v.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[32]||(t[32]=e.createTextVNode(" Add Type ",-1))]),_:1},8,["disabled"])):(e.openBlock(),e.createBlock(k,{key:1,disabled:u.value,onClick:r},{default:e.withCtx(()=>[u.value?(e.openBlock(),e.createBlock(e.unref(v.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[33]||(t[33]=e.createTextVNode(" Save Changes ",-1))]),_:1},8,["disabled"]))]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["open"])}}}),oe={class:"grid gap-4 py-4"},le={key:0,class:"flex flex-col gap-2 items-center text-muted-foreground border rounded p-4"},ne={class:"flex gap-2 items-center"},ae={key:1},re={class:"flex justify-end w-full mb-2"},se={class:"flex items-center gap-2"},de={class:"flex items-center gap-2"},ie={class:"flex items-center gap-2"},ue={class:"flex items-center gap-2"},ce={class:"flex items-center gap-2"},me={class:"font-mono bg-muted-foreground/20 px-1 py-0.5 rounded"},pe=e.defineComponent({__name:"TypeManageDialog",setup(b){const{isAdmin:n}=w.useModulePermissions(),{getModuleData:_,setModuleData:a}=w.useModuleStorage(),{confirm:s}=w.useConfirmation(),i=e.inject("promoTypes",e.ref([])),o=e.useTemplateRef("typeDetailDialog"),m=async u=>{if(!await s(`Are you sure you want to delete the type "${u.label}"?`))return;let p=await _("promo-types")||[];p=p.filter(V=>V.id!==u.id),a("promo-types",p),i.value=JSON.parse(JSON.stringify(p))},g=async()=>{const u=[{id:crypto.randomUUID(),label:"Fixed Amount",key:"fixed",allowUnlimitedUses:!1,hasValueField:!0,valueLabel:"Amount",valuePrefix:"$",valueSuffix:""},{id:crypto.randomUUID(),label:"Percentage",key:"percentage",allowUnlimitedUses:!1,hasValueField:!0,valueLabel:"Percentage",valuePrefix:"",valueSuffix:"%"},{id:crypto.randomUUID(),label:"Free Shipping",key:"free_shipping",allowUnlimitedUses:!1,hasValueField:!1,valueLabel:"",valuePrefix:"",valueSuffix:""}];a("promo-types",u),i.value=JSON.parse(JSON.stringify(u))};return(u,l)=>{const p=e.resolveComponent("Button"),V=e.resolveComponent("DialogTrigger"),r=e.resolveComponent("DialogTitle"),N=e.resolveComponent("DialogDescription"),f=e.resolveComponent("DialogHeader"),t=e.resolveComponent("DropdownMenuTrigger"),x=e.resolveComponent("DropdownMenuItem"),c=e.resolveComponent("DropdownMenuSeparator"),k=e.resolveComponent("DropdownMenuContent"),U=e.resolveComponent("DropdownMenu"),y=e.resolveComponent("TableHead"),E=e.resolveComponent("TableRow"),S=e.resolveComponent("TableHeader"),C=e.resolveComponent("TableCell"),D=e.resolveComponent("TableBody"),B=e.resolveComponent("Table"),$=e.resolveComponent("DialogFooter"),P=e.resolveComponent("DialogScrollContent"),F=e.resolveComponent("Dialog");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(V,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(e.unref(v.UserCog),{class:"size-4"}),l[6]||(l[6]=e.createTextVNode(" Edit Promo Types ",-1))]),_:1})]),_:1}),e.unref(n)()?(e.openBlock(),e.createBlock(P,{key:0,class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(r,null,{default:e.withCtx(()=>[...l[7]||(l[7]=[e.createTextVNode("Edit Promo Types",-1)])]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[...l[8]||(l[8]=[e.createTextVNode(" Define reusable custom promo types to use in discount codes. You can configure how they behave and what fields are shown. ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",oe,[e.unref(i).length===0?(e.openBlock(),e.createElementBlock("div",le,[l[12]||(l[12]=e.createElementVNode("p",null,"You haven't created any custom types yet.",-1)),e.createElementVNode("p",ne,[e.createVNode(p,{variant:"link",onClick:l[0]||(l[0]=d=>o.value?.open())},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("Create a custom type",-1)])]),_:1}),l[11]||(l[11]=e.createTextVNode(" or ",-1)),e.createVNode(p,{variant:"link",onClick:l[1]||(l[1]=d=>g())},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("Import Default Types",-1)])]),_:1})])])):(e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",re,[e.createVNode(U,null,{default:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[e.createVNode(p,{variant:"outline"},{default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(v.Plus),{class:"size-4"}),l[13]||(l[13]=e.createTextVNode(" Create new Promo Type ",-1))])]),_:1})]),_:1}),e.createVNode(k,null,{default:e.withCtx(()=>[e.createVNode(x,{onClick:l[2]||(l[2]=d=>o.value?.open())},{default:e.withCtx(()=>[e.createElementVNode("div",de,[e.createVNode(e.unref(v.Plus),{class:"size-4"}),l[14]||(l[14]=e.createTextVNode(" New Type ",-1))])]),_:1}),e.createVNode(c),e.createVNode(x,{onClick:l[3]||(l[3]=d=>o.value?.openFromTemplate("fixed"))},{default:e.withCtx(()=>[e.createElementVNode("div",ie,[e.createVNode(e.unref(v.DollarSign),{class:"size-4"}),l[15]||(l[15]=e.createTextVNode(" Fixed Amount ",-1))])]),_:1}),e.createVNode(x,{onClick:l[4]||(l[4]=d=>o.value?.openFromTemplate("percentage"))},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createVNode(e.unref(v.Percent),{class:"size-4"}),l[16]||(l[16]=e.createTextVNode(" Percentage ",-1))])]),_:1}),e.createVNode(x,{onClick:l[5]||(l[5]=d=>o.value?.openFromTemplate("free_shipping"))},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[e.createVNode(e.unref(v.Truck),{class:"size-4"}),l[17]||(l[17]=e.createTextVNode(" Free Shipping ",-1))])]),_:1})]),_:1})]),_:1})]),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(E,null,{default:e.withCtx(()=>[e.createVNode(y,null,{default:e.withCtx(()=>[...l[18]||(l[18]=[e.createTextVNode("Name (label)",-1)])]),_:1}),e.createVNode(y,null,{default:e.withCtx(()=>[...l[19]||(l[19]=[e.createTextVNode("Key",-1)])]),_:1}),e.createVNode(y,null,{default:e.withCtx(()=>[...l[20]||(l[20]=[e.createTextVNode("Value Field",-1)])]),_:1}),e.createVNode(y,null,{default:e.withCtx(()=>[...l[21]||(l[21]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createVNode(y,{class:"text-right"},{default:e.withCtx(()=>[...l[22]||(l[22]=[e.createTextVNode("Actions",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(D,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),d=>(e.openBlock(),e.createBlock(E,{key:d.key},{default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label),1)]),_:2},1024),e.createVNode(C,null,{default:e.withCtx(()=>[e.createElementVNode("span",me,e.toDisplayString(d.key),1)]),_:2},1024),e.createVNode(C,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.hasValueField?"Yes":"No"),1)]),_:2},1024),e.createVNode(C,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.allowUnlimitedUses?"Yes":"No"),1)]),_:2},1024),e.createVNode(C,{class:"text-right"},{default:e.withCtx(()=>[e.createVNode(p,{variant:"ghost",size:"icon",onClick:A=>o.value?.open(d)},{default:e.withCtx(()=>[e.createVNode(e.unref(v.Pencil),{class:"size-4"})]),_:1},8,["onClick"]),e.createVNode(p,{variant:"ghost",size:"icon",onClick:A=>m(d)},{default:e.withCtx(()=>[e.createVNode(e.unref(v.Trash2),{class:"size-4 text-red-500"})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})]))]),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(p,{variant:"outline",disabled:""},{default:e.withCtx(()=>[...l[23]||(l[23]=[e.createTextVNode(" Auto-saved ",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(te,{ref_key:"typeDetailDialog",ref:o},null,512)],64)}}}),fe={class:"flex justify-between items-center"},Ve={class:"grid gap-2"},xe={class:"flex flex-wrap gap-12"},ve={key:0,class:"grid gap-2"},Ne={class:"flex items-center gap-2"},Ce={key:1,class:"grid gap-2"},ge={class:"flex items-center space-x-2"},_e=e.defineComponent({__name:"index",setup(b){const n=e.inject("newCoupon"),_=e.inject("promoTypes",e.ref([])),a=e.computed(()=>_.value.find(i=>i.key===n.value?.type)||null),{isAdmin:s}=w.useModulePermissions();return(i,o)=>{const m=e.resolveComponent("Label"),g=e.resolveComponent("SelectValue"),u=e.resolveComponent("SelectTrigger"),l=e.resolveComponent("SelectItem"),p=e.resolveComponent("SelectGroup"),V=e.resolveComponent("SelectContent"),r=e.resolveComponent("Select"),N=e.resolveComponent("Input"),f=e.resolveComponent("Switch"),t=e.resolveComponent("Card");return e.openBlock(),e.createBlock(t,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",fe,[o[3]||(o[3]=e.createElementVNode("h2",{class:"font-medium"},"Value",-1)),e.unref(s)()?(e.openBlock(),e.createBlock(pe,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ve,[e.createVNode(m,{class:"text-muted-foreground"},{default:e.withCtx(()=>[...o[4]||(o[4]=[e.createTextVNode("Promo Type",-1)])]),_:1}),e.createVNode(r,{modelValue:e.unref(n).type,"onUpdate:modelValue":o[0]||(o[0]=x=>e.unref(n).type=x)},{default:e.withCtx(()=>[e.createVNode(u,{class:"w-[200px]"},{default:e.withCtx(()=>[e.createVNode(g,{placeholder:"Select a promo type"})]),_:1}),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(p,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(_),x=>(e.openBlock(),e.createBlock(l,{key:x.key,value:x.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])]),e.createElementVNode("div",xe,[a.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(m,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",Ne,[a.value?.valuePrefix?(e.openBlock(),e.createBlock(m,{key:0,for:"discountValue",class:"text-lg"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?.valuePrefix),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(N,{modelValue:e.unref(n).value,"onUpdate:modelValue":o[1]||(o[1]=x=>e.unref(n).value=x),id:"discountValue"},null,8,["modelValue"]),a.value?.valueSuffix?(e.openBlock(),e.createBlock(m,{key:1,for:"discountValue",class:"text-lg"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?.valueSuffix),1)]),_:1})):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),a.value?.allowUnlimitedUses&&e.unref(n).creationMode!=="multi"?(e.openBlock(),e.createElementBlock("div",Ce,[e.createVNode(m,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...o[5]||(o[5]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",ge,[e.createVNode(f,{id:"unlimitedUses",modelValue:e.unref(n).unlimitedUses,"onUpdate:modelValue":o[2]||(o[2]=x=>e.unref(n).unlimitedUses=x)},null,8,["modelValue"]),e.createVNode(m,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n).unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)])]),_:1})}}}),we={class:"flex gap-4"},ye={class:"flex flex-col"},ke={key:0,class:"-ml-2"},be={key:1,class:"text-xs text-muted-foreground mt-2"},Te={class:"flex flex-col"},De={key:0,class:"-ml-2"},Ue={key:1,class:"text-xs text-muted-foreground mt-2"},Ee=e.defineComponent({__name:"DateRange",setup(b){const n=e.inject("newCoupon"),_=new I.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"});return(a,s)=>{const i=e.resolveComponent("Label"),o=e.resolveComponent("Button"),m=e.resolveComponent("PopoverTrigger"),g=e.resolveComponent("Calendar"),u=e.resolveComponent("PopoverContent"),l=e.resolveComponent("Popover"),p=e.resolveComponent("Card");return e.openBlock(),e.createBlock(p,{class:"p-4"},{default:e.withCtx(()=>[s[8]||(s[8]=e.createElementVNode("div",null,[e.createElementVNode("h2",{class:"font-medium mb-2"},"Availability"),e.createElementVNode("p",{class:"text-muted-foreground"},"When will this code be available?")],-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[e.createVNode(i,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...s[4]||(s[4]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(m,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(o,{variant:"outline",class:e.normalizeClass(e.unref(h.classNames)("w-[280px] justify-start text-left font-normal",!e.unref(n).startsAt&&"text-muted-foreground"))},{default:e.withCtx(()=>[e.createVNode(e.unref(v.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(n).startsAt?e.unref(_).format(e.unref(n).startsAt.toDate(e.unref(M.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class"])]),_:1}),e.createVNode(u,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(g,{modelValue:e.unref(n).startsAt,"onUpdate:modelValue":s[0]||(s[0]=V=>e.unref(n).startsAt=V),"initial-focus":"",minValue:e.unref(M.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),e.unref(n).startsAt?(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(o,{onClick:s[1]||(s[1]=V=>e.unref(n).startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...s[5]||(s[5]=[e.createTextVNode("Clear",-1)])]),_:1})])):(e.openBlock(),e.createElementBlock("p",be,"Not set - codes will be available immediately"))]),e.createElementVNode("div",Te,[e.createVNode(i,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...s[6]||(s[6]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(m,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(o,{variant:"outline",class:e.normalizeClass(e.unref(h.classNames)("w-[280px] justify-start text-left font-normal",!e.unref(n).expiresAt&&"text-muted-foreground"))},{default:e.withCtx(()=>[e.createVNode(e.unref(v.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(n).expiresAt?e.unref(_).format(e.unref(n).expiresAt.toDate(e.unref(M.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class"])]),_:1}),e.createVNode(u,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(g,{modelValue:e.unref(n).expiresAt,"onUpdate:modelValue":s[2]||(s[2]=V=>e.unref(n).expiresAt=V),"initial-focus":"",minValue:e.unref(n).startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),e.unref(n).expiresAt?(e.openBlock(),e.createElementBlock("div",De,[e.createVNode(o,{onClick:s[3]||(s[3]=V=>e.unref(n).expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...s[7]||(s[7]=[e.createTextVNode("Clear",-1)])]),_:1})])):(e.openBlock(),e.createElementBlock("p",Ue,"Not set - codes will never expire"))])])]),_:1})}}}),Se=e.defineComponent({__name:"Note",setup(b){const n=e.inject("newCoupon");return(_,a)=>{const s=e.resolveComponent("Textarea"),i=e.resolveComponent("Card");return e.openBlock(),e.createBlock(i,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",null,[a[1]||(a[1]=e.createElementVNode("h2",{class:"font-medium mb-2"},"Note",-1)),a[2]||(a[2]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-2"},"Used internally. It's a good idea to write down why you're creating this promo code.",-1)),e.createVNode(s,{modelValue:e.unref(n).note,"onUpdate:modelValue":a[0]||(a[0]=o=>e.unref(n).note=o)},null,8,["modelValue"])])]),_:1})}}}),Be={class:"relative"},$e={ref:"container",class:"flex flex-col gap-4 w-full max-w-5xl mx-auto"},Pe={class:"flex justify-between items-center mb-4"},Fe={class:"w-full max-w-2xl"},Me={class:"flex items-center space-x-2"},he={class:"flex items-center space-x-2"},Ae={class:"flex justify-end w-full"},Ie=e.defineComponent({__name:"Create",props:{config:{type:Object,required:!0}},async setup(b){let n,_;const a=b,{hasPermission:s}=w.useModulePermissions(),{navigateTo:i}=w.useModuleRoute(),{getTimezone:o}=w.useProjectSettings(),{log:m,logError:g}=w.useLogs(),{getModuleData:u,setModuleData:l}=w.useModuleStorage();w.useModuleBreadcrumbs(()=>[]);const p=w.useFirebaseIntegration(a.config.project),V=e.ref(!1),r=e.ref({creationMode:"single",generationMode:"generate",quantity:1,prefix:"",codes:"",code:"",type:void 0,value:void 0,unlimitedUses:!1,startsAt:void 0,expiresAt:void 0,minOrderAmount:0,note:""}),N=e.ref([]);N.value=([n,_]=e.withAsyncContext(()=>u("promo-types")),n=await n,_(),n||[]),e.provide("newCoupon",r),e.provide("promoTypes",N);const f=()=>{if(r.value.creationMode=="single"){if(r.value.code=r.value.code?.trim().toUpperCase(),!r.value.code)return T.toast.error("Please enter a code"),!1}else if(r.value.generationMode=="generate"){if(r.value.prefix=r.value.prefix?.trim().toUpperCase(),!r.value.prefix)return T.toast.error("Please enter a prefix"),!1;if(!r.value.quantity||r.value.quantity<1)return T.toast.error("Generate at least 1 code"),!1}else if(r.value.generationMode=="input"&&(r.value.codes=r.value.codes?.trim().toUpperCase(),!r.value.codes||r.value.codes.length<1))return T.toast.error("Please enter some codes"),!1;return r.value.type?N.value.find(x=>x.key===r.value.type)?.hasValueField&&!r.value.value?(T.toast.error("Please enter a value"),!1):(r.value.creationMode==="multi"&&(r.value.unlimitedUses=!1),!0):(T.toast.error("Please select a type"),!1)},t=async()=>{try{if(!f())return;if(V.value=!0,r.value.creationMode=="single"){let x={code:r.value.code,type:r.value.type,value:r.value.value,minOrderAmount:r.value.minOrderAmount,usageLimit:r.value.unlimitedUses?0:1,usageCount:0,lastUsedAt:null,startsAt:r.value.startsAt?r.value.startsAt.toDate(o()):null,expiresAt:r.value.expiresAt?r.value.expiresAt.toDate(o()):null,disabled:!1,note:r.value.note,createdAt:new Date,updatedAt:new Date};const c=await p.add(a.config.promoCodeCollection,x);m("Promo code created",{id:c.id,code:c.code,note:c.note}),T.toast.success("Promo code created")}}catch{g("Failed to create promo code"),T.toast.error("Failed to create promo code")}finally{V.value=!1}};return(x,c)=>{const k=e.resolveComponent("Button"),U=e.resolveComponent("RadioGroupItem"),y=e.resolveComponent("Label"),E=e.resolveComponent("RadioGroup"),S=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",$e,[e.createElementVNode("div",Pe,[c[3]||(c[3]=e.createElementVNode("h1",{class:"text-2xl font-bold"},"New Promo Code",-1)),e.createVNode(k,{onClick:c[0]||(c[0]=C=>e.unref(i)("promo-codes")),variant:"outline",disabled:V.value},{default:e.withCtx(()=>[e.createVNode(e.unref(v.List),{class:"size-4"}),c[2]||(c[2]=e.createTextVNode(" View Promo Codes ",-1))]),_:1},8,["disabled"])]),e.createVNode(S,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[c[6]||(c[6]=e.createElementVNode("h2",{class:"font-medium mb-4"},"Codes",-1)),e.createVNode(E,{modelValue:r.value.creationMode,"onUpdate:modelValue":c[1]||(c[1]=C=>r.value.creationMode=C),orientation:"horizontal",class:"mb-6"},{default:e.withCtx(()=>[e.createElementVNode("div",Me,[e.createVNode(U,{id:"creation_mode_single",value:"single"}),e.createVNode(y,{for:"creation_mode_single"},{default:e.withCtx(()=>[...c[4]||(c[4]=[e.createTextVNode("Create 1 code",-1)])]),_:1})]),e.createElementVNode("div",he,[e.createVNode(U,{id:"creation_mode_multi",value:"multi"}),e.createVNode(y,{for:"creation_mode_multi"},{default:e.withCtx(()=>[...c[5]||(c[5]=[e.createTextVNode("Create multiple codes",-1)])]),_:1})])]),_:1},8,["modelValue"]),r.value.creationMode=="single"?(e.openBlock(),e.createBlock(L,{key:0})):(e.openBlock(),e.createBlock(q,{key:1}))])]),_:1}),e.createVNode(_e),e.createVNode(Ee),e.createVNode(Se),e.createElementVNode("div",Ae,[e.createVNode(k,{disabled:V.value,onClick:t},{default:e.withCtx(()=>[V.value?(e.openBlock(),e.createBlock(e.unref(v.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),c[7]||(c[7]=e.createTextVNode(" Create Promo Code ",-1))]),_:1},8,["disabled"])])],512)])}}});exports.default=Ie;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";let f=new Map;class l{format(e){return this.formatter.format(e)}formatToParts(e){return this.formatter.formatToParts(e)}formatRange(e,r){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(e,r);if(r<e)throw new RangeError("End date must be >= start date");return`${this.formatter.format(e)} – ${this.formatter.format(r)}`}formatRangeToParts(e,r){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(e,r);if(r<e)throw new RangeError("End date must be >= start date");let u=this.formatter.formatToParts(e),t=this.formatter.formatToParts(r);return[...u.map(a=>({...a,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...t.map(a=>({...a,source:"endRange"}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return m()&&(this.resolvedHourCycle||(this.resolvedHourCycle=c(e.locale,this.options)),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),e.calendar==="ethiopic-amete-alem"&&(e.calendar="ethioaa"),e}constructor(e,r={}){this.formatter=h(e,r),this.options=r}}const i={true:{ja:"h11"},false:{}};function h(o,e={}){if(typeof e.hour12=="boolean"&&d()){e={...e};let t=i[String(e.hour12)][o.split("-")[0]],a=e.hour12?"h12":"h23";e.hourCycle=t??a,delete e.hour12}let r=o+(e?Object.entries(e).sort((t,a)=>t[0]<a[0]?-1:1).join():"");if(f.has(r))return f.get(r);let u=new Intl.DateTimeFormat(o,e);return f.set(r,u),u}let n=null;function d(){return n==null&&(n=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),n}let s=null;function m(){return s==null&&(s=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),s}function c(o,e){if(!e.timeStyle&&!e.hour)return;o=o.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),o+=(o.includes("-u-")?"":"-u")+"-nu-latn";let r=h(o,{...e,timeZone:void 0}),u=parseInt(r.formatToParts(new Date(2020,2,3,0)).find(a=>a.type==="hour").value,10),t=parseInt(r.formatToParts(new Date(2020,2,3,23)).find(a=>a.type==="hour").value,10);if(u===0&&t===23)return"h23";if(u===24&&t===23)return"h24";if(u===0&&t===11)return"h11";if(u===12&&t===11)return"h12";throw new Error("Unexpected hour cycle result")}exports.$fb18d541ea1ad717$export$ad991b66133851cf=l;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
let n = /* @__PURE__ */ new Map();
|
|
2
|
-
class c {
|
|
3
|
-
/** Formats a date as a string according to the locale and format options passed to the constructor. */
|
|
4
|
-
format(e) {
|
|
5
|
-
return this.formatter.format(e);
|
|
6
|
-
}
|
|
7
|
-
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
|
|
8
|
-
formatToParts(e) {
|
|
9
|
-
return this.formatter.formatToParts(e);
|
|
10
|
-
}
|
|
11
|
-
/** Formats a date range as a string. */
|
|
12
|
-
formatRange(e, r) {
|
|
13
|
-
if (typeof this.formatter.formatRange == "function")
|
|
14
|
-
return this.formatter.formatRange(e, r);
|
|
15
|
-
if (r < e) throw new RangeError("End date must be >= start date");
|
|
16
|
-
return `${this.formatter.format(e)} – ${this.formatter.format(r)}`;
|
|
17
|
-
}
|
|
18
|
-
/** Formats a date range as an array of parts. */
|
|
19
|
-
formatRangeToParts(e, r) {
|
|
20
|
-
if (typeof this.formatter.formatRangeToParts == "function")
|
|
21
|
-
return this.formatter.formatRangeToParts(e, r);
|
|
22
|
-
if (r < e) throw new RangeError("End date must be >= start date");
|
|
23
|
-
let u = this.formatter.formatToParts(e), t = this.formatter.formatToParts(r);
|
|
24
|
-
return [
|
|
25
|
-
...u.map((a) => ({
|
|
26
|
-
...a,
|
|
27
|
-
source: "startRange"
|
|
28
|
-
})),
|
|
29
|
-
{
|
|
30
|
-
type: "literal",
|
|
31
|
-
value: " – ",
|
|
32
|
-
source: "shared"
|
|
33
|
-
},
|
|
34
|
-
...t.map((a) => ({
|
|
35
|
-
...a,
|
|
36
|
-
source: "endRange"
|
|
37
|
-
}))
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
41
|
-
resolvedOptions() {
|
|
42
|
-
let e = this.formatter.resolvedOptions();
|
|
43
|
-
return m() && (this.resolvedHourCycle || (this.resolvedHourCycle = d(e.locale, this.options)), e.hourCycle = this.resolvedHourCycle, e.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12"), e.calendar === "ethiopic-amete-alem" && (e.calendar = "ethioaa"), e;
|
|
44
|
-
}
|
|
45
|
-
constructor(e, r = {}) {
|
|
46
|
-
this.formatter = h(e, r), this.options = r;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const l = {
|
|
50
|
-
true: {
|
|
51
|
-
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
52
|
-
ja: "h11"
|
|
53
|
-
},
|
|
54
|
-
false: {}
|
|
55
|
-
};
|
|
56
|
-
function h(o, e = {}) {
|
|
57
|
-
if (typeof e.hour12 == "boolean" && i()) {
|
|
58
|
-
e = {
|
|
59
|
-
...e
|
|
60
|
-
};
|
|
61
|
-
let t = l[String(e.hour12)][o.split("-")[0]], a = e.hour12 ? "h12" : "h23";
|
|
62
|
-
e.hourCycle = t ?? a, delete e.hour12;
|
|
63
|
-
}
|
|
64
|
-
let r = o + (e ? Object.entries(e).sort((t, a) => t[0] < a[0] ? -1 : 1).join() : "");
|
|
65
|
-
if (n.has(r)) return n.get(r);
|
|
66
|
-
let u = new Intl.DateTimeFormat(o, e);
|
|
67
|
-
return n.set(r, u), u;
|
|
68
|
-
}
|
|
69
|
-
let f = null;
|
|
70
|
-
function i() {
|
|
71
|
-
return f == null && (f = new Intl.DateTimeFormat("en-US", {
|
|
72
|
-
hour: "numeric",
|
|
73
|
-
hour12: !1
|
|
74
|
-
}).format(new Date(2020, 2, 3, 0)) === "24"), f;
|
|
75
|
-
}
|
|
76
|
-
let s = null;
|
|
77
|
-
function m() {
|
|
78
|
-
return s == null && (s = new Intl.DateTimeFormat("fr", {
|
|
79
|
-
hour: "numeric",
|
|
80
|
-
hour12: !1
|
|
81
|
-
}).resolvedOptions().hourCycle === "h12"), s;
|
|
82
|
-
}
|
|
83
|
-
function d(o, e) {
|
|
84
|
-
if (!e.timeStyle && !e.hour) return;
|
|
85
|
-
o = o.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, ""), o += (o.includes("-u-") ? "" : "-u") + "-nu-latn";
|
|
86
|
-
let r = h(o, {
|
|
87
|
-
...e,
|
|
88
|
-
timeZone: void 0
|
|
89
|
-
// use local timezone
|
|
90
|
-
}), u = parseInt(r.formatToParts(new Date(2020, 2, 3, 0)).find((a) => a.type === "hour").value, 10), t = parseInt(r.formatToParts(new Date(2020, 2, 3, 23)).find((a) => a.type === "hour").value, 10);
|
|
91
|
-
if (u === 0 && t === 23) return "h23";
|
|
92
|
-
if (u === 24 && t === 23) return "h24";
|
|
93
|
-
if (u === 0 && t === 11) return "h11";
|
|
94
|
-
if (u === 12 && t === 11) return "h12";
|
|
95
|
-
throw new Error("Unexpected hour cycle result");
|
|
96
|
-
}
|
|
97
|
-
export {
|
|
98
|
-
c as $
|
|
99
|
-
};
|
package/dist/Detail-DUo6qKqO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B=require("./utils-D6CaKJbp.js"),d=require("@oneclick.dev/cms-kit"),u=require("./CalendarDate-CWtpXgpD.js"),G=require("./DateFormatter-BbcSwTs4.js"),O={class:"relative @container"},R={key:0,class:"max-w-5xl mx-auto mt-4"},W={class:"flex flex-row gap-4 justify-between mb-6"},Z={class:"flex items-center"},K={class:"text-lg font-semibold mx-2 uppercase"},Y={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},H={key:1,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},J={class:"font-medium mb-2 uppercase"},Q={class:"mb-6"},X={key:0},ee={key:1},te={key:2},oe={class:"flex flex-wrap gap-12 mb-6"},le={key:0,class:"grid gap-2"},ae={class:"flex items-center gap-2"},ne={key:0,class:"text-lg"},se={key:1,class:"text-lg"},re={key:1,class:"grid gap-2"},de={class:"flex items-center space-x-2"},ue={class:"flex gap-4 mb-6"},ie={class:"flex flex-col"},ce={key:0,class:"-ml-2"},me={key:1,class:"text-xs text-muted-foreground mt-2"},pe={class:"flex flex-col"},ve={key:0,class:"-ml-2"},fe={key:1,class:"text-xs text-muted-foreground mt-2"},xe={class:"flex justify-end gap-2 mt-6"},Ve=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(E){let i,x;const m=E,{log:Ce,logWarning:Ne,logError:ge}=d.useLogs(),{params:V,navigateTo:C}=d.useModuleRoute(),{getModuleData:S}=d.useModuleStorage(),{confirm:T}=useConfirmation(),p=e.ref([]);p.value=([i,x]=e.withAsyncContext(()=>S("promo-types")),i=await i,x(),i||[]);const N=d.useFirebaseIntegration(m.config.project),o=e.ref(null),v=e.ref(!1),a=e.computed(()=>(o.value?.usageCount??0)>0),s=e.computed(()=>p.value.find(f=>f.key===o.value?.type)||null);d.useModuleBreadcrumbs(()=>[{text:"Promo codes list",href:o.value?.code?"/promo-codes":""},{text:o.value?.code||""}]);const g=new G.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),A=async()=>{o.value=await N.get(m.config.promoCodeCollection,V.value.promoCodeId),o.value.startsAt=u.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.startsAt?.replace(/\.\d{3}Z$/,"")),o.value.expiresAt=u.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.expiresAt?.replace(/\.\d{3}Z$/,""))},$=async()=>{await T(`Are you sure you want to delete the code "${o.value?.code}"?`)&&(await N.remove(m.config.promoCodeCollection,V.value.promoCodeId),C("/promo-codes"))};return A(),(f,t)=>{const r=e.resolveComponent("Button"),n=e.resolveComponent("Label"),k=e.resolveComponent("Input"),h=e.resolveComponent("SelectValue"),U=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),L=e.resolveComponent("Select"),j=e.resolveComponent("Switch"),_=e.resolveComponent("PopoverTrigger"),b=e.resolveComponent("Calendar"),y=e.resolveComponent("PopoverContent"),w=e.resolveComponent("Popover"),q=e.resolveComponent("Textarea"),z=e.resolveComponent("Loader2"),M=e.resolveComponent("CardContent"),F=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",O,[o.value?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",W,[e.createElementVNode("div",Z,[e.createVNode(r,{variant:"ghost",onClick:t[0]||(t[0]=l=>e.unref(C)("/promo-codes"))},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(c.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",K,e.toDisplayString(o.value.code),1),o.value.expiresAt>new Date?(e.openBlock(),e.createElementBlock("span",Y,"Active")):(e.openBlock(),e.createElementBlock("span",H,"Expired"))])]),e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createElementVNode("h3",J,e.toDisplayString(o.value.code),1),e.createElementVNode("p",Q,[t[14]||(t[14]=e.createTextVNode(" This promo code has been created on ",-1)),e.createElementVNode("strong",null,e.toDisplayString(new Date(o.value.createdAt).toLocaleString()),1),t[15]||(t[15]=e.createTextVNode(".",-1)),t[16]||(t[16]=e.createElementVNode("br",null,null,-1)),o.value.usageCount===1?(e.openBlock(),e.createElementBlock("span",X,[...t[11]||(t[11]=[e.createTextVNode("It has been used ",-1),e.createElementVNode("strong",null,"1 time",-1),e.createTextVNode(", so you can't edit it.",-1)])])):o.value.usageCount>1?(e.openBlock(),e.createElementBlock("span",ee,[t[12]||(t[12]=e.createTextVNode("It has been used ",-1)),e.createElementVNode("strong",null,e.toDisplayString(o.value.usageCount)+" times",1),t[13]||(t[13]=e.createTextVNode(", so you can't edit it.",-1))])):(e.openBlock(),e.createElementBlock("span",te,"It has not been used yet."))]),e.createVNode(n,{for:"code",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Promo Code",-1)])]),_:1}),e.createVNode(k,{id:"code",modelValue:o.value.code,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value.code=l),disabled:a.value,class:"mb-6 uppercase"},null,8,["modelValue","disabled"]),e.createElementVNode("div",null,[t[27]||(t[27]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Value",-1)),e.createVNode(L,{modelValue:o.value.type,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value.type=l)},{default:e.withCtx(()=>[e.createVNode(U,{class:"w-[200px] mb-4",disabled:a.value},{default:e.withCtx(()=>[e.createVNode(h,{placeholder:"Select a promo type"})]),_:1},8,["disabled"]),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,l=>(e.openBlock(),e.createBlock(D,{key:l.key,value:l.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",oe,[s.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",le,[e.createVNode(n,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",ae,[s.value?.valuePrefix?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(s.value?.valuePrefix),1)):e.createCommentVNode("",!0),e.createVNode(k,{modelValue:o.value.value,"onUpdate:modelValue":t[3]||(t[3]=l=>o.value.value=l),id:"discountValue",disabled:a.value},null,8,["modelValue","disabled"]),s.value?.valueSuffix?(e.openBlock(),e.createElementBlock("span",se,e.toDisplayString(s.value?.valueSuffix),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),s.value?.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(n,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",de,[e.createVNode(j,{id:"unlimitedUses",modelValue:o.value.unlimitedUses,"onUpdate:modelValue":t[4]||(t[4]=l=>o.value.unlimitedUses=l),disabled:a.value},null,8,["modelValue","disabled"]),e.createVNode(n,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)]),t[28]||(t[28]=e.createElementVNode("h3",{class:"font-medium"},"Availability",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"When will this code be available?",-1)),e.createElementVNode("div",ue,[e.createElementVNode("div",ie,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.startsAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.startsAt?e.unref(g).format(o.value.startsAt.toDate(e.unref(u.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.startsAt,"onUpdate:modelValue":t[5]||(t[5]=l=>o.value.startsAt=l),"initial-focus":"",minValue:e.unref(u.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.startsAt?(e.openBlock(),e.createElementBlock("div",ce,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[6]||(t[6]=l=>o.value.startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",me,"Not set - codes will be available immediately"))]),e.createElementVNode("div",pe,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.expiresAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.expiresAt?e.unref(g).format(o.value.expiresAt.toDate(e.unref(u.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.expiresAt,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value.expiresAt=l),"initial-focus":"",minValue:o.value.startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.expiresAt?(e.openBlock(),e.createElementBlock("div",ve,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[8]||(t[8]=l=>o.value.expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",fe,"Not set - codes will never expire"))])]),e.createVNode(n,{for:"note",class:"text-lg font-medium"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Note",-1)])]),_:1}),e.createVNode(n,{for:"note",class:"font-normal text-sm text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Internal note, you can always edit this later",-1)])]),_:1}),e.createVNode(q,{modelValue:o.value.note,"onUpdate:modelValue":t[9]||(t[9]=l=>o.value.note=l),id:"note"},null,8,["modelValue"]),e.createElementVNode("div",xe,[e.createVNode(r,{variant:"destructive",onClick:t[10]||(t[10]=l=>$()),disabled:v.value},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Code ",-1)])]),_:1},8,["disabled"]),e.createVNode(r,{disabled:v.value},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(z,{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[26]||(t[26]=e.createTextVNode(" Update Code ",-1))]),_:1},8,["disabled"])])])]),_:1})]),_:1}),e.createTextVNode(" "+e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)])}}});exports.default=Ve;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),l=require("@oneclick.dev/cms-kit"),n=require("lucide-vue-next"),m={class:"@container mt-4 w-full"},p={class:"flex flex-col space-y-8 @5xl:flex-row @5xl:space-x-8 @5xl:space-y-0 w-full"},C={class:"hidden @5xl:block @5xl:w-1/4 @7xl:w-1/5"},f={class:"flex flex-col flex-1"},g={class:"@5xl:hidden"},x=e.defineComponent({__name:"EditLayout",setup(b){const{params:t,resolvePath:o}=l.useModuleRoute();l.useModuleBreadcrumbs(()=>[{text:"Edit"}]);const{config:s}=l.useModule(),c=l.useFirebaseIntegration(s.project),d=e.ref(null);(async()=>{let i=await c.get(s.agendaCollection,t.value.id);d.value=i})();const a=[{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"}];return(i,h)=>{const r=e.resolveComponent("VerticalNav"),u=e.resolveComponent("DrawerNav"),v=e.resolveComponent("CardContent"),_=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",p,[e.createElementVNode("div",C,[e.createVNode(r,{links:a})]),e.createElementVNode("div",f,[e.createElementVNode("div",g,[e.createVNode(u,{links:a})]),e.createVNode(_,{class:"flex-1 w-full"},{default:e.withCtx(()=>[e.createVNode(v,null,{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3})]),_:3})])])])}}});exports._sfc_main=x;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { defineComponent as p, ref as f, resolveComponent as o, createElementBlock as g, openBlock as x, createElementVNode as l, createVNode as n, withCtx as c, renderSlot as C } from "vue";
|
|
2
|
-
import { useModuleRoute as b, useModuleBreadcrumbs as k, useModule as h, useFirebaseIntegration as w } from "@oneclick.dev/cms-kit";
|
|
3
|
-
import { ClipboardClock as y, User as $, Calendar as M, CalendarClock as N, CalendarCog as A, Tickets as S, HandCoins as B } from "lucide-vue-next";
|
|
4
|
-
const E = { class: "@container mt-4 w-full" }, V = { class: "flex flex-col space-y-8 @5xl:flex-row @5xl:space-x-8 @5xl:space-y-0 w-full" }, D = { class: "hidden @5xl:block @5xl:w-1/4 @7xl:w-1/5" }, P = { class: "flex flex-col flex-1" }, j = { class: "@5xl:hidden" }, H = /* @__PURE__ */ p({
|
|
5
|
-
__name: "EditLayout",
|
|
6
|
-
setup(L) {
|
|
7
|
-
const { params: e, resolvePath: t } = b();
|
|
8
|
-
k(() => [
|
|
9
|
-
{ text: "Edit" }
|
|
10
|
-
]);
|
|
11
|
-
const { config: s } = h(), d = w(s.project), r = f(null);
|
|
12
|
-
(async () => {
|
|
13
|
-
let i = await d.get(s.agendaCollection, e.value.id);
|
|
14
|
-
r.value = i;
|
|
15
|
-
})();
|
|
16
|
-
const a = [
|
|
17
|
-
{ to: t(`/edit/${e.value.id}/`), title: "Overview", icon: y, subtitle: "General info and quick details" },
|
|
18
|
-
{ to: t(`/edit/${e.value.id}/resources`), title: "Resource Management", icon: $, subtitle: "Manage resources" },
|
|
19
|
-
{ to: t(`/edit/${e.value.id}/agenda`), title: "Agenda", icon: M, subtitle: "Manage scheduled events and sessions" },
|
|
20
|
-
{ to: t(`/edit/${e.value.id}/regular-slots`), title: "Slot Configuration", icon: N, subtitle: "Define recurring time slots and patterns" },
|
|
21
|
-
{ to: t(`/edit/${e.value.id}/exceptions`), title: "Override Slots", icon: A, subtitle: "Adjust or block times" },
|
|
22
|
-
{ to: t(`/edit/${e.value.id}/availability`), title: "Availability Settings", icon: S, subtitle: "Booking rules & limits" },
|
|
23
|
-
{ to: t(`/edit/${e.value.id}/payment`), title: "Payment Settings", icon: B, subtitle: "Payment options & policies" }
|
|
24
|
-
];
|
|
25
|
-
return (i, R) => {
|
|
26
|
-
const u = o("VerticalNav"), _ = o("DrawerNav"), v = o("CardContent"), m = o("Card");
|
|
27
|
-
return x(), g("div", E, [
|
|
28
|
-
l("div", V, [
|
|
29
|
-
l("div", D, [
|
|
30
|
-
n(u, { links: a })
|
|
31
|
-
]),
|
|
32
|
-
l("div", P, [
|
|
33
|
-
l("div", j, [
|
|
34
|
-
n(_, { links: a })
|
|
35
|
-
]),
|
|
36
|
-
n(m, { class: "flex-1 w-full" }, {
|
|
37
|
-
default: c(() => [
|
|
38
|
-
n(v, null, {
|
|
39
|
-
default: c(() => [
|
|
40
|
-
C(i.$slots, "default")
|
|
41
|
-
]),
|
|
42
|
-
_: 3
|
|
43
|
-
})
|
|
44
|
-
]),
|
|
45
|
-
_: 3
|
|
46
|
-
})
|
|
47
|
-
])
|
|
48
|
-
])
|
|
49
|
-
]);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
export {
|
|
54
|
-
H as _
|
|
55
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),E=require("lucide-vue-next"),h=require("@oneclick.dev/cms-kit"),F=require("./index-DUeFrD-B.js"),U=require("./utils-D6CaKJbp.js"),B=require("./index-ijdf0d9-.js"),Z={class:"grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6"},ee=["onClick","onContextmenu"],te=["src"],oe={class:"font-semibold"},ne={class:"text-sm text-muted-foreground flex items-center gap-2"},le={class:"flex items-center gap-2"},re={key:0},se=e.defineComponent({__name:"GridView",props:{products:{type:Array,required:!0}},setup(g){const o=e.inject("selection"),{navigateTo:m}=h.useModuleRoute(),{hasPermission:V}=h.useModulePermissions(),C=(s,l)=>{const f=l.ctrlKey||l.metaKey;if(l.shiftKey)console.log("range");else if(f||o.value.length>0){const r=o.value.indexOf(s.id);r>-1?o.value.splice(r,1):o.value.push(s.id)}else o.value=[],m(s.id)},n=s=>{s.target.closest(".GRID_ITEM")||(o.value=[])},d=(s,l)=>{l.ctrlKey||l.metaKey?o.value.includes(s.id)?o.value.splice(o.value.indexOf(s.id),1):o.value.push(s.id):o.value.includes(s.id)||(o.value=[s.id])};return(s,l)=>(e.openBlock(),e.createElementBlock("div",{class:"@container mb-4 flex-1 select-none",onClick:l[0]||(l[0]=f=>o.value=[]),onContextmenu:n},[e.createElementVNode("div",Z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.products,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,onClick:e.withModifiers(w=>C(f,w),["stop"]),onContextmenu:w=>d(f,w),class:"GRID_ITEM cursor-pointer"},[e.createElementVNode("div",{class:e.normalizeClass(["aspect-square bg-muted rounded-xl overflow-hidden mb-2 transition-all duration-200",{"outline outline-4 outline-primary/50":e.unref(o).includes(f.id)}])},[f.featuredMedia?(e.openBlock(),e.createElementBlock("img",{key:0,src:f.featuredMedia,class:"w-full h-full object-cover pointer-events-none",draggable:"false"},null,8,te)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[e.createElementVNode("p",oe,e.toDisplayString(f.title),1),e.createElementVNode("p",ne,[e.createElementVNode("span",le,[f.status==="published"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[1]||(l[1]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-green-500"},null,-1)),l[2]||(l[2]=e.createTextVNode(" Published ",-1))],64)):f.status==="draft"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l[3]||(l[3]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-blue-500"},null,-1)),l[4]||(l[4]=e.createTextVNode(" Draft ",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l[5]||(l[5]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-gray-300"},null,-1)),l[6]||(l[6]=e.createTextVNode(" Archived ",-1))],64))]),f.variantsTotal>1?(e.openBlock(),e.createElementBlock("span",re,"| "+e.toDisplayString(f.variantsTotal)+" variants",1)):e.createCommentVNode("",!0)])])],40,ee))),128))])],32))}}),ae={class:"flex items-center gap-2"},ie={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},ce={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},ue={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},de=e.defineComponent({__name:"ListView",props:{products:{type:Array,required:!0}},setup(g){const o=e.inject("selection"),{navigateTo:m}=h.useModuleRoute(),{hasPermission:V}=h.useModulePermissions(),C=(n,d)=>{n?o.value.push(d):o.value=o.value.filter(s=>s!==d)};return(n,d)=>{const s=e.resolveComponent("TableHead"),l=e.resolveComponent("TableRow"),f=e.resolveComponent("TableHeader"),w=e.resolveComponent("Checkbox"),r=e.resolveComponent("TableCell"),u=e.resolveComponent("AvatarImage"),t=e.resolveComponent("AvatarFallback"),p=e.resolveComponent("Avatar"),x=e.resolveComponent("TableBody"),N=e.resolveComponent("Table"),b=e.resolveComponent("Card");return e.openBlock(),e.createBlock(b,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(N,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(s,{key:0})):e.createCommentVNode("",!0),e.createVNode(s,null,{default:e.withCtx(()=>[...d[1]||(d[1]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode(" Variants",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("Price",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(x,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.products,v=>(e.openBlock(),e.createBlock(l,{key:v.id,onClick:_=>e.unref(m)(v.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(r,{key:0},{default:e.withCtx(()=>[e.createVNode(w,{"model-value":e.unref(o)?.includes(v.id),"onUpdate:modelValue":_=>C(_,v.id),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(r,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createVNode(p,{class:"size-12 rounded-xl"},{default:e.withCtx(()=>[e.createVNode(u,{src:v.media?.[0],class:"object-cover"},null,8,["src"]),e.createVNode(t,{class:"rounded-xl"})]),_:2},1024),e.createElementVNode("span",null,e.toDisplayString(v.title),1)])]),_:2},1024),e.createVNode(r,null,{default:e.withCtx(()=>[v.status==="published"?(e.openBlock(),e.createElementBlock("span",ie,"Published")):v.status==="draft"?(e.openBlock(),e.createElementBlock("span",ce,"Draft")):v.status==="archived"?(e.openBlock(),e.createElementBlock("span",ue,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(r,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v.variantsTotal),1)]),_:2},1024),e.createVNode(r,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(" € "+e.toDisplayString(v.price||0),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),O=F.isClient?window:void 0;function $(g){var o;const m=e.toValue(g);return(o=m?.$el)!=null?o:m}function me(){const g=e.shallowRef(!1),o=e.getCurrentInstance();return o&&e.onMounted(()=>{g.value=!0},o),g}function pe(g){const o=me();return e.computed(()=>(o.value,!!g()))}function fe(g,o,m={}){const{window:V=O,...C}=m;let n;const d=pe(()=>V&&"ResizeObserver"in V),s=()=>{n&&(n.disconnect(),n=void 0)},l=e.computed(()=>{const r=e.toValue(g);return Array.isArray(r)?r.map(u=>$(u)):[$(r)]}),f=e.watch(l,r=>{if(s(),d.value&&V){n=new ResizeObserver(o);for(const u of r)u&&n.observe(u,C)}},{immediate:!0,flush:"post"}),w=()=>{s(),f()};return F.tryOnScopeDispose(w),{isSupported:d,stop:w}}function ve(g,o={width:0,height:0},m={}){const{window:V=O,box:C="content-box"}=m,n=e.computed(()=>{var r,u;return(u=(r=$(g))==null?void 0:r.namespaceURI)==null?void 0:u.includes("svg")}),d=e.shallowRef(o.width),s=e.shallowRef(o.height),{stop:l}=fe(g,([r])=>{const u=C==="border-box"?r.borderBoxSize:C==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;if(V&&n.value){const t=$(g);if(t){const p=t.getBoundingClientRect();d.value=p.width,s.value=p.height}}else if(u){const t=F.toArray(u);d.value=t.reduce((p,{inlineSize:x})=>p+x,0),s.value=t.reduce((p,{blockSize:x})=>p+x,0)}else d.value=r.contentRect.width,s.value=r.contentRect.height},m);F.tryOnMounted(()=>{const r=$(g);r&&(d.value="offsetWidth"in r?r.offsetWidth:o.width,s.value="offsetHeight"in r?r.offsetHeight:o.height)});const f=e.watch(()=>$(g),r=>{d.value=r?o.width:0,s.value=r?o.height:0});function w(){l(),f()}return{width:d,height:s,stop:w}}const Ce={class:"truncate"},xe={key:0},ge={key:1},Ve={key:2},we={key:3},Ne={class:"relative w-full max-w-sm items-center"},be={class:"truncate"},ke={class:"truncate"},he={class:"flex items-center space-x-2 mb-4"},_e={class:"flex items-center space-x-2 mb-4"},ye={class:"flex items-center space-x-2 mb-4"},Be=e.defineComponent({__name:"FilterPopover",setup(g){const o=e.inject("filter"),m=e.inject("collections"),V=()=>{o.value={collections:[],published:!0,draft:!0,archived:!1}};return(C,n)=>{const d=e.resolveComponent("Button"),s=e.resolveComponent("PopoverTrigger"),l=e.resolveComponent("ComboboxTrigger"),f=e.resolveComponent("ComboboxAnchor"),w=e.resolveComponent("ComboboxInput"),r=e.resolveComponent("ComboboxEmpty"),u=e.resolveComponent("ComboboxItemIndicator"),t=e.resolveComponent("ComboboxItem"),p=e.resolveComponent("ScrollArea"),x=e.resolveComponent("ComboboxGroup"),N=e.resolveComponent("ComboboxList"),b=e.resolveComponent("Combobox"),v=e.resolveComponent("Checkbox"),_=e.resolveComponent("PopoverContent"),y=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(y,null,{default:e.withCtx(()=>[e.createVNode(s,{asChild:""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Filter),{class:"size-4"}),n[4]||(n[4]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(_,{class:"w-64"},{default:e.withCtx(()=>[n[14]||(n[14]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Collection ",-1)),e.createVNode(b,{modelValue:e.unref(o).collections,"onUpdate:modelValue":n[0]||(n[0]=i=>e.unref(o).collections=i),by:"id",multiple:!0,class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(f,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(l,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline",class:"justify-between w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",Ce,[e.unref(o).collections.length===1?(e.openBlock(),e.createElementBlock("span",xe,e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[0])?.title),1)):e.unref(o).collections.length===2?(e.openBlock(),e.createElementBlock("span",ge,e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[1])?.title),1)):e.unref(o).collections.length>2?(e.openBlock(),e.createElementBlock("span",Ve,e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[1])?.title)+" + "+e.toDisplayString(e.unref(o).collections.length-2),1)):(e.openBlock(),e.createElementBlock("span",we,"Select collection"))]),e.createVNode(e.unref(E.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[e.createVNode(w,{placeholder:"Select category..."})]),e.createVNode(r,null,{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode(" No category found. ",-1)])]),_:1}),e.unref(m)?.filter(i=>i.status==="published")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[7]||(n[7]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium mt-2"},"Published",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m).filter(i=>i.status==="published"),i=>(e.openBlock(),e.createBlock(t,{key:i.id,value:i.id},{default:e.withCtx(()=>[n[6]||(n[6]=e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1)),e.createElementVNode("span",be,e.toDisplayString(i.title),1),e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(e.unref(E.Check),{class:e.normalizeClass(e.unref(U.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0),e.unref(m)?.filter(i=>i.status==="draft")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n[9]||(n[9]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium"},"Drafts",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m).filter(i=>i.status==="draft"),i=>(e.openBlock(),e.createBlock(t,{key:i.id,value:i.id},{default:e.withCtx(()=>[n[8]||(n[8]=e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",ke,e.toDisplayString(i.title),1),e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(e.unref(E.Check),{class:e.normalizeClass(e.unref(U.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"]),n[15]||(n[15]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",he,[e.createVNode(v,{id:"chk_published_products",modelValue:e.unref(o).published,"onUpdate:modelValue":n[1]||(n[1]=i=>e.unref(o).published=i)},null,8,["modelValue"]),n[10]||(n[10]=e.createElementVNode("label",{for:"chk_published_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show published products ",-1))]),e.createElementVNode("div",_e,[e.createVNode(v,{id:"chk_draft_products",modelValue:e.unref(o).draft,"onUpdate:modelValue":n[2]||(n[2]=i=>e.unref(o).draft=i)},null,8,["modelValue"]),n[11]||(n[11]=e.createElementVNode("label",{for:"chk_draft_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show draft products ",-1))]),e.createElementVNode("div",ye,[e.createVNode(v,{id:"chk_archived_products",modelValue:e.unref(o).archived,"onUpdate:modelValue":n[3]||(n[3]=i=>e.unref(o).archived=i)},null,8,["modelValue"]),n[12]||(n[12]=e.createElementVNode("label",{for:"chk_archived_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show archived products ",-1))]),e.unref(o).collections.length>0||!e.unref(o).published||!e.unref(o).draft||e.unref(o).archived?(e.openBlock(),e.createBlock(d,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:V},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RotateCcw),{class:"size-3"}),n[13]||(n[13]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),Ee=e.defineComponent({__name:"ProductContextMenu",emits:["selectAll","duplicateProduct","deleteProduct","deleteSelection"],setup(g,{emit:o}){const m=o,V=e.inject("products"),C=e.inject("selection"),n=e.inject("config"),{hasPermission:d}=h.useModulePermissions(),{navigateTo:s}=h.useModuleRoute(),l=e.computed(()=>C.value?.length!==1?null:V.value?.find(u=>u.id===C.value[0])),f=u=>{let t=n.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",u.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",u.slug),window.open(t,"_blank")},w=async(u,t)=>{try{if(!["draft","published","archived"].includes(t))return;await h.useFirebaseIntegration(n.project).update(n.productCollection,u.id,{status:t}),u.status=t,B.toast.success("Product status changed")}catch{B.toast.error("Failed to change product status")}},r=async u=>{try{if(!["draft","published","archived"].includes(u))return;const t=h.useFirebaseIntegration(n.project),p=[];C.value.forEach(async x=>{p.push(t.update(n.productCollection,x,{status:u}))}),B.toast.promise(Promise.all(p),{loading:`Changing status of ${C.value.length} products...`,success:()=>{const x=C.value.length;return C.value.forEach(N=>{V.value.find(b=>b.id==N).status=u}),C.value=[],`Product status changed for ${x} products`},error:x=>"Failed to change product status"})}catch{B.toast.error("Failed to change product status")}};return(u,t)=>{const p=e.resolveComponent("ContextMenuTrigger"),x=e.resolveComponent("ContextMenuShortcut"),N=e.resolveComponent("ContextMenuItem"),b=e.resolveComponent("ContextMenuContent"),v=e.resolveComponent("ContextMenuSeparator"),_=e.resolveComponent("ContextMenuSubTrigger"),y=e.resolveComponent("ContextMenuCheckboxItem"),i=e.resolveComponent("ContextMenuSubContent"),D=e.resolveComponent("ContextMenuSub"),I=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(I,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default")]),_:3}),e.unref(C).length===0?(e.openBlock(),e.createBlock(b,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(N,{inset:"",onClick:t[0]||(t[0]=k=>m("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(C).length===1&&l.value?(e.openBlock(),e.createBlock(b,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(N,{inset:"",onClick:t[1]||(t[1]=k=>e.unref(s)(l.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit product ",-1)])]),_:1}),e.createVNode(v),e.unref(n).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(N,{inset:"",onClick:t[2]||(t[2]=k=>f(l.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview product ",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(e.unref(E.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(v)],64)):e.createCommentVNode("",!0),e.createVNode(N,{inset:"",onClick:t[3]||(t[3]=k=>m("duplicateProduct",l.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate product ",-1)])]),_:1}),e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(_,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(i,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(y,{onClick:t[4]||(t[4]=k=>w(l.value,"draft")),modelValue:l.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(y,{onClick:t[5]||(t[5]=k=>w(l.value,"published")),modelValue:l.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(y,{onClick:t[6]||(t[6]=k=>w(l.value,"archived")),modelValue:l.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(N,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=k=>m("deleteProduct",l.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete product ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(C).length>1?(e.openBlock(),e.createBlock(b,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(_,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(C).length)+") ",1)]),_:1}),e.createVNode(i,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(y,{onClick:t[8]||(t[8]=k=>r("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(y,{onClick:t[9]||(t[9]=k=>r("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(y,{onClick:t[10]||(t[10]=k=>r("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(N,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=k=>m("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete products ("+e.toDisplayString(e.unref(C).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),Pe={class:"relative flex flex-col flex-1"},Se={ref:"container",class:"flex items-center justify-between gap-4 w-full mt-12 mb-8"},Te={class:"flex items-center gap-4"},Me={class:"text-lg whitespace-nowrap"},$e={class:"relative w-full max-w-sm items-center"},De={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ze={class:"flex items-center gap-4"},Ae={class:"flex flex-1"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},async setup(g){let o,m;const V=g,{hasPermission:C}=h.useModulePermissions(),{navigateTo:n}=h.useModuleRoute(),{confirm:d}=h.useConfirmation();h.useModuleBreadcrumbs(()=>[]);const s=h.useFirebaseIntegration(V.config.project),l=e.ref([]),f=async()=>{const c=await s.find(V.config.productCollection);l.value=c||[]},w=e.useTemplateRef("container"),{width:r}=ve(w),u=e.ref("grid"),t=e.ref(1),p=e.ref([]),x=e.ref(""),N=e.ref([]);N.value=([o,m]=e.withAsyncContext(()=>y()),o=await o,m(),o);const b=e.computed(()=>u.value==="grid"?r.value<768?6:r.value<896?8:r.value<1024?10:12:10),v=e.computed(()=>l.value.filter(c=>!(T.value.collections.length>0&&!c.collections?.some(a=>T.value.collections.includes(a))||!T.value.published&&c.status==="published"||!T.value.draft&&c.status==="draft"||!T.value.archived&&c.status==="archived")).filter(c=>c.title.toLowerCase().includes(x.value.toLowerCase())||c.slug.toLowerCase().includes(x.value.toLowerCase())||c.id.toLowerCase().includes(x.value.toLowerCase()))),_=e.computed(()=>{if(v.value.length<=b.value)return v.value;const c=(t.value-1)*b.value,a=c+b.value;return v.value.slice(c,a)});async function y(){if(!V.config.collectionsCollection)return[];const c=V.config.collectionsCollection.split(":");return c.length!==2?[]:(await s.get(c[0]))?.[c[1]]||[]}async function i(c){return(await s.find(V.config.productCollection,{filters:[{field:"slug",operator:"==",value:c}]})).length>0}const D=()=>{p.value=_.value.map(c=>c.id)},I=async c=>{try{let a={...c},S=a.slug+"-copy",M=2;for(;await i(S);)S=a.slug+"-copy-"+M,M++;a.id=void 0,a.createdAt=new Date,a.updatedAt=new Date,a.slug=S,a.status="draft",a.title=a.title+" (copy)";const A=await s.add(V.config.productCollection,a);n(A.id),B.toast.success("Product duplicated")}catch{B.toast.error("Failed to duplicate product")}},k=async c=>{if(await d(`Are you sure you want to delete "${c.title}"?`))try{await s.remove(V.config.productCollection,c.id),l.value=l.value.filter(S=>S.id!==c.id),p.value=[],B.toast.success("Product deleted")}catch{B.toast.error("Failed to delete product")}},L=async()=>{if(await d(`Are you sure you want to delete all selected products (${p.value.length})?`))try{p.value.forEach(async a=>{await s.remove(V.config.productCollection,a)}),l.value=l.value.filter(a=>!p.value.includes(a.id)),p.value=[],B.toast.success("Products deleted")}catch{B.toast.error("Failed to delete products")}},T=e.ref({collections:[],published:!0,draft:!0,archived:!1});e.watch(T,()=>{t.value=1});const R=c=>{c.target?.matches("input, textarea")||c.target?.isContentEditable||(c.key==="Escape"&&(p.value=[]),(c.metaKey||c.ctrlKey)&&c.key.toLowerCase()==="a"&&(c.preventDefault(),D()))};return e.onMounted(()=>{f(),window.addEventListener("keydown",R)}),e.onUnmounted(()=>{window.removeEventListener("keydown",R)}),e.provide("config",V.config),e.provide("filter",T),e.provide("products",l),e.provide("collections",N),e.provide("selection",p),(c,a)=>{const S=e.resolveComponent("Input"),M=e.resolveComponent("Button"),A=e.resolveComponent("SegmentedControlButton"),K=e.resolveComponent("SegmentedControl"),q=e.resolveComponent("PaginationFirst"),G=e.resolveComponent("PaginationPrev"),H=e.resolveComponent("PaginationListItem"),W=e.resolveComponent("PaginationEllipsis"),Q=e.resolveComponent("PaginationNext"),X=e.resolveComponent("PaginationLast"),J=e.resolveComponent("PaginationList"),Y=e.resolveComponent("Pagination");return e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("div",Se,[e.createElementVNode("div",Te,[e.createElementVNode("p",Me,e.toDisplayString(v.value?.length)+" products",1),e.createElementVNode("div",$e,[e.createVNode(S,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:a[0]||(a[0]=e.withKeys(P=>x.value="",["escape"])),modelValue:x.value,"onUpdate:modelValue":a[1]||(a[1]=P=>x.value=P)},null,8,["modelValue"]),e.createElementVNode("span",De,[e.createVNode(e.unref(E.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ze,[p.value.length>0?(e.openBlock(),e.createBlock(M,{key:0,variant:"destructive",onClick:L},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(p.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(C)("create-product")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(M,{variant:"outline",onClick:a[2]||(a[2]=P=>e.unref(n)("new"))},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Plus),{class:"size-4"}),a[5]||(a[5]=e.createTextVNode(" New Product ",-1))]),_:1}),a[6]||(a[6]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(Be),a[7]||(a[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1)),e.createElementVNode("div",null,[e.createVNode(K,{modelValue:u.value,"onUpdate:modelValue":a[3]||(a[3]=P=>u.value=P),"aria-label":"View mode"},{default:e.withCtx(()=>[e.createVNode(A,{value:"grid"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.LayoutGrid),{class:"size-4"})]),_:1}),e.createVNode(A,{value:"list"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.List),{class:"size-4"})]),_:1})]),_:1},8,["modelValue"])])])],512),e.createElementVNode("div",Ae,[e.createVNode(Ee,{onSelectAll:D,onDuplicateProduct:I,onDeleteProduct:k,onDeleteSelection:L},{default:e.withCtx(()=>[u.value==="grid"?(e.openBlock(),e.createBlock(se,{key:0,products:_.value},null,8,["products"])):(e.openBlock(),e.createBlock(de,{key:1,products:_.value},null,8,["products"]))]),_:1})]),v.value?.length>b.value?(e.openBlock(),e.createBlock(Y,{key:0,page:t.value,"onUpdate:page":a[4]||(a[4]=P=>t.value=P),"items-per-page":b.value,total:v.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(J,{class:"flex items-center gap-1"},{default:e.withCtx(({items:P})=>[e.createVNode(q),e.createVNode(G),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P,(z,j)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[z.type==="page"?(e.openBlock(),e.createBlock(H,{key:j,value:z.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(M,{class:"size-10 p-0",variant:z.value===t.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(z.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(W,{key:z.type,index:j},null,8,["index"]))],64))),256)),e.createVNode(Q),e.createVNode(X)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])}}});exports.default=Fe;
|