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