@feedmepos/mf-hrm-portal 2.0.20-dev.3 → 2.0.20
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/{AuditLogList-7E8iWQWx.js → AuditLogList-TOZRNTSo.js} +4 -4
- package/dist/{EmployeeList-DyNW3cUo.js → EmployeeList-CqAhLDpa.js} +6 -6
- package/dist/{Main-BLJyOcEv.js → Main-CNsbo8k2.js} +4 -4
- package/dist/{Main-BZjZxFHp.js → Main-DwipzHNI.js} +9 -9
- package/dist/{Main-C9lMH4EN.js → Main-ZnQXWxWY.js} +6 -6
- package/dist/{PermissionSetList-BuCp14Os.js → PermissionSetList-DH2Cwyis.js} +6 -6
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BQSDnH-Z.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CWS0T07y.js} +867 -867
- package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-oqww39U7.js +34 -0
- package/dist/{RoleList-L8L1xmJ2.js → RoleList-DcrMX2Mi.js} +7 -7
- package/dist/TeamMemberList-MBwOsPwC.js +1130 -0
- package/dist/{TimesheetList-D88u0GFn.js → TimesheetList-KChmIX6Q.js} +6 -6
- package/dist/{app-g_SrJtfC.js → app-DGh3k8-U.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-BGHzwXCt.js → dayjs.min-BxM3dCKV.js} +1 -1
- package/dist/{employee-Dep-q_aU.js → employee-C4FMY6tR.js} +3 -3
- package/dist/{iteration-Dc-Bz5bA.js → iteration-BsPfVFYw.js} +359 -358
- package/dist/{lodash-Cxw1GZ6L.js → lodash-COviVyx5.js} +1 -1
- package/dist/{rule-ClRtpdqO.js → rule-BR8uiSU2.js} +2 -2
- package/dist/src/api/account/index.d.ts +4 -0
- package/dist/src/api/index.d.ts +1 -0
- package/dist/src/composables/useSupportedCountries.d.ts +5 -0
- package/dist/style.css +1 -1
- package/dist/{timesheet-CZoSvFYT.js → timesheet-DtssF2P4.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-CTBRpqmO.js → useAppStore-DhnL8kOw.js} +1 -1
- package/dist/{useLoading-XvrLj1VM.js → useLoading-BdA-bKJE.js} +1 -1
- package/dist/{useReportPermissions-nivbQm9V.js → useReportPermissions-Dqo3v4ao.js} +3 -3
- package/package.json +1 -1
- package/dist/TeamMemberList-DEN9rHqb.js +0 -1124
|
@@ -1,1124 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Se, resolveComponent as S, createElementBlock as A, openBlock as h, createElementVNode as r, createVNode as u, toDisplayString as P, unref as o, ref as v, computed as w, createCommentVNode as J, withCtx as ue, createBlock as H, watch as me, Fragment as ke, renderList as as, withKeys as Be, withModifiers as Fe, nextTick as ls, onUnmounted as os, h as ns, createTextVNode as rs } from "vue";
|
|
2
|
-
import { useI18n as Ve, useCoreStore as $e, baseClientInstance as je } from "@feedmepos/mf-common";
|
|
3
|
-
import { useSnackbar as Je, useDialog as is, useBreakpoints as us, components as Ne } from "@feedmepos/ui-library";
|
|
4
|
-
import { u as ms, _ as ds } from "./useDebounce-CWb5QR9G.js";
|
|
5
|
-
import { _ as cs, S as fe } from "./SelectFilter-DUj7GBtT.js";
|
|
6
|
-
import { b as Ee, m as ps, C as vs, _ as fs, a as bs } from "./app-g_SrJtfC.js";
|
|
7
|
-
import { u as _s, _ as ys } from "./useDiscardConfirm-DPhEV6v0.js";
|
|
8
|
-
import { _ as hs } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
|
|
9
|
-
import { u as gs } from "./useLoading-XvrLj1VM.js";
|
|
10
|
-
import { l as De } from "./lodash-Cxw1GZ6L.js";
|
|
11
|
-
import { g as Le, d as pe, u as Xe } from "./iteration-Dc-Bz5bA.js";
|
|
12
|
-
import { u as Ze, c as Te, b as qe, m as Ie, d as Qe, p as Ke, i as xs, j as ze, k as Ge, l as Us, n as Fs, s as Ss, o as Vs, q as ws, t as Ue } from "./rule-ClRtpdqO.js";
|
|
13
|
-
import { u as Ye } from "./useAppStore-CTBRpqmO.js";
|
|
14
|
-
/* empty css */
|
|
15
|
-
import { _ as Ps } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BQSDnH-Z.js";
|
|
16
|
-
var _e = /* @__PURE__ */ ((m) => (m.Update = "Update", m.Remove = "Remove", m))(_e || {});
|
|
17
|
-
const Is = { class: "w-full flex flex-col gap-16" }, ks = { class: "flex items-center gap-16" }, $s = { class: "space-y-4 min-w-0 flex-1" }, Rs = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, Cs = { class: "fm-typo-en-body-lg-600 truncate" }, Ms = { class: "w-full flex gap-16 items-center" }, Ns = { class: "flex-1 flex flex-col gap-4 min-w-0" }, Ds = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, As = { class: "fm-typo-en-body-lg-600 truncate" }, Os = { class: "flex-1 flex flex-col gap-4 min-w-0" }, Bs = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, js = { class: "fm-typo-en-body-lg-600 truncate" }, Es = /* @__PURE__ */ Se({
|
|
18
|
-
__name: "MemberInfo",
|
|
19
|
-
props: {
|
|
20
|
-
data: {}
|
|
21
|
-
},
|
|
22
|
-
setup(m) {
|
|
23
|
-
const { t: O } = Ve();
|
|
24
|
-
return (n, a) => {
|
|
25
|
-
const d = S("FmAvatar");
|
|
26
|
-
return h(), A("div", Is, [
|
|
27
|
-
r("div", ks, [
|
|
28
|
-
u(d, {
|
|
29
|
-
size: "xl",
|
|
30
|
-
initials: m.data.name
|
|
31
|
-
}, null, 8, ["initials"]),
|
|
32
|
-
r("div", $s, [
|
|
33
|
-
r("p", Rs, P(o(O)("team.memberForm.memberInfo.memberName")), 1),
|
|
34
|
-
r("p", Cs, P(m.data.name || "--"), 1)
|
|
35
|
-
])
|
|
36
|
-
]),
|
|
37
|
-
r("div", Ms, [
|
|
38
|
-
r("div", Ns, [
|
|
39
|
-
r("p", Ds, P(o(O)("team.memberForm.memberInfo.mobileNumber")), 1),
|
|
40
|
-
r("p", As, P(m.data.phoneNumber || "--"), 1)
|
|
41
|
-
]),
|
|
42
|
-
r("div", Os, [
|
|
43
|
-
r("p", Bs, P(o(O)("team.memberForm.memberInfo.emailAddress")), 1),
|
|
44
|
-
r("p", js, P(m.data.email || "--"), 1)
|
|
45
|
-
])
|
|
46
|
-
])
|
|
47
|
-
]);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}), We = {
|
|
51
|
-
async readPermissionUserByPhoneNo(m) {
|
|
52
|
-
var n;
|
|
53
|
-
const { currentBusiness: O } = $e();
|
|
54
|
-
return Le(
|
|
55
|
-
await je("/").get(`/user/b/${(n = O.value) == null ? void 0 : n._id}/phone/${m}`)
|
|
56
|
-
);
|
|
57
|
-
},
|
|
58
|
-
async readPermissionUserByEmail(m) {
|
|
59
|
-
var n;
|
|
60
|
-
const { currentBusiness: O } = $e();
|
|
61
|
-
return Le(
|
|
62
|
-
await je("/").get(`/user/b/${(n = O.value) == null ? void 0 : n._id}/email/${m}`)
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}, Ls = { class: "flex flex-col gap-24 w-full" }, Ts = {
|
|
66
|
-
key: 0,
|
|
67
|
-
class: "flex flex-col gap-8"
|
|
68
|
-
}, qs = { class: "user-info-icon user-info-icon--lg" }, Ks = { class: "flex-1 overflow-hidden" }, zs = { class: "profile-displayName" }, Gs = { class: "profile-email" }, Ws = { class: "profile-phone" }, Js = { key: 2 }, Xs = /* @__PURE__ */ Se({
|
|
69
|
-
__name: "PortalUserSearcher",
|
|
70
|
-
emits: ["invite"],
|
|
71
|
-
setup(m, { emit: O }) {
|
|
72
|
-
const n = O, { t: a } = Ve(), d = Je(), R = $e(), C = v("phone"), x = v(""), B = v(""), p = v();
|
|
73
|
-
async function b() {
|
|
74
|
-
if (!x.value && !B.value) {
|
|
75
|
-
d.open({
|
|
76
|
-
type: "error",
|
|
77
|
-
title: a("team.memberForm.searchUser.emptyError")
|
|
78
|
-
});
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const V = C.value === "phone" ? await We.readPermissionUserByPhoneNo(x.value.replace(/ /g, "")) : await We.readPermissionUserByEmail(B.value);
|
|
82
|
-
V || d.open({
|
|
83
|
-
type: "error",
|
|
84
|
-
title: a("team.memberForm.searchUser.userNotFound")
|
|
85
|
-
}), p.value = V;
|
|
86
|
-
}
|
|
87
|
-
const ee = w(() => {
|
|
88
|
-
var q;
|
|
89
|
-
let V = ((q = p.value) == null ? void 0 : q.displayName) ?? "";
|
|
90
|
-
V || (V = "Feed Me");
|
|
91
|
-
const [_, D] = V.split(" ");
|
|
92
|
-
return D ? `${_[0]}${D[0]}` : _.slice(0, 2);
|
|
93
|
-
}), E = v(!1);
|
|
94
|
-
function oe(V) {
|
|
95
|
-
n("invite", V), E.value = !0;
|
|
96
|
-
}
|
|
97
|
-
function T() {
|
|
98
|
-
E.value = !1;
|
|
99
|
-
}
|
|
100
|
-
return (V, _) => {
|
|
101
|
-
var g, M, X;
|
|
102
|
-
const D = S("FmRadio"), q = S("FmPhoneNumber"), ae = S("FmTextField"), i = S("FmRadioGroup"), l = S("FmButton");
|
|
103
|
-
return h(), A("div", Ls, [
|
|
104
|
-
E.value ? J("", !0) : (h(), A("div", Ts, [
|
|
105
|
-
u(i, {
|
|
106
|
-
modelValue: C.value,
|
|
107
|
-
"onUpdate:modelValue": _[2] || (_[2] = (j) => C.value = j)
|
|
108
|
-
}, {
|
|
109
|
-
default: ue(() => [
|
|
110
|
-
u(D, {
|
|
111
|
-
value: "phone",
|
|
112
|
-
label: o(a)("team.memberForm.searchUser.phoneNumber")
|
|
113
|
-
}, null, 8, ["label"]),
|
|
114
|
-
C.value === "phone" ? (h(), H(q, {
|
|
115
|
-
key: 0,
|
|
116
|
-
modelValue: x.value,
|
|
117
|
-
"onUpdate:modelValue": _[0] || (_[0] = (j) => x.value = j),
|
|
118
|
-
"extra-country-codes": o(R).enabledCountries.value,
|
|
119
|
-
class: "ml-8"
|
|
120
|
-
}, null, 8, ["modelValue", "extra-country-codes"])) : J("", !0),
|
|
121
|
-
u(D, {
|
|
122
|
-
value: "email",
|
|
123
|
-
label: o(a)("team.memberForm.searchUser.email")
|
|
124
|
-
}, null, 8, ["label"]),
|
|
125
|
-
C.value === "email" ? (h(), H(ae, {
|
|
126
|
-
key: 1,
|
|
127
|
-
modelValue: B.value,
|
|
128
|
-
"onUpdate:modelValue": _[1] || (_[1] = (j) => B.value = j),
|
|
129
|
-
placeholder: o(a)("team.memberForm.searchUser.emailPlaceholder"),
|
|
130
|
-
class: "ml-8"
|
|
131
|
-
}, null, 8, ["modelValue", "placeholder"])) : J("", !0)
|
|
132
|
-
]),
|
|
133
|
-
_: 1
|
|
134
|
-
}, 8, ["modelValue"]),
|
|
135
|
-
u(l, {
|
|
136
|
-
label: o(a)("team.memberForm.searchUser.search"),
|
|
137
|
-
variant: "secondary",
|
|
138
|
-
onClick: b
|
|
139
|
-
}, null, 8, ["label"])
|
|
140
|
-
])),
|
|
141
|
-
p.value ? (h(), A("div", {
|
|
142
|
-
key: 1,
|
|
143
|
-
class: "profile-menu--profile cursor-pointer hover:bg-fm-color-opacity-sm",
|
|
144
|
-
onClick: _[3] || (_[3] = (j) => oe(p.value))
|
|
145
|
-
}, [
|
|
146
|
-
r("div", qs, P(ee.value), 1),
|
|
147
|
-
r("div", Ks, [
|
|
148
|
-
r("p", zs, P((g = p.value) == null ? void 0 : g.displayName), 1),
|
|
149
|
-
r("p", Gs, P((M = p.value) == null ? void 0 : M.email), 1),
|
|
150
|
-
r("p", Ws, P((X = p.value) == null ? void 0 : X.phoneNumber), 1)
|
|
151
|
-
])
|
|
152
|
-
])) : J("", !0),
|
|
153
|
-
E.value ? (h(), A("div", Js, [
|
|
154
|
-
u(l, {
|
|
155
|
-
label: o(a)("team.memberForm.searchUser.changeUser"),
|
|
156
|
-
variant: "secondary",
|
|
157
|
-
onClick: T
|
|
158
|
-
}, null, 8, ["label"])
|
|
159
|
-
])) : J("", !0)
|
|
160
|
-
]);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
}), Zs = /* @__PURE__ */ cs(Xs, [["__scopeId", "data-v-c2c7ed35"]]), Qs = { class: "flex flex-col gap-40" }, Ys = { class: "flex items-center" }, Hs = { class: "flex-1 flex flex-col" }, et = { class: "fm-typo-en-title-sm-600" }, st = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, tt = { class: "flex flex-row gap-16" }, at = { class: "flex flex-col gap-8" }, lt = { class: "fm-typo-en-body-lg-400" }, ot = { class: "space-y-16 rounded-lg border border-fm-color-neutral-gray-200 p-16" }, nt = { class: "fm-typo-en-title-sm-600" }, rt = { class: "space-y-16" }, it = { class: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] gap-16" }, ut = { class: "text-sm font-semibold text-fm-color-typo-primary" }, mt = { class: "text-sm font-semibold text-fm-color-typo-primary" }, dt = { class: "flex justify-self-end" }, ct = ["aria-label", "onClick", "onKeydown"], Ae = 4, pt = /* @__PURE__ */ Se({
|
|
164
|
-
__name: "TeamMemberMasterUser",
|
|
165
|
-
props: {
|
|
166
|
-
modelValue: {
|
|
167
|
-
type: Object,
|
|
168
|
-
default: void 0
|
|
169
|
-
},
|
|
170
|
-
fallbackName: {
|
|
171
|
-
type: String,
|
|
172
|
-
required: !0
|
|
173
|
-
},
|
|
174
|
-
fallbackPasscode: {
|
|
175
|
-
type: String,
|
|
176
|
-
default: void 0
|
|
177
|
-
},
|
|
178
|
-
restaurants: {
|
|
179
|
-
type: Array,
|
|
180
|
-
required: !0
|
|
181
|
-
},
|
|
182
|
-
roles: {
|
|
183
|
-
type: Array,
|
|
184
|
-
required: !0
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
emits: ["update:model-value"],
|
|
188
|
-
setup(m, { emit: O }) {
|
|
189
|
-
const n = m, a = O, { t: d } = Ve(), R = v(!0), C = v([]);
|
|
190
|
-
function x() {
|
|
191
|
-
return { restaurantId: "", roleId: "" };
|
|
192
|
-
}
|
|
193
|
-
const B = w(
|
|
194
|
-
() => {
|
|
195
|
-
var i;
|
|
196
|
-
return ((i = n.modelValue) == null ? void 0 : i.roles.map((l) => l.restaurantId).filter(Boolean)) ?? [];
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
function p(i) {
|
|
200
|
-
i ? n.modelValue || a("update:model-value", {
|
|
201
|
-
code: "",
|
|
202
|
-
name: n.fallbackName,
|
|
203
|
-
roles: [x()],
|
|
204
|
-
passcode: n.fallbackPasscode || ""
|
|
205
|
-
}) : a("update:model-value", null);
|
|
206
|
-
}
|
|
207
|
-
function b(i, l) {
|
|
208
|
-
if (!n.modelValue || i === "passcode" && n.modelValue.passcode === l) return;
|
|
209
|
-
const g = pe(n.modelValue);
|
|
210
|
-
g[i] = l, a("update:model-value", g);
|
|
211
|
-
}
|
|
212
|
-
function ee(i = "") {
|
|
213
|
-
return n.restaurants.filter((l) => l.managable || l._id === i).map((l) => ({
|
|
214
|
-
label: `${l.profile.code ? `${l.profile.code} - ` : ""}${l.profile.name}`,
|
|
215
|
-
value: l._id,
|
|
216
|
-
disabled: B.value.includes(l._id) && l._id !== i
|
|
217
|
-
}));
|
|
218
|
-
}
|
|
219
|
-
function E(i = "") {
|
|
220
|
-
return n.roles.map((l) => ({
|
|
221
|
-
label: l.label,
|
|
222
|
-
value: l.value,
|
|
223
|
-
disabled: !!l.disabled && l.value !== i
|
|
224
|
-
}));
|
|
225
|
-
}
|
|
226
|
-
function oe(i, l) {
|
|
227
|
-
var K, L, z;
|
|
228
|
-
if (!n.modelValue) return;
|
|
229
|
-
const g = n.modelValue.roles.length > 0 ? [...n.modelValue.roles] : [x()], M = ((K = g[i]) == null ? void 0 : K.roleId) ?? "", X = E(M), j = ((L = X.find((c) => c.value === M && !c.disabled)) == null ? void 0 : L.value) ?? ((z = X.find((c) => !c.disabled)) == null ? void 0 : z.value) ?? "";
|
|
230
|
-
g[i] = { restaurantId: l, roleId: j }, b("roles", g);
|
|
231
|
-
}
|
|
232
|
-
function T(i, l) {
|
|
233
|
-
var M;
|
|
234
|
-
if (!n.modelValue) return;
|
|
235
|
-
const g = n.modelValue.roles.length > 0 ? [...n.modelValue.roles] : [x()];
|
|
236
|
-
g[i] = {
|
|
237
|
-
restaurantId: ((M = g[i]) == null ? void 0 : M.restaurantId) ?? "",
|
|
238
|
-
roleId: l
|
|
239
|
-
}, b("roles", g);
|
|
240
|
-
}
|
|
241
|
-
function V() {
|
|
242
|
-
n.modelValue && b("roles", [...n.modelValue.roles, x()]);
|
|
243
|
-
}
|
|
244
|
-
function _(i) {
|
|
245
|
-
if (!n.modelValue) return;
|
|
246
|
-
const l = n.modelValue.roles.length > 0 ? [...n.modelValue.roles] : [x()];
|
|
247
|
-
b(
|
|
248
|
-
"roles",
|
|
249
|
-
l.length === 1 ? [x()] : l.filter((g, M) => M !== i)
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
const D = w(() => {
|
|
253
|
-
if (!n.modelValue) return !1;
|
|
254
|
-
const i = n.restaurants.some(
|
|
255
|
-
(g) => g.managable && !B.value.includes(g._id)
|
|
256
|
-
), l = n.modelValue.roles.every(
|
|
257
|
-
(g) => g.restaurantId && g.roleId
|
|
258
|
-
);
|
|
259
|
-
return i && l;
|
|
260
|
-
});
|
|
261
|
-
function q() {
|
|
262
|
-
R.value && (R.value = !1, C.value = [], b("passcode", ""));
|
|
263
|
-
}
|
|
264
|
-
me(
|
|
265
|
-
() => {
|
|
266
|
-
var i;
|
|
267
|
-
return (i = n.modelValue) == null ? void 0 : i.passcode;
|
|
268
|
-
},
|
|
269
|
-
(i) => {
|
|
270
|
-
i && i.length === Ae ? (C.value = i.split(""), R.value = !0) : (C.value = [], R.value = !1);
|
|
271
|
-
},
|
|
272
|
-
{ immediate: !0 }
|
|
273
|
-
), me(
|
|
274
|
-
() => {
|
|
275
|
-
var i;
|
|
276
|
-
return (i = n.modelValue) == null ? void 0 : i.roles;
|
|
277
|
-
},
|
|
278
|
-
(i) => {
|
|
279
|
-
n.modelValue && (!i || i.length === 0) && b("roles", [x()]);
|
|
280
|
-
},
|
|
281
|
-
{ immediate: !0, deep: !0 }
|
|
282
|
-
);
|
|
283
|
-
const ae = w({
|
|
284
|
-
get: () => {
|
|
285
|
-
var i;
|
|
286
|
-
return ((i = n.modelValue) == null ? void 0 : i.roles) ?? [];
|
|
287
|
-
},
|
|
288
|
-
set: () => {
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
return (i, l) => {
|
|
292
|
-
const g = S("FmSwitch"), M = S("FmTextField"), X = S("FmPinField"), j = S("FmFormGroup"), K = S("FmSelect"), L = S("FmIcon"), z = S("FmButton");
|
|
293
|
-
return h(), A("div", Qs, [
|
|
294
|
-
r("div", Ys, [
|
|
295
|
-
r("div", Hs, [
|
|
296
|
-
r("div", et, P(o(d)("team.memberForm.masterUser.title")), 1),
|
|
297
|
-
r("div", st, P(o(d)("team.memberForm.masterUser.sublabel")), 1)
|
|
298
|
-
]),
|
|
299
|
-
r("div", null, [
|
|
300
|
-
u(g, {
|
|
301
|
-
"model-value": !!m.modelValue,
|
|
302
|
-
value: "master-user",
|
|
303
|
-
"onUpdate:modelValue": p
|
|
304
|
-
}, null, 8, ["model-value"])
|
|
305
|
-
])
|
|
306
|
-
]),
|
|
307
|
-
m.modelValue ? (h(), A(ke, { key: 0 }, [
|
|
308
|
-
r("div", tt, [
|
|
309
|
-
u(M, {
|
|
310
|
-
"model-value": m.modelValue.code,
|
|
311
|
-
label: o(d)("team.memberForm.masterUser.code"),
|
|
312
|
-
"onUpdate:modelValue": l[0] || (l[0] = (c) => b("code", c))
|
|
313
|
-
}, null, 8, ["model-value", "label"]),
|
|
314
|
-
u(M, {
|
|
315
|
-
"model-value": m.modelValue.name,
|
|
316
|
-
class: "w-full",
|
|
317
|
-
label: o(d)("team.memberForm.masterUser.name"),
|
|
318
|
-
rules: [(c) => !!c || o(d)("team.memberForm.masterUser.nameEmptyError")],
|
|
319
|
-
"onUpdate:modelValue": l[1] || (l[1] = (c) => b("name", c))
|
|
320
|
-
}, null, 8, ["model-value", "label", "rules"])
|
|
321
|
-
]),
|
|
322
|
-
r("div", at, [
|
|
323
|
-
r("div", lt, P(o(d)("team.memberForm.masterUser.passcode")), 1),
|
|
324
|
-
u(j, {
|
|
325
|
-
modelValue: C.value,
|
|
326
|
-
"onUpdate:modelValue": l[4] || (l[4] = (c) => C.value = c),
|
|
327
|
-
rules: [
|
|
328
|
-
(c) => (c == null ? void 0 : c.filter((y) => !!y).length) !== Ae ? o(d)("team.memberForm.masterUser.passcodeRequired") : !0
|
|
329
|
-
]
|
|
330
|
-
}, {
|
|
331
|
-
default: ue(() => [
|
|
332
|
-
(h(), H(X, {
|
|
333
|
-
key: `pin-field-${R.value}`,
|
|
334
|
-
modelValue: C.value,
|
|
335
|
-
"onUpdate:modelValue": l[2] || (l[2] = (c) => C.value = c),
|
|
336
|
-
length: Ae,
|
|
337
|
-
masked: R.value,
|
|
338
|
-
onComplete: l[3] || (l[3] = (c) => b("passcode", c)),
|
|
339
|
-
onFocus: q
|
|
340
|
-
}, null, 8, ["modelValue", "masked"]))
|
|
341
|
-
]),
|
|
342
|
-
_: 1
|
|
343
|
-
}, 8, ["modelValue", "rules"])
|
|
344
|
-
]),
|
|
345
|
-
u(j, {
|
|
346
|
-
tag: "div",
|
|
347
|
-
modelValue: ae.value,
|
|
348
|
-
"onUpdate:modelValue": l[5] || (l[5] = (c) => ae.value = c),
|
|
349
|
-
rules: [
|
|
350
|
-
(c) => !c || c.length === 0 || c.every((y) => !y.restaurantId) ? o(d)("team.memberForm.masterUser.restaurantRequired") : c.some((y) => !y.restaurantId || !y.roleId) ? o(d)("team.memberForm.masterUser.roleRequired") : !0
|
|
351
|
-
]
|
|
352
|
-
}, {
|
|
353
|
-
default: ue(() => [
|
|
354
|
-
r("div", ot, [
|
|
355
|
-
r("div", nt, P(o(d)("team.memberForm.masterUser.assignmentSection")), 1),
|
|
356
|
-
r("div", rt, [
|
|
357
|
-
r("div", it, [
|
|
358
|
-
r("div", ut, P(o(d)("team.table.columns.restaurant")), 1),
|
|
359
|
-
r("div", mt, P(o(d)("team.memberForm.masterUser.role")), 1),
|
|
360
|
-
l[6] || (l[6] = r("div", null, null, -1))
|
|
361
|
-
]),
|
|
362
|
-
(h(!0), A(ke, null, as(m.modelValue.roles, (c, y) => (h(), A("div", {
|
|
363
|
-
key: `${c.restaurantId || "new"}-${y}`,
|
|
364
|
-
class: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-16"
|
|
365
|
-
}, [
|
|
366
|
-
u(K, {
|
|
367
|
-
class: "min-w-0",
|
|
368
|
-
"model-value": c.restaurantId,
|
|
369
|
-
items: ee(c.restaurantId),
|
|
370
|
-
multiselect: !1,
|
|
371
|
-
placeholder: o(d)("team.table.columns.restaurant"),
|
|
372
|
-
"onUpdate:modelValue": (G) => oe(y, G)
|
|
373
|
-
}, null, 8, ["model-value", "items", "placeholder", "onUpdate:modelValue"]),
|
|
374
|
-
u(K, {
|
|
375
|
-
class: "min-w-0",
|
|
376
|
-
"model-value": c.roleId,
|
|
377
|
-
items: E(c.roleId),
|
|
378
|
-
multiselect: !1,
|
|
379
|
-
placeholder: o(d)("team.memberForm.masterUser.role"),
|
|
380
|
-
disabled: !c.restaurantId,
|
|
381
|
-
"onUpdate:modelValue": (G) => T(y, G)
|
|
382
|
-
}, null, 8, ["model-value", "items", "placeholder", "disabled", "onUpdate:modelValue"]),
|
|
383
|
-
r("div", dt, [
|
|
384
|
-
m.modelValue.roles.length > 1 ? (h(), A("div", {
|
|
385
|
-
key: 0,
|
|
386
|
-
role: "button",
|
|
387
|
-
tabindex: "0",
|
|
388
|
-
class: "inline-flex h-40 w-40 shrink-0 cursor-pointer items-center justify-center rounded-lg text-fm-color-neutral-gray-400 transition-colors hover:bg-fm-color-neutral-gray-100 focus:outline-none focus:ring-2 focus:ring-fm-color-primary",
|
|
389
|
-
"aria-label": o(d)("common.remove"),
|
|
390
|
-
onClick: Fe((G) => _(y), ["stop"]),
|
|
391
|
-
onKeydown: [
|
|
392
|
-
Be(Fe((G) => _(y), ["prevent", "stop"]), ["enter"]),
|
|
393
|
-
Be(Fe((G) => _(y), ["prevent", "stop"]), ["space"])
|
|
394
|
-
]
|
|
395
|
-
}, [
|
|
396
|
-
u(L, {
|
|
397
|
-
name: "delete",
|
|
398
|
-
size: "md"
|
|
399
|
-
})
|
|
400
|
-
], 40, ct)) : J("", !0)
|
|
401
|
-
])
|
|
402
|
-
]))), 128))
|
|
403
|
-
]),
|
|
404
|
-
u(z, {
|
|
405
|
-
type: "button",
|
|
406
|
-
variant: "secondary",
|
|
407
|
-
"text-color": "primary",
|
|
408
|
-
"border-color": "primary",
|
|
409
|
-
"prepend-icon": "add",
|
|
410
|
-
label: o(d)("team.memberForm.masterUser.addAnother"),
|
|
411
|
-
size: "md",
|
|
412
|
-
disabled: !D.value,
|
|
413
|
-
onClick: Fe(V, ["stop"])
|
|
414
|
-
}, null, 8, ["label", "disabled"])
|
|
415
|
-
])
|
|
416
|
-
]),
|
|
417
|
-
_: 1
|
|
418
|
-
}, 8, ["modelValue", "rules"])
|
|
419
|
-
], 64)) : J("", !0)
|
|
420
|
-
]);
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
}), vt = { class: "flex flex-col gap-32" }, ft = { class: "flex w-full" }, bt = {
|
|
424
|
-
key: 0,
|
|
425
|
-
class: "space-y-24"
|
|
426
|
-
}, _t = { class: "space-y-16 rounded-lg border border-fm-color-neutral-gray-200 p-16" }, yt = { class: "fm-typo-en-title-sm-600" }, ht = { class: "space-y-16" }, gt = { class: "fm-typo-en-title-sm-600" }, xt = {
|
|
427
|
-
key: 1,
|
|
428
|
-
class: "flex items-center justify-center py-64"
|
|
429
|
-
}, Ut = /* @__PURE__ */ Se({
|
|
430
|
-
__name: "AddMemberForm",
|
|
431
|
-
props: {
|
|
432
|
-
initialValue: {
|
|
433
|
-
type: Object
|
|
434
|
-
},
|
|
435
|
-
roleErrorMessage: {
|
|
436
|
-
type: String,
|
|
437
|
-
default: ""
|
|
438
|
-
},
|
|
439
|
-
loading: {
|
|
440
|
-
type: Boolean,
|
|
441
|
-
default: !1
|
|
442
|
-
}
|
|
443
|
-
},
|
|
444
|
-
setup(m, { expose: O }) {
|
|
445
|
-
var ve, he, ge;
|
|
446
|
-
const n = m, { t: a } = Ve(), d = v(), R = Ze(), C = w(
|
|
447
|
-
() => R.permissionSets.value.map((t) => ({
|
|
448
|
-
label: t.name,
|
|
449
|
-
value: t.id
|
|
450
|
-
}))
|
|
451
|
-
), x = v(((ve = n.initialValue) == null ? void 0 : ve.permissionSetIds) || []), B = w(
|
|
452
|
-
() => Te(x.value, R.permissionSets.value)
|
|
453
|
-
), p = v((he = n.initialValue) == null ? void 0 : he.posUser), b = v(
|
|
454
|
-
qe(
|
|
455
|
-
Ie(B.value),
|
|
456
|
-
((ge = n.initialValue) == null ? void 0 : ge.permissions) || []
|
|
457
|
-
)
|
|
458
|
-
), { customReportPermissions: ee, isLoaded: E } = Qe(), oe = new Set(
|
|
459
|
-
Ke.filter((t) => t.subject.startsWith(xs)).map((t) => t.subject)
|
|
460
|
-
), T = w(() => {
|
|
461
|
-
const t = new Set(oe);
|
|
462
|
-
for (const f of ee.value) t.add(f.subject);
|
|
463
|
-
return t;
|
|
464
|
-
}), V = w(() => {
|
|
465
|
-
const t = /* @__PURE__ */ new Set();
|
|
466
|
-
for (const f of Ke)
|
|
467
|
-
f.category === Ee.reports && t.add(f.subject);
|
|
468
|
-
for (const f of ee.value)
|
|
469
|
-
f.category === Ee.reports && t.add(f.subject);
|
|
470
|
-
return t;
|
|
471
|
-
}), _ = Xe(), D = Ye().roles, q = w(() => ze(b.value)), ae = w(() => {
|
|
472
|
-
const t = Ge(b.value);
|
|
473
|
-
return t === null ? _.restaurants.value : _.restaurants.value.filter((f) => t.includes(f._id));
|
|
474
|
-
}), i = w(() => {
|
|
475
|
-
const t = q.value;
|
|
476
|
-
return D.value.map(
|
|
477
|
-
(f) => ({
|
|
478
|
-
label: f.name,
|
|
479
|
-
value: f._id,
|
|
480
|
-
disabled: !!t && !t.includes(f._id)
|
|
481
|
-
})
|
|
482
|
-
);
|
|
483
|
-
}), l = v({ permissionSetIds: [], userPermissions: [], posUser: void 0 });
|
|
484
|
-
function g(t) {
|
|
485
|
-
d.value = void 0, x.value = [...(t == null ? void 0 : t.permissionSetIds) ?? []], b.value = qe(
|
|
486
|
-
Ie(
|
|
487
|
-
Te(
|
|
488
|
-
x.value,
|
|
489
|
-
R.permissionSets.value
|
|
490
|
-
)
|
|
491
|
-
),
|
|
492
|
-
(t == null ? void 0 : t.permissions) || []
|
|
493
|
-
), p.value = t != null && t.posUser ? y(pe(t.posUser), b.value) : void 0, G.value = !!p.value, l.value = {
|
|
494
|
-
permissionSetIds: [...x.value],
|
|
495
|
-
userPermissions: pe(b.value),
|
|
496
|
-
posUser: p.value ? pe(p.value) : void 0
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
function M() {
|
|
500
|
-
return !n.initialValue && d.value ? !0 : !De.isEqual(x.value, l.value.permissionSetIds) || !De.isEqual(b.value, l.value.userPermissions) || !De.isEqual(p.value, l.value.posUser);
|
|
501
|
-
}
|
|
502
|
-
function X(t) {
|
|
503
|
-
d.value = t;
|
|
504
|
-
}
|
|
505
|
-
function j(t) {
|
|
506
|
-
p.value = y(p.value, t);
|
|
507
|
-
}
|
|
508
|
-
function K() {
|
|
509
|
-
const t = Ie(B.value), f = E.value ? T.value : oe, I = Us(b.value, f), k = Fs(I, V.value), $ = Ss(k);
|
|
510
|
-
return Vs(t, $);
|
|
511
|
-
}
|
|
512
|
-
function L() {
|
|
513
|
-
var I, k, $, Z, re, ie, de, se, Q, ce;
|
|
514
|
-
const t = K(), f = b.value.filter((Y) => !Y.inverted);
|
|
515
|
-
return {
|
|
516
|
-
email: ((I = d.value) == null ? void 0 : I.email) ?? void 0,
|
|
517
|
-
phoneNumber: ((k = d.value) == null ? void 0 : k.phoneNumber) ?? void 0,
|
|
518
|
-
customPermissions: t,
|
|
519
|
-
permissions: f.map((Y) => ({
|
|
520
|
-
...Y,
|
|
521
|
-
subject: ps(Y.subject)
|
|
522
|
-
})),
|
|
523
|
-
permissionSetIds: x.value,
|
|
524
|
-
name: (($ = d.value) == null ? void 0 : $.displayName) || ((Z = n.initialValue) == null ? void 0 : Z.name) || "",
|
|
525
|
-
posUser: p.value ? {
|
|
526
|
-
...p.value,
|
|
527
|
-
name: p.value.name || ((ie = (re = n.initialValue) == null ? void 0 : re.posUser) == null ? void 0 : ie.name) || ((de = n.initialValue) == null ? void 0 : de.name) || ((se = d.value) == null ? void 0 : se.displayName) || "",
|
|
528
|
-
code: p.value.code || ((ce = (Q = n.initialValue) == null ? void 0 : Q.posUser) == null ? void 0 : ce.code) || "",
|
|
529
|
-
passcode: p.value.passcode,
|
|
530
|
-
roles: p.value.roles.filter((Y) => !!Y.roleId)
|
|
531
|
-
} : p.value === null ? null : void 0
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
const z = v();
|
|
535
|
-
function c() {
|
|
536
|
-
b.value = Ie(B.value);
|
|
537
|
-
}
|
|
538
|
-
function y(t, f) {
|
|
539
|
-
if (!t) return t;
|
|
540
|
-
const I = ze(f), k = Ge(f);
|
|
541
|
-
if (I === null && k === null) return t;
|
|
542
|
-
const $ = pe(t);
|
|
543
|
-
return $.roles = $.roles.filter(
|
|
544
|
-
(Z) => (I === null || I.includes(Z.roleId)) && (k === null || k.includes(Z.restaurantId))
|
|
545
|
-
), $;
|
|
546
|
-
}
|
|
547
|
-
const G = v(!!p.value), ye = v(!1);
|
|
548
|
-
function Re(t) {
|
|
549
|
-
p.value = t, ye.value = !0;
|
|
550
|
-
}
|
|
551
|
-
me(
|
|
552
|
-
() => !!p.value,
|
|
553
|
-
async (t) => {
|
|
554
|
-
t && !G.value && (await ls(), z.value && z.value.$el.scrollIntoView({ behavior: "smooth", block: "start" })), G.value = t;
|
|
555
|
-
}
|
|
556
|
-
);
|
|
557
|
-
const ne = v();
|
|
558
|
-
async function we() {
|
|
559
|
-
return (await ne.value.validateInputsWithoutSubmit()).length ? null : L();
|
|
560
|
-
}
|
|
561
|
-
return me(
|
|
562
|
-
() => n.initialValue,
|
|
563
|
-
(t, f) => {
|
|
564
|
-
if (!f || !t) {
|
|
565
|
-
ye.value = !1, g(t);
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
t.posUser !== void 0 && !ye.value && (p.value = t.posUser ? y(pe(t.posUser), b.value) : void 0, l.value = {
|
|
569
|
-
...l.value,
|
|
570
|
-
posUser: p.value ? pe(p.value) : void 0
|
|
571
|
-
});
|
|
572
|
-
},
|
|
573
|
-
{ immediate: !0 }
|
|
574
|
-
), me(
|
|
575
|
-
b,
|
|
576
|
-
(t) => {
|
|
577
|
-
p.value = y(p.value, t);
|
|
578
|
-
},
|
|
579
|
-
{ deep: !0 }
|
|
580
|
-
), O({
|
|
581
|
-
readFormData: L,
|
|
582
|
-
validate: we,
|
|
583
|
-
isModified: M
|
|
584
|
-
}), (t, f) => {
|
|
585
|
-
const I = S("FmSelect"), k = S("FmCircularProgress"), $ = S("FmForm");
|
|
586
|
-
return h(), H($, {
|
|
587
|
-
ref_key: "formRef",
|
|
588
|
-
ref: ne,
|
|
589
|
-
class: "mx-4"
|
|
590
|
-
}, {
|
|
591
|
-
default: ue(() => {
|
|
592
|
-
var Z, re, ie, de, se;
|
|
593
|
-
return [
|
|
594
|
-
r("div", vt, [
|
|
595
|
-
r("div", ft, [
|
|
596
|
-
m.initialValue ? (h(), H(Es, {
|
|
597
|
-
key: 1,
|
|
598
|
-
data: m.initialValue
|
|
599
|
-
}, null, 8, ["data"])) : (h(), H(Zs, {
|
|
600
|
-
key: 0,
|
|
601
|
-
onInvite: f[0] || (f[0] = (Q) => X(Q))
|
|
602
|
-
}))
|
|
603
|
-
]),
|
|
604
|
-
d.value || m.initialValue ? (h(), A(ke, { key: 0 }, [
|
|
605
|
-
(Z = m.initialValue) != null && Z.isOwner ? J("", !0) : (h(), A("div", bt, [
|
|
606
|
-
r("div", _t, [
|
|
607
|
-
r("div", yt, P(o(a)("team.memberForm.permissionSet.title")), 1),
|
|
608
|
-
u(I, {
|
|
609
|
-
modelValue: x.value,
|
|
610
|
-
"onUpdate:modelValue": [
|
|
611
|
-
f[1] || (f[1] = (Q) => x.value = Q),
|
|
612
|
-
c
|
|
613
|
-
],
|
|
614
|
-
multiselect: "",
|
|
615
|
-
searchable: "",
|
|
616
|
-
"search-debounce": 300,
|
|
617
|
-
items: C.value,
|
|
618
|
-
placeholder: o(a)("team.memberForm.permissionSet.selectPlaceholder")
|
|
619
|
-
}, null, 8, ["modelValue", "items", "placeholder"])
|
|
620
|
-
]),
|
|
621
|
-
r("div", ht, [
|
|
622
|
-
r("div", gt, P(o(a)("team.memberForm.permissions.title")), 1),
|
|
623
|
-
u(Ps, {
|
|
624
|
-
modelValue: b.value,
|
|
625
|
-
"onUpdate:modelValue": f[2] || (f[2] = (Q) => b.value = Q),
|
|
626
|
-
"inherit-permissions": B.value,
|
|
627
|
-
onPermissionChanged: j
|
|
628
|
-
}, null, 8, ["modelValue", "inherit-permissions"])
|
|
629
|
-
])
|
|
630
|
-
])),
|
|
631
|
-
m.loading ? (h(), A("div", xt, [
|
|
632
|
-
u(k, { size: "xl" })
|
|
633
|
-
])) : (h(), H(pt, {
|
|
634
|
-
key: 2,
|
|
635
|
-
ref_key: "masterUserContentRef",
|
|
636
|
-
ref: z,
|
|
637
|
-
"model-value": p.value,
|
|
638
|
-
"fallback-name": ((re = m.initialValue) == null ? void 0 : re.name) || ((ie = d.value) == null ? void 0 : ie.displayName) || "",
|
|
639
|
-
"fallback-passcode": (se = (de = m.initialValue) == null ? void 0 : de.posUser) == null ? void 0 : se.passcode,
|
|
640
|
-
roles: i.value,
|
|
641
|
-
restaurants: ae.value,
|
|
642
|
-
"onUpdate:modelValue": Re
|
|
643
|
-
}, null, 8, ["model-value", "fallback-name", "fallback-passcode", "roles", "restaurants"]))
|
|
644
|
-
], 64)) : J("", !0)
|
|
645
|
-
])
|
|
646
|
-
];
|
|
647
|
-
}),
|
|
648
|
-
_: 1
|
|
649
|
-
}, 512);
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
}), Ft = {
|
|
653
|
-
class: "space-y-24"
|
|
654
|
-
}, St = {
|
|
655
|
-
class: "space-y-8"
|
|
656
|
-
}, Vt = {
|
|
657
|
-
key: 0,
|
|
658
|
-
class: "flex w-full items-start justify-between px-16"
|
|
659
|
-
}, wt = {
|
|
660
|
-
class: "flex items-start gap-8"
|
|
661
|
-
}, Pt = {
|
|
662
|
-
key: 1,
|
|
663
|
-
class: "space-y-4 px-16"
|
|
664
|
-
}, It = {
|
|
665
|
-
class: "flex items-start gap-8"
|
|
666
|
-
}, kt = {
|
|
667
|
-
class: "flex h-full flex-col"
|
|
668
|
-
}, $t = {
|
|
669
|
-
class: "flex w-full items-center justify-between"
|
|
670
|
-
}, Rt = {
|
|
671
|
-
class: "fm-typo-en-title-md-600"
|
|
672
|
-
}, Ct = {
|
|
673
|
-
class: "flex items-center justify-start gap-8"
|
|
674
|
-
}, be = 100;
|
|
675
|
-
var te = /* @__PURE__ */ function(m) {
|
|
676
|
-
return m[m.ADD = 0] = "ADD", m[m.UPDATE = 1] = "UPDATE", m[m.CLOSED = 2] = "CLOSED", m;
|
|
677
|
-
}(te || {});
|
|
678
|
-
const Jt = /* @__PURE__ */ Se({
|
|
679
|
-
__name: "TeamMemberList",
|
|
680
|
-
setup(m, {
|
|
681
|
-
expose: O
|
|
682
|
-
}) {
|
|
683
|
-
const {
|
|
684
|
-
fetchCustomReportPermissions: n
|
|
685
|
-
} = Qe(), {
|
|
686
|
-
t: a
|
|
687
|
-
} = Ve(), d = $e(), R = Xe(), C = Ye(), x = Je(), B = gs(x), p = Ze(), b = ws(), ee = v(!0), E = v(!1), oe = w(() => R.isLoading.value), T = v([]), V = v(0), _ = v(1), D = v(""), q = v("");
|
|
688
|
-
me(R.restaurants, (e) => {
|
|
689
|
-
if (e.length > 0 && T.value.length > 0) {
|
|
690
|
-
const s = new Map(e.map((F) => [F._id, F.profile.name])), U = e.map((F) => F.profile.name).sort();
|
|
691
|
-
T.value = T.value.map((F) => ({
|
|
692
|
-
...F,
|
|
693
|
-
restaurants: F.managableRestaurantIds === null ? U : F.managableRestaurantIds.map((W) => s.get(W) ?? "").filter(Boolean).sort()
|
|
694
|
-
}));
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
const ae = w(() => R.restaurants.value.map((e) => ({
|
|
698
|
-
label: `${e.profile.code ? `${e.profile.code} - ` : ""}${e.profile.name}`,
|
|
699
|
-
value: e._id
|
|
700
|
-
}))), i = ({
|
|
701
|
-
member: e,
|
|
702
|
-
className: s = ""
|
|
703
|
-
}) => {
|
|
704
|
-
const U = {
|
|
705
|
-
label: a("team.actions.updateMember"),
|
|
706
|
-
onClick: () => z(_e.Update, e)
|
|
707
|
-
}, F = {
|
|
708
|
-
label: a("team.actions.removeMember"),
|
|
709
|
-
onClick: () => z(_e.Remove, e),
|
|
710
|
-
itemClass: "text-fm-color-typo-error"
|
|
711
|
-
}, W = e.doc.isOwner ? [U] : [U, F];
|
|
712
|
-
return u(ys, {
|
|
713
|
-
class: s,
|
|
714
|
-
items: W
|
|
715
|
-
}, null);
|
|
716
|
-
}, l = (e) => e.doc.isOwner ? a("team.labels.businessOwner") : e.restaurants.join(", "), g = [{
|
|
717
|
-
accessorKey: "name",
|
|
718
|
-
header: () => a("team.table.columns.name"),
|
|
719
|
-
enableSorting: !1,
|
|
720
|
-
cell(e) {
|
|
721
|
-
const s = e.row.original;
|
|
722
|
-
return u("div", {
|
|
723
|
-
class: "flex items-center gap-8"
|
|
724
|
-
}, [u(Ne.FmAvatar, {
|
|
725
|
-
initials: s.name,
|
|
726
|
-
size: "sm",
|
|
727
|
-
class: "shrink-0"
|
|
728
|
-
}, null), u("span", {
|
|
729
|
-
class: "truncate"
|
|
730
|
-
}, [s.name])]);
|
|
731
|
-
}
|
|
732
|
-
}, {
|
|
733
|
-
accessorKey: "phoneNumber",
|
|
734
|
-
header: () => a("team.table.columns.phoneNumber"),
|
|
735
|
-
enableSorting: !1
|
|
736
|
-
}, {
|
|
737
|
-
accessorKey: "restaurant",
|
|
738
|
-
header: () => a("team.table.columns.restaurant"),
|
|
739
|
-
enableSorting: !1,
|
|
740
|
-
cell(e) {
|
|
741
|
-
if (oe.value)
|
|
742
|
-
return ns(ds);
|
|
743
|
-
const s = e.row.original;
|
|
744
|
-
return l(s);
|
|
745
|
-
}
|
|
746
|
-
}, {
|
|
747
|
-
accessorKey: "assignedRoles",
|
|
748
|
-
header: () => a("team.table.columns.assignedRoles"),
|
|
749
|
-
enableSorting: !1,
|
|
750
|
-
cell(e) {
|
|
751
|
-
const s = e.row.original, U = b.getPermissionAssignmentByUserId(s.id), F = (U == null ? void 0 : U.permissionSetIds) || s.doc.permissionSetIds || [];
|
|
752
|
-
return p.permissionSets.value.filter((le) => F.includes(le.id)).map((le) => le.name).join(", ");
|
|
753
|
-
}
|
|
754
|
-
}, {
|
|
755
|
-
accessorKey: "permission",
|
|
756
|
-
header: () => a("team.table.columns.permission"),
|
|
757
|
-
enableSorting: !1,
|
|
758
|
-
cell(e) {
|
|
759
|
-
const s = e.row.original;
|
|
760
|
-
return M(s);
|
|
761
|
-
},
|
|
762
|
-
meta: {
|
|
763
|
-
width: "200px"
|
|
764
|
-
}
|
|
765
|
-
}, {
|
|
766
|
-
id: "action",
|
|
767
|
-
meta: {
|
|
768
|
-
cellClass: "pl-16",
|
|
769
|
-
headerContentClass: "-mx-16"
|
|
770
|
-
},
|
|
771
|
-
cell(e) {
|
|
772
|
-
const s = e.row.original;
|
|
773
|
-
return i({
|
|
774
|
-
member: s,
|
|
775
|
-
className: "flex justify-end w-full"
|
|
776
|
-
});
|
|
777
|
-
},
|
|
778
|
-
enableSorting: !1
|
|
779
|
-
}];
|
|
780
|
-
function M(e) {
|
|
781
|
-
if (e.doc.isOwner)
|
|
782
|
-
return a("team.labels.businessOwner");
|
|
783
|
-
const s = u(Ne.FmTooltip, {
|
|
784
|
-
variant: "plain",
|
|
785
|
-
placement: "top"
|
|
786
|
-
}, {
|
|
787
|
-
default: () => u(Ne.FmIcon, {
|
|
788
|
-
name: "info",
|
|
789
|
-
class: "cursor-pointer text-fm-color-neutral-gray-300"
|
|
790
|
-
}, null),
|
|
791
|
-
content: () => u("div", null, [a("team.labels.permission"), e.permissionLabels.map((U) => u("div", null, [rs("- "), U]))])
|
|
792
|
-
});
|
|
793
|
-
return u("div", {
|
|
794
|
-
class: "flex flex-row items-center gap-8"
|
|
795
|
-
}, [u("span", null, [a("team.labels.allowed", {
|
|
796
|
-
count: e.permissionLabels.length
|
|
797
|
-
})]), e.permissionLabels.length > 0 && s]);
|
|
798
|
-
}
|
|
799
|
-
function X(e) {
|
|
800
|
-
var W, le, Pe, xe;
|
|
801
|
-
const s = b.getPermissionAssignmentByUserId(e.id), U = (s == null ? void 0 : s.customPermissions) || e.permissions || [], F = (s == null ? void 0 : s.permissionSetIds) || [];
|
|
802
|
-
return {
|
|
803
|
-
id: e.id,
|
|
804
|
-
isOwner: e.doc.isOwner,
|
|
805
|
-
name: e.name,
|
|
806
|
-
phoneNumber: e.phoneNumber,
|
|
807
|
-
email: e.email,
|
|
808
|
-
permissions: U,
|
|
809
|
-
permissionSetIds: F,
|
|
810
|
-
posUser: e.doc.posUser ? {
|
|
811
|
-
code: ((W = e.doc.posUser) == null ? void 0 : W.code) ?? "",
|
|
812
|
-
name: ((le = e.doc.posUser) == null ? void 0 : le.name) ?? e.name,
|
|
813
|
-
passcode: ((Pe = e.doc.posUser) == null ? void 0 : Pe.passcode) ?? "",
|
|
814
|
-
roles: ((xe = e.doc.posUser) == null ? void 0 : xe.roles) ?? []
|
|
815
|
-
} : void 0
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
function j(e) {
|
|
819
|
-
const s = b.getPermissionAssignmentByUserId(e.id), U = (s == null ? void 0 : s.customPermissions) || e.permissions || [], F = (s == null ? void 0 : s.permissionSetIds) || [];
|
|
820
|
-
return {
|
|
821
|
-
id: e.id,
|
|
822
|
-
isOwner: e.doc.isOwner,
|
|
823
|
-
name: e.name,
|
|
824
|
-
phoneNumber: e.phoneNumber,
|
|
825
|
-
email: e.email,
|
|
826
|
-
permissions: U,
|
|
827
|
-
permissionSetIds: F,
|
|
828
|
-
posUser: void 0
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
const K = v(!1);
|
|
832
|
-
let L = 0;
|
|
833
|
-
const z = async (e, s) => {
|
|
834
|
-
if (e == _e.Update) {
|
|
835
|
-
const U = ++L;
|
|
836
|
-
ne.value = j(s), y.value = te.UPDATE, K.value = s.doc.hasPosUser === !0;
|
|
837
|
-
try {
|
|
838
|
-
const F = await Ue.readTeamMember(s.id);
|
|
839
|
-
if (U !== L) return;
|
|
840
|
-
ne.value = X(F);
|
|
841
|
-
} catch {
|
|
842
|
-
if (U !== L) return;
|
|
843
|
-
x.open({
|
|
844
|
-
message: a("common.error"),
|
|
845
|
-
type: "error"
|
|
846
|
-
}), he();
|
|
847
|
-
} finally {
|
|
848
|
-
U === L && (K.value = !1);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
e == _e.Remove && t(s);
|
|
852
|
-
}, c = is(), y = v(te.CLOSED), G = w(() => y.value !== te.CLOSED), ye = w(() => y.value === te.ADD ? a("common.add") : a("common.update")), Re = w(() => y.value === te.ADD ? a("team.actions.addMember") : a("team.actions.updateMember")), ne = v();
|
|
853
|
-
function we() {
|
|
854
|
-
L++, K.value = !1, y.value = te.CLOSED;
|
|
855
|
-
}
|
|
856
|
-
const ve = _s(() => {
|
|
857
|
-
var e;
|
|
858
|
-
return ((e = ce.value) == null ? void 0 : e.isModified()) ?? !1;
|
|
859
|
-
}, we);
|
|
860
|
-
function he() {
|
|
861
|
-
ve();
|
|
862
|
-
}
|
|
863
|
-
const {
|
|
864
|
-
breakpoints: ge
|
|
865
|
-
} = us(), t = (e) => {
|
|
866
|
-
c.open({
|
|
867
|
-
title: a("team.actions.removeMember"),
|
|
868
|
-
message: a("team.removeMember.confirmationMessage", {
|
|
869
|
-
memberName: e.name
|
|
870
|
-
}),
|
|
871
|
-
minWidth: ge.value.lg ? 588 : 0,
|
|
872
|
-
primaryActions: {
|
|
873
|
-
text: "Remove",
|
|
874
|
-
close: !1,
|
|
875
|
-
variant: "destructive",
|
|
876
|
-
isLoading: Ce
|
|
877
|
-
},
|
|
878
|
-
secondaryActions: {
|
|
879
|
-
text: "Cancel",
|
|
880
|
-
close: !0
|
|
881
|
-
}
|
|
882
|
-
}).onPrimary(async () => {
|
|
883
|
-
Ce.value || (await B.minor(async () => {
|
|
884
|
-
await Ue.deleteTeamMember(e.id), await Q();
|
|
885
|
-
}, {
|
|
886
|
-
isLoading: Ce,
|
|
887
|
-
successMessage: a("team.removeMember.successMessage", {
|
|
888
|
-
memberName: e.name
|
|
889
|
-
})
|
|
890
|
-
}), c.close());
|
|
891
|
-
});
|
|
892
|
-
}, f = () => {
|
|
893
|
-
ne.value = null, y.value = te.ADD;
|
|
894
|
-
}, I = v(), k = v(), $ = v(), Z = w(() => {
|
|
895
|
-
var e;
|
|
896
|
-
return JSON.stringify({
|
|
897
|
-
businessId: ((e = d.currentBusiness.value) == null ? void 0 : e._id) ?? "",
|
|
898
|
-
search: q.value.trim(),
|
|
899
|
-
restaurantIds: [...I.value ?? []].sort(),
|
|
900
|
-
permissionSubjects: [...k.value ?? []].sort(),
|
|
901
|
-
permissionSetIds: [...$.value ?? []].sort()
|
|
902
|
-
});
|
|
903
|
-
}), re = w(() => Object.values(vs).map((e) => ({
|
|
904
|
-
label: e.label,
|
|
905
|
-
value: e.subject
|
|
906
|
-
}))), ie = w(() => p.permissionSets.value.map((e) => ({
|
|
907
|
-
label: e.name,
|
|
908
|
-
value: e.id
|
|
909
|
-
})));
|
|
910
|
-
async function de() {
|
|
911
|
-
await C.readRoles();
|
|
912
|
-
}
|
|
913
|
-
async function se(e = _.value) {
|
|
914
|
-
var s, U, F;
|
|
915
|
-
ee.value = !0;
|
|
916
|
-
try {
|
|
917
|
-
const W = await Ue.readTeamMembersPage({
|
|
918
|
-
limit: be,
|
|
919
|
-
offset: (e - 1) * be,
|
|
920
|
-
search: q.value.trim() || void 0,
|
|
921
|
-
restaurantIds: (s = I.value) != null && s.length ? I.value : void 0,
|
|
922
|
-
permissionSubjects: (U = k.value) != null && U.length ? k.value : void 0,
|
|
923
|
-
permissionSetIds: (F = $.value) != null && F.length ? $.value : void 0
|
|
924
|
-
});
|
|
925
|
-
T.value = W.items, V.value = W.total;
|
|
926
|
-
} finally {
|
|
927
|
-
ee.value = !1;
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
async function Q() {
|
|
931
|
-
var s;
|
|
932
|
-
if (!((s = d.currentBusiness.value) != null && s._id)) return;
|
|
933
|
-
await se(_.value);
|
|
934
|
-
const e = Math.max(1, Math.ceil(V.value / be));
|
|
935
|
-
_.value > e && (_.value = e, await se(_.value));
|
|
936
|
-
}
|
|
937
|
-
const ce = v(), Y = v(!1), Ce = v(!1);
|
|
938
|
-
async function He() {
|
|
939
|
-
if (!ce.value) return;
|
|
940
|
-
const e = await ce.value.validate();
|
|
941
|
-
if (!e) return;
|
|
942
|
-
const s = y.value === te.ADD;
|
|
943
|
-
await B.minor(async () => {
|
|
944
|
-
await (s ? Ue.createTeamMember(e) : Ue.updateTeamMember(ne.value.id, e)), we(), await Oe(), await Q();
|
|
945
|
-
}, {
|
|
946
|
-
successMessage: s ? a("team.addMember.successMessage", {
|
|
947
|
-
memberName: e.name
|
|
948
|
-
}) : a("team.updateMember.successMessage", {
|
|
949
|
-
memberName: e.name
|
|
950
|
-
}),
|
|
951
|
-
isLoading: Y
|
|
952
|
-
}), y.value = te.CLOSED;
|
|
953
|
-
}
|
|
954
|
-
async function es() {
|
|
955
|
-
await p.readPermissionSets();
|
|
956
|
-
}
|
|
957
|
-
async function Oe() {
|
|
958
|
-
await b.readPermissionAssignments();
|
|
959
|
-
}
|
|
960
|
-
let Me = !1;
|
|
961
|
-
async function ss({
|
|
962
|
-
pageIndex: e
|
|
963
|
-
}) {
|
|
964
|
-
var s;
|
|
965
|
-
if ((s = d.currentBusiness.value) != null && s._id && !Me && !(e === 0 && _.value === 1 && T.value.length > 0)) {
|
|
966
|
-
Me = !0, _.value = e + 1;
|
|
967
|
-
try {
|
|
968
|
-
await se(_.value);
|
|
969
|
-
} finally {
|
|
970
|
-
Me = !1;
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
const ts = ms(D, () => {
|
|
975
|
-
q.value = D.value;
|
|
976
|
-
});
|
|
977
|
-
return os(ts), me(Z, async () => {
|
|
978
|
-
var e;
|
|
979
|
-
_.value = 1, E.value = !1, (e = d.currentBusiness.value) != null && e._id && (await se(1), E.value = !0);
|
|
980
|
-
}, {
|
|
981
|
-
immediate: !0
|
|
982
|
-
}), me(d.currentBusiness, async () => {
|
|
983
|
-
var e;
|
|
984
|
-
if ((e = d.currentBusiness.value) != null && e._id)
|
|
985
|
-
try {
|
|
986
|
-
await Promise.all([R.readRestaurants(), es(), Oe(), n(), de()]);
|
|
987
|
-
} catch (s) {
|
|
988
|
-
console.error("Failed to load team member dependencies:", s), x.open({
|
|
989
|
-
message: s instanceof Error ? s.message : String(s),
|
|
990
|
-
type: "error"
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
}, {
|
|
994
|
-
immediate: !0
|
|
995
|
-
}), O({
|
|
996
|
-
create: f
|
|
997
|
-
}), (e, s) => {
|
|
998
|
-
var xe;
|
|
999
|
-
const U = S("FmSearch"), F = S("FmTable"), W = S("FmIcon"), le = S("FmButton"), Pe = S("FmSideSheet");
|
|
1000
|
-
return h(), A(ke, null, [r("div", Ft, [r("div", St, [o(ge).xs ? (h(), A("div", Pt, [u(U, {
|
|
1001
|
-
modelValue: D.value,
|
|
1002
|
-
"onUpdate:modelValue": s[4] || (s[4] = (N) => D.value = N),
|
|
1003
|
-
class: "w-[320px] xs:w-full xs:mt-8",
|
|
1004
|
-
placeholder: o(a)("team.search.placeholder")
|
|
1005
|
-
}, null, 8, ["modelValue", "placeholder"]), r("div", It, [u(fe, {
|
|
1006
|
-
modelValue: I.value,
|
|
1007
|
-
"onUpdate:modelValue": s[5] || (s[5] = (N) => I.value = N),
|
|
1008
|
-
multiple: "",
|
|
1009
|
-
items: ae.value,
|
|
1010
|
-
variant: "dark",
|
|
1011
|
-
"selected-prefix": o(a)("team.table.columns.restaurant"),
|
|
1012
|
-
placeholder: o(a)("team.table.columns.restaurant"),
|
|
1013
|
-
class: "!w-auto"
|
|
1014
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), u(fe, {
|
|
1015
|
-
modelValue: k.value,
|
|
1016
|
-
"onUpdate:modelValue": s[6] || (s[6] = (N) => k.value = N),
|
|
1017
|
-
multiple: "",
|
|
1018
|
-
variant: "dark",
|
|
1019
|
-
items: re.value,
|
|
1020
|
-
"selected-prefix": o(a)("team.filter.selected_permission_prefix"),
|
|
1021
|
-
placeholder: o(a)("team.filter.permission_placeholder")
|
|
1022
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), u(fe, {
|
|
1023
|
-
modelValue: $.value,
|
|
1024
|
-
"onUpdate:modelValue": s[7] || (s[7] = (N) => $.value = N),
|
|
1025
|
-
multiple: "",
|
|
1026
|
-
variant: "dark",
|
|
1027
|
-
items: ie.value,
|
|
1028
|
-
"selected-prefix": o(a)("team.filter.selected_assigned_role_prefix"),
|
|
1029
|
-
placeholder: o(a)("team.filter.assigned_role_placeholder")
|
|
1030
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])])) : (h(), A("div", Vt, [r("div", wt, [u(fe, {
|
|
1031
|
-
modelValue: I.value,
|
|
1032
|
-
"onUpdate:modelValue": s[0] || (s[0] = (N) => I.value = N),
|
|
1033
|
-
multiple: "",
|
|
1034
|
-
items: ae.value,
|
|
1035
|
-
variant: "dark",
|
|
1036
|
-
"selected-prefix": o(a)("team.table.columns.restaurant"),
|
|
1037
|
-
placeholder: o(a)("team.table.columns.restaurant"),
|
|
1038
|
-
class: "!w-auto"
|
|
1039
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), u(fe, {
|
|
1040
|
-
modelValue: k.value,
|
|
1041
|
-
"onUpdate:modelValue": s[1] || (s[1] = (N) => k.value = N),
|
|
1042
|
-
multiple: "",
|
|
1043
|
-
variant: "dark",
|
|
1044
|
-
items: re.value,
|
|
1045
|
-
"selected-prefix": o(a)("team.filter.selected_permission_prefix"),
|
|
1046
|
-
placeholder: o(a)("team.filter.permission_placeholder")
|
|
1047
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), u(fe, {
|
|
1048
|
-
modelValue: $.value,
|
|
1049
|
-
"onUpdate:modelValue": s[2] || (s[2] = (N) => $.value = N),
|
|
1050
|
-
multiple: "",
|
|
1051
|
-
variant: "dark",
|
|
1052
|
-
items: ie.value,
|
|
1053
|
-
"selected-prefix": o(a)("team.filter.selected_assigned_role_prefix"),
|
|
1054
|
-
placeholder: o(a)("team.filter.assigned_role_placeholder")
|
|
1055
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), u(U, {
|
|
1056
|
-
modelValue: D.value,
|
|
1057
|
-
"onUpdate:modelValue": s[3] || (s[3] = (N) => D.value = N),
|
|
1058
|
-
class: "w-[320px] xs:w-full xs:mt-8",
|
|
1059
|
-
autofocus: "",
|
|
1060
|
-
placeholder: o(a)("team.search.placeholder")
|
|
1061
|
-
}, null, 8, ["modelValue", "placeholder"])])), (xe = o(d).currentBusiness.value) != null && xe._id ? (h(), H(fs, {
|
|
1062
|
-
key: 2
|
|
1063
|
-
}, {
|
|
1064
|
-
default: ue(() => [r("div", kt, [E.value ? V.value === 0 ? (h(), H(o(hs), {
|
|
1065
|
-
key: 1,
|
|
1066
|
-
title: o(a)("team.emptyState.title"),
|
|
1067
|
-
subtitle: o(a)("team.emptyState.description")
|
|
1068
|
-
}, null, 8, ["title", "subtitle"])) : J("", !0) : (h(), H(bs, {
|
|
1069
|
-
key: 0
|
|
1070
|
-
})), E.value ? (h(), H(F, {
|
|
1071
|
-
key: Z.value,
|
|
1072
|
-
"column-defs": g,
|
|
1073
|
-
"row-data": T.value,
|
|
1074
|
-
"page-size": be,
|
|
1075
|
-
"page-count": Math.ceil(V.value / be),
|
|
1076
|
-
"row-count": V.value,
|
|
1077
|
-
"fetch-fn": ss,
|
|
1078
|
-
"hide-footer": V.value <= be,
|
|
1079
|
-
loading: ee.value,
|
|
1080
|
-
"pin-header-row": "",
|
|
1081
|
-
onRowClick: s[8] || (s[8] = (N) => z(o(_e).Update, N.original))
|
|
1082
|
-
}, null, 8, ["row-data", "page-count", "row-count", "hide-footer", "loading"])) : J("", !0)])]),
|
|
1083
|
-
_: 1
|
|
1084
|
-
})) : J("", !0)])]), u(Pe, {
|
|
1085
|
-
"model-value": G.value,
|
|
1086
|
-
"max-width": 960,
|
|
1087
|
-
"close-button": !1,
|
|
1088
|
-
"onOn:clickedAway": o(ve)
|
|
1089
|
-
}, {
|
|
1090
|
-
"side-sheet-header": ue(() => [r("div", $t, [r("p", Rt, P(Re.value), 1), u(W, {
|
|
1091
|
-
name: "close",
|
|
1092
|
-
size: "md",
|
|
1093
|
-
class: "cursor-pointer",
|
|
1094
|
-
onClick: o(ve)
|
|
1095
|
-
}, null, 8, ["onClick"])])]),
|
|
1096
|
-
"side-sheet-footer": ue(() => [r("div", Ct, [u(le, {
|
|
1097
|
-
label: ye.value,
|
|
1098
|
-
size: "md",
|
|
1099
|
-
variant: "primary",
|
|
1100
|
-
"is-loading": Y.value,
|
|
1101
|
-
disabled: Y.value,
|
|
1102
|
-
onClick: Fe(He, ["prevent"])
|
|
1103
|
-
}, null, 8, ["label", "is-loading", "disabled"]), u(le, {
|
|
1104
|
-
label: o(a)("common.cancel"),
|
|
1105
|
-
size: "md",
|
|
1106
|
-
variant: "secondary",
|
|
1107
|
-
disabled: Y.value,
|
|
1108
|
-
onClick: he
|
|
1109
|
-
}, null, 8, ["label", "disabled"])])]),
|
|
1110
|
-
default: ue(() => [u(Ut, {
|
|
1111
|
-
ref_key: "memberForm",
|
|
1112
|
-
ref: ce,
|
|
1113
|
-
initialValue: ne.value,
|
|
1114
|
-
loading: K.value,
|
|
1115
|
-
class: "gap-8"
|
|
1116
|
-
}, null, 8, ["initialValue", "loading"])]),
|
|
1117
|
-
_: 1
|
|
1118
|
-
}, 8, ["model-value", "onOn:clickedAway"])], 64);
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
export {
|
|
1123
|
-
Jt as default
|
|
1124
|
-
};
|