@oneclick.dev/cms-core-modules 0.0.119 → 0.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ContentEditor-BnOVpmsQ.js → ContentEditor-Dl41qaCh.js} +42 -41
- package/dist/{ContentEditor-Cm28u_14.mjs → ContentEditor-u3k-uTny.mjs} +4785 -4492
- package/dist/{Detail-C8wQiDcv.js → Detail-BCUUNWvp.js} +1 -1
- package/dist/{Detail-CtItxMX4.mjs → Detail-B_scnidb.mjs} +1 -1
- package/dist/Detail-Cn9Bk0u0.mjs +852 -0
- package/dist/Detail-DGg_xXZc.js +1 -0
- package/dist/Detail-Dk8E6_uF.mjs +3731 -0
- package/dist/Detail-Sc2qZdxj.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-4_t0PPqM.mjs +78 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js +1 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +1 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs +1500 -0
- package/dist/Overview-CVgViW3c.mjs +852 -0
- package/dist/Overview-DEF-z7Yb.js +1 -0
- package/dist/Overview-Tf_ApkWh.js +1 -0
- package/dist/{Overview-CVQ1pkuD.mjs → Overview-usm5gPD1.mjs} +131 -131
- package/dist/{agenda-BtmnpFmi.js → agenda-B54F8cEr.js} +1 -1
- package/dist/{agenda-D0QBOJUy.mjs → agenda-BCKDYOeF.mjs} +7 -7
- package/dist/{availability-ClBGVgE9.js → availability-C4v46rha.js} +1 -1
- package/dist/{availability-D8JdA4rP.mjs → availability-DVT1Mdxq.mjs} +1 -1
- package/dist/{booking-data-aMS1p_3g.js → booking-data-A5JrLY4j.js} +1 -1
- package/dist/{booking-data-Px7XCIfU.mjs → booking-data-lZvSYna2.mjs} +1 -1
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-Dgj54ULn.mjs → exceptions-DJHfvADv.mjs} +1 -1
- package/dist/{exceptions-DXqc0Nza.js → exceptions-DKc8fO1S.js} +1 -1
- package/dist/index-Bk3yLv_G.js +35 -0
- package/dist/{index-Dnn2SCSl.js → index-CZau1wR8.js} +1 -1
- package/dist/{index-DRqJOqUR.mjs → index-DE8rdSjd.mjs} +0 -22
- package/dist/index-DU3Ib10Z.mjs +1256 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +35 -33
- package/dist/orders-BMosTk6r.js +1 -0
- package/dist/{orders-C5NT99Fy.mjs → orders-CElKNc1v.mjs} +229 -234
- package/dist/{payment-D5j-68Ig.mjs → payment-DSQ_2FIT.mjs} +1 -1
- package/dist/{payment-BJHgpaeT.js → payment-DlgYuea2.js} +1 -1
- package/dist/{refunds-oVB2Opib.js → refunds-Cvw9N--u.js} +1 -1
- package/dist/{refunds-D9nTeD2d.mjs → refunds-xR936Ted.mjs} +1 -1
- package/dist/reports-BQT_GZzU.js +158 -0
- package/dist/reports-DksZCTOw.mjs +837 -0
- package/dist/{resources-CK0oWssj.mjs → resources-C-5BU9Ux.mjs} +1 -1
- package/dist/{resources-8WouFvJe.js → resources-D04yKKVN.js} +1 -1
- package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +2 -0
- package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +1 -0
- package/dist/src/productCollections/components/detail/Subcollections.vue.d.ts +2 -0
- package/dist/src/productCollections/types.d.ts +1 -4
- package/dist/src/products/components/detail/variants/VariantList.vue.d.ts +48 -6
- package/dist/src/products/components/detail/variants/dialogs/VariantDialog.vue.d.ts +4 -0
- package/dist/{vee-validate-zod-CcOwoF6y.mjs → vee-validate-zod-SjDT8X35.mjs} +92 -90
- package/dist/{vee-validate-zod-ByykgYKJ.js → vee-validate-zod-VCmLnrtQ.js} +1 -1
- package/package.json +2 -2
- package/dist/Detail-C1Blq61w.mjs +0 -585
- package/dist/Detail-CPqug27l.js +0 -1
- package/dist/Detail-CjuhjPby.js +0 -1
- package/dist/Detail-Dnpnmy4-.mjs +0 -3477
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +0 -1
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +0 -77
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CcMEKZzd.mjs +0 -1476
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CkFsdcvP.js +0 -1
- package/dist/Overview-BWLxUksJ.mjs +0 -860
- package/dist/Overview-CBahJviK.js +0 -1
- package/dist/Overview-DAxCu9XC.js +0 -1
- package/dist/index-BnFWz40Q.mjs +0 -1261
- package/dist/index-DcGPR_vt.js +0 -35
- package/dist/orders-lO3dZ5un.js +0 -1
- /package/dist/src/{productCollections/components/detail/SEO.vue.d.ts → appointments/pages/edit/reports.vue.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as q, inject as Z, resolveComponent as p, openBlock as u, createElementBlock as c, createElementVNode as o, createVNode as t, withCtx as s, createTextVNode as d, createCommentVNode as I, ref as F, Fragment as D, renderList as N, unref as V, toDisplayString as S, withModifiers as Ce, normalizeClass as U, useTemplateRef as we, nextTick as Oe, reactive as De, computed as Ie, provide as Te, createBlock as Q, normalizeStyle as he } from "vue";
|
|
2
|
-
import { _ as Ae } from "./EditLayout.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { _ as Ae } from "./EditLayout.vue_vue_type_script_setup_true_lang-4_t0PPqM.mjs";
|
|
3
3
|
import { DollarSign as Pe, Pencil as Re, Trash2 as J, PlusCircle as X, AlertTriangle as de, Users as ie, ChevronDown as Ue } from "lucide-vue-next";
|
|
4
4
|
import { useConfirmation as $e, useModuleRoute as Me, useModulePermissions as Ne, useModule as ze, useFirebaseIntegration as Ee } from "@oneclick.dev/cms-kit";
|
|
5
5
|
import { t as Le } from "./index-RLz1QPrf.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),re=require("./EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js"),N=require("lucide-vue-next"),T=require("@oneclick.dev/cms-kit"),de=require("./index-ijdf0d9-.js"),se={class:"flex gap-3 items-start p-4 border rounded-lg"},ie={class:"flex-1 space-y-3"},ce={class:"grid grid-cols-2 gap-3"},me={class:"flex items-center space-x-2 my-4"},ue={class:"grid grid-cols-2 gap-2"},pe={key:0},Ve={key:1},fe={key:2},xe={key:3},Ne={key:4},ge={key:0},ve=e.defineComponent({__name:"Addon",props:{addOn:{type:Object,required:!0}},setup(i){const y=e.inject("form"),g=C=>{y.addOns=y.addOns.filter(a=>a.id!==C)};return(C,a)=>{const m=e.resolveComponent("Label"),x=e.resolveComponent("Input"),v=e.resolveComponent("Checkbox"),f=e.resolveComponent("SelectTrigger"),p=e.resolveComponent("SelectItem"),_=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),b=e.resolveComponent("Select"),A=e.resolveComponent("Trash2"),B=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",se,[e.createElementVNode("div",ie,[e.createElementVNode("div",ce,[e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode("Add-on Name",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.name,"onUpdate:modelValue":a[0]||(a[0]=V=>i.addOn.name=V),placeholder:"e.g., Swimsuit Rental, Towel Service"},null,8,["modelValue"])]),e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[8]||(a[8]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.price,"onUpdate:modelValue":a[1]||(a[1]=V=>i.addOn.price=V),modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",placeholder:"0.00",class:"no-spinner"},null,8,["modelValue"])])]),e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("Description (Optional)",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.description,"onUpdate:modelValue":a[2]||(a[2]=V=>i.addOn.description=V),placeholder:"Brief description of this add-on"},null,8,["modelValue"])]),e.createElementVNode("div",me,[e.createVNode(v,{id:`required-${i.addOn.id}`,modelValue:i.addOn.required,"onUpdate:modelValue":a[3]||(a[3]=V=>i.addOn.required=V)},null,8,["id","modelValue"]),e.createVNode(m,{for:`required-${i.addOn.id}`,class:"text-xs font-normal cursor-pointer"},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode(" Required (customer must select this add-on) ",-1)])]),_:1},8,["for"])]),e.createElementVNode("div",ue,[e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("Quantity limit",-1)])]),_:1}),e.createVNode(b,{modelValue:i.addOn.scope,"onUpdate:modelValue":a[4]||(a[4]=V=>i.addOn.scope=V)},{default:e.withCtx(()=>[e.createVNode(f,{class:"w-full"},{default:e.withCtx(()=>[i.addOn.scope==="RESERVATION"?(e.openBlock(),e.createElementBlock("span",pe,"Once per reservation")):i.addOn.scope==="TICKET"?(e.openBlock(),e.createElementBlock("span",Ve,"Once per ticket / person")):i.addOn.scope==="UNLIMITED"?(e.openBlock(),e.createElementBlock("span",fe,"Unlimited")):i.addOn.scope==="CUSTOM_LIMIT"?(e.openBlock(),e.createElementBlock("span",xe,"Custom limit...")):(e.openBlock(),e.createElementBlock("span",Ne,"Select a limit…"))]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(_,{class:"max-w-96"},{default:e.withCtx(()=>[e.createVNode(p,{value:"RESERVATION"},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Once per reservation"),e.createElementVNode("p",{class:"text-xs"},"Max 1 per reservation line (charged per reservation).")],-1)])]),_:1}),e.createVNode(p,{value:"TICKET"},{default:e.withCtx(()=>[...a[13]||(a[13]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Once per ticket / person"),e.createElementVNode("p",{class:"text-xs"},"Max 1 per ticket/person (charged per quantity).")],-1)])]),_:1}),e.createVNode(p,{value:"UNLIMITED"},{default:e.withCtx(()=>[...a[14]||(a[14]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Unlimited"),e.createElementVNode("p",{class:"text-xs"},"No limit (can be added multiple times).")],-1)])]),_:1}),e.createVNode(p,{value:"CUSTOM_LIMIT"},{default:e.withCtx(()=>[...a[15]||(a[15]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Custom limit..."),e.createElementVNode("p",{class:"text-xs"},"Set a fixed max amount (e.g. 2, 5, 10).")],-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),i.addOn.scope==="CUSTOM_LIMIT"?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[16]||(a[16]=[e.createTextVNode("Fixed limit",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.limit,"onUpdate:modelValue":a[5]||(a[5]=V=>i.addOn.limit=V),modelModifiers:{number:!0},type:"number",min:"1",step:"1",placeholder:"1",class:"no-spinner"},null,8,["modelValue"])])):e.createCommentVNode("",!0)])]),e.createVNode(B,{onClick:a[6]||(a[6]=V=>g(i.addOn.id)),variant:"ghost",size:"icon",class:"mt-6"},{default:e.withCtx(()=>[e.createVNode(A,{class:"w-4 h-4 text-destructive"})]),_:1})])}}}),ye={class:"grid gap-2"},Ce=["id"],ke=["onClick"],be={class:"flex items-center gap-2"},Ee={class:"flex items-center gap-1"},_e={class:"overflow-hidden"},we=e.defineComponent({__name:"AddonList",setup(i,{expose:y}){const{confirm:g}=T.useConfirmation(),C=e.inject("form"),a=e.ref([]),m=async x=>{if(!await g("Are you sure you want to remove this add-on?"))return;C.addOns=C.addOns.filter(p=>p.id!==x);const f=a.value.indexOf(x);f!==-1&&a.value.splice(f,1),de.toast("Success!",{description:"Add-on removed successfully."})};return y({openAddons:a}),(x,v)=>{const f=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(C).addOns,p=>(e.openBlock(),e.createElementBlock("div",{key:p.id,class:"border p-2 rounded",id:`addon-${p.id}`},[e.createElementVNode("div",{onClick:_=>a.value.includes(p.id)?a.value.splice(a.value.indexOf(p.id),1):a.value.push(p.id),class:"cursor-pointer font-bold text-muted-foreground flex items-center justify-between gap-2 select-none"},[e.createElementVNode("span",be,[e.createVNode(e.unref(N.DollarSign),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(p.name||"Untitled Add-on"),1)]),e.createElementVNode("div",Ee,[e.createVNode(f,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Pencil),{class:"size-4"})]),_:1}),e.createVNode(f,{variant:"ghost",size:"icon",onClick:e.withModifiers(_=>m(p.id),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Trash2),{class:"size-4 text-red-500"})]),_:1},8,["onClick"])])],8,ke),e.createElementVNode("div",{class:e.normalizeClass(["grid",`${a.value.includes(p.id)?"grid-rows-[1fr]":"grid-rows-[0fr]"} transition-all duration-300 ease-in-out overflow-hidden`])},[e.createElementVNode("div",_e,[e.createVNode(ve,{addOn:p},null,8,["addOn"])])],2)],8,Ce))),128))])}}}),he={class:"flex items-center justify-between mb-4"},Te={class:"space-y-3"},Be={key:0,class:"text-center py-8 text-muted-foreground text-sm border rounded-lg"},Se=e.defineComponent({__name:"index",setup(i){const y=e.inject("form"),g=e.useTemplateRef("addonList"),C=async()=>{const a=Math.random().toString(36).substr(2,9);y.addOns.push({id:a,name:"",description:"",price:0,required:!1}),g.value?.openAddons.push(a),await e.nextTick(),document.getElementById(`addon-${a}`)?.scrollIntoView({behavior:"smooth",block:"start"})};return(a,m)=>{const x=e.resolveComponent("Label"),v=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",he,[e.createElementVNode("div",null,[e.createVNode(x,{class:"text-base font-medium"},{default:e.withCtx(()=>[...m[0]||(m[0]=[e.createTextVNode(" Optional Add-ons & Upcharges ",-1)])]),_:1}),m[1]||(m[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Offer optional extras that customers can add to their booking (e.g., swimsuit rental). ",-1))]),e.createVNode(v,{onClick:C,variant:"outline",size:"sm"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.PlusCircle),{class:"w-4 h-4 mr-2"}),m[2]||(m[2]=e.createTextVNode(" Add Add-on ",-1))]),_:1})]),e.createElementVNode("div",Te,[e.createVNode(we,{ref_key:"addonList",ref:g},null,512),e.unref(y).addOns.length===0?(e.openBlock(),e.createElementBlock("div",Be,' No add-ons configured. Click "Add Add-on" to create optional extras. ')):e.createCommentVNode("",!0)])])}}}),De={key:0},Oe={key:0,class:"max-w-2xl space-y-12"},Ie={class:"flex gap-4 items-end"},Ae={class:"w-32"},Pe={class:"flex items-center justify-between mb-4 gap-4"},Ue={class:"space-y-3"},Re={class:"flex-1 space-y-3"},$e={class:"flex gap-3"},ze={class:"flex-1"},Le={class:"flex-1"},Me={class:"flex items-end"},Fe={class:"flex items-center justify-between mb-4"},je={class:"space-y-3"},qe={class:"flex-1 space-y-3"},Ge={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},He={key:0,class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Ye={key:1,class:"space-y-2"},We={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Ke={class:"text-xs text-muted-foreground"},Qe={key:2,class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Je={key:0,class:"sm:col-span-2 flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"},Xe={class:"grid grid-cols-2 gap-3"},Ze={key:0},et={class:"flex items-center gap-2"},tt={key:0},ot={key:1},nt={key:2},lt={class:"space-y-1"},at=["onClick"],rt={class:"size-5 rounded-full bg-muted flex items-center justify-center"},dt={key:0,class:"w-full h-full rounded-full bg-white scale-50"},st=["onClick"],it={class:"text-sm flex-1 truncate"},ct={key:0,class:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},mt={key:0,class:"text-center py-8 text-muted-foreground text-sm border rounded-lg"},ut={key:0,class:"mt-6 p-4 border rounded-lg bg-muted/30"},pt={class:"space-y-4"},Vt={class:"flex items-center gap-3"},ft={class:"flex-1"},xt={class:"text-sm text-muted-foreground"},Nt={class:"text-xs text-muted-foreground"},gt={class:"flex flex-col items-start gap-2 pt-4 border-t"},vt={key:0,class:"flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"},yt={key:1},Ct=e.defineComponent({__name:"payment",setup(i){const y=[{value:"time_after",label:"Time After"},{value:"time_before",label:"Time Before"},{value:"time_between",label:"Time Between"},{value:"day_of_week",label:"Day of Week"},{value:"date_range",label:"Date Range"}],g=[{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"},{value:0,label:"Sunday"}],C=/^([01]\d|2[0-3]):[0-5]\d$/,a=/^\d{4}-\d{2}-\d{2}$/,m=o=>typeof o=="object"&&o!==null&&!Array.isArray(o),x=o=>typeof o=="string"&&y.some(t=>t.value===o),v=(o,t)=>{const l=typeof o=="string"?o:"";return C.test(l)?l:t},f=o=>{const t=typeof o=="string"?o:"";return a.test(t)?t:""},p=o=>{const[t="0",l="0"]=o.split(":"),s=(Number(t)+1)%24;return`${String(s).padStart(2,"0")}:${l.padStart(2,"0")}`},_=o=>typeof o=="string"?o.split(/\s+(?:to|-|–)\s+/):[],I=o=>{const t=String(o).trim().toLowerCase();if(typeof o=="string"&&t==="")return;const l=typeof o=="number"?o:Number(o),s=g.find(c=>c.label.toLowerCase()===t)?.value;return Number.isInteger(l)&&l>=0&&l<=6?l:s},b=o=>{const l=(Array.isArray(o)?o:[o]).flatMap(c=>typeof c=="string"?c.split(/\s*,\s*/):[c]).map(I).filter(c=>c!==void 0),s=Array.from(new Set(l));return s.length>0?g.map(c=>c.value).filter(c=>s.includes(c)):Array.isArray(o)?[]:[1]},A=(o,t)=>{const l=o==="time_before"?"09:00":"17:00";if(m(t)){const s=o==="time_before"?t.end??t.endTime:t.start??t.startTime;return v(s,l)}return v(t,l)},B=(o,t)=>{if(o==="time_between"){if(m(t)){const c=v(t.start??t.startTime,"09:00");return{start:c,end:v(t.end??t.endTime,p(c))}}const l=_(t),s=v(l[0]||t,"09:00");return{start:s,end:v(l[1],p(s))}}if(o==="day_of_week")return b(t);if(o==="date_range"){if(m(t)){const c=f(t.startDate??t.start);return{startDate:c,endDate:f(t.endDate??t.end)||c}}const l=_(t),s=f(l[0]);return{startDate:s,endDate:f(l[1])||s}}return A(o,t)},V=o=>{if(!m(o))return!1;const t=f(o.startDate??o.start),l=f(o.endDate??o.end);return!!(t&&l&&l<t)},P=o=>{const t=o?.condition,l=x(t)?t:"time_after";return{...o,id:String(o?.id||Math.random().toString(36).substr(2,9)),name:o?.name||"",condition:l,conditionValue:B(l,o?.conditionValue),modifier:o?.modifier==="percentage"?"percentage":"fixed",amount:Number(o?.amount)||0,resourceIds:Array.isArray(o?.resourceIds)?o.resourceIds:null}},G=(o,t)=>{x(t)&&(o.condition=t,o.conditionValue=B(t,o.conditionValue))},{params:$}=T.useModuleRoute(),{hasPermission:H}=T.useModulePermissions(),{config:U}=T.useModule(),z=T.useFirebaseIntegration(U.project),d=e.reactive({paymentType:"full",currency:"USD",partialPayment:{type:"percentage",amount:50},pricingOptions:[{id:"1",name:"Standard Service",price:0,duration:30,isDefault:!0}],pricingRules:[],addOns:[]}),S=e.ref(!1),L=e.ref(!0),D=e.ref([]),R=e.computed(()=>d.pricingRules.some(o=>o.condition==="date_range"&&V(o.conditionValue))),M=(o,t)=>b(o.conditionValue).includes(t),Y=o=>{const t=b(o);return t.length===0?"No days selected":t.length===g.length?"Every day":t.map(l=>g.find(s=>s.value===l)?.label).filter(Boolean).join(", ")},W=(o,t,l)=>{const s=b(o.conditionValue);if(l===!0){o.conditionValue=b([...s,t]);return}const u=s.filter(w=>w!==t);o.conditionValue=u.length>0?u:s},K=(o,t)=>{if(!o.resourceIds)o.resourceIds=[t];else{const l=o.resourceIds.indexOf(t);l===-1?o.resourceIds.push(t):o.resourceIds.splice(l,1)}},F=(o,t)=>{o.resourceIds=t?null:[]},Q=async()=>{if(!R.value){S.value=!0;try{const o=$.value.id;if(!o)throw new Error("Missing agenda ID");await z.update(U.agendaCollection,o,{paymentType:d.paymentType||"full",currency:d.currency||"USD",partialPayment:{type:d.partialPayment.type||"percentage",amount:Math.max(Number(d.partialPayment.amount)||0,0)},pricingOptions:d.pricingOptions??[],pricingRules:(d.pricingRules??[]).map(P),addOns:d.addOns??[]})}catch(o){console.error("Error saving changes:",o)}finally{S.value=!1}}},J=()=>{const o=Math.random().toString(36).substr(2,9);d.pricingOptions.push({id:o,name:"",price:0,duration:30,isDefault:!1})},X=o=>{d.pricingOptions=d.pricingOptions.filter(t=>t.id!==o)},Z=o=>{d.pricingOptions.forEach(t=>{t.isDefault=t.id===o})},ee=()=>{const o=Math.random().toString(36).substr(2,9);d.pricingRules.push(P({id:o,name:"",condition:"time_after",conditionValue:"17:00",modifier:"fixed",amount:10,resourceIds:null}))},te=o=>{d.pricingRules=d.pricingRules.filter(t=>t.id!==o)};return(async()=>{try{const o=await z.get(U.agendaCollection,$.value.id);o&&(d.paymentType=o.paymentType||"full",d.currency=o.currency||"USD",d.partialPayment={type:o.partialPayment?.type||"percentage",amount:Number(o.partialPayment?.amount)&&o.partialPayment.amount>0?parseFloat(o.partialPayment.amount):50},d.pricingOptions=o.pricingOptions||[{id:"1",name:"Standard Service",price:0,duration:30,isDefault:!0}],d.pricingRules=(o.pricingRules||[]).map(P),d.addOns=o.addOns||[],D.value=(o.resources||[]).filter(t=>t.isActive))}catch(o){console.error("Error loading agenda data:",o)}finally{L.value=!1}})(),e.provide("form",d),(o,t)=>{const l=e.resolveComponent("Label"),s=e.resolveComponent("SelectValue"),c=e.resolveComponent("SelectTrigger"),u=e.resolveComponent("SelectItem"),w=e.resolveComponent("SelectContent"),O=e.resolveComponent("Select"),E=e.resolveComponent("Button"),k=e.resolveComponent("Input"),oe=e.resolveComponent("Checkbox"),ne=e.resolveComponent("PopoverTrigger"),le=e.resolveComponent("PopoverContent"),ae=e.resolveComponent("Popover"),h=e.resolveComponent("RadioGroupItem"),j=e.resolveComponent("RadioGroup");return e.openBlock(),e.createBlock(re._sfc_main,null,{default:e.withCtx(()=>[e.unref(H)("manage-payment")?(e.openBlock(),e.createElementBlock("div",De,[t[53]||(t[53]=e.createElementVNode("h1",{class:"text-lg font-medium mb-8"},"Payment Settings",-1)),L.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",null,[e.createElementVNode("div",Ie,[e.createElementVNode("div",Ae,[e.createVNode(l,{class:"text-base font-medium mb-2"},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode(" Currency ",-1)])]),_:1}),e.createVNode(O,{modelValue:d.currency,"onUpdate:modelValue":t[0]||(t[0]=n=>d.currency=n)},{default:e.withCtx(()=>[e.createVNode(c,{id:"currency"},{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Currency"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(u,{value:"USD"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("USD ($)",-1)])]),_:1}),e.createVNode(u,{value:"EUR"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("EUR (€)",-1)])]),_:1}),e.createVNode(u,{value:"GBP"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("GBP (£)",-1)])]),_:1}),e.createVNode(u,{value:"CAD"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("CAD ($)",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode(" Service Pricing Options ",-1)])]),_:1}),t[10]||(t[10]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Offer multiple service variations with different prices (e.g., haircut styles, massage types). ",-1))]),e.createVNode(E,{onClick:J,variant:"outline",size:"sm"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.PlusCircle),{class:"w-4 h-4 mr-2"}),t[11]||(t[11]=e.createTextVNode(" Add Option ",-1))]),_:1})]),e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.pricingOptions,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"flex gap-3 items-start p-4 border rounded-lg"},[e.createElementVNode("div",Re,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Service Name",-1)])]),_:1}),e.createVNode(k,{modelValue:n.name,"onUpdate:modelValue":r=>n.name=r,placeholder:"e.g., Men's Haircut, Women's Haircut"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",$e,[e.createElementVNode("div",ze,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(k,{modelValue:n.price,"onUpdate:modelValue":r=>n.price=r,modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",placeholder:"0.00",class:"no-spinner"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Le,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Duration",-1)])]),_:1}),e.createVNode(O,{modelValue:n.duration,"onUpdate:modelValue":r=>n.duration=r,modelModifiers:{number:!0}},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Duration"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(u,{value:15},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode("15 min",-1)])]),_:1}),e.createVNode(u,{value:30},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("30 min",-1)])]),_:1}),e.createVNode(u,{value:45},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("45 min",-1)])]),_:1}),e.createVNode(u,{value:60},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("1 hour",-1)])]),_:1}),e.createVNode(u,{value:90},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("1.5 hours",-1)])]),_:1}),e.createVNode(u,{value:120},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("2 hours",-1)])]),_:1}),e.createVNode(u,{value:180},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("3 hours",-1)])]),_:1}),e.createVNode(u,{value:240},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("4 hours",-1)])]),_:1}),e.createVNode(u,{value:300},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("5 hours",-1)])]),_:1}),e.createVNode(u,{value:360},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("6 hours",-1)])]),_:1}),e.createVNode(u,{value:480},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode("8 hours",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Me,[e.createVNode(E,{onClick:r=>Z(n.id),variant:n.isDefault?"default":"outline",size:"sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.isDefault?"Default":"Set Default"),1)]),_:2},1032,["onClick","variant"])])])]),d.pricingOptions.length>1?(e.openBlock(),e.createBlock(E,{key:0,onClick:r=>X(n.id),variant:"ghost",size:"icon",class:"mt-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Trash2),{class:"w-4 h-4 text-destructive"})]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]))),128))])]),e.createElementVNode("div",null,[e.createElementVNode("div",Fe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[26]||(t[26]=[e.createTextVNode(" Conditional Pricing Rules ",-1)])]),_:1}),t[27]||(t[27]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Add extra fees based on time, day, or other conditions (e.g., +€10 after 5pm). ",-1))]),e.createVNode(E,{onClick:ee,variant:"outline",size:"sm"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.PlusCircle),{class:"w-4 h-4 mr-2"}),t[28]||(t[28]=e.createTextVNode(" Add Rule ",-1))]),_:1})]),e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.pricingRules,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"flex gap-3 items-start p-4 border rounded-lg"},[e.createElementVNode("div",qe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[29]||(t[29]=[e.createTextVNode("Rule Name",-1)])]),_:1}),e.createVNode(k,{modelValue:n.name,"onUpdate:modelValue":r=>n.name=r,placeholder:"e.g., After Hours Fee, Weekend Surcharge"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Ge,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode("Condition",-1)])]),_:1}),e.createVNode(O,{"model-value":n.condition,"onUpdate:modelValue":r=>G(n,r)},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Select condition"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(y,r=>e.createVNode(u,{key:r.value,value:r.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.label),1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value","onUpdate:modelValue"])]),e.createElementVNode("div",{class:e.normalizeClass({"sm:col-span-2":n.condition==="time_between"||n.condition==="date_range"||n.condition==="day_of_week"})},[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[n.condition==="time_between"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode("Hours")],64)):n.condition==="day_of_week"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode("Days")],64)):n.condition==="date_range"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode("Date Range")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode("Hour")],64))]),_:2},1024),n.condition==="time_between"?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode("Start hour",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.start,"onUpdate:modelValue":r=>n.conditionValue.start=r,type:"time"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode("End hour",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.end,"onUpdate:modelValue":r=>n.conditionValue.end=r,type:"time"},null,8,["modelValue","onUpdate:modelValue"])])])):n.condition==="day_of_week"?(e.openBlock(),e.createElementBlock("div",Ye,[e.createElementVNode("div",We,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(g,r=>e.createElementVNode("div",{key:r.value,class:e.normalizeClass(["flex items-center gap-2 rounded-md border p-2 transition-colors",M(n,r.value)?"border-primary bg-primary/5":"border-border"])},[e.createVNode(oe,{id:`pricing-rule-${n.id}-day-${r.value}`,"model-value":M(n,r.value),"onUpdate:modelValue":q=>W(n,r.value,q)},null,8,["id","model-value","onUpdate:modelValue"]),e.createVNode(l,{for:`pricing-rule-${n.id}-day-${r.value}`,class:"text-sm font-normal cursor-pointer flex-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.label),1)]),_:2},1032,["for"])],2)),64))]),e.createElementVNode("p",Ke,e.toDisplayString(Y(n.conditionValue)),1)])):n.condition==="date_range"?(e.openBlock(),e.createElementBlock("div",Qe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[33]||(t[33]=[e.createTextVNode("Start date",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.startDate,"onUpdate:modelValue":r=>n.conditionValue.startDate=r,type:"date"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode("End date",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.endDate,"onUpdate:modelValue":r=>n.conditionValue.endDate=r,type:"date",min:n.conditionValue.startDate||void 0,class:e.normalizeClass({"border-amber-500 focus-visible:ring-amber-500":V(n.conditionValue)})},null,8,["modelValue","onUpdate:modelValue","min","class"])]),V(n.conditionValue)?(e.openBlock(),e.createElementBlock("p",Je,[e.createVNode(e.unref(N.AlertTriangle),{class:"size-3.5 shrink-0 mt-0.5"}),t[35]||(t[35]=e.createElementVNode("span",null,"End date must be on or after the start date.",-1))])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createBlock(k,{key:3,modelValue:n.conditionValue,"onUpdate:modelValue":r=>n.conditionValue=r,type:"time",placeholder:"e.g., 17:00"},null,8,["modelValue","onUpdate:modelValue"]))],2)]),e.createElementVNode("div",Xe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[36]||(t[36]=[e.createTextVNode("Fee Type",-1)])]),_:1}),e.createVNode(O,{modelValue:n.modifier,"onUpdate:modelValue":r=>n.modifier=r},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Select type"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(u,{value:"fixed"},{default:e.withCtx(()=>[...t[37]||(t[37]=[e.createTextVNode("Fixed Amount",-1)])]),_:1}),e.createVNode(u,{value:"percentage"},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode("Percentage",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode("Amount",-1)])]),_:1}),e.createVNode(k,{modelValue:n.amount,"onUpdate:modelValue":r=>n.amount=r,modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",class:"no-spinner",placeholder:n.modifier==="percentage"?"10 (%)":"10.00"},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]),D.value.length>0?(e.openBlock(),e.createElementBlock("div",Ze,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode("Apply To Resources",-1)])]),_:1}),e.createVNode(ae,null,{default:e.withCtx(()=>[e.createVNode(ne,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(E,{variant:"outline",class:"w-full justify-between font-normal"},{default:e.withCtx(()=>[e.createElementVNode("div",et,[e.createVNode(e.unref(N.Users),{class:"w-4 h-4 text-muted-foreground"}),!n.resourceIds||n.resourceIds.length===0?(e.openBlock(),e.createElementBlock("span",tt,"All Resources")):n.resourceIds.length===1?(e.openBlock(),e.createElementBlock("span",ot,e.toDisplayString(D.value.find(r=>r.id===n.resourceIds[0])?.name||"1 resource"),1)):(e.openBlock(),e.createElementBlock("span",nt,e.toDisplayString(n.resourceIds.length)+" resources",1))]),e.createVNode(e.unref(N.ChevronDown),{class:"w-4 h-4 opacity-50"})]),_:2},1024)]),_:2},1024),e.createVNode(le,{class:"w-64 p-2",align:"start"},{default:e.withCtx(()=>[e.createElementVNode("div",lt,[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors",{"bg-muted":!n.resourceIds||n.resourceIds.length===0}]),onClick:r=>F(n,!0)},[e.createElementVNode("div",rt,[e.createVNode(e.unref(N.Users),{class:"w-3 h-3 text-muted-foreground"})]),t[41]||(t[41]=e.createElementVNode("span",{class:"text-sm flex-1"},"All Resources",-1)),e.createElementVNode("div",{class:e.normalizeClass(["size-4 rounded-full border-2",!n.resourceIds||n.resourceIds.length===0?"border-primary bg-primary":"border-muted-foreground"])},[!n.resourceIds||n.resourceIds.length===0?(e.openBlock(),e.createElementBlock("div",dt)):e.createCommentVNode("",!0)],2)],10,at),t[43]||(t[43]=e.createElementVNode("div",{class:"border-t my-2"},null,-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors",onClick:q=>{F(n,!1),K(n,r.id)}},[e.createElementVNode("div",{class:"size-5 rounded-full flex items-center justify-center text-white text-[10px] font-medium",style:e.normalizeStyle({backgroundColor:r.color||"#6b7280"})},e.toDisplayString(r.avatarLabel||r.name.charAt(0).toUpperCase()),5),e.createElementVNode("span",it,e.toDisplayString(r.name),1),e.createElementVNode("div",{class:e.normalizeClass(["size-4 rounded border-2 flex items-center justify-center",n.resourceIds?.includes(r.id)?"border-primary bg-primary":"border-muted-foreground"])},[n.resourceIds?.includes(r.id)?(e.openBlock(),e.createElementBlock("svg",ct,[...t[42]||(t[42]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):e.createCommentVNode("",!0)],2)],8,st))),128))])]),_:2},1024)]),_:2},1024)])):e.createCommentVNode("",!0)]),e.createVNode(E,{onClick:r=>te(n.id),variant:"ghost",size:"icon",class:"mt-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Trash2),{class:"w-4 h-4 text-destructive"})]),_:1},8,["onClick"])]))),128)),d.pricingRules.length===0?(e.openBlock(),e.createElementBlock("div",mt,' No pricing rules configured. Click "Add Rule" to create conditional fees. ')):e.createCommentVNode("",!0)])]),e.createVNode(Se),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[44]||(t[44]=[e.createTextVNode(" Payment Preferences ",-1)])]),_:1}),t[51]||(t[51]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-6"}," Let customers pay full or in part when booking a slot, or pay later. ",-1)),e.createVNode(j,{modelValue:d.paymentType,"onUpdate:modelValue":t[1]||(t[1]=n=>d.paymentType=n),class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createVNode(l,{for:"r1",class:"flex items-start space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{id:"r1",value:"full"}),t[45]||(t[45]=e.createElementVNode("div",null,[e.createElementVNode("p",null,"Pay Full Amount when Booking"),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Your customers are required to complete the payment to confirm their booking. ")],-1))]),_:1}),e.createVNode(l,{for:"r2",class:"flex items-start space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{id:"r2",value:"partial"}),t[46]||(t[46]=e.createElementVNode("div",null,[e.createElementVNode("p",null,"Pay Part Amount when Booking"),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Your customers are required to pay a deposit to confirm their booking. ")],-1))]),_:1}),e.createVNode(l,{for:"r3",class:"flex items-start space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{id:"r3",value:"later"}),t[47]||(t[47]=e.createElementVNode("div",null,[e.createElementVNode("p",null,"Pay Later at Appointment"),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Your customers can book now and pay in person at the time of their appointment. ")],-1))]),_:1})]),_:1},8,["modelValue"]),d.paymentType==="partial"?(e.openBlock(),e.createElementBlock("div",ut,[e.createVNode(l,{class:"text-sm font-medium mb-4 block"},{default:e.withCtx(()=>[...t[48]||(t[48]=[e.createTextVNode(" Deposit Amount Configuration ",-1)])]),_:1}),e.createElementVNode("div",pt,[e.createVNode(j,{modelValue:d.partialPayment.type,"onUpdate:modelValue":t[2]||(t[2]=n=>d.partialPayment.type=n),class:"flex gap-4"},{default:e.withCtx(()=>[e.createVNode(l,{class:"flex items-center space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{value:"percentage"}),t[49]||(t[49]=e.createElementVNode("span",null,"Percentage",-1))]),_:1}),e.createVNode(l,{class:"flex items-center space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{value:"fixed"}),t[50]||(t[50]=e.createElementVNode("span",null,"Fixed Amount",-1))]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",Vt,[e.createElementVNode("div",ft,[e.createVNode(k,{modelValue:d.partialPayment.amount,"onUpdate:modelValue":t[3]||(t[3]=n=>d.partialPayment.amount=n),modelModifiers:{number:!0},type:"number",min:"0",max:d.partialPayment.type==="percentage"?100:void 0,step:"0.01",placeholder:d.partialPayment.type==="percentage"?"50":"10.00",class:"no-spinner"},null,8,["modelValue","max","placeholder"])]),e.createElementVNode("span",xt,e.toDisplayString(d.partialPayment.type==="percentage"?"%":d.currency),1)]),e.createElementVNode("p",Nt,[d.partialPayment.type==="percentage"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" Customers will pay "+e.toDisplayString(d.partialPayment.amount)+"% of the total price upfront. ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" Customers will pay "+e.toDisplayString(d.currency)+" "+e.toDisplayString(d.partialPayment.amount)+" upfront. ",1)],64))])])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",gt,[R.value?(e.openBlock(),e.createElementBlock("p",vt,[e.createVNode(e.unref(N.AlertTriangle),{class:"size-3.5 shrink-0 mt-0.5"}),t[52]||(t[52]=e.createElementVNode("span",null,"Fix invalid date ranges before saving.",-1))])):e.createCommentVNode("",!0),e.createVNode(E,{onClick:Q,disabled:S.value||R.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.value?"Saving...":"Save Changes"),1)]),_:1},8,["disabled"])])]))])):(e.openBlock(),e.createElementBlock("div",yt,[...t[54]||(t[54]=[e.createElementVNode("h1",{class:"text-lg font-medium mb-2"},"Access Denied",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"You do not have permission to view or edit payment settings.",-1)])]))]),_:1})}}});exports.default=Ct;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),re=require("./EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js"),N=require("lucide-vue-next"),T=require("@oneclick.dev/cms-kit"),de=require("./index-ijdf0d9-.js"),se={class:"flex gap-3 items-start p-4 border rounded-lg"},ie={class:"flex-1 space-y-3"},ce={class:"grid grid-cols-2 gap-3"},me={class:"flex items-center space-x-2 my-4"},ue={class:"grid grid-cols-2 gap-2"},pe={key:0},Ve={key:1},fe={key:2},xe={key:3},Ne={key:4},ge={key:0},ve=e.defineComponent({__name:"Addon",props:{addOn:{type:Object,required:!0}},setup(i){const y=e.inject("form"),g=C=>{y.addOns=y.addOns.filter(a=>a.id!==C)};return(C,a)=>{const m=e.resolveComponent("Label"),x=e.resolveComponent("Input"),v=e.resolveComponent("Checkbox"),f=e.resolveComponent("SelectTrigger"),p=e.resolveComponent("SelectItem"),_=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),b=e.resolveComponent("Select"),A=e.resolveComponent("Trash2"),B=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",se,[e.createElementVNode("div",ie,[e.createElementVNode("div",ce,[e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode("Add-on Name",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.name,"onUpdate:modelValue":a[0]||(a[0]=V=>i.addOn.name=V),placeholder:"e.g., Swimsuit Rental, Towel Service"},null,8,["modelValue"])]),e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[8]||(a[8]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.price,"onUpdate:modelValue":a[1]||(a[1]=V=>i.addOn.price=V),modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",placeholder:"0.00",class:"no-spinner"},null,8,["modelValue"])])]),e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("Description (Optional)",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.description,"onUpdate:modelValue":a[2]||(a[2]=V=>i.addOn.description=V),placeholder:"Brief description of this add-on"},null,8,["modelValue"])]),e.createElementVNode("div",me,[e.createVNode(v,{id:`required-${i.addOn.id}`,modelValue:i.addOn.required,"onUpdate:modelValue":a[3]||(a[3]=V=>i.addOn.required=V)},null,8,["id","modelValue"]),e.createVNode(m,{for:`required-${i.addOn.id}`,class:"text-xs font-normal cursor-pointer"},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode(" Required (customer must select this add-on) ",-1)])]),_:1},8,["for"])]),e.createElementVNode("div",ue,[e.createElementVNode("div",null,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("Quantity limit",-1)])]),_:1}),e.createVNode(b,{modelValue:i.addOn.scope,"onUpdate:modelValue":a[4]||(a[4]=V=>i.addOn.scope=V)},{default:e.withCtx(()=>[e.createVNode(f,{class:"w-full"},{default:e.withCtx(()=>[i.addOn.scope==="RESERVATION"?(e.openBlock(),e.createElementBlock("span",pe,"Once per reservation")):i.addOn.scope==="TICKET"?(e.openBlock(),e.createElementBlock("span",Ve,"Once per ticket / person")):i.addOn.scope==="UNLIMITED"?(e.openBlock(),e.createElementBlock("span",fe,"Unlimited")):i.addOn.scope==="CUSTOM_LIMIT"?(e.openBlock(),e.createElementBlock("span",xe,"Custom limit...")):(e.openBlock(),e.createElementBlock("span",Ne,"Select a limit…"))]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(_,{class:"max-w-96"},{default:e.withCtx(()=>[e.createVNode(p,{value:"RESERVATION"},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Once per reservation"),e.createElementVNode("p",{class:"text-xs"},"Max 1 per reservation line (charged per reservation).")],-1)])]),_:1}),e.createVNode(p,{value:"TICKET"},{default:e.withCtx(()=>[...a[13]||(a[13]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Once per ticket / person"),e.createElementVNode("p",{class:"text-xs"},"Max 1 per ticket/person (charged per quantity).")],-1)])]),_:1}),e.createVNode(p,{value:"UNLIMITED"},{default:e.withCtx(()=>[...a[14]||(a[14]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Unlimited"),e.createElementVNode("p",{class:"text-xs"},"No limit (can be added multiple times).")],-1)])]),_:1}),e.createVNode(p,{value:"CUSTOM_LIMIT"},{default:e.withCtx(()=>[...a[15]||(a[15]=[e.createElementVNode("div",{class:"flex flex-col"},[e.createElementVNode("p",{class:"text-sm font-bold mb-1"},"Custom limit..."),e.createElementVNode("p",{class:"text-xs"},"Set a fixed max amount (e.g. 2, 5, 10).")],-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),i.addOn.scope==="CUSTOM_LIMIT"?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(m,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...a[16]||(a[16]=[e.createTextVNode("Fixed limit",-1)])]),_:1}),e.createVNode(x,{modelValue:i.addOn.limit,"onUpdate:modelValue":a[5]||(a[5]=V=>i.addOn.limit=V),modelModifiers:{number:!0},type:"number",min:"1",step:"1",placeholder:"1",class:"no-spinner"},null,8,["modelValue"])])):e.createCommentVNode("",!0)])]),e.createVNode(B,{onClick:a[6]||(a[6]=V=>g(i.addOn.id)),variant:"ghost",size:"icon",class:"mt-6"},{default:e.withCtx(()=>[e.createVNode(A,{class:"w-4 h-4 text-destructive"})]),_:1})])}}}),ye={class:"grid gap-2"},Ce=["id"],ke=["onClick"],be={class:"flex items-center gap-2"},Ee={class:"flex items-center gap-1"},_e={class:"overflow-hidden"},we=e.defineComponent({__name:"AddonList",setup(i,{expose:y}){const{confirm:g}=T.useConfirmation(),C=e.inject("form"),a=e.ref([]),m=async x=>{if(!await g("Are you sure you want to remove this add-on?"))return;C.addOns=C.addOns.filter(p=>p.id!==x);const f=a.value.indexOf(x);f!==-1&&a.value.splice(f,1),de.toast("Success!",{description:"Add-on removed successfully."})};return y({openAddons:a}),(x,v)=>{const f=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(C).addOns,p=>(e.openBlock(),e.createElementBlock("div",{key:p.id,class:"border p-2 rounded",id:`addon-${p.id}`},[e.createElementVNode("div",{onClick:_=>a.value.includes(p.id)?a.value.splice(a.value.indexOf(p.id),1):a.value.push(p.id),class:"cursor-pointer font-bold text-muted-foreground flex items-center justify-between gap-2 select-none"},[e.createElementVNode("span",be,[e.createVNode(e.unref(N.DollarSign),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(p.name||"Untitled Add-on"),1)]),e.createElementVNode("div",Ee,[e.createVNode(f,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Pencil),{class:"size-4"})]),_:1}),e.createVNode(f,{variant:"ghost",size:"icon",onClick:e.withModifiers(_=>m(p.id),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Trash2),{class:"size-4 text-red-500"})]),_:1},8,["onClick"])])],8,ke),e.createElementVNode("div",{class:e.normalizeClass(["grid",`${a.value.includes(p.id)?"grid-rows-[1fr]":"grid-rows-[0fr]"} transition-all duration-300 ease-in-out overflow-hidden`])},[e.createElementVNode("div",_e,[e.createVNode(ve,{addOn:p},null,8,["addOn"])])],2)],8,Ce))),128))])}}}),he={class:"flex items-center justify-between mb-4"},Te={class:"space-y-3"},Be={key:0,class:"text-center py-8 text-muted-foreground text-sm border rounded-lg"},Se=e.defineComponent({__name:"index",setup(i){const y=e.inject("form"),g=e.useTemplateRef("addonList"),C=async()=>{const a=Math.random().toString(36).substr(2,9);y.addOns.push({id:a,name:"",description:"",price:0,required:!1}),g.value?.openAddons.push(a),await e.nextTick(),document.getElementById(`addon-${a}`)?.scrollIntoView({behavior:"smooth",block:"start"})};return(a,m)=>{const x=e.resolveComponent("Label"),v=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",he,[e.createElementVNode("div",null,[e.createVNode(x,{class:"text-base font-medium"},{default:e.withCtx(()=>[...m[0]||(m[0]=[e.createTextVNode(" Optional Add-ons & Upcharges ",-1)])]),_:1}),m[1]||(m[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Offer optional extras that customers can add to their booking (e.g., swimsuit rental). ",-1))]),e.createVNode(v,{onClick:C,variant:"outline",size:"sm"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.PlusCircle),{class:"w-4 h-4 mr-2"}),m[2]||(m[2]=e.createTextVNode(" Add Add-on ",-1))]),_:1})]),e.createElementVNode("div",Te,[e.createVNode(we,{ref_key:"addonList",ref:g},null,512),e.unref(y).addOns.length===0?(e.openBlock(),e.createElementBlock("div",Be,' No add-ons configured. Click "Add Add-on" to create optional extras. ')):e.createCommentVNode("",!0)])])}}}),De={key:0},Oe={key:0,class:"max-w-2xl space-y-12"},Ie={class:"flex gap-4 items-end"},Ae={class:"w-32"},Pe={class:"flex items-center justify-between mb-4 gap-4"},Ue={class:"space-y-3"},Re={class:"flex-1 space-y-3"},$e={class:"flex gap-3"},ze={class:"flex-1"},Le={class:"flex-1"},Me={class:"flex items-end"},Fe={class:"flex items-center justify-between mb-4"},je={class:"space-y-3"},qe={class:"flex-1 space-y-3"},Ge={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},He={key:0,class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Ye={key:1,class:"space-y-2"},We={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Ke={class:"text-xs text-muted-foreground"},Qe={key:2,class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Je={key:0,class:"sm:col-span-2 flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"},Xe={class:"grid grid-cols-2 gap-3"},Ze={key:0},et={class:"flex items-center gap-2"},tt={key:0},ot={key:1},nt={key:2},lt={class:"space-y-1"},at=["onClick"],rt={class:"size-5 rounded-full bg-muted flex items-center justify-center"},dt={key:0,class:"w-full h-full rounded-full bg-white scale-50"},st=["onClick"],it={class:"text-sm flex-1 truncate"},ct={key:0,class:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},mt={key:0,class:"text-center py-8 text-muted-foreground text-sm border rounded-lg"},ut={key:0,class:"mt-6 p-4 border rounded-lg bg-muted/30"},pt={class:"space-y-4"},Vt={class:"flex items-center gap-3"},ft={class:"flex-1"},xt={class:"text-sm text-muted-foreground"},Nt={class:"text-xs text-muted-foreground"},gt={class:"flex flex-col items-start gap-2 pt-4 border-t"},vt={key:0,class:"flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"},yt={key:1},Ct=e.defineComponent({__name:"payment",setup(i){const y=[{value:"time_after",label:"Time After"},{value:"time_before",label:"Time Before"},{value:"time_between",label:"Time Between"},{value:"day_of_week",label:"Day of Week"},{value:"date_range",label:"Date Range"}],g=[{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"},{value:0,label:"Sunday"}],C=/^([01]\d|2[0-3]):[0-5]\d$/,a=/^\d{4}-\d{2}-\d{2}$/,m=o=>typeof o=="object"&&o!==null&&!Array.isArray(o),x=o=>typeof o=="string"&&y.some(t=>t.value===o),v=(o,t)=>{const l=typeof o=="string"?o:"";return C.test(l)?l:t},f=o=>{const t=typeof o=="string"?o:"";return a.test(t)?t:""},p=o=>{const[t="0",l="0"]=o.split(":"),s=(Number(t)+1)%24;return`${String(s).padStart(2,"0")}:${l.padStart(2,"0")}`},_=o=>typeof o=="string"?o.split(/\s+(?:to|-|–)\s+/):[],I=o=>{const t=String(o).trim().toLowerCase();if(typeof o=="string"&&t==="")return;const l=typeof o=="number"?o:Number(o),s=g.find(c=>c.label.toLowerCase()===t)?.value;return Number.isInteger(l)&&l>=0&&l<=6?l:s},b=o=>{const l=(Array.isArray(o)?o:[o]).flatMap(c=>typeof c=="string"?c.split(/\s*,\s*/):[c]).map(I).filter(c=>c!==void 0),s=Array.from(new Set(l));return s.length>0?g.map(c=>c.value).filter(c=>s.includes(c)):Array.isArray(o)?[]:[1]},A=(o,t)=>{const l=o==="time_before"?"09:00":"17:00";if(m(t)){const s=o==="time_before"?t.end??t.endTime:t.start??t.startTime;return v(s,l)}return v(t,l)},B=(o,t)=>{if(o==="time_between"){if(m(t)){const c=v(t.start??t.startTime,"09:00");return{start:c,end:v(t.end??t.endTime,p(c))}}const l=_(t),s=v(l[0]||t,"09:00");return{start:s,end:v(l[1],p(s))}}if(o==="day_of_week")return b(t);if(o==="date_range"){if(m(t)){const c=f(t.startDate??t.start);return{startDate:c,endDate:f(t.endDate??t.end)||c}}const l=_(t),s=f(l[0]);return{startDate:s,endDate:f(l[1])||s}}return A(o,t)},V=o=>{if(!m(o))return!1;const t=f(o.startDate??o.start),l=f(o.endDate??o.end);return!!(t&&l&&l<t)},P=o=>{const t=o?.condition,l=x(t)?t:"time_after";return{...o,id:String(o?.id||Math.random().toString(36).substr(2,9)),name:o?.name||"",condition:l,conditionValue:B(l,o?.conditionValue),modifier:o?.modifier==="percentage"?"percentage":"fixed",amount:Number(o?.amount)||0,resourceIds:Array.isArray(o?.resourceIds)?o.resourceIds:null}},G=(o,t)=>{x(t)&&(o.condition=t,o.conditionValue=B(t,o.conditionValue))},{params:$}=T.useModuleRoute(),{hasPermission:H}=T.useModulePermissions(),{config:U}=T.useModule(),z=T.useFirebaseIntegration(U.project),d=e.reactive({paymentType:"full",currency:"USD",partialPayment:{type:"percentage",amount:50},pricingOptions:[{id:"1",name:"Standard Service",price:0,duration:30,isDefault:!0}],pricingRules:[],addOns:[]}),S=e.ref(!1),L=e.ref(!0),D=e.ref([]),R=e.computed(()=>d.pricingRules.some(o=>o.condition==="date_range"&&V(o.conditionValue))),M=(o,t)=>b(o.conditionValue).includes(t),Y=o=>{const t=b(o);return t.length===0?"No days selected":t.length===g.length?"Every day":t.map(l=>g.find(s=>s.value===l)?.label).filter(Boolean).join(", ")},W=(o,t,l)=>{const s=b(o.conditionValue);if(l===!0){o.conditionValue=b([...s,t]);return}const u=s.filter(w=>w!==t);o.conditionValue=u.length>0?u:s},K=(o,t)=>{if(!o.resourceIds)o.resourceIds=[t];else{const l=o.resourceIds.indexOf(t);l===-1?o.resourceIds.push(t):o.resourceIds.splice(l,1)}},F=(o,t)=>{o.resourceIds=t?null:[]},Q=async()=>{if(!R.value){S.value=!0;try{const o=$.value.id;if(!o)throw new Error("Missing agenda ID");await z.update(U.agendaCollection,o,{paymentType:d.paymentType||"full",currency:d.currency||"USD",partialPayment:{type:d.partialPayment.type||"percentage",amount:Math.max(Number(d.partialPayment.amount)||0,0)},pricingOptions:d.pricingOptions??[],pricingRules:(d.pricingRules??[]).map(P),addOns:d.addOns??[]})}catch(o){console.error("Error saving changes:",o)}finally{S.value=!1}}},J=()=>{const o=Math.random().toString(36).substr(2,9);d.pricingOptions.push({id:o,name:"",price:0,duration:30,isDefault:!1})},X=o=>{d.pricingOptions=d.pricingOptions.filter(t=>t.id!==o)},Z=o=>{d.pricingOptions.forEach(t=>{t.isDefault=t.id===o})},ee=()=>{const o=Math.random().toString(36).substr(2,9);d.pricingRules.push(P({id:o,name:"",condition:"time_after",conditionValue:"17:00",modifier:"fixed",amount:10,resourceIds:null}))},te=o=>{d.pricingRules=d.pricingRules.filter(t=>t.id!==o)};return(async()=>{try{const o=await z.get(U.agendaCollection,$.value.id);o&&(d.paymentType=o.paymentType||"full",d.currency=o.currency||"USD",d.partialPayment={type:o.partialPayment?.type||"percentage",amount:Number(o.partialPayment?.amount)&&o.partialPayment.amount>0?parseFloat(o.partialPayment.amount):50},d.pricingOptions=o.pricingOptions||[{id:"1",name:"Standard Service",price:0,duration:30,isDefault:!0}],d.pricingRules=(o.pricingRules||[]).map(P),d.addOns=o.addOns||[],D.value=(o.resources||[]).filter(t=>t.isActive))}catch(o){console.error("Error loading agenda data:",o)}finally{L.value=!1}})(),e.provide("form",d),(o,t)=>{const l=e.resolveComponent("Label"),s=e.resolveComponent("SelectValue"),c=e.resolveComponent("SelectTrigger"),u=e.resolveComponent("SelectItem"),w=e.resolveComponent("SelectContent"),O=e.resolveComponent("Select"),E=e.resolveComponent("Button"),k=e.resolveComponent("Input"),oe=e.resolveComponent("Checkbox"),ne=e.resolveComponent("PopoverTrigger"),le=e.resolveComponent("PopoverContent"),ae=e.resolveComponent("Popover"),h=e.resolveComponent("RadioGroupItem"),j=e.resolveComponent("RadioGroup");return e.openBlock(),e.createBlock(re._sfc_main,null,{default:e.withCtx(()=>[e.unref(H)("manage-payment")?(e.openBlock(),e.createElementBlock("div",De,[t[53]||(t[53]=e.createElementVNode("h1",{class:"text-lg font-medium mb-8"},"Payment Settings",-1)),L.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",null,[e.createElementVNode("div",Ie,[e.createElementVNode("div",Ae,[e.createVNode(l,{class:"text-base font-medium mb-2"},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode(" Currency ",-1)])]),_:1}),e.createVNode(O,{modelValue:d.currency,"onUpdate:modelValue":t[0]||(t[0]=n=>d.currency=n)},{default:e.withCtx(()=>[e.createVNode(c,{id:"currency"},{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Currency"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(u,{value:"USD"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("USD ($)",-1)])]),_:1}),e.createVNode(u,{value:"EUR"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("EUR (€)",-1)])]),_:1}),e.createVNode(u,{value:"GBP"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("GBP (£)",-1)])]),_:1}),e.createVNode(u,{value:"CAD"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("CAD ($)",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode(" Service Pricing Options ",-1)])]),_:1}),t[10]||(t[10]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Offer multiple service variations with different prices (e.g., haircut styles, massage types). ",-1))]),e.createVNode(E,{onClick:J,variant:"outline",size:"sm"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.PlusCircle),{class:"w-4 h-4 mr-2"}),t[11]||(t[11]=e.createTextVNode(" Add Option ",-1))]),_:1})]),e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.pricingOptions,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"flex gap-3 items-start p-4 border rounded-lg"},[e.createElementVNode("div",Re,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Service Name",-1)])]),_:1}),e.createVNode(k,{modelValue:n.name,"onUpdate:modelValue":r=>n.name=r,placeholder:"e.g., Men's Haircut, Women's Haircut"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",$e,[e.createElementVNode("div",ze,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(k,{modelValue:n.price,"onUpdate:modelValue":r=>n.price=r,modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",placeholder:"0.00",class:"no-spinner"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Le,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Duration",-1)])]),_:1}),e.createVNode(O,{modelValue:n.duration,"onUpdate:modelValue":r=>n.duration=r,modelModifiers:{number:!0}},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Duration"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(u,{value:15},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode("15 min",-1)])]),_:1}),e.createVNode(u,{value:30},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("30 min",-1)])]),_:1}),e.createVNode(u,{value:45},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("45 min",-1)])]),_:1}),e.createVNode(u,{value:60},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("1 hour",-1)])]),_:1}),e.createVNode(u,{value:90},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("1.5 hours",-1)])]),_:1}),e.createVNode(u,{value:120},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("2 hours",-1)])]),_:1}),e.createVNode(u,{value:180},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("3 hours",-1)])]),_:1}),e.createVNode(u,{value:240},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("4 hours",-1)])]),_:1}),e.createVNode(u,{value:300},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("5 hours",-1)])]),_:1}),e.createVNode(u,{value:360},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("6 hours",-1)])]),_:1}),e.createVNode(u,{value:480},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode("8 hours",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Me,[e.createVNode(E,{onClick:r=>Z(n.id),variant:n.isDefault?"default":"outline",size:"sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.isDefault?"Default":"Set Default"),1)]),_:2},1032,["onClick","variant"])])])]),d.pricingOptions.length>1?(e.openBlock(),e.createBlock(E,{key:0,onClick:r=>X(n.id),variant:"ghost",size:"icon",class:"mt-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Trash2),{class:"w-4 h-4 text-destructive"})]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]))),128))])]),e.createElementVNode("div",null,[e.createElementVNode("div",Fe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[26]||(t[26]=[e.createTextVNode(" Conditional Pricing Rules ",-1)])]),_:1}),t[27]||(t[27]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Add extra fees based on time, day, or other conditions (e.g., +€10 after 5pm). ",-1))]),e.createVNode(E,{onClick:ee,variant:"outline",size:"sm"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.PlusCircle),{class:"w-4 h-4 mr-2"}),t[28]||(t[28]=e.createTextVNode(" Add Rule ",-1))]),_:1})]),e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.pricingRules,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"flex gap-3 items-start p-4 border rounded-lg"},[e.createElementVNode("div",qe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[29]||(t[29]=[e.createTextVNode("Rule Name",-1)])]),_:1}),e.createVNode(k,{modelValue:n.name,"onUpdate:modelValue":r=>n.name=r,placeholder:"e.g., After Hours Fee, Weekend Surcharge"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Ge,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode("Condition",-1)])]),_:1}),e.createVNode(O,{"model-value":n.condition,"onUpdate:modelValue":r=>G(n,r)},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Select condition"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(y,r=>e.createVNode(u,{key:r.value,value:r.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.label),1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value","onUpdate:modelValue"])]),e.createElementVNode("div",{class:e.normalizeClass({"sm:col-span-2":n.condition==="time_between"||n.condition==="date_range"||n.condition==="day_of_week"})},[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[n.condition==="time_between"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode("Hours")],64)):n.condition==="day_of_week"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode("Days")],64)):n.condition==="date_range"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode("Date Range")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode("Hour")],64))]),_:2},1024),n.condition==="time_between"?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode("Start hour",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.start,"onUpdate:modelValue":r=>n.conditionValue.start=r,type:"time"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode("End hour",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.end,"onUpdate:modelValue":r=>n.conditionValue.end=r,type:"time"},null,8,["modelValue","onUpdate:modelValue"])])])):n.condition==="day_of_week"?(e.openBlock(),e.createElementBlock("div",Ye,[e.createElementVNode("div",We,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(g,r=>e.createElementVNode("div",{key:r.value,class:e.normalizeClass(["flex items-center gap-2 rounded-md border p-2 transition-colors",M(n,r.value)?"border-primary bg-primary/5":"border-border"])},[e.createVNode(oe,{id:`pricing-rule-${n.id}-day-${r.value}`,"model-value":M(n,r.value),"onUpdate:modelValue":q=>W(n,r.value,q)},null,8,["id","model-value","onUpdate:modelValue"]),e.createVNode(l,{for:`pricing-rule-${n.id}-day-${r.value}`,class:"text-sm font-normal cursor-pointer flex-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.label),1)]),_:2},1032,["for"])],2)),64))]),e.createElementVNode("p",Ke,e.toDisplayString(Y(n.conditionValue)),1)])):n.condition==="date_range"?(e.openBlock(),e.createElementBlock("div",Qe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[33]||(t[33]=[e.createTextVNode("Start date",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.startDate,"onUpdate:modelValue":r=>n.conditionValue.startDate=r,type:"date"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block text-muted-foreground"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode("End date",-1)])]),_:1}),e.createVNode(k,{modelValue:n.conditionValue.endDate,"onUpdate:modelValue":r=>n.conditionValue.endDate=r,type:"date",min:n.conditionValue.startDate||void 0,class:e.normalizeClass({"border-amber-500 focus-visible:ring-amber-500":V(n.conditionValue)})},null,8,["modelValue","onUpdate:modelValue","min","class"])]),V(n.conditionValue)?(e.openBlock(),e.createElementBlock("p",Je,[e.createVNode(e.unref(N.AlertTriangle),{class:"size-3.5 shrink-0 mt-0.5"}),t[35]||(t[35]=e.createElementVNode("span",null,"End date must be on or after the start date.",-1))])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createBlock(k,{key:3,modelValue:n.conditionValue,"onUpdate:modelValue":r=>n.conditionValue=r,type:"time",placeholder:"e.g., 17:00"},null,8,["modelValue","onUpdate:modelValue"]))],2)]),e.createElementVNode("div",Xe,[e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[36]||(t[36]=[e.createTextVNode("Fee Type",-1)])]),_:1}),e.createVNode(O,{modelValue:n.modifier,"onUpdate:modelValue":r=>n.modifier=r},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(s,{placeholder:"Select type"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(u,{value:"fixed"},{default:e.withCtx(()=>[...t[37]||(t[37]=[e.createTextVNode("Fixed Amount",-1)])]),_:1}),e.createVNode(u,{value:"percentage"},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode("Percentage",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode("Amount",-1)])]),_:1}),e.createVNode(k,{modelValue:n.amount,"onUpdate:modelValue":r=>n.amount=r,modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",class:"no-spinner",placeholder:n.modifier==="percentage"?"10 (%)":"10.00"},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]),D.value.length>0?(e.openBlock(),e.createElementBlock("div",Ze,[e.createVNode(l,{class:"text-xs mb-1 block"},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode("Apply To Resources",-1)])]),_:1}),e.createVNode(ae,null,{default:e.withCtx(()=>[e.createVNode(ne,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(E,{variant:"outline",class:"w-full justify-between font-normal"},{default:e.withCtx(()=>[e.createElementVNode("div",et,[e.createVNode(e.unref(N.Users),{class:"w-4 h-4 text-muted-foreground"}),!n.resourceIds||n.resourceIds.length===0?(e.openBlock(),e.createElementBlock("span",tt,"All Resources")):n.resourceIds.length===1?(e.openBlock(),e.createElementBlock("span",ot,e.toDisplayString(D.value.find(r=>r.id===n.resourceIds[0])?.name||"1 resource"),1)):(e.openBlock(),e.createElementBlock("span",nt,e.toDisplayString(n.resourceIds.length)+" resources",1))]),e.createVNode(e.unref(N.ChevronDown),{class:"w-4 h-4 opacity-50"})]),_:2},1024)]),_:2},1024),e.createVNode(le,{class:"w-64 p-2",align:"start"},{default:e.withCtx(()=>[e.createElementVNode("div",lt,[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors",{"bg-muted":!n.resourceIds||n.resourceIds.length===0}]),onClick:r=>F(n,!0)},[e.createElementVNode("div",rt,[e.createVNode(e.unref(N.Users),{class:"w-3 h-3 text-muted-foreground"})]),t[41]||(t[41]=e.createElementVNode("span",{class:"text-sm flex-1"},"All Resources",-1)),e.createElementVNode("div",{class:e.normalizeClass(["size-4 rounded-full border-2",!n.resourceIds||n.resourceIds.length===0?"border-primary bg-primary":"border-muted-foreground"])},[!n.resourceIds||n.resourceIds.length===0?(e.openBlock(),e.createElementBlock("div",dt)):e.createCommentVNode("",!0)],2)],10,at),t[43]||(t[43]=e.createElementVNode("div",{class:"border-t my-2"},null,-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors",onClick:q=>{F(n,!1),K(n,r.id)}},[e.createElementVNode("div",{class:"size-5 rounded-full flex items-center justify-center text-white text-[10px] font-medium",style:e.normalizeStyle({backgroundColor:r.color||"#6b7280"})},e.toDisplayString(r.avatarLabel||r.name.charAt(0).toUpperCase()),5),e.createElementVNode("span",it,e.toDisplayString(r.name),1),e.createElementVNode("div",{class:e.normalizeClass(["size-4 rounded border-2 flex items-center justify-center",n.resourceIds?.includes(r.id)?"border-primary bg-primary":"border-muted-foreground"])},[n.resourceIds?.includes(r.id)?(e.openBlock(),e.createElementBlock("svg",ct,[...t[42]||(t[42]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):e.createCommentVNode("",!0)],2)],8,st))),128))])]),_:2},1024)]),_:2},1024)])):e.createCommentVNode("",!0)]),e.createVNode(E,{onClick:r=>te(n.id),variant:"ghost",size:"icon",class:"mt-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.Trash2),{class:"w-4 h-4 text-destructive"})]),_:1},8,["onClick"])]))),128)),d.pricingRules.length===0?(e.openBlock(),e.createElementBlock("div",mt,' No pricing rules configured. Click "Add Rule" to create conditional fees. ')):e.createCommentVNode("",!0)])]),e.createVNode(Se),e.createElementVNode("div",null,[e.createVNode(l,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[44]||(t[44]=[e.createTextVNode(" Payment Preferences ",-1)])]),_:1}),t[51]||(t[51]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-6"}," Let customers pay full or in part when booking a slot, or pay later. ",-1)),e.createVNode(j,{modelValue:d.paymentType,"onUpdate:modelValue":t[1]||(t[1]=n=>d.paymentType=n),class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createVNode(l,{for:"r1",class:"flex items-start space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{id:"r1",value:"full"}),t[45]||(t[45]=e.createElementVNode("div",null,[e.createElementVNode("p",null,"Pay Full Amount when Booking"),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Your customers are required to complete the payment to confirm their booking. ")],-1))]),_:1}),e.createVNode(l,{for:"r2",class:"flex items-start space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{id:"r2",value:"partial"}),t[46]||(t[46]=e.createElementVNode("div",null,[e.createElementVNode("p",null,"Pay Part Amount when Booking"),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Your customers are required to pay a deposit to confirm their booking. ")],-1))]),_:1}),e.createVNode(l,{for:"r3",class:"flex items-start space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{id:"r3",value:"later"}),t[47]||(t[47]=e.createElementVNode("div",null,[e.createElementVNode("p",null,"Pay Later at Appointment"),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Your customers can book now and pay in person at the time of their appointment. ")],-1))]),_:1})]),_:1},8,["modelValue"]),d.paymentType==="partial"?(e.openBlock(),e.createElementBlock("div",ut,[e.createVNode(l,{class:"text-sm font-medium mb-4 block"},{default:e.withCtx(()=>[...t[48]||(t[48]=[e.createTextVNode(" Deposit Amount Configuration ",-1)])]),_:1}),e.createElementVNode("div",pt,[e.createVNode(j,{modelValue:d.partialPayment.type,"onUpdate:modelValue":t[2]||(t[2]=n=>d.partialPayment.type=n),class:"flex gap-4"},{default:e.withCtx(()=>[e.createVNode(l,{class:"flex items-center space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{value:"percentage"}),t[49]||(t[49]=e.createElementVNode("span",null,"Percentage",-1))]),_:1}),e.createVNode(l,{class:"flex items-center space-x-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(h,{value:"fixed"}),t[50]||(t[50]=e.createElementVNode("span",null,"Fixed Amount",-1))]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",Vt,[e.createElementVNode("div",ft,[e.createVNode(k,{modelValue:d.partialPayment.amount,"onUpdate:modelValue":t[3]||(t[3]=n=>d.partialPayment.amount=n),modelModifiers:{number:!0},type:"number",min:"0",max:d.partialPayment.type==="percentage"?100:void 0,step:"0.01",placeholder:d.partialPayment.type==="percentage"?"50":"10.00",class:"no-spinner"},null,8,["modelValue","max","placeholder"])]),e.createElementVNode("span",xt,e.toDisplayString(d.partialPayment.type==="percentage"?"%":d.currency),1)]),e.createElementVNode("p",Nt,[d.partialPayment.type==="percentage"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" Customers will pay "+e.toDisplayString(d.partialPayment.amount)+"% of the total price upfront. ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" Customers will pay "+e.toDisplayString(d.currency)+" "+e.toDisplayString(d.partialPayment.amount)+" upfront. ",1)],64))])])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",gt,[R.value?(e.openBlock(),e.createElementBlock("p",vt,[e.createVNode(e.unref(N.AlertTriangle),{class:"size-3.5 shrink-0 mt-0.5"}),t[52]||(t[52]=e.createElementVNode("span",null,"Fix invalid date ranges before saving.",-1))])):e.createCommentVNode("",!0),e.createVNode(E,{onClick:Q,disabled:S.value||R.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.value?"Saving...":"Save Changes"),1)]),_:1},8,["disabled"])])]))])):(e.openBlock(),e.createElementBlock("div",yt,[...t[54]||(t[54]=[e.createElementVNode("h1",{class:"text-lg font-medium mb-2"},"Access Denied",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"You do not have permission to view or edit payment settings.",-1)])]))]),_:1})}}});exports.default=Ct;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./index-ijdf0d9-.js"),i=require("lucide-vue-next"),p=require("@oneclick.dev/cms-kit"),$=require("./EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js"),P={key:0},M={key:0,class:"max-w-3xl space-y-10"},K={class:"space-y-4"},J={class:"border rounded-md p-4 space-y-5"},O={class:"flex items-center justify-between gap-4"},H={class:"space-y-3"},Y={class:"flex items-center justify-between gap-4"},W={key:0,class:"text-sm text-muted-foreground border rounded-md p-4 text-center"},Z={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},G={class:"grid gap-1.5"},Q={class:"grid gap-1.5"},X={class:"grid grid-cols-1 sm:grid-cols-[1fr_1fr_auto] gap-3 items-end"},ee={class:"grid gap-1.5"},te={class:"grid gap-1.5"},oe={class:"flex items-center gap-2"},le={class:"space-y-4"},ne={class:"flex items-start gap-3"},ae={class:"size-9 rounded-lg bg-primary/10 flex items-center justify-center mt-0.5"},de={class:"border rounded-md p-4 space-y-4"},re={class:"flex items-center justify-between gap-4"},se={class:"flex items-center gap-3"},ie={class:"text-sm font-medium"},ue={class:"text-xs text-muted-foreground"},ce={class:"flex items-center justify-between gap-4"},me={class:"flex justify-start pt-4 border-t"},fe={key:1},pe=e.defineComponent({__name:"refunds",setup(ve){const{params:v}=p.useModuleRoute(),{isAdmin:N}=p.useModulePermissions(),g=p.useModuleApi(),l=e.reactive({refundFlow:{},refundFlowEnabled:!0,refundDialog:{showAmount:!0,fields:[]}}),u=e.ref(!1),V=e.ref(!0),_=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"textarea",label:"Long text"},{value:"checkbox",label:"Yes / No"}],b=()=>Math.random().toString(36).slice(2,11),w=()=>{let o=l.refundDialog.fields.length+1,t=`field_${o}`;for(;l.refundDialog.fields.some(a=>a.key===t);)o+=1,t=`field_${o}`;return t},y=o=>o.type==="number"?1:o.type==="checkbox"?!0:(o.type==="textarea",o.defaultValue||"Example value"),x=e.computed(()=>Object.fromEntries(l.refundDialog.fields.filter(o=>o.key).map(o=>[o.key,y(o)]))),c=e.computed(()=>Object.keys(l.refundFlow||{}).length>0),h=e.computed(()=>c.value?l.refundFlowEnabled?"Refund flow enabled":"Refund flow disabled":"No refund flow configured"),E=e.computed(()=>c.value?l.refundFlowEnabled?"Cancel & Refund is visible for paid approved reservations.":"The flow is saved, but Cancel & Refund is hidden until this is enabled again.":"Build a flow before using Cancel & Refund."),k=e.computed(()=>[{id:"agenda",name:"agenda",type:"object",value:{id:"agenda_123",name:"Example agenda"}},{id:"order",name:"order",type:"object",value:{id:"order_123",status:"confirmed",total:100,amountPaid:100,customerInfo:{firstName:"Jane",lastName:"Doe",email:"jane@example.com"}}},{id:"reservation",name:"reservation",type:"object",value:{id:"reservation_123",status:"approved",date:"2026-06-02",totalPrice:100,timeslot:{startTime:"09:00",endTime:"10:00"}}},{id:"booking",name:"booking",type:"object",value:{id:"order_123",res_id:"reservation_123",reservationPrice:100,customerInfo:{firstName:"Jane",lastName:"Doe"}}},{id:"customer",name:"customer",type:"object",value:{firstName:"Jane",lastName:"Doe",email:"jane@example.com"}},{id:"refund",name:"refund",type:"object",value:{amount:100,hasAmount:l.refundDialog.showAmount,reason:"Reservation cancelled",fields:x.value,fieldDefinitions:l.refundDialog.fields,requestedAt:"2026-06-02T10:00:00.000Z",notification:{skipped:!1,to:"jane@example.com",subject:"Cancellation and refund of your reservation"}}},{id:"refundFields",name:"refundFields",type:"object",value:x.value},{id:"refundHasAmount",name:"refundHasAmount",type:"boolean",value:l.refundDialog.showAmount},{id:"orderId",name:"orderId",type:"string",value:"order_123"},{id:"reservationId",name:"reservationId",type:"string",value:"reservation_123"},{id:"refundAmount",name:"refundAmount",type:"number",value:100}]),C=()=>{const o=w();l.refundDialog.fields.push({id:b(),key:o,label:"New field",type:"text",required:!1,placeholder:"",defaultValue:""})},F=o=>{l.refundDialog.fields=l.refundDialog.fields.filter(t=>t.id!==o)},D=()=>{l.refundFlow={},l.refundFlowEnabled=!0},S=()=>l.refundDialog.fields.map(o=>({...o,key:o.key?.trim(),label:o.label?.trim(),placeholder:o.placeholder||""})),B=()=>{const o=S();if(o.some(a=>!a.key||!a.label))return s.toast.error("Each dialog field needs a label and key"),null;const t=o.find((a,m)=>o.findIndex(r=>r.key===a.key)!==m)?.key;return t?(s.toast.error(`Field key "${t}" is used more than once`),null):o},T=async()=>{u.value=!0;try{const o=v.value.id;if(!o)throw new Error("Missing agenda ID");const t=B();if(!t)return;await g.patch(`/agendas/${o}/refund-flow`,{body:{refundFlow:l.refundFlow??{},refundFlowEnabled:l.refundFlowEnabled!==!1,refundDialog:{showAmount:l.refundDialog.showAmount!==!1,fields:t}}}),s.toast.success("Refund settings saved")}catch(o){console.error("Error saving refund settings:",o),s.toast.error("Failed to save refund settings")}finally{u.value=!1}};return(async()=>{try{const o=await g.get(`/agendas/${v.value.id}/refund-flow`);o&&(l.refundFlow=o.refundFlow||{},l.refundFlowEnabled=o.refundFlowEnabled!==!1,l.refundDialog.showAmount=o.refundDialog?.showAmount!==!1,l.refundDialog.fields=Array.isArray(o.refundDialog?.fields)?o.refundDialog.fields:[])}catch(o){console.error("Error loading refund settings:",o),s.toast.error("Failed to load refund settings")}finally{V.value=!1}})(),(o,t)=>{const a=e.resolveComponent("Label"),m=e.resolveComponent("Switch"),r=e.resolveComponent("Button"),f=e.resolveComponent("Input"),A=e.resolveComponent("SelectValue"),j=e.resolveComponent("SelectTrigger"),R=e.resolveComponent("SelectItem"),I=e.resolveComponent("SelectContent"),U=e.resolveComponent("Select"),q=e.resolveComponent("Checkbox"),z=e.resolveComponent("Separator"),L=e.resolveComponent("FlowBuilderSelect");return e.openBlock(),e.createBlock($._sfc_main,null,{default:e.withCtx(()=>[e.unref(N)()?(e.openBlock(),e.createElementBlock("div",P,[t[15]||(t[15]=e.createElementVNode("h1",{class:"text-lg font-medium mb-2"},"Refunds",-1)),t[16]||(t[16]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-8"},"Configure the flow and dialog used when an approved reservation is cancelled with a refund.",-1)),V.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("div",K,[e.createElementVNode("div",null,[e.createVNode(a,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode(" Dialog ",-1)])]),_:1})]),e.createElementVNode("div",J,[e.createElementVNode("div",O,[t[4]||(t[4]=e.createElementVNode("div",null,[e.createElementVNode("p",{class:"text-sm font-medium"},"Refund amount")],-1)),e.createVNode(m,{modelValue:l.refundDialog.showAmount,"onUpdate:modelValue":t[0]||(t[0]=n=>l.refundDialog.showAmount=n)},null,8,["modelValue"])]),e.createElementVNode("div",H,[e.createElementVNode("div",Y,[t[6]||(t[6]=e.createElementVNode("p",{class:"text-sm font-medium"},"Extra fields",-1)),e.createVNode(r,{variant:"outline",size:"sm",onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(i.PlusCircle),{class:"size-4"}),t[5]||(t[5]=e.createTextVNode(" Add Field ",-1))]),_:1})]),l.refundDialog.fields.length===0?(e.openBlock(),e.createElementBlock("div",W," No extra fields configured. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.refundDialog.fields,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"border rounded-md p-4 space-y-3"},[e.createElementVNode("div",Z,[e.createElementVNode("div",G,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Label",-1)])]),_:1}),e.createVNode(f,{modelValue:n.label,"onUpdate:modelValue":d=>n.label=d},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Q,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Key",-1)])]),_:1}),e.createVNode(f,{modelValue:n.key,"onUpdate:modelValue":d=>n.key=d},null,8,["modelValue","onUpdate:modelValue"])])]),e.createElementVNode("div",X,[e.createElementVNode("div",ee,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(U,{modelValue:n.type,"onUpdate:modelValue":d=>n.type=d},{default:e.withCtx(()=>[e.createVNode(j,null,{default:e.withCtx(()=>[e.createVNode(A)]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(_,d=>e.createVNode(R,{key:d.value,value:d.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label),1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",te,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Placeholder",-1)])]),_:1}),e.createVNode(f,{modelValue:n.placeholder,"onUpdate:modelValue":d=>n.placeholder=d,disabled:n.type==="checkbox"},null,8,["modelValue","onUpdate:modelValue","disabled"])]),e.createVNode(r,{variant:"ghost",size:"icon",onClick:d=>F(n.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.Trash2),{class:"size-4 text-destructive"})]),_:1},8,["onClick"])]),e.createElementVNode("div",oe,[e.createVNode(q,{id:`refund-field-required-${n.id}`,modelValue:n.required,"onUpdate:modelValue":d=>n.required=d},null,8,["id","modelValue","onUpdate:modelValue"]),e.createVNode(a,{for:`refund-field-required-${n.id}`,class:"text-sm"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Required",-1)])]),_:1},8,["for"])])]))),128))])])]),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.createElementVNode("div",ae,[e.createVNode(e.unref(i.Workflow),{class:"size-4 text-primary"})]),e.createElementVNode("div",null,[e.createVNode(a,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode(" Refund Flow ",-1)])]),_:1}),t[13]||(t[13]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," This flow receives the order, reservation, customer, agenda, and refund details from the refund dialog. ",-1))])]),e.createElementVNode("div",de,[e.createElementVNode("div",re,[e.createElementVNode("div",se,[e.createVNode(e.unref(i.BadgeEuro),{class:"size-5 text-muted-foreground"}),e.createElementVNode("div",null,[e.createElementVNode("p",ie,e.toDisplayString(h.value),1),e.createElementVNode("p",ue,e.toDisplayString(E.value),1)])]),c.value?(e.openBlock(),e.createBlock(m,{key:0,modelValue:l.refundFlowEnabled,"onUpdate:modelValue":t[1]||(t[1]=n=>l.refundFlowEnabled=n)},null,8,["modelValue"])):e.createCommentVNode("",!0)]),e.createVNode(z),e.createElementVNode("div",ce,[e.createVNode(L,{modelValue:l.refundFlow,"onUpdate:modelValue":t[2]||(t[2]=n=>l.refundFlow=n),variables:k.value,"button-variant":"outline"},null,8,["modelValue","variables"]),e.createVNode(r,{variant:"outline",size:"sm",disabled:!c.value,onClick:D},{default:e.withCtx(()=>[e.createVNode(e.unref(i.Trash2),{class:"size-4"}),t[14]||(t[14]=e.createTextVNode(" Remove Flow ",-1))]),_:1},8,["disabled"])])])]),e.createElementVNode("div",me,[e.createVNode(r,{onClick:T,disabled:u.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.value?"Saving...":"Save Changes"),1)]),_:1},8,["disabled"])])]))])):(e.openBlock(),e.createElementBlock("div",fe,[...t[17]||(t[17]=[e.createElementVNode("h1",{class:"text-lg font-medium mb-2"},"Access Denied",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"You do not have permission to view or edit refund settings.",-1)])]))]),_:1})}}});exports.default=pe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./index-ijdf0d9-.js"),i=require("lucide-vue-next"),p=require("@oneclick.dev/cms-kit"),$=require("./EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js"),P={key:0},M={key:0,class:"max-w-3xl space-y-10"},K={class:"space-y-4"},J={class:"border rounded-md p-4 space-y-5"},O={class:"flex items-center justify-between gap-4"},H={class:"space-y-3"},Y={class:"flex items-center justify-between gap-4"},W={key:0,class:"text-sm text-muted-foreground border rounded-md p-4 text-center"},Z={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},G={class:"grid gap-1.5"},Q={class:"grid gap-1.5"},X={class:"grid grid-cols-1 sm:grid-cols-[1fr_1fr_auto] gap-3 items-end"},ee={class:"grid gap-1.5"},te={class:"grid gap-1.5"},oe={class:"flex items-center gap-2"},le={class:"space-y-4"},ne={class:"flex items-start gap-3"},ae={class:"size-9 rounded-lg bg-primary/10 flex items-center justify-center mt-0.5"},de={class:"border rounded-md p-4 space-y-4"},re={class:"flex items-center justify-between gap-4"},se={class:"flex items-center gap-3"},ie={class:"text-sm font-medium"},ue={class:"text-xs text-muted-foreground"},ce={class:"flex items-center justify-between gap-4"},me={class:"flex justify-start pt-4 border-t"},fe={key:1},pe=e.defineComponent({__name:"refunds",setup(ve){const{params:v}=p.useModuleRoute(),{isAdmin:N}=p.useModulePermissions(),g=p.useModuleApi(),l=e.reactive({refundFlow:{},refundFlowEnabled:!0,refundDialog:{showAmount:!0,fields:[]}}),u=e.ref(!1),V=e.ref(!0),_=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"textarea",label:"Long text"},{value:"checkbox",label:"Yes / No"}],b=()=>Math.random().toString(36).slice(2,11),w=()=>{let o=l.refundDialog.fields.length+1,t=`field_${o}`;for(;l.refundDialog.fields.some(a=>a.key===t);)o+=1,t=`field_${o}`;return t},y=o=>o.type==="number"?1:o.type==="checkbox"?!0:(o.type==="textarea",o.defaultValue||"Example value"),x=e.computed(()=>Object.fromEntries(l.refundDialog.fields.filter(o=>o.key).map(o=>[o.key,y(o)]))),c=e.computed(()=>Object.keys(l.refundFlow||{}).length>0),h=e.computed(()=>c.value?l.refundFlowEnabled?"Refund flow enabled":"Refund flow disabled":"No refund flow configured"),E=e.computed(()=>c.value?l.refundFlowEnabled?"Cancel & Refund is visible for paid approved reservations.":"The flow is saved, but Cancel & Refund is hidden until this is enabled again.":"Build a flow before using Cancel & Refund."),k=e.computed(()=>[{id:"agenda",name:"agenda",type:"object",value:{id:"agenda_123",name:"Example agenda"}},{id:"order",name:"order",type:"object",value:{id:"order_123",status:"confirmed",total:100,amountPaid:100,customerInfo:{firstName:"Jane",lastName:"Doe",email:"jane@example.com"}}},{id:"reservation",name:"reservation",type:"object",value:{id:"reservation_123",status:"approved",date:"2026-06-02",totalPrice:100,timeslot:{startTime:"09:00",endTime:"10:00"}}},{id:"booking",name:"booking",type:"object",value:{id:"order_123",res_id:"reservation_123",reservationPrice:100,customerInfo:{firstName:"Jane",lastName:"Doe"}}},{id:"customer",name:"customer",type:"object",value:{firstName:"Jane",lastName:"Doe",email:"jane@example.com"}},{id:"refund",name:"refund",type:"object",value:{amount:100,hasAmount:l.refundDialog.showAmount,reason:"Reservation cancelled",fields:x.value,fieldDefinitions:l.refundDialog.fields,requestedAt:"2026-06-02T10:00:00.000Z",notification:{skipped:!1,to:"jane@example.com",subject:"Cancellation and refund of your reservation"}}},{id:"refundFields",name:"refundFields",type:"object",value:x.value},{id:"refundHasAmount",name:"refundHasAmount",type:"boolean",value:l.refundDialog.showAmount},{id:"orderId",name:"orderId",type:"string",value:"order_123"},{id:"reservationId",name:"reservationId",type:"string",value:"reservation_123"},{id:"refundAmount",name:"refundAmount",type:"number",value:100}]),C=()=>{const o=w();l.refundDialog.fields.push({id:b(),key:o,label:"New field",type:"text",required:!1,placeholder:"",defaultValue:""})},F=o=>{l.refundDialog.fields=l.refundDialog.fields.filter(t=>t.id!==o)},D=()=>{l.refundFlow={},l.refundFlowEnabled=!0},S=()=>l.refundDialog.fields.map(o=>({...o,key:o.key?.trim(),label:o.label?.trim(),placeholder:o.placeholder||""})),B=()=>{const o=S();if(o.some(a=>!a.key||!a.label))return s.toast.error("Each dialog field needs a label and key"),null;const t=o.find((a,m)=>o.findIndex(r=>r.key===a.key)!==m)?.key;return t?(s.toast.error(`Field key "${t}" is used more than once`),null):o},T=async()=>{u.value=!0;try{const o=v.value.id;if(!o)throw new Error("Missing agenda ID");const t=B();if(!t)return;await g.patch(`/agendas/${o}/refund-flow`,{body:{refundFlow:l.refundFlow??{},refundFlowEnabled:l.refundFlowEnabled!==!1,refundDialog:{showAmount:l.refundDialog.showAmount!==!1,fields:t}}}),s.toast.success("Refund settings saved")}catch(o){console.error("Error saving refund settings:",o),s.toast.error("Failed to save refund settings")}finally{u.value=!1}};return(async()=>{try{const o=await g.get(`/agendas/${v.value.id}/refund-flow`);o&&(l.refundFlow=o.refundFlow||{},l.refundFlowEnabled=o.refundFlowEnabled!==!1,l.refundDialog.showAmount=o.refundDialog?.showAmount!==!1,l.refundDialog.fields=Array.isArray(o.refundDialog?.fields)?o.refundDialog.fields:[])}catch(o){console.error("Error loading refund settings:",o),s.toast.error("Failed to load refund settings")}finally{V.value=!1}})(),(o,t)=>{const a=e.resolveComponent("Label"),m=e.resolveComponent("Switch"),r=e.resolveComponent("Button"),f=e.resolveComponent("Input"),A=e.resolveComponent("SelectValue"),j=e.resolveComponent("SelectTrigger"),R=e.resolveComponent("SelectItem"),I=e.resolveComponent("SelectContent"),U=e.resolveComponent("Select"),q=e.resolveComponent("Checkbox"),z=e.resolveComponent("Separator"),L=e.resolveComponent("FlowBuilderSelect");return e.openBlock(),e.createBlock($._sfc_main,null,{default:e.withCtx(()=>[e.unref(N)()?(e.openBlock(),e.createElementBlock("div",P,[t[15]||(t[15]=e.createElementVNode("h1",{class:"text-lg font-medium mb-2"},"Refunds",-1)),t[16]||(t[16]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-8"},"Configure the flow and dialog used when an approved reservation is cancelled with a refund.",-1)),V.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("div",K,[e.createElementVNode("div",null,[e.createVNode(a,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode(" Dialog ",-1)])]),_:1})]),e.createElementVNode("div",J,[e.createElementVNode("div",O,[t[4]||(t[4]=e.createElementVNode("div",null,[e.createElementVNode("p",{class:"text-sm font-medium"},"Refund amount")],-1)),e.createVNode(m,{modelValue:l.refundDialog.showAmount,"onUpdate:modelValue":t[0]||(t[0]=n=>l.refundDialog.showAmount=n)},null,8,["modelValue"])]),e.createElementVNode("div",H,[e.createElementVNode("div",Y,[t[6]||(t[6]=e.createElementVNode("p",{class:"text-sm font-medium"},"Extra fields",-1)),e.createVNode(r,{variant:"outline",size:"sm",onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(i.PlusCircle),{class:"size-4"}),t[5]||(t[5]=e.createTextVNode(" Add Field ",-1))]),_:1})]),l.refundDialog.fields.length===0?(e.openBlock(),e.createElementBlock("div",W," No extra fields configured. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.refundDialog.fields,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"border rounded-md p-4 space-y-3"},[e.createElementVNode("div",Z,[e.createElementVNode("div",G,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Label",-1)])]),_:1}),e.createVNode(f,{modelValue:n.label,"onUpdate:modelValue":d=>n.label=d},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Q,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Key",-1)])]),_:1}),e.createVNode(f,{modelValue:n.key,"onUpdate:modelValue":d=>n.key=d},null,8,["modelValue","onUpdate:modelValue"])])]),e.createElementVNode("div",X,[e.createElementVNode("div",ee,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(U,{modelValue:n.type,"onUpdate:modelValue":d=>n.type=d},{default:e.withCtx(()=>[e.createVNode(j,null,{default:e.withCtx(()=>[e.createVNode(A)]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(_,d=>e.createVNode(R,{key:d.value,value:d.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label),1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",te,[e.createVNode(a,{class:"text-xs text-muted-foreground"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Placeholder",-1)])]),_:1}),e.createVNode(f,{modelValue:n.placeholder,"onUpdate:modelValue":d=>n.placeholder=d,disabled:n.type==="checkbox"},null,8,["modelValue","onUpdate:modelValue","disabled"])]),e.createVNode(r,{variant:"ghost",size:"icon",onClick:d=>F(n.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.Trash2),{class:"size-4 text-destructive"})]),_:1},8,["onClick"])]),e.createElementVNode("div",oe,[e.createVNode(q,{id:`refund-field-required-${n.id}`,modelValue:n.required,"onUpdate:modelValue":d=>n.required=d},null,8,["id","modelValue","onUpdate:modelValue"]),e.createVNode(a,{for:`refund-field-required-${n.id}`,class:"text-sm"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Required",-1)])]),_:1},8,["for"])])]))),128))])])]),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.createElementVNode("div",ae,[e.createVNode(e.unref(i.Workflow),{class:"size-4 text-primary"})]),e.createElementVNode("div",null,[e.createVNode(a,{class:"text-base font-medium"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode(" Refund Flow ",-1)])]),_:1}),t[13]||(t[13]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," This flow receives the order, reservation, customer, agenda, and refund details from the refund dialog. ",-1))])]),e.createElementVNode("div",de,[e.createElementVNode("div",re,[e.createElementVNode("div",se,[e.createVNode(e.unref(i.BadgeEuro),{class:"size-5 text-muted-foreground"}),e.createElementVNode("div",null,[e.createElementVNode("p",ie,e.toDisplayString(h.value),1),e.createElementVNode("p",ue,e.toDisplayString(E.value),1)])]),c.value?(e.openBlock(),e.createBlock(m,{key:0,modelValue:l.refundFlowEnabled,"onUpdate:modelValue":t[1]||(t[1]=n=>l.refundFlowEnabled=n)},null,8,["modelValue"])):e.createCommentVNode("",!0)]),e.createVNode(z),e.createElementVNode("div",ce,[e.createVNode(L,{modelValue:l.refundFlow,"onUpdate:modelValue":t[2]||(t[2]=n=>l.refundFlow=n),variables:k.value,"button-variant":"outline"},null,8,["modelValue","variables"]),e.createVNode(r,{variant:"outline",size:"sm",disabled:!c.value,onClick:D},{default:e.withCtx(()=>[e.createVNode(e.unref(i.Trash2),{class:"size-4"}),t[14]||(t[14]=e.createTextVNode(" Remove Flow ",-1))]),_:1},8,["disabled"])])])]),e.createElementVNode("div",me,[e.createVNode(r,{onClick:T,disabled:u.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.value?"Saving...":"Save Changes"),1)]),_:1},8,["disabled"])])]))])):(e.openBlock(),e.createElementBlock("div",fe,[...t[17]||(t[17]=[e.createElementVNode("h1",{class:"text-lg font-medium mb-2"},"Access Denied",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"You do not have permission to view or edit refund settings.",-1)])]))]),_:1})}}});exports.default=pe;
|
|
@@ -2,7 +2,7 @@ import { defineComponent as ee, reactive as te, ref as S, computed as g, resolve
|
|
|
2
2
|
import { t as v } from "./index-RLz1QPrf.mjs";
|
|
3
3
|
import { PlusCircle as oe, Trash2 as j, Workflow as le, BadgeEuro as ne } from "lucide-vue-next";
|
|
4
4
|
import { useModuleRoute as ae, useModulePermissions as de, useModuleApi as se } from "@oneclick.dev/cms-kit";
|
|
5
|
-
import { _ as re } from "./EditLayout.vue_vue_type_script_setup_true_lang-
|
|
5
|
+
import { _ as re } from "./EditLayout.vue_vue_type_script_setup_true_lang-4_t0PPqM.mjs";
|
|
6
6
|
const ie = { key: 0 }, ue = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "max-w-3xl space-y-10"
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),A=require("@oneclick.dev/cms-kit"),V=require("lucide-vue-next"),se=require("./EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js"),ae={class:"space-y-6"},de={class:"flex flex-col gap-4 @3xl:flex-row @3xl:items-start @3xl:justify-between"},le={class:"text-2xl font-semibold tracking-tight flex items-center gap-2"},ue={class:"flex flex-col gap-2 sm:flex-row sm:items-center"},ie={class:"grid grid-cols-1 gap-3 @xl:grid-cols-3 md:items-end"},ce={class:"grid gap-1.5"},me={class:"grid gap-1.5"},fe={key:0,class:"text-sm text-destructive"},pe={class:"flex flex-wrap gap-2"},xe={key:0,class:"flex items-center justify-center py-12"},ve={key:1,class:"text-center py-12 text-muted-foreground"},ge={class:"grid grid-cols-1 gap-4 @3xl:grid-cols-2 @7xl:grid-cols-4"},Ne={class:"text-2xl font-semibold"},Ve={class:"text-xs text-muted-foreground mt-1"},be={class:"text-2xl font-semibold"},he={class:"text-xs text-muted-foreground mt-1"},Ce={class:"text-2xl font-semibold"},ye={class:"text-xs text-muted-foreground mt-1"},we={class:"text-2xl font-semibold"},_e={class:"text-xs text-muted-foreground mt-1"},Ee={class:"grid grid-cols-1 gap-4 @5xl:grid-cols-2"},Re={class:"flex items-center justify-between gap-4"},De={class:"font-medium"},Se={class:"flex items-center justify-between gap-4"},Te={class:"font-medium text-destructive"},ke={class:"flex items-center justify-between gap-4"},$e={class:"font-semibold"},Be={class:"flex items-center justify-between gap-4"},Ae={class:"font-medium"},Oe={class:"flex items-center justify-between gap-4"},je={class:"font-medium"},ze={class:"flex items-center justify-between gap-4"},Me={class:"font-medium"},Fe={class:"flex items-center justify-between gap-4"},Ue={class:"font-medium"},Le={class:"flex items-center justify-between gap-4"},Pe={class:"font-medium"},Ie={class:"flex items-center justify-between gap-4"},qe={class:"font-medium"},Ye={class:"flex items-center gap-2 text-sm font-medium mb-3"},He={class:"space-y-2 text-sm"},Ge={class:"text-muted-foreground"},Qe={class:"font-medium"},Ke={class:"flex items-center gap-2 text-sm font-medium mb-3"},Je={class:"space-y-2 text-sm"},We={class:"text-muted-foreground"},Xe={class:"font-medium"},Ze={class:"overflow-x-auto"},et=e.defineComponent({__name:"reports",setup(tt){const{params:O}=A.useModuleRoute(),{config:j}=A.useModule(),H=A.useFirebaseIntegration(j.project),G=e.computed(()=>O.value?.id??O.id??""),y=e.ref(!1),N=e.ref([]),h=o=>{const t=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),s=String(o.getDate()).padStart(2,"0");return`${t}-${n}-${s}`},$=o=>{const t=Math.floor(o.getMonth()/3)*3;return new Date(o.getFullYear(),t,1)},Q=o=>{const t=Math.floor(o.getMonth()/3)*3;return new Date(o.getFullYear(),t+3,0)},z=new Date,x=e.ref(h($(z))),v=e.ref(h(z)),_=e.computed(()=>!x.value||!v.value?"Select a start and end date.":x.value>v.value?"Start date must be before end date.":""),K=()=>{const o=new Date(`${x.value}T00:00:00`),t=new Date(`${v.value}T23:59:59.999`);return{start:o,end:t}},M=e.computed(()=>{if(!x.value||!v.value)return"";const o=new Date(`${x.value}T00:00:00`),t=new Date(`${v.value}T00:00:00`);return`${o.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} - ${t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`}),J=()=>{const o=new Date;x.value=h($(o)),v.value=h(o)},W=()=>{const o=new Date,t=new Date(o.getFullYear(),Math.floor(o.getMonth()/3)*3-1,1);x.value=h($(t)),v.value=h(Q(t))},X=()=>{const o=new Date;x.value=h(new Date(o.getFullYear(),0,1)),v.value=h(o)},C=o=>{const t=Number(o);return Number.isFinite(t)?t:0},B=o=>{if(!o)return null;if(o instanceof Date)return o;if(typeof o=="string"||typeof o=="number"){const t=new Date(o);return Number.isNaN(t.getTime())?null:t}return typeof o.toDate=="function"?o.toDate():null},w=o=>typeof o.total=="number"?o.total:(o.reservations||[]).reduce((t,n)=>t+C(n.totalPrice),0),Z=o=>typeof o.amountPaid=="number"?o.amountPaid:w(o),F=o=>o.status==="confirmed",E=e.computed(()=>N.value.flatMap(o=>{const t=o.id,n=o.status||"unknown",s=w(o);return(o.reservations||[]).map(c=>({...c,orderId:t,orderStatus:n,orderCreatedAt:o.createdAt,orderTotal:s,orderAmountPaid:o.amountPaid}))})),U=o=>Array.isArray(o.refunds)?o.refunds:[],L=o=>{const t=U(o);return t.length>0?t.reduce((n,s)=>n+C(s.amount),0):C(o.refundedAmount)},ee=o=>{const t=U(o);return t.length>0?t.length:!!(o.refundStatus||o.refundedAt||C(o.refundedAmount)>0)?1:0},R=e.computed(()=>N.value.filter(F)),r=e.computed(()=>{const o=R.value.reduce((d,f)=>d+w(f),0),t=R.value.reduce((d,f)=>d+Z(f),0),n=E.value.filter(d=>d.orderStatus==="confirmed").length,s=N.value.filter(d=>d.status==="pending").reduce((d,f)=>d+w(f),0),c=N.value.filter(d=>d.status==="cancelled").reduce((d,f)=>d+w(f),0),m=E.value.reduce((d,f)=>d+L(f),0),l=E.value.reduce((d,f)=>d+ee(f),0),b=E.value.reduce((d,f)=>d+C(f.spots),0),p=R.value.reduce((d,f)=>d+C(f.amountDue),0);return{grossRevenue:o,moneyCollected:t,pendingRevenue:s,cancelledRevenue:c,netRevenue:o-m,refundAmount:m,refundCount:l,orders:N.value.length,confirmedOrders:R.value.length,reservations:E.value.length,spots:b,amountDue:p,averageOrder:R.value.length?o/R.value.length:0,averageReservation:n?o/n:0}}),P=e.computed(()=>{const o=new Map;return N.value.forEach(t=>{const n=t.status||"unknown",s=o.get(n)||{status:n,count:0,revenue:0};s.count+=1,s.revenue+=w(t),o.set(n,s)}),Array.from(o.values()).sort((t,n)=>n.count-t.count)}),I=e.computed(()=>{const o=new Map;return E.value.forEach(t=>{const n=t.status||"unknown",s=o.get(n)||{status:n,count:0,spots:0,revenue:0};s.count+=1,s.spots+=C(t.spots),s.revenue+=C(t.totalPrice),o.set(n,s)}),Array.from(o.values()).sort((t,n)=>n.count-t.count)}),q=e.computed(()=>{const o=new Map;return N.value.forEach(t=>{const n=B(t.createdAt),s=n?h(n):"Unknown date",c=o.get(s)||{date:s,orders:0,reservations:0,grossRevenue:0,refunds:0,netRevenue:0},m=t.reservations||[],l=m.reduce((p,d)=>p+L(d),0),b=F(t)?w(t):0;c.orders+=1,c.reservations+=m.length,c.grossRevenue+=b,c.refunds+=l,c.netRevenue=c.grossRevenue-c.refunds,o.set(s,c)}),Array.from(o.values()).sort((t,n)=>n.date.localeCompare(t.date))}),a=o=>new Intl.NumberFormat("nl-BE",{style:"currency",currency:"EUR"}).format(o),i=o=>new Intl.NumberFormat("nl-BE").format(o),k=o=>o.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "),g=o=>String(o??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),te=()=>{if(!N.value.length)return;const o=[["Money made",a(r.value.netRevenue),`${a(r.value.grossRevenue)} gross - ${a(r.value.refundAmount)} refunds`],["Orders",i(r.value.orders),`${i(r.value.confirmedOrders)} confirmed`],["Reservations",i(r.value.reservations),`${i(r.value.spots)} spots booked`],["Refunds",i(r.value.refundCount),`${a(r.value.refundAmount)} refunded`]],t=[["Gross revenue",a(r.value.grossRevenue)],["Refunds",a(r.value.refundAmount)],["Net revenue",a(r.value.netRevenue)],["Money collected",a(r.value.moneyCollected)],["Amount due",a(r.value.amountDue)],["Pending order value",a(r.value.pendingRevenue)],["Cancelled order value",a(r.value.cancelledRevenue)],["Average confirmed order",a(r.value.averageOrder)],["Average reservation",a(r.value.averageReservation)]],n=l=>l.map(b=>`<tr>${b.map(p=>`<td>${g(p)}</td>`).join("")}</tr>`).join(""),s=`<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Appointments Report ${g(x.value)} - ${g(v.value)}</title>
|
|
7
|
+
<style>
|
|
8
|
+
* { box-sizing: border-box; }
|
|
9
|
+
body {
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 40px;
|
|
12
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
|
|
13
|
+
color: #111827;
|
|
14
|
+
background: #f8fafc;
|
|
15
|
+
}
|
|
16
|
+
.report {
|
|
17
|
+
max-width: 1040px;
|
|
18
|
+
margin: 0 auto;
|
|
19
|
+
background: #ffffff;
|
|
20
|
+
border: 1px solid #e5e7eb;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
padding: 32px;
|
|
23
|
+
}
|
|
24
|
+
h1, h2 { margin: 0; }
|
|
25
|
+
h1 { font-size: 28px; letter-spacing: 0; }
|
|
26
|
+
h2 { font-size: 16px; margin-bottom: 12px; }
|
|
27
|
+
.muted { color: #6b7280; }
|
|
28
|
+
.header {
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
gap: 24px;
|
|
32
|
+
border-bottom: 1px solid #e5e7eb;
|
|
33
|
+
padding-bottom: 24px;
|
|
34
|
+
margin-bottom: 24px;
|
|
35
|
+
}
|
|
36
|
+
.cards {
|
|
37
|
+
display: grid;
|
|
38
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
39
|
+
gap: 12px;
|
|
40
|
+
margin-bottom: 24px;
|
|
41
|
+
}
|
|
42
|
+
.card {
|
|
43
|
+
border: 1px solid #e5e7eb;
|
|
44
|
+
border-radius: 8px;
|
|
45
|
+
padding: 16px;
|
|
46
|
+
background: #ffffff;
|
|
47
|
+
}
|
|
48
|
+
.card-label { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
|
|
49
|
+
.card-value { font-size: 22px; font-weight: 700; }
|
|
50
|
+
.card-note { font-size: 12px; color: #6b7280; margin-top: 6px; }
|
|
51
|
+
.grid {
|
|
52
|
+
display: grid;
|
|
53
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
54
|
+
gap: 24px;
|
|
55
|
+
margin-bottom: 24px;
|
|
56
|
+
}
|
|
57
|
+
table {
|
|
58
|
+
width: 100%;
|
|
59
|
+
border-collapse: collapse;
|
|
60
|
+
font-size: 13px;
|
|
61
|
+
}
|
|
62
|
+
th, td {
|
|
63
|
+
border-bottom: 1px solid #e5e7eb;
|
|
64
|
+
padding: 10px 8px;
|
|
65
|
+
text-align: left;
|
|
66
|
+
}
|
|
67
|
+
th {
|
|
68
|
+
color: #6b7280;
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
background: #f9fafb;
|
|
71
|
+
}
|
|
72
|
+
td:last-child, th:last-child { text-align: right; }
|
|
73
|
+
@media print {
|
|
74
|
+
body { background: #ffffff; padding: 0; }
|
|
75
|
+
.report { border: 0; }
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
78
|
+
</head>
|
|
79
|
+
<body>
|
|
80
|
+
<main class="report">
|
|
81
|
+
<section class="header">
|
|
82
|
+
<div>
|
|
83
|
+
<h1>Appointments Report</h1>
|
|
84
|
+
<p class="muted">${g(M.value)}</p>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="muted">Generated ${g(new Date().toLocaleString("en-US"))}</div>
|
|
87
|
+
</section>
|
|
88
|
+
|
|
89
|
+
<section class="cards">
|
|
90
|
+
${o.map(([l,b,p])=>`
|
|
91
|
+
<div class="card">
|
|
92
|
+
<div class="card-label">${g(l)}</div>
|
|
93
|
+
<div class="card-value">${g(b)}</div>
|
|
94
|
+
<div class="card-note">${g(p)}</div>
|
|
95
|
+
</div>
|
|
96
|
+
`).join("")}
|
|
97
|
+
</section>
|
|
98
|
+
|
|
99
|
+
<section class="grid">
|
|
100
|
+
<div>
|
|
101
|
+
<h2>Finance</h2>
|
|
102
|
+
<table><tbody>${n(t)}</tbody></table>
|
|
103
|
+
</div>
|
|
104
|
+
<div>
|
|
105
|
+
<h2>Order Status</h2>
|
|
106
|
+
<table>
|
|
107
|
+
<tbody>
|
|
108
|
+
${n(P.value.map(l=>[k(l.status),`${i(l.count)} - ${a(l.revenue)}`]))}
|
|
109
|
+
</tbody>
|
|
110
|
+
</table>
|
|
111
|
+
</div>
|
|
112
|
+
</section>
|
|
113
|
+
|
|
114
|
+
<section class="grid">
|
|
115
|
+
<div>
|
|
116
|
+
<h2>Reservation Status</h2>
|
|
117
|
+
<table>
|
|
118
|
+
<tbody>
|
|
119
|
+
${n(I.value.map(l=>[k(l.status),`${i(l.count)} - ${i(l.spots)} spots - ${a(l.revenue)}`]))}
|
|
120
|
+
</tbody>
|
|
121
|
+
</table>
|
|
122
|
+
</div>
|
|
123
|
+
<div>
|
|
124
|
+
<h2>Period Totals</h2>
|
|
125
|
+
<table><tbody>${n([["Start date",x.value],["End date",v.value],["Orders",i(r.value.orders)],["Reservations",i(r.value.reservations)]])}</tbody></table>
|
|
126
|
+
</div>
|
|
127
|
+
</section>
|
|
128
|
+
|
|
129
|
+
<section>
|
|
130
|
+
<h2>Daily Breakdown</h2>
|
|
131
|
+
<table>
|
|
132
|
+
<thead>
|
|
133
|
+
<tr>
|
|
134
|
+
<th>Date</th>
|
|
135
|
+
<th>Orders</th>
|
|
136
|
+
<th>Reservations</th>
|
|
137
|
+
<th>Gross</th>
|
|
138
|
+
<th>Refunds</th>
|
|
139
|
+
<th>Net</th>
|
|
140
|
+
</tr>
|
|
141
|
+
</thead>
|
|
142
|
+
<tbody>
|
|
143
|
+
${q.value.map(l=>`
|
|
144
|
+
<tr>
|
|
145
|
+
<td>${g(l.date)}</td>
|
|
146
|
+
<td>${g(i(l.orders))}</td>
|
|
147
|
+
<td>${g(i(l.reservations))}</td>
|
|
148
|
+
<td>${g(a(l.grossRevenue))}</td>
|
|
149
|
+
<td>${g(a(l.refunds))}</td>
|
|
150
|
+
<td>${g(a(l.netRevenue))}</td>
|
|
151
|
+
</tr>
|
|
152
|
+
`).join("")}
|
|
153
|
+
</tbody>
|
|
154
|
+
</table>
|
|
155
|
+
</section>
|
|
156
|
+
</main>
|
|
157
|
+
</body>
|
|
158
|
+
</html>`,c=new Blob([s],{type:"text/html;charset=utf-8"}),m=document.createElement("a");m.href=URL.createObjectURL(c),m.setAttribute("download",`appointments-report-${x.value}-to-${v.value}.html`),document.body.appendChild(m),m.click(),URL.revokeObjectURL(m.href),m.remove()},D=async()=>{if(!_.value){y.value=!0,N.value=[];try{const{start:o,end:t}=K(),n=await H.find(j.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:G.value},{field:"createdAt",operator:">=",value:o.toISOString()},{field:"createdAt",operator:"<=",value:t.toISOString()}]});N.value=n.map(s=>({...s,id:s.id||s.orderId||""})).sort((s,c)=>(B(c.createdAt)?.getTime()||0)-(B(s.createdAt)?.getTime()||0))}catch(o){console.error("Error loading report:",o),N.value=[]}finally{y.value=!1}}};return D(),(o,t)=>{const n=e.resolveComponent("Button"),s=e.resolveComponent("CardTitle"),c=e.resolveComponent("CardDescription"),m=e.resolveComponent("CardHeader"),l=e.resolveComponent("Label"),b=e.resolveComponent("Input"),p=e.resolveComponent("CardContent"),d=e.resolveComponent("Card"),f=e.resolveComponent("Separator"),S=e.resolveComponent("TableHead"),Y=e.resolveComponent("TableRow"),oe=e.resolveComponent("TableHeader"),T=e.resolveComponent("TableCell"),ne=e.resolveComponent("TableBody"),re=e.resolveComponent("Table");return e.openBlock(),e.createBlock(se._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createElementVNode("div",de,[e.createElementVNode("div",null,[e.createElementVNode("h1",le,[e.createVNode(e.unref(V.BarChart3),{class:"size-6"}),t[5]||(t[5]=e.createTextVNode(" Reports ",-1))]),t[6]||(t[6]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," Financial statistics for orders placed in a selected period. ",-1))]),e.createElementVNode("div",ue,[e.createVNode(n,{variant:"outline",onClick:te,disabled:e.unref(y)||!!e.unref(_)||e.unref(N).length===0},{default:e.withCtx(()=>[e.createVNode(e.unref(V.Download),{class:"size-4"}),t[7]||(t[7]=e.createTextVNode(" Download Report ",-1))]),_:1},8,["disabled"]),e.createVNode(n,{variant:"outline",onClick:D,disabled:e.unref(y)||!!e.unref(_)},{default:e.withCtx(()=>[e.createVNode(e.unref(V.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":e.unref(y)}])},null,8,["class"]),t[8]||(t[8]=e.createTextVNode(" Refresh ",-1))]),_:1},8,["disabled"])])]),e.createVNode(d,{class:"-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]"},{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(s,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(V.CalendarIcon),{class:"size-5"}),t[9]||(t[9]=e.createTextVNode(" Period ",-1))]),_:1}),e.createVNode(c,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(M)),1)]),_:1})]),_:1}),e.createVNode(p,{class:"space-y-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ie,[e.createElementVNode("div",ce,[e.createVNode(l,{for:"report-start-date"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Start date",-1)])]),_:1}),e.createVNode(b,{id:"report-start-date",modelValue:e.unref(x),"onUpdate:modelValue":t[0]||(t[0]=u=>e.isRef(x)?x.value=u:null),type:"date"},null,8,["modelValue"])]),e.createElementVNode("div",me,[e.createVNode(l,{for:"report-end-date"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("End date",-1)])]),_:1}),e.createVNode(b,{id:"report-end-date",modelValue:e.unref(v),"onUpdate:modelValue":t[1]||(t[1]=u=>e.isRef(v)?v.value=u:null),type:"date"},null,8,["modelValue"])]),e.createVNode(n,{class:"md:whitespace-nowrap",onClick:D,disabled:e.unref(y)||!!e.unref(_)},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode(" Generate Report ",-1)])]),_:1},8,["disabled"])]),e.unref(_)?(e.openBlock(),e.createElementBlock("p",fe,e.toDisplayString(e.unref(_)),1)):e.createCommentVNode("",!0),e.createElementVNode("div",pe,[e.createVNode(n,{variant:"outline",size:"sm",onClick:t[2]||(t[2]=u=>{J(),D()})},{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" This quarter ",-1)])]),_:1}),e.createVNode(n,{variant:"outline",size:"sm",onClick:t[3]||(t[3]=u=>{W(),D()})},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Previous quarter ",-1)])]),_:1}),e.createVNode(n,{variant:"outline",size:"sm",onClick:t[4]||(t[4]=u=>{X(),D()})},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Year to date ",-1)])]),_:1})])]),_:1})]),_:1}),e.unref(y)?(e.openBlock(),e.createElementBlock("div",xe,[...t[16]||(t[16]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(N).length===0?(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(e.unref(V.BarChart3),{class:"size-12 mx-auto mb-3 opacity-50"}),t[17]||(t[17]=e.createElementVNode("p",null,"No orders found for this period",-1))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",ge,[e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(m,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-sm font-medium text-muted-foreground flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(V.BadgeEuro),{class:"size-4"}),t[18]||(t[18]=e.createTextVNode(" Money made ",-1))]),_:1})]),_:1}),e.createVNode(p,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ne,e.toDisplayString(a(e.unref(r).netRevenue)),1),e.createElementVNode("p",Ve,e.toDisplayString(a(e.unref(r).grossRevenue))+" gross - "+e.toDisplayString(a(e.unref(r).refundAmount))+" refunds ",1)]),_:1})]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(m,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-sm font-medium text-muted-foreground flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(V.ShoppingBag),{class:"size-4"}),t[19]||(t[19]=e.createTextVNode(" Orders ",-1))]),_:1})]),_:1}),e.createVNode(p,null,{default:e.withCtx(()=>[e.createElementVNode("div",be,e.toDisplayString(i(e.unref(r).orders)),1),e.createElementVNode("p",he,e.toDisplayString(i(e.unref(r).confirmedOrders))+" confirmed ",1)]),_:1})]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(m,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-sm font-medium text-muted-foreground flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(V.Users),{class:"size-4"}),t[20]||(t[20]=e.createTextVNode(" Reservations ",-1))]),_:1})]),_:1}),e.createVNode(p,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ce,e.toDisplayString(i(e.unref(r).reservations)),1),e.createElementVNode("p",ye,e.toDisplayString(i(e.unref(r).spots))+" spots booked ",1)]),_:1})]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(m,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-sm font-medium text-muted-foreground flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(V.Undo2),{class:"size-4"}),t[21]||(t[21]=e.createTextVNode(" Refunds ",-1))]),_:1})]),_:1}),e.createVNode(p,null,{default:e.withCtx(()=>[e.createElementVNode("div",we,e.toDisplayString(i(e.unref(r).refundCount)),1),e.createElementVNode("p",_e,e.toDisplayString(a(e.unref(r).refundAmount))+" refunded ",1)]),_:1})]),_:1})]),e.createElementVNode("div",Ee,[e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Finance",-1)])]),_:1}),e.createVNode(c,null,{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Confirmed orders are counted as revenue.",-1)])]),_:1})]),_:1}),e.createVNode(p,{class:"space-y-3 text-sm"},{default:e.withCtx(()=>[e.createElementVNode("div",Re,[t[24]||(t[24]=e.createElementVNode("span",{class:"text-muted-foreground"},"Gross revenue",-1)),e.createElementVNode("span",De,e.toDisplayString(a(e.unref(r).grossRevenue)),1)]),e.createElementVNode("div",Se,[t[25]||(t[25]=e.createElementVNode("span",{class:"text-muted-foreground"},"Refunds",-1)),e.createElementVNode("span",Te,e.toDisplayString(a(e.unref(r).refundAmount)),1)]),e.createVNode(f),e.createElementVNode("div",ke,[t[26]||(t[26]=e.createElementVNode("span",{class:"text-muted-foreground"},"Net revenue",-1)),e.createElementVNode("span",$e,e.toDisplayString(a(e.unref(r).netRevenue)),1)]),e.createElementVNode("div",Be,[t[27]||(t[27]=e.createElementVNode("span",{class:"text-muted-foreground"},"Money collected",-1)),e.createElementVNode("span",Ae,e.toDisplayString(a(e.unref(r).moneyCollected)),1)]),e.createElementVNode("div",Oe,[t[28]||(t[28]=e.createElementVNode("span",{class:"text-muted-foreground"},"Amount due",-1)),e.createElementVNode("span",je,e.toDisplayString(a(e.unref(r).amountDue)),1)]),e.createElementVNode("div",ze,[t[29]||(t[29]=e.createElementVNode("span",{class:"text-muted-foreground"},"Pending order value",-1)),e.createElementVNode("span",Me,e.toDisplayString(a(e.unref(r).pendingRevenue)),1)]),e.createElementVNode("div",Fe,[t[30]||(t[30]=e.createElementVNode("span",{class:"text-muted-foreground"},"Cancelled order value",-1)),e.createElementVNode("span",Ue,e.toDisplayString(a(e.unref(r).cancelledRevenue)),1)]),e.createElementVNode("div",Le,[t[31]||(t[31]=e.createElementVNode("span",{class:"text-muted-foreground"},"Average confirmed order",-1)),e.createElementVNode("span",Pe,e.toDisplayString(a(e.unref(r).averageOrder)),1)]),e.createElementVNode("div",Ie,[t[32]||(t[32]=e.createElementVNode("span",{class:"text-muted-foreground"},"Average reservation",-1)),e.createElementVNode("span",qe,e.toDisplayString(a(e.unref(r).averageReservation)),1)])]),_:1})]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...t[33]||(t[33]=[e.createTextVNode("Status Breakdown",-1)])]),_:1}),e.createVNode(c,null,{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode("Orders and reservation lines in this period.",-1)])]),_:1})]),_:1}),e.createVNode(p,{class:"space-y-5"},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("div",Ye,[e.createVNode(e.unref(V.Receipt),{class:"size-4"}),t[35]||(t[35]=e.createTextVNode(" Orders ",-1))]),e.createElementVNode("div",He,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(P),u=>(e.openBlock(),e.createElementBlock("div",{key:u.status,class:"flex items-center justify-between gap-4"},[e.createElementVNode("span",Ge,e.toDisplayString(k(u.status)),1),e.createElementVNode("span",Qe,e.toDisplayString(i(u.count))+" · "+e.toDisplayString(a(u.revenue)),1)]))),128))])]),e.createVNode(f),e.createElementVNode("div",null,[e.createElementVNode("div",Ke,[e.createVNode(e.unref(V.Users),{class:"size-4"}),t[36]||(t[36]=e.createTextVNode(" Reservations ",-1))]),e.createElementVNode("div",Je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(I),u=>(e.openBlock(),e.createElementBlock("div",{key:u.status,class:"flex items-center justify-between gap-4"},[e.createElementVNode("span",We,e.toDisplayString(k(u.status)),1),e.createElementVNode("span",Xe,e.toDisplayString(i(u.count))+" · "+e.toDisplayString(i(u.spots))+" spots · "+e.toDisplayString(a(u.revenue)),1)]))),128))])])]),_:1})]),_:1})]),e.createVNode(d,{class:"-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]"},{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...t[37]||(t[37]=[e.createTextVNode("Daily Breakdown",-1)])]),_:1}),e.createVNode(c,null,{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode("Revenue is based on orders placed on each day.",-1)])]),_:1})]),_:1}),e.createVNode(p,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ze,[e.createVNode(re,null,{default:e.withCtx(()=>[e.createVNode(oe,null,{default:e.withCtx(()=>[e.createVNode(Y,null,{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode("Date",-1)])]),_:1}),e.createVNode(S,{class:"text-right"},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode("Orders",-1)])]),_:1}),e.createVNode(S,{class:"text-right"},{default:e.withCtx(()=>[...t[41]||(t[41]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createVNode(S,{class:"text-right"},{default:e.withCtx(()=>[...t[42]||(t[42]=[e.createTextVNode("Gross",-1)])]),_:1}),e.createVNode(S,{class:"text-right"},{default:e.withCtx(()=>[...t[43]||(t[43]=[e.createTextVNode("Refunds",-1)])]),_:1}),e.createVNode(S,{class:"text-right"},{default:e.withCtx(()=>[...t[44]||(t[44]=[e.createTextVNode("Net",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(ne,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(q),u=>(e.openBlock(),e.createBlock(Y,{key:u.date},{default:e.withCtx(()=>[e.createVNode(T,{class:"font-medium"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.date),1)]),_:2},1024),e.createVNode(T,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i(u.orders)),1)]),_:2},1024),e.createVNode(T,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i(u.reservations)),1)]),_:2},1024),e.createVNode(T,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a(u.grossRevenue)),1)]),_:2},1024),e.createVNode(T,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a(u.refunds)),1)]),_:2},1024),e.createVNode(T,{class:"text-right font-medium"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a(u.netRevenue)),1)]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})])]),_:1})]),_:1})],64))])]),_:1})}}});exports.default=et;
|