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