@feedmepos/mf-hrm-portal 2.3.2-dev → 2.3.4-dev

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