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