@feedmepos/mf-hrm-portal 2.0.10 → 2.0.11-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AuditLogList-C7QcWwHq.js +941 -0
- package/dist/EmployeeList-CQzS4gXV.js +690 -0
- package/dist/{Main-D9233aXd.js → Main-6td6JhCb.js} +1055 -1054
- package/dist/{Main-6YVJ8qeK.js → Main-BhNhmkn8.js} +4 -4
- package/dist/{Main-BSaeTSWh.js → Main-Bu-UNnSQ.js} +6 -6
- package/dist/{PermissionSetList-vA7XmeDX.js → PermissionSetList-IG15Aj5D.js} +124 -128
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CrL1DmdL.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CDA9oDkd.js} +707 -707
- package/dist/RoleList-Cziztrpo.js +519 -0
- package/dist/TeamMemberList-DwxhZcrA.js +1081 -0
- package/dist/{TimesheetList-HsH2fi2o.js → TimesheetList-D_JT5iyS.js} +74 -74
- package/dist/{app-CvSQBSNk.js → app-h2mRYtCE.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-Cje6yZS4.js → dayjs.min-QbzmY4D1.js} +1 -1
- package/dist/employee-CY4sYUu8.js +232 -0
- package/dist/{index-CUPMZ2Nm.js → index-BLm_-G4e.js} +104 -81
- package/dist/{index-J8WRP1Mb.js → index-CBgvOHm7.js} +1 -1
- package/dist/{iteration-tLtr3UA8.js → iteration-J_5O7DIo.js} +2 -2
- package/dist/{lodash-CrQQQutG.js → lodash-btS1GWf0.js} +1 -1
- package/dist/src/api/employee/index.d.ts +4 -3
- package/dist/src/api/team/index.d.ts +3 -1
- package/dist/src/components/table/TablePagination.vue.d.ts +14 -0
- package/dist/src/composables/useDebounce.d.ts +9 -0
- package/dist/src/stores/employee.d.ts +515 -6
- package/dist/src/stores/team.d.ts +6 -0
- package/dist/src/types/employee.d.ts +35 -1
- package/dist/src/types/team.d.ts +18 -2
- package/dist/src/views/hr/employee/EmployeeForm.vue.d.ts +6 -2
- package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +3 -0
- package/dist/src/views/team/member/AddMemberForm.vue.d.ts +9 -0
- package/dist/src/views/team/member/TeamMemberMasterUser.vue.d.ts +5 -5
- package/dist/style.css +1 -1
- package/dist/{timesheet-Cj5r4laf.js → timesheet-B4Vja79b.js} +3 -3
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-BFge6TcH.js → useAppStore-CEidzV7L.js} +1 -1
- package/dist/useDebounce-Cnv3r01W.js +83 -0
- package/dist/{useLoading-D5jjAdvm.js → useLoading-fH82N_CS.js} +1 -1
- package/dist/{useReportPermissions-BeIK2wRH.js → useReportPermissions-BZS4zPhT.js} +3 -3
- package/package.json +1 -1
- package/dist/AuditLogList-DICsmRKu.js +0 -915
- package/dist/EmployeeList-BeTBQG6y.js +0 -621
- package/dist/RoleList-BwZRlJSm.js +0 -499
- package/dist/TeamMemberList-DqMVgyU0.js +0 -989
- package/dist/employee-Bvza5QKq.js +0 -145
- package/dist/team-eAkNf8XU.js +0 -33
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { defineComponent as _e, ref as P, computed as g, watch as re, onMounted as ge, resolveComponent as b, createBlock as U, openBlock as c, unref as o, withCtx as F, createElementVNode as h, createVNode as p, createElementBlock as w, Fragment as A, createCommentVNode as de, renderList as ee, toDisplayString as M, h as V, createTextVNode as ce, resolveDynamicComponent as pe, withModifiers as Le, nextTick as ve } from "vue";
|
|
2
|
+
import { e as L } from "./iteration-J_5O7DIo.js";
|
|
3
|
+
import { useI18n as be, useCoreStore as ye } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Fe, components as se, useDialog as Ue, useBreakpoints as Ie, FmButtonColorThemeVariant as fe, FmButtonVariant as Ee } from "@feedmepos/ui-library";
|
|
5
|
+
import { _ as Se } from "./app-h2mRYtCE.js";
|
|
6
|
+
import { _ as Pe } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
|
|
7
|
+
import { e as $e, r as W, h as ie, f as Te, g as he, a as Y } from "./index-BLm_-G4e.js";
|
|
8
|
+
import { u as xe } from "./useAppStore-CEidzV7L.js";
|
|
9
|
+
import { u as Ce } from "./useReportPermissions-BZS4zPhT.js";
|
|
10
|
+
import { u as Be, a as De } from "./useRestaurantMap-e9fQJiLC.js";
|
|
11
|
+
import { l as Z } from "./lodash-btS1GWf0.js";
|
|
12
|
+
import { _ as ne, a as Ae } from "./FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js";
|
|
13
|
+
import { u as Me } from "./useLoading-fH82N_CS.js";
|
|
14
|
+
const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, Je = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "flex justify-center py-16"
|
|
17
|
+
}, qe = { class: "space-y-8" }, ze = { class: "space-y-8" }, Ke = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "w-50 ml-5 flex flex-row items-start"
|
|
20
|
+
}, We = { class: "m-2" }, je = { class: "flex gap-8 items-center justify-start" }, Ge = /* @__PURE__ */ _e({
|
|
21
|
+
__name: "RoleForm",
|
|
22
|
+
props: {
|
|
23
|
+
id: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: void 0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
setup(ue, { expose: ae }) {
|
|
29
|
+
const { t: l } = be(), $ = ye(), T = P(""), I = g(() => $.restaurants.value.filter(({ profile: e }) => {
|
|
30
|
+
const s = `${e.code ? e.code + "-" : ""}${e.legalName}`;
|
|
31
|
+
return !T.value || s.toLowerCase().includes(T.value.toLowerCase());
|
|
32
|
+
})), N = P($.restaurants.value.length === 0);
|
|
33
|
+
re(
|
|
34
|
+
() => $.restaurants.value.length,
|
|
35
|
+
(e) => {
|
|
36
|
+
e > 0 && (N.value = !1);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
const B = xe(), j = Fe(), le = Me(j), { fetchReportPermissions: G, allReportPermissions: k, availableReportKeys: O } = Ce(), J = ue, _ = P(!1), H = () => {
|
|
40
|
+
_.value = !_.value, _.value && t();
|
|
41
|
+
}, Q = g(() => J.id ? l("hr.role.form.update") : l("hr.role.form.add")), te = g(() => J.id ? l("common.update") : l("common.add")), q = g(() => {
|
|
42
|
+
const e = $e.filter(
|
|
43
|
+
(i) => i.subject !== L.F_RULE_SUBJECT.enum.report
|
|
44
|
+
).map((i) => W(i)), s = k.value.map((i) => W(i));
|
|
45
|
+
return [...e, ...s];
|
|
46
|
+
}), d = g(() => B.roles.value.find((e) => e._id == J.id)), R = () => ({
|
|
47
|
+
name: "",
|
|
48
|
+
restaurantIds: [],
|
|
49
|
+
permissions: [],
|
|
50
|
+
maxDiscountPercentage: 100
|
|
51
|
+
}), a = P(R()), oe = g(() => [
|
|
52
|
+
{
|
|
53
|
+
title: l("hr.role.labels.operation"),
|
|
54
|
+
filter: (e) => e.isOrderOperation
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: l("hr.role.labels.report"),
|
|
58
|
+
filter: (e) => e.isReportPermission
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: l("hr.role.labels.other"),
|
|
62
|
+
filter: (e) => !e.isOrderOperation && !e.isReportPermission
|
|
63
|
+
}
|
|
64
|
+
].map((e) => ({
|
|
65
|
+
title: e.title,
|
|
66
|
+
options: q.value.filter(e.filter).map(({ label: s, value: i }) => ({
|
|
67
|
+
label: s,
|
|
68
|
+
value: i
|
|
69
|
+
}))
|
|
70
|
+
}))), x = g(() => {
|
|
71
|
+
var e;
|
|
72
|
+
return ie(((e = d.value) == null ? void 0 : e.permissions) || []);
|
|
73
|
+
});
|
|
74
|
+
function t() {
|
|
75
|
+
var e;
|
|
76
|
+
a.value = R(), a.value.name = ((e = d.value) == null ? void 0 : e.name) ?? "", x.value ? (a.value.restaurantIds = I.value.map((s) => s._id), a.value.permissions = q.value.map((s) => s.value)) : d.value && (a.value.restaurantIds = d.value.restaurants.map((s) => s.id), a.value.permissions = d.value.permissions.map((s) => W(s).value).filter((s) => s.startsWith("report:") ? O.value.has(s.split(":")[1]) : !0), a.value.maxDiscountPercentage = he(
|
|
77
|
+
d.value.permissions
|
|
78
|
+
));
|
|
79
|
+
}
|
|
80
|
+
ge(async () => {
|
|
81
|
+
await G(), t();
|
|
82
|
+
}), re(O, () => {
|
|
83
|
+
_.value && d.value && !x.value && (a.value.permissions = a.value.permissions.filter((e) => e.startsWith("report:") ? O.value.has(e.split(":")[1]) : !0));
|
|
84
|
+
});
|
|
85
|
+
const r = P(""), v = g(() => ({
|
|
86
|
+
restaurantIds: a.value.restaurantIds,
|
|
87
|
+
role: {
|
|
88
|
+
name: a.value.name,
|
|
89
|
+
permissions: Te(a.value.permissions, a.value.maxDiscountPercentage)
|
|
90
|
+
}
|
|
91
|
+
})), u = async () => {
|
|
92
|
+
const e = v.value;
|
|
93
|
+
await le.minor(
|
|
94
|
+
async () => {
|
|
95
|
+
d.value ? await B.updateRole(d.value._id, e) : await B.createRole(e);
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
successMessage: d.value ? l("hr.role.update.successMessage", { name: e.role.name }) : l("hr.role.add.successMessage", { name: e.role.name })
|
|
99
|
+
}
|
|
100
|
+
), _.value = !1;
|
|
101
|
+
}, f = g(
|
|
102
|
+
() => a.value.restaurantIds.filter((e) => I.value.some((s) => s._id === e))
|
|
103
|
+
), y = g(() => I.value.length > 0 && I.value.length === f.value.length), z = () => {
|
|
104
|
+
const e = a.value.restaurantIds.filter((s) => !f.value.includes(s));
|
|
105
|
+
y.value === !0 ? a.value.restaurantIds = e : a.value.restaurantIds = I.value.map((s) => s._id);
|
|
106
|
+
}, m = (e) => e.map((i) => i.value).every((i) => a.value.permissions.includes(i)), E = (e) => {
|
|
107
|
+
const s = a.value.permissions.filter(
|
|
108
|
+
(i) => !e.map((D) => D.value).includes(i)
|
|
109
|
+
);
|
|
110
|
+
m(e) === !0 ? a.value.permissions = s : a.value.permissions = [...s, ...e.map((i) => i.value)];
|
|
111
|
+
};
|
|
112
|
+
re(
|
|
113
|
+
() => a.value.restaurantIds,
|
|
114
|
+
(e) => {
|
|
115
|
+
e.length > 0 && (r.value = "");
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
const Re = Be(
|
|
119
|
+
() => {
|
|
120
|
+
var e, s, i, D;
|
|
121
|
+
return !Z.isEqual(a.value.name, ((e = d.value) == null ? void 0 : e.name) || R().name) || !Z.isEqual(
|
|
122
|
+
a.value.restaurantIds,
|
|
123
|
+
((s = d.value) == null ? void 0 : s.restaurants.map((K) => K.id)) || R().restaurantIds
|
|
124
|
+
) || !Z.isEqual(
|
|
125
|
+
a.value.permissions,
|
|
126
|
+
((i = d.value) == null ? void 0 : i.permissions.map((K) => W(K).value)) || R().permissions
|
|
127
|
+
) || !Z.isEqual(
|
|
128
|
+
a.value.maxDiscountPercentage,
|
|
129
|
+
d.value ? he((D = d.value) == null ? void 0 : D.permissions) : R().maxDiscountPercentage
|
|
130
|
+
);
|
|
131
|
+
},
|
|
132
|
+
() => {
|
|
133
|
+
_.value = !1;
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
return ae({
|
|
137
|
+
show: _,
|
|
138
|
+
trigger: H
|
|
139
|
+
}), (e, s) => {
|
|
140
|
+
const i = b("FmTextField"), D = b("FmCircularProgress"), K = b("FmSearch"), X = b("FmCheckbox"), Ve = b("FmFormGroup"), we = b("FmCard"), me = b("fm-button"), ke = b("fm-side-sheet");
|
|
141
|
+
return c(), U(ke, {
|
|
142
|
+
id: "unit-form",
|
|
143
|
+
modelValue: _.value,
|
|
144
|
+
"onUpdate:modelValue": s[7] || (s[7] = (n) => _.value = n),
|
|
145
|
+
"is-container": o(se).FmForm,
|
|
146
|
+
"is-container-props": {
|
|
147
|
+
onValidationSuccess: u,
|
|
148
|
+
blameFormChildOnValidationFailed: !0
|
|
149
|
+
},
|
|
150
|
+
"max-width": 560,
|
|
151
|
+
"onOn:clickedAway": o(Re)
|
|
152
|
+
}, {
|
|
153
|
+
"side-sheet-header": F(() => [
|
|
154
|
+
h("p", Ne, M(Q.value), 1)
|
|
155
|
+
]),
|
|
156
|
+
"side-sheet-footer": F(() => [
|
|
157
|
+
h("div", je, [
|
|
158
|
+
p(me, {
|
|
159
|
+
label: te.value,
|
|
160
|
+
size: "lg",
|
|
161
|
+
type: "submit",
|
|
162
|
+
variant: "primary",
|
|
163
|
+
disabled: x.value
|
|
164
|
+
}, null, 8, ["label", "disabled"]),
|
|
165
|
+
p(me, {
|
|
166
|
+
label: o(l)("common.cancel"),
|
|
167
|
+
size: "lg",
|
|
168
|
+
variant: "tertiary",
|
|
169
|
+
onClick: s[6] || (s[6] = () => _.value = !1)
|
|
170
|
+
}, null, 8, ["label"])
|
|
171
|
+
])
|
|
172
|
+
]),
|
|
173
|
+
default: F(() => [
|
|
174
|
+
h("div", Oe, [
|
|
175
|
+
p(ne, { title: "Role detail" }, {
|
|
176
|
+
default: F(() => [
|
|
177
|
+
p(i, {
|
|
178
|
+
modelValue: a.value.name,
|
|
179
|
+
"onUpdate:modelValue": s[0] || (s[0] = (n) => a.value.name = n),
|
|
180
|
+
autofocus: "",
|
|
181
|
+
rules: [(n) => !!n || o(l)("hr.role.form.required")],
|
|
182
|
+
label: o(l)("hr.role.form.name"),
|
|
183
|
+
disabled: x.value
|
|
184
|
+
}, null, 8, ["modelValue", "rules", "label", "disabled"])
|
|
185
|
+
]),
|
|
186
|
+
_: 1
|
|
187
|
+
}),
|
|
188
|
+
p(ne, {
|
|
189
|
+
title: o(l)("hr.role.form.restaurant")
|
|
190
|
+
}, {
|
|
191
|
+
default: F(() => [
|
|
192
|
+
N.value ? (c(), w("div", Je, [
|
|
193
|
+
p(D)
|
|
194
|
+
])) : (c(), w(A, { key: 1 }, [
|
|
195
|
+
p(K, {
|
|
196
|
+
modelValue: T.value,
|
|
197
|
+
"onUpdate:modelValue": s[1] || (s[1] = (n) => T.value = n),
|
|
198
|
+
placeholder: o(l)("hr.restaurant.search.placeholder")
|
|
199
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
200
|
+
p(Ve, {
|
|
201
|
+
modelValue: a.value.restaurantIds,
|
|
202
|
+
"onUpdate:modelValue": s[3] || (s[3] = (n) => a.value.restaurantIds = n),
|
|
203
|
+
rules: [(n) => n.length > 0 || o(l)("hr.role.form.atLeastOneRestaurant")]
|
|
204
|
+
}, {
|
|
205
|
+
default: F(() => [
|
|
206
|
+
h("div", qe, [
|
|
207
|
+
T.value ? de("", !0) : (c(), U(X, {
|
|
208
|
+
key: 0,
|
|
209
|
+
"model-value": y.value,
|
|
210
|
+
label: "All",
|
|
211
|
+
value: "1",
|
|
212
|
+
disabled: x.value,
|
|
213
|
+
"onUpdate:modelValue": z
|
|
214
|
+
}, null, 8, ["model-value", "disabled"])),
|
|
215
|
+
(c(!0), w(A, null, ee(I.value, (n) => (c(), w("div", {
|
|
216
|
+
key: n._id
|
|
217
|
+
}, [
|
|
218
|
+
p(X, {
|
|
219
|
+
modelValue: a.value.restaurantIds,
|
|
220
|
+
"onUpdate:modelValue": s[2] || (s[2] = (S) => a.value.restaurantIds = S),
|
|
221
|
+
label: `${n.profile.code ? n.profile.code + "-" : ""}${n.profile.name}`,
|
|
222
|
+
value: n._id,
|
|
223
|
+
disabled: x.value
|
|
224
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"])
|
|
225
|
+
]))), 128))
|
|
226
|
+
])
|
|
227
|
+
]),
|
|
228
|
+
_: 1
|
|
229
|
+
}, 8, ["modelValue", "rules"])
|
|
230
|
+
], 64))
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, ["title"]),
|
|
234
|
+
p(ne, {
|
|
235
|
+
title: o(l)("hr.role.form.permissions")
|
|
236
|
+
}, {
|
|
237
|
+
default: F(() => [
|
|
238
|
+
(c(!0), w(A, null, ee(oe.value, (n) => (c(), U(we, {
|
|
239
|
+
key: n.title,
|
|
240
|
+
variant: "outlined",
|
|
241
|
+
class: "p-16"
|
|
242
|
+
}, {
|
|
243
|
+
default: F(() => [
|
|
244
|
+
p(Ae, {
|
|
245
|
+
label: n.title
|
|
246
|
+
}, {
|
|
247
|
+
default: F(() => [
|
|
248
|
+
h("div", ze, [
|
|
249
|
+
p(X, {
|
|
250
|
+
"model-value": m(n.options),
|
|
251
|
+
label: "All",
|
|
252
|
+
value: "1",
|
|
253
|
+
disabled: x.value,
|
|
254
|
+
"onUpdate:modelValue": (S) => E(n.options)
|
|
255
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
256
|
+
(c(!0), w(A, null, ee(n.options, (S) => (c(), w("div", {
|
|
257
|
+
key: S.value
|
|
258
|
+
}, [
|
|
259
|
+
p(X, {
|
|
260
|
+
modelValue: a.value.permissions,
|
|
261
|
+
"onUpdate:modelValue": s[4] || (s[4] = (C) => a.value.permissions = C),
|
|
262
|
+
label: S.label,
|
|
263
|
+
value: S.value,
|
|
264
|
+
disabled: x.value
|
|
265
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"]),
|
|
266
|
+
S.value === "order:discount" && a.value.permissions.includes(S.value) ? (c(), w("div", Ke, [
|
|
267
|
+
h("div", We, M(o(l)("hr.role.form.maxDiscountPercentage")), 1),
|
|
268
|
+
p(i, {
|
|
269
|
+
modelValue: a.value.maxDiscountPercentage,
|
|
270
|
+
"onUpdate:modelValue": s[5] || (s[5] = (C) => a.value.maxDiscountPercentage = C),
|
|
271
|
+
rules: [
|
|
272
|
+
(C) => !!C || o(l)("hr.role.form.required"),
|
|
273
|
+
(C) => !isNaN(C) || o(l)("hr.role.form.onlyContainsNumber"),
|
|
274
|
+
(C) => C <= 100 || o(l)("hr.role.form.maxValueIs", { max: 100 }),
|
|
275
|
+
(C) => C >= 0 || o(l)("hr.role.form.minValueIs", { min: 0 })
|
|
276
|
+
],
|
|
277
|
+
"append-text": "%",
|
|
278
|
+
disabled: x.value
|
|
279
|
+
}, null, 8, ["modelValue", "rules", "disabled"])
|
|
280
|
+
])) : de("", !0)
|
|
281
|
+
]))), 128))
|
|
282
|
+
])
|
|
283
|
+
]),
|
|
284
|
+
_: 2
|
|
285
|
+
}, 1032, ["label"])
|
|
286
|
+
]),
|
|
287
|
+
_: 2
|
|
288
|
+
}, 1024))), 128))
|
|
289
|
+
]),
|
|
290
|
+
_: 1
|
|
291
|
+
}, 8, ["title"])
|
|
292
|
+
])
|
|
293
|
+
]),
|
|
294
|
+
_: 1
|
|
295
|
+
}, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}), He = {
|
|
299
|
+
class: "space-y-8"
|
|
300
|
+
}, Qe = {
|
|
301
|
+
class: "flex justify-end xs:px-16"
|
|
302
|
+
}, Xe = {
|
|
303
|
+
class: "pb-64 sm:hidden md:hidden lg:hidden"
|
|
304
|
+
}, Ye = {
|
|
305
|
+
class: "space-y-4"
|
|
306
|
+
}, Ze = {
|
|
307
|
+
class: "fm-typo-en-body-lg-600"
|
|
308
|
+
}, es = {
|
|
309
|
+
class: "text-fm-color-typo-secondary"
|
|
310
|
+
}, ss = {
|
|
311
|
+
class: "flex"
|
|
312
|
+
}, as = {
|
|
313
|
+
class: "flex"
|
|
314
|
+
}, hs = /* @__PURE__ */ _e({
|
|
315
|
+
__name: "RoleList",
|
|
316
|
+
setup(ue, {
|
|
317
|
+
expose: ae
|
|
318
|
+
}) {
|
|
319
|
+
const {
|
|
320
|
+
t: l
|
|
321
|
+
} = be(), {
|
|
322
|
+
allReportPermissions: $
|
|
323
|
+
} = Ce(), T = ye(), I = g(() => T.restaurants.value), N = g(() => I.value.map((t) => t._id));
|
|
324
|
+
function B(t, r) {
|
|
325
|
+
const v = r === L.F_RULE_SUBJECT.enum.report ? $.value : void 0, u = Y(t, r, v);
|
|
326
|
+
return ["-", "All"].includes(u) ? () => null : () => V(se.FmTooltip, {
|
|
327
|
+
"z-index": "999",
|
|
328
|
+
placement: "top",
|
|
329
|
+
class: "ml-2"
|
|
330
|
+
}, {
|
|
331
|
+
content: () => V("div", [l("hr.role.tooltip.labels.permission"), ...t.filter((f) => f.subject === r).map((f) => V("div", ["- ", W(f).label]))]),
|
|
332
|
+
default: () => V(se.FmIcon, {
|
|
333
|
+
name: "info",
|
|
334
|
+
color: fe.NeutralGray400
|
|
335
|
+
})
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function j(t, r) {
|
|
339
|
+
const v = r === L.F_RULE_SUBJECT.enum.report ? $.value : void 0, u = Y(t, r, v);
|
|
340
|
+
return () => u === "All" ? u : V("div", {
|
|
341
|
+
class: "flex items-center"
|
|
342
|
+
}, [u, B(t, r)()]);
|
|
343
|
+
}
|
|
344
|
+
const le = [{
|
|
345
|
+
accessorKey: "name",
|
|
346
|
+
header: () => l("hr.role.columns.name"),
|
|
347
|
+
enableSorting: !1
|
|
348
|
+
}, {
|
|
349
|
+
accessorKey: "operation",
|
|
350
|
+
header: () => l("hr.role.columns.operation"),
|
|
351
|
+
cell: (t) => V(j(t.row.original.permissions, L.F_RULE_SUBJECT.enum.order)),
|
|
352
|
+
enableSorting: !1
|
|
353
|
+
}, {
|
|
354
|
+
accessorKey: "report",
|
|
355
|
+
header: () => l("hr.role.columns.report"),
|
|
356
|
+
cell: (t) => V(j(t.row.original.permissions, L.F_RULE_SUBJECT.enum.report)),
|
|
357
|
+
enableSorting: !1
|
|
358
|
+
}, {
|
|
359
|
+
accessorKey: "restaurants",
|
|
360
|
+
header: () => l("hr.role.columns.restaurants"),
|
|
361
|
+
cell: (t) => t.row.original.restaurants.map((r, v) => {
|
|
362
|
+
const u = r.code, f = `${u ? u + " - " : ""}${r.name}`;
|
|
363
|
+
return V("div", (v ? `
|
|
364
|
+
` : "") + f);
|
|
365
|
+
}),
|
|
366
|
+
enableSorting: !1
|
|
367
|
+
}, {
|
|
368
|
+
id: "action",
|
|
369
|
+
size: 52,
|
|
370
|
+
meta: {
|
|
371
|
+
cellClass: "pl-16",
|
|
372
|
+
headerContentClass: "-mx-16"
|
|
373
|
+
},
|
|
374
|
+
cell: (t) => V("div", {
|
|
375
|
+
class: "w-full flex justify-end items-center"
|
|
376
|
+
}, [V(se.FmButton, {
|
|
377
|
+
prependIcon: "delete",
|
|
378
|
+
variant: Ee.Tertiary,
|
|
379
|
+
textColor: fe.NeutralGray400,
|
|
380
|
+
disabled: ie(t.row.original.permissions),
|
|
381
|
+
onClick: (r) => {
|
|
382
|
+
r.stopPropagation(), q(t.row.original);
|
|
383
|
+
}
|
|
384
|
+
})])
|
|
385
|
+
}], G = async (t) => {
|
|
386
|
+
var r;
|
|
387
|
+
a.value = t._id, await ve(), (r = R.value) == null || r.trigger();
|
|
388
|
+
}, k = xe(), O = De(), J = g(() => {
|
|
389
|
+
const t = k.roles.value || [];
|
|
390
|
+
return (N.value.length === 0 ? t : t.filter((v) => v.restaurants.some((u) => N.value.includes(u.id)))).map((v) => {
|
|
391
|
+
const u = v.restaurants.map((f) => {
|
|
392
|
+
const y = O.value[f.id];
|
|
393
|
+
return {
|
|
394
|
+
...f,
|
|
395
|
+
// Prefer live data from restaurantMap so names populate reactively
|
|
396
|
+
// even when restaurants loaded after roles.
|
|
397
|
+
name: (y == null ? void 0 : y.profile.name) || f.name,
|
|
398
|
+
code: y == null ? void 0 : y.profile.code
|
|
399
|
+
};
|
|
400
|
+
});
|
|
401
|
+
return {
|
|
402
|
+
...v,
|
|
403
|
+
restaurants: u
|
|
404
|
+
};
|
|
405
|
+
});
|
|
406
|
+
}), _ = g(() => {
|
|
407
|
+
var r;
|
|
408
|
+
return (r = J.value) == null ? void 0 : r.filter((v) => {
|
|
409
|
+
const u = d.value.toLowerCase(), f = v.name.toLowerCase().includes(u), z = (v.restaurants || []).some((m) => {
|
|
410
|
+
var E;
|
|
411
|
+
return m.name.toLowerCase().includes(u) || ((E = m.code) == null ? void 0 : E.toLowerCase().includes(u));
|
|
412
|
+
});
|
|
413
|
+
return f || z;
|
|
414
|
+
});
|
|
415
|
+
}), H = Ue(), Q = Fe(), {
|
|
416
|
+
breakpoints: te
|
|
417
|
+
} = Ie(), q = (t) => {
|
|
418
|
+
H.open({
|
|
419
|
+
title: l("hr.role.remove.title"),
|
|
420
|
+
message: l("hr.role.remove.message", {
|
|
421
|
+
name: t.name
|
|
422
|
+
}),
|
|
423
|
+
minWidth: te.value.lg ? 588 : 0,
|
|
424
|
+
primaryActions: {
|
|
425
|
+
text: l("common.remove"),
|
|
426
|
+
close: !1,
|
|
427
|
+
variant: "destructive"
|
|
428
|
+
},
|
|
429
|
+
secondaryActions: {
|
|
430
|
+
text: l("common.cancel"),
|
|
431
|
+
close: !0
|
|
432
|
+
}
|
|
433
|
+
}).onPrimary(async () => {
|
|
434
|
+
await k.deleteRole(t).then(() => Q.open({
|
|
435
|
+
message: l("hr.role.remove.successMessage", {
|
|
436
|
+
name: t.name
|
|
437
|
+
}),
|
|
438
|
+
type: "success"
|
|
439
|
+
})).catch((r) => Q.open({
|
|
440
|
+
message: r,
|
|
441
|
+
type: "error"
|
|
442
|
+
})), H.close();
|
|
443
|
+
});
|
|
444
|
+
}, d = P(""), R = P(), a = P(void 0);
|
|
445
|
+
async function oe() {
|
|
446
|
+
var t;
|
|
447
|
+
a.value = void 0, await ve(), (t = R.value) == null || t.trigger();
|
|
448
|
+
}
|
|
449
|
+
async function x() {
|
|
450
|
+
k.roles.value.length === 0 && await k.readRoles();
|
|
451
|
+
}
|
|
452
|
+
return ge(() => {
|
|
453
|
+
x();
|
|
454
|
+
}), ae({
|
|
455
|
+
create: oe
|
|
456
|
+
}), (t, r) => {
|
|
457
|
+
const v = b("FmSearch"), u = b("FmTable"), f = b("FmButton"), y = b("FmListItem"), z = b("FmList");
|
|
458
|
+
return c(), w(A, null, [(c(), U(Ge, {
|
|
459
|
+
id: a.value,
|
|
460
|
+
key: a.value,
|
|
461
|
+
ref_key: "roleFormRef",
|
|
462
|
+
ref: R
|
|
463
|
+
}, null, 8, ["id"])), h("div", He, [h("div", Qe, [p(v, {
|
|
464
|
+
modelValue: d.value,
|
|
465
|
+
"onUpdate:modelValue": r[0] || (r[0] = (m) => d.value = m),
|
|
466
|
+
class: "w-[320px] xs:w-full",
|
|
467
|
+
autofocus: "",
|
|
468
|
+
placeholder: o(l)("hr.role.search.placeholder") + " / " + o(l)("hr.restaurant.search.placeholder")
|
|
469
|
+
}, null, 8, ["modelValue", "placeholder"])]), o(k).roles.value.length > 0 || o(k).isLoading.value ? (c(), U(Se, {
|
|
470
|
+
key: 0,
|
|
471
|
+
class: "overflow-auto"
|
|
472
|
+
}, {
|
|
473
|
+
default: F(() => [p(u, {
|
|
474
|
+
class: "xs:hidden",
|
|
475
|
+
"column-defs": le,
|
|
476
|
+
"row-data": _.value,
|
|
477
|
+
"page-size": _.value.length,
|
|
478
|
+
loading: o(k).isLoading.value,
|
|
479
|
+
"pin-header-row": "",
|
|
480
|
+
"hide-footer": "",
|
|
481
|
+
"shrink-at": !1,
|
|
482
|
+
onRowClick: r[1] || (r[1] = (m) => G(m.original))
|
|
483
|
+
}, null, 8, ["row-data", "page-size", "loading"]), h("div", Xe, [p(z, {
|
|
484
|
+
separator: ""
|
|
485
|
+
}, {
|
|
486
|
+
default: F(() => [(c(!0), w(A, null, ee(_.value, (m) => (c(), U(y, {
|
|
487
|
+
key: m._id,
|
|
488
|
+
class: "py-12 px-16 items-center justify-between",
|
|
489
|
+
onClick: (E) => G(m)
|
|
490
|
+
}, {
|
|
491
|
+
default: F(() => [h("div", Ye, [h("p", Ze, M(m.name), 1), h("div", es, [h("p", null, M(o(l)("hr.role.labels.restaurantList", {
|
|
492
|
+
items: m.restaurants.map((E) => E.name).join(", ")
|
|
493
|
+
})), 1), h("p", ss, [ce(M(o(l)("hr.role.labels.operationList", {
|
|
494
|
+
items: o(Y)(m.permissions, o(L.F_RULE_SUBJECT).enum.order)
|
|
495
|
+
})) + " ", 1), (c(), U(pe(B(m.permissions, o(L.F_RULE_SUBJECT).enum.order))))]), h("p", as, [ce(M(o(l)("hr.role.labels.reportList", {
|
|
496
|
+
items: o(Y)(m.permissions, o(L.F_RULE_SUBJECT).enum.report, o($))
|
|
497
|
+
})) + " ", 1), (c(), U(pe(B(m.permissions, o(L.F_RULE_SUBJECT).enum.report))))])])]), p(f, {
|
|
498
|
+
disabled: o(ie)(m.permissions),
|
|
499
|
+
icon: "delete",
|
|
500
|
+
variant: "tertiary",
|
|
501
|
+
"text-color": "neutral-gray-400",
|
|
502
|
+
onClick: Le((E) => q(m), ["stop"])
|
|
503
|
+
}, null, 8, ["disabled", "onClick"])]),
|
|
504
|
+
_: 2
|
|
505
|
+
}, 1032, ["onClick"]))), 128))]),
|
|
506
|
+
_: 1
|
|
507
|
+
})])]),
|
|
508
|
+
_: 1
|
|
509
|
+
})) : (c(), U(o(Pe), {
|
|
510
|
+
key: 1,
|
|
511
|
+
title: o(l)("hr.role.noData.title"),
|
|
512
|
+
subtitle: o(l)("hr.role.noData.subtitle")
|
|
513
|
+
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
export {
|
|
518
|
+
hs as default
|
|
519
|
+
};
|