@feedmepos/mf-hrm-portal 2.0.20-dev.1 → 2.0.20-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 (30) hide show
  1. package/dist/{AuditLogList-Bsj-qg8n.js → AuditLogList-ChxAzO74.js} +4 -4
  2. package/dist/EmployeeList-Cs-Mn6UA.js +843 -0
  3. package/dist/{Main-BGc6kNaR.js → Main-B9_TyRDo.js} +2008 -2001
  4. package/dist/Main-CdHW4UkN.js +90 -0
  5. package/dist/{Main-CSMAtoMj.js → Main-DcvmP7s-.js} +184 -176
  6. package/dist/PermissionSetList-VFVS0g0v.js +347 -0
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CdWgTjZw.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Dr3R9JjS.js} +771 -770
  8. package/dist/{RoleList-e0WUqt4Y.js → RoleList-BZ6RZvm2.js} +199 -188
  9. package/dist/TeamMemberList-C-zhFauD.js +1115 -0
  10. package/dist/{TimesheetList-tFjvFHqH.js → TimesheetList-CZex54an.js} +61 -53
  11. package/dist/{app-CL7rUfL3.js → app-CLL3p27X.js} +191 -193
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-ChdFPuFV.js → dayjs.min-CDt1i9vl.js} +1 -1
  14. package/dist/employee-BpRvjWNh.js +200 -0
  15. package/dist/{iteration-BbD0nOgO.js → iteration-BVjUzYL5.js} +173 -175
  16. package/dist/{lodash-CDf3aG6G.js → lodash-CrwgACp2.js} +1 -1
  17. package/dist/{rule-BJ-y3Sp8.js → rule-BlQ5YZ9Z.js} +27 -26
  18. package/dist/src/types/team.d.ts +1 -0
  19. package/dist/style.css +1 -1
  20. package/dist/{timesheet-BmV02Rkz.js → timesheet-jFs4GTAL.js} +2 -2
  21. package/dist/tsconfig.app.tsbuildinfo +1 -1
  22. package/dist/{useAppStore-D8QAGZ02.js → useAppStore-DMAL8VFY.js} +36 -38
  23. package/dist/{useLoading-KpcQw0p4.js → useLoading-AFTjRLyO.js} +1 -1
  24. package/dist/{useReportPermissions-CmGJAz_N.js → useReportPermissions-hODG0Xx3.js} +3 -3
  25. package/package.json +1 -1
  26. package/dist/EmployeeList-Cy2ayCko.js +0 -824
  27. package/dist/Main-D7bV8EuC.js +0 -86
  28. package/dist/PermissionSetList-CuHhDqWl.js +0 -347
  29. package/dist/TeamMemberList-CpPa1KyV.js +0 -1097
  30. package/dist/employee-kKV7UnHU.js +0 -204
@@ -1,27 +1,27 @@
1
- import { computed as _, defineComponent as ge, ref as P, watch as se, onMounted as be, resolveComponent as R, 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 le, toDisplayString as D, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Le, nextTick as fe } from "vue";
2
- import { u as me, e as k } from "./iteration-BbD0nOgO.js";
1
+ import { computed as _, defineComponent as ge, ref as $, watch as se, onMounted as be, resolveComponent as x, createBlock as P, openBlock as d, unref as o, withCtx as b, createElementVNode as p, createVNode as m, createElementBlock as k, Fragment as D, createCommentVNode as de, renderList as te, toDisplayString as N, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Le, nextTick as fe } from "vue";
2
+ import { u as me, e as L } from "./iteration-BVjUzYL5.js";
3
3
  import { useI18n as ye } from "@feedmepos/mf-common";
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-CL7rUfL3.js";
4
+ import { useSnackbar as xe, components as ue, useDialog as Ee, useBreakpoints as Ue, FmButtonColorThemeVariant as Ie } from "@feedmepos/ui-library";
5
+ import { _ as Se } from "./app-CLL3p27X.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 Re, f as Me, g as _e, a as ae } from "./rule-BJ-y3Sp8.js";
9
- import { u as Ce } from "./useAppStore-D8QAGZ02.js";
10
- import { u as Fe } from "./useReportPermissions-CmGJAz_N.js";
11
- import { l as te } from "./lodash-CDf3aG6G.js";
8
+ import { e as Te, r as W, h as Re, f as Me, g as _e, a as ae } from "./rule-BlQ5YZ9Z.js";
9
+ import { u as Ce } from "./useAppStore-DMAL8VFY.js";
10
+ import { u as Fe } from "./useReportPermissions-hODG0Xx3.js";
11
+ import { l as le } from "./lodash-CrwgACp2.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-KpcQw0p4.js";
14
+ import { u as De } from "./useLoading-AFTjRLyO.js";
15
15
  function Ne() {
16
16
  const j = me();
17
17
  return _(() => {
18
18
  const s = {};
19
- return j.restaurants.value.forEach((C) => {
20
- s[C._id] = C;
19
+ return j.restaurants.value.forEach((R) => {
20
+ s[R._id] = R;
21
21
  }), s;
22
22
  });
23
23
  }
24
- const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, Je = {
24
+ const Oe = { class: "fm-typo-en-title-md-600" }, Ae = { 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,29 +36,29 @@ const Ae = { 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: s } = ye(), C = me(), $ = P(""), U = _(() => C.restaurants.value.filter(({ profile: e }) => {
39
+ const { t: s } = ye(), R = me(), T = $(""), E = _(() => R.restaurants.value.filter(({ profile: e }) => {
40
40
  const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
41
- return !$.value || a.toLowerCase().includes($.value.toLowerCase());
42
- })), O = P(C.restaurants.value.length === 0);
41
+ return !T.value || a.toLowerCase().includes(T.value.toLowerCase());
42
+ })), J = $(R.restaurants.value.length === 0);
43
43
  se(
44
- () => C.restaurants.value.length,
44
+ () => R.restaurants.value.length,
45
45
  (e) => {
46
- e > 0 && (O.value = !1);
46
+ e > 0 && (J.value = !1);
47
47
  }
48
48
  );
49
- const T = Ce(), H = xe(), Q = De(H), { fetchReportPermissions: X, allReportPermissions: oe, availableReportKeys: M } = Fe(), F = j, b = P(!1), re = () => {
50
- b.value = !b.value, b.value && Z();
51
- }, J = _(() => F.id ? s("hr.role.form.update") : s("hr.role.form.add")), Y = _(() => F.id ? s("common.update") : s("common.add")), q = _(() => {
49
+ const M = Ce(), H = xe(), Q = De(H), { fetchReportPermissions: X, allReportPermissions: oe, availableReportKeys: B } = Fe(), C = j, F = $(!1), re = () => {
50
+ F.value = !F.value, F.value && Z();
51
+ }, q = _(() => C.id ? s("hr.role.form.update") : s("hr.role.form.add")), Y = _(() => C.id ? s("common.update") : s("common.add")), O = _(() => {
52
52
  const e = Te.filter(
53
- (i) => i.subject !== k.F_RULE_SUBJECT.enum.report
54
- ).map((i) => W(i)), a = oe.value.map((i) => W(i));
53
+ (n) => n.subject !== L.F_RULE_SUBJECT.enum.report
54
+ ).map((n) => W(n)), a = oe.value.map((n) => W(n));
55
55
  return [...e, ...a];
56
- }), p = _(() => T.roles.value.find((e) => e._id == F.id)), E = () => ({
56
+ }), v = _(() => M.roles.value.find((e) => e._id == C.id)), U = () => ({
57
57
  name: "",
58
58
  restaurantIds: [],
59
59
  permissions: [],
60
60
  maxDiscountPercentage: 100
61
- }), t = P(E()), z = _(() => [
61
+ }), t = $(U()), z = _(() => [
62
62
  {
63
63
  title: s("hr.role.labels.operation"),
64
64
  filter: (e) => e.isOrderOperation
@@ -73,28 +73,28 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
73
73
  }
74
74
  ].map((e) => ({
75
75
  title: e.title,
76
- options: q.value.filter(e.filter).map(({ label: a, value: i }) => ({
77
- label: s(`hr.role.form.permissionLabels.${i}`, a),
78
- value: i
76
+ options: O.value.filter(e.filter).map(({ label: a, value: n }) => ({
77
+ label: s(`hr.role.form.permissionLabels.${n}`, a),
78
+ value: n
79
79
  }))
80
80
  }))), g = _(() => {
81
81
  var e;
82
- return Re(((e = p.value) == null ? void 0 : e.permissions) || []);
82
+ return Re(((e = v.value) == null ? void 0 : e.permissions) || []);
83
83
  });
84
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((a) => a._id), t.value.permissions = q.value.map((a) => a.value)) : p.value && (t.value.restaurantIds = p.value.restaurants.map((a) => a.id), t.value.permissions = p.value.permissions.map((a) => W(a).value).filter((a) => a.startsWith("report:") ? M.value.has(a.split(":")[1]) : !0), t.value.maxDiscountPercentage = _e(
87
- p.value.permissions
86
+ t.value = U(), t.value.name = ((e = v.value) == null ? void 0 : e.name) ?? "", g.value ? (t.value.restaurantIds = E.value.map((a) => a._id), t.value.permissions = O.value.map((a) => a.value)) : v.value && (t.value.restaurantIds = v.value.restaurants.map((a) => a.id), t.value.permissions = v.value.permissions.map((a) => W(a).value).filter((a) => a.startsWith("report:") ? B.value.has(a.split(":")[1]) : !0), t.value.maxDiscountPercentage = _e(
87
+ v.value.permissions
88
88
  ));
89
89
  }
90
90
  be(async () => {
91
- await C.readRestaurants(), await X(), Z();
92
- }), se(b, async (e) => {
91
+ await R.readRestaurants(), await X(), Z();
92
+ }), se(F, async (e) => {
93
93
  e && await X();
94
- }), se(M, () => {
95
- b.value && p.value && !g.value && (t.value.permissions = t.value.permissions.filter((e) => e.startsWith("report:") ? M.value.has(e.split(":")[1]) : !0));
94
+ }), se(B, () => {
95
+ F.value && v.value && !g.value && (t.value.permissions = t.value.permissions.filter((e) => e.startsWith("report:") ? B.value.has(e.split(":")[1]) : !0));
96
96
  });
97
- const ne = P(""), l = _(() => ({
97
+ const ne = $(""), l = _(() => ({
98
98
  restaurantIds: t.value.restaurantIds,
99
99
  role: {
100
100
  name: t.value.name,
@@ -104,22 +104,22 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
104
104
  const e = l.value;
105
105
  await Q.minor(
106
106
  async () => {
107
- p.value ? await T.updateRole(p.value._id, e) : await T.createRole(e);
107
+ v.value ? await M.updateRole(v.value._id, e) : await M.createRole(e);
108
108
  },
109
109
  {
110
- successMessage: p.value ? s("hr.role.update.successMessage", { name: e.role.name }) : s("hr.role.add.successMessage", { name: e.role.name })
110
+ successMessage: v.value ? s("hr.role.update.successMessage", { name: e.role.name }) : s("hr.role.add.successMessage", { name: e.role.name })
111
111
  }
112
- ), b.value = !1;
113
- }, m = _(
114
- () => t.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 = t.value.restaurantIds.filter((a) => !m.value.includes(a));
117
- u.value === !0 ? t.value.restaurantIds = e : t.value.restaurantIds = U.value.map((a) => a._id);
118
- }, x = (e) => e.map((i) => i.value).every((i) => t.value.permissions.includes(i)), v = (e) => {
112
+ ), F.value = !1;
113
+ }, c = _(
114
+ () => t.value.restaurantIds.filter((e) => E.value.some((a) => a._id === e))
115
+ ), i = _(() => E.value.length > 0 && E.value.length === c.value.length), h = () => {
116
+ const e = t.value.restaurantIds.filter((a) => !c.value.includes(a));
117
+ i.value === !0 ? t.value.restaurantIds = e : t.value.restaurantIds = E.value.map((a) => a._id);
118
+ }, y = (e) => e.map((n) => n.value).every((n) => t.value.permissions.includes(n)), f = (e) => {
119
119
  const a = t.value.permissions.filter(
120
- (i) => !e.map((N) => N.value).includes(i)
120
+ (n) => !e.map((A) => A.value).includes(n)
121
121
  );
122
- x(e) === !0 ? t.value.permissions = a : t.value.permissions = [...a, ...e.map((i) => i.value)];
122
+ y(e) === !0 ? t.value.permissions = a : t.value.permissions = [...a, ...e.map((n) => n.value)];
123
123
  };
124
124
  se(
125
125
  () => t.value.restaurantIds,
@@ -127,111 +127,113 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
127
127
  e.length > 0 && (ne.value = "");
128
128
  }
129
129
  );
130
- const B = Pe(
130
+ const V = Pe(
131
131
  () => {
132
- var e, a, i, N;
133
- return !te.isEqual(t.value.name, ((e = p.value) == null ? void 0 : e.name) || E().name) || !te.isEqual(
132
+ var e, a, n, A;
133
+ return !le.isEqual(t.value.name, ((e = v.value) == null ? void 0 : e.name) || U().name) || !le.isEqual(
134
134
  t.value.restaurantIds,
135
- ((a = p.value) == null ? void 0 : a.restaurants.map((K) => K.id)) || E().restaurantIds
136
- ) || !te.isEqual(
135
+ ((a = v.value) == null ? void 0 : a.restaurants.map((K) => K.id)) || U().restaurantIds
136
+ ) || !le.isEqual(
137
137
  t.value.permissions,
138
- ((i = p.value) == null ? void 0 : i.permissions.map((K) => W(K).value)) || E().permissions
139
- ) || !te.isEqual(
138
+ ((n = v.value) == null ? void 0 : n.permissions.map((K) => W(K).value)) || U().permissions
139
+ ) || !le.isEqual(
140
140
  t.value.maxDiscountPercentage,
141
- p.value ? _e((N = p.value) == null ? void 0 : N.permissions) : E().maxDiscountPercentage
141
+ v.value ? _e((A = v.value) == null ? void 0 : A.permissions) : U().maxDiscountPercentage
142
142
  );
143
143
  },
144
144
  () => {
145
- b.value = !1;
145
+ F.value = !1;
146
146
  }
147
147
  );
148
148
  return G({
149
- show: b,
149
+ show: F,
150
150
  trigger: re
151
151
  }), (e, a) => {
152
- const i = R("FmTextField"), N = R("FmCircularProgress"), K = R("FmSearch"), ee = R("FmCheckbox"), we = R("FmFormGroup"), Ve = R("FmCard"), ce = R("fm-button"), ke = R("fm-side-sheet");
153
- return d(), L(ke, {
152
+ const n = x("FmTextField"), A = x("FmCircularProgress"), K = x("FmSearch"), ee = x("FmCheckbox"), we = x("FmFormGroup"), ke = x("FmCard"), ce = x("fm-button"), Ve = x("fm-side-sheet");
153
+ return d(), P(Ve, {
154
154
  id: "unit-form",
155
- modelValue: b.value,
156
- "onUpdate:modelValue": a[7] || (a[7] = (n) => b.value = n),
155
+ "model-value": F.value,
157
156
  "is-container": o(ue).FmForm,
158
157
  "is-container-props": {
159
158
  onValidationSuccess: r,
160
159
  blameFormChildOnValidationFailed: !0
161
160
  },
162
161
  "max-width": 960,
163
- "onOn:clickedAway": o(B)
162
+ "onOn:clickedAway": o(V),
163
+ "onOn:close": o(V)
164
164
  }, {
165
- "side-sheet-header": y(() => [
166
- f("p", Ae, D(J.value), 1)
165
+ "side-sheet-header": b(() => [
166
+ p("p", Oe, N(q.value), 1)
167
167
  ]),
168
- "side-sheet-footer": y(() => [
169
- f("div", Ge, [
170
- c(ce, {
168
+ "side-sheet-footer": b(() => [
169
+ p("div", Ge, [
170
+ m(ce, {
171
171
  label: Y.value,
172
172
  size: "lg",
173
173
  type: "submit",
174
174
  variant: "primary",
175
175
  disabled: g.value
176
176
  }, null, 8, ["label", "disabled"]),
177
- c(ce, {
177
+ m(ce, {
178
178
  label: o(s)("common.cancel"),
179
179
  size: "lg",
180
180
  variant: "tertiary",
181
- onClick: a[6] || (a[6] = () => b.value = !1)
182
- }, null, 8, ["label"])
181
+ onClick: o(V)
182
+ }, null, 8, ["label", "onClick"])
183
183
  ])
184
184
  ]),
185
- default: y(() => [
186
- f("div", Oe, [
187
- c(ie, { title: "Role detail" }, {
188
- default: y(() => [
189
- c(i, {
185
+ default: b(() => [
186
+ p("div", Ae, [
187
+ m(ie, { title: "Role detail" }, {
188
+ default: b(() => [
189
+ m(n, {
190
190
  modelValue: t.value.name,
191
- "onUpdate:modelValue": a[0] || (a[0] = (n) => t.value.name = n),
191
+ "onUpdate:modelValue": a[0] || (a[0] = (u) => t.value.name = u),
192
192
  autofocus: "",
193
- rules: [(n) => !!n || o(s)("hr.role.form.required")],
193
+ rules: [(u) => !!u || o(s)("hr.role.form.required")],
194
194
  label: o(s)("hr.role.form.name"),
195
195
  disabled: g.value
196
196
  }, null, 8, ["modelValue", "rules", "label", "disabled"])
197
197
  ]),
198
198
  _: 1
199
199
  }),
200
- c(ie, {
200
+ m(ie, {
201
201
  title: o(s)("hr.role.form.restaurant")
202
202
  }, {
203
- default: y(() => [
204
- O.value ? (d(), V("div", Je, [
205
- c(N)
206
- ])) : (d(), V(A, { key: 1 }, [
207
- c(K, {
208
- modelValue: $.value,
209
- "onUpdate:modelValue": a[1] || (a[1] = (n) => $.value = n),
203
+ default: b(() => [
204
+ J.value ? (d(), k("div", Je, [
205
+ m(A)
206
+ ])) : (d(), k(D, { key: 1 }, [
207
+ m(K, {
208
+ modelValue: T.value,
209
+ "onUpdate:modelValue": a[1] || (a[1] = (u) => T.value = u),
210
210
  placeholder: o(s)("hr.restaurant.search.placeholder")
211
211
  }, null, 8, ["modelValue", "placeholder"]),
212
- c(we, {
212
+ m(we, {
213
213
  modelValue: t.value.restaurantIds,
214
- "onUpdate:modelValue": a[3] || (a[3] = (n) => t.value.restaurantIds = n),
215
- rules: [(n) => n.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
214
+ "onUpdate:modelValue": a[3] || (a[3] = (u) => t.value.restaurantIds = u),
215
+ rules: [(u) => u.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
216
216
  }, {
217
- default: y(() => [
218
- f("div", qe, [
219
- $.value ? de("", !0) : (d(), L(ee, {
220
- key: 0,
221
- "model-value": u.value,
222
- label: o(s)("hr.role.form.all"),
223
- value: "1",
224
- disabled: g.value,
225
- "onUpdate:modelValue": h
226
- }, null, 8, ["model-value", "label", "disabled"])),
227
- (d(!0), V(A, null, le(U.value, (n) => (d(), V("div", {
228
- key: n._id
217
+ default: b(() => [
218
+ p("div", qe, [
219
+ T.value ? de("", !0) : (d(), k(D, { key: 0 }, [
220
+ m(ee, {
221
+ "model-value": i.value,
222
+ label: o(s)("hr.role.form.all"),
223
+ value: "1",
224
+ disabled: g.value,
225
+ "onUpdate:modelValue": h
226
+ }, null, 8, ["model-value", "label", "disabled"]),
227
+ a[6] || (a[6] = p("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1))
228
+ ], 64)),
229
+ (d(!0), k(D, null, te(E.value, (u) => (d(), k("div", {
230
+ key: u._id
229
231
  }, [
230
- c(ee, {
232
+ m(ee, {
231
233
  modelValue: t.value.restaurantIds,
232
234
  "onUpdate:modelValue": a[2] || (a[2] = (I) => t.value.restaurantIds = I),
233
- label: `${n.profile.code ? n.profile.code + "-" : ""}${n.profile.name}`,
234
- value: n._id,
235
+ label: `${u.profile.code ? u.profile.code + "-" : ""}${u.profile.name}`,
236
+ value: u._id,
235
237
  disabled: g.value
236
238
  }, null, 8, ["modelValue", "label", "value", "disabled"])
237
239
  ]))), 128))
@@ -243,42 +245,43 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
243
245
  ]),
244
246
  _: 1
245
247
  }, 8, ["title"]),
246
- c(ie, {
248
+ m(ie, {
247
249
  title: o(s)("hr.role.form.permissions")
248
250
  }, {
249
- default: y(() => [
250
- (d(!0), V(A, null, le(z.value, (n) => (d(), L(Ve, {
251
- key: n.title,
251
+ default: b(() => [
252
+ (d(!0), k(D, null, te(z.value, (u) => (d(), P(ke, {
253
+ key: u.title,
252
254
  variant: "outlined",
253
255
  class: "p-16"
254
256
  }, {
255
- default: y(() => [
256
- c(Be, null, {
257
- title: y(() => [
258
- f("p", ze, D(n.title), 1)
257
+ default: b(() => [
258
+ m(Be, null, {
259
+ title: b(() => [
260
+ p("p", ze, N(u.title), 1)
259
261
  ]),
260
- default: y(() => [
261
- f("div", Ke, [
262
- c(ee, {
263
- "model-value": x(n.options),
262
+ default: b(() => [
263
+ p("div", Ke, [
264
+ m(ee, {
265
+ "model-value": y(u.options),
264
266
  label: o(s)("hr.role.form.all"),
265
267
  value: "1",
266
268
  disabled: g.value,
267
- "onUpdate:modelValue": (I) => v(n.options)
269
+ "onUpdate:modelValue": (I) => f(u.options)
268
270
  }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
269
- (d(!0), V(A, null, le(n.options, (I) => (d(), V("div", {
271
+ a[7] || (a[7] = p("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1)),
272
+ (d(!0), k(D, null, te(u.options, (I) => (d(), k("div", {
270
273
  key: I.value
271
274
  }, [
272
- c(ee, {
275
+ m(ee, {
273
276
  modelValue: t.value.permissions,
274
277
  "onUpdate:modelValue": a[4] || (a[4] = (w) => t.value.permissions = w),
275
278
  label: I.label,
276
279
  value: I.value,
277
280
  disabled: g.value
278
281
  }, null, 8, ["modelValue", "label", "value", "disabled"]),
279
- I.value === "order:discount" && t.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
+ I.value === "order:discount" && t.value.permissions.includes(I.value) ? (d(), k("div", We, [
283
+ p("div", je, N(o(s)("hr.role.form.maxDiscountPercentage")), 1),
284
+ m(n, {
282
285
  modelValue: t.value.maxDiscountPercentage,
283
286
  "onUpdate:modelValue": a[5] || (a[5] = (w) => t.value.maxDiscountPercentage = w),
284
287
  rules: [
@@ -305,7 +308,7 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
305
308
  ])
306
309
  ]),
307
310
  _: 1
308
- }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
311
+ }, 8, ["model-value", "is-container", "is-container-props", "onOn:clickedAway", "onOn:close"]);
309
312
  };
310
313
  }
311
314
  }), Qe = {
@@ -322,7 +325,7 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
322
325
  class: "text-fm-color-typo-secondary"
323
326
  }, as = {
324
327
  class: "flex"
325
- }, ts = {
328
+ }, ls = {
326
329
  class: "flex"
327
330
  }, gs = /* @__PURE__ */ ge({
328
331
  __name: "RoleList",
@@ -332,11 +335,11 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
332
335
  const {
333
336
  t: s
334
337
  } = ye(), {
335
- allReportPermissions: C
336
- } = Fe(), $ = me(), U = _(() => $.restaurants.value), O = _(() => U.value.map((l) => l._id));
337
- function T(l, r) {
338
- const m = r === k.F_RULE_SUBJECT.enum.report ? C.value : void 0, u = ae(l, r, m);
339
- return ["-", "All"].includes(u) ? () => null : () => S(ue.FmTooltip, {
338
+ allReportPermissions: R
339
+ } = Fe(), T = me(), E = _(() => T.restaurants.value), J = _(() => E.value.map((l) => l._id));
340
+ function M(l, r) {
341
+ const c = r === L.F_RULE_SUBJECT.enum.report ? R.value : void 0, i = ae(l, r, c);
342
+ return ["-", "All"].includes(i) ? () => null : () => S(ue.FmTooltip, {
340
343
  "z-index": "999",
341
344
  placement: "top",
342
345
  class: "ml-2"
@@ -349,18 +352,18 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
349
352
  });
350
353
  }
351
354
  function H(l, r) {
352
- const m = r === k.F_RULE_SUBJECT.enum.report ? C.value : void 0, u = ae(l, r, m);
353
- return () => u === "All" ? u : S("div", {
355
+ const c = r === L.F_RULE_SUBJECT.enum.report ? R.value : void 0, i = ae(l, r, c);
356
+ return () => i === "All" ? i : S("div", {
354
357
  class: "flex items-center"
355
- }, [u, T(l, r)()]);
358
+ }, [i, M(l, r)()]);
356
359
  }
357
360
  function Q(l) {
358
361
  return [{
359
362
  label: s("hr.role.form.update"),
360
- onClick: () => M(l)
363
+ onClick: () => B(l)
361
364
  }, {
362
365
  label: s("hr.role.remove.title"),
363
- onClick: () => E(l),
366
+ onClick: () => U(l),
364
367
  itemClass: "text-fm-color-typo-error",
365
368
  disabled: Re(l.permissions)
366
369
  }];
@@ -368,12 +371,12 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
368
371
  const X = ({
369
372
  role: l,
370
373
  className: r = ""
371
- }) => c("div", {
374
+ }) => m("div", {
372
375
  class: r,
373
- onClick: (m) => {
374
- m.stopPropagation();
376
+ onClick: (c) => {
377
+ c.stopPropagation();
375
378
  }
376
- }, [c(he, {
379
+ }, [m(he, {
377
380
  items: Q(l)
378
381
  }, null)]), oe = [{
379
382
  accessorKey: "name",
@@ -382,19 +385,19 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
382
385
  }, {
383
386
  accessorKey: "operation",
384
387
  header: () => s("hr.role.columns.operation"),
385
- cell: (l) => S(H(l.row.original.permissions, k.F_RULE_SUBJECT.enum.order)),
388
+ cell: (l) => S(H(l.row.original.permissions, L.F_RULE_SUBJECT.enum.order)),
386
389
  enableSorting: !1
387
390
  }, {
388
391
  accessorKey: "report",
389
392
  header: () => s("hr.role.columns.report"),
390
- cell: (l) => S(H(l.row.original.permissions, k.F_RULE_SUBJECT.enum.report)),
393
+ cell: (l) => S(H(l.row.original.permissions, L.F_RULE_SUBJECT.enum.report)),
391
394
  enableSorting: !1
392
395
  }, {
393
396
  accessorKey: "restaurants",
394
397
  header: () => s("hr.role.columns.restaurants"),
395
- cell: (l) => l.row.original.restaurants.map((r, m) => {
396
- const u = r.code, h = `${u ? u + " - " : ""}${r.name}`;
397
- return S("div", (m ? `
398
+ cell: (l) => l.row.original.restaurants.map((r, c) => {
399
+ const i = r.code, h = `${i ? i + " - " : ""}${r.name}`;
400
+ return S("div", (c ? `
398
401
  ` : "") + h);
399
402
  }),
400
403
  enableSorting: !1
@@ -409,45 +412,45 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
409
412
  role: l.row.original,
410
413
  className: "flex w-full items-center justify-end"
411
414
  })
412
- }], M = async (l) => {
415
+ }], B = async (l) => {
413
416
  var r;
414
417
  g.value = l._id, await fe(), (r = z.value) == null || r.trigger();
415
- }, F = Ce(), b = Ne(), re = _(() => {
416
- const l = F.roles.value || [];
417
- return (O.value.length === 0 ? l : l.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
+ }, C = Ce(), F = Ne(), re = _(() => {
419
+ const l = C.roles.value || [];
420
+ return (J.value.length === 0 ? l : l.filter((c) => c.restaurants.some((i) => J.value.includes(i.id)))).map((c) => {
421
+ const i = c.restaurants.map((h) => {
422
+ const y = F.value[h.id];
420
423
  return {
421
424
  ...h,
422
425
  // Prefer live data from restaurantMap so names populate reactively
423
426
  // even when restaurants loaded after roles.
424
- name: (x == null ? void 0 : x.profile.name) || h.name,
425
- code: x == null ? void 0 : x.profile.code
427
+ name: (y == null ? void 0 : y.profile.name) || h.name,
428
+ code: y == null ? void 0 : y.profile.code
426
429
  };
427
430
  });
428
431
  return {
429
- ...m,
430
- restaurants: u
432
+ ...c,
433
+ restaurants: i
431
434
  };
432
435
  });
433
- }), J = _(() => {
436
+ }), q = _(() => {
434
437
  var r;
435
- return (r = re.value) == null ? void 0 : r.filter((m) => {
436
- const u = t.value.toLowerCase(), h = m.name.toLowerCase().includes(u), v = (m.restaurants || []).some((B) => {
438
+ return (r = re.value) == null ? void 0 : r.filter((c) => {
439
+ const i = t.value.toLowerCase(), h = c.name.toLowerCase().includes(i), f = (c.restaurants || []).some((V) => {
437
440
  var e;
438
- return B.name.toLowerCase().includes(u) || ((e = B.code) == null ? void 0 : e.toLowerCase().includes(u));
441
+ return V.name.toLowerCase().includes(i) || ((e = V.code) == null ? void 0 : e.toLowerCase().includes(i));
439
442
  });
440
- return h || v;
443
+ return h || f;
441
444
  });
442
- }), Y = Ue(), q = xe(), {
443
- breakpoints: p
444
- } = Ee(), E = (l) => {
445
+ }), Y = Ee(), O = xe(), {
446
+ breakpoints: v
447
+ } = Ue(), U = (l) => {
445
448
  Y.open({
446
449
  title: s("hr.role.remove.title"),
447
450
  message: s("hr.role.remove.message", {
448
451
  name: l.name
449
452
  }),
450
- minWidth: p.value.lg ? 588 : 0,
453
+ minWidth: v.value.lg ? 588 : 0,
451
454
  primaryActions: {
452
455
  text: s("common.remove"),
453
456
  close: !1,
@@ -458,81 +461,89 @@ const Ae = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, J
458
461
  close: !0
459
462
  }
460
463
  }).onPrimary(async () => {
461
- await F.deleteRole(l).then(() => q.open({
464
+ await C.deleteRole(l).then(() => O.open({
462
465
  message: s("hr.role.remove.successMessage", {
463
466
  name: l.name
464
467
  }),
465
468
  type: "success"
466
- })).catch((r) => q.open({
469
+ })).catch((r) => O.open({
467
470
  message: r,
468
471
  type: "error"
469
472
  })), Y.close();
470
473
  });
471
- }, t = P(""), z = P(), g = P(void 0);
474
+ }, t = $(""), z = $(), g = $(void 0);
472
475
  async function Z() {
473
476
  var l;
474
477
  g.value = void 0, await fe(), (l = z.value) == null || l.trigger();
475
478
  }
476
479
  async function ne() {
477
- F.roles.value.length === 0 && await F.readRoles();
480
+ if (C.roles.value.length === 0)
481
+ try {
482
+ await C.readRoles();
483
+ } catch (l) {
484
+ console.error("Failed to load roles:", l), O.open({
485
+ message: l instanceof Error ? l.message : String(l),
486
+ type: "error"
487
+ });
488
+ }
478
489
  }
479
490
  return be(() => {
480
491
  ne();
481
492
  }), G({
482
493
  create: Z
483
494
  }), (l, r) => {
484
- const m = R("FmSearch"), u = R("FmTable"), h = R("FmListItem"), x = R("FmList");
485
- return d(), V(A, null, [(d(), L(He, {
495
+ const c = x("FmSearch"), i = x("FmTable"), h = x("FmListItem"), y = x("FmList");
496
+ return d(), k(D, null, [(d(), P(He, {
486
497
  id: g.value,
487
498
  key: g.value,
488
499
  ref_key: "roleFormRef",
489
500
  ref: z
490
- }, null, 8, ["id"])), f("div", Qe, [f("div", Xe, [c(m, {
501
+ }, null, 8, ["id"])), p("div", Qe, [p("div", Xe, [m(c, {
491
502
  modelValue: t.value,
492
- "onUpdate:modelValue": r[0] || (r[0] = (v) => t.value = v),
503
+ "onUpdate:modelValue": r[0] || (r[0] = (f) => t.value = f),
493
504
  class: "w-[320px] xs:w-full",
494
505
  autofocus: "",
495
506
  placeholder: o(s)("hr.role.search.placeholder") + " / " + o(s)("hr.restaurant.search.placeholder")
496
- }, null, 8, ["modelValue", "placeholder"])]), o(F).roles.value.length > 0 || o(F).isLoading.value ? (d(), L(Se, {
507
+ }, null, 8, ["modelValue", "placeholder"])]), o(C).roles.value.length > 0 || o(C).isLoading.value ? (d(), P(Se, {
497
508
  key: 0,
498
509
  class: "overflow-auto"
499
510
  }, {
500
- default: y(() => [c(u, {
511
+ default: b(() => [m(i, {
501
512
  class: "xs:hidden",
502
513
  "column-defs": oe,
503
- "row-data": J.value,
504
- "page-size": J.value.length,
505
- loading: o(F).isLoading.value,
514
+ "row-data": q.value,
515
+ "page-size": q.value.length,
516
+ loading: o(C).isLoading.value,
506
517
  "pin-header-row": "",
507
518
  "hide-footer": "",
508
519
  "shrink-at": !1,
509
- onRowClick: r[1] || (r[1] = (v) => M(v.original))
510
- }, null, 8, ["row-data", "page-size", "loading"]), f("div", Ye, [c(x, {
520
+ onRowClick: r[1] || (r[1] = (f) => B(f.original))
521
+ }, null, 8, ["row-data", "page-size", "loading"]), p("div", Ye, [m(y, {
511
522
  separator: ""
512
523
  }, {
513
- default: y(() => [(d(!0), V(A, null, le(J.value, (v) => (d(), L(h, {
514
- key: v._id,
524
+ default: b(() => [(d(!0), k(D, null, te(q.value, (f) => (d(), P(h, {
525
+ key: f._id,
515
526
  class: "py-12 px-16 items-center justify-between",
516
- onClick: (B) => M(v)
527
+ onClick: (V) => B(f)
517
528
  }, {
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", {
519
- items: v.restaurants.map((B) => B.name).join(", ")
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", ts, [pe(D(o(s)("hr.role.labels.reportList", {
523
- items: o(ae)(v.permissions, o(k.F_RULE_SUBJECT).enum.report, o(C))
524
- })) + " ", 1), (d(), L(ve(T(v.permissions, o(k.F_RULE_SUBJECT).enum.report))))])])]), f("div", {
529
+ default: b(() => [p("div", Ze, [p("p", es, N(f.name), 1), p("div", ss, [p("p", null, N(o(s)("hr.role.labels.restaurantList", {
530
+ items: f.restaurants.map((V) => V.name).join(", ")
531
+ })), 1), p("p", as, [pe(N(o(s)("hr.role.labels.operationList", {
532
+ items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.order)
533
+ })) + " ", 1), (d(), P(ve(M(f.permissions, o(L.F_RULE_SUBJECT).enum.order))))]), p("p", ls, [pe(N(o(s)("hr.role.labels.reportList", {
534
+ items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.report, o(R))
535
+ })) + " ", 1), (d(), P(ve(M(f.permissions, o(L.F_RULE_SUBJECT).enum.report))))])])]), p("div", {
525
536
  onClick: r[2] || (r[2] = Le(() => {
526
537
  }, ["stop"]))
527
- }, [c(he, {
528
- items: Q(v)
538
+ }, [m(he, {
539
+ items: Q(f)
529
540
  }, null, 8, ["items"])])]),
530
541
  _: 2
531
542
  }, 1032, ["onClick"]))), 128))]),
532
543
  _: 1
533
544
  })])]),
534
545
  _: 1
535
- })) : (d(), L(o($e), {
546
+ })) : (d(), P(o($e), {
536
547
  key: 1,
537
548
  title: o(s)("hr.role.noData.title"),
538
549
  subtitle: o(s)("hr.role.noData.subtitle")