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