@feedmepos/mf-hrm-portal 2.0.20-dev.2 → 2.0.20-dev.3

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