@feedmepos/mf-hrm-portal 1.1.6-dev → 2.0.0

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