@oneclick.dev/cms-core-modules 0.0.119 → 0.0.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{ContentEditor-BnOVpmsQ.js → ContentEditor-Dl41qaCh.js} +42 -41
  2. package/dist/{ContentEditor-Cm28u_14.mjs → ContentEditor-u3k-uTny.mjs} +4785 -4492
  3. package/dist/{Detail-C8wQiDcv.js → Detail-BCUUNWvp.js} +1 -1
  4. package/dist/{Detail-CtItxMX4.mjs → Detail-B_scnidb.mjs} +1 -1
  5. package/dist/Detail-Cn9Bk0u0.mjs +852 -0
  6. package/dist/Detail-DGg_xXZc.js +1 -0
  7. package/dist/Detail-Dk8E6_uF.mjs +3731 -0
  8. package/dist/Detail-Sc2qZdxj.js +1 -0
  9. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-4_t0PPqM.mjs +78 -0
  10. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js +1 -0
  11. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +1 -0
  12. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs +1500 -0
  13. package/dist/Overview-CVgViW3c.mjs +852 -0
  14. package/dist/Overview-DEF-z7Yb.js +1 -0
  15. package/dist/Overview-Tf_ApkWh.js +1 -0
  16. package/dist/{Overview-CVQ1pkuD.mjs → Overview-usm5gPD1.mjs} +131 -131
  17. package/dist/{agenda-BtmnpFmi.js → agenda-B54F8cEr.js} +1 -1
  18. package/dist/{agenda-D0QBOJUy.mjs → agenda-BCKDYOeF.mjs} +7 -7
  19. package/dist/{availability-ClBGVgE9.js → availability-C4v46rha.js} +1 -1
  20. package/dist/{availability-D8JdA4rP.mjs → availability-DVT1Mdxq.mjs} +1 -1
  21. package/dist/{booking-data-aMS1p_3g.js → booking-data-A5JrLY4j.js} +1 -1
  22. package/dist/{booking-data-Px7XCIfU.mjs → booking-data-lZvSYna2.mjs} +1 -1
  23. package/dist/cms-core-modules.css +1 -1
  24. package/dist/{exceptions-Dgj54ULn.mjs → exceptions-DJHfvADv.mjs} +1 -1
  25. package/dist/{exceptions-DXqc0Nza.js → exceptions-DKc8fO1S.js} +1 -1
  26. package/dist/index-Bk3yLv_G.js +35 -0
  27. package/dist/{index-Dnn2SCSl.js → index-CZau1wR8.js} +1 -1
  28. package/dist/{index-DRqJOqUR.mjs → index-DE8rdSjd.mjs} +0 -22
  29. package/dist/index-DU3Ib10Z.mjs +1256 -0
  30. package/dist/index.cjs.js +1 -1
  31. package/dist/index.mjs +35 -33
  32. package/dist/orders-BMosTk6r.js +1 -0
  33. package/dist/{orders-C5NT99Fy.mjs → orders-CElKNc1v.mjs} +229 -234
  34. package/dist/{payment-D5j-68Ig.mjs → payment-DSQ_2FIT.mjs} +1 -1
  35. package/dist/{payment-BJHgpaeT.js → payment-DlgYuea2.js} +1 -1
  36. package/dist/{refunds-oVB2Opib.js → refunds-Cvw9N--u.js} +1 -1
  37. package/dist/{refunds-D9nTeD2d.mjs → refunds-xR936Ted.mjs} +1 -1
  38. package/dist/reports-BQT_GZzU.js +158 -0
  39. package/dist/reports-DksZCTOw.mjs +837 -0
  40. package/dist/{resources-CK0oWssj.mjs → resources-C-5BU9Ux.mjs} +1 -1
  41. package/dist/{resources-8WouFvJe.js → resources-D04yKKVN.js} +1 -1
  42. package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +2 -0
  43. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +1 -0
  44. package/dist/src/productCollections/components/detail/Subcollections.vue.d.ts +2 -0
  45. package/dist/src/productCollections/types.d.ts +1 -4
  46. package/dist/src/products/components/detail/variants/VariantList.vue.d.ts +48 -6
  47. package/dist/src/products/components/detail/variants/dialogs/VariantDialog.vue.d.ts +4 -0
  48. package/dist/{vee-validate-zod-CcOwoF6y.mjs → vee-validate-zod-SjDT8X35.mjs} +92 -90
  49. package/dist/{vee-validate-zod-ByykgYKJ.js → vee-validate-zod-VCmLnrtQ.js} +1 -1
  50. package/package.json +2 -2
  51. package/dist/Detail-C1Blq61w.mjs +0 -585
  52. package/dist/Detail-CPqug27l.js +0 -1
  53. package/dist/Detail-CjuhjPby.js +0 -1
  54. package/dist/Detail-Dnpnmy4-.mjs +0 -3477
  55. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +0 -1
  56. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +0 -77
  57. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CcMEKZzd.mjs +0 -1476
  58. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CkFsdcvP.js +0 -1
  59. package/dist/Overview-BWLxUksJ.mjs +0 -860
  60. package/dist/Overview-CBahJviK.js +0 -1
  61. package/dist/Overview-DAxCu9XC.js +0 -1
  62. package/dist/index-BnFWz40Q.mjs +0 -1261
  63. package/dist/index-DcGPR_vt.js +0 -35
  64. package/dist/orders-lO3dZ5un.js +0 -1
  65. /package/dist/src/{productCollections/components/detail/SEO.vue.d.ts → appointments/pages/edit/reports.vue.d.ts} +0 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./vee-validate-zod-ByykgYKJ.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:i}=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"),h=e.resolveComponent("Card");return e.openBlock(),e.createBlock(h,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(i),"onUpdate:modelValue":t[0]||(t[0]=N=>e.isRef(i)?i.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,i=>{let n=i?.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<i.length;u++)if(i[u]!==o.value[u]){s=!1;break}s||(o.value=n)}),(i,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"),h=e.resolveComponent("ComboboxItem"),N=e.resolveComponent("ComboboxGroup"),f=e.resolveComponent("ComboboxList"),T=e.resolveComponent("Combobox"),S=e.resolveComponent("CardContent"),w=e.resolveComponent("Card");return e.openBlock(),e.createBlock(w,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(h,{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"},re={key:0,class:"flex gap-2 w-full mt-4"},ie={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:i}=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"),h=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(h,{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(i),"onUpdate:modelValue":t[0]||(t[0]=f=>e.isRef(i)?i.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(i)==="weight_based"?(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("div",ie,[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(i)==="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:i}=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(i)?"€"+e.unref(i).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:i}=$.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(a=>a===""?void 0:a,l.coerce.number().positive("Must be positive").optional()),countries:l.arrayType(l.stringType()).optional(),condition:l.stringType(),condition_min:l.preprocessType(a=>a===""?void 0:a,l.coerce.number().positive("Must be positive").optional()),condition_max:l.preprocessType(a=>a===""?void 0:a,l.coerce.number().positive("Must be positive").optional())})),{handleSubmit:h,errors:N,values:f,setValues:T}=l.useForm({validationSchema:v,initialValues:{status:"published",countries:[],condition:"always"}});$.useModuleBreadcrumbs(()=>[{text:f.title??"New Option"}]);const S=h(async a=>{m.value=!0;let r=await w()||[];if(c.value){let _=JSON.parse(JSON.stringify(a));_.id=crypto.randomUUID();const V=[...r,_],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(a));const V=r.map(k=>k.id===n.value.optionId?_:k),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}),w=async()=>{if(!d.config.shippingOptionsCollection)return[];const a=d.config.shippingOptionsCollection.split(":");return a.length!==2?[]:(await t.get(a[0]))?.[a[1]]||[]},x=async()=>{const r=(await w()).find(_=>_.id===n.value.optionId);T(r),p.value=!0},b=async()=>{try{let r={...[...await w()||[]].find(k=>k.id===n.value.optionId)};r.id=crypto.randomUUID(),r.status="published",r.title=r.title+" (copy)";const V=[...await w()||[],r],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:V}),s(r.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 r=await w()||[];if(r.length===0||!n.value.optionId)throw new Error("Error loading values");const _=r.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),(a,r)=>{const _=e.resolveComponent("Button"),V=e.resolveComponent("MenubarTrigger"),C=e.resolveComponent("MenubarMenu"),k=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:r[0]||(r[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(()=>[...r[1]||(r[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(i)("edit-collection","delete-option")?(e.openBlock(),e.createBlock(C,{key:1},{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.unref(o)("delete-option")?(e.openBlock(),e.createBlock(k,{key:0,variant:"destructive",onClick:O},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Trash),{class:"size-4"}),r[3]||(r[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(i)("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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./vee-validate-zod-VCmLnrtQ.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:i}=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"),h=e.resolveComponent("Card");return e.openBlock(),e.createBlock(h,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(i),"onUpdate:modelValue":t[0]||(t[0]=N=>e.isRef(i)?i.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,i=>{let n=i?.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<i.length;u++)if(i[u]!==o.value[u]){s=!1;break}s||(o.value=n)}),(i,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"),h=e.resolveComponent("ComboboxItem"),N=e.resolveComponent("ComboboxGroup"),f=e.resolveComponent("ComboboxList"),T=e.resolveComponent("Combobox"),S=e.resolveComponent("CardContent"),w=e.resolveComponent("Card");return e.openBlock(),e.createBlock(w,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(h,{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"},re={key:0,class:"flex gap-2 w-full mt-4"},ie={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:i}=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"),h=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(h,{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(i),"onUpdate:modelValue":t[0]||(t[0]=f=>e.isRef(i)?i.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(i)==="weight_based"?(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("div",ie,[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(i)==="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:i}=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(i)?"€"+e.unref(i).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:i}=$.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(a=>a===""?void 0:a,l.coerce.number().positive("Must be positive").optional()),countries:l.arrayType(l.stringType()).optional(),condition:l.stringType(),condition_min:l.preprocessType(a=>a===""?void 0:a,l.coerce.number().positive("Must be positive").optional()),condition_max:l.preprocessType(a=>a===""?void 0:a,l.coerce.number().positive("Must be positive").optional())})),{handleSubmit:h,errors:N,values:f,setValues:T}=l.useForm({validationSchema:v,initialValues:{status:"published",countries:[],condition:"always"}});$.useModuleBreadcrumbs(()=>[{text:f.title??"New Option"}]);const S=h(async a=>{m.value=!0;let r=await w()||[];if(c.value){let _=JSON.parse(JSON.stringify(a));_.id=crypto.randomUUID();const V=[...r,_],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(a));const V=r.map(k=>k.id===n.value.optionId?_:k),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}),w=async()=>{if(!d.config.shippingOptionsCollection)return[];const a=d.config.shippingOptionsCollection.split(":");return a.length!==2?[]:(await t.get(a[0]))?.[a[1]]||[]},x=async()=>{const r=(await w()).find(_=>_.id===n.value.optionId);T(r),p.value=!0},b=async()=>{try{let r={...[...await w()||[]].find(k=>k.id===n.value.optionId)};r.id=crypto.randomUUID(),r.status="published",r.title=r.title+" (copy)";const V=[...await w()||[],r],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:V}),s(r.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 r=await w()||[];if(r.length===0||!n.value.optionId)throw new Error("Error loading values");const _=r.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),(a,r)=>{const _=e.resolveComponent("Button"),V=e.resolveComponent("MenubarTrigger"),C=e.resolveComponent("MenubarMenu"),k=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:r[0]||(r[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(()=>[...r[1]||(r[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(i)("edit-collection","delete-option")?(e.openBlock(),e.createBlock(C,{key:1},{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.unref(o)("delete-option")?(e.openBlock(),e.createBlock(k,{key:0,variant:"destructive",onClick:O},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Trash),{class:"size-4"}),r[3]||(r[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(i)("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;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as B, inject as Q, ref as R, resolveComponent as i, openBlock as d, createBlock as O, withCtx as s, createVNode as n, createElementVNode as o, createTextVNode as v, isRef as N, unref as e, createElementBlock as b, toDisplayString as _, createCommentVNode as f, watch as ee, Fragment as X, renderList as H, normalizeClass as te, computed as oe, onMounted as ne, provide as se } from "vue";
2
- import { u as W, a as S, t as le, o as ie, p as J, c as q, s as F, b as ae, f as de } from "./vee-validate-zod-CcOwoF6y.mjs";
2
+ import { u as W, a as S, t as le, o as ie, p as J, c as q, s as F, b as ae, f as de } from "./vee-validate-zod-SjDT8X35.mjs";
3
3
  import { r as j } from "./countries-BTPvmrsb.mjs";
4
4
  import { ChevronsUpDown as re, Search as ce, Check as ue, X as pe, Tag as me, ChevronRight as fe, Trash as _e, Loader2 as K } from "lucide-vue-next";
5
5
  import { useModulePermissions as xe, useModuleRoute as ve, useConfirmation as be, useFirebaseIntegration as ge, useModuleBreadcrumbs as he } from "@oneclick.dev/cms-kit";