@feedmepos/mf-hrm-portal 2.0.25 → 2.1.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/AuditLogList-AGlAsWwd.js +1608 -0
  2. package/dist/ConditionFormHost.vue_vue_type_script_setup_true_lang-BYHKFwRm.js +383 -0
  3. package/dist/EmployeeList-KvjoGI87.js +884 -0
  4. package/dist/{Main-C6YMg19H.js → Main-BLh16xRg.js} +187 -184
  5. package/dist/{Main-DQg87aB2.js → Main-D3TSdtSE.js} +7 -7
  6. package/dist/{Main-CyqPnLTe.js → Main-Dn1TfDRj.js} +1033 -1029
  7. package/dist/PermissionSetList-Ds69m9UU.js +392 -0
  8. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Bk6ub3Dv.js +4030 -0
  9. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-DWeS7VXx.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-BHxCP_uW.js} +1 -1
  10. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js +42 -0
  11. package/dist/RoleList-v8McRCnz.js +684 -0
  12. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
  13. package/dist/{index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js → TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js} +54 -20
  14. package/dist/TeamMemberList-BYQnNIhT.js +1169 -0
  15. package/dist/{TimesheetList-DzeE73Ns.js → TimesheetList-C1OWa6kf.js} +139 -133
  16. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_91afda4e_lang-CTQs7MIl.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CLu9gzzi.js} +2 -2
  17. package/dist/{app-Df4eEEIU.js → app-CJouCBgi.js} +5248 -2273
  18. package/dist/app.js +1 -1
  19. package/dist/{dayjs.min-DmGoh5hw.js → dayjs.min-DUugkgDM.js} +1 -1
  20. package/dist/{employee-zWTRoOkw.js → employee-D5rEVmge.js} +3 -3
  21. package/dist/{iteration-DTV3udF0.js → iteration-QRRNYlps.js} +3 -3
  22. package/dist/{lodash-LInzVEDS.js → lodash-BlZhpHhM.js} +1 -1
  23. package/dist/rule-Dy7eMChN.js +1053 -0
  24. package/dist/src/api/audit-log/index.d.ts +6 -0
  25. package/dist/src/components/CheckboxInput.vue.d.ts +1 -1
  26. package/dist/src/components/button/ResponsiveFabButton.vue.d.ts +7 -1
  27. package/dist/src/components/table/EmptyDataTemplate/index.vue.d.ts +4 -1
  28. package/dist/src/components/table/TableEmptyState.vue.d.ts +31 -0
  29. package/dist/src/composables/useBasePermission.d.ts +1 -0
  30. package/dist/src/composables/useConditionDraft.d.ts +40 -0
  31. package/dist/src/composables/useCoverConditionOverride.d.ts +61 -0
  32. package/dist/src/helpers/business-timezone.d.ts +22 -0
  33. package/dist/src/helpers/permission-set.d.ts +4 -2
  34. package/dist/src/helpers/rule.d.ts +2 -1
  35. package/dist/src/stores/permission-set.d.ts +12 -3
  36. package/dist/src/types/audit-log.d.ts +1 -1
  37. package/dist/src/views/audit-log/event-line.d.ts +13 -0
  38. package/dist/src/views/audit-log/locales/index.d.ts +296 -0
  39. package/dist/src/views/audit-log/snapshot-diff.d.ts +11 -0
  40. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +1 -0
  41. package/dist/src/views/team/components/BasePermission.vue.d.ts +13 -0
  42. package/dist/src/views/team/condition-builders/ConditionFormHost.vue.d.ts +22 -0
  43. package/dist/src/views/team/condition-builders/ConditionFormRenderer.vue.d.ts +23 -0
  44. package/dist/src/views/team/condition-builders/component-map.d.ts +4 -0
  45. package/dist/src/views/team/condition-builders/condition-form-dedupe.d.ts +23 -0
  46. package/dist/src/views/team/locales/index.d.ts +68 -0
  47. package/dist/style.css +1 -1
  48. package/dist/tsconfig.app.tsbuildinfo +1 -1
  49. package/dist/{useAppStore-BlQSL2ZO.js → useAppStore-CtMoad7V.js} +1 -1
  50. package/dist/useDebounce-B8ZPVS5C.js +15 -0
  51. package/dist/{useLoading-NkUvAr71.js → useLoading-CNqlchYO.js} +1 -1
  52. package/dist/{useReportPermissions-R-eg1L2r.js → useReportPermissions-C5wGC9bf.js} +3 -3
  53. package/package.json +2 -2
  54. package/dist/AuditLogList-BWwgm5wH.js +0 -1145
  55. package/dist/CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js +0 -58
  56. package/dist/EmployeeList-aRGYYmxf.js +0 -851
  57. package/dist/PermissionSetList-BfKgFFUh.js +0 -356
  58. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CNEAlTnY.js +0 -3457
  59. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +0 -38
  60. package/dist/RoleList-CtcVwAPE.js +0 -566
  61. package/dist/TeamMemberList-DU1jYeql.js +0 -1130
  62. package/dist/rule-O-E9JWJz.js +0 -995
  63. package/dist/useDebounce-CWb5QR9G.js +0 -28
@@ -1,38 +0,0 @@
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
- };
@@ -1,566 +0,0 @@
1
- import { computed as _, defineComponent as ge, ref as $, watch as se, onMounted as be, resolveComponent as y, createBlock as P, openBlock as p, unref as o, withCtx as b, createElementVNode as d, createVNode as n, createElementBlock as k, Fragment as N, createCommentVNode as de, renderList as le, toDisplayString as A, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Ie, nextTick as fe } from "vue";
2
- import { u as me, e as L } from "./iteration-DTV3udF0.js";
3
- import { useI18n as ye } from "@feedmepos/mf-common";
4
- import { useSnackbar as xe, components as ue, useDialog as Ee, useBreakpoints as Ue, FmButtonColorThemeVariant as Se } from "@feedmepos/ui-library";
5
- import { _ as Pe } from "./app-Df4eEEIU.js";
6
- import { u as $e, _ as he } from "./useDiscardConfirm-DPhEV6v0.js";
7
- import { _ as Te } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
8
- import { e as De, r as K, h as Ce, f as Me, g as _e, a as ae } from "./rule-O-E9JWJz.js";
9
- import { u as Fe } from "./useAppStore-BlQSL2ZO.js";
10
- import { u as Re } from "./useReportPermissions-R-eg1L2r.js";
11
- import { l as te } from "./lodash-LInzVEDS.js";
12
- import { _ as Be } from "./CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js";
13
- import { _ as ie } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
14
- import { u as Ne } from "./useLoading-NkUvAr71.js";
15
- function Ae() {
16
- const W = me();
17
- return _(() => {
18
- const s = {};
19
- return W.restaurants.value.forEach((C) => {
20
- s[C._id] = C;
21
- }), s;
22
- });
23
- }
24
- const Oe = { class: "flex w-full items-center justify-between" }, Je = { class: "fm-typo-en-title-md-600" }, qe = { class: "space-y-40" }, ze = {
25
- key: 0,
26
- class: "flex justify-center py-16"
27
- }, je = { class: "space-y-8" }, Ke = { class: "fm-typo-en-title-sm-600" }, We = { class: "mt-16 space-y-8" }, Ge = {
28
- key: 0,
29
- class: "ml-20 mt-8 flex max-w-[320px] flex-row items-start gap-8"
30
- }, He = { class: "mt-8 whitespace-nowrap" }, Qe = { class: "flex gap-8 items-center justify-start" }, Xe = /* @__PURE__ */ ge({
31
- __name: "RoleForm",
32
- props: {
33
- id: {
34
- type: String,
35
- default: void 0
36
- }
37
- },
38
- setup(W, { expose: G }) {
39
- const { t: s } = ye(), C = me(), T = $(""), I = _(() => C.restaurants.value.filter(({ profile: e }) => {
40
- const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
41
- return !T.value || a.toLowerCase().includes(T.value.toLowerCase());
42
- })), J = $(C.restaurants.value.length === 0);
43
- se(
44
- () => C.restaurants.value.length,
45
- (e) => {
46
- e > 0 && (J.value = !1);
47
- }
48
- );
49
- const D = Fe(), H = xe(), Q = Ne(H), { fetchReportPermissions: X, allReportPermissions: oe, availableReportKeys: M } = Re(), F = W, R = $(!1), re = () => {
50
- R.value = !R.value, R.value && Z();
51
- }, q = _(() => F.id ? s("hr.role.form.update") : s("hr.role.form.add")), Y = _(() => F.id ? s("common.update") : s("common.add")), O = _(() => {
52
- const e = De.filter(
53
- (u) => u.subject !== L.F_RULE_SUBJECT.enum.report
54
- ).map((u) => K(u)), a = oe.value.map((u) => K(u));
55
- return [...e, ...a];
56
- }), v = _(() => D.roles.value.find((e) => e._id == F.id)), E = () => ({
57
- name: "",
58
- restaurantIds: [],
59
- permissions: [],
60
- maxDiscountPercentage: 100
61
- }), l = $(E()), z = _(() => [
62
- {
63
- title: s("hr.role.labels.operation"),
64
- filter: (e) => e.isOrderOperation
65
- },
66
- {
67
- title: s("hr.role.labels.report"),
68
- filter: (e) => e.isReportPermission
69
- },
70
- {
71
- title: s("hr.role.labels.other"),
72
- filter: (e) => !e.isOrderOperation && !e.isReportPermission
73
- }
74
- ].map((e) => ({
75
- title: e.title,
76
- options: O.value.filter(e.filter).map(({ label: a, value: u }) => ({
77
- label: s(`hr.role.form.permissionLabels.${u}`, a),
78
- value: u
79
- }))
80
- }))), g = _(() => {
81
- var e;
82
- return Ce(((e = v.value) == null ? void 0 : e.permissions) || []);
83
- });
84
- function Z() {
85
- var e;
86
- l.value = E(), l.value.name = ((e = v.value) == null ? void 0 : e.name) ?? "", g.value ? (l.value.restaurantIds = I.value.map((a) => a._id), l.value.permissions = O.value.map((a) => a.value)) : v.value && (l.value.restaurantIds = v.value.restaurants.map((a) => a.id), l.value.permissions = v.value.permissions.map((a) => K(a).value).filter((a) => a.startsWith("report:") ? M.value.has(a.split(":")[1]) : !0), l.value.maxDiscountPercentage = _e(
87
- v.value.permissions
88
- ));
89
- }
90
- be(async () => {
91
- await C.readRestaurants(), await X(), Z();
92
- }), se(R, async (e) => {
93
- e && await X();
94
- }), se(M, () => {
95
- R.value && v.value && !g.value && (l.value.permissions = l.value.permissions.filter((e) => e.startsWith("report:") ? M.value.has(e.split(":")[1]) : !0));
96
- });
97
- const ne = $(""), t = _(() => ({
98
- restaurantIds: l.value.restaurantIds,
99
- role: {
100
- name: l.value.name,
101
- permissions: Me(l.value.permissions, l.value.maxDiscountPercentage)
102
- }
103
- })), r = async () => {
104
- const e = t.value;
105
- await Q.minor(
106
- async () => {
107
- v.value ? await D.updateRole(v.value._id, e) : await D.createRole(e);
108
- },
109
- {
110
- successMessage: v.value ? s("hr.role.update.successMessage", { name: e.role.name }) : s("hr.role.add.successMessage", { name: e.role.name })
111
- }
112
- ), R.value = !1;
113
- }, c = _(
114
- () => l.value.restaurantIds.filter((e) => I.value.some((a) => a._id === e))
115
- ), i = _(() => I.value.length > 0 && I.value.length === c.value.length), h = () => {
116
- const e = l.value.restaurantIds.filter((a) => !c.value.includes(a));
117
- i.value === !0 ? l.value.restaurantIds = e : l.value.restaurantIds = I.value.map((a) => a._id);
118
- }, x = (e) => e.map((u) => u.value).every((u) => l.value.permissions.includes(u)), f = (e) => {
119
- const a = l.value.permissions.filter(
120
- (u) => !e.map((B) => B.value).includes(u)
121
- );
122
- x(e) === !0 ? l.value.permissions = a : l.value.permissions = [...a, ...e.map((u) => u.value)];
123
- };
124
- se(
125
- () => l.value.restaurantIds,
126
- (e) => {
127
- e.length > 0 && (ne.value = "");
128
- }
129
- );
130
- const V = $e(
131
- () => {
132
- var e, a, u, B;
133
- return !te.isEqual(l.value.name, ((e = v.value) == null ? void 0 : e.name) || E().name) || !te.isEqual(
134
- l.value.restaurantIds,
135
- ((a = v.value) == null ? void 0 : a.restaurants.map((j) => j.id)) || E().restaurantIds
136
- ) || !te.isEqual(
137
- l.value.permissions,
138
- ((u = v.value) == null ? void 0 : u.permissions.map((j) => K(j).value)) || E().permissions
139
- ) || !te.isEqual(
140
- l.value.maxDiscountPercentage,
141
- v.value ? _e((B = v.value) == null ? void 0 : B.permissions) : E().maxDiscountPercentage
142
- );
143
- },
144
- () => {
145
- R.value = !1;
146
- }
147
- );
148
- return G({
149
- show: R,
150
- trigger: re
151
- }), (e, a) => {
152
- const u = y("FmIcon"), B = y("FmTextField"), j = y("FmCircularProgress"), we = y("FmSearch"), ee = y("FmCheckbox"), ke = y("FmFormGroup"), Ve = y("FmCard"), ce = y("fm-button"), Le = y("fm-side-sheet");
153
- return p(), P(Le, {
154
- id: "unit-form",
155
- "model-value": R.value,
156
- "is-container": o(ue).FmForm,
157
- "is-container-props": {
158
- onValidationSuccess: r,
159
- blameFormChildOnValidationFailed: !0
160
- },
161
- "max-width": 960,
162
- "close-button": !1,
163
- "onOn:clickedAway": o(V)
164
- }, {
165
- "side-sheet-header": b(() => [
166
- d("div", Oe, [
167
- d("p", Je, A(q.value), 1),
168
- n(u, {
169
- name: "close",
170
- size: "md",
171
- class: "cursor-pointer",
172
- onClick: o(V)
173
- }, null, 8, ["onClick"])
174
- ])
175
- ]),
176
- "side-sheet-footer": b(() => [
177
- d("div", Qe, [
178
- n(ce, {
179
- label: Y.value,
180
- size: "lg",
181
- type: "submit",
182
- variant: "primary",
183
- disabled: g.value
184
- }, null, 8, ["label", "disabled"]),
185
- n(ce, {
186
- label: o(s)("common.cancel"),
187
- size: "lg",
188
- variant: "tertiary",
189
- onClick: o(V)
190
- }, null, 8, ["label", "onClick"])
191
- ])
192
- ]),
193
- default: b(() => [
194
- d("div", qe, [
195
- n(ie, {
196
- title: o(s)("hr.role.form.roleDetail")
197
- }, {
198
- default: b(() => [
199
- n(B, {
200
- modelValue: l.value.name,
201
- "onUpdate:modelValue": a[0] || (a[0] = (m) => l.value.name = m),
202
- autofocus: "",
203
- rules: [(m) => !!m || o(s)("hr.role.form.required")],
204
- label: o(s)("hr.role.form.name"),
205
- disabled: g.value
206
- }, null, 8, ["modelValue", "rules", "label", "disabled"])
207
- ]),
208
- _: 1
209
- }, 8, ["title"]),
210
- n(ie, {
211
- title: o(s)("hr.role.form.restaurant")
212
- }, {
213
- default: b(() => [
214
- J.value ? (p(), k("div", ze, [
215
- n(j)
216
- ])) : (p(), k(N, { key: 1 }, [
217
- n(we, {
218
- modelValue: T.value,
219
- "onUpdate:modelValue": a[1] || (a[1] = (m) => T.value = m),
220
- placeholder: o(s)("hr.restaurant.search.placeholder")
221
- }, null, 8, ["modelValue", "placeholder"]),
222
- n(ke, {
223
- modelValue: l.value.restaurantIds,
224
- "onUpdate:modelValue": a[3] || (a[3] = (m) => l.value.restaurantIds = m),
225
- rules: [(m) => m.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
226
- }, {
227
- default: b(() => [
228
- d("div", je, [
229
- T.value ? de("", !0) : (p(), k(N, { key: 0 }, [
230
- n(ee, {
231
- "model-value": i.value,
232
- label: o(s)("hr.role.form.all"),
233
- value: "1",
234
- disabled: g.value,
235
- "onUpdate:modelValue": h
236
- }, null, 8, ["model-value", "label", "disabled"]),
237
- a[6] || (a[6] = d("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1))
238
- ], 64)),
239
- (p(!0), k(N, null, le(I.value, (m) => (p(), k("div", {
240
- key: m._id
241
- }, [
242
- n(ee, {
243
- modelValue: l.value.restaurantIds,
244
- "onUpdate:modelValue": a[2] || (a[2] = (U) => l.value.restaurantIds = U),
245
- label: `${m.profile.code ? m.profile.code + "-" : ""}${m.profile.name}`,
246
- value: m._id,
247
- disabled: g.value
248
- }, null, 8, ["modelValue", "label", "value", "disabled"])
249
- ]))), 128))
250
- ])
251
- ]),
252
- _: 1
253
- }, 8, ["modelValue", "rules"])
254
- ], 64))
255
- ]),
256
- _: 1
257
- }, 8, ["title"]),
258
- n(ie, {
259
- title: o(s)("hr.role.form.permissions")
260
- }, {
261
- default: b(() => [
262
- (p(!0), k(N, null, le(z.value, (m) => (p(), P(Ve, {
263
- key: m.title,
264
- variant: "outlined",
265
- class: "p-16"
266
- }, {
267
- default: b(() => [
268
- n(Be, null, {
269
- title: b(() => [
270
- d("p", Ke, A(m.title), 1)
271
- ]),
272
- default: b(() => [
273
- d("div", We, [
274
- n(ee, {
275
- "model-value": x(m.options),
276
- label: o(s)("hr.role.form.all"),
277
- value: "1",
278
- disabled: g.value,
279
- "onUpdate:modelValue": (U) => f(m.options)
280
- }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
281
- a[7] || (a[7] = d("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1)),
282
- (p(!0), k(N, null, le(m.options, (U) => (p(), k("div", {
283
- key: U.value
284
- }, [
285
- n(ee, {
286
- modelValue: l.value.permissions,
287
- "onUpdate:modelValue": a[4] || (a[4] = (w) => l.value.permissions = w),
288
- label: U.label,
289
- value: U.value,
290
- disabled: g.value
291
- }, null, 8, ["modelValue", "label", "value", "disabled"]),
292
- U.value === "order:discount" && l.value.permissions.includes(U.value) ? (p(), k("div", Ge, [
293
- d("div", He, A(o(s)("hr.role.form.maxDiscountPercentage")), 1),
294
- n(B, {
295
- modelValue: l.value.maxDiscountPercentage,
296
- "onUpdate:modelValue": a[5] || (a[5] = (w) => l.value.maxDiscountPercentage = w),
297
- rules: [
298
- (w) => !!w || o(s)("hr.role.form.required"),
299
- (w) => !isNaN(w) || o(s)("hr.role.form.onlyContainsNumber"),
300
- (w) => w <= 100 || o(s)("hr.role.form.maxValueIs", { max: 100 }),
301
- (w) => w >= 0 || o(s)("hr.role.form.minValueIs", { min: 0 })
302
- ],
303
- "append-text": "%",
304
- disabled: g.value
305
- }, null, 8, ["modelValue", "rules", "disabled"])
306
- ])) : de("", !0)
307
- ]))), 128))
308
- ])
309
- ]),
310
- _: 2
311
- }, 1024)
312
- ]),
313
- _: 2
314
- }, 1024))), 128))
315
- ]),
316
- _: 1
317
- }, 8, ["title"])
318
- ])
319
- ]),
320
- _: 1
321
- }, 8, ["model-value", "is-container", "is-container-props", "onOn:clickedAway"]);
322
- };
323
- }
324
- }), Ye = {
325
- class: "space-y-8"
326
- }, Ze = {
327
- class: "flex justify-end xs:px-16"
328
- }, es = {
329
- class: "pb-64 sm:hidden md:hidden lg:hidden"
330
- }, ss = {
331
- class: "space-y-4"
332
- }, as = {
333
- class: "fm-typo-en-body-lg-600"
334
- }, ts = {
335
- class: "text-fm-color-typo-secondary"
336
- }, ls = {
337
- class: "flex"
338
- }, os = {
339
- class: "flex"
340
- }, ys = /* @__PURE__ */ ge({
341
- __name: "RoleList",
342
- setup(W, {
343
- expose: G
344
- }) {
345
- const {
346
- t: s
347
- } = ye(), {
348
- allReportPermissions: C
349
- } = Re(), T = me(), I = _(() => T.restaurants.value), J = _(() => I.value.map((t) => t._id));
350
- function D(t, r) {
351
- const c = r === L.F_RULE_SUBJECT.enum.report ? C.value : void 0, i = ae(t, r, c);
352
- return ["-", "All"].includes(i) ? () => null : () => S(ue.FmTooltip, {
353
- "z-index": "999",
354
- placement: "top",
355
- class: "ml-2"
356
- }, {
357
- content: () => S("div", [s("hr.role.tooltip.labels.permission"), ...t.filter((h) => h.subject === r).map((h) => S("div", ["- ", K(h).label]))]),
358
- default: () => S(ue.FmIcon, {
359
- name: "info",
360
- color: Se.NeutralGray400
361
- })
362
- });
363
- }
364
- function H(t, r) {
365
- const c = r === L.F_RULE_SUBJECT.enum.report ? C.value : void 0, i = ae(t, r, c);
366
- return () => i === "All" ? i : S("div", {
367
- class: "flex items-center"
368
- }, [i, D(t, r)()]);
369
- }
370
- function Q(t) {
371
- return [{
372
- label: s("hr.role.form.update"),
373
- onClick: () => M(t)
374
- }, {
375
- label: s("hr.role.remove.title"),
376
- onClick: () => E(t),
377
- itemClass: "text-fm-color-typo-error",
378
- disabled: Ce(t.permissions)
379
- }];
380
- }
381
- const X = ({
382
- role: t,
383
- className: r = ""
384
- }) => n("div", {
385
- class: r,
386
- onClick: (c) => {
387
- c.stopPropagation();
388
- }
389
- }, [n(he, {
390
- items: Q(t)
391
- }, null)]), oe = [{
392
- accessorKey: "name",
393
- header: () => s("hr.role.columns.name"),
394
- enableSorting: !1
395
- }, {
396
- accessorKey: "operation",
397
- header: () => s("hr.role.columns.operation"),
398
- cell: (t) => S(H(t.row.original.permissions, L.F_RULE_SUBJECT.enum.order)),
399
- enableSorting: !1
400
- }, {
401
- accessorKey: "report",
402
- header: () => s("hr.role.columns.report"),
403
- cell: (t) => S(H(t.row.original.permissions, L.F_RULE_SUBJECT.enum.report)),
404
- enableSorting: !1
405
- }, {
406
- accessorKey: "restaurants",
407
- header: () => s("hr.role.columns.restaurants"),
408
- cell: (t) => t.row.original.restaurants.map((r, c) => {
409
- const i = r.code, h = `${i ? i + " - " : ""}${r.name}`;
410
- return S("div", (c ? `
411
- ` : "") + h);
412
- }),
413
- enableSorting: !1
414
- }, {
415
- id: "action",
416
- size: 52,
417
- meta: {
418
- cellClass: "pl-16",
419
- headerContentClass: "-mx-16"
420
- },
421
- cell: (t) => X({
422
- role: t.row.original,
423
- className: "flex w-full items-center justify-end"
424
- })
425
- }], M = async (t) => {
426
- var r;
427
- g.value = t._id, await fe(), (r = z.value) == null || r.trigger();
428
- }, F = Fe(), R = Ae(), re = _(() => {
429
- const t = F.roles.value || [];
430
- return (J.value.length === 0 ? t : t.filter((c) => c.restaurants.some((i) => J.value.includes(i.id)))).map((c) => {
431
- const i = c.restaurants.map((h) => {
432
- const x = R.value[h.id];
433
- return {
434
- ...h,
435
- // Prefer live data from restaurantMap so names populate reactively
436
- // even when restaurants loaded after roles.
437
- name: (x == null ? void 0 : x.profile.name) || h.name,
438
- code: x == null ? void 0 : x.profile.code
439
- };
440
- });
441
- return {
442
- ...c,
443
- restaurants: i
444
- };
445
- });
446
- }), q = _(() => {
447
- var r;
448
- return (r = re.value) == null ? void 0 : r.filter((c) => {
449
- const i = l.value.toLowerCase(), h = c.name.toLowerCase().includes(i), f = (c.restaurants || []).some((V) => {
450
- var e;
451
- return V.name.toLowerCase().includes(i) || ((e = V.code) == null ? void 0 : e.toLowerCase().includes(i));
452
- });
453
- return h || f;
454
- });
455
- }), Y = Ee(), O = xe(), {
456
- breakpoints: v
457
- } = Ue(), E = (t) => {
458
- Y.open({
459
- title: s("hr.role.remove.title"),
460
- message: s("hr.role.remove.message", {
461
- name: t.name
462
- }),
463
- minWidth: v.value.lg ? 588 : 0,
464
- primaryActions: {
465
- text: s("common.remove"),
466
- close: !1,
467
- variant: "destructive"
468
- },
469
- secondaryActions: {
470
- text: s("common.cancel"),
471
- close: !0
472
- }
473
- }).onPrimary(async () => {
474
- await F.deleteRole(t).then(() => O.open({
475
- message: s("hr.role.remove.successMessage", {
476
- name: t.name
477
- }),
478
- type: "success"
479
- })).catch((r) => O.open({
480
- message: r,
481
- type: "error"
482
- })), Y.close();
483
- });
484
- }, l = $(""), z = $(), g = $(void 0);
485
- async function Z() {
486
- var t;
487
- g.value = void 0, await fe(), (t = z.value) == null || t.trigger();
488
- }
489
- async function ne() {
490
- if (F.roles.value.length === 0)
491
- try {
492
- await F.readRoles();
493
- } catch (t) {
494
- console.error("Failed to load roles:", t), O.open({
495
- message: t instanceof Error ? t.message : String(t),
496
- type: "error"
497
- });
498
- }
499
- }
500
- return be(() => {
501
- ne();
502
- }), G({
503
- create: Z
504
- }), (t, r) => {
505
- const c = y("FmSearch"), i = y("FmTable"), h = y("FmListItem"), x = y("FmList");
506
- return p(), k(N, null, [(p(), P(Xe, {
507
- id: g.value,
508
- key: g.value,
509
- ref_key: "roleFormRef",
510
- ref: z
511
- }, null, 8, ["id"])), d("div", Ye, [d("div", Ze, [n(c, {
512
- modelValue: l.value,
513
- "onUpdate:modelValue": r[0] || (r[0] = (f) => l.value = f),
514
- class: "w-[320px] xs:w-full",
515
- autofocus: "",
516
- placeholder: o(s)("hr.role.search.placeholder") + " / " + o(s)("hr.restaurant.search.placeholder")
517
- }, null, 8, ["modelValue", "placeholder"])]), o(F).roles.value.length > 0 || o(F).isLoading.value ? (p(), P(Pe, {
518
- key: 0,
519
- class: "overflow-auto"
520
- }, {
521
- default: b(() => [n(i, {
522
- class: "xs:hidden",
523
- "column-defs": oe,
524
- "row-data": q.value,
525
- "page-size": q.value.length,
526
- loading: o(F).isLoading.value,
527
- "pin-header-row": "",
528
- "hide-footer": "",
529
- "shrink-at": !1,
530
- onRowClick: r[1] || (r[1] = (f) => M(f.original))
531
- }, null, 8, ["row-data", "page-size", "loading"]), d("div", es, [n(x, {
532
- separator: ""
533
- }, {
534
- default: b(() => [(p(!0), k(N, null, le(q.value, (f) => (p(), P(h, {
535
- key: f._id,
536
- class: "py-12 px-16 items-center justify-between",
537
- onClick: (V) => M(f)
538
- }, {
539
- default: b(() => [d("div", ss, [d("p", as, A(f.name), 1), d("div", ts, [d("p", null, A(o(s)("hr.role.labels.restaurantList", {
540
- items: f.restaurants.map((V) => V.name).join(", ")
541
- })), 1), d("p", ls, [pe(A(o(s)("hr.role.labels.operationList", {
542
- items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.order)
543
- })) + " ", 1), (p(), P(ve(D(f.permissions, o(L.F_RULE_SUBJECT).enum.order))))]), d("p", os, [pe(A(o(s)("hr.role.labels.reportList", {
544
- items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.report, o(C))
545
- })) + " ", 1), (p(), P(ve(D(f.permissions, o(L.F_RULE_SUBJECT).enum.report))))])])]), d("div", {
546
- onClick: r[2] || (r[2] = Ie(() => {
547
- }, ["stop"]))
548
- }, [n(he, {
549
- items: Q(f)
550
- }, null, 8, ["items"])])]),
551
- _: 2
552
- }, 1032, ["onClick"]))), 128))]),
553
- _: 1
554
- })])]),
555
- _: 1
556
- })) : (p(), P(o(Te), {
557
- key: 1,
558
- title: o(s)("hr.role.noData.title"),
559
- subtitle: o(s)("hr.role.noData.subtitle")
560
- }, null, 8, ["title", "subtitle"]))])], 64);
561
- };
562
- }
563
- });
564
- export {
565
- ys as default
566
- };