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