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