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