@oneclick.dev/cms-core-modules 0.0.53 → 0.0.54
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/CalendarDate-CRT2Viyt.mjs +830 -0
- package/dist/CalendarDate-CWtpXgpD.js +1 -0
- package/dist/Components-D9yIIosM.mjs +623 -0
- package/dist/Components-DXbx0RLV.js +1 -0
- package/dist/ContentEditor-DRJFQKCv.mjs +34915 -0
- package/dist/ContentEditor-DzTi8fSZ.js +290 -0
- package/dist/Create-BP8TX6rj.js +1 -0
- package/dist/Create-Bwf1RXdG.mjs +1248 -0
- package/dist/DateFormatter-BbcSwTs4.js +1 -0
- package/dist/DateFormatter-CbO0PVUK.mjs +99 -0
- package/dist/Detail-B-PnkcXD.mjs +3473 -0
- package/dist/Detail-BVlGSjOq.mjs +380 -0
- package/dist/Detail-C4E1T87K.mjs +26 -0
- package/dist/Detail-CNfTDUE5.js +1 -0
- package/dist/Detail-Cd5CBVN0.js +1 -0
- package/dist/Detail-CpfOQChd.mjs +585 -0
- package/dist/Detail-CwagT6gQ.mjs +650 -0
- package/dist/Detail-DUo6qKqO.js +1 -0
- package/dist/Detail-Dd_OkpcN.js +1 -0
- package/dist/Detail-mvSGbnFU.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +55 -0
- package/dist/Entries-DcpPvlYj.js +1 -0
- package/dist/Entries-QLMtTYLX.mjs +713 -0
- package/dist/Find-BPR0uU-Z.mjs +229 -0
- package/dist/Find-BidEQJxT.js +1 -0
- package/dist/GlobalStyling-CMzPRd18.js +17 -0
- package/dist/GlobalStyling-DoLHUJeV.mjs +988 -0
- package/dist/Overview-BDlBCUI_.js +1 -0
- package/dist/Overview-BH3NwvNX.mjs +26 -0
- package/dist/Overview-BLsZMHNW.mjs +178 -0
- package/dist/Overview-BNMZ9MUK.js +1 -0
- package/dist/Overview-BbvfH1u-.js +1 -0
- package/dist/Overview-CDN88OSM.mjs +190 -0
- package/dist/Overview-CEPodGCn.mjs +311 -0
- package/dist/Overview-CvquDPhB.js +1 -0
- package/dist/Overview-D54pjmI6.mjs +633 -0
- package/dist/Overview-D67UjG6n.mjs +947 -0
- package/dist/Overview-KT2Mgfh5.js +1 -0
- package/dist/Overview-T-lsy3UZ.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +392 -0
- package/dist/TableView-CpO53xcX.js +111 -0
- package/dist/TableView-D9J5rUls.mjs +72921 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +1 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs +40 -0
- package/dist/View-DlHBZbFu.js +1 -0
- package/dist/View-Dv5QMrSn.mjs +25 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/agenda-B49oKGeh.mjs +706 -0
- package/dist/agenda-DipQ5IWP.js +1 -0
- package/dist/availability-C7q9tq6l.js +1 -0
- package/dist/availability-DeCkqiu8.mjs +613 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/countries-BTPvmrsb.mjs +4 -0
- package/dist/countries-CgZ081No.js +1 -0
- package/dist/exceptions-D3b18TiY.mjs +647 -0
- package/dist/exceptions-DJ9zWX3k.js +1 -0
- package/dist/floating-ui.dom-C82nbomj.js +1 -0
- package/dist/floating-ui.dom-ouSgPqty.mjs +1133 -0
- package/dist/google-CvtuJwgk.mjs +4 -0
- package/dist/google-D4N3gb01.js +1 -0
- package/dist/index--jjEzba7.mjs +24 -0
- package/dist/index-9HVlmvK3.js +1 -0
- package/dist/index-BEGU8Kme.mjs +12 -0
- package/dist/index-Bwi1mtkq.mjs +24 -0
- package/dist/index-BzuHN-r8.mjs +24 -0
- package/dist/index-CImCyE3L.mjs +24 -0
- package/dist/index-CKPshlZ8-BQiiP6r_.mjs +1264 -0
- package/dist/index-CKPshlZ8-CIz1tDwX.js +1 -0
- package/dist/index-CQiY-oTN.mjs +24 -0
- package/dist/index-CSxYBeVA.js +1 -0
- package/dist/index-CkiNvRzs.js +1 -0
- package/dist/index-Co4ON2Di.js +1 -0
- package/dist/index-CwqrAU-H.js +1 -0
- package/dist/index-Cz-baGax.js +1 -0
- package/dist/index-D2a6wEPh.js +1 -0
- package/dist/index-DFQGVHTs.js +1 -0
- package/dist/index-DI6mydpm.mjs +138 -0
- package/dist/index-DMoyoaks.mjs +22 -0
- package/dist/index-DT1wWnUk.mjs +24 -0
- package/dist/index-DUeFrD-B.js +1 -0
- package/dist/index-DsnoK4ia.mjs +579 -0
- package/dist/index-R2oUDsjx.js +1 -0
- package/dist/index-RLz1QPrf.mjs +203 -0
- package/dist/index-UtjLbLw-.js +1 -0
- package/dist/index-_mG-aU3Z.mjs +87 -0
- package/dist/index-_sQDF1pH.js +1 -0
- package/dist/index-ijdf0d9-.js +1 -0
- package/dist/index-klI238nT.mjs +24 -0
- package/dist/index.cjs.js +1 -330
- package/dist/index.mjs +287 -69051
- package/dist/interpolation-BNUjI7LH.js +1 -0
- package/dist/interpolation-BpGXqOz8.mjs +59 -0
- package/dist/payment-kTjsV0Jj.js +1 -0
- package/dist/payment-zpCM0LD-.mjs +981 -0
- package/dist/regular-C4_3YXqx.mjs +602 -0
- package/dist/regular-DFwPEbZO.js +1 -0
- package/dist/regular-slots-4ooEpICB.mjs +67 -0
- package/dist/regular-slots-BAVGbomI.js +1 -0
- package/dist/resources-MpQkSstv.mjs +563 -0
- package/dist/resources-iM28T3dD.js +1 -0
- package/dist/src/appointments/index.d.ts +4 -28
- package/dist/src/appointments/routes.d.ts +3 -9
- package/dist/src/content-manager/index.d.ts +5 -147
- package/dist/src/content-manager/routes.d.ts +4 -128
- package/dist/src/custom/index.d.ts +2 -2
- package/dist/src/custom/routes.d.ts +1 -1
- package/dist/src/mail-templates/index.d.ts +2 -30
- package/dist/src/mail-templates/routes.d.ts +1 -11
- package/dist/src/product-collections/index.d.ts +2 -30
- package/dist/src/product-collections/routes.d.ts +1 -11
- package/dist/src/products/index.d.ts +2 -30
- package/dist/src/products/routes.d.ts +1 -11
- package/dist/src/promo-codes/index.d.ts +2 -30
- package/dist/src/promo-codes/routes.d.ts +1 -11
- package/dist/src/shipping-options/index.d.ts +2 -30
- package/dist/src/shipping-options/routes.d.ts +1 -11
- package/dist/src/table/index.d.ts +2 -70
- package/dist/src/table/routes.d.ts +1 -51
- package/dist/utils-BVKy9S2J.mjs +29 -0
- package/dist/utils-D6CaKJbp.js +2 -0
- package/dist/vee-validate-zod-BPQyEfpF.js +1 -0
- package/dist/vee-validate-zod-IXkfh-6Q.mjs +4402 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./vee-validate-zod-BPQyEfpF.js"),y=require("./countries-CgZ081No.js"),g=require("lucide-vue-next"),$=require("@oneclick.dev/cms-kit"),E=require("./index-ijdf0d9-.js"),M={class:"flex flex-col gap-4"},F={class:"flex flex-col gap-2"},L={key:0,class:"text-red-500 text-sm mt-1"},R={class:"flex flex-col gap-4"},z={class:"flex flex-col gap-2"},U={key:0,class:"text-red-500 text-sm mt-1"},j={class:"flex flex-col gap-4"},P={class:"flex flex-col gap-2"},q={key:0,class:"text-red-500 text-sm mt-1"},G=e.defineComponent({__name:"Main",setup(B){const d=e.inject("isLoadingCompleted",e.ref(!1)),{errors:o}=l.useFormContext(),{value:a}=l.useField("title"),{value:n}=l.useField("description"),{value:s}=l.useField("price");return(u,t)=>{const c=e.resolveComponent("Label"),p=e.resolveComponent("Input"),m=e.resolveComponent("Textarea"),V=e.resolveComponent("CardContent"),w=e.resolveComponent("Card");return e.openBlock(),e.createBlock(w,null,{default:e.withCtx(()=>[e.createVNode(V,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createElementVNode("div",F,[e.createVNode(c,{for:"title",class:"text-sm"},{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Name",-1)])]),_:1}),e.createVNode(p,{type:"text",id:"title",placeholder:e.unref(d)?"Fast shipping":"",modelValue:e.unref(a),"onUpdate:modelValue":t[0]||(t[0]=N=>e.isRef(a)?a.value=N:null)},null,8,["placeholder","modelValue"]),e.unref(o).title?(e.openBlock(),e.createElementBlock("p",L,e.toDisplayString(e.unref(o).title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",R,[e.createElementVNode("div",z,[e.createVNode(c,{for:"description",class:"text-sm"},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Description (optional)",-1)])]),_:1}),e.createVNode(m,{id:"description",placeholder:e.unref(d)?"Ships next day":"",modelValue:e.unref(n),"onUpdate:modelValue":t[1]||(t[1]=N=>e.isRef(n)?n.value=N:null)},null,8,["placeholder","modelValue"]),e.unref(o).description?(e.openBlock(),e.createElementBlock("p",U,e.toDisplayString(e.unref(o).description),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",j,[e.createElementVNode("div",P,[e.createVNode(c,{for:"price",class:"text-sm"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(p,{type:"number",min:"0",id:"price",placeholder:e.unref(d)?"Free":"",modelValue:e.unref(s),"onUpdate:modelValue":t[2]||(t[2]=N=>e.isRef(s)?s.value=N:null),class:"no-spinner"},null,8,["placeholder","modelValue"]),e.unref(o).price?(e.openBlock(),e.createElementBlock("p",q,e.toDisplayString(e.unref(o).price),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})}}}),A={class:"flex flex-col gap-4"},J={class:"flex flex-col gap-2"},K={class:"truncate"},W={class:"relative w-full max-w-sm items-center"},X={class:"absolute start-0 inset-y-0 flex items-center justify-center px-3"},Z={class:"truncate"},H={key:0,class:"text-red-500 text-sm mt-1"},Q={key:0},Y={class:"group flex items-center gap-2 bg-muted/50 rounded-md mb-1 p-2"},ee={class:"w-6"},te={class:"text-muted-foreground group-hover:text-black dark:group-hover:text-white"},oe=e.defineComponent({__name:"Countries",setup(B){const{errors:d}=l.useFormContext(),{value:o}=l.useField("countries");return e.watch(o,a=>{let n=a?.sort((u,t)=>!u||!t?0:y.rawCountries.find(c=>c.cca2===u)?.name.common.localeCompare(y.rawCountries.find(c=>c.cca2===t)?.name.common)),s=!0;for(let u=0;u<a.length;u++)if(a[u]!==o.value[u]){s=!1;break}s||(o.value=n)}),(a,n)=>{const s=e.resolveComponent("Label"),u=e.resolveComponent("Button"),t=e.resolveComponent("ComboboxTrigger"),c=e.resolveComponent("ComboboxAnchor"),p=e.resolveComponent("ComboboxInput"),m=e.resolveComponent("ComboboxEmpty"),V=e.resolveComponent("ComboboxItemIndicator"),w=e.resolveComponent("ComboboxItem"),N=e.resolveComponent("ComboboxGroup"),f=e.resolveComponent("ComboboxList"),T=e.resolveComponent("Combobox"),S=e.resolveComponent("CardContent"),k=e.resolveComponent("Card");return e.openBlock(),e.createBlock(k,null,{default:e.withCtx(()=>[e.createVNode(S,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[n[3]||(n[3]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Countries",-1)),e.createElementVNode("div",A,[e.createElementVNode("div",J,[e.createVNode(s,{class:"text-sm mb-2"},{default:e.withCtx(()=>[...n[1]||(n[1]=[e.createTextVNode("For which countries should this option be available?",-1)])]),_:1}),e.createVNode(T,{modelValue:e.unref(o),"onUpdate:modelValue":n[0]||(n[0]=x=>e.isRef(o)?o.value=x:null),multiple:!0},{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(t,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(u,{variant:"outline",class:"justify-between"},{default:e.withCtx(()=>[e.createElementVNode("span",K,e.toDisplayString(e.unref(o)?.length>0?e.unref(o).slice(0,4).map(x=>e.unref(y.rawCountries).find(b=>b.cca2===x)?.name.common).join(", "):"Select countries"),1),e.createVNode(e.unref(g.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(p,{class:"pl-9 focus-visible:ring-0 border-0 border-b rounded-none h-10",placeholder:"Find country..."}),e.createElementVNode("span",X,[e.createVNode(e.unref(g.Search),{class:"size-4 text-muted-foreground"})])]),e.createVNode(m,null,{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode(" No countries found. ",-1)])]),_:1}),e.createVNode(N,{class:"max-h-72 overflow-y-scroll"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y.rawCountries),x=>(e.openBlock(),e.createBlock(w,{key:x.cca2,value:x.cca2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.flag)+" ",1),e.createElementVNode("span",Z,e.toDisplayString(x.name.common),1),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(e.unref(g.Check),{class:"size-4"})]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.unref(d).countries?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(e.unref(d).countries),1)):e.createCommentVNode("",!0)])]),e.unref(o)?.length>0?(e.openBlock(),e.createElementBlock("div",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),x=>(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,e.toDisplayString(e.unref(y.rawCountries).find(b=>b.cca2===x)?.flag),1),e.createElementVNode("p",te,e.toDisplayString(e.unref(y.rawCountries).find(b=>b.cca2===x)?.name.common),1),e.createVNode(u,{variant:"ghost",size:"icon",onClick:b=>o.value=e.unref(o).filter(O=>O!==x),class:"hidden group-hover:flex ml-auto size-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.X),{class:"size-3"})]),_:1},8,["onClick"])]))),256))])):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ne={class:"flex items-center space-x-2"},le={class:"flex items-center space-x-2"},se={class:"flex items-center space-x-2"},ie={key:0,class:"flex gap-2 w-full mt-4"},re={class:"flex flex-col gap-4 w-full"},ae={class:"flex flex-col gap-2"},ce={class:"relative"},de={key:0,class:"text-red-500 text-sm mt-1"},ue={class:"flex flex-col gap-4 w-full"},pe={class:"flex flex-col gap-2"},me={class:"relative"},fe={key:0,class:"text-red-500 text-sm mt-1"},xe={key:1,class:"flex gap-2 w-full mt-4"},_e={class:"flex flex-col gap-4 w-full"},Ce={class:"flex flex-col gap-2"},ve={class:"relative"},Ve={key:0,class:"text-red-500 text-sm mt-1"},Ne={class:"flex flex-col gap-4 w-full"},ge={class:"flex flex-col gap-2"},be={class:"relative"},he={key:0,class:"text-red-500 text-sm mt-1"},we=e.defineComponent({__name:"Condition",setup(B){const d=e.inject("isLoadingCompleted",e.ref(!1)),{errors:o}=l.useFormContext(),{value:a}=l.useField("condition"),{value:n}=l.useField("condition_min"),{value:s}=l.useField("condition_max");return(u,t)=>{const c=e.resolveComponent("RadioGroupItem"),p=e.resolveComponent("Label"),m=e.resolveComponent("RadioGroup"),V=e.resolveComponent("Input"),w=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(w,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[t[16]||(t[16]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Condition",-1)),t[17]||(t[17]=e.createElementVNode("p",null," Specify when this option should be available ",-1)),e.createVNode(m,{"default-value":"always",modelValue:e.unref(a),"onUpdate:modelValue":t[0]||(t[0]=f=>e.isRef(a)?a.value=f:null),class:e.normalizeClass(["flex flex-col transition-all duration-300",{"opacity-0 pointer-events-none":!e.unref(d)}])},{default:e.withCtx(()=>[e.createElementVNode("div",ne,[e.createVNode(c,{id:"always",value:"always"}),e.createVNode(p,{for:"always"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Always",-1)])]),_:1})]),e.createElementVNode("div",le,[e.createVNode(c,{id:"weight_based",value:"weight_based"}),e.createVNode(p,{for:"weight_based"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("Weight based",-1)])]),_:1})]),e.createElementVNode("div",se,[e.createVNode(c,{id:"price_based",value:"price_based"}),e.createVNode(p,{for:"price_based"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Price based",-1)])]),_:1})])]),_:1},8,["modelValue","class"]),e.unref(a)==="weight_based"?(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",re,[e.createElementVNode("div",ae,[e.createVNode(p,{for:"condition_min",class:"text-sm"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Minimum weight",-1)])]),_:1}),e.createElementVNode("div",ce,[e.createVNode(V,{type:"number",id:"condition_min",min:"0",placeholder:"0",modelValue:e.unref(n),"onUpdate:modelValue":t[1]||(t[1]=f=>e.isRef(n)?n.value=f:null),class:"no-spinner pr-10"},null,8,["modelValue"]),t[9]||(t[9]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground"},"kg",-1))]),e.unref(o).condition_min?(e.openBlock(),e.createElementBlock("p",de,e.toDisplayString(e.unref(o).condition_min),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ue,[e.createElementVNode("div",pe,[e.createVNode(p,{for:"condition_max",class:"text-sm"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Maximum weight",-1)])]),_:1}),e.createElementVNode("div",me,[e.createVNode(V,{type:"number",id:"condition_max",min:"0",placeholder:"No limit",modelValue:e.unref(s),"onUpdate:modelValue":t[2]||(t[2]=f=>e.isRef(s)?s.value=f:null),class:"no-spinner pr-10"},null,8,["modelValue"]),t[11]||(t[11]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground"},"kg",-1))]),e.unref(o).condition_max?(e.openBlock(),e.createElementBlock("p",fe,e.toDisplayString(e.unref(o).condition_max),1)):e.createCommentVNode("",!0)])])])):e.unref(a)==="price_based"?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",_e,[e.createElementVNode("div",Ce,[e.createVNode(p,{for:"condition_min",class:"text-sm"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Minimum price",-1)])]),_:1}),e.createElementVNode("div",ve,[e.createVNode(V,{type:"number",id:"condition_min",min:"0",placeholder:"0, 00",modelValue:e.unref(n),"onUpdate:modelValue":t[3]||(t[3]=f=>e.isRef(n)?n.value=f:null),class:"no-spinner pl-8"},null,8,["modelValue"]),t[13]||(t[13]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground"},"€",-1))]),e.unref(o).condition_min?(e.openBlock(),e.createElementBlock("p",Ve,e.toDisplayString(e.unref(o).condition_min),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ne,[e.createElementVNode("div",ge,[e.createVNode(p,{for:"condition_max",class:"text-sm"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Maximum price",-1)])]),_:1}),e.createElementVNode("div",be,[e.createVNode(V,{type:"number",id:"condition_max",min:"0",placeholder:"No limit",modelValue:e.unref(s),"onUpdate:modelValue":t[4]||(t[4]=f=>e.isRef(s)?s.value=f:null),class:"no-spinner pl-8"},null,8,["modelValue"]),t[15]||(t[15]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground"},"€",-1))]),e.unref(o).condition_max?(e.openBlock(),e.createElementBlock("p",he,e.toDisplayString(e.unref(o).condition_max),1)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ke={class:"flex gap-2 rounded-lg p-2 bg-white text-black overflow-hidden shadow border"},ye={class:"w-full overflow-hidden"},Ee={class:"truncate"},Be={key:0,class:"text-sm text-muted-foreground"},$e={class:"ml-auto shrink-0"},Se={class:"font-bold"},Te=e.defineComponent({__name:"Example",setup(B){const{value:d}=l.useField("title"),{value:o}=l.useField("description"),{value:a}=l.useField("price");return(n,s)=>{const u=e.resolveComponent("CardContent"),t=e.resolveComponent("Card");return e.openBlock(),e.createBlock(t,null,{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[s[1]||(s[1]=e.createElementVNode("p",{class:"text-md font-semibold mb-2"},"Example",-1)),e.createElementVNode("div",ke,[s[0]||(s[0]=e.createElementVNode("div",{class:"pt-1 shrink-0"},[e.createElementVNode("div",{class:"size-4 rounded-full bg-primary flex items-center justify-center"},[e.createElementVNode("div",{class:"size-2 rounded-full bg-white"})])],-1)),e.createElementVNode("div",ye,[e.createElementVNode("p",Ee,e.toDisplayString(e.unref(d)||"Option Name"),1),e.unref(o)?(e.openBlock(),e.createElementBlock("p",Be,e.toDisplayString(e.unref(o)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",$e,[e.createElementVNode("p",Se,e.toDisplayString(e.unref(a)?"€"+e.unref(a).toFixed(2):"FREE"),1)])])]),_:1})]),_:1})}}}),Oe={class:"relative @container"},Ie={class:"flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6"},De={class:"flex items-center"},Me={class:"text-lg font-semibold mx-2"},Fe={class:"flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24"},Le={class:"flex flex-col gap-4 w-full @3xl:w-2/3"},Re={class:"flex flex-col gap-4 w-full @3xl:w-1/3"},ze={key:0,class:"fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"},Ue={class:"w-full max-w-5xl flex items-center justify-end mx-auto"},je=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},setup(B){const d=B,{hasPermission:o,hasAnyPermission:a}=$.useModulePermissions(),{params:n,navigateTo:s}=$.useModuleRoute(),{confirm:u}=$.useConfirmation(),t=$.useFirebaseIntegration(d.config.project),c=e.computed(()=>!n.value.optionId||n.value.optionId==="new"),p=e.ref(!1),m=e.ref(!1),V=l.toTypedSchema(l.objectType({id:l.stringType().optional(),status:l.stringType().optional(),title:l.stringType().min(1,"Title is required"),description:l.stringType().optional(),price:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional()),countries:l.arrayType(l.stringType()).optional(),condition:l.stringType(),condition_min:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional()),condition_max:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional())})),{handleSubmit:w,errors:N,values:f,setValues:T}=l.useForm({validationSchema:V,initialValues:{status:"published",countries:[],condition:"always"}});$.useModuleBreadcrumbs(()=>[{text:f.title??"New Option"}]);const S=w(async r=>{m.value=!0;let i=await k()||[];if(c.value){let _=JSON.parse(JSON.stringify(r));_.id=crypto.randomUUID();const v=[...i,_],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(_.id),E.toast.success("Shipping option created")}else{let _=JSON.parse(JSON.stringify(r));const v=i.map(h=>h.id===n.value.optionId?_:h),C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(`${n.value.optionId}`),E.toast.success("Shipping option updated")}m.value=!1}),k=async()=>{if(!d.config.shippingOptionsCollection)return[];const r=d.config.shippingOptionsCollection.split(":");return r.length!==2?[]:(await t.get(r[0]))?.[r[1]]||[]},x=async()=>{const i=(await k()).find(_=>_.id===n.value.optionId);T(i),p.value=!0},b=async()=>{try{const r=await k();let i={...[...r||[]].find(h=>h.id===n.value.optionId)};console.log(r,n.value.optionId,r.find(h=>h.id===n.value.optionId)),i.id=crypto.randomUUID(),i.status="published",i.title=i.title+" (copy)";const v=[...await k()||[],i],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(i.id),E.toast.success("Option duplicated")}catch{E.toast.error("Failed to duplicate option")}},O=async()=>{if(await u("Are you sure you want to delete this option?"))try{const i=await k()||[];if(i.length===0||!n.value.optionId)throw new Error("Error loading values");const _=i.filter(C=>C.id!==n.value.optionId),v=d.config.shippingOptionsCollection.split(":");await t.update(v[0],null,{[v[1]]:_}),s(""),E.toast.success("Option deleted")}catch{E.toast.error("Failed to delete option")}};return e.onMounted(()=>{c.value?p.value=!0:x()}),e.provide("isLoadingCompleted",p),(r,i)=>{const _=e.resolveComponent("Button"),v=e.resolveComponent("MenubarTrigger"),C=e.resolveComponent("MenubarMenu"),h=e.resolveComponent("MenubarItem"),I=e.resolveComponent("MenubarContent"),D=e.resolveComponent("Menubar");return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",Ie,[e.createElementVNode("div",De,[e.createVNode(_,{variant:"ghost",onClick:i[0]||(i[0]=Pe=>e.unref(s)(""))},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(g.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Me,e.toDisplayString(c.value?"New Option":e.unref(f).title),1)]),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(D,{key:0,class:"bg-sidebar"},{default:e.withCtx(()=>[e.unref(o)("create-collection")?(e.openBlock(),e.createBlock(C,{key:0},{default:e.withCtx(()=>[e.createVNode(v,{onClick:b},{default:e.withCtx(()=>[...i[1]||(i[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(a)("edit-collection","delete-option")?(e.openBlock(),e.createBlock(C,{key:1},{default:e.withCtx(()=>[e.createVNode(v,null,{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.unref(o)("delete-option")?(e.openBlock(),e.createBlock(h,{key:0,variant:"destructive",onClick:O},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Trash),{class:"size-4"}),i[3]||(i[3]=e.createTextVNode(" Delete option ",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1}))]),e.createElementVNode("div",Fe,[e.createElementVNode("div",Le,[e.createVNode(G),e.createVNode(oe),e.createVNode(we)]),e.createElementVNode("div",Re,[e.createVNode(Te)])]),e.unref(a)("create-option","edit-option")?(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",Ue,[c.value&&e.unref(o)("create-option")?(e.openBlock(),e.createBlock(_,{key:0,onClick:e.unref(S),disabled:m.value},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(g.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(m.value?"Creating":"Create")+" New Option ",1)]),_:1},8,["onClick","disabled"])):e.unref(o)("edit-option")?(e.openBlock(),e.createBlock(_,{key:1,onClick:e.unref(S),disabled:m.value},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(g.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(m.value?"Saving":"Save")+" Changes ",1)]),_:1},8,["onClick","disabled"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])}}});exports.default=je;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("@oneclick.dev/cms-kit"),o=require("./TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js"),s={class:"relative"},i=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},setup(r){const c=r;t.useModuleBreadcrumbs(()=>[]),t.useFirebaseIntegration(c.config.project);const n=async()=>{};return e.onMounted(()=>{n()}),(u,a)=>(e.openBlock(),e.createElementBlock("div",s,[e.createVNode(o._sfc_main)]))}});exports.default=i;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),P=require("lucide-vue-next"),g=require("@oneclick.dev/cms-kit"),K=require("./interpolation-BNUjI7LH.js"),N=require("./index-ijdf0d9-.js"),H={class:"flex items-center gap-2"},O={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},W={key:0},G={key:1},Q={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},X={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},J=["href"],Y=["href"],Z=e.defineComponent({__name:"ListView",props:{entries:{type:Array,required:!0}},setup($){const a=e.inject("selection"),f=e.inject("collection"),y=$,{config:c}=g.useModule(),{navigateTo:s,params:b}=g.useModuleRoute(),{hasPermission:x}=g.useModulePermissions(),i=(n,t)=>{n?a.value.push(t):a.value=a.value.filter(r=>r!==t)},v=n=>{if(!f.value)return"about:blank";let t=c.domain?.trim(),r=f.value.defaultLanguageRoutePattern?.trim();if(console.log("waza",{domain:t,pattern:r,entry:n}),!t||!r)return"about:blank";t.endsWith("/")&&(t=t.slice(0,-1)),r.startsWith("/")||(r="/"+r);const p=n.liveByLocale.find(u=>u.locale===c.defaultLanguage)?.slug;return K.interpolateTemplateFromVariableContext(t+r,[{name:"slug",value:p},{name:"id",value:n.id},{name:"lang",value:c.defaultLanguage||"en"}])},k=n=>`${(window.location.origin+window.location.pathname).replace(/\/$/,"")}/${n.id}`,C=e.computed(()=>y.entries?.map(n=>({...n,status:n.archived?"archived":n.liveByLocale&&n.liveByLocale.length>0?"published":"draft",publishProgress:{completed:n.liveByLocale.length,total:c.supportedLanguages?.length||1}}))||[]);return(n,t)=>{const r=e.resolveComponent("TableHead"),p=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),w=e.resolveComponent("Checkbox"),h=e.resolveComponent("TableCell"),E=e.resolveComponent("Button"),_=e.resolveComponent("TableBody"),T=e.resolveComponent("Table"),S=e.resolveComponent("Card");return e.openBlock(),e.createBlock(S,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(T,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(p,null,{default:e.withCtx(()=>[e.unref(a)?.length>0?(e.openBlock(),e.createBlock(r,{key:0})):e.createCommentVNode("",!0),e.createVNode(r,{class:"capitalize"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)?.contentEntryName||"entry"),1)]),_:1}),e.createVNode(r,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Last updated at",-1)])]),_:1}),e.createVNode(r,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(r,{class:"text-right"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Edit",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(_,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,d=>(e.openBlock(),e.createBlock(p,{key:d.id,onClick:m=>e.unref(s)("collections/"+e.unref(b).collectionId+"/"+d.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(a)?.length>0?(e.openBlock(),e.createBlock(h,{key:0},{default:e.withCtx(()=>[e.createVNode(w,{"model-value":e.unref(a)?.includes(d.id),"onUpdate:modelValue":m=>i(m,d.id),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(h,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createElementVNode("span",null,e.toDisplayString(d.title),1)])]),_:2},1024),e.createVNode(h,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.updated?.at?new Date(d.updated.at).toLocaleString():"N/A"),1)]),_:2},1024),e.createVNode(h,null,{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("span",O,[d.publishProgress.completed===d.publishProgress.total?(e.openBlock(),e.createElementBlock("span",W,"Published")):(e.openBlock(),e.createElementBlock("span",G,"Partly Published ("+e.toDisplayString(d.publishProgress.completed)+"/"+e.toDisplayString(d.publishProgress.total)+")",1))])):d.status==="draft"?(e.openBlock(),e.createElementBlock("span",Q,"Draft")):d.status==="archived"?(e.openBlock(),e.createElementBlock("span",X,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(h,{class:"text-right"},{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("a",{key:0,href:v(d),target:"_blank",rel:"noreferrer",onClick:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(E,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Globe),{class:"size-4"})]),_:1})],8,J)):e.createCommentVNode("",!0),e.createElementVNode("a",{href:k(d),rel:"noreferrer",onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(E,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Pencil),{class:"size-4"})]),_:1})],8,Y)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),ee={class:"flex items-center space-x-2 mb-4"},te={for:"chk_published_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},oe={class:"flex items-center space-x-2 mb-4"},ne={for:"chk_draft_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},le={class:"flex items-center space-x-2 mb-4"},ae={for:"chk_archived_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},re=e.defineComponent({__name:"FilterPopover",setup($){const a=e.inject("filter"),f=e.ref(""),y=()=>{a.value={published:!0,draft:!0,archived:!1}};return(c,s)=>{const b=e.resolveComponent("Button"),x=e.resolveComponent("PopoverTrigger"),i=e.resolveComponent("Checkbox"),v=e.resolveComponent("PopoverContent"),k=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(k,null,{default:e.withCtx(()=>[e.createVNode(x,{asChild:""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Filter),{class:"size-4"}),s[3]||(s[3]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(v,{class:"w-64"},{default:e.withCtx(()=>[s[5]||(s[5]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",ee,[e.createVNode(i,{id:"chk_published_entries",modelValue:e.unref(a).published,"onUpdate:modelValue":s[0]||(s[0]=C=>e.unref(a).published=C)},null,8,["modelValue"]),e.createElementVNode("label",te," Show published "+e.toDisplayString(f.value||"entries"),1)]),e.createElementVNode("div",oe,[e.createVNode(i,{id:"chk_draft_entries",modelValue:e.unref(a).draft,"onUpdate:modelValue":s[1]||(s[1]=C=>e.unref(a).draft=C)},null,8,["modelValue"]),e.createElementVNode("label",ne," Show draft "+e.toDisplayString(f.value||"entries"),1)]),e.createElementVNode("div",le,[e.createVNode(i,{id:"chk_archived_entries",modelValue:e.unref(a).archived,"onUpdate:modelValue":s[2]||(s[2]=C=>e.unref(a).archived=C)},null,8,["modelValue"]),e.createElementVNode("label",ae," Show archived "+e.toDisplayString(f.value||"entries"),1)]),!e.unref(a).published||!e.unref(a).draft||e.unref(a).archived?(e.openBlock(),e.createBlock(b,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:y},{default:e.withCtx(()=>[e.createVNode(e.unref(P.RotateCcw),{class:"size-3"}),s[4]||(s[4]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),se=e.defineComponent({__name:"ContentEntryContextMenu",emits:["selectAll","duplicateEntry","deleteEntry","deleteSelection"],setup($,{emit:a}){const f=a,y=e.inject("entries"),c=e.inject("selection"),s=e.inject("config"),{hasPermission:b}=g.useModulePermissions(),{navigateTo:x}=g.useModuleRoute(),i=e.computed(()=>c.value?.length!==1?null:y.value?.find(n=>n.id===c.value[0])),v=n=>{let t=s.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",n.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",n.slug),window.open(t,"_blank")},k=async(n,t)=>{try{if(!["draft","published","archived"].includes(t))return;await g.useFirebaseIntegration(s.project).update(s.contentCollection,n.id,{status:t}),n.status=t,N.toast.success("Entry status changed")}catch{N.toast.error("Failed to change entry status")}},C=async n=>{try{if(!["draft","published","archived"].includes(n))return;const t=g.useFirebaseIntegration(s.project),r=[];c.value.forEach(async p=>{r.push(t.update(s.contentCollection,p,{status:n}))}),N.toast.promise(Promise.all(r),{loading:`Changing status of ${c.value.length} entries...`,success:()=>{const p=c.value.length;return c.value.forEach(u=>{y.value.find(w=>w.id==u).status=n}),c.value=[],`Entry status changed for ${p} entries`},error:p=>"Failed to change entry status"})}catch{N.toast.error("Failed to change entry status")}};return(n,t)=>{const r=e.resolveComponent("ContextMenuTrigger"),p=e.resolveComponent("ContextMenuShortcut"),u=e.resolveComponent("ContextMenuItem"),w=e.resolveComponent("ContextMenuContent"),h=e.resolveComponent("ContextMenuSeparator"),E=e.resolveComponent("ContextMenuSubTrigger"),_=e.resolveComponent("ContextMenuCheckboxItem"),T=e.resolveComponent("ContextMenuSubContent"),S=e.resolveComponent("ContextMenuSub"),d=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(d,null,{default:e.withCtx(()=>[e.createVNode(r,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3}),e.unref(c).length===0?(e.openBlock(),e.createBlock(w,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[0]||(t[0]=m=>f("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(p,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length===1&&i.value?(e.openBlock(),e.createBlock(w,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[1]||(t[1]=m=>e.unref(x)(i.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit entry ",-1)])]),_:1}),e.createVNode(h),e.unref(s).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u,{inset:"",onClick:t[2]||(t[2]=m=>v(i.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview entry ",-1)),e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(e.unref(P.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(h)],64)):e.createCommentVNode("",!0),e.createVNode(u,{inset:"",onClick:t[3]||(t[3]=m=>f("duplicateEntry",i.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate entry ",-1)])]),_:1}),e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(E,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(T,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(_,{onClick:t[4]||(t[4]=m=>k(i.value,"draft")),modelValue:i.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(_,{onClick:t[5]||(t[5]=m=>k(i.value,"published")),modelValue:i.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(_,{onClick:t[6]||(t[6]=m=>k(i.value,"archived")),modelValue:i.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(u,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=m=>f("deleteEntry",i.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete entry ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length>1?(e.openBlock(),e.createBlock(w,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(E,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1}),e.createVNode(T,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(_,{onClick:t[8]||(t[8]=m=>C("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(_,{onClick:t[9]||(t[9]=m=>C("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(_,{onClick:t[10]||(t[10]=m=>C("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(u,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=m=>f("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete entries ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),ie={key:0,class:"relative flex flex-col flex-1"},ce={class:"flex items-center justify-between gap-4 w-full my-4"},de={ref:"container",class:"flex items-center justify-between gap-4 w-full mb-8"},ue={class:"flex items-center gap-4"},pe={class:"text-lg whitespace-nowrap"},me={class:"relative w-full max-w-sm items-center"},fe={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ve={class:"flex items-center gap-4"},Ce={class:"capitalize"},ge={class:"flex flex-1"},xe=e.defineComponent({__name:"Entries",props:{config:{type:Object,required:!0}},setup($){const a=$,{hasPermission:f,isAdmin:y}=g.useModulePermissions(),{params:c,navigateTo:s}=g.useModuleRoute(),{confirm:b}=g.useConfirmation(),x=g.useFirebaseIntegration(a.config.project),i=e.ref(null),v=e.ref([]);g.useModuleBreadcrumbs(()=>[{text:i.value?.name??""}]);const k=async()=>{const l=await x.get(a.config.collectionsCollection,c.value.collectionId);l?i.value=l:(s("/"),N.toast.error("Collection not found"))},C=async()=>{const l=await x.find(a.config.contentCollection,{filters:[{field:"collectionId",operator:"==",value:c.value.collectionId}]});v.value=l||[]},n=e.ref(1),t=e.ref([]),r=e.ref(""),p=e.ref(10),u=e.computed(()=>v.value.filter(l=>l.title.toLowerCase().includes(r.value.toLowerCase())||l.slug.toLowerCase().includes(r.value.toLowerCase())||l.id.toLowerCase().includes(r.value.toLowerCase()))),w=e.computed(()=>{if(u.value.length<=p.value)return u.value;const l=(n.value-1)*p.value,o=l+p.value;return u.value.slice(l,o)});async function h(l){return(await x.find(a.config.contentCollection,{filters:[{field:"slug",operator:"==",value:l}]})).length>0}const E=()=>{t.value=w.value.map(l=>l.id)},_=async l=>{try{let o={...l},V=o.slug+"-copy",L=2;for(;await h(V);)V=o.slug+"-copy-"+L,L++;o.id=void 0,o.createdAt=new Date,o.updatedAt=new Date,o.slug=V,o.status="draft",o.title=o.title+" (copy)";const D=await x.add(a.config.contentCollection,o);s(D.id),N.toast.success("Entry duplicated")}catch{N.toast.error("Failed to duplicate entry")}},T=async l=>{if(await b(`Are you sure you want to delete "${l.title}"?`))try{await x.remove(a.config.contentCollection,l.id),v.value=v.value.filter(V=>V.id!==l.id),t.value=[],N.toast.success("Entry deleted")}catch{N.toast.error("Failed to delete entry")}},S=async()=>{if(await b(`Are you sure you want to delete all selected ${i?.contentEntryNamePlural||"entries"} (${t.value.length})?`))try{t.value.forEach(async o=>{await x.remove(a.config.contentCollection,o)}),v.value=v.value.filter(o=>!t.value.includes(o.id)),t.value=[],N.toast.success("Entries deleted")}catch{N.toast.error("Failed to delete entries")}},d=e.ref({published:!0,draft:!0,archived:!1});e.watch(d,()=>{n.value=1});const m=l=>{l.target?.matches("input, textarea")||l.target?.isContentEditable||(l.key==="Escape"&&(t.value=[]),(l.metaKey||l.ctrlKey)&&l.key.toLowerCase()==="a"&&(l.preventDefault(),E()))};return e.onMounted(()=>{k(),C(),window.addEventListener("keydown",m)}),e.onUnmounted(()=>{window.removeEventListener("keydown",m)}),e.provide("config",a.config),e.provide("filter",d),e.provide("entries",v),e.provide("selection",t),e.provide("collection",i),(l,o)=>{const V=e.resolveComponent("Button"),L=e.resolveComponent("Input"),D=e.resolveComponent("PaginationFirst"),F=e.resolveComponent("PaginationPrev"),I=e.resolveComponent("PaginationListItem"),A=e.resolveComponent("PaginationEllipsis"),U=e.resolveComponent("PaginationNext"),j=e.resolveComponent("PaginationLast"),R=e.resolveComponent("PaginationList"),q=e.resolveComponent("Pagination");return i.value?(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",ce,[e.createVNode(V,{onClick:o[0]||(o[0]=B=>e.unref(s)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.ChevronLeft),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createElementVNode("p",pe,e.toDisplayString(u.value?.length)+" "+e.toDisplayString(i.value?.contentEntryNamePlural||"entries"),1),e.createElementVNode("div",me,[e.createVNode(L,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:o[1]||(o[1]=e.withKeys(B=>r.value="",["escape"])),modelValue:r.value,"onUpdate:modelValue":o[2]||(o[2]=B=>r.value=B)},null,8,["modelValue"]),e.createElementVNode("span",fe,[e.createVNode(e.unref(P.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ve,[t.value.length>0?(e.openBlock(),e.createBlock(V,{key:0,variant:"destructive",onClick:S},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(t.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(y)()||e.unref(f)("create-entry")&&i.value?.allowUserEntryManagement?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(c)?.collectionId?(e.openBlock(),e.createBlock(V,{key:0,variant:"outline",onClick:o[3]||(o[3]=B=>e.unref(s)(`collections/${e.unref(c).collectionId}/new`))},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Plus),{class:"size-4"}),e.createElementVNode("span",null,[o[6]||(o[6]=e.createTextVNode(" New ",-1)),e.createElementVNode("span",Ce,e.toDisplayString(i.value?.contentEntryName||"entry"),1)])]),_:1})):e.createCommentVNode("",!0),o[7]||(o[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(re)])],512),e.createElementVNode("div",ge,[e.createVNode(se,{onSelectAll:E,onDuplicateEntry:_,onDeleteEntry:T,onDeleteSelection:S},{default:e.withCtx(()=>[e.createVNode(Z,{entries:w.value},null,8,["entries"])]),_:1})]),u.value?.length>p.value?(e.openBlock(),e.createBlock(q,{key:0,page:n.value,"onUpdate:page":o[4]||(o[4]=B=>n.value=B),"items-per-page":p.value,total:u.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(R,{class:"flex items-center gap-1"},{default:e.withCtx(({items:B})=>[e.createVNode(D),e.createVNode(F),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B,(M,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[M.type==="page"?(e.openBlock(),e.createBlock(I,{key:z,value:M.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(V,{class:"size-10 p-0",variant:M.value===n.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(M.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(A,{key:M.type,index:z},null,8,["index"]))],64))),256)),e.createVNode(U),e.createVNode(j)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}});exports.default=xe;
|