@feedmepos/mf-hrm-portal 2.3.2-dev.10 → 2.3.2-dev.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{ApprovalCodeList-RKU5B8SO.js → ApprovalCodeList-CCh9mNJh.js} +7 -7
  2. package/dist/AuditLogList-DCADUZ5s.js +2019 -0
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-pL2zRc67.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BZQNDOg7.js} +10 -10
  4. package/dist/{EmployeeList-nrYsS5uz.js → EmployeeList-CRI7XjzX.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-7S2w36aY.js → FormSection.vue_vue_type_script_setup_true_lang-y9_hxba6.js} +1 -1
  6. package/dist/{GrantUserList-BSjeC4MC.js → GrantUserList-DbMngkpK.js} +8 -8
  7. package/dist/{Main-DbdoVLCE.js → Main-BsFUfsmP.js} +29 -29
  8. package/dist/{Main-DtmCBbTR.js → Main-CrnM6wr8.js} +2168 -2169
  9. package/dist/{Main-CpuHaXU6.js → Main-D4Zq5AXi.js} +5 -5
  10. package/dist/{MyPosProfile-CsTCfGNT.js → MyPosProfile-B4cE47im.js} +1 -1
  11. package/dist/{PermissionSetList-B1c-uGZO.js → PermissionSetList-D_2x-mDD.js} +112 -113
  12. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BM9Von-l.js +4212 -0
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-D6Z9z_Yt.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-COX-N0k6.js} +414 -448
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-TWTVo_9Y.js → RoleForm.vue_vue_type_script_setup_true_lang-D8V8KWiL.js} +41 -41
  15. package/dist/{RoleList-CwaGNsFy.js → RoleList-BC-c7fqn.js} +105 -96
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-C2ekVXdR.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DBbuSrXV.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-BVtXmxtp.js → ScheduleGeneralPage-eytzOZQr.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-DdsQ8v-5.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CP-kToVO.js} +4 -4
  19. package/dist/{SchedulePage-3qksmT2I.js → SchedulePage-B0QirzAk.js} +17 -17
  20. package/dist/{SchedulePositionPage-DAU20KPZ.js → SchedulePositionPage-BAE-NQvL.js} +3 -3
  21. package/dist/{SelectFilter-BpzBwBmQ.js → SelectFilter-DrLJhxt6.js} +1 -1
  22. package/dist/TeamMemberList-CHkiL_q9.js +2083 -0
  23. package/dist/TimesheetList-BZuddmzy.js +402 -0
  24. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-LCUO-ogb.js +58 -0
  25. package/dist/{app-DEZT4wdV.js → app-B9qAxMj1.js} +3516 -3470
  26. package/dist/app.js +1 -1
  27. package/dist/{approval-code-BZTz5OXK.js → approval-code-CTgj9q6m.js} +1 -1
  28. package/dist/{dayjs.min-B55I-uhI.js → dayjs.min-giCSI3N8.js} +22 -22
  29. package/dist/employee-BD3NXG8h.js +210 -0
  30. package/dist/{grant-user-B2rYztyf.js → grant-user-jeTFzGU1.js} +1 -1
  31. package/dist/{index-Bfdseotz.js → iteration-Tyg43nH0.js} +726 -698
  32. package/dist/{lodash-B8bqa6a9.js → lodash-CZsDR_DU.js} +1 -1
  33. package/dist/{member-grant-BIpKkuu8.js → member-grant-DsEMLN1N.js} +2 -2
  34. package/dist/restaurant-CDJ3VjdH.js +49 -0
  35. package/dist/role-BDRWt87n.js +91 -0
  36. package/dist/{rule-Ccopk8R_.js → rule-EiO87cJJ.js} +309 -313
  37. package/dist/src/api/employee/index.d.ts +2 -1
  38. package/dist/src/api/timesheet/index.d.ts +1 -1
  39. package/dist/src/composables/useTenant.d.ts +11 -0
  40. package/dist/src/router/courtGuard.d.ts +4 -0
  41. package/dist/src/stores/employee.d.ts +7 -1
  42. package/dist/src/stores/restaurant.d.ts +1 -61
  43. package/dist/src/stores/team.d.ts +1 -1
  44. package/dist/src/stores/timesheet.d.ts +51 -66
  45. package/dist/src/types/timesheet.d.ts +0 -3
  46. package/dist/style.css +1 -1
  47. package/dist/tsconfig.app.tsbuildinfo +1 -1
  48. package/dist/{useAppStore-DfqsbhT2.js → useAppStore-CkUZ2H5h.js} +1 -1
  49. package/dist/{useLoading-CQnX5WjI.js → useLoading-DJHJM5E0.js} +1 -1
  50. package/dist/useReportPermissions-2dfIX21b.js +80 -0
  51. package/dist/useSsoProviders-BarGHndw.js +41 -0
  52. package/package.json +2 -2
  53. package/dist/AuditLogList-DuDCMjGR.js +0 -2026
  54. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Toq6qrLx.js +0 -4208
  55. package/dist/TeamMemberList-Bdpm40i3.js +0 -2087
  56. package/dist/TimesheetList-CL_eJp2h.js +0 -437
  57. package/dist/employee-C6z5i6O4.js +0 -172
  58. package/dist/iteration-CcXrOMQe.js +0 -30
  59. package/dist/restaurant-ejyX2jEG.js +0 -52
  60. package/dist/role-C_t3DDlG.js +0 -98
  61. package/dist/timesheet-CZHcebqS.js +0 -76
  62. package/dist/useReportPermissions-kTjftFk7.js +0 -82
@@ -1,2087 +0,0 @@
1
- import { defineComponent as oe, mergeModels as Qt, useModel as es, createElementBlock as R, openBlock as m, Fragment as de, renderList as Vt, normalizeClass as lt, toDisplayString as E, unref as s, computed as I, resolveComponent as G, createElementVNode as p, createBlock as q, createCommentVNode as T, createVNode as i, ref as c, watch as ue, onUnmounted as Pt, createSlots as vt, withCtx as te, renderSlot as ts, withModifiers as Mt, nextTick as Rt, h as ss, createTextVNode as as } from "vue";
2
- import { useI18n as ce, useCoreStore as Xe } from "@feedmepos/mf-common";
3
- import { useSnackbar as ot, useDialog as Ft, useBreakpoints as $t, components as Qe, SnackbarPosition as et } from "@feedmepos/ui-library";
4
- import { u as ls } from "./useDebounce-B8ZPVS5C.js";
5
- import { S as ie } from "./SelectFilter-BpzBwBmQ.js";
6
- import { g as be, b as ye, a as Ct, v as ft, k as os, _ as rs, c as ns } from "./app-DEZT4wdV.js";
7
- import { _ as bt } from "./ResponsiveContextMenu.vue_vue_type_script_setup_true_lang-mSJFKo7r.js";
8
- import { _ as is } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
9
- import { s as us, _ as ms, d as ds, e as cs } from "./PasscodePinField.vue_vue_type_script_setup_true_lang-TXPEqa46.js";
10
- import { u as Dt } from "./useLoading-CQnX5WjI.js";
11
- import { u as ps } from "./useDiscardConfirm-CzZSPyvh.js";
12
- import { w as vs, h as fs, b as bs, E as ys, t as gs } from "./member-grant-BIpKkuu8.js";
13
- import { a as Ye, i as rt, t as Me, b as He, D as Nt, E as Et, h as Te, u as hs, s as yt, c as ze, d as xs, e as gt } from "./PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-D6Z9z_Yt.js";
14
- import { n as nt } from "./string-DZQ1uNjn.js";
15
- import "./index-Bfdseotz.js";
16
- import { l as Le } from "./lodash-B8bqa6a9.js";
17
- import { _ as ht } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Toq6qrLx.js";
18
- import { t as Ve, u as At, P as tt, H as xt, R as st, a as Ot, p as _t, $ as _s, b as Ut, c as Us } from "./rule-Ccopk8R_.js";
19
- import { t as Is, s as ws, a as It, c as ks, r as Ss, b as Vs, d as wt, _ as Ps, p as Ms } from "./RoleForm.vue_vue_type_script_setup_true_lang-TWTVo_9Y.js";
20
- import { c as Pe } from "./iteration-CcXrOMQe.js";
21
- import { u as Lt } from "./restaurant-ejyX2jEG.js";
22
- import { u as Tt } from "./role-C_t3DDlG.js";
23
- var Ee = /* @__PURE__ */ ((l) => (l.Update = "Update", l.Remove = "Remove", l))(Ee || {});
24
- const Be = "__unassigned__";
25
- function kt(l) {
26
- if (!(l != null && l.length) || l[0] === Be) return l;
27
- const A = l.filter((v) => v !== Be);
28
- return A.length === l.length ? l : [Be, ...A];
29
- }
30
- const Rs = {
31
- role: "tablist",
32
- class: "flex w-full max-w-[361px] items-center gap-4 rounded-[12px] bg-fm-color-neutral-gray-100 p-4"
33
- }, Fs = ["aria-selected", "disabled", "onClick"], $s = /* @__PURE__ */ oe({
34
- __name: "SegmentedTabs",
35
- props: /* @__PURE__ */ Qt({
36
- items: {},
37
- disabled: { type: Boolean }
38
- }, {
39
- modelValue: { required: !0 },
40
- modelModifiers: {}
41
- }),
42
- emits: ["update:modelValue"],
43
- setup(l) {
44
- const A = es(l, "modelValue");
45
- return (v, t) => (m(), R("div", Rs, [
46
- (m(!0), R(de, null, Vt(l.items, (f) => (m(), R("button", {
47
- key: f.value,
48
- type: "button",
49
- role: "tab",
50
- "aria-selected": A.value === f.value,
51
- disabled: l.disabled,
52
- class: lt([
53
- "flex-1 rounded-[8px] px-12 py-8 text-center text-[16px] leading-[24px] tracking-[0.04px] transition-colors disabled:cursor-not-allowed",
54
- A.value === f.value ? "border border-fm-color-neutral-gray-100 bg-fm-color-neutral-white font-semibold text-fm-color-typo-primary shadow-[0px_1px_2px_0px_rgba(28,28,30,0.04)]" : "border border-transparent font-medium text-fm-color-typo-tertiary hover:bg-fm-color-opacity-sm"
55
- ]),
56
- onClick: (u) => A.value = f.value
57
- }, E(f.label), 11, Fs))), 128))
58
- ]));
59
- }
60
- }), it = /* @__PURE__ */ oe({
61
- __name: "MemberStatusBadge",
62
- props: {
63
- status: {}
64
- },
65
- setup(l) {
66
- const { t: A } = ce();
67
- return (v, t) => (m(), R("span", {
68
- class: lt([
69
- "inline-flex items-center rounded-[4px] px-4 py-[2px] text-[10px] font-medium leading-[14px] tracking-[0.2px] whitespace-nowrap",
70
- l.status === "active" ? "bg-fm-color-system-success-100 text-fm-color-typo-success" : "bg-fm-color-system-warning-100 text-fm-color-typo-warning"
71
- ])
72
- }, E(s(A)(`team.status.${l.status}`)), 3));
73
- }
74
- }), Cs = {
75
- class: "flex items-center gap-12 rounded-[16px] border border-[#995900] bg-fm-color-system-warning-100 p-16",
76
- role: "alert",
77
- "data-testid": "existing-member-notice"
78
- }, Ds = { class: "flex size-[56px] shrink-0 items-center justify-center rounded-full bg-fm-color-primary fm-typo-en-body-lg-600 text-fm-color-typo-white" }, Ns = { class: "flex min-w-0 flex-1 flex-col gap-[2px]" }, Es = { class: "flex items-center gap-8" }, As = { class: "truncate text-[16px] font-semibold leading-[24px] text-fm-color-typo-primary" }, Os = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ls = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary" }, Ts = /* @__PURE__ */ oe({
79
- __name: "ExistingMemberNotice",
80
- props: {
81
- existing: {},
82
- match: {}
83
- },
84
- emits: ["update"],
85
- setup(l, { emit: A }) {
86
- const v = l, t = A, { t: f } = ce(), u = I(() => v.existing.kind === "member" ? "active" : "invited"), $ = I(
87
- () => v.existing.restaurantCount === 1 ? f("team.existingMember.restaurantCount.one") : f("team.existingMember.restaurantCount.other", { count: v.existing.restaurantCount })
88
- ), K = I(() => v.existing.kind !== "member" || !v.existing.isOwner);
89
- return (M, O) => {
90
- const k = G("FmButton");
91
- return m(), R("div", Cs, [
92
- p("div", Ds, E(s(nt)(l.existing.name)), 1),
93
- p("div", Ns, [
94
- p("div", Es, [
95
- p("p", As, E(l.existing.name), 1),
96
- i(it, { status: u.value }, null, 8, ["status"])
97
- ]),
98
- p("p", Os, E(s(f)(`team.existingMember.alreadyUses.${l.match}`, { restaurants: $.value })), 1),
99
- p("p", Ls, E(K.value ? s(f)("team.existingMember.updateInstead") : s(f)("team.existingMember.isOwner")), 1)
100
- ]),
101
- K.value ? (m(), q(k, {
102
- key: 0,
103
- label: s(f)("team.existingMember.updateAccess"),
104
- size: "md",
105
- variant: "primary",
106
- class: "shrink-0",
107
- onClick: O[0] || (O[0] = (P) => t("update"))
108
- }, null, 8, ["label"])) : T("", !0)
109
- ]);
110
- };
111
- }
112
- }), Ae = {
113
- async readInvites(l = "pending") {
114
- return be(
115
- await ye("staff-invites").get("", { params: { status: l } })
116
- );
117
- },
118
- async lookup(l, A) {
119
- return be(
120
- await ye("staff-invites").get("/lookup", {
121
- params: { ...l, provider: A }
122
- })
123
- ) || null;
124
- },
125
- async createInvite(l) {
126
- return be(await ye("staff-invites").post("", l));
127
- },
128
- async updateInvite(l, A) {
129
- return be(await ye("staff-invites").put(`/${l}`, A));
130
- },
131
- async revokeInvite(l) {
132
- return be(await ye("staff-invites").delete(`/${l}`));
133
- },
134
- async resendInvite(l) {
135
- return be(await ye("staff-invites").post(`/${l}/resend`));
136
- }
137
- }, Bs = {
138
- class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-300 bg-fm-color-neutral-white p-16",
139
- "data-testid": "member-details-card"
140
- }, js = { class: "flex flex-col gap-8" }, qs = { class: "fm-typo-en-title-sm-600" }, Gs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ks = { class: "flex flex-col gap-[6px]" }, Ws = { class: "fm-typo-en-body-sm-600" }, zs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Hs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Xs = { class: "grid grid-cols-2 gap-[14px] xs:grid-cols-1" }, Ys = { class: "grid grid-cols-2 gap-[14px] xs:grid-cols-1" }, Js = 400, Zs = /* @__PURE__ */ oe({
141
- __name: "MemberDetailsCard",
142
- props: {
143
- providers: {
144
- type: Array,
145
- required: !0
146
- }
147
- },
148
- emits: ["update-existing"],
149
- setup(l, { expose: A, emit: v }) {
150
- var ne, Q;
151
- const t = l, f = v, { t: u } = ce(), $ = Xe(), { supportedCountries: K, ready: M } = Ye(), O = I(() => {
152
- var o;
153
- const D = (o = $.currentCountry.value) == null ? void 0 : o.toUpperCase();
154
- return D && rt(D) ? D : void 0;
155
- }), k = c(((ne = t.providers[0]) == null ? void 0 : ne.slug) ?? ""), P = I(() => t.providers.find((D) => D.slug === k.value)), _ = I(() => {
156
- var D;
157
- return ((D = P.value) == null ? void 0 : D.label) ?? "";
158
- }), H = I(
159
- () => t.providers.map((D) => ({ label: D.label, value: D.slug }))
160
- ), C = c(((Q = P.value) == null ? void 0 : Q.inviteMatch) ?? "mobile"), V = c(""), B = c(""), y = c(""), d = c(""), h = I(() => [
161
- { label: u("team.memberDetails.phoneNumber"), value: "mobile" },
162
- { label: u("team.memberDetails.emailAddress"), value: "email" }
163
- ]), b = I(() => {
164
- if (C.value === "mobile") {
165
- const D = Me(V.value);
166
- return D ? { mobile: D } : null;
167
- }
168
- return He(B.value) ? { email: B.value.trim().toLowerCase() } : null;
169
- }), r = c(null);
170
- let U, j = 0;
171
- ue(
172
- [b, k],
173
- ([D]) => {
174
- clearTimeout(U);
175
- const o = ++j;
176
- r.value = null, D && (U = setTimeout(async () => {
177
- try {
178
- const S = await Ae.lookup(D, k.value || void 0);
179
- o === j && (r.value = S);
180
- } catch {
181
- }
182
- }, Js));
183
- },
184
- { deep: !0 }
185
- ), Pt(() => clearTimeout(U));
186
- function W() {
187
- const D = Te(V.value) ? Me(V.value) ?? "" : "", o = B.value.trim().toLowerCase();
188
- return {
189
- provider: k.value,
190
- match: C.value,
191
- ...C.value === "mobile" ? { mobile: Me(V.value) ?? "", ...o ? { email: o } : {} } : { email: o, ...D ? { mobile: D } : {} },
192
- displayName: y.value.trim(),
193
- ...d.value.trim() ? { employeeId: d.value.trim() } : {}
194
- };
195
- }
196
- function re() {
197
- return Te(V.value) || !!B.value.trim() || !!y.value.trim() || !!d.value.trim();
198
- }
199
- return A({
200
- readDetails: W,
201
- isModified: re,
202
- /** Add is blocked while the key belongs to someone already. */
203
- hasExisting: I(() => !!r.value),
204
- providerLabel: _
205
- }), (D, o) => {
206
- const S = G("FmSelect"), z = G("FmPhoneNumber"), se = G("FmCircularProgress"), X = G("FmTextField");
207
- return m(), R("div", Bs, [
208
- p("div", js, [
209
- p("p", qs, E(s(u)("team.memberDetails.title")), 1),
210
- p("p", Gs, E(s(u)("team.memberDetails.ssoNotice", { label: _.value })), 1)
211
- ]),
212
- l.providers.length > 1 ? (m(), q(S, {
213
- key: 0,
214
- modelValue: k.value,
215
- "onUpdate:modelValue": o[0] || (o[0] = (x) => k.value = x),
216
- label: s(u)("team.memberDetails.provider"),
217
- items: H.value
218
- }, null, 8, ["modelValue", "label", "items"])) : T("", !0),
219
- p("div", Ks, [
220
- p("p", Ws, E(s(u)("team.memberDetails.signInUsing")), 1),
221
- i($s, {
222
- modelValue: C.value,
223
- "onUpdate:modelValue": o[1] || (o[1] = (x) => C.value = x),
224
- items: h.value
225
- }, null, 8, ["modelValue", "items"])
226
- ]),
227
- C.value === "mobile" ? (m(), R(de, { key: 1 }, [
228
- s(M) ? (m(), q(z, {
229
- key: 0,
230
- modelValue: V.value,
231
- "onUpdate:modelValue": o[2] || (o[2] = (x) => V.value = x),
232
- label: s(u)("team.memberDetails.phoneNumber"),
233
- "default-country": O.value,
234
- "extra-country-codes": s(K),
235
- rules: [(x) => !!s(Me)(x) || s(u)("team.memberDetails.errors.mobileInvalid")]
236
- }, vt({ _: 2 }, [
237
- b.value ? {
238
- name: "helper-text",
239
- fn: te(() => [
240
- p("span", zs, E(s(u)("team.memberDetails.signInHint.mobile", { label: _.value })), 1)
241
- ]),
242
- key: "0"
243
- } : void 0
244
- ]), 1032, ["modelValue", "label", "default-country", "extra-country-codes", "rules"])) : (m(), q(se, { key: 1 }))
245
- ], 64)) : (m(), q(X, {
246
- key: 2,
247
- modelValue: B.value,
248
- "onUpdate:modelValue": o[3] || (o[3] = (x) => B.value = x),
249
- label: s(u)("team.memberDetails.emailAddress"),
250
- placeholder: s(u)("team.memberDetails.emailPlaceholder"),
251
- rules: [(x) => s(He)(x) || s(u)("team.memberDetails.errors.emailInvalid")]
252
- }, vt({ _: 2 }, [
253
- b.value ? {
254
- name: "helper-text",
255
- fn: te(() => [
256
- p("span", Hs, E(s(u)("team.memberDetails.signInHint.email", { label: _.value })), 1)
257
- ]),
258
- key: "0"
259
- } : void 0
260
- ]), 1032, ["modelValue", "label", "placeholder", "rules"])),
261
- r.value ? (m(), q(Ts, {
262
- key: 3,
263
- existing: r.value,
264
- match: C.value,
265
- onUpdate: o[4] || (o[4] = (x) => f("update-existing", r.value))
266
- }, null, 8, ["existing", "match"])) : T("", !0),
267
- p("div", Xs, [
268
- i(X, {
269
- modelValue: y.value,
270
- "onUpdate:modelValue": o[5] || (o[5] = (x) => y.value = x),
271
- label: s(u)("team.memberDetails.name"),
272
- placeholder: s(u)("team.memberDetails.namePlaceholder"),
273
- rules: [
274
- (x) => !!x.trim() || s(u)("team.memberDetails.errors.nameRequired"),
275
- (x) => x.trim().length <= s(Nt) || s(u)("team.memberDetails.errors.nameTooLong")
276
- ]
277
- }, null, 8, ["modelValue", "label", "placeholder", "rules"]),
278
- i(X, {
279
- modelValue: d.value,
280
- "onUpdate:modelValue": o[6] || (o[6] = (x) => d.value = x),
281
- label: s(u)("team.memberDetails.employeeId"),
282
- "label-mark": "optional",
283
- placeholder: s(u)("team.memberDetails.employeeIdPlaceholder"),
284
- rules: [
285
- (x) => x.trim().length <= s(Et) || s(u)("team.memberDetails.errors.employeeIdTooLong")
286
- ]
287
- }, null, 8, ["modelValue", "label", "placeholder", "rules"])
288
- ]),
289
- p("div", Ys, [
290
- C.value === "mobile" ? (m(), q(X, {
291
- key: 0,
292
- modelValue: B.value,
293
- "onUpdate:modelValue": o[7] || (o[7] = (x) => B.value = x),
294
- label: s(u)("team.memberDetails.emailAddress"),
295
- "label-mark": "optional",
296
- placeholder: s(u)("team.memberDetails.emailPlaceholder"),
297
- rules: [
298
- (x) => !x.trim() || s(He)(x) || s(u)("team.memberDetails.errors.emailInvalid")
299
- ]
300
- }, null, 8, ["modelValue", "label", "placeholder", "rules"])) : (m(), R(de, { key: 1 }, [
301
- s(M) ? (m(), q(z, {
302
- key: 0,
303
- modelValue: V.value,
304
- "onUpdate:modelValue": o[8] || (o[8] = (x) => V.value = x),
305
- label: s(u)("team.memberDetails.phoneNumber"),
306
- "label-mark": "optional",
307
- "default-country": O.value,
308
- "extra-country-codes": s(K),
309
- rules: [
310
- (x) => !s(Te)(x) || !!s(Me)(x) || s(u)("team.memberDetails.errors.mobileInvalid")
311
- ]
312
- }, null, 8, ["modelValue", "label", "default-country", "extra-country-codes", "rules"])) : T("", !0)
313
- ], 64))
314
- ])
315
- ]);
316
- };
317
- }
318
- }), Qs = {
319
- class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-200 px-24 py-16",
320
- "data-testid": "member-header-card"
321
- }, ea = { class: "flex items-center gap-16" }, ta = { class: "flex size-[56px] shrink-0 items-center justify-center rounded-full bg-fm-color-primary fm-typo-en-body-lg-600 text-fm-color-typo-white" }, sa = { class: "flex min-w-0 flex-1 flex-col" }, aa = { class: "flex items-center gap-8" }, la = { class: "truncate text-[16px] font-semibold leading-[24px] text-fm-color-typo-primary" }, oa = {
322
- key: 0,
323
- class: "truncate fm-typo-en-body-md-400 text-fm-color-typo-secondary"
324
- }, ra = {
325
- key: 1,
326
- class: "truncate fm-typo-en-body-md-400 text-fm-color-typo-secondary"
327
- }, na = /* @__PURE__ */ oe({
328
- __name: "MemberHeaderCard",
329
- props: {
330
- name: {},
331
- status: {},
332
- email: {},
333
- phoneNumber: {}
334
- },
335
- setup(l) {
336
- const A = l, v = I(() => nt(A.name));
337
- return (t, f) => (m(), R("div", Qs, [
338
- p("div", ea, [
339
- p("div", ta, E(v.value), 1),
340
- p("div", sa, [
341
- p("div", aa, [
342
- p("p", la, E(l.name), 1),
343
- i(it, { status: l.status }, null, 8, ["status"])
344
- ]),
345
- l.email ? (m(), R("p", oa, E(l.email), 1)) : T("", !0),
346
- l.phoneNumber ? (m(), R("p", ra, E(l.phoneNumber), 1)) : T("", !0)
347
- ])
348
- ]),
349
- ts(t.$slots, "default")
350
- ]));
351
- }
352
- }), ia = { class: "flex flex-col gap-12" }, ua = { class: "grid grid-cols-2 gap-x-[14px]" }, ma = { class: "fm-typo-en-body-lg-600" }, da = { class: "fm-typo-en-body-lg-600" }, ca = ["onClick"], pa = ["disabled"], va = /* @__PURE__ */ oe({
353
- __name: "PosAssignmentRows",
354
- props: {
355
- modelValue: {
356
- type: Array,
357
- required: !0
358
- },
359
- restaurants: {
360
- type: Array,
361
- required: !0
362
- },
363
- roles: {
364
- type: Array,
365
- required: !0
366
- },
367
- isRoleUsable: {
368
- type: Function,
369
- required: !0
370
- }
371
- },
372
- emits: ["update:modelValue"],
373
- setup(l, { emit: A }) {
374
- const v = l, t = A, { t: f } = ce(), u = c($(v.modelValue));
375
- function $(d) {
376
- const h = Is(d);
377
- return h.length > 0 ? h : [{ restaurantIds: [], roleId: "" }];
378
- }
379
- ue(
380
- () => v.modelValue,
381
- (d) => {
382
- ws(d, It(u.value)) || (u.value = $(d));
383
- },
384
- { deep: !0 }
385
- );
386
- function K(d) {
387
- u.value = d, t("update:modelValue", It(d));
388
- }
389
- function M(d, h) {
390
- const b = u.value.map((r, U) => {
391
- if (U !== d) return r;
392
- const j = { ...r, restaurantIds: h };
393
- return { ...j, roleId: Ms(v.roles, j, v.isRoleUsable) };
394
- });
395
- K(b);
396
- }
397
- function O(d, h) {
398
- K(u.value.map((b, r) => r === d ? { ...b, roleId: h } : b));
399
- }
400
- function k() {
401
- K([...u.value, { restaurantIds: [], roleId: "" }]);
402
- }
403
- function P(d, h) {
404
- var b;
405
- h || u.value.length < 2 || (b = u.value[d]) != null && b.restaurantIds.length || K(u.value.filter((r, U) => U !== d));
406
- }
407
- const _ = I(() => ks(v.restaurants, u.value)), H = c(), C = c(!1), V = c(null);
408
- async function B(d) {
409
- var h;
410
- V.value = d, C.value = !0, await Rt(), (h = H.value) == null || h.trigger();
411
- }
412
- function y(d) {
413
- const h = V.value;
414
- V.value = null;
415
- const b = h === null ? void 0 : u.value[h];
416
- if (h === null || !b) return;
417
- wt(v.roles, b, v.isRoleUsable).some(
418
- (U) => U.value === d && !U.disabled
419
- ) && O(h, d);
420
- }
421
- return (d, h) => {
422
- var r;
423
- const b = G("FmSelect");
424
- return m(), R("div", ia, [
425
- p("div", ua, [
426
- p("p", ma, E(s(f)("team.posAccess.restaurants")), 1),
427
- p("p", da, E(s(f)("team.posAccess.posRole")), 1)
428
- ]),
429
- (m(!0), R(de, null, Vt(u.value, (U, j) => (m(), R("div", {
430
- key: j,
431
- class: "grid grid-cols-2 items-center gap-x-[14px]",
432
- "data-testid": "pos-assignment-row"
433
- }, [
434
- i(b, {
435
- class: lt(["min-w-0 pos-restaurant-select", { "pos-restaurant-select--filled": U.restaurantIds.length > 0 }]),
436
- "model-value": U.restaurantIds,
437
- items: s(Vs)(l.restaurants, u.value, j),
438
- multiselect: "",
439
- searchable: "",
440
- "hide-chips": "",
441
- "search-debounce": 300,
442
- placeholder: s(Ss)(l.restaurants, U) || s(f)("team.posAccess.selectRestaurants"),
443
- "onUpdate:modelValue": (W) => M(j, W),
444
- onDropdownChanged: (W) => P(j, W)
445
- }, null, 8, ["class", "model-value", "items", "placeholder", "onUpdate:modelValue", "onDropdownChanged"]),
446
- i(b, {
447
- class: "min-w-0",
448
- "model-value": U.roleId,
449
- items: s(wt)(l.roles, U, l.isRoleUsable),
450
- placeholder: s(f)("team.posAccess.selectRole"),
451
- disabled: U.restaurantIds.length === 0,
452
- "onUpdate:modelValue": (W) => O(j, W)
453
- }, {
454
- "append-menu": te(() => [
455
- p("button", {
456
- type: "button",
457
- class: "w-full px-12 py-8 text-left text-[12px] font-semibold text-fm-color-primary",
458
- "data-testid": "create-pos-role",
459
- onClick: (W) => B(j)
460
- }, " + " + E(s(f)("team.posAccess.createRole")), 9, ca)
461
- ]),
462
- _: 2
463
- }, 1032, ["model-value", "items", "placeholder", "disabled", "onUpdate:modelValue"])
464
- ]))), 128)),
465
- p("button", {
466
- type: "button",
467
- class: "self-start fm-typo-en-body-md-600 text-fm-color-primary disabled:cursor-not-allowed disabled:text-fm-color-typo-disabled",
468
- disabled: !_.value,
469
- "data-testid": "add-pos-row",
470
- onClick: Mt(k, ["stop"])
471
- }, " + " + E(s(f)("team.posAccess.addRestaurant")), 9, pa),
472
- C.value ? (m(), q(Ps, {
473
- key: 0,
474
- ref_key: "roleFormRef",
475
- ref: H,
476
- "show-back": "",
477
- "restaurant-ids": V.value === null ? [] : ((r = u.value[V.value]) == null ? void 0 : r.restaurantIds) ?? [],
478
- onCreated: y
479
- }, null, 8, ["restaurant-ids"])) : T("", !0)
480
- ]);
481
- };
482
- }
483
- }), fa = /* @__PURE__ */ Ct(va, [["__scopeId", "data-v-26c32ae0"]]), ba = {
484
- class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-300 bg-fm-color-neutral-white p-16",
485
- "data-testid": "pos-access-card"
486
- }, ya = { class: "flex items-center gap-8" }, ga = { class: "flex flex-1 flex-col gap-8" }, ha = { class: "fm-typo-en-title-sm-600" }, xa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _a = {
487
- key: 0,
488
- class: "flex flex-col gap-24"
489
- }, Ua = { class: "flex flex-col gap-12" }, Ia = { class: "fm-typo-en-body-lg-600" }, wa = { class: "flex flex-col items-start gap-16" }, at = 4, ka = /* @__PURE__ */ oe({
490
- __name: "TeamMemberMasterUser",
491
- props: {
492
- modelValue: {
493
- type: Object,
494
- default: void 0
495
- },
496
- fallbackName: {
497
- type: String,
498
- required: !0
499
- },
500
- fallbackPasscode: {
501
- type: String,
502
- default: void 0
503
- },
504
- restaurants: {
505
- type: Array,
506
- required: !0
507
- },
508
- roles: {
509
- type: Array,
510
- required: !0
511
- },
512
- usableRoleIds: {
513
- type: Array,
514
- default: null
515
- },
516
- posUserId: {
517
- type: String,
518
- default: void 0
519
- }
520
- },
521
- emits: ["update:model-value"],
522
- setup(l, { emit: A }) {
523
- const v = l, t = A, { t: f } = ce(), u = ot(), $ = Dt(u), K = c(!1), M = c([]), O = I(() => {
524
- var y;
525
- return us(((y = v.modelValue) == null ? void 0 : y.roles) ?? []);
526
- });
527
- function k(y) {
528
- return v.usableRoleIds === null || v.usableRoleIds.includes(y._id);
529
- }
530
- function P(y) {
531
- y ? v.modelValue || t("update:model-value", {
532
- code: "",
533
- name: v.fallbackName,
534
- roles: [],
535
- passcode: v.fallbackPasscode || ""
536
- }) : t("update:model-value", null);
537
- }
538
- function _(y, d) {
539
- if (!v.modelValue || y === "passcode" && v.modelValue.passcode === d) return;
540
- const h = Pe(v.modelValue);
541
- h[y] = d, t("update:model-value", h);
542
- }
543
- const H = c(!1), C = I(() => O.value.length > 0);
544
- async function V() {
545
- if (C.value)
546
- try {
547
- const y = await $.custom(
548
- () => Ve.generateMasterUserPasscode({
549
- restaurantIds: O.value,
550
- excludePosUserId: v.posUserId
551
- }),
552
- { isLoading: H }
553
- );
554
- K.value = !1, M.value = y.split(""), _("passcode", y);
555
- } catch {
556
- }
557
- }
558
- ue(
559
- () => {
560
- var y;
561
- return (y = v.modelValue) == null ? void 0 : y.passcode;
562
- },
563
- (y) => {
564
- const d = M.value.join("");
565
- y !== d && (y && y.length === at ? (M.value = y.split(""), K.value = !0) : (M.value = [], K.value = !1));
566
- },
567
- { immediate: !0 }
568
- );
569
- const B = I({
570
- get: () => {
571
- var y;
572
- return ((y = v.modelValue) == null ? void 0 : y.roles) ?? [];
573
- },
574
- set: () => {
575
- }
576
- });
577
- return (y, d) => {
578
- const h = G("FmSwitch"), b = G("FmFormGroup");
579
- return m(), R("div", ba, [
580
- p("div", ya, [
581
- p("div", ga, [
582
- p("p", ha, E(s(f)("team.posAccess.title")), 1),
583
- p("p", xa, E(s(f)("team.posAccess.subtitle")), 1)
584
- ]),
585
- i(h, {
586
- "model-value": !!l.modelValue,
587
- value: "master-user",
588
- "onUpdate:modelValue": P
589
- }, null, 8, ["model-value"])
590
- ]),
591
- l.modelValue ? (m(), R("div", _a, [
592
- i(b, {
593
- modelValue: B.value,
594
- "onUpdate:modelValue": d[1] || (d[1] = (r) => B.value = r),
595
- tag: "div",
596
- rules: [
597
- (r) => !r || r.length === 0 ? s(f)("team.memberForm.masterUser.restaurantRequired") : r.some((U) => !U.roleId) ? s(f)("team.memberForm.masterUser.roleRequired") : !0
598
- ]
599
- }, {
600
- default: te(() => [
601
- i(fa, {
602
- "model-value": l.modelValue.roles,
603
- restaurants: l.restaurants,
604
- roles: l.roles,
605
- "is-role-usable": k,
606
- "onUpdate:modelValue": d[0] || (d[0] = (r) => _("roles", r))
607
- }, null, 8, ["model-value", "restaurants", "roles"])
608
- ]),
609
- _: 1
610
- }, 8, ["modelValue", "rules"]),
611
- p("div", Ua, [
612
- p("p", Ia, E(s(f)("team.posAccess.passcode")), 1),
613
- p("div", wa, [
614
- i(b, {
615
- modelValue: M.value,
616
- "onUpdate:modelValue": d[5] || (d[5] = (r) => M.value = r),
617
- rules: [
618
- (r) => (r == null ? void 0 : r.filter((U) => !!U).length) !== at ? s(f)("team.memberForm.masterUser.passcodeRequired") : !0
619
- ]
620
- }, {
621
- default: te(() => [
622
- i(ms, {
623
- modelValue: M.value,
624
- "onUpdate:modelValue": d[2] || (d[2] = (r) => M.value = r),
625
- masked: K.value,
626
- "onUpdate:masked": d[3] || (d[3] = (r) => K.value = r),
627
- length: at,
628
- "toggle-label": s(f)("team.memberForm.masterUser.passcodeToggleVisibility"),
629
- onComplete: d[4] || (d[4] = (r) => _("passcode", r))
630
- }, null, 8, ["modelValue", "masked", "toggle-label"])
631
- ]),
632
- _: 1
633
- }, 8, ["modelValue", "rules"]),
634
- i(ds, {
635
- label: s(f)("team.memberForm.masterUser.passcodeGenerate"),
636
- hint: s(f)("team.memberForm.masterUser.passcodeSelectOutletFirst"),
637
- loading: H.value,
638
- disabled: !C.value,
639
- onClick: V
640
- }, null, 8, ["label", "hint", "loading", "disabled"])
641
- ])
642
- ])
643
- ])) : T("", !0)
644
- ]);
645
- };
646
- }
647
- }), Sa = { class: "flex flex-col gap-24" }, Va = {
648
- key: 0,
649
- class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-200 p-16",
650
- "data-testid": "where-they-work-card"
651
- }, Pa = { class: "flex flex-col gap-8" }, Ma = { class: "fm-typo-en-title-sm-600" }, Ra = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fa = {
652
- key: 1,
653
- class: "flex items-center justify-center py-64"
654
- }, $a = {
655
- key: 3,
656
- class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-300 p-16",
657
- "data-testid": "portal-access-card"
658
- }, Ca = { class: "flex items-center gap-8" }, Da = { class: "flex flex-1 flex-col gap-8" }, Na = { class: "fm-typo-en-title-sm-600" }, Ea = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Aa = /* @__PURE__ */ oe({
659
- __name: "MemberGrantFields",
660
- props: {
661
- initialValue: {
662
- type: Object
663
- },
664
- /** Name to fall back on when neither the saved grant nor the POS user has one. */
665
- fallbackName: {
666
- type: String,
667
- default: ""
668
- },
669
- loading: {
670
- type: Boolean,
671
- default: !1
672
- }
673
- },
674
- setup(l, { expose: A }) {
675
- var qe, ge, ee;
676
- const v = l, { t } = ce(), f = Ft(), { breakpoints: u } = $t(), $ = At(), K = I(
677
- () => $.permissionSets.value.map((n) => ({
678
- label: n.name,
679
- value: n.id
680
- }))
681
- ), M = c(((qe = v.initialValue) == null ? void 0 : qe.permissionSetIds) || []), O = I(
682
- () => tt(M.value, $.permissionSets.value)
683
- ), k = c((ge = v.initialValue) == null ? void 0 : ge.posUser), P = c(
684
- xt(
685
- st(O.value),
686
- ((ee = v.initialValue) == null ? void 0 : ee.permissions) || []
687
- )
688
- ), { customReportPermissions: _, isLoaded: H } = Ot(), C = new Set(
689
- _t.filter((n) => n.subject.startsWith(_s)).map((n) => n.subject)
690
- ), V = I(() => {
691
- const n = new Set(C);
692
- for (const F of _.value) n.add(F.subject);
693
- return n;
694
- }), B = I(() => {
695
- const n = /* @__PURE__ */ new Set();
696
- for (const F of _t)
697
- F.category === ft.reports && n.add(F.subject);
698
- for (const F of _.value)
699
- F.category === ft.reports && n.add(F.subject);
700
- return n;
701
- }), y = I(() => {
702
- var n;
703
- return !!((n = v.initialValue) != null && n.isOwner);
704
- }), d = I(
705
- () => Ut(P.value, { isOwner: y.value })
706
- ), h = Lt(), b = Tt().roles, r = I(() => {
707
- const n = d.value.restaurantIds;
708
- return n === null ? h.restaurants.value : h.restaurants.value.filter((F) => n.includes(F._id));
709
- }), U = c(!1);
710
- function j(n) {
711
- U.value = n, !n && (M.value = [], P.value = vs(P.value));
712
- }
713
- const W = c({ permissionSetIds: [], userPermissions: [], posUser: void 0 });
714
- function re(n) {
715
- M.value = [...(n == null ? void 0 : n.permissionSetIds) ?? []], P.value = xt(
716
- st(
717
- tt(
718
- M.value,
719
- $.permissionSets.value
720
- )
721
- ),
722
- (n == null ? void 0 : n.permissions) || []
723
- ), k.value = n != null && n.posUser ? X(Pe(n.posUser), P.value) : void 0, x.value = !!k.value, U.value = fs(P.value, M.value), W.value = {
724
- permissionSetIds: [...M.value],
725
- userPermissions: Pe(P.value),
726
- posUser: k.value ? Pe(k.value) : void 0
727
- };
728
- }
729
- function ne() {
730
- return !Le.isEqual(M.value, W.value.permissionSetIds) || !Le.isEqual(P.value, W.value.userPermissions) || !Le.isEqual(k.value, W.value.posUser);
731
- }
732
- function Q(n) {
733
- k.value = X(k.value, n);
734
- }
735
- function D(n) {
736
- return st(
737
- tt(n, $.permissionSets.value)
738
- );
739
- }
740
- function o(n) {
741
- P.value = D(n);
742
- }
743
- function S(n) {
744
- const F = [...n ?? []];
745
- if (Le.isEqual(F, M.value)) return;
746
- const J = !Le.isEqual(
747
- P.value,
748
- D(M.value)
749
- );
750
- if (M.value = F, !J) {
751
- o(F);
752
- return;
753
- }
754
- f.open({
755
- title: t("permissionSet.form.overrideInherited.title"),
756
- message: t("permissionSet.form.overrideInherited.message"),
757
- minWidth: u.value.lg ? 588 : 0,
758
- primaryActions: {
759
- text: t("permissionSet.form.overrideInherited.override"),
760
- close: !1
761
- },
762
- secondaryActions: {
763
- text: t("permissionSet.form.overrideInherited.keepCurrent"),
764
- close: !0
765
- }
766
- }).onPrimary(() => {
767
- o(F), f.close();
768
- });
769
- }
770
- function z() {
771
- var n, F;
772
- return bs({
773
- userPermissions: P.value,
774
- inheritedPermissions: O.value,
775
- permissionSetIds: M.value,
776
- posUser: k.value,
777
- reportSubjects: H.value ? V.value : C,
778
- defaultReportSubjects: B.value,
779
- savedPosUser: (n = v.initialValue) == null ? void 0 : n.posUser,
780
- fallbackName: ((F = v.initialValue) == null ? void 0 : F.name) || v.fallbackName
781
- });
782
- }
783
- const se = c();
784
- function X(n, F) {
785
- if (!n) return n;
786
- const J = Ut(F, { isOwner: y.value }), { roleIds: pe, restaurantIds: he } = J;
787
- if (pe === null && he === null) return n;
788
- const ve = Pe(n);
789
- return ve.roles = ve.roles.filter(
790
- (Z) => (pe === null || pe.includes(Z.roleId)) && (he === null || he.includes(Z.restaurantId))
791
- ), ve;
792
- }
793
- const x = c(!!k.value), N = c(!1);
794
- function je(n) {
795
- k.value = n, N.value = !0;
796
- }
797
- return ue(
798
- () => !!k.value,
799
- async (n) => {
800
- n && !x.value && N.value && (await Rt(), se.value && se.value.$el.scrollIntoView({ behavior: "smooth", block: "start" })), x.value = n;
801
- }
802
- ), ue(
803
- () => v.initialValue,
804
- (n, F) => {
805
- if (!F || !n || F.id !== n.id) {
806
- N.value = !1, re(n);
807
- return;
808
- }
809
- n.posUser !== void 0 && !N.value && (k.value = n.posUser ? X(Pe(n.posUser), P.value) : void 0, W.value = {
810
- ...W.value,
811
- posUser: k.value ? Pe(k.value) : void 0
812
- });
813
- },
814
- { immediate: !0 }
815
- ), ue(
816
- P,
817
- (n) => {
818
- k.value = X(k.value, n);
819
- },
820
- { deep: !0 }
821
- ), A({
822
- readGrantData: z,
823
- isModified: ne
824
- }), (n, F) => {
825
- var ve, Z, xe, Re, Fe, Ge;
826
- const J = G("FmCircularProgress"), pe = G("FmSwitch"), he = G("FmSelect");
827
- return m(), R("div", Sa, [
828
- (ve = l.initialValue) != null && ve.isOwner ? T("", !0) : (m(), R("section", Va, [
829
- p("div", Pa, [
830
- p("p", Ma, E(s(t)("team.whereTheyWork.title")), 1),
831
- p("p", Ra, E(s(t)("team.whereTheyWork.subtitle")), 1)
832
- ]),
833
- i(ht, {
834
- modelValue: P.value,
835
- "onUpdate:modelValue": F[0] || (F[0] = (_e) => P.value = _e),
836
- part: "workplace",
837
- "inherit-permissions": O.value,
838
- onPermissionChanged: Q
839
- }, null, 8, ["modelValue", "inherit-permissions"])
840
- ])),
841
- l.loading ? (m(), R("div", Fa, [
842
- i(J, { size: "xl" })
843
- ])) : (m(), q(ka, {
844
- key: 2,
845
- ref_key: "masterUserContentRef",
846
- ref: se,
847
- "model-value": k.value,
848
- "fallback-name": ((Z = l.initialValue) == null ? void 0 : Z.name) || l.fallbackName,
849
- "fallback-passcode": (Re = (xe = l.initialValue) == null ? void 0 : xe.posUser) == null ? void 0 : Re.passcode,
850
- roles: s(b),
851
- "usable-role-ids": d.value.roleIds,
852
- restaurants: r.value,
853
- "pos-user-id": (Fe = l.initialValue) == null ? void 0 : Fe.posUserId,
854
- "onUpdate:modelValue": je
855
- }, null, 8, ["model-value", "fallback-name", "fallback-passcode", "roles", "usable-role-ids", "restaurants", "pos-user-id"])),
856
- (Ge = l.initialValue) != null && Ge.isOwner ? T("", !0) : (m(), R("section", $a, [
857
- p("div", Ca, [
858
- p("div", Da, [
859
- p("p", Na, E(s(t)("team.portalAccess.title")), 1),
860
- p("p", Ea, E(s(t)("team.portalAccess.subtitle")), 1)
861
- ]),
862
- i(pe, {
863
- "model-value": U.value,
864
- value: "portal-access",
865
- "onUpdate:modelValue": j
866
- }, null, 8, ["model-value"])
867
- ]),
868
- U.value ? (m(), R(de, { key: 0 }, [
869
- i(he, {
870
- "model-value": M.value,
871
- multiselect: "",
872
- searchable: "",
873
- "search-debounce": 300,
874
- label: s(t)("team.memberForm.permissionSet.title"),
875
- items: K.value,
876
- placeholder: s(t)("team.memberForm.permissionSet.selectPlaceholder"),
877
- "onUpdate:modelValue": S
878
- }, null, 8, ["model-value", "label", "items", "placeholder"]),
879
- i(ht, {
880
- modelValue: P.value,
881
- "onUpdate:modelValue": F[1] || (F[1] = (_e) => P.value = _e),
882
- part: "portal",
883
- "inherit-permissions": O.value,
884
- onPermissionChanged: Q
885
- }, null, 8, ["modelValue", "inherit-permissions"])
886
- ], 64)) : T("", !0)
887
- ]))
888
- ]);
889
- };
890
- }
891
- }), St = {
892
- async readPermissionUserByPhoneNo(l) {
893
- return be(
894
- await ye().get(
895
- `/portal-users/search-by-phone/${encodeURIComponent(l)}`
896
- )
897
- );
898
- },
899
- async readPermissionUserByEmail(l) {
900
- return be(
901
- await ye().get(
902
- `/portal-users/search-by-email/${encodeURIComponent(l)}`
903
- )
904
- );
905
- }
906
- }, Oa = { class: "flex flex-col gap-24 w-full" }, La = {
907
- key: 0,
908
- class: "flex flex-col gap-8"
909
- }, Ta = { class: "user-info-icon user-info-icon--lg" }, Ba = { class: "flex-1 overflow-hidden" }, ja = { class: "profile-displayName" }, qa = { class: "profile-email" }, Ga = { class: "profile-phone" }, Ka = { key: 2 }, Wa = /* @__PURE__ */ oe({
910
- __name: "PortalUserSearcher",
911
- emits: ["invite"],
912
- setup(l, { emit: A }) {
913
- const v = A, { t } = ce(), f = ot(), u = Xe(), { supportedCountries: $, ready: K } = Ye(), M = I(() => {
914
- var r;
915
- const b = (r = u.currentCountry.value) == null ? void 0 : r.toUpperCase();
916
- return b && rt(b) ? b : void 0;
917
- }), O = c("phone"), k = c(""), P = c(""), _ = c(), H = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, C = I(() => H.test(P.value.trim()));
918
- async function V() {
919
- const b = O.value === "phone" ? k.value.replace(/ /g, "") : P.value.trim();
920
- if (!b) {
921
- f.open({
922
- type: "error",
923
- title: t("team.memberForm.searchUser.emptyError")
924
- });
925
- return;
926
- }
927
- if (O.value === "email" && !C.value) {
928
- f.open({
929
- type: "error",
930
- title: t("team.memberForm.searchUser.invalidEmail")
931
- });
932
- return;
933
- }
934
- const r = () => {
935
- _.value = void 0, f.open({
936
- type: "error",
937
- title: t("team.memberForm.searchUser.userNotFound")
938
- });
939
- };
940
- try {
941
- const U = O.value === "phone" ? await St.readPermissionUserByPhoneNo(b) : await St.readPermissionUserByEmail(b);
942
- if (!U) {
943
- r();
944
- return;
945
- }
946
- _.value = U;
947
- } catch {
948
- _.value = void 0, f.open({
949
- type: "error",
950
- title: t("team.memberForm.searchUser.searchFailed")
951
- });
952
- }
953
- }
954
- const B = I(() => {
955
- var j;
956
- let b = ((j = _.value) == null ? void 0 : j.displayName) ?? "";
957
- b || (b = "Feed Me");
958
- const [r, U] = b.split(" ");
959
- return U ? `${r[0]}${U[0]}` : r.slice(0, 2);
960
- }), y = c(!1);
961
- function d(b) {
962
- v("invite", b), y.value = !0;
963
- }
964
- function h() {
965
- y.value = !1;
966
- }
967
- return (b, r) => {
968
- var D, o, S;
969
- const U = G("FmRadio"), j = G("FmPhoneNumber"), W = G("FmCircularProgress"), re = G("FmTextField"), ne = G("FmRadioGroup"), Q = G("FmButton");
970
- return m(), R("div", Oa, [
971
- y.value ? T("", !0) : (m(), R("div", La, [
972
- i(ne, {
973
- modelValue: O.value,
974
- "onUpdate:modelValue": r[2] || (r[2] = (z) => O.value = z)
975
- }, {
976
- default: te(() => [
977
- i(U, {
978
- value: "phone",
979
- label: s(t)("team.memberForm.searchUser.phoneNumber")
980
- }, null, 8, ["label"]),
981
- O.value === "phone" && s(K) ? (m(), q(j, {
982
- key: 0,
983
- modelValue: k.value,
984
- "onUpdate:modelValue": r[0] || (r[0] = (z) => k.value = z),
985
- "default-country": M.value,
986
- "extra-country-codes": s($),
987
- class: "ml-8"
988
- }, null, 8, ["modelValue", "default-country", "extra-country-codes"])) : O.value === "phone" ? (m(), q(W, {
989
- key: 1,
990
- class: "ml-8"
991
- })) : T("", !0),
992
- i(U, {
993
- value: "email",
994
- label: s(t)("team.memberForm.searchUser.email")
995
- }, null, 8, ["label"]),
996
- O.value === "email" ? (m(), q(re, {
997
- key: 2,
998
- modelValue: P.value,
999
- "onUpdate:modelValue": r[1] || (r[1] = (z) => P.value = z),
1000
- placeholder: s(t)("team.memberForm.searchUser.emailPlaceholder"),
1001
- rules: [
1002
- (z) => !z || C.value || s(t)("team.memberForm.searchUser.invalidEmail")
1003
- ],
1004
- class: "ml-8"
1005
- }, null, 8, ["modelValue", "placeholder", "rules"])) : T("", !0)
1006
- ]),
1007
- _: 1
1008
- }, 8, ["modelValue"]),
1009
- i(Q, {
1010
- label: s(t)("team.memberForm.searchUser.search"),
1011
- variant: "secondary",
1012
- onClick: V
1013
- }, null, 8, ["label"])
1014
- ])),
1015
- _.value ? (m(), R("div", {
1016
- key: 1,
1017
- class: "profile-menu--profile cursor-pointer hover:bg-fm-color-opacity-sm",
1018
- onClick: r[3] || (r[3] = (z) => d(_.value))
1019
- }, [
1020
- p("div", Ta, E(B.value), 1),
1021
- p("div", Ba, [
1022
- p("p", ja, E((D = _.value) == null ? void 0 : D.displayName), 1),
1023
- p("p", qa, E((o = _.value) == null ? void 0 : o.email), 1),
1024
- p("p", Ga, E((S = _.value) == null ? void 0 : S.phoneNumber), 1)
1025
- ])
1026
- ])) : T("", !0),
1027
- y.value ? (m(), R("div", Ka, [
1028
- i(Q, {
1029
- label: s(t)("team.memberForm.searchUser.changeUser"),
1030
- variant: "secondary",
1031
- onClick: h
1032
- }, null, 8, ["label"])
1033
- ])) : T("", !0)
1034
- ]);
1035
- };
1036
- }
1037
- }), za = /* @__PURE__ */ Ct(Wa, [["__scopeId", "data-v-827dfd60"]]), Ha = { class: "flex flex-col gap-24" }, Xa = {
1038
- key: 1,
1039
- class: "flex w-full"
1040
- }, Ya = {
1041
- key: 0,
1042
- class: "grid grid-cols-2 gap-[14px] xs:grid-cols-1",
1043
- "data-testid": "member-edit-details"
1044
- }, Ja = /* @__PURE__ */ oe({
1045
- __name: "AddMemberForm",
1046
- props: {
1047
- initialValue: {
1048
- type: Object
1049
- },
1050
- /**
1051
- * The business's staff SSO providers. With one, Add creates the member by their SSO
1052
- * sign-in key (an invite until their first sign-in) instead of searching FeedMe users.
1053
- */
1054
- providers: {
1055
- type: Array,
1056
- default: () => []
1057
- },
1058
- roleErrorMessage: {
1059
- type: String,
1060
- default: ""
1061
- },
1062
- loading: {
1063
- type: Boolean,
1064
- default: !1
1065
- }
1066
- },
1067
- emits: ["update-existing"],
1068
- setup(l, { expose: A, emit: v }) {
1069
- const t = l, f = v, u = I(() => !t.initialValue && t.providers.length > 0), { t: $ } = ce(), K = Xe(), { supportedCountries: M, ready: O } = Ye(), k = I(() => {
1070
- var S;
1071
- const o = (S = K.currentCountry.value) == null ? void 0 : S.toUpperCase();
1072
- return o && rt(o) ? o : void 0;
1073
- }), P = I(() => {
1074
- var o;
1075
- return ((o = t.initialValue) == null ? void 0 : o.status) === "invited";
1076
- }), _ = I(() => !!t.initialValue && !t.initialValue.isOwner), H = c(""), C = c(""), V = c("");
1077
- function B(o) {
1078
- H.value = (o == null ? void 0 : o.displayName) ?? (o == null ? void 0 : o.name) ?? "", C.value = (o == null ? void 0 : o.employeeId) ?? "", V.value = (o == null ? void 0 : o.contact) ?? "";
1079
- }
1080
- B(t.initialValue);
1081
- function y() {
1082
- var S;
1083
- if (!_.value) return null;
1084
- const o = ((S = t.initialValue) == null ? void 0 : S.match) === "email" ? Te(V.value) ? Me(V.value) ?? "" : "" : V.value.trim().toLowerCase();
1085
- return {
1086
- displayName: H.value.trim(),
1087
- employeeId: C.value.trim(),
1088
- contact: o
1089
- };
1090
- }
1091
- function d() {
1092
- const o = t.initialValue;
1093
- return !o || !_.value ? !1 : C.value.trim() !== (o.employeeId ?? "") || P.value && (H.value.trim() !== (o.displayName ?? o.name) || V.value.trim() !== (o.contact ?? ""));
1094
- }
1095
- const h = c(), b = c(), r = c();
1096
- function U() {
1097
- var o, S;
1098
- return u.value && ((o = r.value) != null && o.isModified()) || d() || !t.initialValue && h.value ? !0 : ((S = b.value) == null ? void 0 : S.isModified()) ?? !1;
1099
- }
1100
- function j(o) {
1101
- h.value = o;
1102
- }
1103
- function W(o) {
1104
- return H.value === (o.displayName ?? o.name) && C.value === (o.employeeId ?? "") && V.value === (o.contact ?? "");
1105
- }
1106
- function re() {
1107
- var S, z, se, X, x;
1108
- const o = ((S = b.value) == null ? void 0 : S.readGrantData()) ?? ys;
1109
- return {
1110
- email: ((z = h.value) == null ? void 0 : z.email) ?? void 0,
1111
- phoneNumber: ((se = h.value) == null ? void 0 : se.phoneNumber) ?? void 0,
1112
- customPermissions: o.customPermissions,
1113
- permissions: o.permissions,
1114
- permissionSetIds: o.permissionSetIds,
1115
- name: ((X = h.value) == null ? void 0 : X.displayName) || ((x = t.initialValue) == null ? void 0 : x.name) || "",
1116
- posUser: o.posUser
1117
- };
1118
- }
1119
- function ne() {
1120
- var o;
1121
- return u.value ? ((o = r.value) == null ? void 0 : o.readDetails()) ?? null : null;
1122
- }
1123
- const Q = c();
1124
- async function D() {
1125
- return (await Q.value.validateInputsWithoutSubmit()).length ? null : re();
1126
- }
1127
- return ue(
1128
- () => t.initialValue,
1129
- (o, S) => {
1130
- (!S || !o || S.id !== o.id) && (h.value = void 0), (!S || !o || S.id !== o.id || W(S)) && B(o);
1131
- }
1132
- ), A({
1133
- readFormData: re,
1134
- readDetails: ne,
1135
- readEdits: y,
1136
- validate: D,
1137
- isModified: U,
1138
- /** Add stays disabled while the sign-in key belongs to someone already (AC4). */
1139
- hasExisting: I(() => {
1140
- var o;
1141
- return !!((o = r.value) != null && o.hasExisting);
1142
- }),
1143
- providerLabel: I(() => {
1144
- var o;
1145
- return ((o = r.value) == null ? void 0 : o.providerLabel) ?? "";
1146
- })
1147
- }), (o, S) => {
1148
- const z = G("FmTextField"), se = G("FmPhoneNumber"), X = G("FmForm");
1149
- return m(), q(X, {
1150
- ref_key: "formRef",
1151
- ref: Q,
1152
- class: "mx-4"
1153
- }, {
1154
- default: te(() => {
1155
- var x;
1156
- return [
1157
- p("div", Ha, [
1158
- u.value ? (m(), q(Zs, {
1159
- key: 0,
1160
- ref_key: "detailsRef",
1161
- ref: r,
1162
- providers: l.providers,
1163
- onUpdateExisting: S[0] || (S[0] = (N) => f("update-existing", N))
1164
- }, null, 8, ["providers"])) : l.initialValue ? (m(), q(na, {
1165
- key: 2,
1166
- name: l.initialValue.name,
1167
- status: l.initialValue.status ?? "active",
1168
- email: l.initialValue.email,
1169
- "phone-number": l.initialValue.phoneNumber
1170
- }, {
1171
- default: te(() => [
1172
- _.value ? (m(), R("div", Ya, [
1173
- P.value ? (m(), q(z, {
1174
- key: 0,
1175
- modelValue: H.value,
1176
- "onUpdate:modelValue": S[2] || (S[2] = (N) => H.value = N),
1177
- label: s($)("team.memberDetails.name"),
1178
- placeholder: s($)("team.memberDetails.namePlaceholder"),
1179
- rules: [
1180
- (N) => !!N.trim() || s($)("team.memberDetails.errors.nameRequired"),
1181
- (N) => N.trim().length <= s(Nt) || s($)("team.memberDetails.errors.nameTooLong")
1182
- ]
1183
- }, null, 8, ["modelValue", "label", "placeholder", "rules"])) : T("", !0),
1184
- i(z, {
1185
- modelValue: C.value,
1186
- "onUpdate:modelValue": S[3] || (S[3] = (N) => C.value = N),
1187
- label: s($)("team.memberDetails.employeeId"),
1188
- "label-mark": "optional",
1189
- placeholder: s($)("team.memberDetails.employeeIdPlaceholder"),
1190
- rules: [
1191
- (N) => N.trim().length <= s(Et) || s($)("team.memberDetails.errors.employeeIdTooLong")
1192
- ]
1193
- }, null, 8, ["modelValue", "label", "placeholder", "rules"]),
1194
- P.value ? (m(), R(de, { key: 1 }, [
1195
- l.initialValue.match === "mobile" ? (m(), q(z, {
1196
- key: 0,
1197
- modelValue: V.value,
1198
- "onUpdate:modelValue": S[4] || (S[4] = (N) => V.value = N),
1199
- label: s($)("team.memberDetails.emailAddress"),
1200
- "label-mark": "optional",
1201
- placeholder: s($)("team.memberDetails.emailPlaceholder"),
1202
- rules: [
1203
- (N) => !N.trim() || s(He)(N) || s($)("team.memberDetails.errors.emailInvalid")
1204
- ]
1205
- }, null, 8, ["modelValue", "label", "placeholder", "rules"])) : s(O) ? (m(), q(se, {
1206
- key: 1,
1207
- modelValue: V.value,
1208
- "onUpdate:modelValue": S[5] || (S[5] = (N) => V.value = N),
1209
- label: s($)("team.memberDetails.phoneNumber"),
1210
- "label-mark": "optional",
1211
- "default-country": k.value,
1212
- "extra-country-codes": s(M),
1213
- rules: [
1214
- (N) => !s(Te)(N) || !!s(Me)(N) || s($)("team.memberDetails.errors.mobileInvalid")
1215
- ]
1216
- }, null, 8, ["modelValue", "label", "default-country", "extra-country-codes", "rules"])) : T("", !0)
1217
- ], 64)) : T("", !0)
1218
- ])) : T("", !0)
1219
- ]),
1220
- _: 1
1221
- }, 8, ["name", "status", "email", "phone-number"])) : (m(), R("div", Xa, [
1222
- i(za, {
1223
- onInvite: S[1] || (S[1] = (N) => j(N))
1224
- })
1225
- ])),
1226
- u.value || h.value || l.initialValue ? (m(), q(Aa, {
1227
- key: 3,
1228
- ref_key: "grantFieldsRef",
1229
- ref: b,
1230
- "initial-value": l.initialValue,
1231
- "fallback-name": ((x = h.value) == null ? void 0 : x.displayName) || "",
1232
- loading: l.loading
1233
- }, null, 8, ["initial-value", "fallback-name", "loading"])) : T("", !0)
1234
- ])
1235
- ];
1236
- }),
1237
- _: 1
1238
- }, 512);
1239
- };
1240
- }
1241
- }), Za = {
1242
- class: "space-y-24"
1243
- }, Qa = {
1244
- class: "space-y-8"
1245
- }, el = {
1246
- key: 0,
1247
- class: "flex w-full items-start justify-between px-16"
1248
- }, tl = {
1249
- class: "flex items-start gap-8"
1250
- }, sl = {
1251
- key: 1,
1252
- class: "space-y-4 px-16"
1253
- }, al = {
1254
- class: "flex items-start gap-8"
1255
- }, ll = {
1256
- class: "flex h-full flex-col overflow-auto"
1257
- }, ol = {
1258
- class: "flex w-full items-center justify-between"
1259
- }, rl = {
1260
- class: "fm-typo-en-title-md-600"
1261
- }, nl = {
1262
- class: "flex items-center justify-start gap-8"
1263
- }, Ne = 100, il = 2;
1264
- var ae = /* @__PURE__ */ function(l) {
1265
- return l[l.ADD = 0] = "ADD", l[l.UPDATE = 1] = "UPDATE", l[l.CLOSED = 2] = "CLOSED", l;
1266
- }(ae || {});
1267
- const Fl = /* @__PURE__ */ oe({
1268
- __name: "TeamMemberList",
1269
- setup(l, {
1270
- expose: A
1271
- }) {
1272
- const {
1273
- fetchCustomReportPermissions: v
1274
- } = Ot();
1275
- Ye();
1276
- const {
1277
- t
1278
- } = ce(), f = Xe(), {
1279
- providers: u,
1280
- hasProviders: $,
1281
- canInvite: K,
1282
- providerLabel: M
1283
- } = hs(), O = I(() => K.value ? u.value : []), k = Lt(), P = Tt(), _ = ot(), H = Dt(_), C = At(), V = Us(), B = c(!0), y = c(!1), d = I(() => k.isLoading.value), h = c([]), b = c(0), r = c(1), U = c(""), j = c("");
1284
- ue(k.restaurants, (e) => {
1285
- if (e.length > 0 && h.value.length > 0) {
1286
- const a = new Map(e.map((w) => [w._id, w.profile.name])), g = e.map((w) => w.profile.name).sort();
1287
- h.value = h.value.map((w) => ({
1288
- ...w,
1289
- restaurants: w.managableRestaurantIds === null ? g : w.managableRestaurantIds.map((Y) => a.get(Y) ?? "").filter(Boolean).sort()
1290
- }));
1291
- }
1292
- });
1293
- const W = I(() => [{
1294
- label: t("team.filter.unassigned_label"),
1295
- value: Be
1296
- }, ...k.restaurants.value.map((e) => ({
1297
- label: `${e.profile.code ? `${e.profile.code} - ` : ""}${e.profile.name}`,
1298
- value: e._id
1299
- }))]), re = ({
1300
- member: e,
1301
- className: a = ""
1302
- }) => {
1303
- const g = {
1304
- label: t("team.actions.updateMember"),
1305
- onClick: () => n(Ee.Update, e)
1306
- }, w = {
1307
- label: t("team.actions.removeMember"),
1308
- onClick: () => n(Ee.Remove, e),
1309
- itemClass: "text-fm-color-typo-error"
1310
- };
1311
- if (e.status === "invited") {
1312
- const le = {
1313
- label: t("team.staffInvite.actions.resend"),
1314
- onClick: () => qt(e)
1315
- }, De = {
1316
- label: t("team.staffInvite.actions.revoke"),
1317
- onClick: () => jt(e),
1318
- itemClass: "text-fm-color-typo-error"
1319
- };
1320
- return i(bt, {
1321
- class: a,
1322
- items: [g, le, De]
1323
- }, null);
1324
- }
1325
- const Y = e.doc.isOwner ? [g] : [g, w];
1326
- return i(bt, {
1327
- class: a,
1328
- items: Y
1329
- }, null);
1330
- }, ne = (e) => {
1331
- if (e.doc.isOwner) return t("team.labels.businessOwner");
1332
- const a = e.restaurants.slice(0, il), g = e.restaurants.length - a.length;
1333
- return i("div", {
1334
- class: "flex flex-col gap-4 py-4"
1335
- }, [a.map((w) => i("span", {
1336
- class: "truncate"
1337
- }, [w])), g > 0 && i("span", {
1338
- class: "text-fm-color-primary"
1339
- }, [t("team.labels.moreRestaurants", {
1340
- count: g
1341
- })])]);
1342
- }, Q = (e) => e.phoneNumber || e.email, D = [{
1343
- accessorKey: "name",
1344
- header: () => t("team.table.columns.name"),
1345
- enableSorting: !1,
1346
- cell(e) {
1347
- const a = e.row.original;
1348
- return i("div", {
1349
- class: "flex items-center gap-8"
1350
- }, [i(Qe.FmAvatar, {
1351
- name: a.name,
1352
- initials: nt(a.name),
1353
- size: "sm",
1354
- class: "shrink-0"
1355
- }, null), i("span", {
1356
- class: "truncate"
1357
- }, [a.name])]);
1358
- }
1359
- }, {
1360
- accessorKey: "phoneNumber",
1361
- header: () => t("team.table.columns.phoneNumber"),
1362
- enableSorting: !1,
1363
- cell(e) {
1364
- const a = e.row.original;
1365
- return i("div", {
1366
- class: "flex min-w-0 items-center gap-8"
1367
- }, [i("span", {
1368
- class: "truncate"
1369
- }, [Q(a)]), a.loginMethod === "sso" && i("span", {
1370
- class: "shrink-0 rounded-[4px] bg-fm-color-neutral-gray-100 px-4 py-[2px] text-[10px] font-medium leading-[14px] text-fm-color-typo-secondary"
1371
- }, [t("team.labels.sso")])]);
1372
- }
1373
- }, {
1374
- accessorKey: "restaurant",
1375
- header: () => t("team.table.columns.restaurant"),
1376
- enableSorting: !1,
1377
- cell(e) {
1378
- if (d.value)
1379
- return ss(cs);
1380
- const a = e.row.original;
1381
- return ne(a);
1382
- }
1383
- }, {
1384
- accessorKey: "assignedRoles",
1385
- header: () => t("team.table.columns.assignedRoles"),
1386
- enableSorting: !1,
1387
- cell(e) {
1388
- const a = e.row.original, g = V.getPermissionAssignmentByUserId(a.id), w = (g == null ? void 0 : g.permissionSetIds) || a.doc.permissionSetIds || [];
1389
- return C.permissionSets.value.filter((le) => w.includes(le.id)).map((le) => le.name).join(", ");
1390
- }
1391
- }, {
1392
- accessorKey: "permission",
1393
- header: () => t("team.table.columns.permission"),
1394
- enableSorting: !1,
1395
- cell(e) {
1396
- const a = e.row.original;
1397
- return o(a);
1398
- },
1399
- meta: {
1400
- width: "200px"
1401
- }
1402
- }, {
1403
- accessorKey: "posAccess",
1404
- header: () => t("team.table.columns.posAccess"),
1405
- enableSorting: !1,
1406
- cell(e) {
1407
- return e.row.original.doc.hasPosUser ? t("team.labels.yes") : t("team.labels.no");
1408
- }
1409
- }, {
1410
- accessorKey: "status",
1411
- header: () => t("team.table.columns.status"),
1412
- enableSorting: !1,
1413
- cell(e) {
1414
- return i(it, {
1415
- status: e.row.original.status
1416
- }, null);
1417
- }
1418
- }, {
1419
- id: "action",
1420
- meta: {
1421
- cellClass: "pl-16",
1422
- headerContentClass: "-mx-16"
1423
- },
1424
- cell(e) {
1425
- const a = e.row.original;
1426
- return re({
1427
- member: a,
1428
- className: "flex justify-end w-full"
1429
- });
1430
- },
1431
- enableSorting: !1
1432
- }];
1433
- function o(e) {
1434
- if (e.doc.isOwner)
1435
- return t("team.labels.businessOwner");
1436
- const a = i(Qe.FmTooltip, {
1437
- variant: "plain",
1438
- placement: "top"
1439
- }, {
1440
- default: () => i(Qe.FmIcon, {
1441
- name: "info",
1442
- class: "cursor-pointer text-fm-color-neutral-gray-300"
1443
- }, null),
1444
- content: () => i("div", null, [t("team.labels.permission"), e.permissionLabels.map((g) => i("div", null, [as("- "), g]))])
1445
- });
1446
- return i("div", {
1447
- class: "flex flex-row items-center gap-8"
1448
- }, [i("span", null, [t("team.labels.allowed", {
1449
- count: e.permissionLabels.length
1450
- })]), e.permissionLabels.length > 0 && a]);
1451
- }
1452
- function S(e) {
1453
- var Y, le, De, Oe;
1454
- const a = V.getPermissionAssignmentByUserId(e.id), g = (a == null ? void 0 : a.customPermissions) ?? e.permissions ?? [], w = (a == null ? void 0 : a.permissionSetIds) ?? e.doc.permissionSetIds ?? [];
1455
- return {
1456
- id: e.id,
1457
- isOwner: e.doc.isOwner,
1458
- name: e.name,
1459
- phoneNumber: e.phoneNumber,
1460
- email: e.email,
1461
- permissions: g,
1462
- permissionSetIds: w,
1463
- posUser: e.doc.posUser ? {
1464
- code: ((Y = e.doc.posUser) == null ? void 0 : Y.code) ?? "",
1465
- name: ((le = e.doc.posUser) == null ? void 0 : le.name) ?? e.name,
1466
- passcode: ((De = e.doc.posUser) == null ? void 0 : De.passcode) ?? "",
1467
- roles: ((Oe = e.doc.posUser) == null ? void 0 : Oe.roles) ?? []
1468
- } : void 0,
1469
- posUserId: e.doc.posUserId,
1470
- status: e.status,
1471
- employeeId: e.doc.employeeId ?? null
1472
- };
1473
- }
1474
- function z(e) {
1475
- const a = V.getPermissionAssignmentByUserId(e.id), g = (a == null ? void 0 : a.customPermissions) ?? e.permissions ?? [], w = (a == null ? void 0 : a.permissionSetIds) ?? e.doc.permissionSetIds ?? [];
1476
- return {
1477
- id: e.id,
1478
- isOwner: e.doc.isOwner,
1479
- name: e.name,
1480
- phoneNumber: e.phoneNumber,
1481
- email: e.email,
1482
- permissions: g,
1483
- permissionSetIds: w,
1484
- posUser: void 0,
1485
- posUserId: e.doc.posUserId,
1486
- status: e.status,
1487
- employeeId: e.doc.employeeId ?? null
1488
- };
1489
- }
1490
- function se(e) {
1491
- var a, g, w, Y;
1492
- return {
1493
- id: e._id,
1494
- isOwner: !1,
1495
- name: e.displayName || e.mobile || e.email || "",
1496
- phoneNumber: e.mobile ?? ((a = e.contact) == null ? void 0 : a.mobile) ?? "",
1497
- email: e.email ?? ((g = e.contact) == null ? void 0 : g.email) ?? "",
1498
- // Saved overrides on top of the roles, as for a member's assignment
1499
- permissions: e.grant.customPermissions,
1500
- permissionSetIds: e.grant.permissionSetIds,
1501
- posUser: e.grant.posUser ?? void 0,
1502
- status: "invited",
1503
- displayName: e.displayName ?? "",
1504
- employeeId: e.employeeId ?? null,
1505
- match: e.match,
1506
- contact: (e.match === "mobile" ? (w = e.contact) == null ? void 0 : w.email : (Y = e.contact) == null ? void 0 : Y.mobile) ?? ""
1507
- };
1508
- }
1509
- const X = c(null);
1510
- function x(e) {
1511
- return {
1512
- label: M(e.provider),
1513
- match: e.match
1514
- };
1515
- }
1516
- async function N(e) {
1517
- const a = ++ee;
1518
- try {
1519
- const g = typeof e == "string" ? (await Ae.readInvites()).find((w) => w._id === e) : e;
1520
- if (a !== ee) return;
1521
- if (!g) {
1522
- _.open({
1523
- type: "error",
1524
- title: t("team.staffInvite.errors.not_pending")
1525
- }), await ke();
1526
- return;
1527
- }
1528
- X.value = g, Z.value = se(g), J.value = ae.UPDATE;
1529
- } catch {
1530
- if (a !== ee) return;
1531
- _.open({
1532
- message: t("common.error"),
1533
- type: "error"
1534
- });
1535
- }
1536
- }
1537
- async function je(e) {
1538
- const a = ++ee;
1539
- X.value = null, Z.value = z(e), J.value = ae.UPDATE, ge.value = e.doc.hasPosUser === !0;
1540
- try {
1541
- const g = await Ve.readTeamMember(e.id);
1542
- if (a !== ee) return;
1543
- Z.value = S(g);
1544
- } catch {
1545
- if (a !== ee) return;
1546
- _.open({
1547
- message: t("common.error"),
1548
- type: "error"
1549
- }), Fe();
1550
- } finally {
1551
- a === ee && (ge.value = !1);
1552
- }
1553
- }
1554
- async function qe(e) {
1555
- if (xe(), e.kind === "invite") {
1556
- await N(e.invite);
1557
- return;
1558
- }
1559
- const a = ++ee;
1560
- try {
1561
- const g = await Ve.readTeamMember(e.id);
1562
- if (a !== ee) return;
1563
- await je(g);
1564
- } catch {
1565
- _.open({
1566
- message: t("common.error"),
1567
- type: "error"
1568
- });
1569
- }
1570
- }
1571
- const ge = c(!1);
1572
- let ee = 0;
1573
- const n = async (e, a) => {
1574
- e == Ee.Update && (a.status === "invited" ? await N(a.id) : await je(a)), e == Ee.Remove && Bt(a);
1575
- }, F = Ft(), J = c(ae.CLOSED), pe = I(() => J.value !== ae.CLOSED), he = I(() => J.value === ae.ADD ? t("common.add") : t("common.update")), ve = I(() => J.value === ae.ADD ? t("team.actions.addMember") : t("team.actions.updateMember")), Z = c();
1576
- function xe() {
1577
- ee++, ge.value = !1, X.value = null, J.value = ae.CLOSED;
1578
- }
1579
- const Re = ps(() => {
1580
- var e;
1581
- return ((e = me.value) == null ? void 0 : e.isModified()) ?? !1;
1582
- }, xe);
1583
- function Fe() {
1584
- Re();
1585
- }
1586
- function Ge(e) {
1587
- e || Fe();
1588
- }
1589
- const {
1590
- breakpoints: _e
1591
- } = $t(), Bt = (e) => {
1592
- F.open({
1593
- title: t("team.actions.removeMember"),
1594
- message: t("team.removeMember.confirmationMessage", {
1595
- memberName: e.name
1596
- }),
1597
- minWidth: _e.value.lg ? 588 : 0,
1598
- primaryActions: {
1599
- text: "Remove",
1600
- close: !1,
1601
- variant: "destructive",
1602
- isLoading: Se
1603
- },
1604
- secondaryActions: {
1605
- text: "Cancel",
1606
- close: !0
1607
- }
1608
- }).onPrimary(async () => {
1609
- Se.value || (await H.minor(async () => {
1610
- await Ve.deleteTeamMember(e.id), await ke();
1611
- }, {
1612
- isLoading: Se,
1613
- successMessage: t("team.removeMember.successMessage", {
1614
- memberName: e.name
1615
- })
1616
- }), F.close());
1617
- });
1618
- };
1619
- function jt(e) {
1620
- F.open({
1621
- title: t("team.staffInvite.revoke.title"),
1622
- message: t("team.staffInvite.revoke.message", {
1623
- name: e.name
1624
- }),
1625
- minWidth: _e.value.lg ? 588 : 0,
1626
- primaryActions: {
1627
- text: t("team.staffInvite.actions.revoke"),
1628
- close: !1,
1629
- variant: "destructive",
1630
- isLoading: Se
1631
- },
1632
- secondaryActions: {
1633
- text: t("common.cancel"),
1634
- close: !0
1635
- }
1636
- }).onPrimary(async () => {
1637
- if (!Se.value) {
1638
- Se.value = !0;
1639
- try {
1640
- await Ae.revokeInvite(e.id), _.open({
1641
- type: "success",
1642
- title: t("team.staffInvite.revoke.successMessage")
1643
- });
1644
- } catch (a) {
1645
- _.open({
1646
- type: "error",
1647
- title: ze(a, {
1648
- label: "",
1649
- match: "mobile"
1650
- }, t)
1651
- });
1652
- } finally {
1653
- Se.value = !1, F.close(), await ke();
1654
- }
1655
- }
1656
- });
1657
- }
1658
- async function qt(e) {
1659
- var g;
1660
- const a = {
1661
- label: ((g = u.value[0]) == null ? void 0 : g.label) ?? "",
1662
- match: e.phoneNumber ? "mobile" : "email"
1663
- };
1664
- try {
1665
- const w = await Ae.resendInvite(e.id);
1666
- w.warnings.length === 0 && _.open({
1667
- type: "success",
1668
- title: t("team.staffInvite.resend.sent", {
1669
- label: a.label
1670
- })
1671
- });
1672
- for (const Y of yt(w.warnings, a, t))
1673
- _.open({
1674
- type: "warning",
1675
- message: Y,
1676
- position: et.BOTTOM
1677
- });
1678
- } catch (w) {
1679
- _.open({
1680
- type: "error",
1681
- title: ze(w, a, t)
1682
- }), gt(w) && await ke();
1683
- }
1684
- }
1685
- const Gt = () => {
1686
- X.value = null, Z.value = null, J.value = ae.ADD;
1687
- }, $e = c(), Ue = c(), Ce = c(), Ie = c(), we = c(), ut = I(() => [{
1688
- label: t("team.status.active"),
1689
- value: "active"
1690
- }, {
1691
- label: t("team.status.invited"),
1692
- value: "invited"
1693
- }]), Kt = I(() => {
1694
- var a;
1695
- const e = (a = u.value[0]) == null ? void 0 : a.label;
1696
- return e ? /\bSSO\b/i.test(e) ? e : t("team.loginMethod.ssoProvider", {
1697
- label: e
1698
- }) : t("team.loginMethod.sso");
1699
- }), mt = I(() => [{
1700
- label: Kt.value,
1701
- value: "sso"
1702
- }, {
1703
- label: t("team.loginMethod.feedme"),
1704
- value: "feedme"
1705
- }]), dt = I(() => {
1706
- var e;
1707
- return JSON.stringify({
1708
- businessId: ((e = f.currentBusiness.value) == null ? void 0 : e._id) ?? "",
1709
- search: j.value.trim(),
1710
- restaurantIds: [...$e.value ?? []].sort(),
1711
- permissionSubjects: [...Ue.value ?? []].sort(),
1712
- permissionSetIds: [...Ce.value ?? []].sort(),
1713
- statuses: [...Ie.value ?? []].sort(),
1714
- loginMethods: [...we.value ?? []].sort()
1715
- });
1716
- }), ct = I(() => Object.values(os).map((e) => ({
1717
- label: e.label,
1718
- value: e.subject
1719
- }))), pt = I(() => [{
1720
- label: t("team.filter.unassigned_label"),
1721
- value: Be
1722
- }, ...C.permissionSets.value.map((e) => ({
1723
- label: e.name,
1724
- value: e.id
1725
- }))]);
1726
- async function Wt() {
1727
- await P.readRoles();
1728
- }
1729
- async function Ke(e = r.value) {
1730
- var a, g, w;
1731
- B.value = !0;
1732
- try {
1733
- const Y = await Ve.readTeamMembersPage({
1734
- limit: Ne,
1735
- offset: (e - 1) * Ne,
1736
- search: j.value.trim() || void 0,
1737
- restaurantIds: kt($e.value),
1738
- permissionSubjects: (a = Ue.value) != null && a.length ? Ue.value : void 0,
1739
- permissionSetIds: kt(Ce.value),
1740
- statuses: (g = Ie.value) != null && g.length ? Ie.value : void 0,
1741
- loginMethods: (w = we.value) != null && w.length ? we.value : void 0
1742
- });
1743
- h.value = Y.items, b.value = Y.total;
1744
- } finally {
1745
- B.value = !1;
1746
- }
1747
- }
1748
- async function ke() {
1749
- var a;
1750
- if (!((a = f.currentBusiness.value) != null && a._id)) return;
1751
- await Ke(r.value);
1752
- const e = Math.max(1, Math.ceil(b.value / Ne));
1753
- r.value > e && (r.value = e, await Ke(r.value));
1754
- }
1755
- const me = c(), fe = c(!1), Se = c(!1);
1756
- async function Je() {
1757
- xe(), await We(), await ke();
1758
- }
1759
- async function zt(e) {
1760
- const a = me.value.readDetails(), g = x(a);
1761
- fe.value = !0;
1762
- try {
1763
- const w = await Ae.createInvite({
1764
- ...a,
1765
- permissions: e.permissions ?? [],
1766
- customPermissions: e.customPermissions,
1767
- permissionSetIds: e.permissionSetIds,
1768
- // The POS user goes by the name the admin entered.
1769
- posUser: e.posUser ? {
1770
- ...e.posUser,
1771
- name: a.displayName
1772
- } : e.posUser
1773
- });
1774
- _.open({
1775
- type: "success",
1776
- title: t("team.addMember.successMessage", {
1777
- memberName: a.displayName
1778
- }),
1779
- position: et.BOTTOM
1780
- });
1781
- for (const Y of yt(w.warnings, g, t, w.result))
1782
- _.open({
1783
- type: "warning",
1784
- message: Y,
1785
- position: et.BOTTOM
1786
- });
1787
- await Je();
1788
- } catch (w) {
1789
- _.open({
1790
- type: "error",
1791
- title: ze(w, g, t)
1792
- });
1793
- } finally {
1794
- fe.value = !1;
1795
- }
1796
- }
1797
- async function Ht(e, a) {
1798
- const g = x(e);
1799
- fe.value = !0;
1800
- try {
1801
- await Ae.updateInvite(e._id, xs(e, {
1802
- permissions: a.permissions ?? [],
1803
- customPermissions: a.customPermissions,
1804
- permissionSetIds: a.permissionSetIds,
1805
- posUser: a.posUser
1806
- }, me.value.readEdits() ?? void 0)), _.open({
1807
- type: "success",
1808
- title: t("team.updateMember.successMessage", {
1809
- memberName: Z.value.name
1810
- })
1811
- }), await Je();
1812
- } catch (w) {
1813
- _.open({
1814
- type: "error",
1815
- title: ze(w, g, t)
1816
- }), gt(w) && await Je();
1817
- } finally {
1818
- fe.value = !1;
1819
- }
1820
- }
1821
- async function Xt() {
1822
- if (!me.value) return;
1823
- const e = await me.value.validate();
1824
- if (!e) return;
1825
- const a = J.value === ae.ADD;
1826
- if (a && O.value.length > 0) {
1827
- me.value.hasExisting || await zt(e);
1828
- return;
1829
- }
1830
- if (!a && X.value) {
1831
- await Ht(X.value, e);
1832
- return;
1833
- }
1834
- const g = a ? null : me.value.readEdits();
1835
- await H.minor(async () => {
1836
- await (a ? Ve.createTeamMember(e) : Ve.updateTeamMember(Z.value.id, {
1837
- ...gs(e, Z.value.posUser),
1838
- // '' clears it; the owner's sheet has no field, so it is left out
1839
- ...g ? {
1840
- employeeId: g.employeeId
1841
- } : {}
1842
- })), xe(), await We(), await ke();
1843
- }, {
1844
- successMessage: a ? t("team.addMember.successMessage", {
1845
- memberName: e.name
1846
- }) : t("team.updateMember.successMessage", {
1847
- memberName: e.name
1848
- }),
1849
- isLoading: fe
1850
- }), J.value = ae.CLOSED;
1851
- }
1852
- async function Yt() {
1853
- await C.readPermissionSets();
1854
- }
1855
- async function We() {
1856
- await V.readPermissionAssignments();
1857
- }
1858
- let Ze = !1;
1859
- async function Jt({
1860
- pageIndex: e
1861
- }) {
1862
- var a;
1863
- if ((a = f.currentBusiness.value) != null && a._id && !Ze && !(e === 0 && r.value === 1 && h.value.length > 0)) {
1864
- Ze = !0, r.value = e + 1;
1865
- try {
1866
- await Ke(r.value);
1867
- } finally {
1868
- Ze = !1;
1869
- }
1870
- }
1871
- }
1872
- const Zt = ls(U, () => {
1873
- j.value = U.value;
1874
- });
1875
- return Pt(Zt), ue(dt, async () => {
1876
- var e;
1877
- r.value = 1, y.value = !1, (e = f.currentBusiness.value) != null && e._id && (await Ke(1), y.value = !0);
1878
- }, {
1879
- immediate: !0
1880
- }), ue(f.currentBusiness, async () => {
1881
- var e;
1882
- if ((e = f.currentBusiness.value) != null && e._id)
1883
- try {
1884
- await Promise.all([k.readRestaurants(), Yt(), We(), v(), Wt()]);
1885
- } catch (a) {
1886
- console.error("Failed to load team member dependencies:", a), _.open({
1887
- message: a instanceof Error ? a.message : String(a),
1888
- type: "error"
1889
- });
1890
- }
1891
- }, {
1892
- immediate: !0
1893
- }), A({
1894
- create: Gt,
1895
- refresh: async () => {
1896
- await We(), await ke();
1897
- }
1898
- }), (e, a) => {
1899
- var Oe;
1900
- const g = G("FmSearch"), w = G("FmTable"), Y = G("FmIcon"), le = G("FmButton"), De = G("FmSideSheet");
1901
- return m(), R(de, null, [p("div", Za, [p("div", Qa, [s(_e).xs ? (m(), R("div", sl, [i(g, {
1902
- modelValue: U.value,
1903
- "onUpdate:modelValue": a[6] || (a[6] = (L) => U.value = L),
1904
- class: "w-[320px] xs:w-full xs:mt-8",
1905
- placeholder: s(t)("team.search.placeholder")
1906
- }, null, 8, ["modelValue", "placeholder"]), p("div", al, [i(ie, {
1907
- modelValue: $e.value,
1908
- "onUpdate:modelValue": a[7] || (a[7] = (L) => $e.value = L),
1909
- multiple: "",
1910
- items: W.value,
1911
- variant: "dark",
1912
- "chip-icon": "storefront",
1913
- "selected-prefix": s(t)("team.table.columns.restaurant"),
1914
- placeholder: s(t)("team.table.columns.restaurant"),
1915
- class: "!w-auto"
1916
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(ie, {
1917
- modelValue: Ce.value,
1918
- "onUpdate:modelValue": a[8] || (a[8] = (L) => Ce.value = L),
1919
- multiple: "",
1920
- variant: "dark",
1921
- "chip-icon": "account_circle",
1922
- items: pt.value,
1923
- "selected-prefix": s(t)("team.filter.selected_assigned_role_prefix"),
1924
- placeholder: s(t)("team.filter.assigned_role_placeholder")
1925
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(ie, {
1926
- modelValue: Ue.value,
1927
- "onUpdate:modelValue": a[9] || (a[9] = (L) => Ue.value = L),
1928
- multiple: "",
1929
- variant: "dark",
1930
- "chip-icon": "settings_account_box",
1931
- items: ct.value,
1932
- "selected-prefix": s(t)("team.filter.selected_permission_prefix"),
1933
- placeholder: s(t)("team.filter.permission_placeholder")
1934
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), s($) ? (m(), R(de, {
1935
- key: 0
1936
- }, [i(ie, {
1937
- modelValue: Ie.value,
1938
- "onUpdate:modelValue": a[10] || (a[10] = (L) => Ie.value = L),
1939
- multiple: "",
1940
- variant: "dark",
1941
- "chip-icon": "check_circle",
1942
- searchable: !1,
1943
- items: ut.value,
1944
- "selected-prefix": s(t)("team.filter.selected_status_prefix"),
1945
- placeholder: s(t)("team.filter.status_placeholder")
1946
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(ie, {
1947
- modelValue: we.value,
1948
- "onUpdate:modelValue": a[11] || (a[11] = (L) => we.value = L),
1949
- multiple: "",
1950
- variant: "dark",
1951
- "chip-icon": "check_circle",
1952
- searchable: !1,
1953
- items: mt.value,
1954
- "selected-prefix": s(t)("team.filter.selected_login_method_prefix"),
1955
- placeholder: s(t)("team.filter.login_method_placeholder")
1956
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])], 64)) : T("", !0)])])) : (m(), R("div", el, [p("div", tl, [i(ie, {
1957
- modelValue: $e.value,
1958
- "onUpdate:modelValue": a[0] || (a[0] = (L) => $e.value = L),
1959
- multiple: "",
1960
- items: W.value,
1961
- variant: "dark",
1962
- "chip-icon": "storefront",
1963
- "selected-prefix": s(t)("team.table.columns.restaurant"),
1964
- placeholder: s(t)("team.table.columns.restaurant"),
1965
- class: "!w-auto"
1966
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(ie, {
1967
- modelValue: Ce.value,
1968
- "onUpdate:modelValue": a[1] || (a[1] = (L) => Ce.value = L),
1969
- multiple: "",
1970
- variant: "dark",
1971
- "chip-icon": "account_circle",
1972
- items: pt.value,
1973
- "selected-prefix": s(t)("team.filter.selected_assigned_role_prefix"),
1974
- placeholder: s(t)("team.filter.assigned_role_placeholder")
1975
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(ie, {
1976
- modelValue: Ue.value,
1977
- "onUpdate:modelValue": a[2] || (a[2] = (L) => Ue.value = L),
1978
- multiple: "",
1979
- variant: "dark",
1980
- "chip-icon": "settings_account_box",
1981
- items: ct.value,
1982
- "selected-prefix": s(t)("team.filter.selected_permission_prefix"),
1983
- placeholder: s(t)("team.filter.permission_placeholder")
1984
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), s($) ? (m(), R(de, {
1985
- key: 0
1986
- }, [i(ie, {
1987
- modelValue: Ie.value,
1988
- "onUpdate:modelValue": a[3] || (a[3] = (L) => Ie.value = L),
1989
- multiple: "",
1990
- variant: "dark",
1991
- "chip-icon": "check_circle",
1992
- searchable: !1,
1993
- items: ut.value,
1994
- "selected-prefix": s(t)("team.filter.selected_status_prefix"),
1995
- placeholder: s(t)("team.filter.status_placeholder")
1996
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i(ie, {
1997
- modelValue: we.value,
1998
- "onUpdate:modelValue": a[4] || (a[4] = (L) => we.value = L),
1999
- multiple: "",
2000
- variant: "dark",
2001
- "chip-icon": "check_circle",
2002
- searchable: !1,
2003
- items: mt.value,
2004
- "selected-prefix": s(t)("team.filter.selected_login_method_prefix"),
2005
- placeholder: s(t)("team.filter.login_method_placeholder")
2006
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])], 64)) : T("", !0)]), i(g, {
2007
- modelValue: U.value,
2008
- "onUpdate:modelValue": a[5] || (a[5] = (L) => U.value = L),
2009
- class: "w-[320px] xs:w-full xs:mt-8",
2010
- autofocus: "",
2011
- placeholder: s(t)("team.search.placeholder")
2012
- }, null, 8, ["modelValue", "placeholder"])])), (Oe = s(f).currentBusiness.value) != null && Oe._id ? (m(), q(rs, {
2013
- key: 2
2014
- }, {
2015
- default: te(() => [p("div", ll, [y.value ? T("", !0) : (m(), q(ns, {
2016
- key: 0
2017
- })), y.value ? (m(), q(is, {
2018
- key: 1,
2019
- "is-loading": B.value,
2020
- "is-empty": b.value === 0,
2021
- title: s(t)("team.emptyState.title"),
2022
- subtitle: s(t)("team.emptyState.description")
2023
- }, {
2024
- default: te(() => [(m(), q(w, {
2025
- key: dt.value,
2026
- "column-defs": D,
2027
- "row-data": h.value,
2028
- "page-size": Ne,
2029
- "page-count": Math.ceil(b.value / Ne),
2030
- "row-count": b.value,
2031
- "fetch-fn": Jt,
2032
- "hide-footer": b.value <= Ne,
2033
- loading: B.value,
2034
- "pin-header-row": "",
2035
- onRowClick: a[12] || (a[12] = (L) => n(s(Ee).Update, L.original))
2036
- }, null, 8, ["row-data", "page-count", "row-count", "hide-footer", "loading"]))]),
2037
- _: 1
2038
- }, 8, ["is-loading", "is-empty", "title", "subtitle"])) : T("", !0)])]),
2039
- _: 1
2040
- })) : T("", !0)])]), i(De, {
2041
- "model-value": pe.value,
2042
- "max-width": 960,
2043
- "close-button": !1,
2044
- "onUpdate:modelValue": Ge,
2045
- "onOn:clickedAway": s(Re)
2046
- }, {
2047
- "side-sheet-header": te(() => [p("div", ol, [p("p", rl, E(ve.value), 1), i(Y, {
2048
- name: "close",
2049
- size: "md",
2050
- class: "cursor-pointer",
2051
- onClick: s(Re)
2052
- }, null, 8, ["onClick"])])]),
2053
- "side-sheet-footer": te(() => {
2054
- var L;
2055
- return [p("div", nl, [i(le, {
2056
- label: he.value,
2057
- size: "md",
2058
- variant: "primary",
2059
- "is-loading": fe.value,
2060
- disabled: fe.value || J.value === ae.ADD && ((L = me.value) == null ? void 0 : L.hasExisting),
2061
- onClick: Mt(Xt, ["prevent"])
2062
- }, null, 8, ["label", "is-loading", "disabled"]), i(le, {
2063
- label: s(t)("common.cancel"),
2064
- size: "md",
2065
- variant: "secondary",
2066
- disabled: fe.value,
2067
- onClick: Fe
2068
- }, null, 8, ["label", "disabled"])])];
2069
- }),
2070
- default: te(() => [pe.value ? (m(), q(Ja, {
2071
- key: 0,
2072
- ref_key: "memberForm",
2073
- ref: me,
2074
- initialValue: Z.value,
2075
- providers: O.value,
2076
- loading: ge.value,
2077
- class: "gap-8",
2078
- onUpdateExisting: qe
2079
- }, null, 8, ["initialValue", "providers", "loading"])) : T("", !0)]),
2080
- _: 1
2081
- }, 8, ["model-value", "onOn:clickedAway"])], 64);
2082
- };
2083
- }
2084
- });
2085
- export {
2086
- Fl as default
2087
- };