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

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