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