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