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