@feedmepos/mf-hrm-portal 2.0.10 → 2.0.11-dev

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 (44) hide show
  1. package/dist/AuditLogList-C7QcWwHq.js +941 -0
  2. package/dist/EmployeeList-CQzS4gXV.js +690 -0
  3. package/dist/{Main-D9233aXd.js → Main-6td6JhCb.js} +1055 -1054
  4. package/dist/{Main-6YVJ8qeK.js → Main-BhNhmkn8.js} +4 -4
  5. package/dist/{Main-BSaeTSWh.js → Main-Bu-UNnSQ.js} +6 -6
  6. package/dist/{PermissionSetList-vA7XmeDX.js → PermissionSetList-IG15Aj5D.js} +124 -128
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CrL1DmdL.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CDA9oDkd.js} +707 -707
  8. package/dist/RoleList-Cziztrpo.js +519 -0
  9. package/dist/TeamMemberList-DwxhZcrA.js +1081 -0
  10. package/dist/{TimesheetList-HsH2fi2o.js → TimesheetList-D_JT5iyS.js} +74 -74
  11. package/dist/{app-CvSQBSNk.js → app-h2mRYtCE.js} +4 -4
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-Cje6yZS4.js → dayjs.min-QbzmY4D1.js} +1 -1
  14. package/dist/employee-CY4sYUu8.js +232 -0
  15. package/dist/{index-CUPMZ2Nm.js → index-BLm_-G4e.js} +104 -81
  16. package/dist/{index-J8WRP1Mb.js → index-CBgvOHm7.js} +1 -1
  17. package/dist/{iteration-tLtr3UA8.js → iteration-J_5O7DIo.js} +2 -2
  18. package/dist/{lodash-CrQQQutG.js → lodash-btS1GWf0.js} +1 -1
  19. package/dist/src/api/employee/index.d.ts +4 -3
  20. package/dist/src/api/team/index.d.ts +3 -1
  21. package/dist/src/components/table/TablePagination.vue.d.ts +14 -0
  22. package/dist/src/composables/useDebounce.d.ts +9 -0
  23. package/dist/src/stores/employee.d.ts +515 -6
  24. package/dist/src/stores/team.d.ts +6 -0
  25. package/dist/src/types/employee.d.ts +35 -1
  26. package/dist/src/types/team.d.ts +18 -2
  27. package/dist/src/views/hr/employee/EmployeeForm.vue.d.ts +6 -2
  28. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +3 -0
  29. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +9 -0
  30. package/dist/src/views/team/member/TeamMemberMasterUser.vue.d.ts +5 -5
  31. package/dist/style.css +1 -1
  32. package/dist/{timesheet-Cj5r4laf.js → timesheet-B4Vja79b.js} +3 -3
  33. package/dist/tsconfig.app.tsbuildinfo +1 -1
  34. package/dist/{useAppStore-BFge6TcH.js → useAppStore-CEidzV7L.js} +1 -1
  35. package/dist/useDebounce-Cnv3r01W.js +83 -0
  36. package/dist/{useLoading-D5jjAdvm.js → useLoading-fH82N_CS.js} +1 -1
  37. package/dist/{useReportPermissions-BeIK2wRH.js → useReportPermissions-BZS4zPhT.js} +3 -3
  38. package/package.json +1 -1
  39. package/dist/AuditLogList-DICsmRKu.js +0 -915
  40. package/dist/EmployeeList-BeTBQG6y.js +0 -621
  41. package/dist/RoleList-BwZRlJSm.js +0 -499
  42. package/dist/TeamMemberList-DqMVgyU0.js +0 -989
  43. package/dist/employee-Bvza5QKq.js +0 -145
  44. package/dist/team-eAkNf8XU.js +0 -33
@@ -1,14 +1,14 @@
1
- import { ref as d, computed as b, defineComponent as ce, onMounted as me, watch as X, resolveComponent as i, createElementBlock as B, openBlock as D, Fragment as Z, createVNode as l, createElementVNode as u, unref as n, withCtx as C, createCommentVNode as pe, toDisplayString as $, createTextVNode as ve, createBlock as z, isRef as fe, renderList as he, nextTick as ge } from "vue";
2
- import { d as v } from "./dayjs.min-Cje6yZS4.js";
3
- import { useI18n as we, useCoreStore as ye, RestaurantSelector as be } from "@feedmepos/mf-common";
1
+ import { ref as d, computed as b, defineComponent as ce, onMounted as me, watch as X, resolveComponent as u, createElementBlock as B, openBlock as D, Fragment as Z, createVNode as l, createElementVNode as i, unref as n, withCtx as V, createCommentVNode as pe, toDisplayString as $, createTextVNode as ve, createBlock as z, isRef as fe, renderList as he, nextTick as ge } from "vue";
2
+ import { d as v } from "./dayjs.min-QbzmY4D1.js";
3
+ import { useI18n as ye, useCoreStore as we, RestaurantSelector as be } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as _e, components as De } from "@feedmepos/ui-library";
5
- import { _ as xe } from "./app-CvSQBSNk.js";
5
+ import { _ as xe } from "./app-h2mRYtCE.js";
6
6
  import { _ as Se } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
7
- import { u as ke } from "./useLoading-D5jjAdvm.js";
8
- import { c as Ce, s as Ve } from "./iteration-tLtr3UA8.js";
9
- import { b as Fe } from "./index-CUPMZ2Nm.js";
10
- import { u as Ye } from "./employee-Bvza5QKq.js";
11
- import { u as Le } from "./timesheet-Cj5r4laf.js";
7
+ import { u as ke } from "./useLoading-fH82N_CS.js";
8
+ import { c as Ce, s as Ve } from "./iteration-J_5O7DIo.js";
9
+ import { b as Fe } from "./index-BLm_-G4e.js";
10
+ import { u as Ye } from "./employee-CY4sYUu8.js";
11
+ import { u as Le } from "./timesheet-B4Vja79b.js";
12
12
  function Me(x, a) {
13
13
  return ["years", "months"].find((S) => {
14
14
  const k = x.startOf(S), f = x.endOf(S);
@@ -19,7 +19,7 @@ function Te() {
19
19
  const x = {
20
20
  startDate: v().format("YYYY-MM-DD"),
21
21
  endDate: v().format("YYYY-MM-DD")
22
- }, a = d(x), V = b(() => {
22
+ }, a = d(x), F = b(() => {
23
23
  if (!a.value) return "No dates selected.";
24
24
  const f = a.value.startDate ?? "Start", _ = a.value.endDate ?? "End";
25
25
  return `${f} - ${_}`;
@@ -28,25 +28,25 @@ function Te() {
28
28
  endDate: new Date(a.value.endDate)
29
29
  }));
30
30
  function k(f) {
31
- const _ = v(a.value.startDate), c = v(a.value.endDate), h = Me(_, c), A = h === "days" ? c.diff(_, "days") + 1 : 1, F = f === "subtract" ? (g) => g.subtract(A, h) : (g) => g.add(A, h);
31
+ const _ = v(a.value.startDate), c = v(a.value.endDate), h = Me(_, c), C = h === "days" ? c.diff(_, "days") + 1 : 1, Y = f === "subtract" ? (g) => g.subtract(C, h) : (g) => g.add(C, h);
32
32
  a.value = {
33
- startDate: F(_).startOf(h).format("YYYY-MM-DD"),
34
- endDate: F(c).endOf(h).format("YYYY-MM-DD")
33
+ startDate: Y(_).startOf(h).format("YYYY-MM-DD"),
34
+ endDate: Y(c).endOf(h).format("YYYY-MM-DD")
35
35
  };
36
36
  }
37
- return { dateRange: a, parsedDateRange: S, dateRangeLabel: V, setRange: k };
37
+ return { dateRange: a, parsedDateRange: S, dateRangeLabel: F, setRange: k };
38
38
  }
39
39
  const Re = {
40
40
  class: "my-16 flex w-[350px] flex-col gap-40"
41
41
  }, Ie = {
42
42
  class: "flex gap-16"
43
- }, Oe = {
43
+ }, Ee = {
44
44
  class: "flex flex-col gap-4"
45
- }, $e = {
45
+ }, Oe = {
46
46
  class: "fm-typo-body-md-400 text-fm-color-typo-secondary"
47
- }, Ae = {
47
+ }, $e = {
48
48
  class: "fm-typo-body-md-700 text-fm-color-typo-primary"
49
- }, Ee = {
49
+ }, Ae = {
50
50
  class: "flex flex-col gap-8"
51
51
  }, Ke = {
52
52
  class: "fm-typo-body-xl-700"
@@ -74,7 +74,7 @@ const Re = {
74
74
  setup(x) {
75
75
  const {
76
76
  t: a
77
- } = we(), V = _e(), S = ke(V), k = [{
77
+ } = ye(), F = _e(), S = ke(F), k = [{
78
78
  label: a("hr.timesheet.listView"),
79
79
  value: "listView"
80
80
  }, {
@@ -83,15 +83,15 @@ const Re = {
83
83
  }], f = d("listView"), _ = b(() => {
84
84
  var t;
85
85
  return (t = k.find((e) => e.value === f.value)) == null ? void 0 : t.label;
86
- }), c = d(""), h = Le(), A = Ye(), F = b(() => A.employees.value), g = b(() => h.timesheets.value.filter((s) => !E.value || E.value.includes(s.restaurantId)).map((s) => {
87
- var y;
88
- const r = (y = ee.restaurants.value.find((p) => p._id === s.restaurantId)) == null ? void 0 : y.profile.code, w = F.value.find((p) => p._id === s.user.id);
86
+ }), c = d(""), h = Le(), C = Ye(), Y = b(() => C.employees.value), g = b(() => h.timesheets.value.filter((s) => !A.value || A.value.includes(s.restaurantId)).map((s) => {
87
+ var w;
88
+ const r = (w = ee.restaurants.value.find((p) => p._id === s.restaurantId)) == null ? void 0 : w.profile.code, y = Y.value.find((p) => p._id === s.user.id);
89
89
  return {
90
90
  ...s,
91
91
  restaurantCode: r,
92
92
  user: {
93
93
  ...s.user,
94
- code: w ? w.code : ""
94
+ code: y ? y.code : ""
95
95
  }
96
96
  };
97
97
  })), P = b(() => g.value.filter((t) => {
@@ -99,13 +99,13 @@ const Re = {
99
99
  return t.user.name.toLowerCase().includes(c.value.toLowerCase()) || t.restaurantName.toLowerCase().includes(c.value.toLowerCase()) || ((e = t.restaurantCode) == null ? void 0 : e.toLowerCase().includes(c.value.toLowerCase())) || ((s = t.user.code) == null ? void 0 : s.toLowerCase().includes(c.value.toLowerCase()));
100
100
  })), j = b(() => {
101
101
  const t = Ce(g.value, (s) => s.user.name), e = Object.entries(t).map(([s, r]) => {
102
- const w = F.value.find((y) => y._id === r[0].user.id);
102
+ const y = Y.value.find((w) => w._id === r[0].user.id);
103
103
  return {
104
104
  key: s,
105
105
  user: r[0].user.name,
106
- code: w ? w.code : "",
106
+ code: y ? y.code : "",
107
107
  timesheets: r,
108
- total: Fe(r.reduce((y, p) => y + p.totalMin, 0))
108
+ total: Fe(r.reduce((w, p) => w + p.totalMin, 0))
109
109
  };
110
110
  });
111
111
  return Ve(e, {
@@ -114,32 +114,32 @@ const Re = {
114
114
  }), H = b(() => j.value.filter((t) => {
115
115
  var e;
116
116
  return t.user.toLowerCase().includes(c.value.toLowerCase()) || ((e = t.code) == null ? void 0 : e.toLowerCase().includes(c.value.toLowerCase()));
117
- })), Y = d(!1), N = async () => {
117
+ })), L = d(!1), N = async () => {
118
118
  const {
119
119
  startDate: t,
120
120
  endDate: e
121
- } = L.value;
122
- Y.value = !0;
121
+ } = M.value;
122
+ L.value = !0;
123
123
  try {
124
124
  await h.readTimesheet(new Date(t), new Date(e)), await ge(), U.value = Object.fromEntries(Object.entries(new Array(j.value.length).fill(!0)));
125
125
  } catch (s) {
126
- V.open({
126
+ F.open({
127
127
  title: s instanceof Error ? s.message : `${s}`,
128
128
  type: "error"
129
129
  });
130
130
  } finally {
131
- Y.value = !1;
131
+ L.value = !1;
132
132
  }
133
133
  };
134
- me(() => {
135
- N();
134
+ me(async () => {
135
+ C.employees.value.length === 0 && await C.readEmployees(), N();
136
136
  });
137
- const ee = ye(), E = d(), {
138
- dateRange: L,
137
+ const ee = we(), A = d(), {
138
+ dateRange: M,
139
139
  dateRangeLabel: te,
140
140
  setRange: G
141
141
  } = Te();
142
- X(L, async () => {
142
+ X(M, async () => {
143
143
  N();
144
144
  });
145
145
  const ae = [{
@@ -228,13 +228,13 @@ const Re = {
228
228
  return e.total ? `Total: ${e.total}` : e.duration;
229
229
  },
230
230
  enableSorting: !1
231
- }], M = d(!1);
231
+ }], T = d(!1);
232
232
  function q(t) {
233
- m.value = t, T.value = v(m.value.startedAt).format("YYYY-MM-DD"), I.value = v(m.value.endedAt || m.value.startedAt).format("YYYY-MM-DD"), R.value = v(m.value.startedAt).format("HH:mm"), O.value = v(m.value.endedAt || m.value.startedAt).format("HH:mm"), M.value = !0;
233
+ m.value = t, R.value = v(m.value.startedAt).format("YYYY-MM-DD"), E.value = v(m.value.endedAt || m.value.startedAt).format("YYYY-MM-DD"), I.value = v(m.value.startedAt).format("HH:mm"), O.value = v(m.value.endedAt || m.value.startedAt).format("HH:mm"), T.value = !0;
234
234
  }
235
- const T = d(), R = d(), I = d(), O = d(), m = d(), K = d("");
235
+ const R = d(), I = d(), E = d(), O = d(), m = d(), K = d("");
236
236
  async function se() {
237
- const t = J(T.value, R.value), e = J(I.value, O.value);
237
+ const t = J(R.value, I.value), e = J(E.value, O.value);
238
238
  if (v(t).isAfter(e)) {
239
239
  K.value = a("hr.timesheet.checkOutMustBeforeCheckIn");
240
240
  return;
@@ -243,20 +243,20 @@ const Re = {
243
243
  await h.updateTimesheet(m.value, t, e);
244
244
  }, {
245
245
  successMessage: a("hr.timesheet.update.successMessage")
246
- }), N(), M.value = !1;
246
+ }), N(), T.value = !1;
247
247
  }
248
248
  const J = (t, e) => v(t).set("h", parseInt(e.split(":")[0])).set("m", parseInt(e.split(":")[1])).toISOString();
249
- return X([T, I, R, O], ([t, e, s, r]) => {
249
+ return X([R, E, I, O], ([t, e, s, r]) => {
250
250
  (t || e || s || r) && (K.value = "");
251
251
  }), (t, e) => {
252
- const s = i("FmAvatar"), r = i("FmDatePicker"), w = i("FmTimePicker"), y = i("FmIcon"), p = i("FmButton"), le = i("FmSideSheet"), Q = i("FmChip"), ne = i("FmDateRangePicker"), re = i("FmMenuItem"), ue = i("FmMenu"), ie = i("FmSpacer"), de = i("FmSearch"), W = i("FmTable");
252
+ const s = u("FmAvatar"), r = u("FmDatePicker"), y = u("FmTimePicker"), w = u("FmIcon"), p = u("FmButton"), le = u("FmSideSheet"), Q = u("FmChip"), ne = u("FmDateRangePicker"), re = u("FmMenuItem"), ie = u("FmMenu"), ue = u("FmSpacer"), de = u("FmSearch"), W = u("FmTable");
253
253
  return D(), B(Z, null, [l(le, {
254
- modelValue: M.value,
255
- "onUpdate:modelValue": e[5] || (e[5] = (o) => M.value = o),
254
+ modelValue: T.value,
255
+ "onUpdate:modelValue": e[5] || (e[5] = (o) => T.value = o),
256
256
  "dismiss-away": "",
257
257
  header: n(a)("hr.timesheet.update.title")
258
258
  }, {
259
- "side-sheet-footer": C(() => [u("div", je, [l(p, {
259
+ "side-sheet-footer": V(() => [i("div", je, [l(p, {
260
260
  label: n(a)("common.update"),
261
261
  size: "md",
262
262
  variant: "primary",
@@ -265,48 +265,48 @@ const Re = {
265
265
  label: n(a)("common.cancel"),
266
266
  size: "md",
267
267
  variant: "secondary",
268
- onClick: e[4] || (e[4] = (o) => M.value = !1)
268
+ onClick: e[4] || (e[4] = (o) => T.value = !1)
269
269
  }, null, 8, ["label"])])]),
270
- default: C(() => [u("div", Re, [u("div", Ie, [l(s, {
270
+ default: V(() => [i("div", Re, [i("div", Ie, [l(s, {
271
271
  initials: m.value.user.name,
272
272
  size: "lg"
273
- }, null, 8, ["initials"]), u("div", Oe, [u("div", $e, $(n(a)("hr.timesheet.employeeName")), 1), u("div", Ae, $(m.value.user.name), 1)])]), u("div", Ee, [u("div", Ke, $(n(a)("hr.timesheet.update.checkIn")), 1), u("div", ze, [l(r, {
274
- modelValue: T.value,
275
- "onUpdate:modelValue": e[0] || (e[0] = (o) => T.value = o),
273
+ }, null, 8, ["initials"]), i("div", Ee, [i("div", Oe, $(n(a)("hr.timesheet.employeeName")), 1), i("div", $e, $(m.value.user.name), 1)])]), i("div", Ae, [i("div", Ke, $(n(a)("hr.timesheet.update.checkIn")), 1), i("div", ze, [l(r, {
274
+ modelValue: R.value,
275
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => R.value = o),
276
276
  disabled: !1,
277
277
  label: n(a)("hr.timesheet.update.date")
278
- }, null, 8, ["modelValue", "label"]), l(w, {
279
- modelValue: R.value,
280
- "onUpdate:modelValue": e[1] || (e[1] = (o) => R.value = o),
281
- label: n(a)("hr.timesheet.update.time")
282
- }, null, 8, ["modelValue", "label"])])]), u("div", Ne, [u("div", Ue, $(n(a)("hr.timesheet.update.checkOut")), 1), u("div", Be, [l(r, {
278
+ }, null, 8, ["modelValue", "label"]), l(y, {
283
279
  modelValue: I.value,
284
- "onUpdate:modelValue": e[2] || (e[2] = (o) => I.value = o),
280
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => I.value = o),
281
+ label: n(a)("hr.timesheet.update.time")
282
+ }, null, 8, ["modelValue", "label"])])]), i("div", Ne, [i("div", Ue, $(n(a)("hr.timesheet.update.checkOut")), 1), i("div", Be, [l(r, {
283
+ modelValue: E.value,
284
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => E.value = o),
285
285
  disabled: !1,
286
286
  label: n(a)("hr.timesheet.update.date")
287
- }, null, 8, ["modelValue", "label"]), l(w, {
287
+ }, null, 8, ["modelValue", "label"]), l(y, {
288
288
  modelValue: O.value,
289
289
  "onUpdate:modelValue": e[3] || (e[3] = (o) => O.value = o),
290
290
  label: n(a)("hr.timesheet.update.time")
291
- }, null, 8, ["modelValue", "label"])])]), K.value ? (D(), B("div", Pe, [l(y, {
291
+ }, null, 8, ["modelValue", "label"])])]), K.value ? (D(), B("div", Pe, [l(w, {
292
292
  color: "#FF3B30",
293
293
  name: "error",
294
294
  size: "sm"
295
295
  }), ve(" " + $(K.value), 1)])) : pe("", !0)])]),
296
296
  _: 1
297
- }, 8, ["modelValue", "header"]), u("div", He, [u("div", Ge, [l(n(be), {
298
- modelValue: E.value,
299
- "onUpdate:modelValue": e[6] || (e[6] = (o) => E.value = o),
297
+ }, 8, ["modelValue", "header"]), i("div", He, [i("div", Ge, [l(n(be), {
298
+ modelValue: A.value,
299
+ "onUpdate:modelValue": e[6] || (e[6] = (o) => A.value = o),
300
300
  "managable-only": "",
301
301
  multiple: "",
302
302
  variant: "dark",
303
303
  class: "!w-auto pt-[3px]"
304
- }, null, 8, ["modelValue"]), u("div", qe, [l(ne, {
305
- modelValue: n(L),
306
- "onUpdate:modelValue": e[7] || (e[7] = (o) => fe(L) ? L.value = o : null),
304
+ }, null, 8, ["modelValue"]), i("div", qe, [l(ne, {
305
+ modelValue: n(M),
306
+ "onUpdate:modelValue": e[7] || (e[7] = (o) => fe(M) ? M.value = o : null),
307
307
  "show-predefined-range": ""
308
308
  }, {
309
- "trigger-button": C(() => [l(Q, {
309
+ "trigger-button": V(() => [l(Q, {
310
310
  label: n(te)
311
311
  }, null, 8, ["label"])]),
312
312
  _: 1
@@ -318,25 +318,25 @@ const Re = {
318
318
  icon: "chevron_right",
319
319
  variant: "tertiary",
320
320
  onClick: e[9] || (e[9] = (o) => n(G)("add"))
321
- })]), l(ue, {
321
+ })]), l(ie, {
322
322
  class: "pt-[3px]"
323
323
  }, {
324
- "menu-button": C(() => [l(Q, {
324
+ "menu-button": V(() => [l(Q, {
325
325
  label: _.value,
326
326
  "right-icon": "keyboard_arrow_down"
327
327
  }, null, 8, ["label"])]),
328
- default: C(() => [(D(), B(Z, null, he(k, (o) => l(re, {
328
+ default: V(() => [(D(), B(Z, null, he(k, (o) => l(re, {
329
329
  key: o.value,
330
330
  label: o.label,
331
331
  onClick: (Je) => f.value = o.value
332
332
  }, null, 8, ["label", "onClick"])), 64))]),
333
333
  _: 1
334
- }), l(ie), l(de, {
334
+ }), l(ue), l(de, {
335
335
  modelValue: c.value,
336
336
  "onUpdate:modelValue": e[10] || (e[10] = (o) => c.value = o),
337
337
  class: "w-[320px]",
338
338
  placeholder: n(a)("hr.timesheet.search.placeholder")
339
- }, null, 8, ["modelValue", "placeholder"])]), g.value.length === 0 && !Y.value ? (D(), z(n(Se), {
339
+ }, null, 8, ["modelValue", "placeholder"])]), g.value.length === 0 && !L.value ? (D(), z(n(Se), {
340
340
  key: 0,
341
341
  title: n(a)("hr.timesheet.noData.title"),
342
342
  subtitle: ""
@@ -344,13 +344,13 @@ const Re = {
344
344
  key: 1,
345
345
  class: "w-full xs:px-16 overflow-auto"
346
346
  }, {
347
- default: C(() => [f.value === "listView" ? (D(), z(W, {
347
+ default: V(() => [f.value === "listView" ? (D(), z(W, {
348
348
  key: 0,
349
349
  class: "min-w-[640px]",
350
350
  "column-defs": ae,
351
351
  "row-data": P.value,
352
352
  "page-size": P.value.length,
353
- loading: Y.value,
353
+ loading: L.value,
354
354
  "pin-header-row": "",
355
355
  "hide-footer": "",
356
356
  "shrink-at": !1,
@@ -361,7 +361,7 @@ const Re = {
361
361
  "column-defs": oe,
362
362
  "row-data": H.value,
363
363
  "page-size": g.value.length + H.value.length,
364
- loading: Y.value,
364
+ loading: L.value,
365
365
  "pin-header-row": "",
366
366
  "hide-footer": "",
367
367
  "shrink-at": !1,
@@ -4502,10 +4502,10 @@ const ce = (e) => ({
4502
4502
  }
4503
4503
  ]
4504
4504
  }
4505
- }), Ba = ae(O(() => import("./Main-D9233aXd.js"))), ba = ae(O(() => import("./Main-BSaeTSWh.js"))), pa = ae(
4506
- O(() => import("./AuditLogList-DICsmRKu.js"))
4507
- ), fa = ae(O(() => import("./Main-6YVJ8qeK.js"))), wa = O(() => import("./EmployeeList-BeTBQG6y.js")), Ma = O(() => import("./RoleList-BwZRlJSm.js")), ya = O(() => import("./TimesheetList-HsH2fi2o.js")), Da = O(() => import("./TeamMemberList-DqMVgyU0.js")), va = O(
4508
- () => import("./PermissionSetList-vA7XmeDX.js")
4505
+ }), Ba = ae(O(() => import("./Main-6td6JhCb.js"))), ba = ae(O(() => import("./Main-Bu-UNnSQ.js"))), pa = ae(
4506
+ O(() => import("./AuditLogList-C7QcWwHq.js"))
4507
+ ), fa = ae(O(() => import("./Main-BhNhmkn8.js"))), wa = O(() => import("./EmployeeList-CQzS4gXV.js")), Ma = O(() => import("./RoleList-Cziztrpo.js")), ya = O(() => import("./TimesheetList-D_JT5iyS.js")), Da = O(() => import("./TeamMemberList-DwxhZcrA.js")), va = O(
4508
+ () => import("./PermissionSetList-IG15Aj5D.js")
4509
4509
  ), Pa = [
4510
4510
  {
4511
4511
  path: "/",
package/dist/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, i as r, r as o } from "./app-CvSQBSNk.js";
1
+ import { a as e, i as r, r as o } from "./app-h2mRYtCE.js";
2
2
  export {
3
3
  e as FmApp,
4
4
  r as i18nMessages,
@@ -1,4 +1,4 @@
1
- import { g as Q, c as K } from "./app-CvSQBSNk.js";
1
+ import { g as Q, c as K } from "./app-h2mRYtCE.js";
2
2
  var E = { exports: {} };
3
3
  (function(V, X) {
4
4
  (function(W, k) {
@@ -0,0 +1,232 @@
1
+ import { d as _ } from "./dayjs.min-QbzmY4D1.js";
2
+ import { defineStore as A, storeToRefs as x } from "pinia";
3
+ import { ref as E } from "vue";
4
+ import { useCoreStore as h } from "@feedmepos/mf-common";
5
+ import { b as n, g as p, s as M } from "./iteration-J_5O7DIo.js";
6
+ import { t as z, i as P } from "./index-BLm_-G4e.js";
7
+ import { u as N } from "./useAppStore-CEidzV7L.js";
8
+ const l = {
9
+ async readEmployees() {
10
+ return p(await n().get("/pos-users"));
11
+ },
12
+ async readEmployeesPage(e) {
13
+ var t, i;
14
+ return p(
15
+ await n().get("/pos-users/paged", {
16
+ params: {
17
+ limit: e.limit,
18
+ offset: e.offset,
19
+ search: e.search,
20
+ restaurantIds: (t = e.restaurantIds) != null && t.length ? e.restaurantIds : void 0,
21
+ roleIds: (i = e.roleIds) != null && i.length ? e.roleIds : void 0
22
+ }
23
+ })
24
+ );
25
+ },
26
+ async createEmployee(e) {
27
+ return p(await n().post("/pos-users", e));
28
+ },
29
+ async createMasterEmployee(e) {
30
+ return p(await n().post("/pos-users/master-user", e));
31
+ },
32
+ async migrateToMasterEmployee(e, t) {
33
+ return p(
34
+ await n().put(`/pos-users/migrate/${e}`, t)
35
+ );
36
+ },
37
+ async updateEmployee(e, t) {
38
+ return p(await n().put(`/pos-users/${e}`, t));
39
+ },
40
+ async updateMasterEmployee(e, t) {
41
+ return p(
42
+ await n().put(`/pos-users/master-user/${e}`, t)
43
+ );
44
+ },
45
+ async deleteEmployee(e) {
46
+ return p(
47
+ await n().put(`/pos-users/${e._id}`, {
48
+ user: e,
49
+ roles: [],
50
+ previousRoles: e.restaurants.map((t) => ({
51
+ restaurantId: t.restaurantId,
52
+ roleId: t.roleId
53
+ }))
54
+ })
55
+ );
56
+ },
57
+ async deleteMasterEmployee(e) {
58
+ return p(
59
+ await n().put(`/pos-users/master-user/${e._id}`, {
60
+ user: e,
61
+ roles: [],
62
+ previousRoles: e.restaurants.map((t) => ({
63
+ restaurantId: t.restaurantId,
64
+ roleId: t.roleId
65
+ }))
66
+ })
67
+ );
68
+ },
69
+ async generateEmployeePasscode() {
70
+ return `${p(
71
+ await n().get("/pos-users/generate-passcode")
72
+ )}`;
73
+ },
74
+ async syncUsersMeta() {
75
+ await n().post("/pos-users/create-users-meta");
76
+ }
77
+ };
78
+ async function m(e) {
79
+ const t = N().roles.value, { restaurants: i } = h(), c = new Map(
80
+ i.value.map((a) => [a._id, a.profile.name])
81
+ ), d = new Map(t.map((a) => [a._id, a.name])), o = /* @__PURE__ */ new Map();
82
+ for (const a of e) {
83
+ const f = {
84
+ restaurantId: a.restaurantId,
85
+ restaurantName: c.get(a.restaurantId) || "",
86
+ roleId: a.role,
87
+ roleName: d.get(a.role) || ""
88
+ }, y = o.get(a._id);
89
+ if (!y) {
90
+ o.set(a._id, {
91
+ ...a,
92
+ since: _(P(a._id)).format("DD/MM/YYYY"),
93
+ restaurants: [f]
94
+ });
95
+ continue;
96
+ }
97
+ y.restaurants.some((w) => w.restaurantId === a.restaurantId) || (y.restaurants = M([...y.restaurants, f], {
98
+ selector: "restaurantName"
99
+ }));
100
+ }
101
+ return M([...o.values()], { selector: "name" });
102
+ }
103
+ function v(e) {
104
+ const { restaurants: t } = h(), i = N().roles.value, c = new Map(
105
+ t.value.map((a) => [a._id, a.profile.name])
106
+ ), d = new Map(i.map((a) => [a._id, a.name])), o = e.restaurantRole[0];
107
+ return {
108
+ _id: e._id,
109
+ name: e.name,
110
+ code: e.code,
111
+ passcode: e.passcode,
112
+ isMasterUser: e.isMasterUser,
113
+ restaurantId: (o == null ? void 0 : o.restaurantId) || "",
114
+ role: (o == null ? void 0 : o.roleId) || "",
115
+ since: _(P(e._id)).format("DD/MM/YYYY"),
116
+ restaurants: M(
117
+ e.restaurantRole.map((a) => ({
118
+ restaurantId: a.restaurantId,
119
+ restaurantName: c.get(a.restaurantId) || "",
120
+ roleId: a.roleId,
121
+ roleName: d.get(a.roleId) || ""
122
+ })),
123
+ { selector: "restaurantName" }
124
+ )
125
+ };
126
+ }
127
+ const C = A("employee", () => {
128
+ const e = E([]), t = E([]), i = E(0), c = E(!1), d = E([]);
129
+ async function o() {
130
+ try {
131
+ c.value = !0;
132
+ const s = await l.readEmployees();
133
+ e.value = await m(s);
134
+ } catch (s) {
135
+ console.log("Error reading employees:", s);
136
+ } finally {
137
+ c.value = !1;
138
+ }
139
+ }
140
+ async function a(s) {
141
+ try {
142
+ c.value = !0;
143
+ const r = await l.readEmployeesPage(s);
144
+ t.value = r.items.map(v), i.value = r.total;
145
+ } catch (r) {
146
+ console.log("Error reading employee page:", r);
147
+ } finally {
148
+ c.value = !1;
149
+ }
150
+ }
151
+ async function f(s) {
152
+ const u = [];
153
+ let I = 0;
154
+ for (; ; ) {
155
+ const g = await l.readEmployeesPage({
156
+ ...s,
157
+ limit: 200,
158
+ offset: I
159
+ });
160
+ if (u.push(...g.items.map(v)), I += g.items.length, I >= g.total || g.items.length === 0)
161
+ break;
162
+ }
163
+ return u;
164
+ }
165
+ async function y(s) {
166
+ const r = await l.createEmployee(s);
167
+ e.value = await m(r);
168
+ }
169
+ async function w(s, r) {
170
+ const u = await l.updateEmployee(s, r);
171
+ e.value = await m(u);
172
+ }
173
+ async function S(s) {
174
+ const r = await l.deleteEmployee(s);
175
+ e.value = await m(r);
176
+ }
177
+ async function U(s) {
178
+ const r = await l.deleteMasterEmployee(s);
179
+ e.value = await m(r);
180
+ }
181
+ async function Y(s) {
182
+ const r = await l.createMasterEmployee(s);
183
+ e.value = await m(r);
184
+ }
185
+ async function T(s, r) {
186
+ const u = await l.updateMasterEmployee(s, r);
187
+ e.value = await m(u);
188
+ }
189
+ async function b(s, r) {
190
+ const u = await l.migrateToMasterEmployee(s, r);
191
+ e.value = await m(u);
192
+ }
193
+ async function D() {
194
+ try {
195
+ d.value = await z.readTeamMemberPosUserIds();
196
+ } catch (s) {
197
+ console.log("Error reading team member pos user ids:", s);
198
+ }
199
+ }
200
+ async function $() {
201
+ await l.syncUsersMeta();
202
+ }
203
+ return {
204
+ employees: e,
205
+ listEmployees: t,
206
+ totalEmployees: i,
207
+ restrictEmployeeIds: d,
208
+ isLoading: c,
209
+ readEmployees: o,
210
+ readEmployeesPage: a,
211
+ readAllEmployeesPage: f,
212
+ createEmployee: y,
213
+ updateEmployee: w,
214
+ deleteEmployee: S,
215
+ createMasterEmployee: Y,
216
+ updateMasterEmployee: T,
217
+ deleteMasterEmployee: U,
218
+ migrateToMasterUser: b,
219
+ readTeamMemberPosUserIds: D,
220
+ syncUsersMeta: $
221
+ };
222
+ }), J = () => {
223
+ const e = C();
224
+ return {
225
+ ...e,
226
+ ...x(e)
227
+ };
228
+ };
229
+ export {
230
+ l as E,
231
+ J as u
232
+ };