@feedmepos/mf-hrm-portal 2.3.2-dev.15 → 2.3.2-dev.16

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