@oneclick.dev/cms-core-modules 0.0.101 → 0.0.103
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/Acquisition-Br1Pfny3.js +1 -0
- package/dist/{Acquisition-BJXNY4ko.mjs → Acquisition-CPlZzUBo.mjs} +40 -40
- package/dist/AgendaOpeningHoursCard-B7ROIPWw.js +1 -0
- package/dist/AgendaOpeningHoursCard-Cp4wxUeK.mjs +172 -0
- package/dist/AppointmentListTable-DZJNmTMb.mjs +177 -0
- package/dist/AppointmentListTable-Dieu9US_.js +1 -0
- package/dist/Audience-BfkrmBuQ.js +1 -0
- package/dist/{Audience-CIzVtUvV.mjs → Audience-DTblSAiL.mjs} +89 -89
- package/dist/Content-BHr_rPVY.js +1 -0
- package/dist/{Content-CWhjurn_.mjs → Content-CYOZKvWK.mjs} +56 -56
- package/dist/{ContentEditor-Cjqgb64R.mjs → ContentEditor-B1nfKG_5.mjs} +706 -677
- package/dist/{ContentEditor-YgOS3kxS.js → ContentEditor-DdFU8piH.js} +15 -16
- package/dist/{Create-6uT9HWar.mjs → Create-BRBh0xjM.mjs} +2 -2
- package/dist/{Create-DuZ5nZrX.js → Create-qPeQxkdl.js} +1 -1
- package/dist/{DateFormatter-2B0R-DY4.mjs → DateFormatter-Bw-87W31.mjs} +212 -227
- package/dist/DateFormatter-CYAD4GBN.js +1 -0
- package/dist/{Detail-BZ-iE9vf.js → Detail-C857g62L.js} +1 -1
- package/dist/{Detail-CJVMJDP7.mjs → Detail-CujdFApD.mjs} +2 -2
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +76 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +1 -0
- package/dist/{Entries-DkRhOt95.js → Entries-BaS6H6ak.js} +1 -1
- package/dist/{Entries-dLlCrXXe.mjs → Entries-C8UJkrVC.mjs} +1 -1
- package/dist/{Find-Bd1uLqSa.mjs → Find-B24ZEhYM.mjs} +1 -1
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-Bc946oSc.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-9Q7TMm4u.mjs} +37 -37
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-DiNzGl-q.js} +1 -1
- package/dist/{Overview-DoOASlNz.mjs → Overview-3HWhsqaz.mjs} +2 -2
- package/dist/Overview-BrCwozey.js +1 -0
- package/dist/{Overview-37nilXzE.js → Overview-CpHhuiaV.js} +1 -1
- package/dist/{Overview-DeQQ0FY3.js → Overview-DAxCu9XC.js} +1 -1
- package/dist/{Overview-C--dq51X.mjs → Overview-D_T3K6aq.mjs} +1 -1
- package/dist/{Overview-CGo4jaaA.mjs → Overview-kaMhsIUq.mjs} +21 -21
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cz_22Oce.mjs +2927 -0
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-DPPNc-Z5.js +349 -0
- package/dist/SeoHealth-09sEOu3G.js +1 -0
- package/dist/{SeoHealth-DVFDz3em.mjs → SeoHealth-BzcWd_w7.mjs} +29 -29
- package/dist/TableView-CPAw3h8g.js +4 -0
- package/dist/TableView-DXmEF6pY.mjs +6143 -0
- package/dist/agenda-BNG05SAq.js +1 -0
- package/dist/agenda-D1RxMxBS.mjs +1152 -0
- package/dist/availability-CMrRa5y2.mjs +269 -0
- package/dist/availability-Cf2YfMwM.js +1 -0
- package/dist/booking-data-DgJd0BcM.mjs +889 -0
- package/dist/booking-data-Di5GmH_8.js +1 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-Bp5BSvxO.js → exceptions-CI0B4xVj.js} +1 -1
- package/dist/{exceptions-C97cNZYl.mjs → exceptions-vo8SA5SE.mjs} +68 -68
- package/dist/index-BtujSJeg.js +35 -0
- package/dist/{index-CrGjxSwa.mjs → index-CrgzoTyR.mjs} +1 -1
- package/dist/{index-D2a6wEPh.js → index-DPd3waTN.js} +1 -1
- package/dist/{index-CABh6Qn6.mjs → index-DrXxXB2F.mjs} +15 -15
- package/dist/{index-B-lVEpFX.mjs → index-MYWjg0zi.mjs} +3 -3
- package/dist/index-dOdMm1pV.mjs +1105 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +201 -148
- package/dist/interpolation-DEDSLETn.mjs +128 -0
- package/dist/interpolation-DERg6Lwt.js +1 -0
- package/dist/orders-CzzcFQha.mjs +559 -0
- package/dist/orders-ETtbA4aQ.js +1 -0
- package/dist/{payment-Bosr0m3u.mjs → payment-C3ohkehF.mjs} +1 -1
- package/dist/{payment-DDnC03jb.js → payment-Dfr-Ro-a.js} +1 -1
- package/dist/{resources-BtF5RUUq.js → resources-CxeFd57z.js} +1 -1
- package/dist/{resources-B7qDBC91.mjs → resources-WI_4SO6T.mjs} +2 -2
- package/dist/server-handlers.cjs.js +1 -1
- package/dist/server-handlers.mjs +457 -387
- package/dist/src/appointments/chat-components/AgendaOpeningHoursCard.vue.d.ts +15 -0
- package/dist/src/appointments/components/edit/CustomerInformationFieldEditorDialog.vue.d.ts +17 -5
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +8 -3
- package/dist/src/appointments/components/edit/EventDialog/EventDialog.vue.d.ts +1 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +6 -3
- package/dist/src/appointments/components/edit/EventTimeline.vue.d.ts +3 -0
- package/dist/src/appointments/components/edit/EventView.vue.d.ts +6 -1
- package/dist/src/appointments/components/edit/MetadataSchemaEditorDialog.vue.d.ts +12 -0
- package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +21 -0
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +8 -3
- package/dist/src/appointments/index.d.ts +53 -0
- package/dist/src/appointments/pages/edit/agenda.vue.d.ts +3 -1
- package/dist/src/appointments/pages/edit/availability.vue.d.ts +1 -26
- package/dist/src/appointments/pages/edit/booking-data.vue.d.ts +65 -0
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +7 -3
- package/dist/src/appointments/tools.d.ts +52 -0
- package/dist/src/appointments/types.d.ts +12 -0
- package/dist/src/table/config.d.ts +200 -0
- package/dist/src/table/get_data_flow-DEFAULT.json.d.ts +129 -0
- package/dist/src/table/index.d.ts +200 -0
- package/dist/utils-CanmrIWO.mjs +47 -0
- package/dist/utils-Yd6F5mea.js +3 -0
- package/package.json +2 -2
- package/src/appointments/tools.ts +38 -0
- package/dist/Acquisition-DPScJD4t.js +0 -1
- package/dist/AppointmentListTable-CQ0WIXtj.js +0 -1
- package/dist/AppointmentListTable-aV_UJd6j.mjs +0 -159
- package/dist/Audience-Csw1QLmw.js +0 -1
- package/dist/Content-dYr7kYT0.js +0 -1
- package/dist/DateFormatter-DbtOLV0L.js +0 -1
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DXa-Xxue.mjs +0 -74
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-ozYrxb2g.js +0 -1
- package/dist/Overview-DBu86Ikb.js +0 -1
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-COfCOMsz.js +0 -349
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CYXkhhdp.mjs +0 -2383
- package/dist/SeoHealth-DzftZW1m.js +0 -1
- package/dist/TableView-CIJs118q.mjs +0 -5929
- package/dist/TableView-DzZYf34i.js +0 -4
- package/dist/agenda-DMT75Qfo.mjs +0 -1133
- package/dist/agenda-DxD4RMsy.js +0 -1
- package/dist/availability-B1D4Fyzi.mjs +0 -629
- package/dist/availability-DxrUcYbW.js +0 -1
- package/dist/index-BbqRTXuU.js +0 -35
- package/dist/index-D4GsbUId.mjs +0 -1091
- package/dist/interpolation-BBwG_ON6.mjs +0 -65
- package/dist/interpolation-CsOrww73.js +0 -1
- package/dist/orders-BRfXlWgV.mjs +0 -397
- package/dist/orders-CrCz1WTR.js +0 -1
- package/dist/regular-slots-Cc1jmKuC.mjs +0 -222
- package/dist/regular-slots-DBs1XVeN.js +0 -1
- package/dist/src/appointments/pages/edit/regular-slots.vue.d.ts +0 -2
- package/dist/utils-BVKy9S2J.mjs +0 -29
- package/dist/utils-D6CaKJbp.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),O=require("lucide-vue-next"),S=require("@oneclick.dev/cms-kit"),X=require("./utils-D6CaKJbp.js"),f=require("./DateFormatter-DbtOLV0L.js"),Y={class:"@container/new-res-form space-y-5 py-4"},Z={class:"grid gap-4"},ee={class:"grid gap-4 @md/new-res-form:grid-cols-2"},te={class:"grid gap-2"},oe={class:"flex gap-2 items-center"},ae={class:"grid gap-2"},le={class:"flex gap-2 items-center"},ne={class:"grid gap-2"},re={class:"grid gap-2"},se={class:"grid gap-4"},de={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ie={class:"grid gap-2"},ue={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ce={class:"grid gap-2"},pe={class:"grid gap-2"},me={class:"flex items-center h-9 px-3 text-sm text-muted-foreground"},ve={class:"grid gap-4"},fe={class:"grid gap-4 @md/new-res-form:grid-cols-2"},Ve={class:"grid gap-2"},ge={class:"grid gap-2"},Ne={class:"grid gap-4 @md/new-res-form:grid-cols-2"},_e={class:"grid gap-2"},xe={class:"grid gap-2"},Ce={class:"mt-4 text-red-400"},we={class:"list-disc pl-4"},he={key:0},De={key:1},Ee=e.defineComponent({__name:"NewReservationDialog",setup(Se){const{params:I}=S.useModuleRoute(),{config:T}=S.useModule(),U=S.useFirebaseIntegration(T.project),N=e.ref(!1);e.watch(N,a=>{a&&(x.value=[],c.value=1,i.value=0,n.value=l.value?.resources?.[0]?.id??"",s.value=l.value?.pricingOptions?.find(t=>t.isDefault===!0)?.id??"",r.value="",V.value="",g.value="",p.value="",C.value="")});const _=e.ref(!1),l=e.inject("agendaData",e.ref({})),x=e.ref([]),c=e.ref(1),i=e.ref(0),n=e.ref(""),s=e.ref(""),r=e.ref(""),V=e.ref(""),g=e.ref(""),p=e.ref(""),C=e.ref(""),L=f.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2()),u=e.ref(),M=new f.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),b=e.computed(()=>{if(!r.value||!s.value)return"";const a=l.value?.pricingOptions?.find(E=>E.id===s.value);if(!a?.duration)return r.value;const[t,m]=r.value.split(":").map(Number);if(isNaN(t)||isNaN(m))return"";const w=t*60+m+a.duration,h=Math.floor(w/60)%24,D=w%60;return`${h.toString().padStart(2,"0")}:${D.toString().padStart(2,"0")}`}),R=()=>{const a=[];return x.value=[],c.value<1&&c.value>9999&&a.push("Please fill in a correct number of spots."),i.value<0&&(i.value=0),n.value||a.push("Please select a resource."),s.value||a.push("Please select a type."),u.value||a.push("Please select the booking date."),(!r.value||r.value.length!==5||r.value?.indexOf(":")===-1||!parseInt(r.value?.replace(":","")))&&a.push("Please select a correct booking time."),V.value||a.push("Please fill in the first name of the customer."),g.value||a.push("Please fill in the last name of the customer."),(!p.value||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p.value)===!1)&&a.push("Please fill in the correct email of the customer."),x.value=a,a.length===0},q=async()=>{if(R())try{_.value=!0;const a={agendaId:I.value.id,customerInfo:{firstName:V.value,lastName:g.value,email:p.value,phone:C.value},amountPaid:parseFloat(i.value)??0,amountDue:0,subtotal:parseFloat(i.value)??0,total:parseFloat(i.value)??0,createdAt:new Date,updatedAt:new Date,discount:0,flattenedReservationDates:[`${n.value}_${u.value}`],flattenedReservations:[`${n.value}_${u.value}_${r.value?.replace(":","")}`],paymentStatus:"paid",paymentType:"full",reservations:[{status:"approved",totalPrice:parseFloat(i.value?.toFixed(2))??0,basePrice:parseFloat((i.value/c.value).toFixed(2))??0,addOnsPrice:0,addOns:[],date:`${u.value}`,id:`res_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,pricingOption:{duration:l.value?.pricingOptions?.find(t=>t.id===s.value)?.duration||"",id:l.value?.pricingOptions?.find(t=>t.id===s.value)?.id||"",name:l.value?.pricingOptions?.find(t=>t.id===s.value)?.name||"",price:l.value?.pricingOptions?.find(t=>t.id===s.value)?.price||""},pricingOptionId:s.value,resource:{avatarLabel:l.value?.resources?.find(t=>t.id===n.value)?.avatarLabel||"",color:l.value?.resources?.find(t=>t.id===n.value)?.color||"",description:l.value?.resources?.find(t=>t.id===n.value)?.description||"",id:l.value?.resources?.find(t=>t.id===n.value)?.id||"",name:l.value?.resources?.find(t=>t.id===n.value)?.name||""},resourceId:n.value,spots:c.value,timeslot:{startTime:r.value,endTime:b.value}}],status:"confirmed"};await U.add(T.reservationsCollection,a)}catch{}finally{_.value=!1,N.value=!1}};return(a,t)=>{const m=e.resolveComponent("Button"),w=e.resolveComponent("DialogTrigger"),h=e.resolveComponent("DialogTitle"),D=e.resolveComponent("DialogDescription"),E=e.resolveComponent("DialogHeader"),d=e.resolveComponent("Label"),v=e.resolveComponent("Input"),y=e.resolveComponent("SelectValue"),$=e.resolveComponent("SelectTrigger"),k=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),B=e.resolveComponent("SelectContent"),F=e.resolveComponent("Select"),j=e.resolveComponent("PopoverTrigger"),A=e.resolveComponent("Calendar"),H=e.resolveComponent("PopoverContent"),z=e.resolveComponent("Popover"),G=e.resolveComponent("TimeInput"),K=e.resolveComponent("DialogFooter"),J=e.resolveComponent("DialogScrollContent"),Q=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(Q,{open:N.value,"onUpdate:open":t[10]||(t[10]=o=>N.value=o)},{default:e.withCtx(()=>[e.createVNode(w,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(O.Plus),{class:"size-4"}),t[11]||(t[11]=e.createTextVNode(" Add Reservation ",-1))]),_:1})]),_:1}),e.createVNode(J,{class:"sm:max-w-xl"},{default:e.withCtx(()=>[e.createVNode(E,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Create new reservation",-1)])]),_:1}),e.createVNode(D)]),_:1}),e.createElementVNode("div",Y,[e.createElementVNode("div",Z,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Spots/tickets",-1)])]),_:1}),e.createElementVNode("div",oe,[e.createVNode(v,{modelValue:c.value,"onUpdate:modelValue":t[0]||(t[0]=o=>c.value=o),modelModifiers:{number:!0},type:"number",min:"1",class:"no-spinner"},null,8,["modelValue"])])]),e.createElementVNode("div",ae,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Total price paid",-1)])]),_:1}),e.createElementVNode("div",le,[e.createVNode(v,{modelValue:i.value,"onUpdate:modelValue":t[1]||(t[1]=o=>i.value=o),modelModifiers:{number:!0},type:"number",min:"0",class:"no-spinner"},null,8,["modelValue"]),e.createTextVNode(" "+e.toDisplayString(e.unref(l).currency),1)])]),e.createElementVNode("div",ne,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode("Resource",-1)])]),_:1}),e.createVNode(F,{modelValue:n.value,"onUpdate:modelValue":t[2]||(t[2]=o=>n.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select resource"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).resources,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])]),e.createElementVNode("div",re,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(F,{modelValue:s.value,"onUpdate:modelValue":t[3]||(t[3]=o=>s.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select type"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).pricingOptions,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name)+" ("+e.toDisplayString(o.duration)+"min) ",1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",se,[e.createElementVNode("div",de,[e.createElementVNode("div",ie,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Date",-1)])]),_:1}),e.createVNode(z,null,{default:e.withCtx(({close:o})=>[e.createVNode(j,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,{variant:"outline",class:e.normalizeClass(e.unref(X.classNames)("w-[240px] justify-start text-left font-normal",!u.value&&"text-muted-foreground"))},{default:e.withCtx(()=>[e.createVNode(e.unref(O.CalendarIcon)),e.createTextVNode(" "+e.toDisplayString(u.value?e.unref(M).format(u.value.toDate(e.unref(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class"])]),_:1}),e.createVNode(H,{class:"w-auto p-0",align:"start"},{default:e.withCtx(()=>[e.createVNode(A,{modelValue:u.value,"onUpdate:modelValue":[t[4]||(t[4]=W=>u.value=W),o],"default-placeholder":e.unref(L),layout:"month-and-year","initial-focus":"",minValue:e.unref(f.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)(e.unref(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())},null,8,["modelValue","default-placeholder","onUpdate:modelValue","minValue"])]),_:2},1024)]),_:1})])]),e.createElementVNode("div",ue,[e.createElementVNode("div",ce,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Start time",-1)])]),_:1}),e.createVNode(G,{modelValue:r.value,"onUpdate:modelValue":t[5]||(t[5]=o=>r.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",pe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("End time",-1)])]),_:1}),e.createElementVNode("div",me,e.toDisplayString(e.unref(b)||"--:--"),1)])])]),e.createElementVNode("div",ve,[e.createElementVNode("div",fe,[e.createElementVNode("div",Ve,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Firstname",-1)])]),_:1}),e.createVNode(v,{modelValue:V.value,"onUpdate:modelValue":t[6]||(t[6]=o=>V.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",ge,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Lastname",-1)])]),_:1}),e.createVNode(v,{modelValue:g.value,"onUpdate:modelValue":t[7]||(t[7]=o=>g.value=o)},null,8,["modelValue"])])]),e.createElementVNode("div",Ne,[e.createElementVNode("div",_e,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("E-mail",-1)])]),_:1}),e.createVNode(v,{modelValue:p.value,"onUpdate:modelValue":t[8]||(t[8]=o=>p.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",xe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Phone Nr ",-1),e.createElementVNode("span",{class:"italic text-xs opacity-50"},"optional",-1)])]),_:1}),e.createVNode(v,{modelValue:C.value,"onUpdate:modelValue":t[9]||(t[9]=o=>C.value=o)},null,8,["modelValue"])])])]),e.createElementVNode("div",Ce,[e.createElementVNode("ul",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,o=>(e.openBlock(),e.createElementBlock("li",{key:o},e.toDisplayString(o),1))),128))])])]),e.createVNode(K,{class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(m,{onClick:q,disabled:_.value},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("span",he,"Creating...")):(e.openBlock(),e.createElementBlock("span",De,"Create reservation"))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}});exports._sfc_main=Ee;
|
|
1
|
+
"use strict";const e=require("vue"),O=require("lucide-vue-next"),b=require("@oneclick.dev/cms-kit"),X=require("./utils-Yd6F5mea.js"),f=require("./DateFormatter-CYAD4GBN.js"),Y={class:"@container/new-res-form space-y-5 py-4"},Z={class:"grid gap-4"},ee={class:"grid gap-4 @md/new-res-form:grid-cols-2"},te={class:"grid gap-2"},oe={class:"flex gap-2 items-center"},ae={class:"grid gap-2"},le={class:"flex gap-2 items-center"},ne={class:"grid gap-2"},re={class:"grid gap-2"},se={class:"grid gap-4"},de={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ie={class:"grid gap-2"},ue={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ce={class:"grid gap-2"},pe={class:"grid gap-2"},me={class:"flex items-center h-9 px-3 text-sm text-muted-foreground"},ve={class:"grid gap-4"},fe={class:"grid gap-4 @md/new-res-form:grid-cols-2"},Ve={class:"grid gap-2"},ge={class:"grid gap-2"},Ne={class:"grid gap-4 @md/new-res-form:grid-cols-2"},_e={class:"grid gap-2"},xe={class:"grid gap-2"},Ce={class:"mt-4 text-red-400"},we={class:"list-disc pl-4"},he={key:0},De={key:1},Ee=e.defineComponent({__name:"NewReservationDialog",setup(be){const{params:I}=b.useModuleRoute(),{config:S}=b.useModule(),U=b.useFirebaseIntegration(S.project),N=e.ref(!1);e.watch(N,a=>{a&&(x.value=[],c.value=1,i.value=0,n.value=l.value?.resources?.[0]?.id??"",s.value=l.value?.pricingOptions?.find(t=>t.isDefault===!0)?.id??"",r.value="",V.value="",g.value="",p.value="",C.value="")});const _=e.ref(!1),l=e.inject("agendaData",e.ref({})),x=e.ref([]),c=e.ref(1),i=e.ref(0),n=e.ref(""),s=e.ref(""),r=e.ref(""),V=e.ref(""),g=e.ref(""),p=e.ref(""),C=e.ref(""),L=f.$ad063034c8620db8$export$d0bdf45af03a6ea3(f.$ad063034c8620db8$export$aa8b41735afcabd2()),u=e.ref(),M=new f.$12a3c853105e5a70$export$ad991b66133851cf("en-US",{dateStyle:"long"}),T=e.computed(()=>{if(!r.value||!s.value)return"";const a=l.value?.pricingOptions?.find(E=>E.id===s.value);if(!a?.duration)return r.value;const[t,m]=r.value.split(":").map(Number);if(isNaN(t)||isNaN(m))return"";const w=t*60+m+a.duration,h=Math.floor(w/60)%24,D=w%60;return`${h.toString().padStart(2,"0")}:${D.toString().padStart(2,"0")}`}),R=()=>{const a=[];return x.value=[],c.value<1&&c.value>9999&&a.push("Please fill in a correct number of spots."),i.value<0&&(i.value=0),n.value||a.push("Please select a resource."),s.value||a.push("Please select a type."),u.value||a.push("Please select the booking date."),(!r.value||r.value.length!==5||r.value?.indexOf(":")===-1||!parseInt(r.value?.replace(":","")))&&a.push("Please select a correct booking time."),V.value||a.push("Please fill in the first name of the customer."),g.value||a.push("Please fill in the last name of the customer."),(!p.value||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p.value)===!1)&&a.push("Please fill in the correct email of the customer."),x.value=a,a.length===0},q=async()=>{if(R())try{_.value=!0;const a={agendaId:I.value.id,customerInfo:{firstName:V.value,lastName:g.value,email:p.value,phone:C.value},amountPaid:parseFloat(i.value)??0,amountDue:0,subtotal:parseFloat(i.value)??0,total:parseFloat(i.value)??0,createdAt:new Date,updatedAt:new Date,discount:0,flattenedReservationDates:[`${n.value}_${u.value}`],flattenedReservations:[`${n.value}_${u.value}_${r.value?.replace(":","")}`],paymentStatus:"paid",paymentType:"full",reservations:[{status:"approved",totalPrice:parseFloat(i.value?.toFixed(2))??0,basePrice:parseFloat((i.value/c.value).toFixed(2))??0,addOnsPrice:0,addOns:[],date:`${u.value}`,id:`res_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,pricingOption:{duration:l.value?.pricingOptions?.find(t=>t.id===s.value)?.duration||"",id:l.value?.pricingOptions?.find(t=>t.id===s.value)?.id||"",name:l.value?.pricingOptions?.find(t=>t.id===s.value)?.name||"",price:l.value?.pricingOptions?.find(t=>t.id===s.value)?.price||""},pricingOptionId:s.value,resource:{avatarLabel:l.value?.resources?.find(t=>t.id===n.value)?.avatarLabel||"",color:l.value?.resources?.find(t=>t.id===n.value)?.color||"",description:l.value?.resources?.find(t=>t.id===n.value)?.description||"",id:l.value?.resources?.find(t=>t.id===n.value)?.id||"",name:l.value?.resources?.find(t=>t.id===n.value)?.name||""},resourceId:n.value,spots:c.value,timeslot:{startTime:r.value,endTime:T.value}}],status:"confirmed"};await U.add(S.reservationsCollection,a)}catch{}finally{_.value=!1,N.value=!1}};return(a,t)=>{const m=e.resolveComponent("Button"),w=e.resolveComponent("DialogTrigger"),h=e.resolveComponent("DialogTitle"),D=e.resolveComponent("DialogDescription"),E=e.resolveComponent("DialogHeader"),d=e.resolveComponent("Label"),v=e.resolveComponent("Input"),y=e.resolveComponent("SelectValue"),$=e.resolveComponent("SelectTrigger"),k=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),B=e.resolveComponent("SelectContent"),F=e.resolveComponent("Select"),j=e.resolveComponent("PopoverTrigger"),A=e.resolveComponent("Calendar"),H=e.resolveComponent("PopoverContent"),z=e.resolveComponent("Popover"),G=e.resolveComponent("TimeInput"),K=e.resolveComponent("DialogFooter"),J=e.resolveComponent("DialogScrollContent"),Q=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(Q,{open:N.value,"onUpdate:open":t[10]||(t[10]=o=>N.value=o)},{default:e.withCtx(()=>[e.createVNode(w,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(O.Plus),{class:"size-4"}),t[11]||(t[11]=e.createTextVNode(" Add Reservation ",-1))]),_:1})]),_:1}),e.createVNode(J,{class:"sm:max-w-xl"},{default:e.withCtx(()=>[e.createVNode(E,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Create new reservation",-1)])]),_:1}),e.createVNode(D)]),_:1}),e.createElementVNode("div",Y,[e.createElementVNode("div",Z,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Spots/tickets",-1)])]),_:1}),e.createElementVNode("div",oe,[e.createVNode(v,{modelValue:c.value,"onUpdate:modelValue":t[0]||(t[0]=o=>c.value=o),modelModifiers:{number:!0},type:"number",min:"1",class:"no-spinner"},null,8,["modelValue"])])]),e.createElementVNode("div",ae,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Total price paid",-1)])]),_:1}),e.createElementVNode("div",le,[e.createVNode(v,{modelValue:i.value,"onUpdate:modelValue":t[1]||(t[1]=o=>i.value=o),modelModifiers:{number:!0},type:"number",min:"0",class:"no-spinner"},null,8,["modelValue"]),e.createTextVNode(" "+e.toDisplayString(e.unref(l).currency),1)])]),e.createElementVNode("div",ne,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode("Resource",-1)])]),_:1}),e.createVNode(F,{modelValue:n.value,"onUpdate:modelValue":t[2]||(t[2]=o=>n.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select resource"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).resources,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])]),e.createElementVNode("div",re,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(F,{modelValue:s.value,"onUpdate:modelValue":t[3]||(t[3]=o=>s.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select type"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).pricingOptions,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name)+" ("+e.toDisplayString(o.duration)+"min) ",1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",se,[e.createElementVNode("div",de,[e.createElementVNode("div",ie,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Date",-1)])]),_:1}),e.createVNode(z,null,{default:e.withCtx(({close:o})=>[e.createVNode(j,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,{variant:"outline",class:e.normalizeClass(e.unref(X.classNames)("w-full justify-start text-left font-normal",!u.value&&"text-muted-foreground"))},{default:e.withCtx(()=>[e.createVNode(e.unref(O.CalendarIcon)),e.createTextVNode(" "+e.toDisplayString(u.value?e.unref(M).format(u.value.toDate(e.unref(f.$ad063034c8620db8$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class"])]),_:1}),e.createVNode(H,{class:"w-auto p-0",align:"start"},{default:e.withCtx(()=>[e.createVNode(A,{modelValue:u.value,"onUpdate:modelValue":[t[4]||(t[4]=W=>u.value=W),o],"default-placeholder":e.unref(L),layout:"month-and-year","initial-focus":"",minValue:e.unref(f.$ad063034c8620db8$export$d0bdf45af03a6ea3)(e.unref(f.$ad063034c8620db8$export$aa8b41735afcabd2)())},null,8,["modelValue","default-placeholder","onUpdate:modelValue","minValue"])]),_:2},1024)]),_:1})])]),e.createElementVNode("div",ue,[e.createElementVNode("div",ce,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Start time",-1)])]),_:1}),e.createVNode(G,{modelValue:r.value,"onUpdate:modelValue":t[5]||(t[5]=o=>r.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",pe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("End time",-1)])]),_:1}),e.createElementVNode("div",me,e.toDisplayString(e.unref(T)||"--:--"),1)])])]),e.createElementVNode("div",ve,[e.createElementVNode("div",fe,[e.createElementVNode("div",Ve,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Firstname",-1)])]),_:1}),e.createVNode(v,{modelValue:V.value,"onUpdate:modelValue":t[6]||(t[6]=o=>V.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",ge,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Lastname",-1)])]),_:1}),e.createVNode(v,{modelValue:g.value,"onUpdate:modelValue":t[7]||(t[7]=o=>g.value=o)},null,8,["modelValue"])])]),e.createElementVNode("div",Ne,[e.createElementVNode("div",_e,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("E-mail",-1)])]),_:1}),e.createVNode(v,{modelValue:p.value,"onUpdate:modelValue":t[8]||(t[8]=o=>p.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",xe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Phone Nr ",-1),e.createElementVNode("span",{class:"italic text-xs opacity-50"},"optional",-1)])]),_:1}),e.createVNode(v,{modelValue:C.value,"onUpdate:modelValue":t[9]||(t[9]=o=>C.value=o)},null,8,["modelValue"])])])]),e.createElementVNode("div",Ce,[e.createElementVNode("ul",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,o=>(e.openBlock(),e.createElementBlock("li",{key:o},e.toDisplayString(o),1))),128))])])]),e.createVNode(K,{class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(m,{onClick:q,disabled:_.value},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("span",he,"Creating...")):(e.openBlock(),e.createElementBlock("span",De,"Create reservation"))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}});exports._sfc_main=Ee;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as Q, inject as K, openBlock as r, createElementBlock as g, createElementVNode as i, Fragment as I, renderList as q, withModifiers as ue, normalizeClass as ee, unref as o, createCommentVNode as T, toDisplayString as P, createTextVNode as m, resolveComponent as s, createBlock as $, withCtx as l, createVNode as t, computed as X, renderSlot as _e, ref as j, useTemplateRef as be, withAsyncContext as xe, watch as Ce, onMounted as ye, onUnmounted as we, provide as O, withKeys as ke } from "vue";
|
|
2
2
|
import { Filter as he, ChevronsUpDown as Pe, Check as se, RotateCcw as $e, ExternalLink as Se, Search as Me, Plus as Ve, LayoutGrid as Te, List as Ae } from "lucide-vue-next";
|
|
3
3
|
import { useModuleRoute as J, useModulePermissions as Y, useFirebaseIntegration as te, useConfirmation as ze, useModuleBreadcrumbs as Ie } from "@oneclick.dev/cms-kit";
|
|
4
|
-
import {
|
|
5
|
-
import { c as ae } from "./utils-
|
|
4
|
+
import { a as Le } from "./index-MYWjg0zi.mjs";
|
|
5
|
+
import { c as ae } from "./utils-CanmrIWO.mjs";
|
|
6
6
|
import { t as D } from "./index-RLz1QPrf.mjs";
|
|
7
7
|
const Ee = { class: "grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6" }, De = ["onClick", "onContextmenu"], Fe = ["src"], Be = { class: "font-semibold" }, Ue = { class: "text-sm text-muted-foreground flex items-center gap-2" }, Re = { class: "flex items-center gap-2" }, je = { key: 0 }, Ke = /* @__PURE__ */ Q({
|
|
8
8
|
__name: "GridView",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("@oneclick.dev/cms-kit");require("./index-BuzLn4Km.js");const D=require("@oneclick.dev/cms-kit/charts"),a=require("lucide-vue-next"),c=require("./index-DQYBP8Js.js"),N=require("./index-C4YUVWzJ.js"),Z={class:"flex flex-col gap-4 w-full max-w-7xl mx-auto py-8"},J={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},Q={class:"text-muted-foreground text-sm mt-1"},Y={key:0,class:"flex items-center gap-2"},ee={class:"flex items-center border rounded-lg overflow-hidden"},te=["onClick"],oe={class:"text-sm text-destructive font-medium"},se={key:2,class:"flex items-center justify-center py-20"},ae={class:"flex items-start justify-between"},ne={class:"flex items-center gap-2"},le={class:"text-sm font-medium"},re={class:"grid grid-cols-2 @md:grid-cols-3 @xl:grid-cols-4 gap-4"},ce={class:"flex items-center gap-1.5 text-muted-foreground mb-2"},ie={class:"text-xs font-medium uppercase tracking-wide"},de={class:"text-2xl font-semibold tabular-nums"},ue={key:0,class:"flex items-center gap-1 mt-1"},me={class:"flex flex-col @xl:grid @xl:grid-cols-2 gap-4 max-w-full"},fe={class:"flex flex-col @lg:grid @lg:grid-cols-2 gap-4"},pe={class:"divide-y"},xe={class:"flex items-center gap-3 min-w-0"},ge={class:"text-muted-foreground w-5 text-right shrink-0"},ve={class:"truncate font-mono text-xs"},he={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ve={class:"text-muted-foreground text-xs w-16 text-right"},Ne={class:"text-muted-foreground text-xs w-16 text-right"},_e={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},ye={class:"divide-y"},Ce={class:"flex items-center gap-3 min-w-0"},we={class:"text-muted-foreground w-5 text-right shrink-0"},ke={class:"truncate"},be={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ee={class:"text-muted-foreground text-xs w-20 text-right"},Be={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},De={class:"grid @lg:grid-cols-2 gap-4"},Se={class:"space-y-3"},Te={class:"text-sm capitalize flex-1"},$e={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Pe={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Fe={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Ue={class:"space-y-3"},ze={class:"text-sm flex-1"},Re={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Me={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Ae={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Le=e.defineComponent({__name:"Overview",setup(qe){const{config:S}=U.useModule(),{moduleId:G}=U.useModuleRoute();U.useModuleBreadcrumbs(()=>[{label:"Overview"}]);const x=e.ref(!0),_=e.ref(null),y=e.ref("30"),h=e.ref([]),r=e.ref({}),I=e.ref({}),i=e.ref({}),z=e.ref(0),T=e.ref([]),$=e.ref([]),C=e.ref([]),w=e.ref([]),k=e.computed(()=>!!(S.serviceAccount&&S.propertyId));function g(s){return`/api/v1/modules/${G}${s}`}const O=[{label:"7 days",value:"7"},{label:"14 days",value:"14"},{label:"30 days",value:"30"},{label:"90 days",value:"90"}],m={sessions:"#3b82f6",users:"#8b5cf6",pageViews:"#10b981"},P={sessions:{label:"Sessions",color:m.sessions},totalUsers:{label:"Users",color:m.users}},F={screenPageViews:{label:"Page Views",color:m.pageViews}},V=(s,t)=>t,R=s=>s.sessions||0,X=s=>s.totalUsers||0,M=s=>s.screenPageViews||0,A=s=>{const t=h.value[Math.round(s)];if(!t)return"";const l=new Date(t.date);return`${l.getDate()}/${l.getMonth()+1}`},L=s=>{const t=h.value[Math.round(Number(s))];return t?new Date(t.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""},W=e.computed(()=>[{label:"Sessions",value:d(r.value.sessions||0),icon:a.MousePointerClick,change:i.value.sessions},{label:"Users",value:d(r.value.totalUsers||0),icon:a.Users,change:i.value.totalUsers},{label:"Page Views",value:d(r.value.screenPageViews||0),icon:a.Eye,change:i.value.screenPageViews},{label:"Avg. Duration",value:H(r.value.averageSessionDuration||0),icon:a.Clock,change:i.value.averageSessionDuration},{label:"Engagement",value:`${((r.value.engagementRate||0)*100).toFixed(1)}%`,icon:a.Zap,change:i.value.engagementRate,positive:!0},{label:"Bounce Rate",value:`${((r.value.bounceRate||0)*100).toFixed(1)}%`,icon:(r.value.bounceRate||0)>.5?a.TrendingDown:a.TrendingUp,change:i.value.bounceRate,positive:!1},{label:"New Users",value:d(r.value.newUsers||0),icon:a.UserPlus,change:i.value.newUsers},{label:"Pages / Session",value:(r.value.screenPageViewsPerSession||0).toFixed(1),icon:a.Activity,change:i.value.screenPageViewsPerSession}]);function d(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toString()}function H(s){const t=Math.floor(s/60),l=Math.round(s%60);return t>0?`${t}m ${l}s`:`${l}s`}function b(s,t=!0){if(s==null)return{text:"—",cls:"text-muted-foreground",icon:a.Minus};const n=`${Math.abs(s).toFixed(1)}%`,p=s>0;return{text:n,cls:(t?p:!p)?"text-emerald-600 dark:text-emerald-400":"text-red-500 dark:text-red-400",icon:p?a.TrendingUp:a.TrendingDown}}function K(s){const t=s.toLowerCase();return t==="mobile"?a.Smartphone:t==="tablet"?a.Tablet:a.Monitor}async function E(){if(!k.value)return;x.value=!0,_.value=null;const s=`${y.value}daysAgo`;try{const[t,l,n,p,u,f]=await Promise.all([$fetch(g(`/report?startDate=${s}&endDate=today`)),$fetch(g("/realtime")).catch(()=>({activeUsers:0})),$fetch(g(`/top-pages?startDate=${s}&endDate=today&limit=10`)),$fetch(g(`/top-sources?startDate=${s}&endDate=today`)),$fetch(g(`/devices?startDate=${s}&endDate=today`)),$fetch(g(`/countries?startDate=${s}&endDate=today`))]);h.value=t.rows||[],r.value=t.totals||{},I.value=t.previousTotals||{},i.value=t.changes||{},z.value=l.activeUsers||0,T.value=n.rows||[],$.value=p.rows||[],C.value=u.rows||[],w.value=f.rows||[]}catch(t){console.error("Failed to fetch analytics data:",t),_.value=t?.data?.statusMessage||t?.message||"Failed to load analytics data"}finally{x.value=!1}}return e.watch(y,()=>E()),e.onMounted(()=>{k.value?E():x.value=!1}),(s,t)=>{const l=e.resolveComponent("Button"),n=e.resolveComponent("Card"),p=e.resolveComponent("Badge"),u=e.resolveComponent("CardTitle"),f=e.resolveComponent("CardHeader"),q=e.resolveComponent("ChartLegendContent"),j=e.resolveComponent("ChartContainer"),v=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",J,[e.createElementVNode("div",null,[t[0]||(t[0]=e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Analytics Overview",-1)),e.createElementVNode("p",Q,"Property "+e.toDisplayString(e.unref(S).propertyId||"—"),1)]),k.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(O,o=>e.createElementVNode("button",{key:o.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",y.value===o.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:B=>y.value=o.value},e.toDisplayString(o.label),11,te)),64))]),e.createVNode(l,{variant:"outline",size:"icon",onClick:E,disabled:x.value},{default:e.withCtx(()=>[e.createVNode(e.unref(a.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":x.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),k.value?_.value?(e.openBlock(),e.createBlock(n,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",oe,e.toDisplayString(_.value),1),e.createVNode(l,{variant:"outline",size:"sm",class:"mt-3",onClick:E},{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):x.value?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(a.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(n,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createElementVNode("div",ne,[t[3]||(t[3]=e.createElementVNode("span",{class:"relative flex h-2.5 w-2.5"},[e.createElementVNode("span",{class:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.createElementVNode("span",{class:"relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500"})],-1)),e.createElementVNode("span",le,e.toDisplayString(z.value)+" visitors",1),t[4]||(t[4]=e.createElementVNode("span",{class:"text-xs text-muted-foreground translate-y-0.25"},"in the last 30 minutes",-1))]),e.createVNode(p,{variant:"outline",class:"text-xs"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Live",-1)])]),_:1})])]),_:1}),e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,o=>(e.openBlock(),e.createBlock(n,{key:o.label,class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{class:"size-3.5"})),e.createElementVNode("span",ie,e.toDisplayString(o.label),1)]),e.createElementVNode("p",de,e.toDisplayString(o.value),1),o.change!==void 0?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.change,o.positive!==!1).icon),{class:e.normalizeClass(["size-3",b(o.change,o.positive!==!1).cls])},null,8,["class"])),e.createElementVNode("span",{class:e.normalizeClass(["text-xs font-medium",b(o.change,o.positive!==!1).cls])},e.toDisplayString(b(o.change,o.positive!==!1).text),3),t[6]||(t[6]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"vs prev.",-1))])):e.createCommentVNode("",!0)]),_:2},1024))),128))]),e.createElementVNode("div",me,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Sessions & Users",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(j,{config:P,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.C),{x:V,y:R,color:m.sessions,opacity:.1,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C$1),{x:V,y:R,color:m.sessions,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C$1),{x:V,y:X,color:m.users,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(P,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(q,{config:P})]),_:1})]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Page Views",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(j,{config:F,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.C),{x:V,y:M,color:m.pageViews,opacity:.15,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C$1),{x:V,y:M,color:m.pageViews,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(F,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(q,{config:F})]),_:1})]),_:1})]),_:1})]),e.createElementVNode("div",fe,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Top Pages",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.pagePath,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",xe,[e.createElementVNode("span",ge,e.toDisplayString(B+1),1),e.createElementVNode("span",ve,e.toDisplayString(o.pagePath),1)]),e.createElementVNode("div",he,[e.createElementVNode("span",Ve,e.toDisplayString(d(o.screenPageViews))+" views",1),e.createElementVNode("span",Ne,e.toDisplayString(d(o.totalUsers))+" users",1)])]))),128)),T.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_e,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Traffic Sources",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.sessionSource,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",Ce,[e.createElementVNode("span",we,e.toDisplayString(B+1),1),e.createVNode(e.unref(a.ArrowUpRight),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",ke,e.toDisplayString(o.sessionSource||"(direct)"),1)]),e.createElementVNode("div",be,[e.createElementVNode("span",Ee,e.toDisplayString(d(o.sessions))+" sessions",1)])]))),128)),$.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Be,"No data available"))])]),_:1})]),_:1})]),e.createElementVNode("div",De,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Devices",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.deviceCategory,class:"flex items-center gap-3"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(K(o.deviceCategory)),{class:"size-4 text-muted-foreground shrink-0"})),e.createElementVNode("span",Te,e.toDisplayString(o.deviceCategory),1),e.createElementVNode("div",$e,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(C.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Pe,e.toDisplayString(d(o.sessions)),1)]))),128)),C.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fe,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Top Countries",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.country,class:"flex items-center gap-3"},[e.createVNode(e.unref(a.Globe),{class:"size-4 text-muted-foreground shrink-0"}),e.createElementVNode("span",ze,e.toDisplayString(o.country),1),e.createElementVNode("div",Re,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(w.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Me,e.toDisplayString(d(o.sessions)),1)]))),128)),w.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ae,"No data available"))])]),_:1})]),_:1})])],64)):(e.openBlock(),e.createBlock(n,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createElementVNode("div",{class:"mx-auto max-w-md space-y-3"},[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required"),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"Connect a Google Service Account and enter your GA4 Property ID in the module settings to start seeing analytics.")],-1)])]),_:1}))])}}});exports.default=Le;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-CsOrww73.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),l=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,l.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,l.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=o=>c.value=o)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=o=>m.value=o),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=o=>a.value=o)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=o=>p.value=o),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=o=>x.value=o),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=o=>V.value=o),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=o=>n.value=o),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:l.value,"onUpdate:modelValue":t[7]||(t[7]=o=>l.value=o),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=o=>C.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=o=>E.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,o=>(e.openBlock(),e.createBlock(D,{key:o.id,value:o.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${o.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[o.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=o=>i.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=o=>d.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{await c.add(f.config.collectionsCollection,n)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const l=r.value.findIndex(i=>i.id===n.id);l!==-1&&(r.value[l]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async l=>{if(l)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,l)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[0]||(l[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),l[5]||(l[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[1]||(l[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),l[6]||(l[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[2]||(l[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),l[7]||(l[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:l[3]||(l[3]=d=>v.value=d),onEdit:l[4]||(l[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-DERg6Lwt.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),l=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,l.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,l.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=o=>c.value=o)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=o=>m.value=o),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=o=>a.value=o)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=o=>p.value=o),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=o=>x.value=o),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=o=>V.value=o),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=o=>n.value=o),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:l.value,"onUpdate:modelValue":t[7]||(t[7]=o=>l.value=o),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=o=>C.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=o=>E.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,o=>(e.openBlock(),e.createBlock(D,{key:o.id,value:o.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${o.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[o.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=o=>i.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=o=>d.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{await c.add(f.config.collectionsCollection,n)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const l=r.value.findIndex(i=>i.id===n.id);l!==-1&&(r.value[l]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async l=>{if(l)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,l)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[0]||(l[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),l[5]||(l[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[1]||(l[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),l[6]||(l[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[2]||(l[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),l[7]||(l[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:l[3]||(l[3]=d=>v.value=d),onEdit:l[4]||(l[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("lucide-vue-next"),_=require("@oneclick.dev/cms-kit"),X=require("./index-CxETuRsG.js"),j=require("./utils-D6CaKJbp.js"),y=require("./index-ijdf0d9-.js"),J={class:"grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6"},Y=["onClick","onContextmenu"],Z=["src"],ee={class:"font-semibold"},te={class:"text-sm text-muted-foreground flex items-center gap-2"},oe={class:"flex items-center gap-2"},ne={key:0},le=e.defineComponent({__name:"GridView",props:{products:{type:Array,required:!0}},setup(T){const o=e.inject("selection"),{navigateTo:f}=_.useModuleRoute(),{hasPermission:g}=_.useModulePermissions(),v=(i,l)=>{const u=l.ctrlKey||l.metaKey;if(!l.shiftKey)if(u||o.value.length>0){const x=o.value.indexOf(i.id);x>-1?o.value.splice(x,1):o.value.push(i.id)}else o.value=[],f(i.id)},n=i=>{i.target.closest(".GRID_ITEM")||(o.value=[])},d=(i,l)=>{l.ctrlKey||l.metaKey?o.value.includes(i.id)?o.value.splice(o.value.indexOf(i.id),1):o.value.push(i.id):o.value.includes(i.id)||(o.value=[i.id])};return(i,l)=>(e.openBlock(),e.createElementBlock("div",{class:"@container mb-4 flex-1 select-none",onClick:l[0]||(l[0]=u=>o.value=[]),onContextmenu:n},[e.createElementVNode("div",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.products,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,onClick:e.withModifiers(k=>v(u,k),["stop"]),onContextmenu:k=>d(u,k),class:"GRID_ITEM cursor-pointer"},[e.createElementVNode("div",{class:e.normalizeClass(["aspect-square bg-muted rounded-xl overflow-hidden mb-2 transition-all duration-200",{"outline outline-4 outline-primary/50":e.unref(o).includes(u.id)}])},[u.featuredMedia?(e.openBlock(),e.createElementBlock("img",{key:0,src:u.featuredMedia,class:"w-full h-full object-cover pointer-events-none",draggable:"false"},null,8,Z)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[e.createElementVNode("p",ee,e.toDisplayString(u.title),1),e.createElementVNode("p",te,[e.createElementVNode("span",oe,[u.status==="published"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[1]||(l[1]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-green-500"},null,-1)),l[2]||(l[2]=e.createTextVNode(" Published ",-1))],64)):u.status==="draft"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l[3]||(l[3]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-blue-500"},null,-1)),l[4]||(l[4]=e.createTextVNode(" Draft ",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l[5]||(l[5]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-gray-300"},null,-1)),l[6]||(l[6]=e.createTextVNode(" Archived ",-1))],64))]),u.variantsTotal>1?(e.openBlock(),e.createElementBlock("span",ne,"| "+e.toDisplayString(u.variantsTotal)+" variants",1)):e.createCommentVNode("",!0)])])],40,Y))),128))])],32))}}),re={class:"flex items-center gap-2"},se={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},ae={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},ie={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},ce=e.defineComponent({__name:"ListView",props:{products:{type:Array,required:!0}},setup(T){const o=e.inject("selection"),{navigateTo:f}=_.useModuleRoute(),{hasPermission:g}=_.useModulePermissions(),v=(n,d)=>{n?o.value.push(d):o.value=o.value.filter(i=>i!==d)};return(n,d)=>{const i=e.resolveComponent("TableHead"),l=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),k=e.resolveComponent("Checkbox"),x=e.resolveComponent("TableCell"),m=e.resolveComponent("AvatarImage"),t=e.resolveComponent("AvatarFallback"),p=e.resolveComponent("Avatar"),C=e.resolveComponent("TableBody"),V=e.resolveComponent("Table"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(V,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createVNode(i,null,{default:e.withCtx(()=>[...d[1]||(d[1]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode(" Variants",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("Price",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(C,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.products,c=>(e.openBlock(),e.createBlock(l,{key:c.id,onClick:w=>e.unref(f)(c.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(x,{key:0},{default:e.withCtx(()=>[e.createVNode(k,{"model-value":e.unref(o)?.includes(c.id),"onUpdate:modelValue":w=>v(w,c.id),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(x,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.createVNode(p,{class:"size-12 rounded-xl"},{default:e.withCtx(()=>[e.createVNode(m,{src:c.media?.[0],class:"object-cover"},null,8,["src"]),e.createVNode(t,{class:"rounded-xl"})]),_:2},1024),e.createElementVNode("span",null,e.toDisplayString(c.title),1)])]),_:2},1024),e.createVNode(x,null,{default:e.withCtx(()=>[c.status==="published"?(e.openBlock(),e.createElementBlock("span",se,"Published")):c.status==="draft"?(e.openBlock(),e.createElementBlock("span",ae,"Draft")):c.status==="archived"?(e.openBlock(),e.createElementBlock("span",ie,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(x,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.variantsTotal),1)]),_:2},1024),e.createVNode(x,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(" € "+e.toDisplayString(c.price||0),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),de={class:"truncate"},ue={key:0},me={key:1},pe={key:2},fe={key:3},ve={class:"relative w-full max-w-sm items-center"},Ce={class:"truncate"},xe={class:"truncate"},ge={class:"flex items-center space-x-2 mb-4"},Ve={class:"flex items-center space-x-2 mb-4"},Ne={class:"flex items-center space-x-2 mb-4"},ke=e.defineComponent({__name:"FilterPopover",setup(T){const o=e.inject("filter"),f=e.inject("collections"),g=()=>{o.value={collections:[],published:!0,draft:!0,archived:!1}};return(v,n)=>{const d=e.resolveComponent("Button"),i=e.resolveComponent("PopoverTrigger"),l=e.resolveComponent("ComboboxTrigger"),u=e.resolveComponent("ComboboxAnchor"),k=e.resolveComponent("ComboboxInput"),x=e.resolveComponent("ComboboxEmpty"),m=e.resolveComponent("ComboboxItemIndicator"),t=e.resolveComponent("ComboboxItem"),p=e.resolveComponent("ScrollArea"),C=e.resolveComponent("ComboboxGroup"),V=e.resolveComponent("ComboboxList"),N=e.resolveComponent("Combobox"),c=e.resolveComponent("Checkbox"),w=e.resolveComponent("PopoverContent"),h=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(h,null,{default:e.withCtx(()=>[e.createVNode(i,{asChild:""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Filter),{class:"size-4"}),n[4]||(n[4]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(w,{class:"w-64"},{default:e.withCtx(()=>[n[14]||(n[14]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Collection ",-1)),e.createVNode(N,{modelValue:e.unref(o).collections,"onUpdate:modelValue":n[0]||(n[0]=s=>e.unref(o).collections=s),by:"id",multiple:!0,class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(u,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(l,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline",class:"justify-between w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",de,[e.unref(o).collections.length===1?(e.openBlock(),e.createElementBlock("span",ue,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title),1)):e.unref(o).collections.length===2?(e.openBlock(),e.createElementBlock("span",me,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[1])?.title),1)):e.unref(o).collections.length>2?(e.openBlock(),e.createElementBlock("span",pe,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[1])?.title)+" + "+e.toDisplayString(e.unref(o).collections.length-2),1)):(e.openBlock(),e.createElementBlock("span",fe,"Select collection"))]),e.createVNode(e.unref(B.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(V,null,{default:e.withCtx(()=>[e.createElementVNode("div",ve,[e.createVNode(k,{placeholder:"Select category..."})]),e.createVNode(x,null,{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode(" No category found. ",-1)])]),_:1}),e.unref(f)?.filter(s=>s.status==="published")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[7]||(n[7]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium mt-2"},"Published",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f).filter(s=>s.status==="published"),s=>(e.openBlock(),e.createBlock(t,{key:s.id,value:s.id},{default:e.withCtx(()=>[n[6]||(n[6]=e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1)),e.createElementVNode("span",Ce,e.toDisplayString(s.title),1),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.Check),{class:e.normalizeClass(e.unref(j.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0),e.unref(f)?.filter(s=>s.status==="draft")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n[9]||(n[9]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium"},"Drafts",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f).filter(s=>s.status==="draft"),s=>(e.openBlock(),e.createBlock(t,{key:s.id,value:s.id},{default:e.withCtx(()=>[n[8]||(n[8]=e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",xe,e.toDisplayString(s.title),1),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.Check),{class:e.normalizeClass(e.unref(j.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"]),n[15]||(n[15]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",ge,[e.createVNode(c,{id:"chk_published_products",modelValue:e.unref(o).published,"onUpdate:modelValue":n[1]||(n[1]=s=>e.unref(o).published=s)},null,8,["modelValue"]),n[10]||(n[10]=e.createElementVNode("label",{for:"chk_published_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show published products ",-1))]),e.createElementVNode("div",Ve,[e.createVNode(c,{id:"chk_draft_products",modelValue:e.unref(o).draft,"onUpdate:modelValue":n[2]||(n[2]=s=>e.unref(o).draft=s)},null,8,["modelValue"]),n[11]||(n[11]=e.createElementVNode("label",{for:"chk_draft_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show draft products ",-1))]),e.createElementVNode("div",Ne,[e.createVNode(c,{id:"chk_archived_products",modelValue:e.unref(o).archived,"onUpdate:modelValue":n[3]||(n[3]=s=>e.unref(o).archived=s)},null,8,["modelValue"]),n[12]||(n[12]=e.createElementVNode("label",{for:"chk_archived_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show archived products ",-1))]),e.unref(o).collections.length>0||!e.unref(o).published||!e.unref(o).draft||e.unref(o).archived?(e.openBlock(),e.createBlock(d,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:g},{default:e.withCtx(()=>[e.createVNode(e.unref(B.RotateCcw),{class:"size-3"}),n[13]||(n[13]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),be=e.defineComponent({__name:"ProductContextMenu",emits:["selectAll","duplicateProduct","deleteProduct","deleteSelection"],setup(T,{emit:o}){const f=o,g=e.inject("products"),v=e.inject("selection"),n=e.inject("config"),{hasPermission:d}=_.useModulePermissions(),{navigateTo:i}=_.useModuleRoute(),l=e.computed(()=>v.value?.length!==1?null:g.value?.find(m=>m.id===v.value[0])),u=m=>{let t=n.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",m.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",m.slug),window.open(t,"_blank")},k=async(m,t)=>{try{if(!["draft","published","archived"].includes(t))return;await _.useFirebaseIntegration(n.project).update(n.productCollection,m.id,{status:t}),m.status=t,y.toast.success("Product status changed")}catch{y.toast.error("Failed to change product status")}},x=async m=>{try{if(!["draft","published","archived"].includes(m))return;const t=_.useFirebaseIntegration(n.project),p=[];v.value.forEach(async C=>{p.push(t.update(n.productCollection,C,{status:m}))}),y.toast.promise(Promise.all(p),{loading:`Changing status of ${v.value.length} products...`,success:()=>{const C=v.value.length;return v.value.forEach(V=>{g.value.find(N=>N.id==V).status=m}),v.value=[],`Product status changed for ${C} products`},error:C=>"Failed to change product status"})}catch{y.toast.error("Failed to change product status")}};return(m,t)=>{const p=e.resolveComponent("ContextMenuTrigger"),C=e.resolveComponent("ContextMenuShortcut"),V=e.resolveComponent("ContextMenuItem"),N=e.resolveComponent("ContextMenuContent"),c=e.resolveComponent("ContextMenuSeparator"),w=e.resolveComponent("ContextMenuSubTrigger"),h=e.resolveComponent("ContextMenuCheckboxItem"),s=e.resolveComponent("ContextMenuSubContent"),$=e.resolveComponent("ContextMenuSub"),z=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(z,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"default")]),_:3}),e.unref(v).length===0?(e.openBlock(),e.createBlock(N,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(V,{inset:"",onClick:t[0]||(t[0]=b=>f("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(v).length===1&&l.value?(e.openBlock(),e.createBlock(N,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(V,{inset:"",onClick:t[1]||(t[1]=b=>e.unref(i)(l.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit product ",-1)])]),_:1}),e.createVNode(c),e.unref(n).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(V,{inset:"",onClick:t[2]||(t[2]=b=>u(l.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview product ",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(c)],64)):e.createCommentVNode("",!0),e.createVNode(V,{inset:"",onClick:t[3]||(t[3]=b=>f("duplicateProduct",l.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate product ",-1)])]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(w,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(s,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[4]||(t[4]=b=>k(l.value,"draft")),modelValue:l.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[5]||(t[5]=b=>k(l.value,"published")),modelValue:l.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[6]||(t[6]=b=>k(l.value,"archived")),modelValue:l.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(V,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=b=>f("deleteProduct",l.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete product ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(v).length>1?(e.openBlock(),e.createBlock(N,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(w,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(v).length)+") ",1)]),_:1}),e.createVNode(s,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[8]||(t[8]=b=>x("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(h,{onClick:t[9]||(t[9]=b=>x("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(h,{onClick:t[10]||(t[10]=b=>x("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(V,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=b=>f("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete products ("+e.toDisplayString(e.unref(v).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),_e={class:"relative flex flex-col flex-1"},we={ref:"container",class:"flex items-center justify-between gap-4 w-full mt-12 mb-8"},he={class:"flex items-center gap-4"},ye={class:"text-lg whitespace-nowrap"},Be={class:"relative w-full max-w-sm items-center"},Ee={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},Pe={class:"flex items-center gap-4"},Te={class:"flex flex-1"},Se=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},async setup(T){let o,f;const g=T,{hasPermission:v}=_.useModulePermissions(),{navigateTo:n}=_.useModuleRoute(),{confirm:d}=_.useConfirmation();_.useModuleBreadcrumbs(()=>[]);const i=_.useFirebaseIntegration(g.config.project),l=e.ref([]),u=async()=>{const a=await i.find(g.config.productCollection);l.value=a||[]},k=e.useTemplateRef("container"),{width:x}=X.useElementSize(k),m=e.ref("grid"),t=e.ref(1),p=e.ref([]),C=e.ref(""),V=e.ref([]);V.value=([o,f]=e.withAsyncContext(()=>h()),o=await o,f(),o);const N=e.computed(()=>m.value==="grid"?x.value<768?6:x.value<896?8:x.value<1024?10:12:10),c=e.computed(()=>l.value.filter(a=>!(S.value.collections.length>0&&!a.collections?.some(r=>S.value.collections.includes(r))||!S.value.published&&a.status==="published"||!S.value.draft&&a.status==="draft"||!S.value.archived&&a.status==="archived")).filter(a=>a.title.toLowerCase().includes(C.value.toLowerCase())||a.slug.toLowerCase().includes(C.value.toLowerCase())||a.id.toLowerCase().includes(C.value.toLowerCase()))),w=e.computed(()=>{if(c.value.length<=N.value)return c.value;const a=(t.value-1)*N.value,r=a+N.value;return c.value.slice(a,r)});async function h(){if(!g.config.collectionsCollection)return[];const a=g.config.collectionsCollection.split(":");return a.length!==2?[]:(await i.get(a[0]))?.[a[1]]||[]}async function s(a){return(await i.find(g.config.productCollection,{filters:[{field:"slug",operator:"==",value:a}]})).length>0}const $=()=>{p.value=w.value.map(a=>a.id)},z=async a=>{try{let r={...a},P=r.slug+"-copy",M=2;for(;await s(P);)P=r.slug+"-copy-"+M,M++;r.id=void 0,r.createdAt=new Date,r.updatedAt=new Date,r.slug=P,r.status="draft",r.title=r.title+" (copy)";const F=await i.add(g.config.productCollection,r);n(F.id),y.toast.success("Product duplicated")}catch{y.toast.error("Failed to duplicate product")}},b=async a=>{if(await d(`Are you sure you want to delete "${a.title}"?`))try{await i.remove(g.config.productCollection,a.id),l.value=l.value.filter(P=>P.id!==a.id),p.value=[],y.toast.success("Product deleted")}catch{y.toast.error("Failed to delete product")}},A=async()=>{if(await d(`Are you sure you want to delete all selected products (${p.value.length})?`))try{p.value.forEach(async r=>{await i.remove(g.config.productCollection,r)}),l.value=l.value.filter(r=>!p.value.includes(r.id)),p.value=[],y.toast.success("Products deleted")}catch{y.toast.error("Failed to delete products")}},S=e.ref({collections:[],published:!0,draft:!0,archived:!1});e.watch(S,()=>{t.value=1});const I=a=>{a.target?.matches("input, textarea")||a.target?.isContentEditable||(a.key==="Escape"&&(p.value=[]),(a.metaKey||a.ctrlKey)&&a.key.toLowerCase()==="a"&&(a.preventDefault(),$()))};return e.onMounted(()=>{u(),window.addEventListener("keydown",I)}),e.onUnmounted(()=>{window.removeEventListener("keydown",I)}),e.provide("config",g.config),e.provide("filter",S),e.provide("products",l),e.provide("collections",V),e.provide("selection",p),(a,r)=>{const P=e.resolveComponent("Input"),M=e.resolveComponent("Button"),F=e.resolveComponent("SegmentedControlButton"),R=e.resolveComponent("SegmentedControl"),U=e.resolveComponent("PaginationFirst"),K=e.resolveComponent("PaginationPrev"),q=e.resolveComponent("PaginationListItem"),G=e.resolveComponent("PaginationEllipsis"),O=e.resolveComponent("PaginationNext"),H=e.resolveComponent("PaginationLast"),Q=e.resolveComponent("PaginationList"),W=e.resolveComponent("Pagination");return e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",we,[e.createElementVNode("div",he,[e.createElementVNode("p",ye,e.toDisplayString(c.value?.length)+" products",1),e.createElementVNode("div",Be,[e.createVNode(P,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:r[0]||(r[0]=e.withKeys(E=>C.value="",["escape"])),modelValue:C.value,"onUpdate:modelValue":r[1]||(r[1]=E=>C.value=E)},null,8,["modelValue"]),e.createElementVNode("span",Ee,[e.createVNode(e.unref(B.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",Pe,[p.value.length>0?(e.openBlock(),e.createBlock(M,{key:0,variant:"destructive",onClick:A},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(p.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(v)("create-product")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(M,{variant:"outline",onClick:r[2]||(r[2]=E=>e.unref(n)("new"))},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Plus),{class:"size-4"}),r[5]||(r[5]=e.createTextVNode(" New Product ",-1))]),_:1}),r[6]||(r[6]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(ke),r[7]||(r[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1)),e.createElementVNode("div",null,[e.createVNode(R,{modelValue:m.value,"onUpdate:modelValue":r[3]||(r[3]=E=>m.value=E),"aria-label":"View mode"},{default:e.withCtx(()=>[e.createVNode(F,{value:"grid"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.LayoutGrid),{class:"size-4"})]),_:1}),e.createVNode(F,{value:"list"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.List),{class:"size-4"})]),_:1})]),_:1},8,["modelValue"])])])],512),e.createElementVNode("div",Te,[e.createVNode(be,{onSelectAll:$,onDuplicateProduct:z,onDeleteProduct:b,onDeleteSelection:A},{default:e.withCtx(()=>[m.value==="grid"?(e.openBlock(),e.createBlock(le,{key:0,products:w.value},null,8,["products"])):(e.openBlock(),e.createBlock(ce,{key:1,products:w.value},null,8,["products"]))]),_:1})]),c.value?.length>N.value?(e.openBlock(),e.createBlock(W,{key:0,page:t.value,"onUpdate:page":r[4]||(r[4]=E=>t.value=E),"items-per-page":N.value,total:c.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(Q,{class:"flex items-center gap-1"},{default:e.withCtx(({items:E})=>[e.createVNode(U),e.createVNode(K),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E,(D,L)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[D.type==="page"?(e.openBlock(),e.createBlock(q,{key:L,value:D.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(M,{class:"size-10 p-0",variant:D.value===t.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(D.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(G,{key:D.type,index:L},null,8,["index"]))],64))),256)),e.createVNode(O),e.createVNode(H)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])}}});exports.default=Se;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("lucide-vue-next"),_=require("@oneclick.dev/cms-kit"),X=require("./index-CxETuRsG.js"),j=require("./utils-Yd6F5mea.js"),y=require("./index-ijdf0d9-.js"),J={class:"grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6"},Y=["onClick","onContextmenu"],Z=["src"],ee={class:"font-semibold"},te={class:"text-sm text-muted-foreground flex items-center gap-2"},oe={class:"flex items-center gap-2"},ne={key:0},le=e.defineComponent({__name:"GridView",props:{products:{type:Array,required:!0}},setup(T){const o=e.inject("selection"),{navigateTo:f}=_.useModuleRoute(),{hasPermission:g}=_.useModulePermissions(),v=(i,l)=>{const u=l.ctrlKey||l.metaKey;if(!l.shiftKey)if(u||o.value.length>0){const x=o.value.indexOf(i.id);x>-1?o.value.splice(x,1):o.value.push(i.id)}else o.value=[],f(i.id)},n=i=>{i.target.closest(".GRID_ITEM")||(o.value=[])},d=(i,l)=>{l.ctrlKey||l.metaKey?o.value.includes(i.id)?o.value.splice(o.value.indexOf(i.id),1):o.value.push(i.id):o.value.includes(i.id)||(o.value=[i.id])};return(i,l)=>(e.openBlock(),e.createElementBlock("div",{class:"@container mb-4 flex-1 select-none",onClick:l[0]||(l[0]=u=>o.value=[]),onContextmenu:n},[e.createElementVNode("div",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.products,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,onClick:e.withModifiers(k=>v(u,k),["stop"]),onContextmenu:k=>d(u,k),class:"GRID_ITEM cursor-pointer"},[e.createElementVNode("div",{class:e.normalizeClass(["aspect-square bg-muted rounded-xl overflow-hidden mb-2 transition-all duration-200",{"outline outline-4 outline-primary/50":e.unref(o).includes(u.id)}])},[u.featuredMedia?(e.openBlock(),e.createElementBlock("img",{key:0,src:u.featuredMedia,class:"w-full h-full object-cover pointer-events-none",draggable:"false"},null,8,Z)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[e.createElementVNode("p",ee,e.toDisplayString(u.title),1),e.createElementVNode("p",te,[e.createElementVNode("span",oe,[u.status==="published"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[1]||(l[1]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-green-500"},null,-1)),l[2]||(l[2]=e.createTextVNode(" Published ",-1))],64)):u.status==="draft"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l[3]||(l[3]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-blue-500"},null,-1)),l[4]||(l[4]=e.createTextVNode(" Draft ",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l[5]||(l[5]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-gray-300"},null,-1)),l[6]||(l[6]=e.createTextVNode(" Archived ",-1))],64))]),u.variantsTotal>1?(e.openBlock(),e.createElementBlock("span",ne,"| "+e.toDisplayString(u.variantsTotal)+" variants",1)):e.createCommentVNode("",!0)])])],40,Y))),128))])],32))}}),re={class:"flex items-center gap-2"},se={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},ae={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},ie={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},ce=e.defineComponent({__name:"ListView",props:{products:{type:Array,required:!0}},setup(T){const o=e.inject("selection"),{navigateTo:f}=_.useModuleRoute(),{hasPermission:g}=_.useModulePermissions(),v=(n,d)=>{n?o.value.push(d):o.value=o.value.filter(i=>i!==d)};return(n,d)=>{const i=e.resolveComponent("TableHead"),l=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),k=e.resolveComponent("Checkbox"),x=e.resolveComponent("TableCell"),m=e.resolveComponent("AvatarImage"),t=e.resolveComponent("AvatarFallback"),p=e.resolveComponent("Avatar"),C=e.resolveComponent("TableBody"),V=e.resolveComponent("Table"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(V,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createVNode(i,null,{default:e.withCtx(()=>[...d[1]||(d[1]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode(" Variants",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("Price",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(C,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.products,c=>(e.openBlock(),e.createBlock(l,{key:c.id,onClick:w=>e.unref(f)(c.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(x,{key:0},{default:e.withCtx(()=>[e.createVNode(k,{"model-value":e.unref(o)?.includes(c.id),"onUpdate:modelValue":w=>v(w,c.id),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(x,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.createVNode(p,{class:"size-12 rounded-xl"},{default:e.withCtx(()=>[e.createVNode(m,{src:c.media?.[0],class:"object-cover"},null,8,["src"]),e.createVNode(t,{class:"rounded-xl"})]),_:2},1024),e.createElementVNode("span",null,e.toDisplayString(c.title),1)])]),_:2},1024),e.createVNode(x,null,{default:e.withCtx(()=>[c.status==="published"?(e.openBlock(),e.createElementBlock("span",se,"Published")):c.status==="draft"?(e.openBlock(),e.createElementBlock("span",ae,"Draft")):c.status==="archived"?(e.openBlock(),e.createElementBlock("span",ie,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(x,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.variantsTotal),1)]),_:2},1024),e.createVNode(x,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(" € "+e.toDisplayString(c.price||0),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),de={class:"truncate"},ue={key:0},me={key:1},pe={key:2},fe={key:3},ve={class:"relative w-full max-w-sm items-center"},Ce={class:"truncate"},xe={class:"truncate"},ge={class:"flex items-center space-x-2 mb-4"},Ve={class:"flex items-center space-x-2 mb-4"},Ne={class:"flex items-center space-x-2 mb-4"},ke=e.defineComponent({__name:"FilterPopover",setup(T){const o=e.inject("filter"),f=e.inject("collections"),g=()=>{o.value={collections:[],published:!0,draft:!0,archived:!1}};return(v,n)=>{const d=e.resolveComponent("Button"),i=e.resolveComponent("PopoverTrigger"),l=e.resolveComponent("ComboboxTrigger"),u=e.resolveComponent("ComboboxAnchor"),k=e.resolveComponent("ComboboxInput"),x=e.resolveComponent("ComboboxEmpty"),m=e.resolveComponent("ComboboxItemIndicator"),t=e.resolveComponent("ComboboxItem"),p=e.resolveComponent("ScrollArea"),C=e.resolveComponent("ComboboxGroup"),V=e.resolveComponent("ComboboxList"),N=e.resolveComponent("Combobox"),c=e.resolveComponent("Checkbox"),w=e.resolveComponent("PopoverContent"),h=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(h,null,{default:e.withCtx(()=>[e.createVNode(i,{asChild:""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Filter),{class:"size-4"}),n[4]||(n[4]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(w,{class:"w-64"},{default:e.withCtx(()=>[n[14]||(n[14]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Collection ",-1)),e.createVNode(N,{modelValue:e.unref(o).collections,"onUpdate:modelValue":n[0]||(n[0]=s=>e.unref(o).collections=s),by:"id",multiple:!0,class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(u,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(l,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline",class:"justify-between w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",de,[e.unref(o).collections.length===1?(e.openBlock(),e.createElementBlock("span",ue,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title),1)):e.unref(o).collections.length===2?(e.openBlock(),e.createElementBlock("span",me,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[1])?.title),1)):e.unref(o).collections.length>2?(e.openBlock(),e.createElementBlock("span",pe,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[1])?.title)+" + "+e.toDisplayString(e.unref(o).collections.length-2),1)):(e.openBlock(),e.createElementBlock("span",fe,"Select collection"))]),e.createVNode(e.unref(B.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(V,null,{default:e.withCtx(()=>[e.createElementVNode("div",ve,[e.createVNode(k,{placeholder:"Select category..."})]),e.createVNode(x,null,{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode(" No category found. ",-1)])]),_:1}),e.unref(f)?.filter(s=>s.status==="published")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[7]||(n[7]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium mt-2"},"Published",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f).filter(s=>s.status==="published"),s=>(e.openBlock(),e.createBlock(t,{key:s.id,value:s.id},{default:e.withCtx(()=>[n[6]||(n[6]=e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1)),e.createElementVNode("span",Ce,e.toDisplayString(s.title),1),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.Check),{class:e.normalizeClass(e.unref(j.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0),e.unref(f)?.filter(s=>s.status==="draft")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n[9]||(n[9]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium"},"Drafts",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f).filter(s=>s.status==="draft"),s=>(e.openBlock(),e.createBlock(t,{key:s.id,value:s.id},{default:e.withCtx(()=>[n[8]||(n[8]=e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",xe,e.toDisplayString(s.title),1),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.Check),{class:e.normalizeClass(e.unref(j.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"]),n[15]||(n[15]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",ge,[e.createVNode(c,{id:"chk_published_products",modelValue:e.unref(o).published,"onUpdate:modelValue":n[1]||(n[1]=s=>e.unref(o).published=s)},null,8,["modelValue"]),n[10]||(n[10]=e.createElementVNode("label",{for:"chk_published_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show published products ",-1))]),e.createElementVNode("div",Ve,[e.createVNode(c,{id:"chk_draft_products",modelValue:e.unref(o).draft,"onUpdate:modelValue":n[2]||(n[2]=s=>e.unref(o).draft=s)},null,8,["modelValue"]),n[11]||(n[11]=e.createElementVNode("label",{for:"chk_draft_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show draft products ",-1))]),e.createElementVNode("div",Ne,[e.createVNode(c,{id:"chk_archived_products",modelValue:e.unref(o).archived,"onUpdate:modelValue":n[3]||(n[3]=s=>e.unref(o).archived=s)},null,8,["modelValue"]),n[12]||(n[12]=e.createElementVNode("label",{for:"chk_archived_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show archived products ",-1))]),e.unref(o).collections.length>0||!e.unref(o).published||!e.unref(o).draft||e.unref(o).archived?(e.openBlock(),e.createBlock(d,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:g},{default:e.withCtx(()=>[e.createVNode(e.unref(B.RotateCcw),{class:"size-3"}),n[13]||(n[13]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),be=e.defineComponent({__name:"ProductContextMenu",emits:["selectAll","duplicateProduct","deleteProduct","deleteSelection"],setup(T,{emit:o}){const f=o,g=e.inject("products"),v=e.inject("selection"),n=e.inject("config"),{hasPermission:d}=_.useModulePermissions(),{navigateTo:i}=_.useModuleRoute(),l=e.computed(()=>v.value?.length!==1?null:g.value?.find(m=>m.id===v.value[0])),u=m=>{let t=n.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",m.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",m.slug),window.open(t,"_blank")},k=async(m,t)=>{try{if(!["draft","published","archived"].includes(t))return;await _.useFirebaseIntegration(n.project).update(n.productCollection,m.id,{status:t}),m.status=t,y.toast.success("Product status changed")}catch{y.toast.error("Failed to change product status")}},x=async m=>{try{if(!["draft","published","archived"].includes(m))return;const t=_.useFirebaseIntegration(n.project),p=[];v.value.forEach(async C=>{p.push(t.update(n.productCollection,C,{status:m}))}),y.toast.promise(Promise.all(p),{loading:`Changing status of ${v.value.length} products...`,success:()=>{const C=v.value.length;return v.value.forEach(V=>{g.value.find(N=>N.id==V).status=m}),v.value=[],`Product status changed for ${C} products`},error:C=>"Failed to change product status"})}catch{y.toast.error("Failed to change product status")}};return(m,t)=>{const p=e.resolveComponent("ContextMenuTrigger"),C=e.resolveComponent("ContextMenuShortcut"),V=e.resolveComponent("ContextMenuItem"),N=e.resolveComponent("ContextMenuContent"),c=e.resolveComponent("ContextMenuSeparator"),w=e.resolveComponent("ContextMenuSubTrigger"),h=e.resolveComponent("ContextMenuCheckboxItem"),s=e.resolveComponent("ContextMenuSubContent"),$=e.resolveComponent("ContextMenuSub"),z=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(z,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"default")]),_:3}),e.unref(v).length===0?(e.openBlock(),e.createBlock(N,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(V,{inset:"",onClick:t[0]||(t[0]=b=>f("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(v).length===1&&l.value?(e.openBlock(),e.createBlock(N,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(V,{inset:"",onClick:t[1]||(t[1]=b=>e.unref(i)(l.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit product ",-1)])]),_:1}),e.createVNode(c),e.unref(n).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(V,{inset:"",onClick:t[2]||(t[2]=b=>u(l.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview product ",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(c)],64)):e.createCommentVNode("",!0),e.createVNode(V,{inset:"",onClick:t[3]||(t[3]=b=>f("duplicateProduct",l.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate product ",-1)])]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(w,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(s,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[4]||(t[4]=b=>k(l.value,"draft")),modelValue:l.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[5]||(t[5]=b=>k(l.value,"published")),modelValue:l.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[6]||(t[6]=b=>k(l.value,"archived")),modelValue:l.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(V,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=b=>f("deleteProduct",l.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete product ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(v).length>1?(e.openBlock(),e.createBlock(N,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(w,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(v).length)+") ",1)]),_:1}),e.createVNode(s,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[8]||(t[8]=b=>x("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(h,{onClick:t[9]||(t[9]=b=>x("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(h,{onClick:t[10]||(t[10]=b=>x("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(V,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=b=>f("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete products ("+e.toDisplayString(e.unref(v).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),_e={class:"relative flex flex-col flex-1"},we={ref:"container",class:"flex items-center justify-between gap-4 w-full mt-12 mb-8"},he={class:"flex items-center gap-4"},ye={class:"text-lg whitespace-nowrap"},Be={class:"relative w-full max-w-sm items-center"},Ee={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},Pe={class:"flex items-center gap-4"},Te={class:"flex flex-1"},Se=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},async setup(T){let o,f;const g=T,{hasPermission:v}=_.useModulePermissions(),{navigateTo:n}=_.useModuleRoute(),{confirm:d}=_.useConfirmation();_.useModuleBreadcrumbs(()=>[]);const i=_.useFirebaseIntegration(g.config.project),l=e.ref([]),u=async()=>{const a=await i.find(g.config.productCollection);l.value=a||[]},k=e.useTemplateRef("container"),{width:x}=X.useElementSize(k),m=e.ref("grid"),t=e.ref(1),p=e.ref([]),C=e.ref(""),V=e.ref([]);V.value=([o,f]=e.withAsyncContext(()=>h()),o=await o,f(),o);const N=e.computed(()=>m.value==="grid"?x.value<768?6:x.value<896?8:x.value<1024?10:12:10),c=e.computed(()=>l.value.filter(a=>!(S.value.collections.length>0&&!a.collections?.some(r=>S.value.collections.includes(r))||!S.value.published&&a.status==="published"||!S.value.draft&&a.status==="draft"||!S.value.archived&&a.status==="archived")).filter(a=>a.title.toLowerCase().includes(C.value.toLowerCase())||a.slug.toLowerCase().includes(C.value.toLowerCase())||a.id.toLowerCase().includes(C.value.toLowerCase()))),w=e.computed(()=>{if(c.value.length<=N.value)return c.value;const a=(t.value-1)*N.value,r=a+N.value;return c.value.slice(a,r)});async function h(){if(!g.config.collectionsCollection)return[];const a=g.config.collectionsCollection.split(":");return a.length!==2?[]:(await i.get(a[0]))?.[a[1]]||[]}async function s(a){return(await i.find(g.config.productCollection,{filters:[{field:"slug",operator:"==",value:a}]})).length>0}const $=()=>{p.value=w.value.map(a=>a.id)},z=async a=>{try{let r={...a},P=r.slug+"-copy",M=2;for(;await s(P);)P=r.slug+"-copy-"+M,M++;r.id=void 0,r.createdAt=new Date,r.updatedAt=new Date,r.slug=P,r.status="draft",r.title=r.title+" (copy)";const F=await i.add(g.config.productCollection,r);n(F.id),y.toast.success("Product duplicated")}catch{y.toast.error("Failed to duplicate product")}},b=async a=>{if(await d(`Are you sure you want to delete "${a.title}"?`))try{await i.remove(g.config.productCollection,a.id),l.value=l.value.filter(P=>P.id!==a.id),p.value=[],y.toast.success("Product deleted")}catch{y.toast.error("Failed to delete product")}},A=async()=>{if(await d(`Are you sure you want to delete all selected products (${p.value.length})?`))try{p.value.forEach(async r=>{await i.remove(g.config.productCollection,r)}),l.value=l.value.filter(r=>!p.value.includes(r.id)),p.value=[],y.toast.success("Products deleted")}catch{y.toast.error("Failed to delete products")}},S=e.ref({collections:[],published:!0,draft:!0,archived:!1});e.watch(S,()=>{t.value=1});const I=a=>{a.target?.matches("input, textarea")||a.target?.isContentEditable||(a.key==="Escape"&&(p.value=[]),(a.metaKey||a.ctrlKey)&&a.key.toLowerCase()==="a"&&(a.preventDefault(),$()))};return e.onMounted(()=>{u(),window.addEventListener("keydown",I)}),e.onUnmounted(()=>{window.removeEventListener("keydown",I)}),e.provide("config",g.config),e.provide("filter",S),e.provide("products",l),e.provide("collections",V),e.provide("selection",p),(a,r)=>{const P=e.resolveComponent("Input"),M=e.resolveComponent("Button"),F=e.resolveComponent("SegmentedControlButton"),R=e.resolveComponent("SegmentedControl"),U=e.resolveComponent("PaginationFirst"),K=e.resolveComponent("PaginationPrev"),q=e.resolveComponent("PaginationListItem"),G=e.resolveComponent("PaginationEllipsis"),O=e.resolveComponent("PaginationNext"),H=e.resolveComponent("PaginationLast"),Q=e.resolveComponent("PaginationList"),W=e.resolveComponent("Pagination");return e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",we,[e.createElementVNode("div",he,[e.createElementVNode("p",ye,e.toDisplayString(c.value?.length)+" products",1),e.createElementVNode("div",Be,[e.createVNode(P,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:r[0]||(r[0]=e.withKeys(E=>C.value="",["escape"])),modelValue:C.value,"onUpdate:modelValue":r[1]||(r[1]=E=>C.value=E)},null,8,["modelValue"]),e.createElementVNode("span",Ee,[e.createVNode(e.unref(B.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",Pe,[p.value.length>0?(e.openBlock(),e.createBlock(M,{key:0,variant:"destructive",onClick:A},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(p.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(v)("create-product")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(M,{variant:"outline",onClick:r[2]||(r[2]=E=>e.unref(n)("new"))},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Plus),{class:"size-4"}),r[5]||(r[5]=e.createTextVNode(" New Product ",-1))]),_:1}),r[6]||(r[6]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(ke),r[7]||(r[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1)),e.createElementVNode("div",null,[e.createVNode(R,{modelValue:m.value,"onUpdate:modelValue":r[3]||(r[3]=E=>m.value=E),"aria-label":"View mode"},{default:e.withCtx(()=>[e.createVNode(F,{value:"grid"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.LayoutGrid),{class:"size-4"})]),_:1}),e.createVNode(F,{value:"list"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.List),{class:"size-4"})]),_:1})]),_:1},8,["modelValue"])])])],512),e.createElementVNode("div",Te,[e.createVNode(be,{onSelectAll:$,onDuplicateProduct:z,onDeleteProduct:b,onDeleteSelection:A},{default:e.withCtx(()=>[m.value==="grid"?(e.openBlock(),e.createBlock(le,{key:0,products:w.value},null,8,["products"])):(e.openBlock(),e.createBlock(ce,{key:1,products:w.value},null,8,["products"]))]),_:1})]),c.value?.length>N.value?(e.openBlock(),e.createBlock(W,{key:0,page:t.value,"onUpdate:page":r[4]||(r[4]=E=>t.value=E),"items-per-page":N.value,total:c.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(Q,{class:"flex items-center gap-1"},{default:e.withCtx(({items:E})=>[e.createVNode(U),e.createVNode(K),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E,(D,L)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[D.type==="page"?(e.openBlock(),e.createBlock(q,{key:L,value:D.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(M,{class:"size-10 p-0",variant:D.value===t.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(D.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(G,{key:D.type,index:L},null,8,["index"]))],64))),256)),e.createVNode(O),e.createVNode(H)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])}}});exports.default=Se;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as G, resolveComponent as n, openBlock as c, createElementBlock as k, Fragment as te, renderList as le, createBlock as w, unref as C, withCtx as l, createElementVNode as o, normalizeClass as oe, resolveDynamicComponent as ne, toDisplayString as P, createCommentVNode as U, createVNode as t, withModifiers as Ee, createTextVNode as d, ref as v, computed as q, useTemplateRef as Se, onMounted as De } from "vue";
|
|
2
2
|
import { icons as ae, EllipsisVertical as Te, Paintbrush as Pe, ToyBrick as Me, Plus as Ue } from "lucide-vue-next";
|
|
3
3
|
import { useModuleRoute as se, useConfirmation as ie, useModuleStorage as $e, useModulePermissions as Ne, useModuleBreadcrumbs as Re, useFirebaseIntegration as Ae } from "@oneclick.dev/cms-kit";
|
|
4
|
-
import { i as Le } from "./interpolation-
|
|
4
|
+
import { i as Le } from "./interpolation-DEDSLETn.mjs";
|
|
5
5
|
import { t as z } from "./index-RLz1QPrf.mjs";
|
|
6
6
|
const Be = { class: "grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4" }, Ie = { class: "relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3" }, Fe = { class: "self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]" }, ze = ["title"], Oe = ["title"], je = { class: "absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100" }, qe = /* @__PURE__ */ G({
|
|
7
7
|
__name: "CollectionsGridView",
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { defineComponent as _e, ref as
|
|
1
|
+
import { defineComponent as _e, ref as f, computed as te, watch as he, onMounted as ye, resolveComponent as h, openBlock as n, createElementBlock as i, createElementVNode as s, toDisplayString as u, unref as r, Fragment as w, renderList as D, normalizeClass as L, createVNode as t, withCtx as l, createCommentVNode as T, createBlock as P, createTextVNode as y, resolveDynamicComponent as W, normalizeStyle as se } from "vue";
|
|
2
2
|
import { useModule as be, useModuleRoute as we, useModuleBreadcrumbs as Ce } from "@oneclick.dev/cms-kit";
|
|
3
3
|
import "./index-CMk3uhUt.mjs";
|
|
4
4
|
import { componentToString as oe, ChartTooltipContent as ae } from "@oneclick.dev/cms-kit/charts";
|
|
5
5
|
import { MousePointerClick as ke, Users as $e, Eye as De, Clock as Te, Zap as Pe, TrendingDown as le, TrendingUp as ne, UserPlus as Se, Activity as Ue, RefreshCw as Ve, Loader2 as Re, ArrowUpRight as Me, Globe as Fe, Minus as Ae, Smartphone as ze, Tablet as Ne, Monitor as Be } from "lucide-vue-next";
|
|
6
6
|
import { S as re, C as j, A as ie, z as ue } from "./index-_2lRVt_k.mjs";
|
|
7
7
|
import { C as ce, a as H } from "./index-p5Uqu8c2.mjs";
|
|
8
|
-
const Le = { class: "flex flex-col gap-
|
|
8
|
+
const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je = { class: "flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center" }, Ge = { class: "text-muted-foreground text-sm mt-1" }, Ie = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "flex items-center gap-2"
|
|
11
11
|
}, Xe = { class: "flex items-center border rounded-lg overflow-hidden" }, Ee = ["onClick"], Oe = { class: "text-sm text-destructive font-medium" }, We = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "flex items-center justify-center py-20"
|
|
14
|
-
}, He = { class: "flex items-start justify-between" }, qe = { class: "flex items-center gap-2" }, Ke = { class: "text-sm font-medium" }, Ze = { class: "grid grid-cols-2 @
|
|
14
|
+
}, He = { class: "flex items-start justify-between" }, qe = { class: "flex items-center gap-2" }, Ke = { class: "text-sm font-medium" }, Ze = { class: "grid grid-cols-2 @md:grid-cols-3 @xl:grid-cols-4 gap-4" }, Je = { class: "flex items-center gap-1.5 text-muted-foreground mb-2" }, Qe = { class: "text-xs font-medium uppercase tracking-wide" }, Ye = { class: "text-2xl font-semibold tabular-nums" }, et = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "flex items-center gap-1 mt-1"
|
|
17
|
-
}, tt = { class: "grid @
|
|
17
|
+
}, tt = { class: "flex flex-col @xl:grid @xl:grid-cols-2 gap-4 max-w-full" }, st = { class: "flex flex-col @lg:grid @lg:grid-cols-2 gap-4" }, ot = { class: "divide-y" }, at = { class: "flex items-center gap-3 min-w-0" }, lt = { class: "text-muted-foreground w-5 text-right shrink-0" }, nt = { class: "truncate font-mono text-xs" }, rt = { class: "flex items-center gap-4 shrink-0 tabular-nums" }, it = { class: "text-muted-foreground text-xs w-16 text-right" }, ut = { class: "text-muted-foreground text-xs w-16 text-right" }, ct = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "px-6 py-8 text-center text-muted-foreground text-sm"
|
|
20
|
-
}, dt = { class: "divide-y" },
|
|
20
|
+
}, dt = { class: "divide-y" }, ft = { class: "flex items-center gap-3 min-w-0" }, mt = { class: "text-muted-foreground w-5 text-right shrink-0" }, vt = { class: "truncate" }, pt = { class: "flex items-center gap-4 shrink-0 tabular-nums" }, gt = { class: "text-muted-foreground text-xs w-20 text-right" }, xt = {
|
|
21
21
|
key: 0,
|
|
22
22
|
class: "px-6 py-8 text-center text-muted-foreground text-sm"
|
|
23
|
-
}, _t = { class: "grid @lg:grid-cols-2 gap-
|
|
23
|
+
}, _t = { class: "grid @lg:grid-cols-2 gap-4" }, ht = { class: "space-y-3" }, yt = { class: "text-sm capitalize flex-1" }, bt = { class: "flex-1 h-2 bg-muted rounded-full overflow-hidden" }, wt = { class: "text-xs tabular-nums text-muted-foreground w-16 text-right" }, Ct = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "py-4 text-center text-muted-foreground text-sm"
|
|
26
26
|
}, kt = { class: "space-y-3" }, $t = { class: "text-sm flex-1" }, Dt = { class: "flex-1 h-2 bg-muted rounded-full overflow-hidden" }, Tt = { class: "text-xs tabular-nums text-muted-foreground w-16 text-right" }, Pt = {
|
|
@@ -31,11 +31,11 @@ const Le = { class: "flex flex-col gap-6 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
31
31
|
setup(St) {
|
|
32
32
|
const { config: G } = be(), { moduleId: de } = we();
|
|
33
33
|
Ce(() => [{ label: "Overview" }]);
|
|
34
|
-
const C =
|
|
34
|
+
const C = f(!0), V = f(null), R = f("30"), S = f([]), m = f({}), fe = f({}), v = f({}), q = f(0), I = f([]), X = f([]), M = f([]), F = f([]), A = te(() => !!(G.serviceAccount && G.propertyId));
|
|
35
35
|
function k(a) {
|
|
36
36
|
return `/api/v1/modules/${de}${a}`;
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const me = [
|
|
39
39
|
{ label: "7 days", value: "7" },
|
|
40
40
|
{ label: "14 days", value: "14" },
|
|
41
41
|
{ label: "30 days", value: "30" },
|
|
@@ -60,51 +60,51 @@ const Le = { class: "flex flex-col gap-6 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
60
60
|
}, pe = te(() => [
|
|
61
61
|
{
|
|
62
62
|
label: "Sessions",
|
|
63
|
-
value: p(
|
|
63
|
+
value: p(m.value.sessions || 0),
|
|
64
64
|
icon: ke,
|
|
65
65
|
change: v.value.sessions
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
label: "Users",
|
|
69
|
-
value: p(
|
|
69
|
+
value: p(m.value.totalUsers || 0),
|
|
70
70
|
icon: $e,
|
|
71
71
|
change: v.value.totalUsers
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
label: "Page Views",
|
|
75
|
-
value: p(
|
|
75
|
+
value: p(m.value.screenPageViews || 0),
|
|
76
76
|
icon: De,
|
|
77
77
|
change: v.value.screenPageViews
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
label: "Avg. Duration",
|
|
81
|
-
value: ge(
|
|
81
|
+
value: ge(m.value.averageSessionDuration || 0),
|
|
82
82
|
icon: Te,
|
|
83
83
|
change: v.value.averageSessionDuration
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
label: "Engagement",
|
|
87
|
-
value: `${((
|
|
87
|
+
value: `${((m.value.engagementRate || 0) * 100).toFixed(1)}%`,
|
|
88
88
|
icon: Pe,
|
|
89
89
|
change: v.value.engagementRate,
|
|
90
90
|
positive: !0
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
label: "Bounce Rate",
|
|
94
|
-
value: `${((
|
|
95
|
-
icon: (
|
|
94
|
+
value: `${((m.value.bounceRate || 0) * 100).toFixed(1)}%`,
|
|
95
|
+
icon: (m.value.bounceRate || 0) > 0.5 ? le : ne,
|
|
96
96
|
change: v.value.bounceRate,
|
|
97
97
|
positive: !1
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
label: "New Users",
|
|
101
|
-
value: p(
|
|
101
|
+
value: p(m.value.newUsers || 0),
|
|
102
102
|
icon: Se,
|
|
103
103
|
change: v.value.newUsers
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
label: "Pages / Session",
|
|
107
|
-
value: (
|
|
107
|
+
value: (m.value.screenPageViewsPerSession || 0).toFixed(1),
|
|
108
108
|
icon: Ue,
|
|
109
109
|
change: v.value.screenPageViewsPerSession
|
|
110
110
|
}
|
|
@@ -143,7 +143,7 @@ const Le = { class: "flex flex-col gap-6 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
143
143
|
$fetch(k(`/devices?startDate=${a}&endDate=today`)),
|
|
144
144
|
$fetch(k(`/countries?startDate=${a}&endDate=today`))
|
|
145
145
|
]);
|
|
146
|
-
S.value = e.rows || [],
|
|
146
|
+
S.value = e.rows || [], m.value = e.totals || {}, fe.value = e.previousTotals || {}, v.value = e.changes || {}, q.value = d.activeUsers || 0, I.value = c.rows || [], X.value = b.rows || [], M.value = g.rows || [], F.value = _.rows || [];
|
|
147
147
|
} catch (e) {
|
|
148
148
|
console.error("Failed to fetch analytics data:", e), V.value = e?.data?.statusMessage || e?.message || "Failed to load analytics data";
|
|
149
149
|
} finally {
|
|
@@ -162,7 +162,7 @@ const Le = { class: "flex flex-col gap-6 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
162
162
|
]),
|
|
163
163
|
A.value ? (n(), i("div", Ie, [
|
|
164
164
|
s("div", Xe, [
|
|
165
|
-
(n(), i(w, null, D(
|
|
165
|
+
(n(), i(w, null, D(me, (o) => s("button", {
|
|
166
166
|
key: o.value,
|
|
167
167
|
class: L(["px-3 py-1.5 text-xs font-medium transition-colors", R.value === o.value ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted"]),
|
|
168
168
|
onClick: (B) => R.value = o.value
|
|
@@ -450,8 +450,8 @@ const Le = { class: "flex flex-col gap-6 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
450
450
|
key: o.sessionSource,
|
|
451
451
|
class: "flex items-center justify-between px-6 py-3 text-sm"
|
|
452
452
|
}, [
|
|
453
|
-
s("div",
|
|
454
|
-
s("span",
|
|
453
|
+
s("div", ft, [
|
|
454
|
+
s("span", mt, u(B + 1), 1),
|
|
455
455
|
t(r(Me), { class: "size-3.5 text-muted-foreground shrink-0" }),
|
|
456
456
|
s("span", vt, u(o.sessionSource || "(direct)"), 1)
|
|
457
457
|
]),
|