@feedmepos/mf-hrm-portal 1.1.3-dev → 1.1.6-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/{EmployeeList-zU7fmC4c.js → EmployeeList-CP42mLpi.js} +16 -18
- package/dist/{PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js → PageLayout.vue_vue_type_script_setup_true_lang-DuwNwJDM.js} +2 -2
- package/dist/{RoleList-jbZqer7A.js → RoleList-CsctaXlu.js} +53 -57
- package/dist/TeamMemberList-DtXoUa5K.js +1508 -0
- package/dist/{TimesheetList-hgT9DrHd.js → TimesheetList-qaolOL4w.js} +41 -42
- package/dist/api/team/index.d.ts +1 -5
- package/dist/app-G_Dbs0OJ.js +1202 -0
- package/dist/app.js +4 -4
- package/dist/components/AppForm.vue.d.ts +2 -3
- package/dist/components/CheckboxInput.vue.d.ts +4 -10
- package/dist/components/CollapsibleWrapper.vue.d.ts +2 -3
- package/dist/components/form/SelectFilter.vue.d.ts +2 -3
- package/dist/components/layout/FormColumn.vue.d.ts +3 -6
- package/dist/components/layout/FormItem.vue.d.ts +1 -2
- package/dist/components/layout/FormSection.vue.d.ts +1 -2
- package/dist/components/layout/FullWrapper.vue.d.ts +3 -6
- package/dist/components/layout/PageLayout.vue.d.ts +1 -2
- package/dist/components/menu/BottomSheetMenu.vue.d.ts +1 -2
- package/dist/components/menu/BottomSheetMenuItem.vue.d.ts +3 -6
- package/dist/components/table/EmptyDataTemplate/index.vue.d.ts +3 -6
- package/dist/composables/useAppStore.d.ts +6 -6
- package/dist/composables/useDateRange.d.ts +1 -1
- package/dist/composables/useRestaurantMap.d.ts +8 -4
- package/dist/composables/useSheet.d.ts +1 -1
- package/dist/employee-BTWpYxn5.js +449 -0
- package/dist/{index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js → empty-placeholder-ey8LJtN1.js} +2 -43
- package/dist/helpers/rule.d.ts +3 -4
- package/dist/index-8ift6lz3.js +57 -0
- package/dist/{lodash-7Am6_Zd3.js → lodash-B5BTJU4_.js} +343 -326
- package/dist/{Main-DGymQNz9.js → main-C370wsCl.js} +1531 -1501
- package/dist/router/shared.d.ts +1 -4
- package/dist/rule-CM7JgjNr.js +142112 -0
- package/dist/stores/employee.d.ts +4 -4
- package/dist/stores/role.d.ts +4 -4
- package/dist/stores/timesheet.d.ts +19 -19
- package/dist/{timesheet-DKhEeLe7.js → timesheet-Cy-jSzje.js} +14 -14
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/types/permission.d.ts +4 -1
- package/dist/types/team.d.ts +3 -13
- package/dist/useAppStore-zINIo0LR.js +93 -0
- package/dist/useLoading-CWBRIBiy.js +141 -0
- package/dist/{useRestaurantMap-D5BNPLKh.js → useRestaurantMap-CpS9-OSq.js} +7 -7
- package/dist/{SelectFilter-NbXrJ4iH.js → useSearch-C25VELOk.js} +101 -90
- package/dist/views/hr/employee/{EmployeeForm.vue.d.ts → components/EmployeeForm.vue.d.ts} +7 -10
- package/dist/views/team/{member → components}/AddMemberForm.vue.d.ts +0 -1
- package/dist/views/team/components/PortalPermissionEditor.vue.d.ts +28 -68
- package/dist/views/team/components/TeamMemberBasePermission.vue.d.ts +36 -0
- package/dist/views/team/components/{ConditionPermission.vue.d.ts → TeamMemberConditionPermission.vue.d.ts} +1 -14
- package/dist/views/team/components/TeamMemberMasterUser.vue.d.ts +718 -0
- package/dist/views/team/components/{PosRolePermission.vue.d.ts → TeamMemberRolePermission.vue.d.ts} +1 -14
- package/dist/views/team/locales/index.d.ts +4 -176
- package/package.json +8 -13
- package/dist/AuditLogList-DNQh1rE9.js +0 -316
- package/dist/Main-BqhrqOzx.js +0 -85
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BvjXcknf.js +0 -3050
- package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +0 -38
- package/dist/RolePermissionList-Dd8ks5i7.js +0 -285
- package/dist/TeamMemberList-uamoOFIV.js +0 -949
- package/dist/api/audit-log/index.d.ts +0 -10
- package/dist/api/permission-assignment/index.d.ts +0 -10
- package/dist/api/permission-set/index.d.ts +0 -8
- package/dist/app-CcbYGJ22.js +0 -2598
- package/dist/dayjs.min-CgN1oBQf.js +0 -282
- package/dist/employee-khk560IC.js +0 -172
- package/dist/helpers/permission-set.d.ts +0 -32
- package/dist/helpers/portal-user.d.ts +0 -8
- package/dist/index-D5sdamN5.js +0 -8411
- package/dist/stores/permission-assignment.d.ts +0 -277
- package/dist/stores/permission-set.d.ts +0 -250
- package/dist/stores/team.d.ts +0 -288
- package/dist/team-CFyc6tnm.js +0 -26
- package/dist/types/audit-log.d.ts +0 -19
- package/dist/types/permission-assignment.d.ts +0 -20
- package/dist/types/permission-set.d.ts +0 -20
- package/dist/useAppStore-DOSLuH24.js +0 -180
- package/dist/useLoading-BA-GSZ3R.js +0 -99
- package/dist/useSearch-B6WK1LBB.js +0 -15
- package/dist/views/audit-log/locales/index.d.ts +0 -211
- package/dist/views/team/Main.vue.d.ts +0 -2
- package/dist/views/team/components/BasePermission.vue.d.ts +0 -64
- package/dist/views/team/components/InheritPermissionTooltip.vue.d.ts +0 -14
- package/dist/views/team/components/PermissionWithTooltip.vue.d.ts +0 -14
- package/dist/views/team/member/TeamMemberList.vue.d.ts +0 -4
- package/dist/views/team/member/TeamMemberMasterUser.vue.d.ts +0 -55
- package/dist/views/team/role/RolePermissionForm.vue.d.ts +0 -19
- package/dist/views/team/role/RolePermissionList.vue.d.ts +0 -5
- /package/dist/views/{audit-log/AuditLogList.vue.d.ts → hr/main.vue.d.ts} +0 -0
- /package/dist/views/{hr/Main.vue.d.ts → team/TeamMemberList.vue.d.ts} +0 -0
- /package/dist/views/team/{member → components}/MemberInfo.vue.d.ts +0 -0
|
@@ -0,0 +1,1508 @@
|
|
|
1
|
+
import { defineComponent as z, ref as j, resolveComponent as M, openBlock as m, createBlock as I, withCtx as q, createElementVNode as u, renderSlot as Q, withModifiers as Re, createCommentVNode as O, nextTick as _e, createElementBlock as P, normalizeClass as oe, createTextVNode as xe, toDisplayString as A, computed as R, Fragment as ne, renderList as pe, createVNode as v, unref as d, useSlots as Ae, normalizeStyle as de, onMounted as Me, onUnmounted as Ie, watch as Ve, isRef as ye, createSlots as De } from "vue";
|
|
2
|
+
import { useI18n as ee, Permission as G, useCoreStore as re, fullPermission as ce, baseClientInstance as Fe, RestaurantSelector as $e } from "@feedmepos/mf-common";
|
|
3
|
+
import { useBreakpoints as Be, useSnackbar as we, useDialog as qe, components as Ee } from "@feedmepos/ui-library";
|
|
4
|
+
import { u as je, _ as Le, S as Ue } from "./useSearch-C25VELOk.js";
|
|
5
|
+
import { _ as Te } from "./app-G_Dbs0OJ.js";
|
|
6
|
+
import { _ as ze } from "./PageLayout.vue_vue_type_script_setup_true_lang-DuwNwJDM.js";
|
|
7
|
+
import { E as We } from "./empty-placeholder-ey8LJtN1.js";
|
|
8
|
+
import { c as Z, i as ke, g as ge, b as Ke, u as Oe, a as Ge, d as Se } from "./rule-CM7JgjNr.js";
|
|
9
|
+
import { p as ue, t as me } from "./index-8ift6lz3.js";
|
|
10
|
+
const Je = /* @__PURE__ */ z({
|
|
11
|
+
__name: "BottomSheetMenu",
|
|
12
|
+
setup(l) {
|
|
13
|
+
const t = j(!1);
|
|
14
|
+
async function e() {
|
|
15
|
+
await _e(), t.value = !t.value;
|
|
16
|
+
}
|
|
17
|
+
return (i, r) => {
|
|
18
|
+
const n = M("FmButton"), k = M("FmBottomSheet");
|
|
19
|
+
return m(), I(k, {
|
|
20
|
+
modelValue: t.value,
|
|
21
|
+
"onUpdate:modelValue": r[1] || (r[1] = ($) => t.value = $),
|
|
22
|
+
"dismiss-away": "",
|
|
23
|
+
"no-header": "",
|
|
24
|
+
"z-index": 110
|
|
25
|
+
}, {
|
|
26
|
+
"bottom-sheet-button": q(() => [
|
|
27
|
+
i.$slots.button ? O("", !0) : (m(), I(n, {
|
|
28
|
+
key: 0,
|
|
29
|
+
icon: "more_vert",
|
|
30
|
+
variant: "tertiary",
|
|
31
|
+
onClick: Re(e, ["stop"])
|
|
32
|
+
})),
|
|
33
|
+
Q(i.$slots, "button")
|
|
34
|
+
]),
|
|
35
|
+
default: q(() => [
|
|
36
|
+
u("div", {
|
|
37
|
+
onClick: r[0] || (r[0] = ($) => t.value = !1)
|
|
38
|
+
}, [
|
|
39
|
+
Q(i.$slots, "default")
|
|
40
|
+
])
|
|
41
|
+
]),
|
|
42
|
+
_: 3
|
|
43
|
+
}, 8, ["modelValue"]);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}), He = { class: "py-8 px-12 hover:bg-fm-color-neutral-gray-100" }, Ye = /* @__PURE__ */ z({
|
|
47
|
+
__name: "BottomSheetMenuItem",
|
|
48
|
+
props: {
|
|
49
|
+
label: {},
|
|
50
|
+
icon: {},
|
|
51
|
+
disabled: { type: Boolean },
|
|
52
|
+
itemClass: {}
|
|
53
|
+
},
|
|
54
|
+
setup(l) {
|
|
55
|
+
const t = l;
|
|
56
|
+
return (e, i) => {
|
|
57
|
+
const r = M("FmIcon");
|
|
58
|
+
return m(), P("div", He, [
|
|
59
|
+
e.$slots.content ? O("", !0) : (m(), P("div", {
|
|
60
|
+
key: 0,
|
|
61
|
+
class: oe(["flex items-center", {
|
|
62
|
+
"text-fm-color-typo-disabled": t.disabled,
|
|
63
|
+
"cursor-pointer": !t.disabled,
|
|
64
|
+
"cursor-not-allowed": t.disabled,
|
|
65
|
+
[t.itemClass || ""]: t.itemClass && !t.disabled
|
|
66
|
+
}])
|
|
67
|
+
}, [
|
|
68
|
+
l.icon ? (m(), I(r, {
|
|
69
|
+
key: 0,
|
|
70
|
+
name: l.icon
|
|
71
|
+
}, null, 8, ["name"])) : O("", !0),
|
|
72
|
+
xe(" " + A(l.label), 1)
|
|
73
|
+
], 2)),
|
|
74
|
+
Q(e.$slots, "content")
|
|
75
|
+
]);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}), Qe = /* @__PURE__ */ z({
|
|
79
|
+
__name: "ResponsiveContextMenu",
|
|
80
|
+
props: {
|
|
81
|
+
items: {}
|
|
82
|
+
},
|
|
83
|
+
setup(l) {
|
|
84
|
+
const t = Be(), e = R(() => t.breakpoints.value.xs);
|
|
85
|
+
return (i, r) => {
|
|
86
|
+
const n = M("FmButton"), k = M("FmMenuItem"), $ = M("FmMenu");
|
|
87
|
+
return e.value ? (m(), I(Je, { key: 0 }, {
|
|
88
|
+
default: q(() => [
|
|
89
|
+
(m(!0), P(ne, null, pe(l.items, ({ icon: p, label: y, disabled: F, itemClass: s, onClick: _ }) => (m(), I(Ye, {
|
|
90
|
+
key: y,
|
|
91
|
+
icon: p,
|
|
92
|
+
label: y,
|
|
93
|
+
disabled: F,
|
|
94
|
+
itemClass: s,
|
|
95
|
+
onClick: () => {
|
|
96
|
+
!F && (_ == null || _());
|
|
97
|
+
}
|
|
98
|
+
}, null, 8, ["icon", "label", "disabled", "itemClass", "onClick"]))), 128))
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
})) : (m(), I($, {
|
|
102
|
+
key: 1,
|
|
103
|
+
"stop-click-propagation": "",
|
|
104
|
+
shift: !0
|
|
105
|
+
}, {
|
|
106
|
+
"menu-button": q(() => [
|
|
107
|
+
v(n, {
|
|
108
|
+
type: "button",
|
|
109
|
+
variant: "tertiary",
|
|
110
|
+
icon: "more_vert",
|
|
111
|
+
"text-color": "neutral-gray-400",
|
|
112
|
+
size: "md"
|
|
113
|
+
})
|
|
114
|
+
]),
|
|
115
|
+
default: q(() => [
|
|
116
|
+
(m(!0), P(ne, null, pe(l.items, ({ label: p, disabled: y, itemClass: F, onClick: s }) => (m(), I(k, {
|
|
117
|
+
key: p,
|
|
118
|
+
disabled: y,
|
|
119
|
+
label: p,
|
|
120
|
+
onClick: () => {
|
|
121
|
+
!y && (s == null || s());
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
label: q(() => [
|
|
125
|
+
u("span", {
|
|
126
|
+
class: oe(y ? "text-fm-color-typo-disabled" : F)
|
|
127
|
+
}, A(p), 3)
|
|
128
|
+
]),
|
|
129
|
+
_: 2
|
|
130
|
+
}, 1032, ["disabled", "label", "onClick"]))), 128))
|
|
131
|
+
]),
|
|
132
|
+
_: 1
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
var ae = /* @__PURE__ */ ((l) => (l.Update = "Update", l.Remove = "Remove", l))(ae || {});
|
|
138
|
+
const Xe = { class: "w-full flex flex-col gap-16" }, Ze = { class: "flex items-center gap-16" }, el = { class: "space-y-4 min-w-0 flex-1" }, ll = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, tl = { class: "fm-typo-en-body-lg-600 truncate" }, sl = { class: "w-full flex gap-16 items-center" }, al = { class: "flex-1 flex flex-col gap-4 min-w-0" }, ol = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, nl = { class: "fm-typo-en-body-lg-600 truncate" }, rl = { class: "flex-1 flex flex-col gap-4 min-w-0" }, il = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, ul = { class: "fm-typo-en-body-lg-600 truncate" }, ml = /* @__PURE__ */ z({
|
|
139
|
+
__name: "MemberInfo",
|
|
140
|
+
props: {
|
|
141
|
+
data: {}
|
|
142
|
+
},
|
|
143
|
+
setup(l) {
|
|
144
|
+
const { t } = ee();
|
|
145
|
+
return (e, i) => {
|
|
146
|
+
const r = M("FmAvatar");
|
|
147
|
+
return m(), P("div", Xe, [
|
|
148
|
+
u("div", Ze, [
|
|
149
|
+
v(r, {
|
|
150
|
+
size: "xl",
|
|
151
|
+
initials: l.data.name
|
|
152
|
+
}, null, 8, ["initials"]),
|
|
153
|
+
u("div", el, [
|
|
154
|
+
u("p", ll, A(d(t)("team.memberForm.memberInfo.memberName")), 1),
|
|
155
|
+
u("p", tl, A(l.data.name || "--"), 1)
|
|
156
|
+
])
|
|
157
|
+
]),
|
|
158
|
+
u("div", sl, [
|
|
159
|
+
u("div", al, [
|
|
160
|
+
u("p", ol, A(d(t)("team.memberForm.memberInfo.mobileNumber")), 1),
|
|
161
|
+
u("p", nl, A(l.data.phoneNumber || "--"), 1)
|
|
162
|
+
]),
|
|
163
|
+
u("div", rl, [
|
|
164
|
+
u("p", il, A(d(t)("team.memberForm.memberInfo.emailAddress")), 1),
|
|
165
|
+
u("p", ul, A(l.data.email || "--"), 1)
|
|
166
|
+
])
|
|
167
|
+
])
|
|
168
|
+
]);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}), dl = { class: "space-y-16" }, cl = {
|
|
172
|
+
key: 0,
|
|
173
|
+
class: "flex fm-typo-en-title-sm-600"
|
|
174
|
+
}, pl = {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: "q-mr-xs text-red col"
|
|
177
|
+
}, fl = { class: "form-input" }, vl = /* @__PURE__ */ z({
|
|
178
|
+
__name: "AppForm",
|
|
179
|
+
props: {
|
|
180
|
+
title: {
|
|
181
|
+
type: String,
|
|
182
|
+
default: void 0
|
|
183
|
+
},
|
|
184
|
+
required: {
|
|
185
|
+
type: [Boolean, String],
|
|
186
|
+
default: !1
|
|
187
|
+
},
|
|
188
|
+
inline: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: !1
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
setup(l) {
|
|
194
|
+
const t = l;
|
|
195
|
+
return (e, i) => (m(), P("div", dl, [
|
|
196
|
+
Q(e.$slots, "top", {}, () => [
|
|
197
|
+
t.title ? (m(), P("div", cl, [
|
|
198
|
+
u("div", null, [
|
|
199
|
+
t.required ? (m(), P("span", pl, "*")) : O("", !0),
|
|
200
|
+
xe(A(t.title), 1)
|
|
201
|
+
]),
|
|
202
|
+
Q(e.$slots, "title-right")
|
|
203
|
+
])) : O("", !0)
|
|
204
|
+
]),
|
|
205
|
+
u("div", fl, [
|
|
206
|
+
Q(e.$slots, "default")
|
|
207
|
+
])
|
|
208
|
+
]));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
function bl(l, t) {
|
|
212
|
+
let e = "", i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
213
|
+
const r = i.length;
|
|
214
|
+
for (let n = 0; n < l; n++)
|
|
215
|
+
e += i.charAt(Math.floor(Math.random() * r));
|
|
216
|
+
return e;
|
|
217
|
+
}
|
|
218
|
+
const hl = { class: "col flex items-center" }, yl = {
|
|
219
|
+
key: 1,
|
|
220
|
+
class: "q-pa-sm form-error-message text-error"
|
|
221
|
+
}, ie = /* @__PURE__ */ z({
|
|
222
|
+
__name: "CheckboxInput",
|
|
223
|
+
props: {
|
|
224
|
+
options: {
|
|
225
|
+
type: Array,
|
|
226
|
+
required: !0
|
|
227
|
+
},
|
|
228
|
+
title: {
|
|
229
|
+
type: String,
|
|
230
|
+
required: !0
|
|
231
|
+
},
|
|
232
|
+
modelValue: {
|
|
233
|
+
type: Array,
|
|
234
|
+
required: !0
|
|
235
|
+
},
|
|
236
|
+
showAllToggle: {
|
|
237
|
+
type: [Boolean, String],
|
|
238
|
+
default: !0
|
|
239
|
+
},
|
|
240
|
+
includeDisabledOptionsWhenSelectAll: {
|
|
241
|
+
type: Boolean,
|
|
242
|
+
default: !1
|
|
243
|
+
},
|
|
244
|
+
disable: {
|
|
245
|
+
type: Boolean,
|
|
246
|
+
default: !1
|
|
247
|
+
},
|
|
248
|
+
min: {
|
|
249
|
+
type: Number,
|
|
250
|
+
default: 0
|
|
251
|
+
},
|
|
252
|
+
max: {
|
|
253
|
+
type: Number,
|
|
254
|
+
default: void 0
|
|
255
|
+
},
|
|
256
|
+
showIntermediate: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: !0
|
|
259
|
+
},
|
|
260
|
+
gutter: {
|
|
261
|
+
type: Number,
|
|
262
|
+
default: void 0
|
|
263
|
+
},
|
|
264
|
+
falsyShowSlot: {
|
|
265
|
+
type: Boolean,
|
|
266
|
+
default: !1
|
|
267
|
+
},
|
|
268
|
+
bottomSlotIndent: {
|
|
269
|
+
type: String,
|
|
270
|
+
default: "36px"
|
|
271
|
+
},
|
|
272
|
+
alignCenter: {
|
|
273
|
+
type: Boolean,
|
|
274
|
+
default: !0
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
emits: ["update:model-value"],
|
|
278
|
+
setup(l, { emit: t }) {
|
|
279
|
+
const e = l, i = t, { t: r } = ee(), n = j(!1), k = Ae(), $ = R(() => e.modelValue.length < e.min ? `Min selection ${e.min}` : e.max !== void 0 && e.modelValue.length > e.max ? `Max selection ${e.max}` : !0), p = `checkbox-${bl(6)}`, y = R(() => $.value !== !0), F = R(
|
|
280
|
+
() => e.modelValue.filter((V) => e.options.some((U) => U.value === V))
|
|
281
|
+
), s = R(
|
|
282
|
+
() => typeof e.showAllToggle == "boolean" ? r("team.labels.all") : e.showAllToggle
|
|
283
|
+
), _ = R(() => e.options.length > 0 && e.options.length === F.value.length);
|
|
284
|
+
function N() {
|
|
285
|
+
const V = e.modelValue.filter((U) => !F.value.includes(U));
|
|
286
|
+
if (_.value === !0)
|
|
287
|
+
i("update:model-value", V);
|
|
288
|
+
else {
|
|
289
|
+
const U = e.includeDisabledOptionsWhenSelectAll ? e.options.map((C) => C.value) : e.options.filter((C) => !C.disabled).map((C) => C.value);
|
|
290
|
+
i("update:model-value", [...V, ...U]);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function B(V, U) {
|
|
294
|
+
let C = Z(e.modelValue);
|
|
295
|
+
U ? C.every((b) => b !== V) && C.push(V) : C = C.filter((b) => b !== V), i("update:model-value", C);
|
|
296
|
+
}
|
|
297
|
+
return (V, U) => {
|
|
298
|
+
const C = M("FmCheckbox");
|
|
299
|
+
return m(), I(vl, {
|
|
300
|
+
id: p,
|
|
301
|
+
title: l.title,
|
|
302
|
+
required: !1
|
|
303
|
+
}, {
|
|
304
|
+
top: q(() => [
|
|
305
|
+
Q(V.$slots, "top")
|
|
306
|
+
]),
|
|
307
|
+
default: q(() => [
|
|
308
|
+
e.showAllToggle ? (m(), I(C, {
|
|
309
|
+
key: 0,
|
|
310
|
+
"model-value": _.value,
|
|
311
|
+
disabled: l.disable,
|
|
312
|
+
label: s.value,
|
|
313
|
+
style: de(`margin-bottom: ${e.gutter}px`),
|
|
314
|
+
size: "sm",
|
|
315
|
+
dense: "",
|
|
316
|
+
value: s.value,
|
|
317
|
+
"onUpdate:modelValue": N
|
|
318
|
+
}, null, 8, ["model-value", "disabled", "label", "style", "value"])) : O("", !0),
|
|
319
|
+
(m(!0), P(ne, null, pe(l.options, (b, c) => (m(), P("div", {
|
|
320
|
+
key: b.value,
|
|
321
|
+
style: de(`margin-bottom: ${c < l.options.length - 1 ? e.gutter : 0}px`),
|
|
322
|
+
class: oe(c < l.options.length - 1 ? "q-mb-sm" : "")
|
|
323
|
+
}, [
|
|
324
|
+
u("div", {
|
|
325
|
+
class: oe(["row justify-between", l.alignCenter ? "items-center" : "items-start"])
|
|
326
|
+
}, [
|
|
327
|
+
u("div", hl, [
|
|
328
|
+
v(C, {
|
|
329
|
+
"model-value": l.modelValue.includes(b.value),
|
|
330
|
+
disabled: l.disable || b.disabled,
|
|
331
|
+
size: "sm",
|
|
332
|
+
label: b.label,
|
|
333
|
+
value: b.label,
|
|
334
|
+
"onUpdate:modelValue": (h) => B(b.value, h)
|
|
335
|
+
}, null, 8, ["model-value", "disabled", "label", "value", "onUpdate:modelValue"])
|
|
336
|
+
]),
|
|
337
|
+
d(k)[`checkbox-${b.key || b.value}-end`] && (l.modelValue.includes(b.value) || l.falsyShowSlot) ? (m(), P("div", {
|
|
338
|
+
key: 0,
|
|
339
|
+
class: oe([{ "q-checkbox disabled": l.disable || b.disabled }, "col"])
|
|
340
|
+
}, [
|
|
341
|
+
Q(V.$slots, `checkbox-${b.key || b.value}-end`, {
|
|
342
|
+
option: b,
|
|
343
|
+
value: l.modelValue.includes(b.value),
|
|
344
|
+
disable: l.disable || b.disabled
|
|
345
|
+
})
|
|
346
|
+
], 2)) : O("", !0)
|
|
347
|
+
], 2),
|
|
348
|
+
d(k)[`checkbox-${b.key || b.value}-bottom`] && (l.modelValue.includes(b.value) || l.falsyShowSlot) ? (m(), P("div", {
|
|
349
|
+
key: 0,
|
|
350
|
+
class: oe(["q-mt-sm", { "q-checkbox disabled": l.disable || b.disabled }]),
|
|
351
|
+
style: de(`margin-left: ${l.bottomSlotIndent}`)
|
|
352
|
+
}, [
|
|
353
|
+
Q(V.$slots, `checkbox-${b.key || b.value}-bottom`, {
|
|
354
|
+
option: b,
|
|
355
|
+
disable: l.disable || b.disabled,
|
|
356
|
+
value: l.modelValue.includes(b.value)
|
|
357
|
+
})
|
|
358
|
+
], 6)) : O("", !0)
|
|
359
|
+
], 6))), 128)),
|
|
360
|
+
n.value && y.value ? (m(), P("div", yl, A($.value), 1)) : O("", !0)
|
|
361
|
+
]),
|
|
362
|
+
_: 3
|
|
363
|
+
}, 8, ["title"]);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}), gl = { class: "flex flex-col gap-16" }, _l = /* @__PURE__ */ z({
|
|
367
|
+
__name: "TeamMemberBasePermission",
|
|
368
|
+
props: {
|
|
369
|
+
modelValue: {
|
|
370
|
+
type: Array,
|
|
371
|
+
required: !0
|
|
372
|
+
},
|
|
373
|
+
disable: {
|
|
374
|
+
type: Boolean,
|
|
375
|
+
default: !1
|
|
376
|
+
},
|
|
377
|
+
excludedSubjects: {
|
|
378
|
+
type: Array,
|
|
379
|
+
required: !0
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
emits: ["update:model-value"],
|
|
383
|
+
setup(l, { emit: t }) {
|
|
384
|
+
const e = l, i = t, { t: r } = ee(), n = R(() => ue.filter((s) => !e.excludedSubjects.includes(s.subject)).filter((s) => !ke.includes(s.subject)).map((s) => ({
|
|
385
|
+
label: s.label,
|
|
386
|
+
value: s.subject
|
|
387
|
+
}))), k = R(() => ue.filter((s) => ke.includes(s.subject)).map((s) => ({
|
|
388
|
+
label: s.label,
|
|
389
|
+
value: s.subject
|
|
390
|
+
}))), $ = R(() => e.modelValue.filter((s) => n.value.some((_) => _.value === s.subject)).map((s) => s.subject)), p = R(() => e.modelValue.filter((s) => k.value.some((_) => _.value === s.subject)).map((s) => s.subject));
|
|
391
|
+
function y(s) {
|
|
392
|
+
i("update:model-value", [
|
|
393
|
+
// Keep non-general permissions unchanged
|
|
394
|
+
...e.modelValue.filter((_) => !n.value.some((N) => N.value === _.subject)),
|
|
395
|
+
// Add selected general permissions
|
|
396
|
+
...ue.filter((_) => s.includes(_.subject))
|
|
397
|
+
]);
|
|
398
|
+
}
|
|
399
|
+
function F(s) {
|
|
400
|
+
i("update:model-value", [
|
|
401
|
+
// Keep non-inventory permissions unchanged
|
|
402
|
+
...e.modelValue.filter(
|
|
403
|
+
(_) => !k.value.some((N) => N.value === _.subject)
|
|
404
|
+
),
|
|
405
|
+
// Add selected inventory permissions
|
|
406
|
+
...ue.filter((_) => s.includes(_.subject))
|
|
407
|
+
]);
|
|
408
|
+
}
|
|
409
|
+
return (s, _) => (m(), P("div", gl, [
|
|
410
|
+
v(ie, {
|
|
411
|
+
"model-value": $.value,
|
|
412
|
+
options: n.value,
|
|
413
|
+
disable: l.disable,
|
|
414
|
+
title: d(r)("team.memberForm.permissions.general"),
|
|
415
|
+
"onUpdate:modelValue": y
|
|
416
|
+
}, null, 8, ["model-value", "options", "disable", "title"]),
|
|
417
|
+
k.value.length > 0 ? (m(), I(ie, {
|
|
418
|
+
key: 0,
|
|
419
|
+
"model-value": p.value,
|
|
420
|
+
options: k.value,
|
|
421
|
+
disable: l.disable,
|
|
422
|
+
title: d(r)("team.memberForm.permissions.stock"),
|
|
423
|
+
"onUpdate:modelValue": F
|
|
424
|
+
}, null, 8, ["model-value", "options", "disable", "title"])) : O("", !0)
|
|
425
|
+
]));
|
|
426
|
+
}
|
|
427
|
+
}), xl = { class: "flex items-center" }, Vl = { class: "ml-auto" }, wl = /* @__PURE__ */ z({
|
|
428
|
+
__name: "CollapsibleWrapper",
|
|
429
|
+
props: {
|
|
430
|
+
title: { default: "" },
|
|
431
|
+
initiallyCollapsed: { type: Boolean, default: !1 }
|
|
432
|
+
},
|
|
433
|
+
setup(l) {
|
|
434
|
+
const e = j(l.initiallyCollapsed), i = j(), r = j(0);
|
|
435
|
+
let n;
|
|
436
|
+
function k() {
|
|
437
|
+
e.value = !e.value;
|
|
438
|
+
}
|
|
439
|
+
function $() {
|
|
440
|
+
i.value && (r.value = i.value.scrollHeight);
|
|
441
|
+
}
|
|
442
|
+
return Me(async () => {
|
|
443
|
+
await _e(), i.value && (n = new ResizeObserver(() => {
|
|
444
|
+
$();
|
|
445
|
+
}), n.observe(i.value));
|
|
446
|
+
}), Ie(() => {
|
|
447
|
+
n == null || n.disconnect();
|
|
448
|
+
}), (p, y) => {
|
|
449
|
+
const F = M("FmButton");
|
|
450
|
+
return m(), P(ne, null, [
|
|
451
|
+
u("div", { onClick: k }, [
|
|
452
|
+
u("div", xl, [
|
|
453
|
+
Q(p.$slots, "title"),
|
|
454
|
+
u("div", Vl, [
|
|
455
|
+
v(F, {
|
|
456
|
+
icon: e.value ? "keyboard_arrow_down" : "keyboard_arrow_up",
|
|
457
|
+
"text-color": "neutral-gray-400",
|
|
458
|
+
variant: "tertiary",
|
|
459
|
+
size: "md"
|
|
460
|
+
}, null, 8, ["icon"])
|
|
461
|
+
])
|
|
462
|
+
])
|
|
463
|
+
]),
|
|
464
|
+
u("div", {
|
|
465
|
+
ref_key: "contentRef",
|
|
466
|
+
ref: i,
|
|
467
|
+
class: "transition-all duration-300 ease-in-out overflow-hidden",
|
|
468
|
+
style: de({ maxHeight: e.value ? "0" : r.value + "px" })
|
|
469
|
+
}, [
|
|
470
|
+
Q(p.$slots, "default")
|
|
471
|
+
], 4)
|
|
472
|
+
], 64);
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
}), Fl = { class: "fm-typo-en-title-sm-600" }, ve = "includedFuture", Ce = /* @__PURE__ */ z({
|
|
476
|
+
__name: "TeamMemberConditionPermission",
|
|
477
|
+
props: {
|
|
478
|
+
modelValue: {
|
|
479
|
+
type: Array,
|
|
480
|
+
default: null
|
|
481
|
+
},
|
|
482
|
+
options: {
|
|
483
|
+
type: Array,
|
|
484
|
+
required: !0
|
|
485
|
+
},
|
|
486
|
+
disable: {
|
|
487
|
+
type: Boolean,
|
|
488
|
+
default: !1
|
|
489
|
+
},
|
|
490
|
+
context: {
|
|
491
|
+
type: String,
|
|
492
|
+
required: !0
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
emits: ["update:model-value"],
|
|
496
|
+
setup(l, { emit: t }) {
|
|
497
|
+
const e = l, i = t, { t: r } = ee(), n = R(() => [
|
|
498
|
+
{
|
|
499
|
+
label: r("team.memberForm.permissions.includedFuture", { context: e.context }),
|
|
500
|
+
value: ve,
|
|
501
|
+
// Can only be selected if all other options are selected
|
|
502
|
+
disable: !!e.modelValue && e.options.length > e.modelValue.length
|
|
503
|
+
},
|
|
504
|
+
...e.options.filter(
|
|
505
|
+
(y) => y.label.toLocaleLowerCase().includes(p.value.toLocaleLowerCase())
|
|
506
|
+
)
|
|
507
|
+
]), k = R(() => e.modelValue ? e.modelValue : [ve, ...e.options.map((y) => y.value)]);
|
|
508
|
+
function $(y) {
|
|
509
|
+
const F = y.length === n.value.length;
|
|
510
|
+
i("update:model-value", F ? null : y.filter((s) => s !== ve));
|
|
511
|
+
}
|
|
512
|
+
const p = j("");
|
|
513
|
+
return (y, F) => {
|
|
514
|
+
const s = M("fm-search");
|
|
515
|
+
return m(), I(wl, null, {
|
|
516
|
+
title: q(() => [
|
|
517
|
+
u("p", Fl, A(d(r)("team.memberForm.permissions.manageable", { context: l.context })), 1)
|
|
518
|
+
]),
|
|
519
|
+
default: q(() => [
|
|
520
|
+
l.options.length > 1 ? (m(), I(s, {
|
|
521
|
+
key: 0,
|
|
522
|
+
modelValue: p.value,
|
|
523
|
+
"onUpdate:modelValue": F[0] || (F[0] = (_) => p.value = _),
|
|
524
|
+
class: "mt-16",
|
|
525
|
+
placeholder: d(r)("team.memberForm.permissions.search", { context: l.context })
|
|
526
|
+
}, null, 8, ["modelValue", "placeholder"])) : O("", !0),
|
|
527
|
+
v(ie, {
|
|
528
|
+
"model-value": k.value,
|
|
529
|
+
options: n.value,
|
|
530
|
+
"show-intermediate": !1,
|
|
531
|
+
"show-all-toggle": !0,
|
|
532
|
+
disable: l.disable,
|
|
533
|
+
"include-disabled-options-when-select-all": !0,
|
|
534
|
+
title: "",
|
|
535
|
+
class: "mt-16",
|
|
536
|
+
"onUpdate:modelValue": $
|
|
537
|
+
}, null, 8, ["model-value", "options", "disable"])
|
|
538
|
+
]),
|
|
539
|
+
_: 1
|
|
540
|
+
});
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
}), $l = { class: "flex flex-col gap-40" }, Ul = { class: "flex items-center" }, kl = { class: "flex-1 flex flex-col" }, Sl = { class: "fm-typo-en-title-sm-600" }, Cl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pl = { class: "flex flex-row gap-16" }, Rl = { class: "flex flex-col gap-8" }, Ml = { class: "fm-typo-en-body-lg-400" }, Bl = { class: "p-16 fm-corner-radius-lg border border-fm-color-neutral-gray-200" }, be = 4, jl = /* @__PURE__ */ z({
|
|
544
|
+
__name: "TeamMemberMasterUser",
|
|
545
|
+
props: {
|
|
546
|
+
modelValue: {
|
|
547
|
+
type: Object,
|
|
548
|
+
default: void 0
|
|
549
|
+
},
|
|
550
|
+
fallbackName: {
|
|
551
|
+
type: String,
|
|
552
|
+
required: !0
|
|
553
|
+
},
|
|
554
|
+
fallbackPasscode: {
|
|
555
|
+
type: String,
|
|
556
|
+
default: void 0
|
|
557
|
+
},
|
|
558
|
+
restaurants: {
|
|
559
|
+
type: Array,
|
|
560
|
+
required: !0
|
|
561
|
+
},
|
|
562
|
+
roles: {
|
|
563
|
+
type: Array,
|
|
564
|
+
required: !0
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
emits: ["update:model-value"],
|
|
568
|
+
setup(l, { emit: t }) {
|
|
569
|
+
const e = l, i = t, { t: r } = ee(), { searchKey: n, filter: k } = je(""), $ = j(!0), p = j([]), y = R(() => {
|
|
570
|
+
const c = {};
|
|
571
|
+
return e.roles.forEach((h) => {
|
|
572
|
+
c[h.value] = h.label;
|
|
573
|
+
}), c;
|
|
574
|
+
}), F = R(() => {
|
|
575
|
+
var h;
|
|
576
|
+
const c = {};
|
|
577
|
+
return (h = e.modelValue) == null || h.roles.forEach((E) => {
|
|
578
|
+
c[E.restaurantId] = E.roleId;
|
|
579
|
+
}), c;
|
|
580
|
+
}), s = R(() => e.restaurants.filter((c) => k([c.profile.name, c.profile.code, N(c._id)])).map((c) => ({
|
|
581
|
+
label: `${c.profile.code ? c.profile.code + "-" : ""}${c.profile.name}`,
|
|
582
|
+
value: c._id,
|
|
583
|
+
slot: `checkbox-${c._id}-bottom`,
|
|
584
|
+
disable: e.roles.filter((h) => !h.disabled).length === 0,
|
|
585
|
+
roleOptions: e.roles
|
|
586
|
+
}))), _ = R(() => {
|
|
587
|
+
const c = e.roles.find((h) => !h.disabled);
|
|
588
|
+
return c ? c.value : null;
|
|
589
|
+
});
|
|
590
|
+
function N(c) {
|
|
591
|
+
const h = F.value[c] ?? "";
|
|
592
|
+
return y.value[h] || "";
|
|
593
|
+
}
|
|
594
|
+
function B(c) {
|
|
595
|
+
c ? e.modelValue || i("update:model-value", {
|
|
596
|
+
code: "",
|
|
597
|
+
name: e.fallbackName,
|
|
598
|
+
roles: [],
|
|
599
|
+
passcode: e.fallbackPasscode || ""
|
|
600
|
+
}) : i("update:model-value", void 0);
|
|
601
|
+
}
|
|
602
|
+
function V(c, h) {
|
|
603
|
+
if (!e.modelValue || c === "passcode" && e.modelValue.passcode === h)
|
|
604
|
+
return;
|
|
605
|
+
const E = Z(e.modelValue);
|
|
606
|
+
E[c] = h, i("update:model-value", E);
|
|
607
|
+
}
|
|
608
|
+
function U(c) {
|
|
609
|
+
V(
|
|
610
|
+
"roles",
|
|
611
|
+
c.map((h) => {
|
|
612
|
+
var Y, g, a;
|
|
613
|
+
const E = (g = (Y = s.value.find((w) => w.value === h)) == null ? void 0 : Y.roleOptions.find((w) => !w.disabled)) == null ? void 0 : g.value, L = (a = e.modelValue) == null ? void 0 : a.roles.find((w) => w.restaurantId === h);
|
|
614
|
+
return {
|
|
615
|
+
restaurantId: h,
|
|
616
|
+
roleId: (L == null ? void 0 : L.roleId) || E
|
|
617
|
+
};
|
|
618
|
+
})
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
function C(c, h) {
|
|
622
|
+
V("roles", [
|
|
623
|
+
...e.modelValue.roles.filter(
|
|
624
|
+
(E) => E.restaurantId !== c
|
|
625
|
+
),
|
|
626
|
+
{
|
|
627
|
+
restaurantId: c,
|
|
628
|
+
roleId: h
|
|
629
|
+
}
|
|
630
|
+
]);
|
|
631
|
+
}
|
|
632
|
+
function b() {
|
|
633
|
+
$.value && ($.value = !1, p.value = [], V("passcode", ""));
|
|
634
|
+
}
|
|
635
|
+
return Ve(
|
|
636
|
+
() => {
|
|
637
|
+
var c;
|
|
638
|
+
return (c = e.modelValue) == null ? void 0 : c.passcode;
|
|
639
|
+
},
|
|
640
|
+
(c) => {
|
|
641
|
+
c && c.length === be ? (p.value = c.split(""), $.value = !0) : (p.value = [], $.value = !1);
|
|
642
|
+
},
|
|
643
|
+
{ immediate: !0 }
|
|
644
|
+
), (c, h) => {
|
|
645
|
+
const E = M("FmSwitch"), L = M("FmTextField"), Y = M("FmPinField"), g = M("FmFormGroup"), a = M("FmSearch"), w = M("FmSelect");
|
|
646
|
+
return m(), P("div", $l, [
|
|
647
|
+
u("div", Ul, [
|
|
648
|
+
u("div", kl, [
|
|
649
|
+
u("div", Sl, A(d(r)("team.memberForm.masterUser.title")), 1),
|
|
650
|
+
u("div", Cl, A(d(r)("team.memberForm.masterUser.sublabel")), 1)
|
|
651
|
+
]),
|
|
652
|
+
u("div", null, [
|
|
653
|
+
v(E, {
|
|
654
|
+
"model-value": !!l.modelValue,
|
|
655
|
+
value: "master-user",
|
|
656
|
+
"onUpdate:modelValue": B
|
|
657
|
+
}, null, 8, ["model-value"])
|
|
658
|
+
])
|
|
659
|
+
]),
|
|
660
|
+
l.modelValue ? (m(), P(ne, { key: 0 }, [
|
|
661
|
+
u("div", Pl, [
|
|
662
|
+
v(L, {
|
|
663
|
+
"model-value": l.modelValue.code,
|
|
664
|
+
label: d(r)("team.memberForm.masterUser.code"),
|
|
665
|
+
"onUpdate:modelValue": h[0] || (h[0] = (f) => V("code", f))
|
|
666
|
+
}, null, 8, ["model-value", "label"]),
|
|
667
|
+
v(L, {
|
|
668
|
+
"model-value": l.modelValue.name,
|
|
669
|
+
class: "w-full",
|
|
670
|
+
label: d(r)("team.memberForm.masterUser.name"),
|
|
671
|
+
rules: [(f) => !!f || d(r)("team.memberForm.masterUser.nameEmptyError")],
|
|
672
|
+
"onUpdate:modelValue": h[1] || (h[1] = (f) => V("name", f))
|
|
673
|
+
}, null, 8, ["model-value", "label", "rules"])
|
|
674
|
+
]),
|
|
675
|
+
u("div", Rl, [
|
|
676
|
+
u("div", Ml, A(d(r)("team.memberForm.masterUser.passcode")), 1),
|
|
677
|
+
v(g, {
|
|
678
|
+
modelValue: p.value,
|
|
679
|
+
"onUpdate:modelValue": h[4] || (h[4] = (f) => p.value = f),
|
|
680
|
+
rules: [
|
|
681
|
+
(f) => (f == null ? void 0 : f.filter((S) => !!S).length) !== be ? d(r)("team.memberForm.masterUser.passcodeRequired") : !0
|
|
682
|
+
]
|
|
683
|
+
}, {
|
|
684
|
+
default: q(() => [
|
|
685
|
+
(m(), I(Y, {
|
|
686
|
+
key: `pin-field-${$.value}`,
|
|
687
|
+
modelValue: p.value,
|
|
688
|
+
"onUpdate:modelValue": h[2] || (h[2] = (f) => p.value = f),
|
|
689
|
+
length: be,
|
|
690
|
+
masked: $.value,
|
|
691
|
+
onComplete: h[3] || (h[3] = (f) => V("passcode", f)),
|
|
692
|
+
onFocus: b
|
|
693
|
+
}, null, 8, ["modelValue", "masked"]))
|
|
694
|
+
]),
|
|
695
|
+
_: 1
|
|
696
|
+
}, 8, ["modelValue", "rules"])
|
|
697
|
+
]),
|
|
698
|
+
u("div", Bl, [
|
|
699
|
+
v(a, {
|
|
700
|
+
modelValue: d(n),
|
|
701
|
+
"onUpdate:modelValue": h[5] || (h[5] = (f) => ye(n) ? n.value = f : null),
|
|
702
|
+
placeholder: d(r)("team.memberForm.role.placeholder"),
|
|
703
|
+
class: "mb-16"
|
|
704
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
705
|
+
v(ie, {
|
|
706
|
+
"model-value": l.modelValue.roles.map((f) => f.restaurantId),
|
|
707
|
+
options: s.value,
|
|
708
|
+
min: 1,
|
|
709
|
+
title: d(r)("team.memberForm.masterUser.role"),
|
|
710
|
+
"onUpdate:modelValue": U
|
|
711
|
+
}, De({ _: 2 }, [
|
|
712
|
+
pe(s.value, (f) => ({
|
|
713
|
+
name: f.slot,
|
|
714
|
+
fn: q(() => {
|
|
715
|
+
var S;
|
|
716
|
+
return [
|
|
717
|
+
u("div", null, [
|
|
718
|
+
v(w, {
|
|
719
|
+
"model-value": ((S = l.modelValue.roles.find((D) => D.restaurantId === f.value)) == null ? void 0 : S.roleId) || _.value,
|
|
720
|
+
items: f.roleOptions,
|
|
721
|
+
"onUpdate:modelValue": (D) => C(f.value, D)
|
|
722
|
+
}, null, 8, ["model-value", "items", "onUpdate:modelValue"])
|
|
723
|
+
])
|
|
724
|
+
];
|
|
725
|
+
})
|
|
726
|
+
}))
|
|
727
|
+
]), 1032, ["model-value", "options", "title"])
|
|
728
|
+
])
|
|
729
|
+
], 64)) : O("", !0)
|
|
730
|
+
]);
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
}), he = "includedNewRole", Ol = /* @__PURE__ */ z({
|
|
734
|
+
__name: "TeamMemberRolePermission",
|
|
735
|
+
props: {
|
|
736
|
+
modelValue: {
|
|
737
|
+
type: Array,
|
|
738
|
+
default: null
|
|
739
|
+
},
|
|
740
|
+
roles: {
|
|
741
|
+
type: Array,
|
|
742
|
+
required: !0
|
|
743
|
+
},
|
|
744
|
+
restaurantIds: {
|
|
745
|
+
type: Array,
|
|
746
|
+
default: null
|
|
747
|
+
},
|
|
748
|
+
disable: {
|
|
749
|
+
type: Boolean,
|
|
750
|
+
default: !1
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
emits: ["update:model-value"],
|
|
754
|
+
setup(l, { emit: t }) {
|
|
755
|
+
const e = l, i = t, { t: r } = ee(), n = R(() => {
|
|
756
|
+
const p = e.restaurantIds;
|
|
757
|
+
return [
|
|
758
|
+
{
|
|
759
|
+
label: r("team.memberForm.permissions.includedNewRole"),
|
|
760
|
+
value: he,
|
|
761
|
+
disable: !!e.modelValue && e.roles.length > e.modelValue.length
|
|
762
|
+
},
|
|
763
|
+
...e.roles.map((y) => ({
|
|
764
|
+
label: y.name,
|
|
765
|
+
value: y._id,
|
|
766
|
+
disable: !!p && y.restaurants.every(({ id: F }) => !p.includes(F))
|
|
767
|
+
}))
|
|
768
|
+
];
|
|
769
|
+
}), k = R(() => e.modelValue ? e.modelValue : [he, ...e.roles.map((p) => p._id)]);
|
|
770
|
+
function $(p) {
|
|
771
|
+
const y = p.length === n.value.length;
|
|
772
|
+
i("update:model-value", y ? null : p.filter((F) => F !== he));
|
|
773
|
+
}
|
|
774
|
+
return (p, y) => (m(), I(ie, {
|
|
775
|
+
"model-value": k.value,
|
|
776
|
+
options: n.value,
|
|
777
|
+
"show-intermediate": !1,
|
|
778
|
+
"show-all-toggle": !1,
|
|
779
|
+
disable: l.disable,
|
|
780
|
+
title: d(r)("team.memberForm.permissions.roles"),
|
|
781
|
+
"onUpdate:modelValue": $
|
|
782
|
+
}, null, 8, ["model-value", "options", "disable", "title"]));
|
|
783
|
+
}
|
|
784
|
+
}), Nl = {
|
|
785
|
+
async readWarehouses() {
|
|
786
|
+
return ge(await Ke().get("/warehouses"));
|
|
787
|
+
}
|
|
788
|
+
}, Al = { class: "flex flex-col gap-40" }, Il = {
|
|
789
|
+
key: 0,
|
|
790
|
+
class: "p-16 fm-corner-radius-lg border border-fm-color-neutral-gray-200"
|
|
791
|
+
}, Dl = {
|
|
792
|
+
key: 1,
|
|
793
|
+
class: "p-16 fm-corner-radius-lg border border-fm-color-neutral-gray-200"
|
|
794
|
+
}, ql = {
|
|
795
|
+
key: 2,
|
|
796
|
+
class: "p-16 fm-corner-radius-lg border border-fm-color-neutral-gray-200"
|
|
797
|
+
}, El = {
|
|
798
|
+
key: 3,
|
|
799
|
+
class: "p-16 fm-corner-radius-lg border border-fm-color-neutral-gray-200"
|
|
800
|
+
}, Ll = /* @__PURE__ */ z({
|
|
801
|
+
__name: "PortalPermissionEditor",
|
|
802
|
+
props: {
|
|
803
|
+
initialValue: {
|
|
804
|
+
type: Object,
|
|
805
|
+
default: void 0
|
|
806
|
+
},
|
|
807
|
+
username: {
|
|
808
|
+
type: String,
|
|
809
|
+
required: !0
|
|
810
|
+
},
|
|
811
|
+
disable: {
|
|
812
|
+
type: Boolean,
|
|
813
|
+
default: !1
|
|
814
|
+
},
|
|
815
|
+
isOwner: {
|
|
816
|
+
type: Boolean,
|
|
817
|
+
default: !1
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
emits: ["permissionChanged"],
|
|
821
|
+
setup(l, { emit: t }) {
|
|
822
|
+
const e = l, i = t, { t: r } = ee(), n = j({
|
|
823
|
+
permissions: []
|
|
824
|
+
}), k = [
|
|
825
|
+
G.Subject.Business.restaurant,
|
|
826
|
+
G.Subject.Business.role,
|
|
827
|
+
G.Subject.Business.stock,
|
|
828
|
+
G.Subject.Restaurant.restaurant
|
|
829
|
+
], $ = R(() => {
|
|
830
|
+
var a;
|
|
831
|
+
const g = (a = n.value) == null ? void 0 : a.permissions.find(
|
|
832
|
+
(w) => w.subject === G.Subject.Business.stock
|
|
833
|
+
);
|
|
834
|
+
return g ? g.conditions ? JSON.parse(g.conditions).warehouseId.$in : null : [];
|
|
835
|
+
}), p = j([]);
|
|
836
|
+
Me(async () => {
|
|
837
|
+
e.initialValue && (n.value = e.initialValue), p.value = await Nl.readWarehouses();
|
|
838
|
+
});
|
|
839
|
+
function y(g) {
|
|
840
|
+
const a = F(n.value.permissions, g);
|
|
841
|
+
n.value = {
|
|
842
|
+
...n.value,
|
|
843
|
+
permissions: a,
|
|
844
|
+
posUser: h(n.value.posUser, a)
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
function F(g, a) {
|
|
848
|
+
let w = Z(
|
|
849
|
+
g.filter((f) => f.subject !== G.Subject.Business.stock)
|
|
850
|
+
);
|
|
851
|
+
if (!a || a.length > 0) {
|
|
852
|
+
const f = {
|
|
853
|
+
actions: [G.Action.manage],
|
|
854
|
+
subject: G.Subject.Business.stock
|
|
855
|
+
};
|
|
856
|
+
a && (f.conditions = JSON.stringify({ warehouseId: { $in: a } })), w.push(f);
|
|
857
|
+
}
|
|
858
|
+
return w;
|
|
859
|
+
}
|
|
860
|
+
const { restaurants: s } = re(), _ = Oe().roles, N = R(() => s.value.reduce((g, a) => (g[a._id] = _.value.filter((w) => w.restaurants.some((f) => f.id === a._id)).map((w) => w._id), g), {})), B = R(() => Ge(n.value.permissions));
|
|
861
|
+
function V(g) {
|
|
862
|
+
const a = C(n.value.permissions, g);
|
|
863
|
+
n.value = {
|
|
864
|
+
...n.value,
|
|
865
|
+
permissions: a,
|
|
866
|
+
posUser: h(n.value.posUser, a)
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
const U = R(() => Se(n.value.permissions));
|
|
870
|
+
function C(g, a) {
|
|
871
|
+
var S;
|
|
872
|
+
let w = Z(
|
|
873
|
+
g.filter(
|
|
874
|
+
(D) => D.subject !== G.Subject.Business.restaurant && D.subject !== G.Subject.Restaurant.restaurant
|
|
875
|
+
)
|
|
876
|
+
);
|
|
877
|
+
if (!a || a.length > 0) {
|
|
878
|
+
w.push(ce.restaurant);
|
|
879
|
+
const D = {
|
|
880
|
+
actions: [G.Action.manage],
|
|
881
|
+
subject: G.Subject.Restaurant.restaurant
|
|
882
|
+
};
|
|
883
|
+
a && (D.conditions = JSON.stringify({ restaurantId: { $in: a } })), w.push(D);
|
|
884
|
+
}
|
|
885
|
+
if (a) {
|
|
886
|
+
const D = [
|
|
887
|
+
...new Set(a.map((W) => N.value[W]).flatMap((W) => W))
|
|
888
|
+
], le = _.value.map((W) => W._id);
|
|
889
|
+
D.length !== le.length && (w = f(
|
|
890
|
+
w,
|
|
891
|
+
(S = U.value || le) == null ? void 0 : S.filter((W) => D.includes(W))
|
|
892
|
+
));
|
|
893
|
+
}
|
|
894
|
+
function f(D, le) {
|
|
895
|
+
let W = Z(
|
|
896
|
+
D.filter((fe) => fe.subject !== G.Subject.Business.role)
|
|
897
|
+
);
|
|
898
|
+
const se = Z(ce.role);
|
|
899
|
+
return le && (se.conditions = JSON.stringify({ roleId: { $in: le } })), W.push(se), W;
|
|
900
|
+
}
|
|
901
|
+
return w;
|
|
902
|
+
}
|
|
903
|
+
function b(g) {
|
|
904
|
+
const a = c(n.value.permissions, g);
|
|
905
|
+
n.value = {
|
|
906
|
+
...n.value,
|
|
907
|
+
permissions: a,
|
|
908
|
+
posUser: h(n.value.posUser, a)
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
function c(g, a) {
|
|
912
|
+
let w = Z(
|
|
913
|
+
g.filter((S) => S.subject !== G.Subject.Business.role)
|
|
914
|
+
);
|
|
915
|
+
const f = Z(ce.role);
|
|
916
|
+
return a && (f.conditions = JSON.stringify({ roleId: { $in: a } })), w.push(f), w;
|
|
917
|
+
}
|
|
918
|
+
function h(g, a) {
|
|
919
|
+
if (!g) return;
|
|
920
|
+
const w = Se(a);
|
|
921
|
+
if (!w) return g;
|
|
922
|
+
const f = Z(g);
|
|
923
|
+
return f.roles = f.roles.reduce((S, D) => (w.includes(D.roleId) && S.push(D), S), []), f;
|
|
924
|
+
}
|
|
925
|
+
const E = R(() => {
|
|
926
|
+
const g = U.value;
|
|
927
|
+
return _.value.map((a) => ({
|
|
928
|
+
label: a.name,
|
|
929
|
+
value: a._id,
|
|
930
|
+
disabled: !!g && !g.includes(a._id)
|
|
931
|
+
}));
|
|
932
|
+
}), L = j();
|
|
933
|
+
async function Y() {
|
|
934
|
+
await _e(), L.value && L.value.$el.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
935
|
+
}
|
|
936
|
+
return Ve(
|
|
937
|
+
n,
|
|
938
|
+
(g) => {
|
|
939
|
+
i("permissionChanged", g);
|
|
940
|
+
},
|
|
941
|
+
{ deep: !0 }
|
|
942
|
+
), (g, a) => {
|
|
943
|
+
var w, f;
|
|
944
|
+
return m(), P("div", Al, [
|
|
945
|
+
l.isOwner ? O("", !0) : (m(), P("div", Il, [
|
|
946
|
+
v(_l, {
|
|
947
|
+
modelValue: n.value.permissions,
|
|
948
|
+
"onUpdate:modelValue": a[0] || (a[0] = (S) => n.value.permissions = S),
|
|
949
|
+
disable: l.isOwner,
|
|
950
|
+
"excluded-subjects": k
|
|
951
|
+
}, null, 8, ["modelValue", "disable"])
|
|
952
|
+
])),
|
|
953
|
+
l.isOwner ? O("", !0) : (m(), P("div", Dl, [
|
|
954
|
+
v(Ce, {
|
|
955
|
+
"model-value": $.value,
|
|
956
|
+
options: p.value.map((S) => ({
|
|
957
|
+
label: S.profile.name,
|
|
958
|
+
value: S._id
|
|
959
|
+
})),
|
|
960
|
+
context: d(r)("team.labels.warehouse"),
|
|
961
|
+
"onUpdate:modelValue": y
|
|
962
|
+
}, null, 8, ["model-value", "options", "context"])
|
|
963
|
+
])),
|
|
964
|
+
l.isOwner ? O("", !0) : (m(), P("div", ql, [
|
|
965
|
+
v(Ce, {
|
|
966
|
+
"model-value": B.value,
|
|
967
|
+
options: d(s).map((S) => ({
|
|
968
|
+
label: `${S.profile.code ? S.profile.code + "-" : ""}${S.profile.name}`,
|
|
969
|
+
value: S._id
|
|
970
|
+
})),
|
|
971
|
+
context: d(r)("team.labels.restaurant"),
|
|
972
|
+
"onUpdate:modelValue": V
|
|
973
|
+
}, null, 8, ["model-value", "options", "context"])
|
|
974
|
+
])),
|
|
975
|
+
l.isOwner ? O("", !0) : (m(), P("div", El, [
|
|
976
|
+
v(Ol, {
|
|
977
|
+
roles: d(_),
|
|
978
|
+
"model-value": U.value,
|
|
979
|
+
"restaurant-ids": B.value,
|
|
980
|
+
"onUpdate:modelValue": b
|
|
981
|
+
}, null, 8, ["roles", "model-value", "restaurant-ids"])
|
|
982
|
+
])),
|
|
983
|
+
u("div", null, [
|
|
984
|
+
v(jl, {
|
|
985
|
+
ref_key: "masterUserContentRef",
|
|
986
|
+
ref: L,
|
|
987
|
+
modelValue: n.value.posUser,
|
|
988
|
+
"onUpdate:modelValue": [
|
|
989
|
+
a[1] || (a[1] = (S) => n.value.posUser = S),
|
|
990
|
+
Y
|
|
991
|
+
],
|
|
992
|
+
"fallback-name": l.username,
|
|
993
|
+
"fallback-passcode": (f = (w = l.initialValue) == null ? void 0 : w.posUser) == null ? void 0 : f.passcode,
|
|
994
|
+
restaurants: d(s),
|
|
995
|
+
roles: E.value
|
|
996
|
+
}, null, 8, ["modelValue", "fallback-name", "fallback-passcode", "restaurants", "roles"])
|
|
997
|
+
])
|
|
998
|
+
]);
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
}), Pe = {
|
|
1002
|
+
async readPermissionUserByPhoneNo(l) {
|
|
1003
|
+
var e;
|
|
1004
|
+
const { currentBusiness: t } = re();
|
|
1005
|
+
return ge(
|
|
1006
|
+
await Fe("/").get(`/user/b/${(e = t.value) == null ? void 0 : e._id}/phone/${l}`)
|
|
1007
|
+
);
|
|
1008
|
+
},
|
|
1009
|
+
async readPermissionUserByEmail(l) {
|
|
1010
|
+
var e;
|
|
1011
|
+
const { currentBusiness: t } = re();
|
|
1012
|
+
return ge(
|
|
1013
|
+
await Fe("/").get(`/user/b/${(e = t.value) == null ? void 0 : e._id}/email/${l}`)
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
}, Tl = { class: "flex flex-col gap-24 w-full" }, zl = {
|
|
1017
|
+
key: 0,
|
|
1018
|
+
class: "flex flex-col gap-8"
|
|
1019
|
+
}, Wl = { class: "user-info-icon user-info-icon--lg" }, Kl = { class: "flex-1 overflow-hidden" }, Gl = { class: "profile-displayName" }, Jl = { class: "profile-email" }, Hl = { class: "profile-phone" }, Yl = { key: 2 }, Ql = /* @__PURE__ */ z({
|
|
1020
|
+
__name: "PortalUserSearcher",
|
|
1021
|
+
emits: ["invite"],
|
|
1022
|
+
setup(l, { emit: t }) {
|
|
1023
|
+
const e = t, { t: i } = ee(), r = we(), n = re(), k = j("phone"), $ = j(""), p = j(""), y = j();
|
|
1024
|
+
async function F() {
|
|
1025
|
+
if (!$.value && !p.value) {
|
|
1026
|
+
r.open({
|
|
1027
|
+
type: "error",
|
|
1028
|
+
title: i("team.memberForm.searchUser.emptyError")
|
|
1029
|
+
});
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
const V = k.value === "phone" ? await Pe.readPermissionUserByPhoneNo($.value.replace(/ /g, "")) : await Pe.readPermissionUserByEmail(p.value);
|
|
1033
|
+
V || r.open({
|
|
1034
|
+
type: "error",
|
|
1035
|
+
title: i("team.memberForm.searchUser.userNotFound")
|
|
1036
|
+
}), y.value = V;
|
|
1037
|
+
}
|
|
1038
|
+
const s = R(() => {
|
|
1039
|
+
var b;
|
|
1040
|
+
let V = ((b = y.value) == null ? void 0 : b.displayName) ?? "";
|
|
1041
|
+
V || (V = "Feed Me");
|
|
1042
|
+
const [U, C] = V.split(" ");
|
|
1043
|
+
return C ? `${U[0]}${C[0]}` : U.slice(0, 2);
|
|
1044
|
+
}), _ = j(!1);
|
|
1045
|
+
function N(V) {
|
|
1046
|
+
e("invite", V), _.value = !0;
|
|
1047
|
+
}
|
|
1048
|
+
function B() {
|
|
1049
|
+
_.value = !1;
|
|
1050
|
+
}
|
|
1051
|
+
return (V, U) => {
|
|
1052
|
+
var L, Y, g;
|
|
1053
|
+
const C = M("FmRadio"), b = M("FmPhoneNumber"), c = M("FmTextField"), h = M("FmRadioGroup"), E = M("FmButton");
|
|
1054
|
+
return m(), P("div", Tl, [
|
|
1055
|
+
_.value ? O("", !0) : (m(), P("div", zl, [
|
|
1056
|
+
v(h, {
|
|
1057
|
+
modelValue: k.value,
|
|
1058
|
+
"onUpdate:modelValue": U[2] || (U[2] = (a) => k.value = a)
|
|
1059
|
+
}, {
|
|
1060
|
+
default: q(() => [
|
|
1061
|
+
v(C, {
|
|
1062
|
+
value: "phone",
|
|
1063
|
+
label: d(i)("team.memberForm.searchUser.phoneNumber")
|
|
1064
|
+
}, null, 8, ["label"]),
|
|
1065
|
+
k.value === "phone" ? (m(), I(b, {
|
|
1066
|
+
key: 0,
|
|
1067
|
+
modelValue: $.value,
|
|
1068
|
+
"onUpdate:modelValue": U[0] || (U[0] = (a) => $.value = a),
|
|
1069
|
+
"extra-country-codes": d(n).enabledCountries.value,
|
|
1070
|
+
class: "ml-8"
|
|
1071
|
+
}, null, 8, ["modelValue", "extra-country-codes"])) : O("", !0),
|
|
1072
|
+
v(C, {
|
|
1073
|
+
value: "email",
|
|
1074
|
+
label: d(i)("team.memberForm.searchUser.email")
|
|
1075
|
+
}, null, 8, ["label"]),
|
|
1076
|
+
k.value === "email" ? (m(), I(c, {
|
|
1077
|
+
key: 1,
|
|
1078
|
+
modelValue: p.value,
|
|
1079
|
+
"onUpdate:modelValue": U[1] || (U[1] = (a) => p.value = a),
|
|
1080
|
+
placeholder: d(i)("team.memberForm.searchUser.emailPlaceholder"),
|
|
1081
|
+
class: "ml-8"
|
|
1082
|
+
}, null, 8, ["modelValue", "placeholder"])) : O("", !0)
|
|
1083
|
+
]),
|
|
1084
|
+
_: 1
|
|
1085
|
+
}, 8, ["modelValue"]),
|
|
1086
|
+
v(E, {
|
|
1087
|
+
label: d(i)("team.memberForm.searchUser.search"),
|
|
1088
|
+
variant: "secondary",
|
|
1089
|
+
onClick: F
|
|
1090
|
+
}, null, 8, ["label"])
|
|
1091
|
+
])),
|
|
1092
|
+
y.value ? (m(), P("div", {
|
|
1093
|
+
key: 1,
|
|
1094
|
+
class: "profile-menu--profile cursor-pointer hover:bg-fm-color-opacity-sm",
|
|
1095
|
+
onClick: U[3] || (U[3] = (a) => N(y.value))
|
|
1096
|
+
}, [
|
|
1097
|
+
u("div", Wl, A(s.value), 1),
|
|
1098
|
+
u("div", Kl, [
|
|
1099
|
+
u("p", Gl, A((L = y.value) == null ? void 0 : L.displayName), 1),
|
|
1100
|
+
u("p", Jl, A((Y = y.value) == null ? void 0 : Y.email), 1),
|
|
1101
|
+
u("p", Hl, A((g = y.value) == null ? void 0 : g.phoneNumber), 1)
|
|
1102
|
+
])
|
|
1103
|
+
])) : O("", !0),
|
|
1104
|
+
_.value ? (m(), P("div", Yl, [
|
|
1105
|
+
v(E, {
|
|
1106
|
+
label: d(i)("team.memberForm.searchUser.changeUser"),
|
|
1107
|
+
variant: "secondary",
|
|
1108
|
+
onClick: B
|
|
1109
|
+
}, null, 8, ["label"])
|
|
1110
|
+
])) : O("", !0)
|
|
1111
|
+
]);
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
}), Xl = /* @__PURE__ */ Le(Ql, [["__scopeId", "data-v-c2c7ed35"]]), Zl = { class: "flex w-full pb-24" }, et = /* @__PURE__ */ z({
|
|
1115
|
+
__name: "AddMemberForm",
|
|
1116
|
+
props: {
|
|
1117
|
+
initialValue: {
|
|
1118
|
+
type: Object
|
|
1119
|
+
},
|
|
1120
|
+
roleErrorMessage: {
|
|
1121
|
+
type: String,
|
|
1122
|
+
default: ""
|
|
1123
|
+
}
|
|
1124
|
+
},
|
|
1125
|
+
setup(l, { expose: t }) {
|
|
1126
|
+
const e = l, i = j(), r = j({
|
|
1127
|
+
permissions: []
|
|
1128
|
+
});
|
|
1129
|
+
function n(F) {
|
|
1130
|
+
i.value = F;
|
|
1131
|
+
}
|
|
1132
|
+
function k(F) {
|
|
1133
|
+
r.value = { ...r.value, ...F };
|
|
1134
|
+
}
|
|
1135
|
+
function $() {
|
|
1136
|
+
var F, s, _, N, B, V, U, C;
|
|
1137
|
+
return {
|
|
1138
|
+
email: ((F = i.value) == null ? void 0 : F.email) ?? void 0,
|
|
1139
|
+
phoneNumber: ((s = i.value) == null ? void 0 : s.phoneNumber) ?? void 0,
|
|
1140
|
+
permissions: r.value.permissions,
|
|
1141
|
+
posUser: r.value.posUser ? {
|
|
1142
|
+
...r.value.posUser,
|
|
1143
|
+
name: r.value.posUser.name || ((N = (_ = e.initialValue) == null ? void 0 : _.posUser) == null ? void 0 : N.name) || ((B = e.initialValue) == null ? void 0 : B.name) || ((V = i.value) == null ? void 0 : V.displayName) || "",
|
|
1144
|
+
code: r.value.posUser.code || ((C = (U = e.initialValue) == null ? void 0 : U.posUser) == null ? void 0 : C.code) || "",
|
|
1145
|
+
passcode: r.value.posUser.passcode,
|
|
1146
|
+
roles: r.value.posUser.roles.filter((b) => !!b.roleId)
|
|
1147
|
+
} : void 0
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
const p = j();
|
|
1151
|
+
async function y() {
|
|
1152
|
+
return (await p.value.validateInputsWithoutSubmit()).length ? null : $();
|
|
1153
|
+
}
|
|
1154
|
+
return t({
|
|
1155
|
+
readFormData: $,
|
|
1156
|
+
validate: y
|
|
1157
|
+
}), (F, s) => {
|
|
1158
|
+
const _ = M("FmForm");
|
|
1159
|
+
return m(), I(_, {
|
|
1160
|
+
ref_key: "formRef",
|
|
1161
|
+
ref: p,
|
|
1162
|
+
class: "mx-4 flex flex-col"
|
|
1163
|
+
}, {
|
|
1164
|
+
default: q(() => {
|
|
1165
|
+
var N, B, V;
|
|
1166
|
+
return [
|
|
1167
|
+
u("div", Zl, [
|
|
1168
|
+
e.initialValue ? (m(), I(ml, {
|
|
1169
|
+
key: 1,
|
|
1170
|
+
data: e.initialValue
|
|
1171
|
+
}, null, 8, ["data"])) : (m(), I(Xl, {
|
|
1172
|
+
key: 0,
|
|
1173
|
+
onInvite: s[0] || (s[0] = (U) => n(U))
|
|
1174
|
+
}))
|
|
1175
|
+
]),
|
|
1176
|
+
i.value || l.initialValue ? (m(), I(Ll, {
|
|
1177
|
+
key: 0,
|
|
1178
|
+
username: ((N = l.initialValue) == null ? void 0 : N.name) || ((B = i.value) == null ? void 0 : B.displayName) || "",
|
|
1179
|
+
initialValue: l.initialValue,
|
|
1180
|
+
isOwner: (V = l.initialValue) == null ? void 0 : V.isOwner,
|
|
1181
|
+
onPermissionChanged: s[1] || (s[1] = (U) => k(U))
|
|
1182
|
+
}, null, 8, ["username", "initialValue", "isOwner"])) : O("", !0)
|
|
1183
|
+
];
|
|
1184
|
+
}),
|
|
1185
|
+
_: 1
|
|
1186
|
+
}, 512);
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
function lt() {
|
|
1191
|
+
const l = we();
|
|
1192
|
+
function t(i) {
|
|
1193
|
+
l.open({ title: i, type: "success" });
|
|
1194
|
+
}
|
|
1195
|
+
function e(i) {
|
|
1196
|
+
l.open({ title: i, type: "error" });
|
|
1197
|
+
}
|
|
1198
|
+
return {
|
|
1199
|
+
success: t,
|
|
1200
|
+
error: e
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
const tt = {
|
|
1204
|
+
class: "space-y-24"
|
|
1205
|
+
}, st = {
|
|
1206
|
+
class: "space-y-8"
|
|
1207
|
+
}, at = {
|
|
1208
|
+
class: "xs:hidden flex w-full items-start justify-between px-16"
|
|
1209
|
+
}, ot = {
|
|
1210
|
+
class: "flex items-start gap-8"
|
|
1211
|
+
}, nt = {
|
|
1212
|
+
class: "space-y-4 hidden xs:block px-16"
|
|
1213
|
+
}, rt = {
|
|
1214
|
+
class: "flex items-start gap-8"
|
|
1215
|
+
}, it = {
|
|
1216
|
+
key: 0
|
|
1217
|
+
}, ut = {
|
|
1218
|
+
key: 1,
|
|
1219
|
+
class: "bg-fm-color-neutral-white shadow-light-300 flex max-h-dvh items-center justify-center gap-24 self-stretch p-24"
|
|
1220
|
+
}, mt = {
|
|
1221
|
+
class: "flex flex-col items-center justify-center gap-16"
|
|
1222
|
+
}, dt = ["src"], ct = {
|
|
1223
|
+
class: "fm-typo-title-sm-700"
|
|
1224
|
+
}, pt = {
|
|
1225
|
+
class: "fm-typo-body-md-400 text-center text-gray-500"
|
|
1226
|
+
}, ft = {
|
|
1227
|
+
class: "flex items-center justify-start gap-8"
|
|
1228
|
+
};
|
|
1229
|
+
var H = /* @__PURE__ */ function(l) {
|
|
1230
|
+
return l[l.ADD = 0] = "ADD", l[l.UPDATE = 1] = "UPDATE", l[l.CLOSED = 2] = "CLOSED", l;
|
|
1231
|
+
}(H || {});
|
|
1232
|
+
const Ft = /* @__PURE__ */ z({
|
|
1233
|
+
__name: "TeamMemberList",
|
|
1234
|
+
setup(l) {
|
|
1235
|
+
const {
|
|
1236
|
+
t
|
|
1237
|
+
} = ee(), e = re(), i = Oe(), {
|
|
1238
|
+
success: r,
|
|
1239
|
+
error: n
|
|
1240
|
+
} = lt(), k = ({
|
|
1241
|
+
member: o,
|
|
1242
|
+
className: x = ""
|
|
1243
|
+
}) => {
|
|
1244
|
+
const K = {
|
|
1245
|
+
label: t("common.update"),
|
|
1246
|
+
onClick: () => s(ae.Update, o)
|
|
1247
|
+
}, J = {
|
|
1248
|
+
label: t("common.remove"),
|
|
1249
|
+
onClick: () => s(ae.Remove, o),
|
|
1250
|
+
itemClass: "text-fm-color-typo-error"
|
|
1251
|
+
}, X = o.doc.isOwner ? [K] : [K, J];
|
|
1252
|
+
return v(Qe, {
|
|
1253
|
+
class: x,
|
|
1254
|
+
items: X
|
|
1255
|
+
}, null);
|
|
1256
|
+
}, $ = (o) => o.doc.isOwner ? t("team.labels.businessOwner") : o.restaurants.join(", "), p = [{
|
|
1257
|
+
accessorKey: "name",
|
|
1258
|
+
header: () => t("team.table.columns.name"),
|
|
1259
|
+
enableSorting: !1
|
|
1260
|
+
}, {
|
|
1261
|
+
accessorKey: "phoneNumber",
|
|
1262
|
+
header: () => t("team.table.columns.phoneNumber"),
|
|
1263
|
+
enableSorting: !1
|
|
1264
|
+
}, {
|
|
1265
|
+
accessorKey: "restaurant",
|
|
1266
|
+
header: () => t("team.table.columns.restaurant"),
|
|
1267
|
+
enableSorting: !1,
|
|
1268
|
+
cell(o) {
|
|
1269
|
+
const x = o.row.original;
|
|
1270
|
+
return $(x);
|
|
1271
|
+
}
|
|
1272
|
+
}, {
|
|
1273
|
+
accessorKey: "permission",
|
|
1274
|
+
header: () => t("team.table.columns.permission"),
|
|
1275
|
+
enableSorting: !1,
|
|
1276
|
+
cell(o) {
|
|
1277
|
+
const x = o.row.original;
|
|
1278
|
+
return y(x);
|
|
1279
|
+
},
|
|
1280
|
+
meta: {
|
|
1281
|
+
width: "200px"
|
|
1282
|
+
}
|
|
1283
|
+
}, {
|
|
1284
|
+
id: "action",
|
|
1285
|
+
meta: {
|
|
1286
|
+
cellClass: "pl-16",
|
|
1287
|
+
headerContentClass: "-mx-16"
|
|
1288
|
+
},
|
|
1289
|
+
cell(o) {
|
|
1290
|
+
const x = o.row.original;
|
|
1291
|
+
return k({
|
|
1292
|
+
member: x,
|
|
1293
|
+
className: "flex justify-end w-full"
|
|
1294
|
+
});
|
|
1295
|
+
},
|
|
1296
|
+
enableSorting: !1
|
|
1297
|
+
}];
|
|
1298
|
+
function y(o) {
|
|
1299
|
+
return o.doc.isOwner ? t("team.labels.businessOwner") : v("div", {
|
|
1300
|
+
class: "flex flex-row items-center gap-8"
|
|
1301
|
+
}, [v("span", null, [t("team.labels.allowed", {
|
|
1302
|
+
count: o.permissions.length
|
|
1303
|
+
})]), v(Ee.FmTooltip, {
|
|
1304
|
+
variant: "plain",
|
|
1305
|
+
placement: "top"
|
|
1306
|
+
}, {
|
|
1307
|
+
default: () => v(M("componentsFmIcon"), {
|
|
1308
|
+
name: "info",
|
|
1309
|
+
class: "cursor-pointer text-fm-color-neutral-gray-300"
|
|
1310
|
+
}, null),
|
|
1311
|
+
content: () => v("div", null, [t("team.labels.permission"), o.permissions.map((x) => v("div", null, [xe("- "), x]))])
|
|
1312
|
+
})]);
|
|
1313
|
+
}
|
|
1314
|
+
function F(o) {
|
|
1315
|
+
var x, K, J, X;
|
|
1316
|
+
return {
|
|
1317
|
+
id: o.id,
|
|
1318
|
+
isOwner: o.doc.isOwner,
|
|
1319
|
+
name: o.name,
|
|
1320
|
+
phoneNumber: o.phoneNumber,
|
|
1321
|
+
email: o.email,
|
|
1322
|
+
permissions: o.doc.permissions,
|
|
1323
|
+
posUser: o.doc.posUser ? {
|
|
1324
|
+
code: ((x = o.doc.posUser) == null ? void 0 : x.code) ?? "",
|
|
1325
|
+
name: ((K = o.doc.posUser) == null ? void 0 : K.name) ?? o.name,
|
|
1326
|
+
passcode: ((J = o.doc.posUser) == null ? void 0 : J.passcode) ?? "",
|
|
1327
|
+
roles: ((X = o.doc.posUser) == null ? void 0 : X.roles) ?? []
|
|
1328
|
+
} : void 0
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
const s = (o, x) => {
|
|
1332
|
+
if (o == ae.Update) {
|
|
1333
|
+
const K = F(x);
|
|
1334
|
+
b.value = K, B.value = H.UPDATE;
|
|
1335
|
+
}
|
|
1336
|
+
o == ae.Remove && L(x);
|
|
1337
|
+
}, _ = we(), N = qe(), B = j(H.CLOSED), V = R(() => B.value !== H.CLOSED), U = R(() => B.value === H.ADD ? t("common.add") : t("common.update")), C = R(() => B.value === H.ADD ? t("team.actions.addMember") : t("team.actions.updateMember")), b = j();
|
|
1338
|
+
function c(o) {
|
|
1339
|
+
o || (B.value = H.CLOSED);
|
|
1340
|
+
}
|
|
1341
|
+
function h() {
|
|
1342
|
+
B.value = H.CLOSED;
|
|
1343
|
+
}
|
|
1344
|
+
const {
|
|
1345
|
+
breakpoints: E
|
|
1346
|
+
} = Be(), L = (o) => {
|
|
1347
|
+
N.open({
|
|
1348
|
+
title: t("team.actions.removeMember"),
|
|
1349
|
+
message: t("team.removeMember.confirmationMessage", {
|
|
1350
|
+
memberName: o.name
|
|
1351
|
+
}),
|
|
1352
|
+
minWidth: E.value.lg ? 588 : 0,
|
|
1353
|
+
primaryActions: {
|
|
1354
|
+
text: "Remove",
|
|
1355
|
+
close: !1,
|
|
1356
|
+
variant: "destructive"
|
|
1357
|
+
},
|
|
1358
|
+
secondaryActions: {
|
|
1359
|
+
text: "Cancel",
|
|
1360
|
+
close: !0
|
|
1361
|
+
}
|
|
1362
|
+
}).onPrimary(async () => {
|
|
1363
|
+
await me.deleteTeamMember(o.id).then(() => _.open({
|
|
1364
|
+
message: t("team.removeMember.successMessage", {
|
|
1365
|
+
memberName: o.name
|
|
1366
|
+
}),
|
|
1367
|
+
type: "success"
|
|
1368
|
+
})).catch((x) => n(x)), N.close(), W();
|
|
1369
|
+
});
|
|
1370
|
+
}, Y = () => {
|
|
1371
|
+
b.value = null, B.value = H.ADD;
|
|
1372
|
+
}, g = j([]), a = j(), w = j(), f = R(() => Object.values(ce).map((o) => ({
|
|
1373
|
+
label: o.label,
|
|
1374
|
+
value: o.subject
|
|
1375
|
+
}))), {
|
|
1376
|
+
searchKey: S,
|
|
1377
|
+
filter: D
|
|
1378
|
+
} = je(""), le = R(() => g.value.filter((o) => {
|
|
1379
|
+
var X;
|
|
1380
|
+
const x = !a.value || o.managableRestaurantIds.some((te) => a.value.includes(te)), K = ((X = o.doc.permissions) == null ? void 0 : X.map((te) => te.subject).flat().filter(Boolean)) || [], J = !w.value || K.some((te) => w.value.includes(te));
|
|
1381
|
+
return x && J && D([o.name, o.phoneNumber, $(o)]);
|
|
1382
|
+
}));
|
|
1383
|
+
async function W(o = !0) {
|
|
1384
|
+
const x = await me.readTeamMembers();
|
|
1385
|
+
g.value = x.sort((K, J) => K.doc.isOwner ? -1 : K.name.localeCompare(J.name)), o || await i.readRoles();
|
|
1386
|
+
}
|
|
1387
|
+
const se = j();
|
|
1388
|
+
async function fe() {
|
|
1389
|
+
if (se.value) {
|
|
1390
|
+
const o = await se.value.validate();
|
|
1391
|
+
if (!o) return;
|
|
1392
|
+
try {
|
|
1393
|
+
await (B.value === H.ADD ? me.createTeamMember(o) : me.updateTeamMember(b.value.id, o)), await W(), B.value === H.ADD ? r(t("team.addMember.successMessage", {
|
|
1394
|
+
memberName: o.name
|
|
1395
|
+
})) : r(t("team.updateMember.successMessage", {
|
|
1396
|
+
memberName: o.name
|
|
1397
|
+
}));
|
|
1398
|
+
} catch (x) {
|
|
1399
|
+
n(x);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
B.value = H.CLOSED;
|
|
1403
|
+
}
|
|
1404
|
+
return Ve(e.currentBusiness, () => {
|
|
1405
|
+
var o;
|
|
1406
|
+
(o = e.currentBusiness.value) != null && o._id && W(!1);
|
|
1407
|
+
}, {
|
|
1408
|
+
immediate: !0
|
|
1409
|
+
}), (o, x) => {
|
|
1410
|
+
const K = M("FmSpacer"), J = M("FmButton"), X = M("FmSearch"), te = M("FmTable"), Ne = M("FmSideSheet");
|
|
1411
|
+
return m(), P(ne, null, [v(ze, {
|
|
1412
|
+
heading: d(t)("team.title")
|
|
1413
|
+
}, {
|
|
1414
|
+
"append-heading": q(() => [v(K), v(J, {
|
|
1415
|
+
"prepend-icon": "add",
|
|
1416
|
+
label: d(t)("team.actions.addMember"),
|
|
1417
|
+
onClick: Y
|
|
1418
|
+
}, null, 8, ["label"])]),
|
|
1419
|
+
default: q(() => [u("div", tt, [u("div", st, [u("div", at, [u("div", ot, [v(d($e), {
|
|
1420
|
+
modelValue: a.value,
|
|
1421
|
+
"onUpdate:modelValue": x[0] || (x[0] = (T) => a.value = T),
|
|
1422
|
+
"managable-only": !1,
|
|
1423
|
+
multiple: "",
|
|
1424
|
+
variant: "dark",
|
|
1425
|
+
class: "!w-auto"
|
|
1426
|
+
}, null, 8, ["modelValue"]), v(Ue, {
|
|
1427
|
+
modelValue: w.value,
|
|
1428
|
+
"onUpdate:modelValue": x[1] || (x[1] = (T) => w.value = T),
|
|
1429
|
+
multiple: "",
|
|
1430
|
+
variant: "dark",
|
|
1431
|
+
items: f.value,
|
|
1432
|
+
"selected-prefix": d(t)("team.filter.selected_permission_prefix"),
|
|
1433
|
+
placeholder: d(t)("team.filter.permission_placeholder")
|
|
1434
|
+
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), v(X, {
|
|
1435
|
+
modelValue: d(S),
|
|
1436
|
+
"onUpdate:modelValue": x[2] || (x[2] = (T) => ye(S) ? S.value = T : null),
|
|
1437
|
+
class: "w-[320px] xs:w-full xs:mt-8",
|
|
1438
|
+
autofocus: "",
|
|
1439
|
+
placeholder: d(t)("team.search.placeholder")
|
|
1440
|
+
}, null, 8, ["modelValue", "placeholder"])]), u("div", nt, [v(X, {
|
|
1441
|
+
modelValue: d(S),
|
|
1442
|
+
"onUpdate:modelValue": x[3] || (x[3] = (T) => ye(S) ? S.value = T : null),
|
|
1443
|
+
class: "w-[320px] xs:w-full xs:mt-8",
|
|
1444
|
+
autofocus: "",
|
|
1445
|
+
placeholder: d(t)("team.search.placeholder")
|
|
1446
|
+
}, null, 8, ["modelValue", "placeholder"]), u("div", rt, [v(d($e), {
|
|
1447
|
+
modelValue: a.value,
|
|
1448
|
+
"onUpdate:modelValue": x[4] || (x[4] = (T) => a.value = T),
|
|
1449
|
+
"managable-only": !1,
|
|
1450
|
+
multiple: "",
|
|
1451
|
+
variant: "dark",
|
|
1452
|
+
class: "!w-auto"
|
|
1453
|
+
}, null, 8, ["modelValue"]), v(Ue, {
|
|
1454
|
+
modelValue: w.value,
|
|
1455
|
+
"onUpdate:modelValue": x[5] || (x[5] = (T) => w.value = T),
|
|
1456
|
+
multiple: "",
|
|
1457
|
+
variant: "dark",
|
|
1458
|
+
items: f.value,
|
|
1459
|
+
"selected-prefix": d(t)("team.filter.selected_permission_prefix"),
|
|
1460
|
+
placeholder: d(t)("team.filter.permission_placeholder")
|
|
1461
|
+
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), g.value && g.value.length > 0 ? (m(), P("div", it, [v(Te, null, {
|
|
1462
|
+
default: q(() => [v(te, {
|
|
1463
|
+
"column-defs": p,
|
|
1464
|
+
"row-data": le.value,
|
|
1465
|
+
"page-size": le.value.length,
|
|
1466
|
+
"pin-header-row": "",
|
|
1467
|
+
"hide-footer": "",
|
|
1468
|
+
"shrink-at": !1,
|
|
1469
|
+
onRowClick: x[6] || (x[6] = (T) => s(d(ae).Update, T.original))
|
|
1470
|
+
}, null, 8, ["row-data", "page-size"])]),
|
|
1471
|
+
_: 1
|
|
1472
|
+
})])) : (m(), P("div", ut, [u("div", mt, [u("div", null, [u("img", {
|
|
1473
|
+
src: d(We),
|
|
1474
|
+
alt: "List is empty"
|
|
1475
|
+
}, null, 8, dt)]), u("p", ct, A(d(t)("team.emptyState.title")), 1), u("p", pt, A(d(t)("team.emptyState.description")), 1)])]))])])]),
|
|
1476
|
+
_: 1
|
|
1477
|
+
}, 8, ["heading"]), v(Ne, {
|
|
1478
|
+
header: C.value,
|
|
1479
|
+
"model-value": V.value,
|
|
1480
|
+
"max-width": 560,
|
|
1481
|
+
"dismiss-away": "",
|
|
1482
|
+
"onUpdate:modelValue": x[7] || (x[7] = (T) => c(T))
|
|
1483
|
+
}, {
|
|
1484
|
+
"side-sheet-footer": q(() => [u("div", ft, [v(J, {
|
|
1485
|
+
label: U.value,
|
|
1486
|
+
size: "md",
|
|
1487
|
+
variant: "primary",
|
|
1488
|
+
onClick: Re(fe, ["prevent"])
|
|
1489
|
+
}, null, 8, ["label"]), v(J, {
|
|
1490
|
+
label: d(t)("common.cancel"),
|
|
1491
|
+
size: "md",
|
|
1492
|
+
variant: "secondary",
|
|
1493
|
+
onClick: h
|
|
1494
|
+
}, null, 8, ["label"])])]),
|
|
1495
|
+
default: q(() => [v(et, {
|
|
1496
|
+
ref_key: "memberForm",
|
|
1497
|
+
ref: se,
|
|
1498
|
+
initialValue: b.value,
|
|
1499
|
+
class: "gap-8"
|
|
1500
|
+
}, null, 8, ["initialValue"])]),
|
|
1501
|
+
_: 1
|
|
1502
|
+
}, 8, ["header", "model-value"])], 64);
|
|
1503
|
+
};
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
export {
|
|
1507
|
+
Ft as default
|
|
1508
|
+
};
|