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