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