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