@oneclick.dev/cms-core-modules 0.0.115 → 0.0.116
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-MctMvN7D.js → ContentEditor-CsbOFg3a.js} +52 -52
- package/dist/{ContentEditor-C5yNNLeV.mjs → ContentEditor-Df5uWpVC.mjs} +10337 -8677
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +77 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BHeMJ6nr.mjs +1476 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js +1 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +925 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +5021 -0
- package/dist/Overview-CBahJviK.js +1 -0
- package/dist/Overview-CVQ1pkuD.mjs +527 -0
- package/dist/TableView-Csv5Lycy.mjs +6234 -0
- package/dist/TableView-Cwal0BPW.js +4 -0
- package/dist/agenda-BSdlrfxv.mjs +1253 -0
- package/dist/agenda-Bev1mO7E.js +1 -0
- package/dist/availability-ClBGVgE9.js +1 -0
- package/dist/availability-D8JdA4rP.mjs +274 -0
- package/dist/booking-data-Px7XCIfU.mjs +1024 -0
- package/dist/booking-data-aMS1p_3g.js +1 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/exceptions-CqityDo9.mjs +651 -0
- package/dist/exceptions-DXqc0Nza.js +1 -0
- package/dist/index-CM4eaK5T.mjs +1245 -0
- package/dist/index-DliTZzwI.js +35 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +12 -11
- package/dist/orders-1swJVKw2.js +1 -0
- package/dist/orders-D41GbzIa.mjs +624 -0
- package/dist/payment-BJHgpaeT.js +1 -0
- package/dist/payment-D5j-68Ig.mjs +1278 -0
- package/dist/refunds-D9nTeD2d.mjs +436 -0
- package/dist/refunds-oVB2Opib.js +1 -0
- package/dist/resources-8WouFvJe.js +1 -0
- package/dist/resources-B-D5MUhV.mjs +975 -0
- package/dist/server-handlers.cjs.js +1 -1
- package/dist/server-handlers.mjs +626 -515
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +146 -5
- package/dist/src/appointments/components/edit/EventDialog/CancelRefundReservationDialog.vue.d.ts +33 -0
- package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +26 -8
- package/dist/src/appointments/components/edit/EventDialog/RefundDetailsDisplay.vue.d.ts +8 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +91 -5
- package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +20 -3
- package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +5 -0
- package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +20 -2
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +240 -0
- package/dist/src/appointments/composables/useAgendaMetadataSchema.d.ts +37 -0
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +225 -0
- package/dist/src/appointments/pages/edit/refunds.vue.d.ts +2 -0
- package/dist/src/appointments/server.d.ts +2 -0
- package/dist/src/appointments/types.d.ts +6 -0
- package/dist/src/appointments/utils/printReservation.d.ts +65 -3
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.d.ts +36 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.vue.d.ts +95 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableCell.d.ts +13 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableHeader.d.ts +6 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableRow.d.ts +6 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/index.d.ts +4 -0
- package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/TableMenu.vue.d.ts +13 -0
- package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +14 -0
- package/package.json +2 -2
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +0 -76
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +0 -1263
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +0 -1
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +0 -330
- package/dist/Overview-98nkJUWN.mjs +0 -481
- package/dist/Overview-Dl8cMlsr.js +0 -1
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +0 -349
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +0 -3077
- package/dist/TableView-CVfkyj1k.js +0 -4
- package/dist/TableView-zDx0IegJ.mjs +0 -6096
- package/dist/agenda-BaJu3-1c.js +0 -1
- package/dist/agenda-BwVY_8oM.mjs +0 -1165
- package/dist/availability-CMrRa5y2.mjs +0 -269
- package/dist/availability-Cf2YfMwM.js +0 -1
- package/dist/booking-data-DgJd0BcM.mjs +0 -889
- package/dist/booking-data-Di5GmH_8.js +0 -1
- package/dist/exceptions-B6P9UiCj.js +0 -1
- package/dist/exceptions-De9-FvdP.mjs +0 -646
- package/dist/index-DL6orwdK.js +0 -35
- package/dist/index-hH3e-IYz.mjs +0 -1187
- package/dist/orders-C65SlpJy.mjs +0 -618
- package/dist/orders-XVzWAgG1.js +0 -1
- package/dist/payment-C3ohkehF.mjs +0 -1080
- package/dist/payment-Dfr-Ro-a.js +0 -1
- package/dist/resources-CxeFd57z.js +0 -1
- package/dist/resources-DwYxn2Vi.mjs +0 -811
|
@@ -0,0 +1,1024 @@
|
|
|
1
|
+
import { defineComponent as ie, ref as C, reactive as se, computed as W, resolveComponent as d, openBlock as m, createBlock as I, withCtx as n, createVNode as t, createTextVNode as u, createElementVNode as l, unref as x, createCommentVNode as S, createElementBlock as g, Fragment as A, renderList as M, toDisplayString as w } from "vue";
|
|
2
|
+
import { _ as ce } from "./EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs";
|
|
3
|
+
import { Lock as fe, LockOpen as pe, Workflow as ue, Trash2 as ne, Pencil as de, Eye as ve, EyeOff as ge, PlusCircle as re } from "lucide-vue-next";
|
|
4
|
+
import { useConfirmation as me, useModuleRoute as ye, useModulePermissions as be, useModule as _e, useFirebaseIntegration as xe, useModuleApi as ke } from "@oneclick.dev/cms-kit";
|
|
5
|
+
const Fe = { class: "space-y-6 py-4" }, Ie = { class: "grid grid-cols-2 gap-6" }, we = { class: "relative" }, he = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "text-xs text-red-600 mt-1"
|
|
8
|
+
}, Se = { key: 0 }, Ce = { key: 1 }, De = { class: "flex items-center gap-3" }, Ve = {
|
|
9
|
+
key: 2,
|
|
10
|
+
class: "grid gap-2"
|
|
11
|
+
}, Te = { class: "w-full flex justify-between items-center" }, Ne = { class: "flex items-center gap-2 ml-auto" }, $e = /* @__PURE__ */ ie({
|
|
12
|
+
__name: "CustomerInformationFieldEditorDialog",
|
|
13
|
+
props: {
|
|
14
|
+
keysInUse: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => []
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
emits: ["add-field", "update-field", "remove-field"],
|
|
20
|
+
setup(Q, { expose: P, emit: q }) {
|
|
21
|
+
const z = q, h = Q, { confirm: T } = me(), o = C(!1), b = C("add"), p = C(null), r = se({
|
|
22
|
+
id: "",
|
|
23
|
+
fieldName: "",
|
|
24
|
+
fieldDescription: "",
|
|
25
|
+
fieldType: "text",
|
|
26
|
+
required: !1,
|
|
27
|
+
isNativeField: !1,
|
|
28
|
+
visible: !0,
|
|
29
|
+
options: []
|
|
30
|
+
}), E = W(() => {
|
|
31
|
+
const c = new Set(h.keysInUse);
|
|
32
|
+
return b.value === "edit" && p.value && c.delete(p.value), c;
|
|
33
|
+
}), U = [
|
|
34
|
+
{ value: "text", label: "Text Box" },
|
|
35
|
+
{ value: "checkbox", label: "Checkbox" },
|
|
36
|
+
{ value: "radio", label: "Radio Button" },
|
|
37
|
+
{ value: "select", label: "Select" },
|
|
38
|
+
{ value: "date", label: "Date Picker" }
|
|
39
|
+
], L = (c) => {
|
|
40
|
+
b.value = c ? "edit" : "add", N.value = [], r.id = c?.id || "", p.value = c?.id || null, r.fieldName = c?.fieldName || "", r.fieldDescription = c?.fieldDescription || "", r.fieldType = c?.fieldType || "text", r.required = c?.required || !1, r.isNativeField = c?.isNativeField || !1, r.options = c?.options || [], r.visible = c?.visible !== void 0 ? c.visible : !0, k.value = b.value === "edit", o.value = !0;
|
|
41
|
+
}, H = () => {
|
|
42
|
+
o.value = !1, N.value = [];
|
|
43
|
+
}, K = () => {
|
|
44
|
+
R() && (z("add-field", { ...r }), o.value = !1);
|
|
45
|
+
}, G = () => {
|
|
46
|
+
R() && (z("update-field", p.value, { ...r }), o.value = !1);
|
|
47
|
+
}, Y = () => {
|
|
48
|
+
z("remove-field", p.value), o.value = !1;
|
|
49
|
+
}, N = C([]), R = () => (N.value = [], r.fieldName = r.fieldName.trim(), r.fieldName ? !0 : (N.value.push("Field name is required."), !1)), k = C(!1), B = async () => {
|
|
50
|
+
await T("Previous orders using this field won't update to reflect changes. Are you sure you want to change the key?") && (k.value = !1);
|
|
51
|
+
};
|
|
52
|
+
return P({
|
|
53
|
+
openDialog: L
|
|
54
|
+
}), (c, e) => {
|
|
55
|
+
const Z = d("DialogTitle"), J = d("DialogHeader"), $ = d("Label"), F = d("Input"), V = d("Button"), s = d("SelectValue"), a = d("SelectTrigger"), y = d("SelectItem"), v = d("SelectContent"), _ = d("Select"), f = d("TagsInputItemText"), D = d("TagsInputItemDelete"), j = d("TagsInputItem"), X = d("TagsInputInput"), O = d("TagsInput"), ee = d("Checkbox"), te = d("DialogFooter"), le = d("DialogScrollContent"), oe = d("Dialog");
|
|
56
|
+
return m(), I(oe, {
|
|
57
|
+
open: o.value,
|
|
58
|
+
"onUpdate:open": e[6] || (e[6] = (i) => o.value = i)
|
|
59
|
+
}, {
|
|
60
|
+
default: n(() => [
|
|
61
|
+
t(le, { class: "sm:max-w-2xl" }, {
|
|
62
|
+
default: n(() => [
|
|
63
|
+
t(J, null, {
|
|
64
|
+
default: n(() => [
|
|
65
|
+
t(Z, null, {
|
|
66
|
+
default: n(() => [...e[7] || (e[7] = [
|
|
67
|
+
u("Customer Information", -1)
|
|
68
|
+
])]),
|
|
69
|
+
_: 1
|
|
70
|
+
})
|
|
71
|
+
]),
|
|
72
|
+
_: 1
|
|
73
|
+
}),
|
|
74
|
+
l("div", Fe, [
|
|
75
|
+
l("div", Ie, [
|
|
76
|
+
l("div", null, [
|
|
77
|
+
t($, {
|
|
78
|
+
class: "text-bsmase font-normal mb-1.5",
|
|
79
|
+
for: "customer-info-field-dialog-fieldname"
|
|
80
|
+
}, {
|
|
81
|
+
default: n(() => [...e[8] || (e[8] = [
|
|
82
|
+
u("Field Name", -1)
|
|
83
|
+
])]),
|
|
84
|
+
_: 1
|
|
85
|
+
}),
|
|
86
|
+
t(F, {
|
|
87
|
+
modelValue: r.fieldName,
|
|
88
|
+
"onUpdate:modelValue": e[0] || (e[0] = (i) => r.fieldName = i),
|
|
89
|
+
id: "customer-info-field-dialog-fieldname"
|
|
90
|
+
}, null, 8, ["modelValue"])
|
|
91
|
+
]),
|
|
92
|
+
l("div", null, [
|
|
93
|
+
t($, {
|
|
94
|
+
class: "text-bsmase font-normal mb-1.5",
|
|
95
|
+
for: "customer-info-field-dialog-fieldname"
|
|
96
|
+
}, {
|
|
97
|
+
default: n(() => [...e[9] || (e[9] = [
|
|
98
|
+
u("Key", -1)
|
|
99
|
+
])]),
|
|
100
|
+
_: 1
|
|
101
|
+
}),
|
|
102
|
+
l("div", we, [
|
|
103
|
+
t(F, {
|
|
104
|
+
modelValue: r.id,
|
|
105
|
+
"onUpdate:modelValue": e[1] || (e[1] = (i) => r.id = i),
|
|
106
|
+
id: "customer-info-field-dialog-fieldname",
|
|
107
|
+
disabled: k.value
|
|
108
|
+
}, null, 8, ["modelValue", "disabled"]),
|
|
109
|
+
k.value ? (m(), I(V, {
|
|
110
|
+
key: 0,
|
|
111
|
+
variant: "ghost",
|
|
112
|
+
size: "icon",
|
|
113
|
+
class: "absolute group top-0 right-0",
|
|
114
|
+
onClick: B
|
|
115
|
+
}, {
|
|
116
|
+
default: n(() => [
|
|
117
|
+
t(x(fe), { class: "size-4 block group-hover:hidden" }),
|
|
118
|
+
t(x(pe), { class: "size-4 hidden group-hover:block" })
|
|
119
|
+
]),
|
|
120
|
+
_: 1
|
|
121
|
+
})) : S("", !0)
|
|
122
|
+
]),
|
|
123
|
+
x(E).has(r.id) ? (m(), g("p", he, " Key already in use. ")) : S("", !0)
|
|
124
|
+
])
|
|
125
|
+
]),
|
|
126
|
+
l("div", null, [
|
|
127
|
+
t($, {
|
|
128
|
+
class: "text-sm font-normal mb-1.5",
|
|
129
|
+
for: "customer-info-field-dialog-field-description"
|
|
130
|
+
}, {
|
|
131
|
+
default: n(() => [...e[10] || (e[10] = [
|
|
132
|
+
u("Description", -1)
|
|
133
|
+
])]),
|
|
134
|
+
_: 1
|
|
135
|
+
}),
|
|
136
|
+
t(F, {
|
|
137
|
+
modelValue: r.fieldDescription,
|
|
138
|
+
"onUpdate:modelValue": e[2] || (e[2] = (i) => r.fieldDescription = i),
|
|
139
|
+
id: "customer-info-field-dialog-field-description"
|
|
140
|
+
}, null, 8, ["modelValue"])
|
|
141
|
+
]),
|
|
142
|
+
r.isNativeField ? S("", !0) : (m(), g("div", Se, [
|
|
143
|
+
t($, { class: "text-sm font-normal mb-1.5" }, {
|
|
144
|
+
default: n(() => [...e[11] || (e[11] = [
|
|
145
|
+
u("Field Type", -1)
|
|
146
|
+
])]),
|
|
147
|
+
_: 1
|
|
148
|
+
}),
|
|
149
|
+
t(_, {
|
|
150
|
+
modelValue: r.fieldType,
|
|
151
|
+
"onUpdate:modelValue": e[3] || (e[3] = (i) => r.fieldType = i)
|
|
152
|
+
}, {
|
|
153
|
+
default: n(() => [
|
|
154
|
+
t(a, null, {
|
|
155
|
+
default: n(() => [
|
|
156
|
+
t(s, { placeholder: "Select field type" })
|
|
157
|
+
]),
|
|
158
|
+
_: 1
|
|
159
|
+
}),
|
|
160
|
+
t(v, null, {
|
|
161
|
+
default: n(() => [
|
|
162
|
+
(m(), g(A, null, M(U, (i) => t(y, {
|
|
163
|
+
key: i.value,
|
|
164
|
+
value: i.value
|
|
165
|
+
}, {
|
|
166
|
+
default: n(() => [
|
|
167
|
+
u(w(i.label), 1)
|
|
168
|
+
]),
|
|
169
|
+
_: 2
|
|
170
|
+
}, 1032, ["value"])), 64))
|
|
171
|
+
]),
|
|
172
|
+
_: 1
|
|
173
|
+
})
|
|
174
|
+
]),
|
|
175
|
+
_: 1
|
|
176
|
+
}, 8, ["modelValue"])
|
|
177
|
+
])),
|
|
178
|
+
r.fieldType === "select" || r.fieldType === "radio" ? (m(), g("div", Ce, [
|
|
179
|
+
t($, {
|
|
180
|
+
class: "text-sm font-normal mb-1.5",
|
|
181
|
+
for: "customer-info-field-dialog-field-new-option"
|
|
182
|
+
}, {
|
|
183
|
+
default: n(() => [...e[12] || (e[12] = [
|
|
184
|
+
u("Options", -1)
|
|
185
|
+
])]),
|
|
186
|
+
_: 1
|
|
187
|
+
}),
|
|
188
|
+
t(O, {
|
|
189
|
+
modelValue: r.options,
|
|
190
|
+
"onUpdate:modelValue": e[4] || (e[4] = (i) => r.options = i)
|
|
191
|
+
}, {
|
|
192
|
+
default: n(() => [
|
|
193
|
+
(m(!0), g(A, null, M(r.options, (i) => (m(), I(j, {
|
|
194
|
+
key: i,
|
|
195
|
+
value: i
|
|
196
|
+
}, {
|
|
197
|
+
default: n(() => [
|
|
198
|
+
t(f),
|
|
199
|
+
t(D)
|
|
200
|
+
]),
|
|
201
|
+
_: 1
|
|
202
|
+
}, 8, ["value"]))), 128)),
|
|
203
|
+
t(X, {
|
|
204
|
+
placeholder: "New option...",
|
|
205
|
+
id: "customer-info-field-dialog-field-new-option"
|
|
206
|
+
})
|
|
207
|
+
]),
|
|
208
|
+
_: 1
|
|
209
|
+
}, 8, ["modelValue"])
|
|
210
|
+
])) : S("", !0),
|
|
211
|
+
l("div", De, [
|
|
212
|
+
t(ee, {
|
|
213
|
+
id: "customer-info-field-dialog-field-required",
|
|
214
|
+
modelValue: r.required,
|
|
215
|
+
"onUpdate:modelValue": e[5] || (e[5] = (i) => r.required = i)
|
|
216
|
+
}, null, 8, ["modelValue"]),
|
|
217
|
+
t($, {
|
|
218
|
+
for: "customer-info-field-dialog-field-required",
|
|
219
|
+
class: "text-base font-normal cursor-pointer"
|
|
220
|
+
}, {
|
|
221
|
+
default: n(() => [...e[13] || (e[13] = [
|
|
222
|
+
u(" Is this field mandatory? ", -1)
|
|
223
|
+
])]),
|
|
224
|
+
_: 1
|
|
225
|
+
})
|
|
226
|
+
]),
|
|
227
|
+
N.value.length > 0 ? (m(), g("p", Ve, [
|
|
228
|
+
(m(!0), g(A, null, M(N.value, (i, ae) => (m(), g("span", {
|
|
229
|
+
key: ae,
|
|
230
|
+
class: "text-sm text-red-600 block"
|
|
231
|
+
}, w(i), 1))), 128))
|
|
232
|
+
])) : S("", !0)
|
|
233
|
+
]),
|
|
234
|
+
t(te, { class: "gap-2" }, {
|
|
235
|
+
default: n(() => [
|
|
236
|
+
l("div", Te, [
|
|
237
|
+
b.value === "edit" && !r.isNativeField ? (m(), I(V, {
|
|
238
|
+
key: 0,
|
|
239
|
+
variant: "destructive",
|
|
240
|
+
onClick: Y
|
|
241
|
+
}, {
|
|
242
|
+
default: n(() => [...e[14] || (e[14] = [
|
|
243
|
+
u(" Remove Field ", -1)
|
|
244
|
+
])]),
|
|
245
|
+
_: 1
|
|
246
|
+
})) : S("", !0),
|
|
247
|
+
l("div", Ne, [
|
|
248
|
+
t(V, {
|
|
249
|
+
variant: "outline",
|
|
250
|
+
onClick: H
|
|
251
|
+
}, {
|
|
252
|
+
default: n(() => [...e[15] || (e[15] = [
|
|
253
|
+
u(" Cancel ", -1)
|
|
254
|
+
])]),
|
|
255
|
+
_: 1
|
|
256
|
+
}),
|
|
257
|
+
b.value === "add" ? (m(), I(V, {
|
|
258
|
+
key: 0,
|
|
259
|
+
onClick: K
|
|
260
|
+
}, {
|
|
261
|
+
default: n(() => [...e[16] || (e[16] = [
|
|
262
|
+
u(" Add Field ", -1)
|
|
263
|
+
])]),
|
|
264
|
+
_: 1
|
|
265
|
+
})) : (m(), I(V, {
|
|
266
|
+
key: 1,
|
|
267
|
+
onClick: G
|
|
268
|
+
}, {
|
|
269
|
+
default: n(() => [...e[17] || (e[17] = [
|
|
270
|
+
u(" Update Field ", -1)
|
|
271
|
+
])]),
|
|
272
|
+
_: 1
|
|
273
|
+
}))
|
|
274
|
+
])
|
|
275
|
+
])
|
|
276
|
+
]),
|
|
277
|
+
_: 1
|
|
278
|
+
})
|
|
279
|
+
]),
|
|
280
|
+
_: 1
|
|
281
|
+
})
|
|
282
|
+
]),
|
|
283
|
+
_: 1
|
|
284
|
+
}, 8, ["open"]);
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
}), Ue = { class: "space-y-6 py-4" }, Ae = { class: "text-xs text-muted-foreground" }, ze = { class: "flex items-center justify-between rounded-md border p-3" }, Me = { class: "min-w-0" }, Pe = { class: "rounded-md border p-4 space-y-4" }, Le = { class: "flex items-center justify-between gap-4" }, Re = { class: "flex items-center gap-3 min-w-0" }, Be = { class: "size-9 rounded-md bg-primary/10 flex items-center justify-center shrink-0" }, Oe = { class: "min-w-0" }, Ee = {
|
|
288
|
+
key: 0,
|
|
289
|
+
class: "flex items-center justify-between gap-3 border-t pt-4"
|
|
290
|
+
}, je = { class: "grid grid-cols-2 gap-4" }, qe = {
|
|
291
|
+
key: 0,
|
|
292
|
+
class: "grid gap-2"
|
|
293
|
+
}, He = { class: "w-full flex justify-between items-center" }, Ke = { class: "flex items-center gap-2 ml-auto" }, Ge = /* @__PURE__ */ ie({
|
|
294
|
+
__name: "MetadataSchemaEditorDialog",
|
|
295
|
+
emits: ["add-field", "update-field", "remove-field"],
|
|
296
|
+
setup(Q, { expose: P, emit: q }) {
|
|
297
|
+
const z = q, h = C(!1), T = C("add"), o = se({
|
|
298
|
+
id: "",
|
|
299
|
+
key: "",
|
|
300
|
+
label: "",
|
|
301
|
+
display: "field",
|
|
302
|
+
scope: "order",
|
|
303
|
+
includeInPdf: !1,
|
|
304
|
+
icon: "",
|
|
305
|
+
color: "",
|
|
306
|
+
order: 0,
|
|
307
|
+
action: {
|
|
308
|
+
type: "flow",
|
|
309
|
+
flow: {}
|
|
310
|
+
}
|
|
311
|
+
}), b = C(!1), p = [
|
|
312
|
+
{ value: "highlight", label: "Highlight", description: "Large prominent card — ideal for door codes, PINs" },
|
|
313
|
+
{ value: "badge", label: "Badge", description: "Colored pill in the order header — ideal for membership, VIP status" },
|
|
314
|
+
{ value: "field", label: "Field", description: "Standard label-value row in order details" },
|
|
315
|
+
{ value: "hidden", label: "Hidden", description: "Not shown in the UI — internal system fields" }
|
|
316
|
+
], r = [
|
|
317
|
+
{ value: "order", label: "Order", description: "Attached to the whole order" },
|
|
318
|
+
{ value: "reservation", label: "Reservation", description: "Attached to each individual reservation" }
|
|
319
|
+
], E = [
|
|
320
|
+
{
|
|
321
|
+
id: "value",
|
|
322
|
+
name: "value",
|
|
323
|
+
type: "string",
|
|
324
|
+
value: "Example metadata value"
|
|
325
|
+
}
|
|
326
|
+
], U = W(() => Object.keys(o.action?.flow || {}).length > 0), L = (c) => {
|
|
327
|
+
T.value = c ? "edit" : "add", k.value = [], o.id = c?.id || "", o.key = c?.key || "", o.label = c?.label || "", o.display = c?.display || "field", o.scope = c?.scope || "order", o.includeInPdf = c?.includeInPdf === !0, o.icon = c?.icon || "", o.color = c?.color || "", o.order = c?.order || 0, o.action = {
|
|
328
|
+
type: "flow",
|
|
329
|
+
flow: c?.action?.flow || {}
|
|
330
|
+
}, b.value = c?.action?.type === "flow" && Object.keys(c?.action?.flow || {}).length > 0, h.value = !0;
|
|
331
|
+
}, H = () => {
|
|
332
|
+
h.value = !1, k.value = [];
|
|
333
|
+
}, K = () => {
|
|
334
|
+
B() && (z("add-field", R()), h.value = !1);
|
|
335
|
+
}, G = () => {
|
|
336
|
+
B() && (z("update-field", R()), h.value = !1);
|
|
337
|
+
}, Y = () => {
|
|
338
|
+
z("remove-field", o.id), h.value = !1;
|
|
339
|
+
}, N = () => {
|
|
340
|
+
o.action.flow = {};
|
|
341
|
+
}, R = () => {
|
|
342
|
+
const c = {
|
|
343
|
+
id: o.id,
|
|
344
|
+
key: o.key,
|
|
345
|
+
label: o.label,
|
|
346
|
+
display: o.display,
|
|
347
|
+
scope: o.scope,
|
|
348
|
+
includeInPdf: o.includeInPdf,
|
|
349
|
+
icon: o.icon,
|
|
350
|
+
color: o.color,
|
|
351
|
+
order: o.order
|
|
352
|
+
};
|
|
353
|
+
return b.value && U.value && (c.action = {
|
|
354
|
+
type: "flow",
|
|
355
|
+
flow: o.action.flow || {}
|
|
356
|
+
}), c;
|
|
357
|
+
}, k = C([]), B = () => (k.value = [], o.key = o.key.trim(), o.label = o.label.trim(), o.key || k.value.push("Metadata key is required."), o.label || k.value.push("Display label is required."), o.key && !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o.key) && k.value.push("Key must be alphanumeric (letters, numbers, underscores)."), b.value && !U.value && k.value.push("Build a metadata action flow or turn the action off."), k.value.length === 0);
|
|
358
|
+
return P({
|
|
359
|
+
openDialog: L
|
|
360
|
+
}), (c, e) => {
|
|
361
|
+
const Z = d("DialogTitle"), J = d("DialogDescription"), $ = d("DialogHeader"), F = d("Label"), V = d("Input"), s = d("RadioGroupItem"), a = d("RadioGroup"), y = d("SelectValue"), v = d("SelectTrigger"), _ = d("SelectItem"), f = d("SelectContent"), D = d("Select"), j = d("Switch"), X = d("FlowBuilderSelect"), O = d("Button"), ee = d("LucideIconPicker"), te = d("DialogFooter"), le = d("DialogScrollContent"), oe = d("Dialog");
|
|
362
|
+
return m(), I(oe, {
|
|
363
|
+
open: h.value,
|
|
364
|
+
"onUpdate:open": e[10] || (e[10] = (i) => h.value = i)
|
|
365
|
+
}, {
|
|
366
|
+
default: n(() => [
|
|
367
|
+
t(le, { class: "sm:max-w-2xl" }, {
|
|
368
|
+
default: n(() => [
|
|
369
|
+
t($, null, {
|
|
370
|
+
default: n(() => [
|
|
371
|
+
t(Z, null, {
|
|
372
|
+
default: n(() => [
|
|
373
|
+
u(w(T.value === "add" ? "Add Metadata Field" : "Edit Metadata Field"), 1)
|
|
374
|
+
]),
|
|
375
|
+
_: 1
|
|
376
|
+
}),
|
|
377
|
+
t(J, null, {
|
|
378
|
+
default: n(() => [...e[11] || (e[11] = [
|
|
379
|
+
u(" Configure how an external metadata field is displayed on orders. ", -1)
|
|
380
|
+
])]),
|
|
381
|
+
_: 1
|
|
382
|
+
})
|
|
383
|
+
]),
|
|
384
|
+
_: 1
|
|
385
|
+
}),
|
|
386
|
+
l("div", Ue, [
|
|
387
|
+
l("div", null, [
|
|
388
|
+
t(F, {
|
|
389
|
+
class: "text-sm font-normal mb-1.5",
|
|
390
|
+
for: "metadata-field-key"
|
|
391
|
+
}, {
|
|
392
|
+
default: n(() => [...e[12] || (e[12] = [
|
|
393
|
+
u("Metadata Key", -1)
|
|
394
|
+
])]),
|
|
395
|
+
_: 1
|
|
396
|
+
}),
|
|
397
|
+
t(V, {
|
|
398
|
+
modelValue: o.key,
|
|
399
|
+
"onUpdate:modelValue": e[0] || (e[0] = (i) => o.key = i),
|
|
400
|
+
id: "metadata-field-key",
|
|
401
|
+
placeholder: "e.g. doorCode, membershipTier",
|
|
402
|
+
disabled: T.value === "edit"
|
|
403
|
+
}, null, 8, ["modelValue", "disabled"]),
|
|
404
|
+
e[13] || (e[13] = l("p", { class: "text-xs text-muted-foreground mt-1" }, " The key in the metadata object. Must match what your external system writes. ", -1))
|
|
405
|
+
]),
|
|
406
|
+
l("div", null, [
|
|
407
|
+
t(F, {
|
|
408
|
+
class: "text-sm font-normal mb-1.5",
|
|
409
|
+
for: "metadata-field-label"
|
|
410
|
+
}, {
|
|
411
|
+
default: n(() => [...e[14] || (e[14] = [
|
|
412
|
+
u("Display Label", -1)
|
|
413
|
+
])]),
|
|
414
|
+
_: 1
|
|
415
|
+
}),
|
|
416
|
+
t(V, {
|
|
417
|
+
modelValue: o.label,
|
|
418
|
+
"onUpdate:modelValue": e[1] || (e[1] = (i) => o.label = i),
|
|
419
|
+
id: "metadata-field-label",
|
|
420
|
+
placeholder: "e.g. Door Code, Membership"
|
|
421
|
+
}, null, 8, ["modelValue"])
|
|
422
|
+
]),
|
|
423
|
+
l("div", null, [
|
|
424
|
+
t(F, { class: "text-sm font-normal mb-1.5" }, {
|
|
425
|
+
default: n(() => [...e[15] || (e[15] = [
|
|
426
|
+
u("Display Mode", -1)
|
|
427
|
+
])]),
|
|
428
|
+
_: 1
|
|
429
|
+
}),
|
|
430
|
+
t(a, {
|
|
431
|
+
modelValue: o.display,
|
|
432
|
+
"onUpdate:modelValue": e[2] || (e[2] = (i) => o.display = i)
|
|
433
|
+
}, {
|
|
434
|
+
default: n(() => [
|
|
435
|
+
(m(), g(A, null, M(p, (i) => l("div", {
|
|
436
|
+
key: i.value,
|
|
437
|
+
class: "flex items-start space-x-3 space-y-0 rounded-md border p-3 mb-2"
|
|
438
|
+
}, [
|
|
439
|
+
t(s, {
|
|
440
|
+
value: i.value,
|
|
441
|
+
id: `display-${i.value}`,
|
|
442
|
+
class: "mt-0.5"
|
|
443
|
+
}, null, 8, ["value", "id"]),
|
|
444
|
+
l("div", null, [
|
|
445
|
+
t(F, {
|
|
446
|
+
for: `display-${i.value}`,
|
|
447
|
+
class: "font-medium cursor-pointer"
|
|
448
|
+
}, {
|
|
449
|
+
default: n(() => [
|
|
450
|
+
u(w(i.label), 1)
|
|
451
|
+
]),
|
|
452
|
+
_: 2
|
|
453
|
+
}, 1032, ["for"]),
|
|
454
|
+
l("p", Ae, w(i.description), 1)
|
|
455
|
+
])
|
|
456
|
+
])), 64))
|
|
457
|
+
]),
|
|
458
|
+
_: 1
|
|
459
|
+
}, 8, ["modelValue"])
|
|
460
|
+
]),
|
|
461
|
+
l("div", null, [
|
|
462
|
+
t(F, { class: "text-sm font-normal mb-1.5" }, {
|
|
463
|
+
default: n(() => [...e[16] || (e[16] = [
|
|
464
|
+
u("Scope", -1)
|
|
465
|
+
])]),
|
|
466
|
+
_: 1
|
|
467
|
+
}),
|
|
468
|
+
t(D, {
|
|
469
|
+
modelValue: o.scope,
|
|
470
|
+
"onUpdate:modelValue": e[3] || (e[3] = (i) => o.scope = i)
|
|
471
|
+
}, {
|
|
472
|
+
default: n(() => [
|
|
473
|
+
t(v, null, {
|
|
474
|
+
default: n(() => [
|
|
475
|
+
t(y, { placeholder: "Select scope" })
|
|
476
|
+
]),
|
|
477
|
+
_: 1
|
|
478
|
+
}),
|
|
479
|
+
t(f, null, {
|
|
480
|
+
default: n(() => [
|
|
481
|
+
(m(), g(A, null, M(r, (i) => t(_, {
|
|
482
|
+
key: i.value,
|
|
483
|
+
value: i.value
|
|
484
|
+
}, {
|
|
485
|
+
default: n(() => [
|
|
486
|
+
u(w(i.label) + " — " + w(i.description), 1)
|
|
487
|
+
]),
|
|
488
|
+
_: 2
|
|
489
|
+
}, 1032, ["value"])), 64))
|
|
490
|
+
]),
|
|
491
|
+
_: 1
|
|
492
|
+
})
|
|
493
|
+
]),
|
|
494
|
+
_: 1
|
|
495
|
+
}, 8, ["modelValue"])
|
|
496
|
+
]),
|
|
497
|
+
l("div", ze, [
|
|
498
|
+
l("div", Me, [
|
|
499
|
+
t(F, {
|
|
500
|
+
for: "metadata-field-include-pdf",
|
|
501
|
+
class: "font-medium cursor-pointer"
|
|
502
|
+
}, {
|
|
503
|
+
default: n(() => [...e[17] || (e[17] = [
|
|
504
|
+
u("Include in PDF", -1)
|
|
505
|
+
])]),
|
|
506
|
+
_: 1
|
|
507
|
+
})
|
|
508
|
+
]),
|
|
509
|
+
t(j, {
|
|
510
|
+
id: "metadata-field-include-pdf",
|
|
511
|
+
modelValue: o.includeInPdf,
|
|
512
|
+
"onUpdate:modelValue": e[4] || (e[4] = (i) => o.includeInPdf = i)
|
|
513
|
+
}, null, 8, ["modelValue"])
|
|
514
|
+
]),
|
|
515
|
+
l("div", Pe, [
|
|
516
|
+
l("div", Le, [
|
|
517
|
+
l("div", Re, [
|
|
518
|
+
l("div", Be, [
|
|
519
|
+
t(x(ue), { class: "size-4 text-primary" })
|
|
520
|
+
]),
|
|
521
|
+
l("div", Oe, [
|
|
522
|
+
t(F, {
|
|
523
|
+
for: "metadata-field-action",
|
|
524
|
+
class: "font-medium cursor-pointer"
|
|
525
|
+
}, {
|
|
526
|
+
default: n(() => [...e[18] || (e[18] = [
|
|
527
|
+
u("Action", -1)
|
|
528
|
+
])]),
|
|
529
|
+
_: 1
|
|
530
|
+
}),
|
|
531
|
+
e[19] || (e[19] = l("p", { class: "text-xs text-muted-foreground" }, "Run a flow from this metadata value.", -1))
|
|
532
|
+
])
|
|
533
|
+
]),
|
|
534
|
+
t(j, {
|
|
535
|
+
id: "metadata-field-action",
|
|
536
|
+
modelValue: b.value,
|
|
537
|
+
"onUpdate:modelValue": e[5] || (e[5] = (i) => b.value = i)
|
|
538
|
+
}, null, 8, ["modelValue"])
|
|
539
|
+
]),
|
|
540
|
+
b.value ? (m(), g("div", Ee, [
|
|
541
|
+
t(X, {
|
|
542
|
+
modelValue: o.action.flow,
|
|
543
|
+
"onUpdate:modelValue": e[6] || (e[6] = (i) => o.action.flow = i),
|
|
544
|
+
variables: E,
|
|
545
|
+
"button-variant": "outline"
|
|
546
|
+
}, null, 8, ["modelValue"]),
|
|
547
|
+
t(O, {
|
|
548
|
+
variant: "outline",
|
|
549
|
+
size: "sm",
|
|
550
|
+
disabled: !U.value,
|
|
551
|
+
onClick: N
|
|
552
|
+
}, {
|
|
553
|
+
default: n(() => [
|
|
554
|
+
t(x(ne), { class: "size-4" }),
|
|
555
|
+
e[20] || (e[20] = u(" Remove Flow ", -1))
|
|
556
|
+
]),
|
|
557
|
+
_: 1
|
|
558
|
+
}, 8, ["disabled"])
|
|
559
|
+
])) : S("", !0)
|
|
560
|
+
]),
|
|
561
|
+
l("div", je, [
|
|
562
|
+
l("div", null, [
|
|
563
|
+
t(F, {
|
|
564
|
+
class: "text-sm font-normal mb-1.5",
|
|
565
|
+
for: "metadata-field-icon"
|
|
566
|
+
}, {
|
|
567
|
+
default: n(() => [...e[21] || (e[21] = [
|
|
568
|
+
u("Icon (Optional)", -1)
|
|
569
|
+
])]),
|
|
570
|
+
_: 1
|
|
571
|
+
}),
|
|
572
|
+
t(ee, {
|
|
573
|
+
id: "metadata-field-icon",
|
|
574
|
+
modelValue: o.icon,
|
|
575
|
+
"onUpdate:modelValue": e[7] || (e[7] = (i) => o.icon = i)
|
|
576
|
+
}, null, 8, ["modelValue"])
|
|
577
|
+
]),
|
|
578
|
+
l("div", null, [
|
|
579
|
+
t(F, {
|
|
580
|
+
class: "text-sm font-normal mb-1.5",
|
|
581
|
+
for: "metadata-field-color"
|
|
582
|
+
}, {
|
|
583
|
+
default: n(() => [...e[22] || (e[22] = [
|
|
584
|
+
u("Color (Optional)", -1)
|
|
585
|
+
])]),
|
|
586
|
+
_: 1
|
|
587
|
+
}),
|
|
588
|
+
t(V, {
|
|
589
|
+
modelValue: o.color,
|
|
590
|
+
"onUpdate:modelValue": e[8] || (e[8] = (i) => o.color = i),
|
|
591
|
+
id: "metadata-field-color",
|
|
592
|
+
placeholder: "e.g. #FFD700"
|
|
593
|
+
}, null, 8, ["modelValue"])
|
|
594
|
+
])
|
|
595
|
+
]),
|
|
596
|
+
l("div", null, [
|
|
597
|
+
t(F, {
|
|
598
|
+
class: "text-sm font-normal mb-1.5",
|
|
599
|
+
for: "metadata-field-order"
|
|
600
|
+
}, {
|
|
601
|
+
default: n(() => [...e[23] || (e[23] = [
|
|
602
|
+
u("Sort Order (Optional)", -1)
|
|
603
|
+
])]),
|
|
604
|
+
_: 1
|
|
605
|
+
}),
|
|
606
|
+
t(V, {
|
|
607
|
+
modelValue: o.order,
|
|
608
|
+
"onUpdate:modelValue": e[9] || (e[9] = (i) => o.order = i),
|
|
609
|
+
modelModifiers: { number: !0 },
|
|
610
|
+
id: "metadata-field-order",
|
|
611
|
+
type: "number",
|
|
612
|
+
placeholder: "0",
|
|
613
|
+
class: "max-w-24"
|
|
614
|
+
}, null, 8, ["modelValue"]),
|
|
615
|
+
e[24] || (e[24] = l("p", { class: "text-xs text-muted-foreground mt-1" }, "Lower numbers appear first.", -1))
|
|
616
|
+
]),
|
|
617
|
+
k.value.length > 0 ? (m(), g("p", qe, [
|
|
618
|
+
(m(!0), g(A, null, M(k.value, (i, ae) => (m(), g("span", {
|
|
619
|
+
key: ae,
|
|
620
|
+
class: "text-sm text-red-600 block"
|
|
621
|
+
}, w(i), 1))), 128))
|
|
622
|
+
])) : S("", !0)
|
|
623
|
+
]),
|
|
624
|
+
t(te, { class: "gap-2" }, {
|
|
625
|
+
default: n(() => [
|
|
626
|
+
l("div", He, [
|
|
627
|
+
T.value === "edit" ? (m(), I(O, {
|
|
628
|
+
key: 0,
|
|
629
|
+
variant: "destructive",
|
|
630
|
+
onClick: Y
|
|
631
|
+
}, {
|
|
632
|
+
default: n(() => [...e[25] || (e[25] = [
|
|
633
|
+
u(" Remove Field ", -1)
|
|
634
|
+
])]),
|
|
635
|
+
_: 1
|
|
636
|
+
})) : S("", !0),
|
|
637
|
+
l("div", Ke, [
|
|
638
|
+
t(O, {
|
|
639
|
+
variant: "outline",
|
|
640
|
+
onClick: H
|
|
641
|
+
}, {
|
|
642
|
+
default: n(() => [...e[26] || (e[26] = [
|
|
643
|
+
u("Cancel", -1)
|
|
644
|
+
])]),
|
|
645
|
+
_: 1
|
|
646
|
+
}),
|
|
647
|
+
T.value === "add" ? (m(), I(O, {
|
|
648
|
+
key: 0,
|
|
649
|
+
onClick: K
|
|
650
|
+
}, {
|
|
651
|
+
default: n(() => [...e[27] || (e[27] = [
|
|
652
|
+
u("Add Field", -1)
|
|
653
|
+
])]),
|
|
654
|
+
_: 1
|
|
655
|
+
})) : (m(), I(O, {
|
|
656
|
+
key: 1,
|
|
657
|
+
onClick: G
|
|
658
|
+
}, {
|
|
659
|
+
default: n(() => [...e[28] || (e[28] = [
|
|
660
|
+
u("Update Field", -1)
|
|
661
|
+
])]),
|
|
662
|
+
_: 1
|
|
663
|
+
}))
|
|
664
|
+
])
|
|
665
|
+
])
|
|
666
|
+
]),
|
|
667
|
+
_: 1
|
|
668
|
+
})
|
|
669
|
+
]),
|
|
670
|
+
_: 1
|
|
671
|
+
})
|
|
672
|
+
]),
|
|
673
|
+
_: 1
|
|
674
|
+
}, 8, ["open"]);
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
}), Ye = { key: 0 }, Ze = {
|
|
678
|
+
key: 0,
|
|
679
|
+
class: "max-w-2xl"
|
|
680
|
+
}, Je = { class: "border rounded-md p-4 mb-4" }, We = { class: "font-medium text-sm" }, Qe = { class: "flex items-center justify-between gap-4 mt-4" }, Xe = { class: "border rounded-md p-4 mb-4" }, et = {
|
|
681
|
+
key: 0,
|
|
682
|
+
class: "text-sm text-muted-foreground py-4 text-center"
|
|
683
|
+
}, tt = { class: "flex items-center gap-3 min-w-0" }, lt = { class: "min-w-0" }, ot = { class: "font-medium text-sm" }, at = { class: "text-xs text-muted-foreground" }, nt = { class: "bg-muted px-1 py-0.5 rounded text-xs" }, it = { class: "inline-flex items-center gap-1" }, st = { class: "flex items-center gap-3 shrink-0" }, dt = { class: "flex items-center gap-2" }, rt = { class: "flex justify-start mt-8" }, ut = { key: 1 }, vt = /* @__PURE__ */ ie({
|
|
684
|
+
__name: "booking-data",
|
|
685
|
+
setup(Q) {
|
|
686
|
+
const { params: P } = ye(), { hasPermission: q } = be(), { confirm: z } = me(), { config: h } = _e(), T = xe(h.project), o = ke(), b = [
|
|
687
|
+
{
|
|
688
|
+
id: "firstName",
|
|
689
|
+
fieldName: "First Name",
|
|
690
|
+
fieldType: "text",
|
|
691
|
+
required: !0,
|
|
692
|
+
visible: !0,
|
|
693
|
+
isNativeField: !0
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
id: "lastName",
|
|
697
|
+
fieldName: "Last Name",
|
|
698
|
+
fieldType: "text",
|
|
699
|
+
required: !0,
|
|
700
|
+
visible: !0,
|
|
701
|
+
isNativeField: !0
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
id: "phone",
|
|
705
|
+
fieldName: "Phone No",
|
|
706
|
+
fieldType: "tel",
|
|
707
|
+
required: !0,
|
|
708
|
+
visible: !0,
|
|
709
|
+
isNativeField: !0
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
id: "email",
|
|
713
|
+
fieldName: "Email",
|
|
714
|
+
fieldType: "email",
|
|
715
|
+
required: !0,
|
|
716
|
+
visible: !0,
|
|
717
|
+
isNativeField: !0
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
id: "birthDate",
|
|
721
|
+
fieldName: "Birth date",
|
|
722
|
+
fieldType: "date",
|
|
723
|
+
required: !0,
|
|
724
|
+
visible: !0,
|
|
725
|
+
isNativeField: !0
|
|
726
|
+
}
|
|
727
|
+
], p = se({
|
|
728
|
+
customerInformationFields: [...b],
|
|
729
|
+
metadataSchema: []
|
|
730
|
+
}), r = C(!1), E = C(!0), U = C(null), L = C(null), H = W(() => {
|
|
731
|
+
if (p.customerInformationFields.length !== b.length) return !0;
|
|
732
|
+
const s = (y) => JSON.stringify({ ...y }, Object.keys(y).sort()), a = new Set(p.customerInformationFields.map(s));
|
|
733
|
+
return b.some((y) => !a.has(s(y)));
|
|
734
|
+
}), K = () => {
|
|
735
|
+
p.customerInformationFields = [...b];
|
|
736
|
+
}, G = (s) => {
|
|
737
|
+
const { isNativeField: a, options: y, ...v } = s;
|
|
738
|
+
v.fieldType !== "radio" && v.fieldType !== "select" ? delete v.options : v.options = y;
|
|
739
|
+
let _ = v.id;
|
|
740
|
+
if (!_ || p.customerInformationFields.some((f) => f.id === _))
|
|
741
|
+
for (_ = Math.random().toString(36).substr(2, 9); p.customerInformationFields.some((f) => f.id === _); )
|
|
742
|
+
_ = Math.random().toString(36).substr(2, 9);
|
|
743
|
+
p.customerInformationFields.push({ ...v, id: _ });
|
|
744
|
+
}, Y = (s, a) => {
|
|
745
|
+
const { isNativeField: y, options: v, ..._ } = a;
|
|
746
|
+
y && (_.isNativeField = !0), (_.fieldType === "radio" || _.fieldType === "select") && (_.options = v);
|
|
747
|
+
const f = p.customerInformationFields.findIndex((D) => D.id === s);
|
|
748
|
+
f !== -1 && (p.customerInformationFields[f] = { ..._ });
|
|
749
|
+
}, N = async (s) => {
|
|
750
|
+
p.customerInformationFields = p.customerInformationFields.filter((a) => a.id !== s);
|
|
751
|
+
}, R = (s) => {
|
|
752
|
+
let a = Math.random().toString(36).substr(2, 9);
|
|
753
|
+
for (; p.metadataSchema.find((y) => y.id === a); )
|
|
754
|
+
a = Math.random().toString(36).substr(2, 9);
|
|
755
|
+
p.metadataSchema.push({ ...s, id: a });
|
|
756
|
+
}, k = (s) => {
|
|
757
|
+
const a = p.metadataSchema.findIndex((y) => y.id === s.id);
|
|
758
|
+
a !== -1 && (p.metadataSchema[a] = { ...s });
|
|
759
|
+
}, B = (s) => {
|
|
760
|
+
p.metadataSchema = p.metadataSchema.filter((a) => a.id !== s);
|
|
761
|
+
}, c = (s, a) => {
|
|
762
|
+
const y = p.metadataSchema.find((v) => v.id === s);
|
|
763
|
+
y && (y.includeInPdf = a);
|
|
764
|
+
}, e = W(() => [...p.metadataSchema].sort((s, a) => (s.order || 0) - (a.order || 0))), Z = (s) => {
|
|
765
|
+
switch (s) {
|
|
766
|
+
case "highlight":
|
|
767
|
+
return "Highlight";
|
|
768
|
+
case "badge":
|
|
769
|
+
return "Badge";
|
|
770
|
+
case "field":
|
|
771
|
+
return "Field";
|
|
772
|
+
case "hidden":
|
|
773
|
+
return "Hidden";
|
|
774
|
+
default:
|
|
775
|
+
return s;
|
|
776
|
+
}
|
|
777
|
+
}, J = (s) => s === "order" ? "Order" : "Reservation", $ = (s) => Object.keys(s.action?.flow || {}).length > 0, F = async () => {
|
|
778
|
+
r.value = !0;
|
|
779
|
+
try {
|
|
780
|
+
const s = P.value.id;
|
|
781
|
+
if (!s) throw new Error("Missing agenda ID");
|
|
782
|
+
await Promise.all([
|
|
783
|
+
T.update(h.agendaCollection, s, {
|
|
784
|
+
customerInformationFields: p.customerInformationFields ?? []
|
|
785
|
+
}),
|
|
786
|
+
o.patch(`/agendas/${s}/metadata-schema`, {
|
|
787
|
+
body: {
|
|
788
|
+
metadataSchema: p.metadataSchema ?? []
|
|
789
|
+
}
|
|
790
|
+
})
|
|
791
|
+
]);
|
|
792
|
+
} catch (s) {
|
|
793
|
+
console.error("Error saving changes:", s);
|
|
794
|
+
} finally {
|
|
795
|
+
r.value = !1;
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
return (async () => {
|
|
799
|
+
try {
|
|
800
|
+
const s = await T.get(h.agendaCollection, P.value.id);
|
|
801
|
+
s && (p.customerInformationFields = s.customerInformationFields || [...b]);
|
|
802
|
+
} catch (s) {
|
|
803
|
+
console.error("Error loading agenda data:", s);
|
|
804
|
+
}
|
|
805
|
+
try {
|
|
806
|
+
const s = await o.get(`/agendas/${P.value.id}/metadata-schema`);
|
|
807
|
+
p.metadataSchema = s?.metadataSchema || [];
|
|
808
|
+
} catch (s) {
|
|
809
|
+
console.error("Error loading metadata schema:", s);
|
|
810
|
+
} finally {
|
|
811
|
+
E.value = !1;
|
|
812
|
+
}
|
|
813
|
+
})(), (s, a) => {
|
|
814
|
+
const y = d("Label"), v = d("Button"), _ = d("Switch");
|
|
815
|
+
return m(), I(ce, null, {
|
|
816
|
+
default: n(() => [
|
|
817
|
+
x(q)("manage-booking-data") ? (m(), g("div", Ye, [
|
|
818
|
+
a[15] || (a[15] = l("h1", { class: "text-lg font-medium mb-2" }, "Booking Data", -1)),
|
|
819
|
+
a[16] || (a[16] = l("p", { class: "text-sm text-muted-foreground mb-8" }, "Customer form fields & order metadata", -1)),
|
|
820
|
+
E.value ? S("", !0) : (m(), g("div", Ze, [
|
|
821
|
+
l("div", null, [
|
|
822
|
+
t(y, { class: "text-base font-medium" }, {
|
|
823
|
+
default: n(() => [...a[2] || (a[2] = [
|
|
824
|
+
u(" Customer Information ", -1)
|
|
825
|
+
])]),
|
|
826
|
+
_: 1
|
|
827
|
+
}),
|
|
828
|
+
a[5] || (a[5] = l("p", { class: "text-sm text-muted-foreground mb-2" }, " Fields the customer fills in when booking. ", -1)),
|
|
829
|
+
l("div", Je, [
|
|
830
|
+
(m(!0), g(A, null, M(p.customerInformationFields, (f) => (m(), g("div", {
|
|
831
|
+
key: f.id,
|
|
832
|
+
class: "flex items-center justify-between hover:bg-input/50 px-2 rounded"
|
|
833
|
+
}, [
|
|
834
|
+
l("div", null, [
|
|
835
|
+
l("p", We, w(f.fieldName), 1)
|
|
836
|
+
]),
|
|
837
|
+
l("div", null, [
|
|
838
|
+
t(v, {
|
|
839
|
+
variant: "ghost",
|
|
840
|
+
size: "icon",
|
|
841
|
+
onClick: (D) => U.value.openDialog(f),
|
|
842
|
+
class: "active:scale-90 transition-transform duration-150"
|
|
843
|
+
}, {
|
|
844
|
+
default: n(() => [
|
|
845
|
+
t(x(de), { class: "size-4" })
|
|
846
|
+
]),
|
|
847
|
+
_: 1
|
|
848
|
+
}, 8, ["onClick"]),
|
|
849
|
+
t(v, {
|
|
850
|
+
variant: "ghost",
|
|
851
|
+
size: "icon",
|
|
852
|
+
onClick: (D) => f.visible = !f.visible,
|
|
853
|
+
class: "active:scale-90 transition-transform duration-150"
|
|
854
|
+
}, {
|
|
855
|
+
default: n(() => [
|
|
856
|
+
f.visible ? (m(), I(x(ve), {
|
|
857
|
+
key: 0,
|
|
858
|
+
class: "size-4"
|
|
859
|
+
})) : (m(), I(x(ge), {
|
|
860
|
+
key: 1,
|
|
861
|
+
class: "size-4"
|
|
862
|
+
}))
|
|
863
|
+
]),
|
|
864
|
+
_: 2
|
|
865
|
+
}, 1032, ["onClick"]),
|
|
866
|
+
t(v, {
|
|
867
|
+
variant: "ghost",
|
|
868
|
+
size: "icon",
|
|
869
|
+
disabled: f.isNativeField,
|
|
870
|
+
onClick: (D) => p.customerInformationFields = p.customerInformationFields.filter((j) => j.id !== f.id),
|
|
871
|
+
class: "active:scale-90 transition-transform duration-150"
|
|
872
|
+
}, {
|
|
873
|
+
default: n(() => [
|
|
874
|
+
t(x(ne), { class: "size-4" })
|
|
875
|
+
]),
|
|
876
|
+
_: 1
|
|
877
|
+
}, 8, ["disabled", "onClick"])
|
|
878
|
+
])
|
|
879
|
+
]))), 128)),
|
|
880
|
+
l("div", Qe, [
|
|
881
|
+
t(v, {
|
|
882
|
+
size: "sm",
|
|
883
|
+
onClick: a[0] || (a[0] = (f) => U.value.openDialog())
|
|
884
|
+
}, {
|
|
885
|
+
default: n(() => [
|
|
886
|
+
t(x(re), { class: "size-4" }),
|
|
887
|
+
a[3] || (a[3] = u(" Add New Field ", -1))
|
|
888
|
+
]),
|
|
889
|
+
_: 1
|
|
890
|
+
}),
|
|
891
|
+
x(H) ? (m(), I(v, {
|
|
892
|
+
key: 0,
|
|
893
|
+
size: "sm",
|
|
894
|
+
variant: "outline",
|
|
895
|
+
onClick: K
|
|
896
|
+
}, {
|
|
897
|
+
default: n(() => [...a[4] || (a[4] = [
|
|
898
|
+
u(" Reset to Default ", -1)
|
|
899
|
+
])]),
|
|
900
|
+
_: 1
|
|
901
|
+
})) : S("", !0)
|
|
902
|
+
])
|
|
903
|
+
]),
|
|
904
|
+
t($e, {
|
|
905
|
+
ref_key: "customerInfoFieldDialog",
|
|
906
|
+
ref: U,
|
|
907
|
+
keysInUse: p.customerInformationFields.map((f) => f.id),
|
|
908
|
+
onAddField: G,
|
|
909
|
+
onUpdateField: Y,
|
|
910
|
+
onRemoveField: N
|
|
911
|
+
}, null, 8, ["keysInUse"])
|
|
912
|
+
]),
|
|
913
|
+
a[14] || (a[14] = l("hr", { class: "my-8" }, null, -1)),
|
|
914
|
+
l("div", null, [
|
|
915
|
+
t(y, { class: "text-base font-medium" }, {
|
|
916
|
+
default: n(() => [...a[6] || (a[6] = [
|
|
917
|
+
u(" Order Metadata ", -1)
|
|
918
|
+
])]),
|
|
919
|
+
_: 1
|
|
920
|
+
}),
|
|
921
|
+
a[13] || (a[13] = l("p", { class: "text-sm text-muted-foreground mb-2" }, " Configure how externally-attached data is displayed on orders. Your external systems (Cloud Functions, webhooks, API) write metadata to orders — this controls how it appears in the dashboard. ", -1)),
|
|
922
|
+
l("div", Xe, [
|
|
923
|
+
x(e).length === 0 ? (m(), g("div", et, " No metadata fields configured yet. ")) : S("", !0),
|
|
924
|
+
(m(!0), g(A, null, M(x(e), (f) => (m(), g("div", {
|
|
925
|
+
key: f.id,
|
|
926
|
+
class: "flex items-center justify-between hover:bg-input/50 px-2 py-1 rounded"
|
|
927
|
+
}, [
|
|
928
|
+
l("div", tt, [
|
|
929
|
+
l("div", lt, [
|
|
930
|
+
l("p", ot, w(f.label), 1),
|
|
931
|
+
l("p", at, [
|
|
932
|
+
l("code", nt, w(f.key), 1),
|
|
933
|
+
a[9] || (a[9] = l("span", { class: "mx-1" }, "·", -1)),
|
|
934
|
+
l("span", null, w(Z(f.display)), 1),
|
|
935
|
+
a[10] || (a[10] = l("span", { class: "mx-1" }, "·", -1)),
|
|
936
|
+
l("span", null, w(J(f.scope)), 1),
|
|
937
|
+
$(f) ? (m(), g(A, { key: 0 }, [
|
|
938
|
+
a[8] || (a[8] = l("span", { class: "mx-1" }, "·", -1)),
|
|
939
|
+
l("span", it, [
|
|
940
|
+
t(x(ue), { class: "size-3" }),
|
|
941
|
+
a[7] || (a[7] = u(" Action ", -1))
|
|
942
|
+
])
|
|
943
|
+
], 64)) : S("", !0)
|
|
944
|
+
])
|
|
945
|
+
])
|
|
946
|
+
]),
|
|
947
|
+
l("div", st, [
|
|
948
|
+
l("div", dt, [
|
|
949
|
+
a[11] || (a[11] = l("span", { class: "text-xs text-muted-foreground" }, "PDF", -1)),
|
|
950
|
+
t(_, {
|
|
951
|
+
"model-value": f.includeInPdf === !0,
|
|
952
|
+
"aria-label": `Include ${f.label} in PDF`,
|
|
953
|
+
"onUpdate:modelValue": (D) => c(f.id, !!D)
|
|
954
|
+
}, null, 8, ["model-value", "aria-label", "onUpdate:modelValue"])
|
|
955
|
+
]),
|
|
956
|
+
t(v, {
|
|
957
|
+
variant: "ghost",
|
|
958
|
+
size: "icon",
|
|
959
|
+
onClick: (D) => L.value.openDialog(f),
|
|
960
|
+
class: "active:scale-90 transition-transform duration-150"
|
|
961
|
+
}, {
|
|
962
|
+
default: n(() => [
|
|
963
|
+
t(x(de), { class: "size-4" })
|
|
964
|
+
]),
|
|
965
|
+
_: 1
|
|
966
|
+
}, 8, ["onClick"]),
|
|
967
|
+
t(v, {
|
|
968
|
+
variant: "ghost",
|
|
969
|
+
size: "icon",
|
|
970
|
+
onClick: (D) => B(f.id),
|
|
971
|
+
class: "active:scale-90 transition-transform duration-150"
|
|
972
|
+
}, {
|
|
973
|
+
default: n(() => [
|
|
974
|
+
t(x(ne), { class: "size-4" })
|
|
975
|
+
]),
|
|
976
|
+
_: 1
|
|
977
|
+
}, 8, ["onClick"])
|
|
978
|
+
])
|
|
979
|
+
]))), 128)),
|
|
980
|
+
t(v, {
|
|
981
|
+
size: "sm",
|
|
982
|
+
class: "mt-4",
|
|
983
|
+
onClick: a[1] || (a[1] = (f) => L.value.openDialog())
|
|
984
|
+
}, {
|
|
985
|
+
default: n(() => [
|
|
986
|
+
t(x(re), { class: "size-4" }),
|
|
987
|
+
a[12] || (a[12] = u(" Add Metadata Field ", -1))
|
|
988
|
+
]),
|
|
989
|
+
_: 1
|
|
990
|
+
})
|
|
991
|
+
]),
|
|
992
|
+
t(Ge, {
|
|
993
|
+
ref_key: "metadataSchemaDialog",
|
|
994
|
+
ref: L,
|
|
995
|
+
onAddField: R,
|
|
996
|
+
onUpdateField: k,
|
|
997
|
+
onRemoveField: B
|
|
998
|
+
}, null, 512)
|
|
999
|
+
]),
|
|
1000
|
+
l("div", rt, [
|
|
1001
|
+
t(v, {
|
|
1002
|
+
onClick: F,
|
|
1003
|
+
disabled: r.value
|
|
1004
|
+
}, {
|
|
1005
|
+
default: n(() => [
|
|
1006
|
+
u(w(r.value ? "Saving..." : "Save Changes"), 1)
|
|
1007
|
+
]),
|
|
1008
|
+
_: 1
|
|
1009
|
+
}, 8, ["disabled"])
|
|
1010
|
+
])
|
|
1011
|
+
]))
|
|
1012
|
+
])) : (m(), g("div", ut, [...a[17] || (a[17] = [
|
|
1013
|
+
l("h1", { class: "text-lg font-medium mb-2" }, "Access Denied", -1),
|
|
1014
|
+
l("p", { class: "text-sm text-muted-foreground" }, "You do not have permission to view or edit booking data.", -1)
|
|
1015
|
+
])]))
|
|
1016
|
+
]),
|
|
1017
|
+
_: 1
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
export {
|
|
1023
|
+
vt as default
|
|
1024
|
+
};
|