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