@feedmepos/mf-hrm-portal 2.0.17-dev.3 → 2.0.17-dev.5
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-Dl3Nmf00.js +1011 -0
- package/dist/EmployeeList-DBd_rVW2.js +831 -0
- package/dist/{Main-Dkr5lzbv.js → Main-CQ3KwxDY.js} +1368 -1371
- package/dist/{Main--tejoyEP.js → Main-pTgqNncY.js} +125 -125
- package/dist/{Main-BNXKItvX.js → Main-w0XUUaBp.js} +6 -6
- package/dist/PermissionSetList-B8qNOWH6.js +347 -0
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BBsaxaXu.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-C9VUjAu_.js} +1064 -1060
- package/dist/{RoleList-SZCgvYvC.js → RoleList-DMFJsUZv.js} +202 -200
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
- package/dist/TeamMemberList-BLRTfKLz.js +1031 -0
- package/dist/{TimesheetList-D-3k0Uad.js → TimesheetList-Bwp9_xHe.js} +6 -6
- package/dist/{app-BjXuSCis.js → app-COJbSNM4.js} +1975 -1440
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-z-vrgFCL.js → dayjs.min-CcBi6N-K.js} +1 -1
- package/dist/{employee-DAqAMupR.js → employee-xiV0LfnL.js} +3 -3
- package/dist/{iteration-Cp1eSTJA.js → iteration-JOKbtlLf.js} +1 -1
- package/dist/{lodash-CXLZQQp8.js → lodash-D5xlVzib.js} +1 -1
- package/dist/rule-3sXHiW0y.js +994 -0
- package/dist/src/api/audit-log/index.d.ts +9 -0
- package/dist/src/api/report-query/index.d.ts +2 -2
- package/dist/src/components/Skeleton.vue.d.ts +7 -0
- package/dist/src/composables/useBasePermission.d.ts +1 -0
- package/dist/src/stores/team.d.ts +6 -6
- package/dist/src/types/team.d.ts +1 -1
- package/dist/src/views/hr/locales/index.d.ts +172 -0
- package/dist/src/views/team/components/BasePermission.vue.d.ts +1 -1
- package/dist/src/views/team/locales/index.d.ts +312 -0
- package/dist/style.css +1 -1
- package/dist/{team-CnQ_rIx2.js → team-CyNektSD.js} +1 -1
- package/dist/{timesheet-BlPhOifI.js → timesheet-DkD3AysG.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-BVnrWyPF.js → useAppStore-CvmsaYSG.js} +1 -1
- package/dist/{useLoading-7ia-Bps7.js → useLoading-4TNmhm5N.js} +1 -1
- package/dist/useReportPermissions-CWMFFb8E.js +70 -0
- package/package.json +2 -2
- package/dist/AuditLogList-C6qAeY5g.js +0 -954
- package/dist/EmployeeList-COtXtTqG.js +0 -827
- package/dist/PermissionSetList-B_Sdvbu7.js +0 -340
- package/dist/TeamMemberList-Dk5HeFfQ.js +0 -1008
- package/dist/rule-vBxopbM_.js +0 -990
- package/dist/useReportPermissions-C8HMek35.js +0 -60
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { computed as _, defineComponent as ge, ref as P, watch as
|
|
2
|
-
import { e as k } from "./iteration-
|
|
1
|
+
import { computed as _, defineComponent as ge, ref as P, watch as se, onMounted as be, resolveComponent as C, createBlock as L, openBlock as d, unref as o, withCtx as y, createElementVNode as f, createVNode as c, createElementBlock as V, Fragment as A, createCommentVNode as de, renderList as te, toDisplayString as D, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Le, nextTick as fe } from "vue";
|
|
2
|
+
import { e as k } from "./iteration-JOKbtlLf.js";
|
|
3
3
|
import { useCoreStore as me, useI18n as ye } from "@feedmepos/mf-common";
|
|
4
4
|
import { useSnackbar as xe, components as ue, useDialog as Ue, useBreakpoints as Ee, FmButtonColorThemeVariant as Ie } from "@feedmepos/ui-library";
|
|
5
|
-
import { _ as Se } from "./app-
|
|
5
|
+
import { _ as Se } from "./app-COJbSNM4.js";
|
|
6
6
|
import { u as Pe, _ as he } from "./useDiscardConfirm-DPhEV6v0.js";
|
|
7
7
|
import { _ as $e } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
|
|
8
|
-
import { e as Te, r as W, h as Ce, f as Me, g as _e, a as
|
|
9
|
-
import { u as Re } from "./useAppStore-
|
|
10
|
-
import { u as Fe } from "./useReportPermissions-
|
|
11
|
-
import { l as
|
|
8
|
+
import { e as Te, r as W, h as Ce, f as Me, g as _e, a as ae } from "./rule-3sXHiW0y.js";
|
|
9
|
+
import { u as Re } from "./useAppStore-CvmsaYSG.js";
|
|
10
|
+
import { u as Fe } from "./useReportPermissions-CWMFFb8E.js";
|
|
11
|
+
import { l as le } from "./lodash-D5xlVzib.js";
|
|
12
12
|
import { _ as Be } 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 De } from "./useLoading-
|
|
15
|
-
function
|
|
14
|
+
import { u as De } from "./useLoading-4TNmhm5N.js";
|
|
15
|
+
function Ne() {
|
|
16
16
|
const j = me();
|
|
17
17
|
return _(() => {
|
|
18
|
-
const
|
|
18
|
+
const s = {};
|
|
19
19
|
return j.restaurants.value.forEach((w) => {
|
|
20
|
-
|
|
21
|
-
}),
|
|
20
|
+
s[w._id] = w;
|
|
21
|
+
}), s;
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, Je = {
|
|
25
25
|
key: 0,
|
|
26
26
|
class: "flex justify-center py-16"
|
|
27
27
|
}, qe = { class: "space-y-8" }, ze = { class: "fm-typo-en-title-sm-600" }, Ke = { class: "mt-16 space-y-8" }, We = {
|
|
@@ -36,122 +36,124 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
setup(j, { expose: G }) {
|
|
39
|
-
const { t:
|
|
40
|
-
const
|
|
41
|
-
return !$.value ||
|
|
39
|
+
const { t: s } = ye(), w = me(), $ = P(""), U = _(() => w.restaurants.value.filter(({ profile: e }) => {
|
|
40
|
+
const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
|
|
41
|
+
return !$.value || a.toLowerCase().includes($.value.toLowerCase());
|
|
42
42
|
})), O = P(w.restaurants.value.length === 0);
|
|
43
|
-
|
|
43
|
+
se(
|
|
44
44
|
() => w.restaurants.value.length,
|
|
45
45
|
(e) => {
|
|
46
46
|
e > 0 && (O.value = !1);
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
|
-
const T = Re(), H = xe(), Q = De(H), { fetchReportPermissions:
|
|
50
|
-
|
|
51
|
-
}, J = _(() => R.id ?
|
|
49
|
+
const T = Re(), H = xe(), Q = De(H), { fetchReportPermissions: X, allReportPermissions: oe, availableReportKeys: M } = Fe(), R = j, b = P(!1), re = () => {
|
|
50
|
+
b.value = !b.value, b.value && Z();
|
|
51
|
+
}, J = _(() => R.id ? s("hr.role.form.update") : s("hr.role.form.add")), Y = _(() => R.id ? s("common.update") : s("common.add")), q = _(() => {
|
|
52
52
|
const e = Te.filter(
|
|
53
|
-
(
|
|
54
|
-
).map((
|
|
55
|
-
return [...e, ...
|
|
53
|
+
(i) => i.subject !== k.F_RULE_SUBJECT.enum.report
|
|
54
|
+
).map((i) => W(i)), a = oe.value.map((i) => W(i));
|
|
55
|
+
return [...e, ...a];
|
|
56
56
|
}), p = _(() => T.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 = P(E()), z = _(() => [
|
|
62
62
|
{
|
|
63
|
-
title:
|
|
63
|
+
title: s("hr.role.labels.operation"),
|
|
64
64
|
filter: (e) => e.isOrderOperation
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
|
-
title:
|
|
67
|
+
title: s("hr.role.labels.report"),
|
|
68
68
|
filter: (e) => e.isReportPermission
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
|
-
title:
|
|
71
|
+
title: s("hr.role.labels.other"),
|
|
72
72
|
filter: (e) => !e.isOrderOperation && !e.isReportPermission
|
|
73
73
|
}
|
|
74
74
|
].map((e) => ({
|
|
75
75
|
title: e.title,
|
|
76
|
-
options: q.value.filter(e.filter).map(({ label:
|
|
77
|
-
label: s,
|
|
78
|
-
value:
|
|
76
|
+
options: q.value.filter(e.filter).map(({ label: a, value: i }) => ({
|
|
77
|
+
label: s(`hr.role.form.permissionLabels.${i}`, a),
|
|
78
|
+
value: i
|
|
79
79
|
}))
|
|
80
80
|
}))), g = _(() => {
|
|
81
81
|
var e;
|
|
82
82
|
return Ce(((e = p.value) == null ? void 0 : e.permissions) || []);
|
|
83
83
|
});
|
|
84
|
-
function
|
|
84
|
+
function Z() {
|
|
85
85
|
var e;
|
|
86
|
-
|
|
86
|
+
l.value = E(), l.value.name = ((e = p.value) == null ? void 0 : e.name) ?? "", g.value ? (l.value.restaurantIds = U.value.map((a) => a._id), l.value.permissions = q.value.map((a) => a.value)) : p.value && (l.value.restaurantIds = p.value.restaurants.map((a) => a.id), l.value.permissions = p.value.permissions.map((a) => W(a).value).filter((a) => a.startsWith("report:") ? M.value.has(a.split(":")[1]) : !0), l.value.maxDiscountPercentage = _e(
|
|
87
87
|
p.value.permissions
|
|
88
88
|
));
|
|
89
89
|
}
|
|
90
90
|
be(async () => {
|
|
91
|
-
await
|
|
92
|
-
}),
|
|
93
|
-
|
|
91
|
+
await X(), Z();
|
|
92
|
+
}), se(b, async (e) => {
|
|
93
|
+
e && await X();
|
|
94
|
+
}), se(M, () => {
|
|
95
|
+
b.value && p.value && !g.value && (l.value.permissions = l.value.permissions.filter((e) => e.startsWith("report:") ? M.value.has(e.split(":")[1]) : !0));
|
|
94
96
|
});
|
|
95
|
-
const
|
|
96
|
-
restaurantIds:
|
|
97
|
+
const ne = P(""), t = _(() => ({
|
|
98
|
+
restaurantIds: l.value.restaurantIds,
|
|
97
99
|
role: {
|
|
98
|
-
name:
|
|
99
|
-
permissions: Me(
|
|
100
|
+
name: l.value.name,
|
|
101
|
+
permissions: Me(l.value.permissions, l.value.maxDiscountPercentage)
|
|
100
102
|
}
|
|
101
103
|
})), r = async () => {
|
|
102
|
-
const e =
|
|
104
|
+
const e = t.value;
|
|
103
105
|
await Q.minor(
|
|
104
106
|
async () => {
|
|
105
107
|
p.value ? await T.updateRole(p.value._id, e) : await T.createRole(e);
|
|
106
108
|
},
|
|
107
109
|
{
|
|
108
|
-
successMessage: p.value ?
|
|
110
|
+
successMessage: p.value ? s("hr.role.update.successMessage", { name: e.role.name }) : s("hr.role.add.successMessage", { name: e.role.name })
|
|
109
111
|
}
|
|
110
|
-
),
|
|
112
|
+
), b.value = !1;
|
|
111
113
|
}, m = _(
|
|
112
|
-
() =>
|
|
113
|
-
),
|
|
114
|
-
const e =
|
|
115
|
-
|
|
116
|
-
}, x = (e) => e.map((
|
|
117
|
-
const
|
|
118
|
-
(
|
|
114
|
+
() => l.value.restaurantIds.filter((e) => U.value.some((a) => a._id === e))
|
|
115
|
+
), u = _(() => U.value.length > 0 && U.value.length === m.value.length), h = () => {
|
|
116
|
+
const e = l.value.restaurantIds.filter((a) => !m.value.includes(a));
|
|
117
|
+
u.value === !0 ? l.value.restaurantIds = e : l.value.restaurantIds = U.value.map((a) => a._id);
|
|
118
|
+
}, x = (e) => e.map((i) => i.value).every((i) => l.value.permissions.includes(i)), v = (e) => {
|
|
119
|
+
const a = l.value.permissions.filter(
|
|
120
|
+
(i) => !e.map((N) => N.value).includes(i)
|
|
119
121
|
);
|
|
120
|
-
x(e) === !0 ?
|
|
122
|
+
x(e) === !0 ? l.value.permissions = a : l.value.permissions = [...a, ...e.map((i) => i.value)];
|
|
121
123
|
};
|
|
122
|
-
|
|
123
|
-
() =>
|
|
124
|
+
se(
|
|
125
|
+
() => l.value.restaurantIds,
|
|
124
126
|
(e) => {
|
|
125
|
-
e.length > 0 && (
|
|
127
|
+
e.length > 0 && (ne.value = "");
|
|
126
128
|
}
|
|
127
129
|
);
|
|
128
130
|
const B = Pe(
|
|
129
131
|
() => {
|
|
130
|
-
var e,
|
|
131
|
-
return !
|
|
132
|
-
|
|
133
|
-
((
|
|
134
|
-
) || !
|
|
135
|
-
|
|
136
|
-
((
|
|
137
|
-
) || !
|
|
138
|
-
|
|
139
|
-
p.value ? _e((
|
|
132
|
+
var e, a, i, N;
|
|
133
|
+
return !le.isEqual(l.value.name, ((e = p.value) == null ? void 0 : e.name) || E().name) || !le.isEqual(
|
|
134
|
+
l.value.restaurantIds,
|
|
135
|
+
((a = p.value) == null ? void 0 : a.restaurants.map((K) => K.id)) || E().restaurantIds
|
|
136
|
+
) || !le.isEqual(
|
|
137
|
+
l.value.permissions,
|
|
138
|
+
((i = p.value) == null ? void 0 : i.permissions.map((K) => W(K).value)) || E().permissions
|
|
139
|
+
) || !le.isEqual(
|
|
140
|
+
l.value.maxDiscountPercentage,
|
|
141
|
+
p.value ? _e((N = p.value) == null ? void 0 : N.permissions) : E().maxDiscountPercentage
|
|
140
142
|
);
|
|
141
143
|
},
|
|
142
144
|
() => {
|
|
143
|
-
|
|
145
|
+
b.value = !1;
|
|
144
146
|
}
|
|
145
147
|
);
|
|
146
148
|
return G({
|
|
147
|
-
show:
|
|
148
|
-
trigger:
|
|
149
|
-
}), (e,
|
|
150
|
-
const
|
|
149
|
+
show: b,
|
|
150
|
+
trigger: re
|
|
151
|
+
}), (e, a) => {
|
|
152
|
+
const i = C("FmTextField"), N = C("FmCircularProgress"), K = C("FmSearch"), ee = C("FmCheckbox"), we = C("FmFormGroup"), Ve = C("FmCard"), ce = C("fm-button"), ke = C("fm-side-sheet");
|
|
151
153
|
return d(), L(ke, {
|
|
152
154
|
id: "unit-form",
|
|
153
|
-
modelValue:
|
|
154
|
-
"onUpdate:modelValue":
|
|
155
|
+
modelValue: b.value,
|
|
156
|
+
"onUpdate:modelValue": a[7] || (a[7] = (n) => b.value = n),
|
|
155
157
|
"is-container": o(ue).FmForm,
|
|
156
158
|
"is-container-props": {
|
|
157
159
|
onValidationSuccess: r,
|
|
@@ -160,74 +162,74 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
160
162
|
"max-width": 960,
|
|
161
163
|
"onOn:clickedAway": o(B)
|
|
162
164
|
}, {
|
|
163
|
-
"side-sheet-header":
|
|
164
|
-
f("p",
|
|
165
|
+
"side-sheet-header": y(() => [
|
|
166
|
+
f("p", Ae, D(J.value), 1)
|
|
165
167
|
]),
|
|
166
|
-
"side-sheet-footer":
|
|
168
|
+
"side-sheet-footer": y(() => [
|
|
167
169
|
f("div", Ge, [
|
|
168
170
|
c(ce, {
|
|
169
|
-
label:
|
|
171
|
+
label: Y.value,
|
|
170
172
|
size: "lg",
|
|
171
173
|
type: "submit",
|
|
172
174
|
variant: "primary",
|
|
173
175
|
disabled: g.value
|
|
174
176
|
}, null, 8, ["label", "disabled"]),
|
|
175
177
|
c(ce, {
|
|
176
|
-
label: o(
|
|
178
|
+
label: o(s)("common.cancel"),
|
|
177
179
|
size: "lg",
|
|
178
180
|
variant: "tertiary",
|
|
179
|
-
onClick:
|
|
181
|
+
onClick: a[6] || (a[6] = () => b.value = !1)
|
|
180
182
|
}, null, 8, ["label"])
|
|
181
183
|
])
|
|
182
184
|
]),
|
|
183
|
-
default:
|
|
185
|
+
default: y(() => [
|
|
184
186
|
f("div", Oe, [
|
|
185
187
|
c(ie, { title: "Role detail" }, {
|
|
186
|
-
default:
|
|
187
|
-
c(
|
|
188
|
-
modelValue:
|
|
189
|
-
"onUpdate:modelValue":
|
|
188
|
+
default: y(() => [
|
|
189
|
+
c(i, {
|
|
190
|
+
modelValue: l.value.name,
|
|
191
|
+
"onUpdate:modelValue": a[0] || (a[0] = (n) => l.value.name = n),
|
|
190
192
|
autofocus: "",
|
|
191
|
-
rules: [(n) => !!n || o(
|
|
192
|
-
label: o(
|
|
193
|
+
rules: [(n) => !!n || o(s)("hr.role.form.required")],
|
|
194
|
+
label: o(s)("hr.role.form.name"),
|
|
193
195
|
disabled: g.value
|
|
194
196
|
}, null, 8, ["modelValue", "rules", "label", "disabled"])
|
|
195
197
|
]),
|
|
196
198
|
_: 1
|
|
197
199
|
}),
|
|
198
200
|
c(ie, {
|
|
199
|
-
title: o(
|
|
201
|
+
title: o(s)("hr.role.form.restaurant")
|
|
200
202
|
}, {
|
|
201
|
-
default:
|
|
203
|
+
default: y(() => [
|
|
202
204
|
O.value ? (d(), V("div", Je, [
|
|
203
|
-
c(
|
|
204
|
-
])) : (d(), V(
|
|
205
|
+
c(N)
|
|
206
|
+
])) : (d(), V(A, { key: 1 }, [
|
|
205
207
|
c(K, {
|
|
206
208
|
modelValue: $.value,
|
|
207
|
-
"onUpdate:modelValue":
|
|
208
|
-
placeholder: o(
|
|
209
|
+
"onUpdate:modelValue": a[1] || (a[1] = (n) => $.value = n),
|
|
210
|
+
placeholder: o(s)("hr.restaurant.search.placeholder")
|
|
209
211
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
210
212
|
c(we, {
|
|
211
|
-
modelValue:
|
|
212
|
-
"onUpdate:modelValue":
|
|
213
|
-
rules: [(n) => n.length > 0 || o(
|
|
213
|
+
modelValue: l.value.restaurantIds,
|
|
214
|
+
"onUpdate:modelValue": a[3] || (a[3] = (n) => l.value.restaurantIds = n),
|
|
215
|
+
rules: [(n) => n.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
|
|
214
216
|
}, {
|
|
215
|
-
default:
|
|
217
|
+
default: y(() => [
|
|
216
218
|
f("div", qe, [
|
|
217
|
-
$.value ? de("", !0) : (d(), L(
|
|
219
|
+
$.value ? de("", !0) : (d(), L(ee, {
|
|
218
220
|
key: 0,
|
|
219
|
-
"model-value":
|
|
220
|
-
label: "
|
|
221
|
+
"model-value": u.value,
|
|
222
|
+
label: o(s)("hr.role.form.all"),
|
|
221
223
|
value: "1",
|
|
222
224
|
disabled: g.value,
|
|
223
225
|
"onUpdate:modelValue": h
|
|
224
|
-
}, null, 8, ["model-value", "disabled"])),
|
|
225
|
-
(d(!0), V(
|
|
226
|
+
}, null, 8, ["model-value", "label", "disabled"])),
|
|
227
|
+
(d(!0), V(A, null, te(U.value, (n) => (d(), V("div", {
|
|
226
228
|
key: n._id
|
|
227
229
|
}, [
|
|
228
|
-
c(
|
|
229
|
-
modelValue:
|
|
230
|
-
"onUpdate:modelValue":
|
|
230
|
+
c(ee, {
|
|
231
|
+
modelValue: l.value.restaurantIds,
|
|
232
|
+
"onUpdate:modelValue": a[2] || (a[2] = (I) => l.value.restaurantIds = I),
|
|
231
233
|
label: `${n.profile.code ? n.profile.code + "-" : ""}${n.profile.name}`,
|
|
232
234
|
value: n._id,
|
|
233
235
|
disabled: g.value
|
|
@@ -242,48 +244,48 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
242
244
|
_: 1
|
|
243
245
|
}, 8, ["title"]),
|
|
244
246
|
c(ie, {
|
|
245
|
-
title: o(
|
|
247
|
+
title: o(s)("hr.role.form.permissions")
|
|
246
248
|
}, {
|
|
247
|
-
default:
|
|
248
|
-
(d(!0), V(
|
|
249
|
+
default: y(() => [
|
|
250
|
+
(d(!0), V(A, null, te(z.value, (n) => (d(), L(Ve, {
|
|
249
251
|
key: n.title,
|
|
250
252
|
variant: "outlined",
|
|
251
253
|
class: "p-16"
|
|
252
254
|
}, {
|
|
253
|
-
default:
|
|
255
|
+
default: y(() => [
|
|
254
256
|
c(Be, null, {
|
|
255
|
-
title:
|
|
257
|
+
title: y(() => [
|
|
256
258
|
f("p", ze, D(n.title), 1)
|
|
257
259
|
]),
|
|
258
|
-
default:
|
|
260
|
+
default: y(() => [
|
|
259
261
|
f("div", Ke, [
|
|
260
|
-
c(
|
|
262
|
+
c(ee, {
|
|
261
263
|
"model-value": x(n.options),
|
|
262
|
-
label: "
|
|
264
|
+
label: o(s)("hr.role.form.all"),
|
|
263
265
|
value: "1",
|
|
264
266
|
disabled: g.value,
|
|
265
267
|
"onUpdate:modelValue": (I) => v(n.options)
|
|
266
|
-
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
267
|
-
(d(!0), V(
|
|
268
|
+
}, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
|
|
269
|
+
(d(!0), V(A, null, te(n.options, (I) => (d(), V("div", {
|
|
268
270
|
key: I.value
|
|
269
271
|
}, [
|
|
270
|
-
c(
|
|
271
|
-
modelValue:
|
|
272
|
-
"onUpdate:modelValue":
|
|
272
|
+
c(ee, {
|
|
273
|
+
modelValue: l.value.permissions,
|
|
274
|
+
"onUpdate:modelValue": a[4] || (a[4] = (F) => l.value.permissions = F),
|
|
273
275
|
label: I.label,
|
|
274
276
|
value: I.value,
|
|
275
277
|
disabled: g.value
|
|
276
278
|
}, null, 8, ["modelValue", "label", "value", "disabled"]),
|
|
277
|
-
I.value === "order:discount" &&
|
|
278
|
-
f("div", je, D(o(
|
|
279
|
-
c(
|
|
280
|
-
modelValue:
|
|
281
|
-
"onUpdate:modelValue":
|
|
279
|
+
I.value === "order:discount" && l.value.permissions.includes(I.value) ? (d(), V("div", We, [
|
|
280
|
+
f("div", je, D(o(s)("hr.role.form.maxDiscountPercentage")), 1),
|
|
281
|
+
c(i, {
|
|
282
|
+
modelValue: l.value.maxDiscountPercentage,
|
|
283
|
+
"onUpdate:modelValue": a[5] || (a[5] = (F) => l.value.maxDiscountPercentage = F),
|
|
282
284
|
rules: [
|
|
283
|
-
(F) => !!F || o(
|
|
284
|
-
(F) => !isNaN(F) || o(
|
|
285
|
-
(F) => F <= 100 || o(
|
|
286
|
-
(F) => F >= 0 || o(
|
|
285
|
+
(F) => !!F || o(s)("hr.role.form.required"),
|
|
286
|
+
(F) => !isNaN(F) || o(s)("hr.role.form.onlyContainsNumber"),
|
|
287
|
+
(F) => F <= 100 || o(s)("hr.role.form.maxValueIs", { max: 100 }),
|
|
288
|
+
(F) => F >= 0 || o(s)("hr.role.form.minValueIs", { min: 0 })
|
|
287
289
|
],
|
|
288
290
|
"append-text": "%",
|
|
289
291
|
disabled: g.value
|
|
@@ -320,7 +322,7 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
320
322
|
class: "text-fm-color-typo-secondary"
|
|
321
323
|
}, as = {
|
|
322
324
|
class: "flex"
|
|
323
|
-
},
|
|
325
|
+
}, ls = {
|
|
324
326
|
class: "flex"
|
|
325
327
|
}, gs = /* @__PURE__ */ ge({
|
|
326
328
|
__name: "RoleList",
|
|
@@ -328,43 +330,43 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
328
330
|
expose: G
|
|
329
331
|
}) {
|
|
330
332
|
const {
|
|
331
|
-
t:
|
|
333
|
+
t: s
|
|
332
334
|
} = ye(), {
|
|
333
335
|
allReportPermissions: w
|
|
334
|
-
} = Fe(), $ = me(), U = _(() => $.restaurants.value), O = _(() => U.value.map((
|
|
335
|
-
function T(
|
|
336
|
-
const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0,
|
|
337
|
-
return ["-", "All"].includes(
|
|
336
|
+
} = Fe(), $ = me(), U = _(() => $.restaurants.value), O = _(() => U.value.map((t) => t._id));
|
|
337
|
+
function T(t, r) {
|
|
338
|
+
const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0, u = ae(t, r, m);
|
|
339
|
+
return ["-", "All"].includes(u) ? () => null : () => S(ue.FmTooltip, {
|
|
338
340
|
"z-index": "999",
|
|
339
341
|
placement: "top",
|
|
340
342
|
class: "ml-2"
|
|
341
343
|
}, {
|
|
342
|
-
content: () => S("div", [
|
|
344
|
+
content: () => S("div", [s("hr.role.tooltip.labels.permission"), ...t.filter((h) => h.subject === r).map((h) => S("div", ["- ", W(h).label]))]),
|
|
343
345
|
default: () => S(ue.FmIcon, {
|
|
344
346
|
name: "info",
|
|
345
347
|
color: Ie.NeutralGray400
|
|
346
348
|
})
|
|
347
349
|
});
|
|
348
350
|
}
|
|
349
|
-
function H(
|
|
350
|
-
const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0,
|
|
351
|
-
return () =>
|
|
351
|
+
function H(t, r) {
|
|
352
|
+
const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0, u = ae(t, r, m);
|
|
353
|
+
return () => u === "All" ? u : S("div", {
|
|
352
354
|
class: "flex items-center"
|
|
353
|
-
}, [
|
|
355
|
+
}, [u, T(t, r)()]);
|
|
354
356
|
}
|
|
355
|
-
function Q(
|
|
357
|
+
function Q(t) {
|
|
356
358
|
return [{
|
|
357
|
-
label:
|
|
358
|
-
onClick: () => M(
|
|
359
|
+
label: s("hr.role.form.update"),
|
|
360
|
+
onClick: () => M(t)
|
|
359
361
|
}, {
|
|
360
|
-
label:
|
|
361
|
-
onClick: () => E(
|
|
362
|
+
label: s("hr.role.remove.title"),
|
|
363
|
+
onClick: () => E(t),
|
|
362
364
|
itemClass: "text-fm-color-typo-error",
|
|
363
|
-
disabled: Ce(
|
|
365
|
+
disabled: Ce(t.permissions)
|
|
364
366
|
}];
|
|
365
367
|
}
|
|
366
|
-
const
|
|
367
|
-
role:
|
|
368
|
+
const X = ({
|
|
369
|
+
role: t,
|
|
368
370
|
className: r = ""
|
|
369
371
|
}) => c("div", {
|
|
370
372
|
class: r,
|
|
@@ -372,26 +374,26 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
372
374
|
m.stopPropagation();
|
|
373
375
|
}
|
|
374
376
|
}, [c(he, {
|
|
375
|
-
items: Q(
|
|
376
|
-
}, null)]),
|
|
377
|
+
items: Q(t)
|
|
378
|
+
}, null)]), oe = [{
|
|
377
379
|
accessorKey: "name",
|
|
378
|
-
header: () =>
|
|
380
|
+
header: () => s("hr.role.columns.name"),
|
|
379
381
|
enableSorting: !1
|
|
380
382
|
}, {
|
|
381
383
|
accessorKey: "operation",
|
|
382
|
-
header: () =>
|
|
383
|
-
cell: (
|
|
384
|
+
header: () => s("hr.role.columns.operation"),
|
|
385
|
+
cell: (t) => S(H(t.row.original.permissions, k.F_RULE_SUBJECT.enum.order)),
|
|
384
386
|
enableSorting: !1
|
|
385
387
|
}, {
|
|
386
388
|
accessorKey: "report",
|
|
387
|
-
header: () =>
|
|
388
|
-
cell: (
|
|
389
|
+
header: () => s("hr.role.columns.report"),
|
|
390
|
+
cell: (t) => S(H(t.row.original.permissions, k.F_RULE_SUBJECT.enum.report)),
|
|
389
391
|
enableSorting: !1
|
|
390
392
|
}, {
|
|
391
393
|
accessorKey: "restaurants",
|
|
392
|
-
header: () =>
|
|
393
|
-
cell: (
|
|
394
|
-
const
|
|
394
|
+
header: () => s("hr.role.columns.restaurants"),
|
|
395
|
+
cell: (t) => t.row.original.restaurants.map((r, m) => {
|
|
396
|
+
const u = r.code, h = `${u ? u + " - " : ""}${r.name}`;
|
|
395
397
|
return S("div", (m ? `
|
|
396
398
|
` : "") + h);
|
|
397
399
|
}),
|
|
@@ -403,18 +405,18 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
403
405
|
cellClass: "pl-16",
|
|
404
406
|
headerContentClass: "-mx-16"
|
|
405
407
|
},
|
|
406
|
-
cell: (
|
|
407
|
-
role:
|
|
408
|
+
cell: (t) => X({
|
|
409
|
+
role: t.row.original,
|
|
408
410
|
className: "flex w-full items-center justify-end"
|
|
409
411
|
})
|
|
410
|
-
}], M = async (
|
|
412
|
+
}], M = async (t) => {
|
|
411
413
|
var r;
|
|
412
|
-
g.value =
|
|
413
|
-
}, R = Re(),
|
|
414
|
-
const
|
|
415
|
-
return (O.value.length === 0 ?
|
|
416
|
-
const
|
|
417
|
-
const x =
|
|
414
|
+
g.value = t._id, await fe(), (r = z.value) == null || r.trigger();
|
|
415
|
+
}, R = Re(), b = Ne(), re = _(() => {
|
|
416
|
+
const t = R.roles.value || [];
|
|
417
|
+
return (O.value.length === 0 ? t : t.filter((m) => m.restaurants.some((u) => O.value.includes(u.id)))).map((m) => {
|
|
418
|
+
const u = m.restaurants.map((h) => {
|
|
419
|
+
const x = b.value[h.id];
|
|
418
420
|
return {
|
|
419
421
|
...h,
|
|
420
422
|
// Prefer live data from restaurantMap so names populate reactively
|
|
@@ -425,79 +427,79 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
425
427
|
});
|
|
426
428
|
return {
|
|
427
429
|
...m,
|
|
428
|
-
restaurants:
|
|
430
|
+
restaurants: u
|
|
429
431
|
};
|
|
430
432
|
});
|
|
431
433
|
}), J = _(() => {
|
|
432
434
|
var r;
|
|
433
|
-
return (r =
|
|
434
|
-
const
|
|
435
|
+
return (r = re.value) == null ? void 0 : r.filter((m) => {
|
|
436
|
+
const u = l.value.toLowerCase(), h = m.name.toLowerCase().includes(u), v = (m.restaurants || []).some((B) => {
|
|
435
437
|
var e;
|
|
436
|
-
return B.name.toLowerCase().includes(
|
|
438
|
+
return B.name.toLowerCase().includes(u) || ((e = B.code) == null ? void 0 : e.toLowerCase().includes(u));
|
|
437
439
|
});
|
|
438
440
|
return h || v;
|
|
439
441
|
});
|
|
440
|
-
}),
|
|
442
|
+
}), Y = Ue(), q = xe(), {
|
|
441
443
|
breakpoints: p
|
|
442
|
-
} = Ee(), E = (
|
|
443
|
-
|
|
444
|
-
title:
|
|
445
|
-
message:
|
|
446
|
-
name:
|
|
444
|
+
} = Ee(), E = (t) => {
|
|
445
|
+
Y.open({
|
|
446
|
+
title: s("hr.role.remove.title"),
|
|
447
|
+
message: s("hr.role.remove.message", {
|
|
448
|
+
name: t.name
|
|
447
449
|
}),
|
|
448
450
|
minWidth: p.value.lg ? 588 : 0,
|
|
449
451
|
primaryActions: {
|
|
450
|
-
text:
|
|
452
|
+
text: s("common.remove"),
|
|
451
453
|
close: !1,
|
|
452
454
|
variant: "destructive"
|
|
453
455
|
},
|
|
454
456
|
secondaryActions: {
|
|
455
|
-
text:
|
|
457
|
+
text: s("common.cancel"),
|
|
456
458
|
close: !0
|
|
457
459
|
}
|
|
458
460
|
}).onPrimary(async () => {
|
|
459
|
-
await R.deleteRole(
|
|
460
|
-
message:
|
|
461
|
-
name:
|
|
461
|
+
await R.deleteRole(t).then(() => q.open({
|
|
462
|
+
message: s("hr.role.remove.successMessage", {
|
|
463
|
+
name: t.name
|
|
462
464
|
}),
|
|
463
465
|
type: "success"
|
|
464
466
|
})).catch((r) => q.open({
|
|
465
467
|
message: r,
|
|
466
468
|
type: "error"
|
|
467
|
-
})),
|
|
469
|
+
})), Y.close();
|
|
468
470
|
});
|
|
469
|
-
},
|
|
470
|
-
async function
|
|
471
|
-
var
|
|
472
|
-
g.value = void 0, await fe(), (
|
|
471
|
+
}, l = P(""), z = P(), g = P(void 0);
|
|
472
|
+
async function Z() {
|
|
473
|
+
var t;
|
|
474
|
+
g.value = void 0, await fe(), (t = z.value) == null || t.trigger();
|
|
473
475
|
}
|
|
474
|
-
async function
|
|
476
|
+
async function ne() {
|
|
475
477
|
R.roles.value.length === 0 && await R.readRoles();
|
|
476
478
|
}
|
|
477
479
|
return be(() => {
|
|
478
|
-
|
|
480
|
+
ne();
|
|
479
481
|
}), G({
|
|
480
|
-
create:
|
|
481
|
-
}), (
|
|
482
|
-
const m = C("FmSearch"),
|
|
483
|
-
return d(), V(
|
|
482
|
+
create: Z
|
|
483
|
+
}), (t, r) => {
|
|
484
|
+
const m = C("FmSearch"), u = C("FmTable"), h = C("FmListItem"), x = C("FmList");
|
|
485
|
+
return d(), V(A, null, [(d(), L(He, {
|
|
484
486
|
id: g.value,
|
|
485
487
|
key: g.value,
|
|
486
488
|
ref_key: "roleFormRef",
|
|
487
489
|
ref: z
|
|
488
490
|
}, null, 8, ["id"])), f("div", Qe, [f("div", Xe, [c(m, {
|
|
489
|
-
modelValue:
|
|
490
|
-
"onUpdate:modelValue": r[0] || (r[0] = (v) =>
|
|
491
|
+
modelValue: l.value,
|
|
492
|
+
"onUpdate:modelValue": r[0] || (r[0] = (v) => l.value = v),
|
|
491
493
|
class: "w-[320px] xs:w-full",
|
|
492
494
|
autofocus: "",
|
|
493
|
-
placeholder: o(
|
|
495
|
+
placeholder: o(s)("hr.role.search.placeholder") + " / " + o(s)("hr.restaurant.search.placeholder")
|
|
494
496
|
}, null, 8, ["modelValue", "placeholder"])]), o(R).roles.value.length > 0 || o(R).isLoading.value ? (d(), L(Se, {
|
|
495
497
|
key: 0,
|
|
496
498
|
class: "overflow-auto"
|
|
497
499
|
}, {
|
|
498
|
-
default:
|
|
500
|
+
default: y(() => [c(u, {
|
|
499
501
|
class: "xs:hidden",
|
|
500
|
-
"column-defs":
|
|
502
|
+
"column-defs": oe,
|
|
501
503
|
"row-data": J.value,
|
|
502
504
|
"page-size": J.value.length,
|
|
503
505
|
loading: o(R).isLoading.value,
|
|
@@ -508,17 +510,17 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
508
510
|
}, null, 8, ["row-data", "page-size", "loading"]), f("div", Ye, [c(x, {
|
|
509
511
|
separator: ""
|
|
510
512
|
}, {
|
|
511
|
-
default:
|
|
513
|
+
default: y(() => [(d(!0), V(A, null, te(J.value, (v) => (d(), L(h, {
|
|
512
514
|
key: v._id,
|
|
513
515
|
class: "py-12 px-16 items-center justify-between",
|
|
514
516
|
onClick: (B) => M(v)
|
|
515
517
|
}, {
|
|
516
|
-
default:
|
|
518
|
+
default: y(() => [f("div", Ze, [f("p", es, D(v.name), 1), f("div", ss, [f("p", null, D(o(s)("hr.role.labels.restaurantList", {
|
|
517
519
|
items: v.restaurants.map((B) => B.name).join(", ")
|
|
518
|
-
})), 1), f("p", as, [pe(D(o(
|
|
519
|
-
items: o(
|
|
520
|
-
})) + " ", 1), (d(), L(ve(T(v.permissions, o(k.F_RULE_SUBJECT).enum.order))))]), f("p",
|
|
521
|
-
items: o(
|
|
520
|
+
})), 1), f("p", as, [pe(D(o(s)("hr.role.labels.operationList", {
|
|
521
|
+
items: o(ae)(v.permissions, o(k.F_RULE_SUBJECT).enum.order)
|
|
522
|
+
})) + " ", 1), (d(), L(ve(T(v.permissions, o(k.F_RULE_SUBJECT).enum.order))))]), f("p", ls, [pe(D(o(s)("hr.role.labels.reportList", {
|
|
523
|
+
items: o(ae)(v.permissions, o(k.F_RULE_SUBJECT).enum.report, o(w))
|
|
522
524
|
})) + " ", 1), (d(), L(ve(T(v.permissions, o(k.F_RULE_SUBJECT).enum.report))))])])]), f("div", {
|
|
523
525
|
onClick: r[2] || (r[2] = Le(() => {
|
|
524
526
|
}, ["stop"]))
|
|
@@ -532,8 +534,8 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
|
|
|
532
534
|
_: 1
|
|
533
535
|
})) : (d(), L(o($e), {
|
|
534
536
|
key: 1,
|
|
535
|
-
title: o(
|
|
536
|
-
subtitle: o(
|
|
537
|
+
title: o(s)("hr.role.noData.title"),
|
|
538
|
+
subtitle: o(s)("hr.role.noData.subtitle")
|
|
537
539
|
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
538
540
|
};
|
|
539
541
|
}
|