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