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