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