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