@feedmepos/mf-hrm-portal 2.3.2-dev.7 → 2.3.2-dev.8

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 (61) hide show
  1. package/dist/{ApprovalCodeList-Bw0E-hZl.js → ApprovalCodeList-DIYhVMGW.js} +7 -7
  2. package/dist/{AuditLogList-CA-_t77n.js → AuditLogList-DIc3Jgpr.js} +795 -719
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-LtjNCAFN.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-4YsF7lXu.js} +2 -2
  4. package/dist/{EmployeeList-D_bX0EhQ.js → EmployeeList-iVg4pI9Y.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-CyZxQa-b.js → FormSection.vue_vue_type_script_setup_true_lang-C9AE0EHw.js} +1 -1
  6. package/dist/{GrantUserList-Cg7ITk_M.js → GrantUserList-8zmzFk9z.js} +8 -8
  7. package/dist/{Main-D5wi42fp.js → Main-ClJox3pV.js} +10 -10
  8. package/dist/{Main-Bl-Ocx1G.js → Main-DYzFd_qa.js} +5 -5
  9. package/dist/{Main-BaB4vgI5.js → Main-gRu17-N6.js} +1005 -999
  10. package/dist/{MyPosProfile-CUG_201f.js → MyPosProfile-ARRrolbz.js} +1 -1
  11. package/dist/{PermissionSetList-kgG9H3DX.js → PermissionSetList-CL42jQY4.js} +13 -12
  12. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-y1YcZpGA.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DkA0XbZw.js} +648 -647
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-fQyCtDXM.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-CA87qQ4b.js} +1 -1
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-3Q8udk43.js → RoleForm.vue_vue_type_script_setup_true_lang-B3N3hTcU.js} +9 -9
  15. package/dist/{RoleList-Cmz97HHP.js → RoleList-F9ZORhgE.js} +7 -7
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CggEy3OI.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-B9NMhw9Z.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-B39k3SQH.js → ScheduleGeneralPage-751cEUwS.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-C5j3D4eF.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CBDNfiIM.js} +4 -4
  19. package/dist/{SchedulePage-AVmRkFi1.js → SchedulePage-C-NcbGIl.js} +189 -201
  20. package/dist/{SchedulePositionPage-3rE-O8CG.js → SchedulePositionPage-Ba0iiSRg.js} +3 -3
  21. package/dist/{SelectFilter-R7ry_GEg.js → SelectFilter-Dpsq165k.js} +1 -1
  22. package/dist/{TeamMemberList-CvDnIILn.js → TeamMemberList-DZ0aRbxg.js} +28 -27
  23. package/dist/TimesheetList-DO5T__dL.js +437 -0
  24. package/dist/{app-DKUCzcrc.js → app-DXkKrcRn.js} +38 -10
  25. package/dist/app.js +1 -1
  26. package/dist/{approval-code-nsETgIry.js → approval-code-D2pGW-sI.js} +4 -4
  27. package/dist/{dayjs.min-CtULWW1N.js → dayjs.min-BAz84JAQ.js} +1 -1
  28. package/dist/employee-yYhuhc9L.js +172 -0
  29. package/dist/{grant-user-Dpa_Rl6j.js → grant-user-B95RDjkR.js} +2 -2
  30. package/dist/{iteration-DpHBtiyr.js → index-TrBkLxJe.js} +698 -726
  31. package/dist/iteration-CcXrOMQe.js +30 -0
  32. package/dist/{lodash-YaHCUo_F.js → lodash-DXRsZpTB.js} +1 -1
  33. package/dist/{member-grant-CEokFI3_.js → member-grant-ByAQ1Qja.js} +2 -2
  34. package/dist/{restaurant-CDFKqEFm.js → restaurant-COSpCpTQ.js} +2 -2
  35. package/dist/{role-DyBVVlEA.js → role-ZmCd2yG4.js} +8 -7
  36. package/dist/{rule-xErZqYmH.js → rule-Bty9eoI3.js} +38 -37
  37. package/dist/src/api/audit-log/index.d.ts +2 -0
  38. package/dist/src/api/employee/index.d.ts +1 -2
  39. package/dist/src/stores/approval-code.d.ts +1 -1
  40. package/dist/src/stores/employee.d.ts +3 -9
  41. package/dist/src/stores/grant-user.d.ts +1 -1
  42. package/dist/src/stores/permission-assignment.d.ts +2 -2
  43. package/dist/src/stores/permission-set.d.ts +2 -2
  44. package/dist/src/stores/restaurant.d.ts +2 -2
  45. package/dist/src/stores/role.d.ts +2 -2
  46. package/dist/src/stores/team.d.ts +1 -1
  47. package/dist/src/stores/timesheet.d.ts +62 -47
  48. package/dist/src/types/timesheet.d.ts +3 -0
  49. package/dist/src/views/audit-log/locales/index.d.ts +28 -0
  50. package/dist/src/views/audit-log/useTraceIdDeepLink.d.ts +19 -0
  51. package/dist/style.css +1 -1
  52. package/dist/timesheet-CFD6XPiG.js +76 -0
  53. package/dist/tsconfig.app.tsbuildinfo +1 -1
  54. package/dist/{useAppStore-BqsvPsPB.js → useAppStore-7O0GMkXY.js} +1 -1
  55. package/dist/{useLoading-BS1bnZg1.js → useLoading-BZXydjer.js} +1 -1
  56. package/dist/useMessage-_ywT_N9X.js +17 -0
  57. package/dist/{useReportPermissions-DJEhkyGc.js → useReportPermissions-Cn3ntCJ9.js} +3 -3
  58. package/package.json +3 -3
  59. package/dist/TimesheetList-DYoglTi8.js +0 -401
  60. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_d0c6fd51_lang-DBpzyQ17.js +0 -63
  61. package/dist/employee-DlsSqR3i.js +0 -210
@@ -2,9 +2,9 @@ import { defineComponent as S, ref as x, onMounted as N, computed as z, createEl
2
2
  import { useRouter as B } from "vue-router";
3
3
  import { useSnackbar as I } from "@feedmepos/ui-library";
4
4
  import { useI18n as O } from "@feedmepos/mf-common";
5
- import { R as L, a as T } from "./app-DKUCzcrc.js";
6
- import { aA as U, aB as H, ai as R, av as h, ax as j } from "./ScheduleModal.vue_vue_type_script_setup_true_lang-C5j3D4eF.js";
7
- import { u as K, a as q, _ as Q } from "./ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CggEy3OI.js";
5
+ import { R as L, a as T } from "./app-DXkKrcRn.js";
6
+ import { aA as U, aB as H, ai as R, av as h, ax as j } from "./ScheduleModal.vue_vue_type_script_setup_true_lang-CBDNfiIM.js";
7
+ import { u as K, a as q, _ as Q } from "./ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-B9NMhw9Z.js";
8
8
  const W = { class: "main" }, G = {
9
9
  id: "viewPositions",
10
10
  class: "view"
@@ -1,7 +1,7 @@
1
1
  import { ref as $, computed as v, defineComponent as X, watch as Y, nextTick as Z, resolveComponent as F, createElementBlock as d, openBlock as c, createElementVNode as A, createVNode as b, renderSlot as z, withCtx as O, createCommentVNode as x, normalizeStyle as ee, Fragment as S, createBlock as T, unref as k, renderList as R, toDisplayString as N, normalizeClass as le, withModifiers as te } from "vue";
2
2
  import "@feedmepos/ui-library";
3
3
  /* empty css */
4
- import { a as ae } from "./app-DKUCzcrc.js";
4
+ import { a as ae } from "./app-DXkKrcRn.js";
5
5
  function ue(r, u, _ = r) {
6
6
  const t = $(!0), C = v(() => {
7
7
  if (!t.value && !u.value)
@@ -2,23 +2,24 @@ import { defineComponent as oe, mergeModels as Qt, useModel as es, createElement
2
2
  import { useI18n as ce, useCoreStore as Xe } from "@feedmepos/mf-common";
3
3
  import { useSnackbar as ot, useDialog as Rt, useBreakpoints as $t, components as Qe, SnackbarPosition as et } from "@feedmepos/ui-library";
4
4
  import { u as ls } from "./useDebounce-B8ZPVS5C.js";
5
- import { S as ie } from "./SelectFilter-R7ry_GEg.js";
6
- import { g as be, b as ye, a as Ct, v as ft, k as os, _ as rs, c as ns } from "./app-DKUCzcrc.js";
5
+ import { S as ie } from "./SelectFilter-Dpsq165k.js";
6
+ import { g as be, b as ye, a as Ct, v as ft, k as os, _ as rs, c as ns } from "./app-DXkKrcRn.js";
7
7
  import { _ as bt } from "./ResponsiveContextMenu.vue_vue_type_script_setup_true_lang-mSJFKo7r.js";
8
8
  import { _ as is } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
9
9
  import { s as us, _ as ms, d as ds, e as cs } from "./PasscodePinField.vue_vue_type_script_setup_true_lang-TXPEqa46.js";
10
- import { u as Dt } from "./useLoading-BS1bnZg1.js";
10
+ import { u as Dt } from "./useLoading-BZXydjer.js";
11
11
  import { u as ps } from "./useDiscardConfirm-CzZSPyvh.js";
12
- import { w as vs, h as fs, b as bs, E as ys, t as gs } from "./member-grant-CEokFI3_.js";
13
- import { a as Ye, i as rt, t as Me, b as He, D as Nt, E as Et, h as Te, u as hs, s as yt, c as ze, d as xs, e as gt } from "./PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-fQyCtDXM.js";
12
+ import { w as vs, h as fs, b as bs, E as ys, t as gs } from "./member-grant-ByAQ1Qja.js";
13
+ import { a as Ye, i as rt, t as Me, b as He, D as Nt, E as Et, h as Te, u as hs, s as yt, c as ze, d as xs, e as gt } from "./PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-CA87qQ4b.js";
14
14
  import { n as nt } from "./string-DZQ1uNjn.js";
15
- import { c as Ve } from "./iteration-DpHBtiyr.js";
16
- import { l as Le } from "./lodash-YaHCUo_F.js";
17
- import { _ as ht } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-y1YcZpGA.js";
18
- import { t as Pe, u as At, y as tt, q as xt, P as st, a as Ot, p as _t, E as _s, b as Ut, c as Us } from "./rule-xErZqYmH.js";
19
- import { t as Is, s as ws, a as It, c as ks, r as Ss, b as Vs, d as wt, _ as Ps, p as Ms } from "./RoleForm.vue_vue_type_script_setup_true_lang-3Q8udk43.js";
20
- import { u as Lt } from "./restaurant-CDFKqEFm.js";
21
- import { u as Tt } from "./role-DyBVVlEA.js";
15
+ import "./index-TrBkLxJe.js";
16
+ import { l as Le } from "./lodash-DXRsZpTB.js";
17
+ import { _ as ht } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DkA0XbZw.js";
18
+ import { t as Ve, u as At, y as tt, q as xt, P as st, a as Ot, p as _t, E as _s, b as Ut, c as Us } from "./rule-Bty9eoI3.js";
19
+ import { t as Is, s as ws, a as It, c as ks, r as Ss, b as Vs, d as wt, _ as Ps, p as Ms } from "./RoleForm.vue_vue_type_script_setup_true_lang-B3N3hTcU.js";
20
+ import { c as Pe } from "./iteration-CcXrOMQe.js";
21
+ import { u as Lt } from "./restaurant-COSpCpTQ.js";
22
+ import { u as Tt } from "./role-ZmCd2yG4.js";
22
23
  var Ee = /* @__PURE__ */ ((l) => (l.Update = "Update", l.Remove = "Remove", l))(Ee || {});
23
24
  const Be = "__unassigned__";
24
25
  function kt(l) {
@@ -536,7 +537,7 @@ const Fs = {
536
537
  }
537
538
  function _(y, d) {
538
539
  if (!v.modelValue || y === "passcode" && v.modelValue.passcode === d) return;
539
- const h = Ve(v.modelValue);
540
+ const h = Pe(v.modelValue);
540
541
  h[y] = d, t("update:model-value", h);
541
542
  }
542
543
  const H = c(!1), C = I(() => O.value.length > 0);
@@ -544,7 +545,7 @@ const Fs = {
544
545
  if (C.value)
545
546
  try {
546
547
  const y = await $.custom(
547
- () => Pe.generateMasterUserPasscode({
548
+ () => Ve.generateMasterUserPasscode({
548
549
  restaurantIds: O.value,
549
550
  excludePosUserId: v.posUserId
550
551
  }),
@@ -719,10 +720,10 @@ const Fs = {
719
720
  )
720
721
  ),
721
722
  (n == null ? void 0 : n.permissions) || []
722
- ), k.value = n != null && n.posUser ? X(Ve(n.posUser), P.value) : void 0, x.value = !!k.value, U.value = fs(P.value, M.value), W.value = {
723
+ ), k.value = n != null && n.posUser ? X(Pe(n.posUser), P.value) : void 0, x.value = !!k.value, U.value = fs(P.value, M.value), W.value = {
723
724
  permissionSetIds: [...M.value],
724
- userPermissions: Ve(P.value),
725
- posUser: k.value ? Ve(k.value) : void 0
725
+ userPermissions: Pe(P.value),
726
+ posUser: k.value ? Pe(k.value) : void 0
726
727
  };
727
728
  }
728
729
  function ne() {
@@ -784,7 +785,7 @@ const Fs = {
784
785
  if (!n) return n;
785
786
  const J = Ut(R, { isOwner: y.value }), { roleIds: pe, restaurantIds: he } = J;
786
787
  if (pe === null && he === null) return n;
787
- const ve = Ve(n);
788
+ const ve = Pe(n);
788
789
  return ve.roles = ve.roles.filter(
789
790
  (Z) => (pe === null || pe.includes(Z.roleId)) && (he === null || he.includes(Z.restaurantId))
790
791
  ), ve;
@@ -805,9 +806,9 @@ const Fs = {
805
806
  N.value = !1, re(n);
806
807
  return;
807
808
  }
808
- n.posUser !== void 0 && !N.value && (k.value = n.posUser ? X(Ve(n.posUser), P.value) : void 0, W.value = {
809
+ n.posUser !== void 0 && !N.value && (k.value = n.posUser ? X(Pe(n.posUser), P.value) : void 0, W.value = {
809
810
  ...W.value,
810
- posUser: k.value ? Ve(k.value) : void 0
811
+ posUser: k.value ? Pe(k.value) : void 0
811
812
  });
812
813
  },
813
814
  { immediate: !0 }
@@ -1263,7 +1264,7 @@ const Fs = {
1263
1264
  var ae = /* @__PURE__ */ function(l) {
1264
1265
  return l[l.ADD = 0] = "ADD", l[l.UPDATE = 1] = "UPDATE", l[l.CLOSED = 2] = "CLOSED", l;
1265
1266
  }(ae || {});
1266
- const Fl = /* @__PURE__ */ oe({
1267
+ const Rl = /* @__PURE__ */ oe({
1267
1268
  __name: "TeamMemberList",
1268
1269
  setup(l, {
1269
1270
  expose: A
@@ -1537,7 +1538,7 @@ const Fl = /* @__PURE__ */ oe({
1537
1538
  const a = ++ee;
1538
1539
  X.value = null, Z.value = z(e), J.value = ae.UPDATE, ge.value = e.doc.hasPosUser === !0;
1539
1540
  try {
1540
- const g = await Pe.readTeamMember(e.id);
1541
+ const g = await Ve.readTeamMember(e.id);
1541
1542
  if (a !== ee) return;
1542
1543
  Z.value = S(g);
1543
1544
  } catch {
@@ -1557,7 +1558,7 @@ const Fl = /* @__PURE__ */ oe({
1557
1558
  }
1558
1559
  const a = ++ee;
1559
1560
  try {
1560
- const g = await Pe.readTeamMember(e.id);
1561
+ const g = await Ve.readTeamMember(e.id);
1561
1562
  if (a !== ee) return;
1562
1563
  await je(g);
1563
1564
  } catch {
@@ -1606,7 +1607,7 @@ const Fl = /* @__PURE__ */ oe({
1606
1607
  }
1607
1608
  }).onPrimary(async () => {
1608
1609
  Se.value || (await H.minor(async () => {
1609
- await Pe.deleteTeamMember(e.id), await ke();
1610
+ await Ve.deleteTeamMember(e.id), await ke();
1610
1611
  }, {
1611
1612
  isLoading: Se,
1612
1613
  successMessage: t("team.removeMember.successMessage", {
@@ -1729,7 +1730,7 @@ const Fl = /* @__PURE__ */ oe({
1729
1730
  var a, g, w;
1730
1731
  B.value = !0;
1731
1732
  try {
1732
- const Y = await Pe.readTeamMembersPage({
1733
+ const Y = await Ve.readTeamMembersPage({
1733
1734
  limit: Ne,
1734
1735
  offset: (e - 1) * Ne,
1735
1736
  search: j.value.trim() || void 0,
@@ -1832,7 +1833,7 @@ const Fl = /* @__PURE__ */ oe({
1832
1833
  }
1833
1834
  const g = a ? null : me.value.readEdits();
1834
1835
  await H.minor(async () => {
1835
- await (a ? Pe.createTeamMember(e) : Pe.updateTeamMember(Z.value.id, {
1836
+ await (a ? Ve.createTeamMember(e) : Ve.updateTeamMember(Z.value.id, {
1836
1837
  ...gs(e, Z.value.posUser),
1837
1838
  // '' clears it; the owner's sheet has no field, so it is left out
1838
1839
  ...g ? {
@@ -2082,5 +2083,5 @@ const Fl = /* @__PURE__ */ oe({
2082
2083
  }
2083
2084
  });
2084
2085
  export {
2085
- Fl as default
2086
+ Rl as default
2086
2087
  };
@@ -0,0 +1,437 @@
1
+ import { ref as m, computed as v, defineComponent as fe, onMounted as pe, watch as X, resolveComponent as d, createElementBlock as P, openBlock as L, Fragment as Z, createVNode as s, createElementVNode as i, unref as n, withCtx as w, createCommentVNode as ve, toDisplayString as T, createTextVNode as he, isRef as ge, renderList as De, createBlock as ee, nextTick as we } from "vue";
2
+ import { d as l } from "./dayjs.min-BAz84JAQ.js";
3
+ import { useI18n as Ye } from "@feedmepos/mf-common";
4
+ import { useSnackbar as be, components as ye } from "@feedmepos/ui-library";
5
+ import { S as _e } from "./SelectFilter-Dpsq165k.js";
6
+ import { _ as Me } from "./app-DXkKrcRn.js";
7
+ import { _ as xe } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
+ import { u as ke } from "./useLoading-BZXydjer.js";
9
+ import { g as Se, s as Ve } from "./iteration-CcXrOMQe.js";
10
+ import { f as Ce } from "./utils-BZkjJbju.js";
11
+ import { n as Fe } from "./string-DZQ1uNjn.js";
12
+ import { u as Le } from "./restaurant-COSpCpTQ.js";
13
+ import { u as Te } from "./timesheet-CFD6XPiG.js";
14
+ function Oe(Y, a) {
15
+ return ["years", "months"].find((y) => {
16
+ const _ = Y.startOf(y), p = Y.endOf(y);
17
+ return Y.isSame(_, "day") && a.isSame(p, "day");
18
+ }) || "days";
19
+ }
20
+ function Re() {
21
+ const Y = {
22
+ startDate: l().format("YYYY-MM-DD"),
23
+ endDate: l().format("YYYY-MM-DD")
24
+ }, a = m(Y), b = v(() => {
25
+ if (!a.value) return "No dates selected.";
26
+ const p = a.value.startDate ?? "Start", g = a.value.endDate ?? "End";
27
+ return `${p} - ${g}`;
28
+ }), y = v(() => ({
29
+ startDate: new Date(a.value.startDate),
30
+ endDate: new Date(a.value.endDate)
31
+ }));
32
+ function _(p) {
33
+ const g = l(a.value.startDate), c = l(a.value.endDate), h = Oe(g, c), M = h === "days" ? c.diff(g, "days") + 1 : 1, O = p === "subtract" ? (D) => D.subtract(M, h) : (D) => D.add(M, h);
34
+ a.value = {
35
+ startDate: O(g).startOf(h).format("YYYY-MM-DD"),
36
+ endDate: O(c).endOf(h).format("YYYY-MM-DD")
37
+ };
38
+ }
39
+ return { dateRange: a, parsedDateRange: y, dateRangeLabel: b, setRange: _ };
40
+ }
41
+ const Ie = {
42
+ class: "my-16 flex w-[350px] flex-col gap-40"
43
+ }, $e = {
44
+ class: "flex gap-16"
45
+ }, Ae = {
46
+ class: "flex flex-col gap-4"
47
+ }, Ee = {
48
+ class: "fm-typo-body-md-400 text-fm-color-typo-secondary"
49
+ }, Ke = {
50
+ class: "fm-typo-body-md-700 text-fm-color-typo-primary"
51
+ }, Ne = {
52
+ class: "flex flex-col gap-8"
53
+ }, Ue = {
54
+ class: "fm-typo-body-xl-700"
55
+ }, ze = {
56
+ class: "flex flex-col gap-24"
57
+ }, Be = {
58
+ class: "flex flex-col gap-8"
59
+ }, Pe = {
60
+ class: "fm-typo-body-xl-700"
61
+ }, je = {
62
+ class: "flex flex-col gap-24"
63
+ }, He = {
64
+ key: 0,
65
+ class: "fm-typo-body-sm-400 text-fm-color-typo-error mt-1 flex items-center gap-4"
66
+ }, Ge = {
67
+ class: "flex items-center justify-start gap-8"
68
+ }, qe = {
69
+ class: "space-y-8"
70
+ }, Je = {
71
+ class: "flex items-start gap-8 flex-wrap xs:px-16"
72
+ }, Qe = {
73
+ class: "flex items-center gap-8"
74
+ }, We = {
75
+ class: "flex h-full flex-col overflow-auto"
76
+ }, ct = /* @__PURE__ */ fe({
77
+ __name: "TimesheetList",
78
+ setup(Y) {
79
+ const {
80
+ t: a
81
+ } = Ye(), b = be(), y = ke(b), _ = [{
82
+ label: a("hr.timesheet.listView"),
83
+ value: "listView"
84
+ }, {
85
+ label: a("hr.timesheet.userView"),
86
+ value: "userView"
87
+ }], p = m("listView"), g = v(() => {
88
+ var t;
89
+ return (t = _.find((e) => e.value === p.value)) == null ? void 0 : t.label;
90
+ }), c = m(""), h = Te(), M = Le(), O = v(() => new Map(M.restaurants.value.map((t) => [t._id, t.profile.code]))), D = v(() => h.timesheets.value.map((r) => {
91
+ const u = O.value.get(r.restaurantId);
92
+ return {
93
+ ...r,
94
+ restaurantCode: u
95
+ };
96
+ })), R = v(() => D.value.filter((t) => {
97
+ var e, r;
98
+ 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())) || ((r = t.user.code) == null ? void 0 : r.toLowerCase().includes(c.value.toLowerCase()));
99
+ })), j = v(() => {
100
+ const t = Se(D.value, (r) => r.user.name), e = Object.entries(t).map(([r, u]) => ({
101
+ key: r,
102
+ user: u[0].user.name,
103
+ code: u[0].user.code || "",
104
+ timesheets: u,
105
+ total: Ce(u.reduce((A, B) => A + B.totalMin, 0))
106
+ }));
107
+ return Ve(e, {
108
+ selector: "user"
109
+ });
110
+ }), H = v(() => j.value.filter((t) => {
111
+ var e;
112
+ return t.user.toLowerCase().includes(c.value.toLowerCase()) || ((e = t.code) == null ? void 0 : e.toLowerCase().includes(c.value.toLowerCase()));
113
+ })), K = m(!1), N = v(() => K.value && D.value.length === 0), U = async () => {
114
+ const {
115
+ startDate: t,
116
+ endDate: e
117
+ } = x.value;
118
+ K.value = !0;
119
+ try {
120
+ await h.readTimesheet(new Date(t), new Date(e), I.value), await we(), z.value = Object.fromEntries(Object.entries(new Array(j.value.length).fill(!0)));
121
+ } catch (r) {
122
+ b.open({
123
+ title: r instanceof Error ? r.message : `${r}`,
124
+ type: "error"
125
+ });
126
+ } finally {
127
+ K.value = !1;
128
+ }
129
+ };
130
+ pe(async () => {
131
+ try {
132
+ await M.readRestaurants();
133
+ } catch (t) {
134
+ console.error("Failed to load timesheet dependencies:", t), b.open({
135
+ message: t instanceof Error ? t.message : String(t),
136
+ type: "error"
137
+ });
138
+ }
139
+ U();
140
+ });
141
+ const I = m(), te = v(() => M.restaurants.value.filter((t) => t.managable).map((t) => ({
142
+ label: `${t.profile.code ? `${t.profile.code} - ` : ""}${t.profile.name}`,
143
+ value: t._id
144
+ }))), {
145
+ dateRange: x,
146
+ dateRangeLabel: ae,
147
+ setRange: G
148
+ } = Re(), oe = [{
149
+ label: "Today",
150
+ value: {
151
+ startDate: l().format("YYYY-MM-DD"),
152
+ endDate: l().format("YYYY-MM-DD")
153
+ }
154
+ }, {
155
+ label: "Yesterday",
156
+ value: {
157
+ startDate: l().subtract(1, "day").format("YYYY-MM-DD"),
158
+ endDate: l().subtract(1, "day").format("YYYY-MM-DD")
159
+ }
160
+ }, {
161
+ label: "This week",
162
+ value: {
163
+ startDate: l().startOf("week").format("YYYY-MM-DD"),
164
+ endDate: l().endOf("week").format("YYYY-MM-DD")
165
+ }
166
+ }, {
167
+ label: "Last week",
168
+ value: {
169
+ startDate: l().subtract(1, "week").startOf("week").format("YYYY-MM-DD"),
170
+ endDate: l().subtract(1, "week").endOf("week").format("YYYY-MM-DD")
171
+ }
172
+ }, {
173
+ label: "Last 7 days",
174
+ value: {
175
+ startDate: l().subtract(7, "day").format("YYYY-MM-DD"),
176
+ endDate: l().subtract(1, "day").format("YYYY-MM-DD")
177
+ }
178
+ }, {
179
+ label: "This month",
180
+ value: {
181
+ startDate: l().startOf("month").format("YYYY-MM-DD"),
182
+ endDate: l().endOf("month").format("YYYY-MM-DD")
183
+ }
184
+ }, {
185
+ label: "Last month",
186
+ value: {
187
+ startDate: l().subtract(1, "month").startOf("month").format("YYYY-MM-DD"),
188
+ endDate: l().subtract(1, "month").endOf("month").format("YYYY-MM-DD")
189
+ }
190
+ }];
191
+ X([x, I], async () => {
192
+ U();
193
+ });
194
+ const se = [{
195
+ accessorKey: "user.code",
196
+ size: 100,
197
+ header: () => a("hr.employee.columns.code"),
198
+ cell: (t) => t.row.original.user.code || "--",
199
+ enableSorting: !0
200
+ }, {
201
+ accessorKey: "user",
202
+ header: () => a("hr.timesheet.columns.name"),
203
+ cell: (t) => t.row.original.user.name,
204
+ enableSorting: !1
205
+ }, {
206
+ accessorKey: "restaurantName",
207
+ header: () => a("hr.timesheet.columns.restaurant"),
208
+ cell: (t) => {
209
+ const e = t.row.original.restaurantCode, r = t.row.original.restaurantName;
210
+ return `${e ? e + " - " : ""}${r}`;
211
+ },
212
+ enableSorting: !0
213
+ }, {
214
+ accessorKey: "start",
215
+ header: () => a("hr.timesheet.columns.start"),
216
+ cell: (t) => t.row.original.start || "--",
217
+ enableSorting: !0
218
+ }, {
219
+ accessorKey: "end",
220
+ header: () => a("hr.timesheet.columns.end"),
221
+ cell: (t) => t.row.original.end || "--",
222
+ enableSorting: !0
223
+ }, {
224
+ name: "duration",
225
+ accessorKey: "duration",
226
+ header: () => a("hr.timesheet.columns.duration"),
227
+ cell: (t) => t.row.original.duration || "--",
228
+ enableSorting: !0
229
+ }], z = m({}), le = [{
230
+ accessorKey: "code",
231
+ size: 100,
232
+ header: () => a("hr.employee.columns.code"),
233
+ cell: (t) => t.row.original.code,
234
+ enableSorting: !1
235
+ }, {
236
+ accessorKey: "user",
237
+ header: () => a("hr.timesheet.columns.name"),
238
+ cell: (t) => {
239
+ const e = t.row.original;
240
+ if (typeof e.user == "string") {
241
+ const r = t.row.getIsExpanded();
242
+ return s("div", {
243
+ class: "flex items-center gap-8"
244
+ }, [s("div", {
245
+ onClick: (u) => {
246
+ u.stopPropagation(), t.row.getToggleExpandedHandler()(u);
247
+ }
248
+ }, [s(ye.FmButton, {
249
+ variant: "tertiary",
250
+ icon: r ? "keyboard_arrow_up" : "keyboard_arrow_down"
251
+ }, null)]), e.user]);
252
+ }
253
+ },
254
+ enableSorting: !1
255
+ }, {
256
+ accessorKey: "start",
257
+ header: () => a("hr.timesheet.columns.start"),
258
+ cell: (t) => {
259
+ const e = t.row.original;
260
+ return (e == null ? void 0 : e.start) || "--";
261
+ },
262
+ enableSorting: !1
263
+ }, {
264
+ accessorKey: "end",
265
+ header: () => a("hr.timesheet.columns.end"),
266
+ cell: (t) => {
267
+ const e = t.row.original;
268
+ return (e == null ? void 0 : e.end) || "--";
269
+ },
270
+ enableSorting: !1
271
+ }, {
272
+ name: "duration",
273
+ accessorKey: "duration",
274
+ header: () => a("hr.timesheet.columns.hourMinute"),
275
+ cell: (t) => {
276
+ const e = t.row.original;
277
+ return e.total ? `Total: ${e.total}` : e.duration;
278
+ },
279
+ enableSorting: !1
280
+ }], k = m(!1);
281
+ function q(t) {
282
+ f.value = t, S.value = l(f.value.startedAt).format("YYYY-MM-DD"), C.value = l(f.value.endedAt || f.value.startedAt).format("YYYY-MM-DD"), V.value = l(f.value.startedAt).format("HH:mm"), F.value = l(f.value.endedAt || f.value.startedAt).format("HH:mm"), k.value = !0;
283
+ }
284
+ const S = m(), V = m(), C = m(), F = m(), f = m(), $ = m("");
285
+ async function re() {
286
+ const t = J(S.value, V.value), e = J(C.value, F.value);
287
+ if (l(t).isAfter(e)) {
288
+ $.value = a("hr.timesheet.checkOutMustBeforeCheckIn");
289
+ return;
290
+ }
291
+ y.minor(async () => {
292
+ await h.updateTimesheet(f.value, t, e);
293
+ }, {
294
+ successMessage: a("hr.timesheet.update.successMessage")
295
+ }), U(), k.value = !1;
296
+ }
297
+ const J = (t, e) => l(t).set("h", parseInt(e.split(":")[0])).set("m", parseInt(e.split(":")[1])).toISOString();
298
+ return X([S, C, V, F], ([t, e, r, u]) => {
299
+ (t || e || r || u) && ($.value = "");
300
+ }), (t, e) => {
301
+ const r = d("FmAvatar"), u = d("FmDatePicker"), A = d("FmTimePicker"), B = d("FmIcon"), E = d("FmButton"), ne = d("FmSideSheet"), Q = d("FmChip"), ie = d("FmDateRangePicker"), ue = d("FmMenuItem"), de = d("FmMenu"), me = d("FmSpacer"), ce = d("FmSearch"), W = d("FmTable");
302
+ return L(), P(Z, null, [s(ne, {
303
+ modelValue: k.value,
304
+ "onUpdate:modelValue": e[5] || (e[5] = (o) => k.value = o),
305
+ "dismiss-away": "",
306
+ header: n(a)("hr.timesheet.update.title")
307
+ }, {
308
+ "side-sheet-footer": w(() => [i("div", Ge, [s(E, {
309
+ label: n(a)("common.update"),
310
+ size: "md",
311
+ variant: "primary",
312
+ onClick: re
313
+ }, null, 8, ["label"]), s(E, {
314
+ label: n(a)("common.cancel"),
315
+ size: "md",
316
+ variant: "secondary",
317
+ onClick: e[4] || (e[4] = (o) => k.value = !1)
318
+ }, null, 8, ["label"])])]),
319
+ default: w(() => [i("div", Ie, [i("div", $e, [s(r, {
320
+ name: f.value.user.name,
321
+ initials: n(Fe)(f.value.user.name),
322
+ size: "lg"
323
+ }, null, 8, ["name", "initials"]), i("div", Ae, [i("div", Ee, T(n(a)("hr.timesheet.employeeName")), 1), i("div", Ke, T(f.value.user.name), 1)])]), i("div", Ne, [i("div", Ue, T(n(a)("hr.timesheet.update.checkIn")), 1), i("div", ze, [s(u, {
324
+ modelValue: S.value,
325
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => S.value = o),
326
+ disabled: !1,
327
+ label: n(a)("hr.timesheet.update.date")
328
+ }, null, 8, ["modelValue", "label"]), s(A, {
329
+ modelValue: V.value,
330
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => V.value = o),
331
+ label: n(a)("hr.timesheet.update.time")
332
+ }, null, 8, ["modelValue", "label"])])]), i("div", Be, [i("div", Pe, T(n(a)("hr.timesheet.update.checkOut")), 1), i("div", je, [s(u, {
333
+ modelValue: C.value,
334
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => C.value = o),
335
+ disabled: !1,
336
+ label: n(a)("hr.timesheet.update.date")
337
+ }, null, 8, ["modelValue", "label"]), s(A, {
338
+ modelValue: F.value,
339
+ "onUpdate:modelValue": e[3] || (e[3] = (o) => F.value = o),
340
+ label: n(a)("hr.timesheet.update.time")
341
+ }, null, 8, ["modelValue", "label"])])]), $.value ? (L(), P("div", He, [s(B, {
342
+ color: "#FF3B30",
343
+ name: "error",
344
+ size: "sm"
345
+ }), he(" " + T($.value), 1)])) : ve("", !0)])]),
346
+ _: 1
347
+ }, 8, ["modelValue", "header"]), i("div", qe, [i("div", Je, [s(_e, {
348
+ modelValue: I.value,
349
+ "onUpdate:modelValue": e[6] || (e[6] = (o) => I.value = o),
350
+ multiple: "",
351
+ items: te.value,
352
+ variant: "dark",
353
+ "selected-prefix": n(a)("hr.role.columns.restaurants"),
354
+ placeholder: n(a)("hr.role.columns.restaurants"),
355
+ class: "!w-auto pt-[3px]"
356
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i("div", Qe, [s(ie, {
357
+ modelValue: n(x),
358
+ "onUpdate:modelValue": e[7] || (e[7] = (o) => ge(x) ? x.value = o : null),
359
+ "show-predefined-range": "",
360
+ "predefined-range": oe
361
+ }, {
362
+ "trigger-button": w(() => [s(Q, {
363
+ label: n(ae)
364
+ }, null, 8, ["label"])]),
365
+ _: 1
366
+ }, 8, ["modelValue"]), s(E, {
367
+ icon: "chevron_left",
368
+ variant: "tertiary",
369
+ onClick: e[8] || (e[8] = (o) => n(G)("subtract"))
370
+ }), s(E, {
371
+ icon: "chevron_right",
372
+ variant: "tertiary",
373
+ onClick: e[9] || (e[9] = (o) => n(G)("add"))
374
+ })]), s(de, {
375
+ class: "pt-[3px]"
376
+ }, {
377
+ "menu-button": w(() => [s(Q, {
378
+ label: g.value,
379
+ "right-icon": "keyboard_arrow_down"
380
+ }, null, 8, ["label"])]),
381
+ default: w(() => [(L(), P(Z, null, De(_, (o) => s(ue, {
382
+ key: o.value,
383
+ label: o.label,
384
+ onClick: (Xe) => p.value = o.value
385
+ }, null, 8, ["label", "onClick"])), 64))]),
386
+ _: 1
387
+ }), s(me), s(ce, {
388
+ modelValue: c.value,
389
+ "onUpdate:modelValue": e[10] || (e[10] = (o) => c.value = o),
390
+ class: "w-[320px]",
391
+ placeholder: n(a)("hr.timesheet.search.placeholder")
392
+ }, null, 8, ["modelValue", "placeholder"])]), s(Me, {
393
+ class: "w-full xs:px-16"
394
+ }, {
395
+ default: w(() => [i("div", We, [s(xe, {
396
+ "is-loading": N.value,
397
+ "is-empty": p.value === "listView" ? R.value.length === 0 : H.value.length === 0,
398
+ "collapse-at": !1,
399
+ title: n(a)("hr.timesheet.noData.title"),
400
+ subtitle: ""
401
+ }, {
402
+ default: w(() => [p.value === "listView" ? (L(), ee(W, {
403
+ key: 0,
404
+ class: "min-w-[640px]",
405
+ "column-defs": se,
406
+ "row-data": R.value,
407
+ "page-size": R.value.length,
408
+ loading: N.value,
409
+ virtual: R.value.length > 0,
410
+ "pin-header-row": "",
411
+ "hide-footer": "",
412
+ "shrink-at": !1,
413
+ onRowClick: e[11] || (e[11] = (o) => q(o.original))
414
+ }, null, 8, ["row-data", "page-size", "loading", "virtual"])) : (L(), ee(W, {
415
+ key: 1,
416
+ class: "min-w-[640px]",
417
+ "column-defs": le,
418
+ "row-data": H.value,
419
+ "page-size": 100,
420
+ loading: N.value,
421
+ "pin-header-row": "",
422
+ "shrink-at": !1,
423
+ "expanded-state": z.value,
424
+ "get-sub-row": (o) => o.timesheets,
425
+ "onUpdate:expandedState": e[12] || (e[12] = (o) => z.value = o),
426
+ onRowClick: e[13] || (e[13] = (o) => q(o.original))
427
+ }, null, 8, ["row-data", "loading", "expanded-state", "get-sub-row"]))]),
428
+ _: 1
429
+ }, 8, ["is-loading", "is-empty", "title"])])]),
430
+ _: 1
431
+ })])], 64);
432
+ };
433
+ }
434
+ });
435
+ export {
436
+ ct as default
437
+ };