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