@feedmepos/mf-hrm-portal 2.0.20-dev.2 → 2.0.20-dev.4
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-ChxAzO74.js → AuditLogList-BYYLqx_Y.js} +4 -4
- package/dist/{EmployeeList-Cs-Mn6UA.js → EmployeeList-faGmAgin.js} +214 -206
- package/dist/{Main-B9_TyRDo.js → Main-BAKU5xhk.js} +9 -9
- package/dist/{Main-DcvmP7s-.js → Main-BqGguhdK.js} +4 -4
- package/dist/{Main-CdHW4UkN.js → Main-DYtpusvH.js} +5 -5
- package/dist/{PermissionSetList-VFVS0g0v.js → PermissionSetList-BkNXF5wd.js} +115 -107
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Dr3R9JjS.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BSLC4-XO.js} +687 -674
- package/dist/{RoleList-BZ6RZvm2.js → RoleList-CU6fMUKg.js} +201 -193
- package/dist/{TeamMemberList-C-zhFauD.js → TeamMemberList-DWXfFltX.js} +427 -418
- package/dist/{TimesheetList-CZex54an.js → TimesheetList-oVhzBmO4.js} +6 -6
- package/dist/{app-CLL3p27X.js → app-C6YPb0ie.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-CDt1i9vl.js → dayjs.min-DjBQkDnl.js} +1 -1
- package/dist/{employee-BpRvjWNh.js → employee-CgQNP7Yg.js} +3 -3
- package/dist/{iteration-BVjUzYL5.js → iteration-DK5wFKKW.js} +1 -1
- package/dist/{lodash-CrwgACp2.js → lodash-D2og8lPS.js} +1 -1
- package/dist/{rule-BlQ5YZ9Z.js → rule-CkKkOqTh.js} +2 -2
- package/dist/{timesheet-jFs4GTAL.js → timesheet-AUYF-qUh.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-DMAL8VFY.js → useAppStore-BvpZCRgH.js} +1 -1
- package/dist/{useLoading-AFTjRLyO.js → useLoading-RPOCpcNO.js} +1 -1
- package/dist/{useReportPermissions-hODG0Xx3.js → useReportPermissions-wHthaWRW.js} +3 -3
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { computed as _, defineComponent as ge, ref as $, watch as se, onMounted as be, resolveComponent as
|
|
2
|
-
import { u as me, e as L } from "./iteration-
|
|
1
|
+
import { computed as _, defineComponent as ge, ref as $, watch as se, onMounted as be, resolveComponent as y, createBlock as P, openBlock as p, unref as o, withCtx as b, createElementVNode as d, createVNode as n, createElementBlock as k, Fragment as N, createCommentVNode as de, renderList as le, toDisplayString as A, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Ie, nextTick as fe } from "vue";
|
|
2
|
+
import { u as me, e as L } from "./iteration-DK5wFKKW.js";
|
|
3
3
|
import { useI18n as ye } from "@feedmepos/mf-common";
|
|
4
|
-
import { useSnackbar as xe, components as ue, useDialog as Ee, useBreakpoints as Ue, FmButtonColorThemeVariant as
|
|
5
|
-
import { _ as
|
|
6
|
-
import { u as
|
|
7
|
-
import { _ as
|
|
8
|
-
import { e as
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as Fe } from "./useReportPermissions-
|
|
11
|
-
import { l as
|
|
12
|
-
import { _ as
|
|
4
|
+
import { useSnackbar as xe, components as ue, useDialog as Ee, useBreakpoints as Ue, FmButtonColorThemeVariant as Se } from "@feedmepos/ui-library";
|
|
5
|
+
import { _ as Pe } from "./app-C6YPb0ie.js";
|
|
6
|
+
import { u as $e, _ as he } from "./useDiscardConfirm-DPhEV6v0.js";
|
|
7
|
+
import { _ as Te } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
|
|
8
|
+
import { e as Me, r as K, h as Ce, f as Be, g as _e, a as ae } from "./rule-CkKkOqTh.js";
|
|
9
|
+
import { u as Re } from "./useAppStore-BvpZCRgH.js";
|
|
10
|
+
import { u as Fe } from "./useReportPermissions-wHthaWRW.js";
|
|
11
|
+
import { l as te } from "./lodash-D2og8lPS.js";
|
|
12
|
+
import { _ as De } from "./CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js";
|
|
13
13
|
import { _ as ie } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
|
|
14
|
-
import { u as
|
|
15
|
-
function
|
|
16
|
-
const
|
|
14
|
+
import { u as Ne } from "./useLoading-RPOCpcNO.js";
|
|
15
|
+
function Ae() {
|
|
16
|
+
const W = me();
|
|
17
17
|
return _(() => {
|
|
18
18
|
const s = {};
|
|
19
|
-
return
|
|
20
|
-
s[
|
|
19
|
+
return W.restaurants.value.forEach((C) => {
|
|
20
|
+
s[C._id] = C;
|
|
21
21
|
}), s;
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const Oe = { class: "fm-typo-en-title-md-600" },
|
|
24
|
+
const Oe = { class: "flex w-full items-center justify-between" }, Je = { class: "fm-typo-en-title-md-600" }, qe = { class: "space-y-40" }, ze = {
|
|
25
25
|
key: 0,
|
|
26
26
|
class: "flex justify-center py-16"
|
|
27
|
-
},
|
|
27
|
+
}, je = { class: "space-y-8" }, Ke = { class: "fm-typo-en-title-sm-600" }, We = { class: "mt-16 space-y-8" }, Ge = {
|
|
28
28
|
key: 0,
|
|
29
29
|
class: "ml-20 mt-8 flex max-w-[320px] flex-row items-start gap-8"
|
|
30
|
-
},
|
|
30
|
+
}, He = { class: "mt-8 whitespace-nowrap" }, Qe = { class: "flex gap-8 items-center justify-start" }, Xe = /* @__PURE__ */ ge({
|
|
31
31
|
__name: "RoleForm",
|
|
32
32
|
props: {
|
|
33
33
|
id: {
|
|
@@ -35,30 +35,30 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
35
35
|
default: void 0
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
setup(
|
|
39
|
-
const { t: s } = ye(),
|
|
38
|
+
setup(W, { expose: G }) {
|
|
39
|
+
const { t: s } = ye(), C = me(), T = $(""), I = _(() => C.restaurants.value.filter(({ profile: e }) => {
|
|
40
40
|
const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
|
|
41
41
|
return !T.value || a.toLowerCase().includes(T.value.toLowerCase());
|
|
42
|
-
})), J = $(
|
|
42
|
+
})), J = $(C.restaurants.value.length === 0);
|
|
43
43
|
se(
|
|
44
|
-
() =>
|
|
44
|
+
() => C.restaurants.value.length,
|
|
45
45
|
(e) => {
|
|
46
46
|
e > 0 && (J.value = !1);
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
|
-
const M =
|
|
49
|
+
const M = Re(), H = xe(), Q = Ne(H), { fetchReportPermissions: X, allReportPermissions: oe, availableReportKeys: B } = Fe(), R = W, F = $(!1), re = () => {
|
|
50
50
|
F.value = !F.value, F.value && Z();
|
|
51
|
-
}, q = _(() =>
|
|
52
|
-
const e =
|
|
53
|
-
(
|
|
54
|
-
).map((
|
|
51
|
+
}, q = _(() => R.id ? s("hr.role.form.update") : s("hr.role.form.add")), Y = _(() => R.id ? s("common.update") : s("common.add")), O = _(() => {
|
|
52
|
+
const e = Me.filter(
|
|
53
|
+
(u) => u.subject !== L.F_RULE_SUBJECT.enum.report
|
|
54
|
+
).map((u) => K(u)), a = oe.value.map((u) => K(u));
|
|
55
55
|
return [...e, ...a];
|
|
56
|
-
}), v = _(() => M.roles.value.find((e) => e._id ==
|
|
56
|
+
}), v = _(() => M.roles.value.find((e) => e._id == R.id)), E = () => ({
|
|
57
57
|
name: "",
|
|
58
58
|
restaurantIds: [],
|
|
59
59
|
permissions: [],
|
|
60
60
|
maxDiscountPercentage: 100
|
|
61
|
-
}),
|
|
61
|
+
}), l = $(E()), z = _(() => [
|
|
62
62
|
{
|
|
63
63
|
title: s("hr.role.labels.operation"),
|
|
64
64
|
filter: (e) => e.isOrderOperation
|
|
@@ -73,35 +73,35 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
73
73
|
}
|
|
74
74
|
].map((e) => ({
|
|
75
75
|
title: e.title,
|
|
76
|
-
options: O.value.filter(e.filter).map(({ label: a, value:
|
|
77
|
-
label: s(`hr.role.form.permissionLabels.${
|
|
78
|
-
value:
|
|
76
|
+
options: O.value.filter(e.filter).map(({ label: a, value: u }) => ({
|
|
77
|
+
label: s(`hr.role.form.permissionLabels.${u}`, a),
|
|
78
|
+
value: u
|
|
79
79
|
}))
|
|
80
80
|
}))), g = _(() => {
|
|
81
81
|
var e;
|
|
82
|
-
return
|
|
82
|
+
return Ce(((e = v.value) == null ? void 0 : e.permissions) || []);
|
|
83
83
|
});
|
|
84
84
|
function Z() {
|
|
85
85
|
var e;
|
|
86
|
-
|
|
86
|
+
l.value = E(), l.value.name = ((e = v.value) == null ? void 0 : e.name) ?? "", g.value ? (l.value.restaurantIds = I.value.map((a) => a._id), l.value.permissions = O.value.map((a) => a.value)) : v.value && (l.value.restaurantIds = v.value.restaurants.map((a) => a.id), l.value.permissions = v.value.permissions.map((a) => K(a).value).filter((a) => a.startsWith("report:") ? B.value.has(a.split(":")[1]) : !0), l.value.maxDiscountPercentage = _e(
|
|
87
87
|
v.value.permissions
|
|
88
88
|
));
|
|
89
89
|
}
|
|
90
90
|
be(async () => {
|
|
91
|
-
await
|
|
91
|
+
await C.readRestaurants(), await X(), Z();
|
|
92
92
|
}), se(F, async (e) => {
|
|
93
93
|
e && await X();
|
|
94
94
|
}), se(B, () => {
|
|
95
|
-
F.value && v.value && !g.value && (
|
|
95
|
+
F.value && v.value && !g.value && (l.value.permissions = l.value.permissions.filter((e) => e.startsWith("report:") ? B.value.has(e.split(":")[1]) : !0));
|
|
96
96
|
});
|
|
97
|
-
const ne = $(""),
|
|
98
|
-
restaurantIds:
|
|
97
|
+
const ne = $(""), t = _(() => ({
|
|
98
|
+
restaurantIds: l.value.restaurantIds,
|
|
99
99
|
role: {
|
|
100
|
-
name:
|
|
101
|
-
permissions:
|
|
100
|
+
name: l.value.name,
|
|
101
|
+
permissions: Be(l.value.permissions, l.value.maxDiscountPercentage)
|
|
102
102
|
}
|
|
103
103
|
})), r = async () => {
|
|
104
|
-
const e =
|
|
104
|
+
const e = t.value;
|
|
105
105
|
await Q.minor(
|
|
106
106
|
async () => {
|
|
107
107
|
v.value ? await M.updateRole(v.value._id, e) : await M.createRole(e);
|
|
@@ -111,34 +111,34 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
111
111
|
}
|
|
112
112
|
), F.value = !1;
|
|
113
113
|
}, c = _(
|
|
114
|
-
() =>
|
|
115
|
-
), i = _(() =>
|
|
116
|
-
const e =
|
|
117
|
-
i.value === !0 ?
|
|
118
|
-
},
|
|
119
|
-
const a =
|
|
120
|
-
(
|
|
114
|
+
() => l.value.restaurantIds.filter((e) => I.value.some((a) => a._id === e))
|
|
115
|
+
), i = _(() => I.value.length > 0 && I.value.length === c.value.length), h = () => {
|
|
116
|
+
const e = l.value.restaurantIds.filter((a) => !c.value.includes(a));
|
|
117
|
+
i.value === !0 ? l.value.restaurantIds = e : l.value.restaurantIds = I.value.map((a) => a._id);
|
|
118
|
+
}, x = (e) => e.map((u) => u.value).every((u) => l.value.permissions.includes(u)), f = (e) => {
|
|
119
|
+
const a = l.value.permissions.filter(
|
|
120
|
+
(u) => !e.map((D) => D.value).includes(u)
|
|
121
121
|
);
|
|
122
|
-
|
|
122
|
+
x(e) === !0 ? l.value.permissions = a : l.value.permissions = [...a, ...e.map((u) => u.value)];
|
|
123
123
|
};
|
|
124
124
|
se(
|
|
125
|
-
() =>
|
|
125
|
+
() => l.value.restaurantIds,
|
|
126
126
|
(e) => {
|
|
127
127
|
e.length > 0 && (ne.value = "");
|
|
128
128
|
}
|
|
129
129
|
);
|
|
130
|
-
const V =
|
|
130
|
+
const V = $e(
|
|
131
131
|
() => {
|
|
132
|
-
var e, a,
|
|
133
|
-
return !
|
|
134
|
-
|
|
135
|
-
((a = v.value) == null ? void 0 : a.restaurants.map((
|
|
136
|
-
) || !
|
|
137
|
-
|
|
138
|
-
((
|
|
139
|
-
) || !
|
|
140
|
-
|
|
141
|
-
v.value ? _e((
|
|
132
|
+
var e, a, u, D;
|
|
133
|
+
return !te.isEqual(l.value.name, ((e = v.value) == null ? void 0 : e.name) || E().name) || !te.isEqual(
|
|
134
|
+
l.value.restaurantIds,
|
|
135
|
+
((a = v.value) == null ? void 0 : a.restaurants.map((j) => j.id)) || E().restaurantIds
|
|
136
|
+
) || !te.isEqual(
|
|
137
|
+
l.value.permissions,
|
|
138
|
+
((u = v.value) == null ? void 0 : u.permissions.map((j) => K(j).value)) || E().permissions
|
|
139
|
+
) || !te.isEqual(
|
|
140
|
+
l.value.maxDiscountPercentage,
|
|
141
|
+
v.value ? _e((D = v.value) == null ? void 0 : D.permissions) : E().maxDiscountPercentage
|
|
142
142
|
);
|
|
143
143
|
},
|
|
144
144
|
() => {
|
|
@@ -149,8 +149,8 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
149
149
|
show: F,
|
|
150
150
|
trigger: re
|
|
151
151
|
}), (e, a) => {
|
|
152
|
-
const
|
|
153
|
-
return
|
|
152
|
+
const u = y("FmIcon"), D = y("FmTextField"), j = y("FmCircularProgress"), we = y("FmSearch"), ee = y("FmCheckbox"), ke = y("FmFormGroup"), Ve = y("FmCard"), ce = y("fm-button"), Le = y("fm-side-sheet");
|
|
153
|
+
return p(), P(Le, {
|
|
154
154
|
id: "unit-form",
|
|
155
155
|
"model-value": F.value,
|
|
156
156
|
"is-container": o(ue).FmForm,
|
|
@@ -159,22 +159,30 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
159
159
|
blameFormChildOnValidationFailed: !0
|
|
160
160
|
},
|
|
161
161
|
"max-width": 960,
|
|
162
|
-
"
|
|
163
|
-
"onOn:
|
|
162
|
+
"close-button": !1,
|
|
163
|
+
"onOn:clickedAway": o(V)
|
|
164
164
|
}, {
|
|
165
165
|
"side-sheet-header": b(() => [
|
|
166
|
-
|
|
166
|
+
d("div", Oe, [
|
|
167
|
+
d("p", Je, A(q.value), 1),
|
|
168
|
+
n(u, {
|
|
169
|
+
name: "close",
|
|
170
|
+
size: "md",
|
|
171
|
+
class: "cursor-pointer",
|
|
172
|
+
onClick: o(V)
|
|
173
|
+
}, null, 8, ["onClick"])
|
|
174
|
+
])
|
|
167
175
|
]),
|
|
168
176
|
"side-sheet-footer": b(() => [
|
|
169
|
-
|
|
170
|
-
|
|
177
|
+
d("div", Qe, [
|
|
178
|
+
n(ce, {
|
|
171
179
|
label: Y.value,
|
|
172
180
|
size: "lg",
|
|
173
181
|
type: "submit",
|
|
174
182
|
variant: "primary",
|
|
175
183
|
disabled: g.value
|
|
176
184
|
}, null, 8, ["label", "disabled"]),
|
|
177
|
-
|
|
185
|
+
n(ce, {
|
|
178
186
|
label: o(s)("common.cancel"),
|
|
179
187
|
size: "lg",
|
|
180
188
|
variant: "tertiary",
|
|
@@ -183,57 +191,57 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
183
191
|
])
|
|
184
192
|
]),
|
|
185
193
|
default: b(() => [
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
d("div", qe, [
|
|
195
|
+
n(ie, { title: "Role detail" }, {
|
|
188
196
|
default: b(() => [
|
|
189
|
-
|
|
190
|
-
modelValue:
|
|
191
|
-
"onUpdate:modelValue": a[0] || (a[0] = (
|
|
197
|
+
n(D, {
|
|
198
|
+
modelValue: l.value.name,
|
|
199
|
+
"onUpdate:modelValue": a[0] || (a[0] = (m) => l.value.name = m),
|
|
192
200
|
autofocus: "",
|
|
193
|
-
rules: [(
|
|
201
|
+
rules: [(m) => !!m || o(s)("hr.role.form.required")],
|
|
194
202
|
label: o(s)("hr.role.form.name"),
|
|
195
203
|
disabled: g.value
|
|
196
204
|
}, null, 8, ["modelValue", "rules", "label", "disabled"])
|
|
197
205
|
]),
|
|
198
206
|
_: 1
|
|
199
207
|
}),
|
|
200
|
-
|
|
208
|
+
n(ie, {
|
|
201
209
|
title: o(s)("hr.role.form.restaurant")
|
|
202
210
|
}, {
|
|
203
211
|
default: b(() => [
|
|
204
|
-
J.value ? (
|
|
205
|
-
|
|
206
|
-
])) : (
|
|
207
|
-
|
|
212
|
+
J.value ? (p(), k("div", ze, [
|
|
213
|
+
n(j)
|
|
214
|
+
])) : (p(), k(N, { key: 1 }, [
|
|
215
|
+
n(we, {
|
|
208
216
|
modelValue: T.value,
|
|
209
|
-
"onUpdate:modelValue": a[1] || (a[1] = (
|
|
217
|
+
"onUpdate:modelValue": a[1] || (a[1] = (m) => T.value = m),
|
|
210
218
|
placeholder: o(s)("hr.restaurant.search.placeholder")
|
|
211
219
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
212
|
-
|
|
213
|
-
modelValue:
|
|
214
|
-
"onUpdate:modelValue": a[3] || (a[3] = (
|
|
215
|
-
rules: [(
|
|
220
|
+
n(ke, {
|
|
221
|
+
modelValue: l.value.restaurantIds,
|
|
222
|
+
"onUpdate:modelValue": a[3] || (a[3] = (m) => l.value.restaurantIds = m),
|
|
223
|
+
rules: [(m) => m.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
|
|
216
224
|
}, {
|
|
217
225
|
default: b(() => [
|
|
218
|
-
|
|
219
|
-
T.value ? de("", !0) : (
|
|
220
|
-
|
|
226
|
+
d("div", je, [
|
|
227
|
+
T.value ? de("", !0) : (p(), k(N, { key: 0 }, [
|
|
228
|
+
n(ee, {
|
|
221
229
|
"model-value": i.value,
|
|
222
230
|
label: o(s)("hr.role.form.all"),
|
|
223
231
|
value: "1",
|
|
224
232
|
disabled: g.value,
|
|
225
233
|
"onUpdate:modelValue": h
|
|
226
234
|
}, null, 8, ["model-value", "label", "disabled"]),
|
|
227
|
-
a[6] || (a[6] =
|
|
235
|
+
a[6] || (a[6] = d("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1))
|
|
228
236
|
], 64)),
|
|
229
|
-
(
|
|
230
|
-
key:
|
|
237
|
+
(p(!0), k(N, null, le(I.value, (m) => (p(), k("div", {
|
|
238
|
+
key: m._id
|
|
231
239
|
}, [
|
|
232
|
-
|
|
233
|
-
modelValue:
|
|
234
|
-
"onUpdate:modelValue": a[2] || (a[2] = (
|
|
235
|
-
label: `${
|
|
236
|
-
value:
|
|
240
|
+
n(ee, {
|
|
241
|
+
modelValue: l.value.restaurantIds,
|
|
242
|
+
"onUpdate:modelValue": a[2] || (a[2] = (U) => l.value.restaurantIds = U),
|
|
243
|
+
label: `${m.profile.code ? m.profile.code + "-" : ""}${m.profile.name}`,
|
|
244
|
+
value: m._id,
|
|
237
245
|
disabled: g.value
|
|
238
246
|
}, null, 8, ["modelValue", "label", "value", "disabled"])
|
|
239
247
|
]))), 128))
|
|
@@ -245,45 +253,45 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
245
253
|
]),
|
|
246
254
|
_: 1
|
|
247
255
|
}, 8, ["title"]),
|
|
248
|
-
|
|
256
|
+
n(ie, {
|
|
249
257
|
title: o(s)("hr.role.form.permissions")
|
|
250
258
|
}, {
|
|
251
259
|
default: b(() => [
|
|
252
|
-
(
|
|
253
|
-
key:
|
|
260
|
+
(p(!0), k(N, null, le(z.value, (m) => (p(), P(Ve, {
|
|
261
|
+
key: m.title,
|
|
254
262
|
variant: "outlined",
|
|
255
263
|
class: "p-16"
|
|
256
264
|
}, {
|
|
257
265
|
default: b(() => [
|
|
258
|
-
|
|
266
|
+
n(De, null, {
|
|
259
267
|
title: b(() => [
|
|
260
|
-
|
|
268
|
+
d("p", Ke, A(m.title), 1)
|
|
261
269
|
]),
|
|
262
270
|
default: b(() => [
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
"model-value":
|
|
271
|
+
d("div", We, [
|
|
272
|
+
n(ee, {
|
|
273
|
+
"model-value": x(m.options),
|
|
266
274
|
label: o(s)("hr.role.form.all"),
|
|
267
275
|
value: "1",
|
|
268
276
|
disabled: g.value,
|
|
269
|
-
"onUpdate:modelValue": (
|
|
277
|
+
"onUpdate:modelValue": (U) => f(m.options)
|
|
270
278
|
}, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
|
|
271
|
-
a[7] || (a[7] =
|
|
272
|
-
(
|
|
273
|
-
key:
|
|
279
|
+
a[7] || (a[7] = d("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1)),
|
|
280
|
+
(p(!0), k(N, null, le(m.options, (U) => (p(), k("div", {
|
|
281
|
+
key: U.value
|
|
274
282
|
}, [
|
|
275
|
-
|
|
276
|
-
modelValue:
|
|
277
|
-
"onUpdate:modelValue": a[4] || (a[4] = (w) =>
|
|
278
|
-
label:
|
|
279
|
-
value:
|
|
283
|
+
n(ee, {
|
|
284
|
+
modelValue: l.value.permissions,
|
|
285
|
+
"onUpdate:modelValue": a[4] || (a[4] = (w) => l.value.permissions = w),
|
|
286
|
+
label: U.label,
|
|
287
|
+
value: U.value,
|
|
280
288
|
disabled: g.value
|
|
281
289
|
}, null, 8, ["modelValue", "label", "value", "disabled"]),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
modelValue:
|
|
286
|
-
"onUpdate:modelValue": a[5] || (a[5] = (w) =>
|
|
290
|
+
U.value === "order:discount" && l.value.permissions.includes(U.value) ? (p(), k("div", Ge, [
|
|
291
|
+
d("div", He, A(o(s)("hr.role.form.maxDiscountPercentage")), 1),
|
|
292
|
+
n(D, {
|
|
293
|
+
modelValue: l.value.maxDiscountPercentage,
|
|
294
|
+
"onUpdate:modelValue": a[5] || (a[5] = (w) => l.value.maxDiscountPercentage = w),
|
|
287
295
|
rules: [
|
|
288
296
|
(w) => !!w || o(s)("hr.role.form.required"),
|
|
289
297
|
(w) => !isNaN(w) || o(s)("hr.role.form.onlyContainsNumber"),
|
|
@@ -308,76 +316,76 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
308
316
|
])
|
|
309
317
|
]),
|
|
310
318
|
_: 1
|
|
311
|
-
}, 8, ["model-value", "is-container", "is-container-props", "onOn:clickedAway"
|
|
319
|
+
}, 8, ["model-value", "is-container", "is-container-props", "onOn:clickedAway"]);
|
|
312
320
|
};
|
|
313
321
|
}
|
|
314
|
-
}),
|
|
322
|
+
}), Ye = {
|
|
315
323
|
class: "space-y-8"
|
|
316
|
-
},
|
|
324
|
+
}, Ze = {
|
|
317
325
|
class: "flex justify-end xs:px-16"
|
|
318
|
-
},
|
|
326
|
+
}, es = {
|
|
319
327
|
class: "pb-64 sm:hidden md:hidden lg:hidden"
|
|
320
|
-
},
|
|
328
|
+
}, ss = {
|
|
321
329
|
class: "space-y-4"
|
|
322
|
-
},
|
|
330
|
+
}, as = {
|
|
323
331
|
class: "fm-typo-en-body-lg-600"
|
|
324
|
-
},
|
|
332
|
+
}, ts = {
|
|
325
333
|
class: "text-fm-color-typo-secondary"
|
|
326
|
-
}, as = {
|
|
327
|
-
class: "flex"
|
|
328
334
|
}, ls = {
|
|
329
335
|
class: "flex"
|
|
330
|
-
},
|
|
336
|
+
}, os = {
|
|
337
|
+
class: "flex"
|
|
338
|
+
}, ys = /* @__PURE__ */ ge({
|
|
331
339
|
__name: "RoleList",
|
|
332
|
-
setup(
|
|
340
|
+
setup(W, {
|
|
333
341
|
expose: G
|
|
334
342
|
}) {
|
|
335
343
|
const {
|
|
336
344
|
t: s
|
|
337
345
|
} = ye(), {
|
|
338
|
-
allReportPermissions:
|
|
339
|
-
} = Fe(), T = me(),
|
|
340
|
-
function M(
|
|
341
|
-
const c = r === L.F_RULE_SUBJECT.enum.report ?
|
|
346
|
+
allReportPermissions: C
|
|
347
|
+
} = Fe(), T = me(), I = _(() => T.restaurants.value), J = _(() => I.value.map((t) => t._id));
|
|
348
|
+
function M(t, r) {
|
|
349
|
+
const c = r === L.F_RULE_SUBJECT.enum.report ? C.value : void 0, i = ae(t, r, c);
|
|
342
350
|
return ["-", "All"].includes(i) ? () => null : () => S(ue.FmTooltip, {
|
|
343
351
|
"z-index": "999",
|
|
344
352
|
placement: "top",
|
|
345
353
|
class: "ml-2"
|
|
346
354
|
}, {
|
|
347
|
-
content: () => S("div", [s("hr.role.tooltip.labels.permission"), ...
|
|
355
|
+
content: () => S("div", [s("hr.role.tooltip.labels.permission"), ...t.filter((h) => h.subject === r).map((h) => S("div", ["- ", K(h).label]))]),
|
|
348
356
|
default: () => S(ue.FmIcon, {
|
|
349
357
|
name: "info",
|
|
350
|
-
color:
|
|
358
|
+
color: Se.NeutralGray400
|
|
351
359
|
})
|
|
352
360
|
});
|
|
353
361
|
}
|
|
354
|
-
function H(
|
|
355
|
-
const c = r === L.F_RULE_SUBJECT.enum.report ?
|
|
362
|
+
function H(t, r) {
|
|
363
|
+
const c = r === L.F_RULE_SUBJECT.enum.report ? C.value : void 0, i = ae(t, r, c);
|
|
356
364
|
return () => i === "All" ? i : S("div", {
|
|
357
365
|
class: "flex items-center"
|
|
358
|
-
}, [i, M(
|
|
366
|
+
}, [i, M(t, r)()]);
|
|
359
367
|
}
|
|
360
|
-
function Q(
|
|
368
|
+
function Q(t) {
|
|
361
369
|
return [{
|
|
362
370
|
label: s("hr.role.form.update"),
|
|
363
|
-
onClick: () => B(
|
|
371
|
+
onClick: () => B(t)
|
|
364
372
|
}, {
|
|
365
373
|
label: s("hr.role.remove.title"),
|
|
366
|
-
onClick: () =>
|
|
374
|
+
onClick: () => E(t),
|
|
367
375
|
itemClass: "text-fm-color-typo-error",
|
|
368
|
-
disabled:
|
|
376
|
+
disabled: Ce(t.permissions)
|
|
369
377
|
}];
|
|
370
378
|
}
|
|
371
379
|
const X = ({
|
|
372
|
-
role:
|
|
380
|
+
role: t,
|
|
373
381
|
className: r = ""
|
|
374
|
-
}) =>
|
|
382
|
+
}) => n("div", {
|
|
375
383
|
class: r,
|
|
376
384
|
onClick: (c) => {
|
|
377
385
|
c.stopPropagation();
|
|
378
386
|
}
|
|
379
|
-
}, [
|
|
380
|
-
items: Q(
|
|
387
|
+
}, [n(he, {
|
|
388
|
+
items: Q(t)
|
|
381
389
|
}, null)]), oe = [{
|
|
382
390
|
accessorKey: "name",
|
|
383
391
|
header: () => s("hr.role.columns.name"),
|
|
@@ -385,17 +393,17 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
385
393
|
}, {
|
|
386
394
|
accessorKey: "operation",
|
|
387
395
|
header: () => s("hr.role.columns.operation"),
|
|
388
|
-
cell: (
|
|
396
|
+
cell: (t) => S(H(t.row.original.permissions, L.F_RULE_SUBJECT.enum.order)),
|
|
389
397
|
enableSorting: !1
|
|
390
398
|
}, {
|
|
391
399
|
accessorKey: "report",
|
|
392
400
|
header: () => s("hr.role.columns.report"),
|
|
393
|
-
cell: (
|
|
401
|
+
cell: (t) => S(H(t.row.original.permissions, L.F_RULE_SUBJECT.enum.report)),
|
|
394
402
|
enableSorting: !1
|
|
395
403
|
}, {
|
|
396
404
|
accessorKey: "restaurants",
|
|
397
405
|
header: () => s("hr.role.columns.restaurants"),
|
|
398
|
-
cell: (
|
|
406
|
+
cell: (t) => t.row.original.restaurants.map((r, c) => {
|
|
399
407
|
const i = r.code, h = `${i ? i + " - " : ""}${r.name}`;
|
|
400
408
|
return S("div", (c ? `
|
|
401
409
|
` : "") + h);
|
|
@@ -408,24 +416,24 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
408
416
|
cellClass: "pl-16",
|
|
409
417
|
headerContentClass: "-mx-16"
|
|
410
418
|
},
|
|
411
|
-
cell: (
|
|
412
|
-
role:
|
|
419
|
+
cell: (t) => X({
|
|
420
|
+
role: t.row.original,
|
|
413
421
|
className: "flex w-full items-center justify-end"
|
|
414
422
|
})
|
|
415
|
-
}], B = async (
|
|
423
|
+
}], B = async (t) => {
|
|
416
424
|
var r;
|
|
417
|
-
g.value =
|
|
418
|
-
},
|
|
419
|
-
const
|
|
420
|
-
return (J.value.length === 0 ?
|
|
425
|
+
g.value = t._id, await fe(), (r = z.value) == null || r.trigger();
|
|
426
|
+
}, R = Re(), F = Ae(), re = _(() => {
|
|
427
|
+
const t = R.roles.value || [];
|
|
428
|
+
return (J.value.length === 0 ? t : t.filter((c) => c.restaurants.some((i) => J.value.includes(i.id)))).map((c) => {
|
|
421
429
|
const i = c.restaurants.map((h) => {
|
|
422
|
-
const
|
|
430
|
+
const x = F.value[h.id];
|
|
423
431
|
return {
|
|
424
432
|
...h,
|
|
425
433
|
// Prefer live data from restaurantMap so names populate reactively
|
|
426
434
|
// even when restaurants loaded after roles.
|
|
427
|
-
name: (
|
|
428
|
-
code:
|
|
435
|
+
name: (x == null ? void 0 : x.profile.name) || h.name,
|
|
436
|
+
code: x == null ? void 0 : x.profile.code
|
|
429
437
|
};
|
|
430
438
|
});
|
|
431
439
|
return {
|
|
@@ -436,7 +444,7 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
436
444
|
}), q = _(() => {
|
|
437
445
|
var r;
|
|
438
446
|
return (r = re.value) == null ? void 0 : r.filter((c) => {
|
|
439
|
-
const i =
|
|
447
|
+
const i = l.value.toLowerCase(), h = c.name.toLowerCase().includes(i), f = (c.restaurants || []).some((V) => {
|
|
440
448
|
var e;
|
|
441
449
|
return V.name.toLowerCase().includes(i) || ((e = V.code) == null ? void 0 : e.toLowerCase().includes(i));
|
|
442
450
|
});
|
|
@@ -444,11 +452,11 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
444
452
|
});
|
|
445
453
|
}), Y = Ee(), O = xe(), {
|
|
446
454
|
breakpoints: v
|
|
447
|
-
} = Ue(),
|
|
455
|
+
} = Ue(), E = (t) => {
|
|
448
456
|
Y.open({
|
|
449
457
|
title: s("hr.role.remove.title"),
|
|
450
458
|
message: s("hr.role.remove.message", {
|
|
451
|
-
name:
|
|
459
|
+
name: t.name
|
|
452
460
|
}),
|
|
453
461
|
minWidth: v.value.lg ? 588 : 0,
|
|
454
462
|
primaryActions: {
|
|
@@ -461,9 +469,9 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
461
469
|
close: !0
|
|
462
470
|
}
|
|
463
471
|
}).onPrimary(async () => {
|
|
464
|
-
await
|
|
472
|
+
await R.deleteRole(t).then(() => O.open({
|
|
465
473
|
message: s("hr.role.remove.successMessage", {
|
|
466
|
-
name:
|
|
474
|
+
name: t.name
|
|
467
475
|
}),
|
|
468
476
|
type: "success"
|
|
469
477
|
})).catch((r) => O.open({
|
|
@@ -471,18 +479,18 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
471
479
|
type: "error"
|
|
472
480
|
})), Y.close();
|
|
473
481
|
});
|
|
474
|
-
},
|
|
482
|
+
}, l = $(""), z = $(), g = $(void 0);
|
|
475
483
|
async function Z() {
|
|
476
|
-
var
|
|
477
|
-
g.value = void 0, await fe(), (
|
|
484
|
+
var t;
|
|
485
|
+
g.value = void 0, await fe(), (t = z.value) == null || t.trigger();
|
|
478
486
|
}
|
|
479
487
|
async function ne() {
|
|
480
|
-
if (
|
|
488
|
+
if (R.roles.value.length === 0)
|
|
481
489
|
try {
|
|
482
|
-
await
|
|
483
|
-
} catch (
|
|
484
|
-
console.error("Failed to load roles:",
|
|
485
|
-
message:
|
|
490
|
+
await R.readRoles();
|
|
491
|
+
} catch (t) {
|
|
492
|
+
console.error("Failed to load roles:", t), O.open({
|
|
493
|
+
message: t instanceof Error ? t.message : String(t),
|
|
486
494
|
type: "error"
|
|
487
495
|
});
|
|
488
496
|
}
|
|
@@ -491,51 +499,51 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
491
499
|
ne();
|
|
492
500
|
}), G({
|
|
493
501
|
create: Z
|
|
494
|
-
}), (
|
|
495
|
-
const c =
|
|
496
|
-
return
|
|
502
|
+
}), (t, r) => {
|
|
503
|
+
const c = y("FmSearch"), i = y("FmTable"), h = y("FmListItem"), x = y("FmList");
|
|
504
|
+
return p(), k(N, null, [(p(), P(Xe, {
|
|
497
505
|
id: g.value,
|
|
498
506
|
key: g.value,
|
|
499
507
|
ref_key: "roleFormRef",
|
|
500
508
|
ref: z
|
|
501
|
-
}, null, 8, ["id"])),
|
|
502
|
-
modelValue:
|
|
503
|
-
"onUpdate:modelValue": r[0] || (r[0] = (f) =>
|
|
509
|
+
}, null, 8, ["id"])), d("div", Ye, [d("div", Ze, [n(c, {
|
|
510
|
+
modelValue: l.value,
|
|
511
|
+
"onUpdate:modelValue": r[0] || (r[0] = (f) => l.value = f),
|
|
504
512
|
class: "w-[320px] xs:w-full",
|
|
505
513
|
autofocus: "",
|
|
506
514
|
placeholder: o(s)("hr.role.search.placeholder") + " / " + o(s)("hr.restaurant.search.placeholder")
|
|
507
|
-
}, null, 8, ["modelValue", "placeholder"])]), o(
|
|
515
|
+
}, null, 8, ["modelValue", "placeholder"])]), o(R).roles.value.length > 0 || o(R).isLoading.value ? (p(), P(Pe, {
|
|
508
516
|
key: 0,
|
|
509
517
|
class: "overflow-auto"
|
|
510
518
|
}, {
|
|
511
|
-
default: b(() => [
|
|
519
|
+
default: b(() => [n(i, {
|
|
512
520
|
class: "xs:hidden",
|
|
513
521
|
"column-defs": oe,
|
|
514
522
|
"row-data": q.value,
|
|
515
523
|
"page-size": q.value.length,
|
|
516
|
-
loading: o(
|
|
524
|
+
loading: o(R).isLoading.value,
|
|
517
525
|
"pin-header-row": "",
|
|
518
526
|
"hide-footer": "",
|
|
519
527
|
"shrink-at": !1,
|
|
520
528
|
onRowClick: r[1] || (r[1] = (f) => B(f.original))
|
|
521
|
-
}, null, 8, ["row-data", "page-size", "loading"]),
|
|
529
|
+
}, null, 8, ["row-data", "page-size", "loading"]), d("div", es, [n(x, {
|
|
522
530
|
separator: ""
|
|
523
531
|
}, {
|
|
524
|
-
default: b(() => [(
|
|
532
|
+
default: b(() => [(p(!0), k(N, null, le(q.value, (f) => (p(), P(h, {
|
|
525
533
|
key: f._id,
|
|
526
534
|
class: "py-12 px-16 items-center justify-between",
|
|
527
535
|
onClick: (V) => B(f)
|
|
528
536
|
}, {
|
|
529
|
-
default: b(() => [
|
|
537
|
+
default: b(() => [d("div", ss, [d("p", as, A(f.name), 1), d("div", ts, [d("p", null, A(o(s)("hr.role.labels.restaurantList", {
|
|
530
538
|
items: f.restaurants.map((V) => V.name).join(", ")
|
|
531
|
-
})), 1),
|
|
539
|
+
})), 1), d("p", ls, [pe(A(o(s)("hr.role.labels.operationList", {
|
|
532
540
|
items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.order)
|
|
533
|
-
})) + " ", 1), (
|
|
534
|
-
items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.report, o(
|
|
535
|
-
})) + " ", 1), (
|
|
536
|
-
onClick: r[2] || (r[2] =
|
|
541
|
+
})) + " ", 1), (p(), P(ve(M(f.permissions, o(L.F_RULE_SUBJECT).enum.order))))]), d("p", os, [pe(A(o(s)("hr.role.labels.reportList", {
|
|
542
|
+
items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.report, o(C))
|
|
543
|
+
})) + " ", 1), (p(), P(ve(M(f.permissions, o(L.F_RULE_SUBJECT).enum.report))))])])]), d("div", {
|
|
544
|
+
onClick: r[2] || (r[2] = Ie(() => {
|
|
537
545
|
}, ["stop"]))
|
|
538
|
-
}, [
|
|
546
|
+
}, [n(he, {
|
|
539
547
|
items: Q(f)
|
|
540
548
|
}, null, 8, ["items"])])]),
|
|
541
549
|
_: 2
|
|
@@ -543,7 +551,7 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
543
551
|
_: 1
|
|
544
552
|
})])]),
|
|
545
553
|
_: 1
|
|
546
|
-
})) : (
|
|
554
|
+
})) : (p(), P(o(Te), {
|
|
547
555
|
key: 1,
|
|
548
556
|
title: o(s)("hr.role.noData.title"),
|
|
549
557
|
subtitle: o(s)("hr.role.noData.subtitle")
|
|
@@ -552,5 +560,5 @@ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { class: "space-y-40" }, J
|
|
|
552
560
|
}
|
|
553
561
|
});
|
|
554
562
|
export {
|
|
555
|
-
|
|
563
|
+
ys as default
|
|
556
564
|
};
|