@feedmepos/mf-hrm-portal 2.3.2-dev.2 → 2.3.2-dev.3

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