@feedmepos/mf-hrm-portal 2.0.17-dev.3 → 2.0.17-dev.5

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 (41) hide show
  1. package/dist/AuditLogList-Dl3Nmf00.js +1011 -0
  2. package/dist/EmployeeList-DBd_rVW2.js +831 -0
  3. package/dist/{Main-Dkr5lzbv.js → Main-CQ3KwxDY.js} +1368 -1371
  4. package/dist/{Main--tejoyEP.js → Main-pTgqNncY.js} +125 -125
  5. package/dist/{Main-BNXKItvX.js → Main-w0XUUaBp.js} +6 -6
  6. package/dist/PermissionSetList-B8qNOWH6.js +347 -0
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BBsaxaXu.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-C9VUjAu_.js} +1064 -1060
  8. package/dist/{RoleList-SZCgvYvC.js → RoleList-DMFJsUZv.js} +202 -200
  9. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
  10. package/dist/TeamMemberList-BLRTfKLz.js +1031 -0
  11. package/dist/{TimesheetList-D-3k0Uad.js → TimesheetList-Bwp9_xHe.js} +6 -6
  12. package/dist/{app-BjXuSCis.js → app-COJbSNM4.js} +1975 -1440
  13. package/dist/app.js +1 -1
  14. package/dist/{dayjs.min-z-vrgFCL.js → dayjs.min-CcBi6N-K.js} +1 -1
  15. package/dist/{employee-DAqAMupR.js → employee-xiV0LfnL.js} +3 -3
  16. package/dist/{iteration-Cp1eSTJA.js → iteration-JOKbtlLf.js} +1 -1
  17. package/dist/{lodash-CXLZQQp8.js → lodash-D5xlVzib.js} +1 -1
  18. package/dist/rule-3sXHiW0y.js +994 -0
  19. package/dist/src/api/audit-log/index.d.ts +9 -0
  20. package/dist/src/api/report-query/index.d.ts +2 -2
  21. package/dist/src/components/Skeleton.vue.d.ts +7 -0
  22. package/dist/src/composables/useBasePermission.d.ts +1 -0
  23. package/dist/src/stores/team.d.ts +6 -6
  24. package/dist/src/types/team.d.ts +1 -1
  25. package/dist/src/views/hr/locales/index.d.ts +172 -0
  26. package/dist/src/views/team/components/BasePermission.vue.d.ts +1 -1
  27. package/dist/src/views/team/locales/index.d.ts +312 -0
  28. package/dist/style.css +1 -1
  29. package/dist/{team-CnQ_rIx2.js → team-CyNektSD.js} +1 -1
  30. package/dist/{timesheet-BlPhOifI.js → timesheet-DkD3AysG.js} +2 -2
  31. package/dist/tsconfig.app.tsbuildinfo +1 -1
  32. package/dist/{useAppStore-BVnrWyPF.js → useAppStore-CvmsaYSG.js} +1 -1
  33. package/dist/{useLoading-7ia-Bps7.js → useLoading-4TNmhm5N.js} +1 -1
  34. package/dist/useReportPermissions-CWMFFb8E.js +70 -0
  35. package/package.json +2 -2
  36. package/dist/AuditLogList-C6qAeY5g.js +0 -954
  37. package/dist/EmployeeList-COtXtTqG.js +0 -827
  38. package/dist/PermissionSetList-B_Sdvbu7.js +0 -340
  39. package/dist/TeamMemberList-Dk5HeFfQ.js +0 -1008
  40. package/dist/rule-vBxopbM_.js +0 -990
  41. package/dist/useReportPermissions-C8HMek35.js +0 -60
@@ -1,27 +1,27 @@
1
- import { computed as _, defineComponent as ge, ref as P, watch as ne, onMounted as be, resolveComponent as C, createBlock as L, openBlock as d, unref as o, withCtx as b, createElementVNode as f, createVNode as c, createElementBlock as V, Fragment as N, createCommentVNode as de, renderList as ae, toDisplayString as D, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Le, nextTick as fe } from "vue";
2
- import { e as k } from "./iteration-Cp1eSTJA.js";
1
+ import { computed as _, defineComponent as ge, ref as P, watch as se, onMounted as be, resolveComponent as C, createBlock as L, openBlock as d, unref as o, withCtx as y, createElementVNode as f, createVNode as c, createElementBlock as V, Fragment as A, createCommentVNode as de, renderList as te, toDisplayString as D, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Le, nextTick as fe } from "vue";
2
+ import { e as k } from "./iteration-JOKbtlLf.js";
3
3
  import { useCoreStore as me, useI18n as ye } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as xe, components as ue, useDialog as Ue, useBreakpoints as Ee, FmButtonColorThemeVariant as Ie } from "@feedmepos/ui-library";
5
- import { _ as Se } from "./app-BjXuSCis.js";
5
+ import { _ as Se } from "./app-COJbSNM4.js";
6
6
  import { u as Pe, _ as he } from "./useDiscardConfirm-DPhEV6v0.js";
7
7
  import { _ as $e } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
8
- import { e as Te, r as W, h as Ce, f as Me, g as _e, a as ee } from "./rule-vBxopbM_.js";
9
- import { u as Re } from "./useAppStore-BVnrWyPF.js";
10
- import { u as Fe } from "./useReportPermissions-C8HMek35.js";
11
- import { l as se } from "./lodash-CXLZQQp8.js";
8
+ import { e as Te, r as W, h as Ce, f as Me, g as _e, a as ae } from "./rule-3sXHiW0y.js";
9
+ import { u as Re } from "./useAppStore-CvmsaYSG.js";
10
+ import { u as Fe } from "./useReportPermissions-CWMFFb8E.js";
11
+ import { l as le } from "./lodash-D5xlVzib.js";
12
12
  import { _ as Be } from "./CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js";
13
13
  import { _ as ie } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
14
- import { u as De } from "./useLoading-7ia-Bps7.js";
15
- function Ae() {
14
+ import { u as De } from "./useLoading-4TNmhm5N.js";
15
+ function Ne() {
16
16
  const j = me();
17
17
  return _(() => {
18
- const a = {};
18
+ const s = {};
19
19
  return j.restaurants.value.forEach((w) => {
20
- a[w._id] = w;
21
- }), a;
20
+ s[w._id] = w;
21
+ }), s;
22
22
  });
23
23
  }
24
- const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, Je = {
24
+ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, Je = {
25
25
  key: 0,
26
26
  class: "flex justify-center py-16"
27
27
  }, qe = { class: "space-y-8" }, ze = { class: "fm-typo-en-title-sm-600" }, Ke = { class: "mt-16 space-y-8" }, We = {
@@ -36,122 +36,124 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
36
36
  }
37
37
  },
38
38
  setup(j, { expose: G }) {
39
- const { t: a } = ye(), w = me(), $ = P(""), U = _(() => w.restaurants.value.filter(({ profile: e }) => {
40
- const s = `${e.code ? e.code + "-" : ""}${e.legalName}`;
41
- return !$.value || s.toLowerCase().includes($.value.toLowerCase());
39
+ const { t: s } = ye(), w = me(), $ = P(""), U = _(() => w.restaurants.value.filter(({ profile: e }) => {
40
+ const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
41
+ return !$.value || a.toLowerCase().includes($.value.toLowerCase());
42
42
  })), O = P(w.restaurants.value.length === 0);
43
- ne(
43
+ se(
44
44
  () => w.restaurants.value.length,
45
45
  (e) => {
46
46
  e > 0 && (O.value = !1);
47
47
  }
48
48
  );
49
- const T = Re(), H = xe(), Q = De(H), { fetchReportPermissions: te, allReportPermissions: le, availableReportKeys: M } = Fe(), R = j, y = P(!1), oe = () => {
50
- y.value = !y.value, y.value && Y();
51
- }, J = _(() => R.id ? a("hr.role.form.update") : a("hr.role.form.add")), X = _(() => R.id ? a("common.update") : a("common.add")), q = _(() => {
49
+ const T = Re(), H = xe(), Q = De(H), { fetchReportPermissions: X, allReportPermissions: oe, availableReportKeys: M } = Fe(), R = j, b = P(!1), re = () => {
50
+ b.value = !b.value, b.value && Z();
51
+ }, J = _(() => R.id ? s("hr.role.form.update") : s("hr.role.form.add")), Y = _(() => R.id ? s("common.update") : s("common.add")), q = _(() => {
52
52
  const e = Te.filter(
53
- (u) => u.subject !== k.F_RULE_SUBJECT.enum.report
54
- ).map((u) => W(u)), s = le.value.map((u) => W(u));
55
- return [...e, ...s];
53
+ (i) => i.subject !== k.F_RULE_SUBJECT.enum.report
54
+ ).map((i) => W(i)), a = oe.value.map((i) => W(i));
55
+ return [...e, ...a];
56
56
  }), p = _(() => T.roles.value.find((e) => e._id == R.id)), E = () => ({
57
57
  name: "",
58
58
  restaurantIds: [],
59
59
  permissions: [],
60
60
  maxDiscountPercentage: 100
61
- }), t = P(E()), z = _(() => [
61
+ }), l = P(E()), z = _(() => [
62
62
  {
63
- title: a("hr.role.labels.operation"),
63
+ title: s("hr.role.labels.operation"),
64
64
  filter: (e) => e.isOrderOperation
65
65
  },
66
66
  {
67
- title: a("hr.role.labels.report"),
67
+ title: s("hr.role.labels.report"),
68
68
  filter: (e) => e.isReportPermission
69
69
  },
70
70
  {
71
- title: a("hr.role.labels.other"),
71
+ title: s("hr.role.labels.other"),
72
72
  filter: (e) => !e.isOrderOperation && !e.isReportPermission
73
73
  }
74
74
  ].map((e) => ({
75
75
  title: e.title,
76
- options: q.value.filter(e.filter).map(({ label: s, value: u }) => ({
77
- label: s,
78
- value: u
76
+ options: q.value.filter(e.filter).map(({ label: a, value: i }) => ({
77
+ label: s(`hr.role.form.permissionLabels.${i}`, a),
78
+ value: i
79
79
  }))
80
80
  }))), g = _(() => {
81
81
  var e;
82
82
  return Ce(((e = p.value) == null ? void 0 : e.permissions) || []);
83
83
  });
84
- function Y() {
84
+ function Z() {
85
85
  var e;
86
- t.value = E(), t.value.name = ((e = p.value) == null ? void 0 : e.name) ?? "", g.value ? (t.value.restaurantIds = U.value.map((s) => s._id), t.value.permissions = q.value.map((s) => s.value)) : p.value && (t.value.restaurantIds = p.value.restaurants.map((s) => s.id), t.value.permissions = p.value.permissions.map((s) => W(s).value).filter((s) => s.startsWith("report:") ? M.value.has(s.split(":")[1]) : !0), t.value.maxDiscountPercentage = _e(
86
+ l.value = E(), l.value.name = ((e = p.value) == null ? void 0 : e.name) ?? "", g.value ? (l.value.restaurantIds = U.value.map((a) => a._id), l.value.permissions = q.value.map((a) => a.value)) : p.value && (l.value.restaurantIds = p.value.restaurants.map((a) => a.id), l.value.permissions = p.value.permissions.map((a) => W(a).value).filter((a) => a.startsWith("report:") ? M.value.has(a.split(":")[1]) : !0), l.value.maxDiscountPercentage = _e(
87
87
  p.value.permissions
88
88
  ));
89
89
  }
90
90
  be(async () => {
91
- await te(), Y();
92
- }), ne(M, () => {
93
- y.value && p.value && !g.value && (t.value.permissions = t.value.permissions.filter((e) => e.startsWith("report:") ? M.value.has(e.split(":")[1]) : !0));
91
+ await X(), Z();
92
+ }), se(b, async (e) => {
93
+ e && await X();
94
+ }), se(M, () => {
95
+ b.value && p.value && !g.value && (l.value.permissions = l.value.permissions.filter((e) => e.startsWith("report:") ? M.value.has(e.split(":")[1]) : !0));
94
96
  });
95
- const re = P(""), l = _(() => ({
96
- restaurantIds: t.value.restaurantIds,
97
+ const ne = P(""), t = _(() => ({
98
+ restaurantIds: l.value.restaurantIds,
97
99
  role: {
98
- name: t.value.name,
99
- permissions: Me(t.value.permissions, t.value.maxDiscountPercentage)
100
+ name: l.value.name,
101
+ permissions: Me(l.value.permissions, l.value.maxDiscountPercentage)
100
102
  }
101
103
  })), r = async () => {
102
- const e = l.value;
104
+ const e = t.value;
103
105
  await Q.minor(
104
106
  async () => {
105
107
  p.value ? await T.updateRole(p.value._id, e) : await T.createRole(e);
106
108
  },
107
109
  {
108
- successMessage: p.value ? a("hr.role.update.successMessage", { name: e.role.name }) : a("hr.role.add.successMessage", { name: e.role.name })
110
+ successMessage: p.value ? s("hr.role.update.successMessage", { name: e.role.name }) : s("hr.role.add.successMessage", { name: e.role.name })
109
111
  }
110
- ), y.value = !1;
112
+ ), b.value = !1;
111
113
  }, m = _(
112
- () => t.value.restaurantIds.filter((e) => U.value.some((s) => s._id === e))
113
- ), i = _(() => U.value.length > 0 && U.value.length === m.value.length), h = () => {
114
- const e = t.value.restaurantIds.filter((s) => !m.value.includes(s));
115
- i.value === !0 ? t.value.restaurantIds = e : t.value.restaurantIds = U.value.map((s) => s._id);
116
- }, x = (e) => e.map((u) => u.value).every((u) => t.value.permissions.includes(u)), v = (e) => {
117
- const s = t.value.permissions.filter(
118
- (u) => !e.map((A) => A.value).includes(u)
114
+ () => l.value.restaurantIds.filter((e) => U.value.some((a) => a._id === e))
115
+ ), u = _(() => U.value.length > 0 && U.value.length === m.value.length), h = () => {
116
+ const e = l.value.restaurantIds.filter((a) => !m.value.includes(a));
117
+ u.value === !0 ? l.value.restaurantIds = e : l.value.restaurantIds = U.value.map((a) => a._id);
118
+ }, x = (e) => e.map((i) => i.value).every((i) => l.value.permissions.includes(i)), v = (e) => {
119
+ const a = l.value.permissions.filter(
120
+ (i) => !e.map((N) => N.value).includes(i)
119
121
  );
120
- x(e) === !0 ? t.value.permissions = s : t.value.permissions = [...s, ...e.map((u) => u.value)];
122
+ x(e) === !0 ? l.value.permissions = a : l.value.permissions = [...a, ...e.map((i) => i.value)];
121
123
  };
122
- ne(
123
- () => t.value.restaurantIds,
124
+ se(
125
+ () => l.value.restaurantIds,
124
126
  (e) => {
125
- e.length > 0 && (re.value = "");
127
+ e.length > 0 && (ne.value = "");
126
128
  }
127
129
  );
128
130
  const B = Pe(
129
131
  () => {
130
- var e, s, u, A;
131
- return !se.isEqual(t.value.name, ((e = p.value) == null ? void 0 : e.name) || E().name) || !se.isEqual(
132
- t.value.restaurantIds,
133
- ((s = p.value) == null ? void 0 : s.restaurants.map((K) => K.id)) || E().restaurantIds
134
- ) || !se.isEqual(
135
- t.value.permissions,
136
- ((u = p.value) == null ? void 0 : u.permissions.map((K) => W(K).value)) || E().permissions
137
- ) || !se.isEqual(
138
- t.value.maxDiscountPercentage,
139
- p.value ? _e((A = p.value) == null ? void 0 : A.permissions) : E().maxDiscountPercentage
132
+ var e, a, i, N;
133
+ return !le.isEqual(l.value.name, ((e = p.value) == null ? void 0 : e.name) || E().name) || !le.isEqual(
134
+ l.value.restaurantIds,
135
+ ((a = p.value) == null ? void 0 : a.restaurants.map((K) => K.id)) || E().restaurantIds
136
+ ) || !le.isEqual(
137
+ l.value.permissions,
138
+ ((i = p.value) == null ? void 0 : i.permissions.map((K) => W(K).value)) || E().permissions
139
+ ) || !le.isEqual(
140
+ l.value.maxDiscountPercentage,
141
+ p.value ? _e((N = p.value) == null ? void 0 : N.permissions) : E().maxDiscountPercentage
140
142
  );
141
143
  },
142
144
  () => {
143
- y.value = !1;
145
+ b.value = !1;
144
146
  }
145
147
  );
146
148
  return G({
147
- show: y,
148
- trigger: oe
149
- }), (e, s) => {
150
- const u = C("FmTextField"), A = C("FmCircularProgress"), K = C("FmSearch"), Z = C("FmCheckbox"), we = C("FmFormGroup"), Ve = C("FmCard"), ce = C("fm-button"), ke = C("fm-side-sheet");
149
+ show: b,
150
+ trigger: re
151
+ }), (e, a) => {
152
+ const i = C("FmTextField"), N = C("FmCircularProgress"), K = C("FmSearch"), ee = C("FmCheckbox"), we = C("FmFormGroup"), Ve = C("FmCard"), ce = C("fm-button"), ke = C("fm-side-sheet");
151
153
  return d(), L(ke, {
152
154
  id: "unit-form",
153
- modelValue: y.value,
154
- "onUpdate:modelValue": s[7] || (s[7] = (n) => y.value = n),
155
+ modelValue: b.value,
156
+ "onUpdate:modelValue": a[7] || (a[7] = (n) => b.value = n),
155
157
  "is-container": o(ue).FmForm,
156
158
  "is-container-props": {
157
159
  onValidationSuccess: r,
@@ -160,74 +162,74 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
160
162
  "max-width": 960,
161
163
  "onOn:clickedAway": o(B)
162
164
  }, {
163
- "side-sheet-header": b(() => [
164
- f("p", Ne, D(J.value), 1)
165
+ "side-sheet-header": y(() => [
166
+ f("p", Ae, D(J.value), 1)
165
167
  ]),
166
- "side-sheet-footer": b(() => [
168
+ "side-sheet-footer": y(() => [
167
169
  f("div", Ge, [
168
170
  c(ce, {
169
- label: X.value,
171
+ label: Y.value,
170
172
  size: "lg",
171
173
  type: "submit",
172
174
  variant: "primary",
173
175
  disabled: g.value
174
176
  }, null, 8, ["label", "disabled"]),
175
177
  c(ce, {
176
- label: o(a)("common.cancel"),
178
+ label: o(s)("common.cancel"),
177
179
  size: "lg",
178
180
  variant: "tertiary",
179
- onClick: s[6] || (s[6] = () => y.value = !1)
181
+ onClick: a[6] || (a[6] = () => b.value = !1)
180
182
  }, null, 8, ["label"])
181
183
  ])
182
184
  ]),
183
- default: b(() => [
185
+ default: y(() => [
184
186
  f("div", Oe, [
185
187
  c(ie, { title: "Role detail" }, {
186
- default: b(() => [
187
- c(u, {
188
- modelValue: t.value.name,
189
- "onUpdate:modelValue": s[0] || (s[0] = (n) => t.value.name = n),
188
+ default: y(() => [
189
+ c(i, {
190
+ modelValue: l.value.name,
191
+ "onUpdate:modelValue": a[0] || (a[0] = (n) => l.value.name = n),
190
192
  autofocus: "",
191
- rules: [(n) => !!n || o(a)("hr.role.form.required")],
192
- label: o(a)("hr.role.form.name"),
193
+ rules: [(n) => !!n || o(s)("hr.role.form.required")],
194
+ label: o(s)("hr.role.form.name"),
193
195
  disabled: g.value
194
196
  }, null, 8, ["modelValue", "rules", "label", "disabled"])
195
197
  ]),
196
198
  _: 1
197
199
  }),
198
200
  c(ie, {
199
- title: o(a)("hr.role.form.restaurant")
201
+ title: o(s)("hr.role.form.restaurant")
200
202
  }, {
201
- default: b(() => [
203
+ default: y(() => [
202
204
  O.value ? (d(), V("div", Je, [
203
- c(A)
204
- ])) : (d(), V(N, { key: 1 }, [
205
+ c(N)
206
+ ])) : (d(), V(A, { key: 1 }, [
205
207
  c(K, {
206
208
  modelValue: $.value,
207
- "onUpdate:modelValue": s[1] || (s[1] = (n) => $.value = n),
208
- placeholder: o(a)("hr.restaurant.search.placeholder")
209
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => $.value = n),
210
+ placeholder: o(s)("hr.restaurant.search.placeholder")
209
211
  }, null, 8, ["modelValue", "placeholder"]),
210
212
  c(we, {
211
- modelValue: t.value.restaurantIds,
212
- "onUpdate:modelValue": s[3] || (s[3] = (n) => t.value.restaurantIds = n),
213
- rules: [(n) => n.length > 0 || o(a)("hr.role.form.atLeastOneRestaurant")]
213
+ modelValue: l.value.restaurantIds,
214
+ "onUpdate:modelValue": a[3] || (a[3] = (n) => l.value.restaurantIds = n),
215
+ rules: [(n) => n.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
214
216
  }, {
215
- default: b(() => [
217
+ default: y(() => [
216
218
  f("div", qe, [
217
- $.value ? de("", !0) : (d(), L(Z, {
219
+ $.value ? de("", !0) : (d(), L(ee, {
218
220
  key: 0,
219
- "model-value": i.value,
220
- label: "All",
221
+ "model-value": u.value,
222
+ label: o(s)("hr.role.form.all"),
221
223
  value: "1",
222
224
  disabled: g.value,
223
225
  "onUpdate:modelValue": h
224
- }, null, 8, ["model-value", "disabled"])),
225
- (d(!0), V(N, null, ae(U.value, (n) => (d(), V("div", {
226
+ }, null, 8, ["model-value", "label", "disabled"])),
227
+ (d(!0), V(A, null, te(U.value, (n) => (d(), V("div", {
226
228
  key: n._id
227
229
  }, [
228
- c(Z, {
229
- modelValue: t.value.restaurantIds,
230
- "onUpdate:modelValue": s[2] || (s[2] = (I) => t.value.restaurantIds = I),
230
+ c(ee, {
231
+ modelValue: l.value.restaurantIds,
232
+ "onUpdate:modelValue": a[2] || (a[2] = (I) => l.value.restaurantIds = I),
231
233
  label: `${n.profile.code ? n.profile.code + "-" : ""}${n.profile.name}`,
232
234
  value: n._id,
233
235
  disabled: g.value
@@ -242,48 +244,48 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
242
244
  _: 1
243
245
  }, 8, ["title"]),
244
246
  c(ie, {
245
- title: o(a)("hr.role.form.permissions")
247
+ title: o(s)("hr.role.form.permissions")
246
248
  }, {
247
- default: b(() => [
248
- (d(!0), V(N, null, ae(z.value, (n) => (d(), L(Ve, {
249
+ default: y(() => [
250
+ (d(!0), V(A, null, te(z.value, (n) => (d(), L(Ve, {
249
251
  key: n.title,
250
252
  variant: "outlined",
251
253
  class: "p-16"
252
254
  }, {
253
- default: b(() => [
255
+ default: y(() => [
254
256
  c(Be, null, {
255
- title: b(() => [
257
+ title: y(() => [
256
258
  f("p", ze, D(n.title), 1)
257
259
  ]),
258
- default: b(() => [
260
+ default: y(() => [
259
261
  f("div", Ke, [
260
- c(Z, {
262
+ c(ee, {
261
263
  "model-value": x(n.options),
262
- label: "All",
264
+ label: o(s)("hr.role.form.all"),
263
265
  value: "1",
264
266
  disabled: g.value,
265
267
  "onUpdate:modelValue": (I) => v(n.options)
266
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
267
- (d(!0), V(N, null, ae(n.options, (I) => (d(), V("div", {
268
+ }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
269
+ (d(!0), V(A, null, te(n.options, (I) => (d(), V("div", {
268
270
  key: I.value
269
271
  }, [
270
- c(Z, {
271
- modelValue: t.value.permissions,
272
- "onUpdate:modelValue": s[4] || (s[4] = (F) => t.value.permissions = F),
272
+ c(ee, {
273
+ modelValue: l.value.permissions,
274
+ "onUpdate:modelValue": a[4] || (a[4] = (F) => l.value.permissions = F),
273
275
  label: I.label,
274
276
  value: I.value,
275
277
  disabled: g.value
276
278
  }, null, 8, ["modelValue", "label", "value", "disabled"]),
277
- I.value === "order:discount" && t.value.permissions.includes(I.value) ? (d(), V("div", We, [
278
- f("div", je, D(o(a)("hr.role.form.maxDiscountPercentage")), 1),
279
- c(u, {
280
- modelValue: t.value.maxDiscountPercentage,
281
- "onUpdate:modelValue": s[5] || (s[5] = (F) => t.value.maxDiscountPercentage = F),
279
+ I.value === "order:discount" && l.value.permissions.includes(I.value) ? (d(), V("div", We, [
280
+ f("div", je, D(o(s)("hr.role.form.maxDiscountPercentage")), 1),
281
+ c(i, {
282
+ modelValue: l.value.maxDiscountPercentage,
283
+ "onUpdate:modelValue": a[5] || (a[5] = (F) => l.value.maxDiscountPercentage = F),
282
284
  rules: [
283
- (F) => !!F || o(a)("hr.role.form.required"),
284
- (F) => !isNaN(F) || o(a)("hr.role.form.onlyContainsNumber"),
285
- (F) => F <= 100 || o(a)("hr.role.form.maxValueIs", { max: 100 }),
286
- (F) => F >= 0 || o(a)("hr.role.form.minValueIs", { min: 0 })
285
+ (F) => !!F || o(s)("hr.role.form.required"),
286
+ (F) => !isNaN(F) || o(s)("hr.role.form.onlyContainsNumber"),
287
+ (F) => F <= 100 || o(s)("hr.role.form.maxValueIs", { max: 100 }),
288
+ (F) => F >= 0 || o(s)("hr.role.form.minValueIs", { min: 0 })
287
289
  ],
288
290
  "append-text": "%",
289
291
  disabled: g.value
@@ -320,7 +322,7 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
320
322
  class: "text-fm-color-typo-secondary"
321
323
  }, as = {
322
324
  class: "flex"
323
- }, ts = {
325
+ }, ls = {
324
326
  class: "flex"
325
327
  }, gs = /* @__PURE__ */ ge({
326
328
  __name: "RoleList",
@@ -328,43 +330,43 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
328
330
  expose: G
329
331
  }) {
330
332
  const {
331
- t: a
333
+ t: s
332
334
  } = ye(), {
333
335
  allReportPermissions: w
334
- } = Fe(), $ = me(), U = _(() => $.restaurants.value), O = _(() => U.value.map((l) => l._id));
335
- function T(l, r) {
336
- const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0, i = ee(l, r, m);
337
- return ["-", "All"].includes(i) ? () => null : () => S(ue.FmTooltip, {
336
+ } = Fe(), $ = me(), U = _(() => $.restaurants.value), O = _(() => U.value.map((t) => t._id));
337
+ function T(t, r) {
338
+ const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0, u = ae(t, r, m);
339
+ return ["-", "All"].includes(u) ? () => null : () => S(ue.FmTooltip, {
338
340
  "z-index": "999",
339
341
  placement: "top",
340
342
  class: "ml-2"
341
343
  }, {
342
- content: () => S("div", [a("hr.role.tooltip.labels.permission"), ...l.filter((h) => h.subject === r).map((h) => S("div", ["- ", W(h).label]))]),
344
+ content: () => S("div", [s("hr.role.tooltip.labels.permission"), ...t.filter((h) => h.subject === r).map((h) => S("div", ["- ", W(h).label]))]),
343
345
  default: () => S(ue.FmIcon, {
344
346
  name: "info",
345
347
  color: Ie.NeutralGray400
346
348
  })
347
349
  });
348
350
  }
349
- function H(l, r) {
350
- const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0, i = ee(l, r, m);
351
- return () => i === "All" ? i : S("div", {
351
+ function H(t, r) {
352
+ const m = r === k.F_RULE_SUBJECT.enum.report ? w.value : void 0, u = ae(t, r, m);
353
+ return () => u === "All" ? u : S("div", {
352
354
  class: "flex items-center"
353
- }, [i, T(l, r)()]);
355
+ }, [u, T(t, r)()]);
354
356
  }
355
- function Q(l) {
357
+ function Q(t) {
356
358
  return [{
357
- label: a("hr.role.form.update"),
358
- onClick: () => M(l)
359
+ label: s("hr.role.form.update"),
360
+ onClick: () => M(t)
359
361
  }, {
360
- label: a("hr.role.remove.title"),
361
- onClick: () => E(l),
362
+ label: s("hr.role.remove.title"),
363
+ onClick: () => E(t),
362
364
  itemClass: "text-fm-color-typo-error",
363
- disabled: Ce(l.permissions)
365
+ disabled: Ce(t.permissions)
364
366
  }];
365
367
  }
366
- const te = ({
367
- role: l,
368
+ const X = ({
369
+ role: t,
368
370
  className: r = ""
369
371
  }) => c("div", {
370
372
  class: r,
@@ -372,26 +374,26 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
372
374
  m.stopPropagation();
373
375
  }
374
376
  }, [c(he, {
375
- items: Q(l)
376
- }, null)]), le = [{
377
+ items: Q(t)
378
+ }, null)]), oe = [{
377
379
  accessorKey: "name",
378
- header: () => a("hr.role.columns.name"),
380
+ header: () => s("hr.role.columns.name"),
379
381
  enableSorting: !1
380
382
  }, {
381
383
  accessorKey: "operation",
382
- header: () => a("hr.role.columns.operation"),
383
- cell: (l) => S(H(l.row.original.permissions, k.F_RULE_SUBJECT.enum.order)),
384
+ header: () => s("hr.role.columns.operation"),
385
+ cell: (t) => S(H(t.row.original.permissions, k.F_RULE_SUBJECT.enum.order)),
384
386
  enableSorting: !1
385
387
  }, {
386
388
  accessorKey: "report",
387
- header: () => a("hr.role.columns.report"),
388
- cell: (l) => S(H(l.row.original.permissions, k.F_RULE_SUBJECT.enum.report)),
389
+ header: () => s("hr.role.columns.report"),
390
+ cell: (t) => S(H(t.row.original.permissions, k.F_RULE_SUBJECT.enum.report)),
389
391
  enableSorting: !1
390
392
  }, {
391
393
  accessorKey: "restaurants",
392
- header: () => a("hr.role.columns.restaurants"),
393
- cell: (l) => l.row.original.restaurants.map((r, m) => {
394
- const i = r.code, h = `${i ? i + " - " : ""}${r.name}`;
394
+ header: () => s("hr.role.columns.restaurants"),
395
+ cell: (t) => t.row.original.restaurants.map((r, m) => {
396
+ const u = r.code, h = `${u ? u + " - " : ""}${r.name}`;
395
397
  return S("div", (m ? `
396
398
  ` : "") + h);
397
399
  }),
@@ -403,18 +405,18 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
403
405
  cellClass: "pl-16",
404
406
  headerContentClass: "-mx-16"
405
407
  },
406
- cell: (l) => te({
407
- role: l.row.original,
408
+ cell: (t) => X({
409
+ role: t.row.original,
408
410
  className: "flex w-full items-center justify-end"
409
411
  })
410
- }], M = async (l) => {
412
+ }], M = async (t) => {
411
413
  var r;
412
- g.value = l._id, await fe(), (r = z.value) == null || r.trigger();
413
- }, R = Re(), y = Ae(), oe = _(() => {
414
- const l = R.roles.value || [];
415
- return (O.value.length === 0 ? l : l.filter((m) => m.restaurants.some((i) => O.value.includes(i.id)))).map((m) => {
416
- const i = m.restaurants.map((h) => {
417
- const x = y.value[h.id];
414
+ g.value = t._id, await fe(), (r = z.value) == null || r.trigger();
415
+ }, R = Re(), b = Ne(), re = _(() => {
416
+ const t = R.roles.value || [];
417
+ return (O.value.length === 0 ? t : t.filter((m) => m.restaurants.some((u) => O.value.includes(u.id)))).map((m) => {
418
+ const u = m.restaurants.map((h) => {
419
+ const x = b.value[h.id];
418
420
  return {
419
421
  ...h,
420
422
  // Prefer live data from restaurantMap so names populate reactively
@@ -425,79 +427,79 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
425
427
  });
426
428
  return {
427
429
  ...m,
428
- restaurants: i
430
+ restaurants: u
429
431
  };
430
432
  });
431
433
  }), J = _(() => {
432
434
  var r;
433
- return (r = oe.value) == null ? void 0 : r.filter((m) => {
434
- const i = t.value.toLowerCase(), h = m.name.toLowerCase().includes(i), v = (m.restaurants || []).some((B) => {
435
+ return (r = re.value) == null ? void 0 : r.filter((m) => {
436
+ const u = l.value.toLowerCase(), h = m.name.toLowerCase().includes(u), v = (m.restaurants || []).some((B) => {
435
437
  var e;
436
- return B.name.toLowerCase().includes(i) || ((e = B.code) == null ? void 0 : e.toLowerCase().includes(i));
438
+ return B.name.toLowerCase().includes(u) || ((e = B.code) == null ? void 0 : e.toLowerCase().includes(u));
437
439
  });
438
440
  return h || v;
439
441
  });
440
- }), X = Ue(), q = xe(), {
442
+ }), Y = Ue(), q = xe(), {
441
443
  breakpoints: p
442
- } = Ee(), E = (l) => {
443
- X.open({
444
- title: a("hr.role.remove.title"),
445
- message: a("hr.role.remove.message", {
446
- name: l.name
444
+ } = Ee(), E = (t) => {
445
+ Y.open({
446
+ title: s("hr.role.remove.title"),
447
+ message: s("hr.role.remove.message", {
448
+ name: t.name
447
449
  }),
448
450
  minWidth: p.value.lg ? 588 : 0,
449
451
  primaryActions: {
450
- text: a("common.remove"),
452
+ text: s("common.remove"),
451
453
  close: !1,
452
454
  variant: "destructive"
453
455
  },
454
456
  secondaryActions: {
455
- text: a("common.cancel"),
457
+ text: s("common.cancel"),
456
458
  close: !0
457
459
  }
458
460
  }).onPrimary(async () => {
459
- await R.deleteRole(l).then(() => q.open({
460
- message: a("hr.role.remove.successMessage", {
461
- name: l.name
461
+ await R.deleteRole(t).then(() => q.open({
462
+ message: s("hr.role.remove.successMessage", {
463
+ name: t.name
462
464
  }),
463
465
  type: "success"
464
466
  })).catch((r) => q.open({
465
467
  message: r,
466
468
  type: "error"
467
- })), X.close();
469
+ })), Y.close();
468
470
  });
469
- }, t = P(""), z = P(), g = P(void 0);
470
- async function Y() {
471
- var l;
472
- g.value = void 0, await fe(), (l = z.value) == null || l.trigger();
471
+ }, l = P(""), z = P(), g = P(void 0);
472
+ async function Z() {
473
+ var t;
474
+ g.value = void 0, await fe(), (t = z.value) == null || t.trigger();
473
475
  }
474
- async function re() {
476
+ async function ne() {
475
477
  R.roles.value.length === 0 && await R.readRoles();
476
478
  }
477
479
  return be(() => {
478
- re();
480
+ ne();
479
481
  }), G({
480
- create: Y
481
- }), (l, r) => {
482
- const m = C("FmSearch"), i = C("FmTable"), h = C("FmListItem"), x = C("FmList");
483
- return d(), V(N, null, [(d(), L(He, {
482
+ create: Z
483
+ }), (t, r) => {
484
+ const m = C("FmSearch"), u = C("FmTable"), h = C("FmListItem"), x = C("FmList");
485
+ return d(), V(A, null, [(d(), L(He, {
484
486
  id: g.value,
485
487
  key: g.value,
486
488
  ref_key: "roleFormRef",
487
489
  ref: z
488
490
  }, null, 8, ["id"])), f("div", Qe, [f("div", Xe, [c(m, {
489
- modelValue: t.value,
490
- "onUpdate:modelValue": r[0] || (r[0] = (v) => t.value = v),
491
+ modelValue: l.value,
492
+ "onUpdate:modelValue": r[0] || (r[0] = (v) => l.value = v),
491
493
  class: "w-[320px] xs:w-full",
492
494
  autofocus: "",
493
- placeholder: o(a)("hr.role.search.placeholder") + " / " + o(a)("hr.restaurant.search.placeholder")
495
+ placeholder: o(s)("hr.role.search.placeholder") + " / " + o(s)("hr.restaurant.search.placeholder")
494
496
  }, null, 8, ["modelValue", "placeholder"])]), o(R).roles.value.length > 0 || o(R).isLoading.value ? (d(), L(Se, {
495
497
  key: 0,
496
498
  class: "overflow-auto"
497
499
  }, {
498
- default: b(() => [c(i, {
500
+ default: y(() => [c(u, {
499
501
  class: "xs:hidden",
500
- "column-defs": le,
502
+ "column-defs": oe,
501
503
  "row-data": J.value,
502
504
  "page-size": J.value.length,
503
505
  loading: o(R).isLoading.value,
@@ -508,17 +510,17 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
508
510
  }, null, 8, ["row-data", "page-size", "loading"]), f("div", Ye, [c(x, {
509
511
  separator: ""
510
512
  }, {
511
- default: b(() => [(d(!0), V(N, null, ae(J.value, (v) => (d(), L(h, {
513
+ default: y(() => [(d(!0), V(A, null, te(J.value, (v) => (d(), L(h, {
512
514
  key: v._id,
513
515
  class: "py-12 px-16 items-center justify-between",
514
516
  onClick: (B) => M(v)
515
517
  }, {
516
- default: b(() => [f("div", Ze, [f("p", es, D(v.name), 1), f("div", ss, [f("p", null, D(o(a)("hr.role.labels.restaurantList", {
518
+ default: y(() => [f("div", Ze, [f("p", es, D(v.name), 1), f("div", ss, [f("p", null, D(o(s)("hr.role.labels.restaurantList", {
517
519
  items: v.restaurants.map((B) => B.name).join(", ")
518
- })), 1), f("p", as, [pe(D(o(a)("hr.role.labels.operationList", {
519
- items: o(ee)(v.permissions, o(k.F_RULE_SUBJECT).enum.order)
520
- })) + " ", 1), (d(), L(ve(T(v.permissions, o(k.F_RULE_SUBJECT).enum.order))))]), f("p", ts, [pe(D(o(a)("hr.role.labels.reportList", {
521
- items: o(ee)(v.permissions, o(k.F_RULE_SUBJECT).enum.report, o(w))
520
+ })), 1), f("p", as, [pe(D(o(s)("hr.role.labels.operationList", {
521
+ items: o(ae)(v.permissions, o(k.F_RULE_SUBJECT).enum.order)
522
+ })) + " ", 1), (d(), L(ve(T(v.permissions, o(k.F_RULE_SUBJECT).enum.order))))]), f("p", ls, [pe(D(o(s)("hr.role.labels.reportList", {
523
+ items: o(ae)(v.permissions, o(k.F_RULE_SUBJECT).enum.report, o(w))
522
524
  })) + " ", 1), (d(), L(ve(T(v.permissions, o(k.F_RULE_SUBJECT).enum.report))))])])]), f("div", {
523
525
  onClick: r[2] || (r[2] = Le(() => {
524
526
  }, ["stop"]))
@@ -532,8 +534,8 @@ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
532
534
  _: 1
533
535
  })) : (d(), L(o($e), {
534
536
  key: 1,
535
- title: o(a)("hr.role.noData.title"),
536
- subtitle: o(a)("hr.role.noData.subtitle")
537
+ title: o(s)("hr.role.noData.title"),
538
+ subtitle: o(s)("hr.role.noData.subtitle")
537
539
  }, null, 8, ["title", "subtitle"]))])], 64);
538
540
  };
539
541
  }