@feedmepos/mf-hrm-portal 2.3.2-dev.10 → 2.3.2-dev.12

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 (62) hide show
  1. package/dist/{ApprovalCodeList-RKU5B8SO.js → ApprovalCodeList-CCh9mNJh.js} +7 -7
  2. package/dist/AuditLogList-DCADUZ5s.js +2019 -0
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-pL2zRc67.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BZQNDOg7.js} +10 -10
  4. package/dist/{EmployeeList-nrYsS5uz.js → EmployeeList-CRI7XjzX.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-7S2w36aY.js → FormSection.vue_vue_type_script_setup_true_lang-y9_hxba6.js} +1 -1
  6. package/dist/{GrantUserList-BSjeC4MC.js → GrantUserList-DbMngkpK.js} +8 -8
  7. package/dist/{Main-DbdoVLCE.js → Main-BsFUfsmP.js} +29 -29
  8. package/dist/{Main-DtmCBbTR.js → Main-CrnM6wr8.js} +2168 -2169
  9. package/dist/{Main-CpuHaXU6.js → Main-D4Zq5AXi.js} +5 -5
  10. package/dist/{MyPosProfile-CsTCfGNT.js → MyPosProfile-B4cE47im.js} +1 -1
  11. package/dist/{PermissionSetList-B1c-uGZO.js → PermissionSetList-D_2x-mDD.js} +112 -113
  12. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BM9Von-l.js +4212 -0
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-D6Z9z_Yt.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-COX-N0k6.js} +414 -448
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-TWTVo_9Y.js → RoleForm.vue_vue_type_script_setup_true_lang-D8V8KWiL.js} +41 -41
  15. package/dist/{RoleList-CwaGNsFy.js → RoleList-BC-c7fqn.js} +105 -96
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-C2ekVXdR.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DBbuSrXV.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-BVtXmxtp.js → ScheduleGeneralPage-eytzOZQr.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-DdsQ8v-5.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CP-kToVO.js} +4 -4
  19. package/dist/{SchedulePage-3qksmT2I.js → SchedulePage-B0QirzAk.js} +17 -17
  20. package/dist/{SchedulePositionPage-DAU20KPZ.js → SchedulePositionPage-BAE-NQvL.js} +3 -3
  21. package/dist/{SelectFilter-BpzBwBmQ.js → SelectFilter-DrLJhxt6.js} +1 -1
  22. package/dist/TeamMemberList-CHkiL_q9.js +2083 -0
  23. package/dist/TimesheetList-BZuddmzy.js +402 -0
  24. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-LCUO-ogb.js +58 -0
  25. package/dist/{app-DEZT4wdV.js → app-B9qAxMj1.js} +3516 -3470
  26. package/dist/app.js +1 -1
  27. package/dist/{approval-code-BZTz5OXK.js → approval-code-CTgj9q6m.js} +1 -1
  28. package/dist/{dayjs.min-B55I-uhI.js → dayjs.min-giCSI3N8.js} +22 -22
  29. package/dist/employee-BD3NXG8h.js +210 -0
  30. package/dist/{grant-user-B2rYztyf.js → grant-user-jeTFzGU1.js} +1 -1
  31. package/dist/{index-Bfdseotz.js → iteration-Tyg43nH0.js} +726 -698
  32. package/dist/{lodash-B8bqa6a9.js → lodash-CZsDR_DU.js} +1 -1
  33. package/dist/{member-grant-BIpKkuu8.js → member-grant-DsEMLN1N.js} +2 -2
  34. package/dist/restaurant-CDJ3VjdH.js +49 -0
  35. package/dist/role-BDRWt87n.js +91 -0
  36. package/dist/{rule-Ccopk8R_.js → rule-EiO87cJJ.js} +309 -313
  37. package/dist/src/api/employee/index.d.ts +2 -1
  38. package/dist/src/api/timesheet/index.d.ts +1 -1
  39. package/dist/src/composables/useTenant.d.ts +11 -0
  40. package/dist/src/router/courtGuard.d.ts +4 -0
  41. package/dist/src/stores/employee.d.ts +7 -1
  42. package/dist/src/stores/restaurant.d.ts +1 -61
  43. package/dist/src/stores/team.d.ts +1 -1
  44. package/dist/src/stores/timesheet.d.ts +51 -66
  45. package/dist/src/types/timesheet.d.ts +0 -3
  46. package/dist/style.css +1 -1
  47. package/dist/tsconfig.app.tsbuildinfo +1 -1
  48. package/dist/{useAppStore-DfqsbhT2.js → useAppStore-CkUZ2H5h.js} +1 -1
  49. package/dist/{useLoading-CQnX5WjI.js → useLoading-DJHJM5E0.js} +1 -1
  50. package/dist/useReportPermissions-2dfIX21b.js +80 -0
  51. package/dist/useSsoProviders-BarGHndw.js +41 -0
  52. package/package.json +2 -2
  53. package/dist/AuditLogList-DuDCMjGR.js +0 -2026
  54. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Toq6qrLx.js +0 -4208
  55. package/dist/TeamMemberList-Bdpm40i3.js +0 -2087
  56. package/dist/TimesheetList-CL_eJp2h.js +0 -437
  57. package/dist/employee-C6z5i6O4.js +0 -172
  58. package/dist/iteration-CcXrOMQe.js +0 -30
  59. package/dist/restaurant-ejyX2jEG.js +0 -52
  60. package/dist/role-C_t3DDlG.js +0 -98
  61. package/dist/timesheet-CZHcebqS.js +0 -76
  62. package/dist/useReportPermissions-kTjftFk7.js +0 -82
@@ -0,0 +1,402 @@
1
+ import { ref as d, computed as g, defineComponent as pe, onMounted as fe, watch as Z, resolveComponent as u, createElementBlock as P, openBlock as E, Fragment as ee, createVNode as l, createElementVNode as i, unref as n, withCtx as b, createCommentVNode as ve, toDisplayString as O, createTextVNode as he, isRef as ge, renderList as we, createBlock as te, nextTick as ye } from "vue";
2
+ import { d as v } from "./dayjs.min-giCSI3N8.js";
3
+ import { useI18n as _e } from "@feedmepos/mf-common";
4
+ import { useSnackbar as be, components as xe } from "@feedmepos/ui-library";
5
+ import { S as De } from "./SelectFilter-DrLJhxt6.js";
6
+ import { _ as Se, a as Ve } from "./app-B9qAxMj1.js";
7
+ import { _ as ke } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
+ import { u as Ce } from "./useLoading-DJHJM5E0.js";
9
+ import { g as Fe, s as Ye } from "./iteration-Tyg43nH0.js";
10
+ import { f as Le } from "./utils-BZkjJbju.js";
11
+ import { n as Me } from "./string-DZQ1uNjn.js";
12
+ import { u as Te } from "./employee-BD3NXG8h.js";
13
+ import { u as Ie } from "./restaurant-CDJ3VjdH.js";
14
+ import { u as Re } from "./TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-LCUO-ogb.js";
15
+ function $e(x, a) {
16
+ return ["years", "months"].find((S) => {
17
+ const V = x.startOf(S), p = x.endOf(S);
18
+ return x.isSame(V, "day") && a.isSame(p, "day");
19
+ }) || "days";
20
+ }
21
+ function Ee() {
22
+ const x = {
23
+ startDate: v().format("YYYY-MM-DD"),
24
+ endDate: v().format("YYYY-MM-DD")
25
+ }, a = d(x), D = g(() => {
26
+ if (!a.value) return "No dates selected.";
27
+ const p = a.value.startDate ?? "Start", _ = a.value.endDate ?? "End";
28
+ return `${p} - ${_}`;
29
+ }), S = g(() => ({
30
+ startDate: new Date(a.value.startDate),
31
+ endDate: new Date(a.value.endDate)
32
+ }));
33
+ function V(p) {
34
+ const _ = v(a.value.startDate), c = v(a.value.endDate), h = $e(_, c), k = h === "days" ? c.diff(_, "days") + 1 : 1, C = p === "subtract" ? (F) => F.subtract(k, h) : (F) => F.add(k, h);
35
+ a.value = {
36
+ startDate: C(_).startOf(h).format("YYYY-MM-DD"),
37
+ endDate: C(c).endOf(h).format("YYYY-MM-DD")
38
+ };
39
+ }
40
+ return { dateRange: a, parsedDateRange: S, dateRangeLabel: D, setRange: V };
41
+ }
42
+ const Oe = {
43
+ class: "my-16 flex w-[350px] flex-col gap-40"
44
+ }, Ae = {
45
+ class: "flex gap-16"
46
+ }, Ke = {
47
+ class: "flex flex-col gap-4"
48
+ }, ze = {
49
+ class: "fm-typo-body-md-400 text-fm-color-typo-secondary"
50
+ }, Ne = {
51
+ class: "fm-typo-body-md-700 text-fm-color-typo-primary"
52
+ }, Ue = {
53
+ class: "flex flex-col gap-8"
54
+ }, Be = {
55
+ class: "fm-typo-body-xl-700"
56
+ }, Pe = {
57
+ class: "flex flex-col gap-24"
58
+ }, je = {
59
+ class: "flex flex-col gap-8"
60
+ }, He = {
61
+ class: "fm-typo-body-xl-700"
62
+ }, Ge = {
63
+ class: "flex flex-col gap-24"
64
+ }, qe = {
65
+ key: 0,
66
+ class: "fm-typo-body-sm-400 text-fm-color-typo-error mt-1 flex items-center gap-4"
67
+ }, Je = {
68
+ class: "flex items-center justify-start gap-8"
69
+ }, Qe = {
70
+ class: "space-y-8"
71
+ }, We = {
72
+ class: "flex items-start gap-8 flex-wrap xs:px-16"
73
+ }, Xe = {
74
+ class: "flex items-center gap-8"
75
+ }, Ze = {
76
+ class: "flex h-full flex-col overflow-auto"
77
+ }, et = /* @__PURE__ */ pe({
78
+ __name: "TimesheetList",
79
+ setup(x) {
80
+ const {
81
+ t: a
82
+ } = _e(), D = be(), S = Ce(D), V = [{
83
+ label: a("hr.timesheet.listView"),
84
+ value: "listView"
85
+ }, {
86
+ label: a("hr.timesheet.userView"),
87
+ value: "userView"
88
+ }], p = d("listView"), _ = g(() => {
89
+ var t;
90
+ return (t = V.find((e) => e.value === p.value)) == null ? void 0 : t.label;
91
+ }), c = d(""), h = Re(), k = Te(), C = Ie(), F = g(() => k.employees.value), j = g(() => h.timesheets.value.filter((s) => !A.value || A.value.includes(s.restaurantId)).map((s) => {
92
+ var y;
93
+ const r = (y = C.restaurants.value.find((f) => f._id === s.restaurantId)) == null ? void 0 : y.profile.code, w = F.value.find((f) => f._id === s.user.id);
94
+ return {
95
+ ...s,
96
+ restaurantCode: r,
97
+ user: {
98
+ ...s.user,
99
+ code: w ? w.code : ""
100
+ }
101
+ };
102
+ })), z = g(() => j.value.filter((t) => {
103
+ var e, s;
104
+ 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()));
105
+ })), H = g(() => {
106
+ const t = Fe(j.value, (s) => s.user.name), e = Object.entries(t).map(([s, r]) => {
107
+ const w = F.value.find((y) => y._id === r[0].user.id);
108
+ return {
109
+ key: s,
110
+ user: r[0].user.name,
111
+ code: w ? w.code : r[0].user.code || "",
112
+ timesheets: r,
113
+ total: Le(r.reduce((y, f) => y + f.totalMin, 0))
114
+ };
115
+ });
116
+ return Ye(e, {
117
+ selector: "user"
118
+ });
119
+ }), N = g(() => H.value.filter((t) => {
120
+ var e;
121
+ return t.user.toLowerCase().includes(c.value.toLowerCase()) || ((e = t.code) == null ? void 0 : e.toLowerCase().includes(c.value.toLowerCase()));
122
+ })), Y = d(!1), U = async () => {
123
+ const {
124
+ startDate: t,
125
+ endDate: e
126
+ } = L.value;
127
+ Y.value = !0;
128
+ try {
129
+ await h.readTimesheet(new Date(t), new Date(e)), await ye(), B.value = Object.fromEntries(Object.entries(new Array(H.value.length).fill(!0)));
130
+ } catch (s) {
131
+ D.open({
132
+ title: s instanceof Error ? s.message : `${s}`,
133
+ type: "error"
134
+ });
135
+ } finally {
136
+ Y.value = !1;
137
+ }
138
+ };
139
+ fe(async () => {
140
+ try {
141
+ await C.readRestaurants(), k.employees.value.length === 0 && await k.readEmployees();
142
+ } catch (t) {
143
+ console.error("Failed to load timesheet dependencies:", t), D.open({
144
+ message: t instanceof Error ? t.message : String(t),
145
+ type: "error"
146
+ });
147
+ }
148
+ U();
149
+ });
150
+ const A = d(), ae = g(() => C.restaurants.value.filter((t) => t.managable).map((t) => ({
151
+ label: `${t.profile.code ? `${t.profile.code} - ` : ""}${t.profile.name}`,
152
+ value: t._id
153
+ }))), {
154
+ dateRange: L,
155
+ dateRangeLabel: oe,
156
+ setRange: G
157
+ } = Ee();
158
+ Z(L, async () => {
159
+ U();
160
+ });
161
+ const se = [{
162
+ accessorKey: "user.code",
163
+ size: 100,
164
+ header: () => a("hr.employee.columns.code"),
165
+ cell: (t) => t.row.original.user.code || "--",
166
+ enableSorting: !0
167
+ }, {
168
+ accessorKey: "user",
169
+ header: () => a("hr.timesheet.columns.name"),
170
+ cell: (t) => t.row.original.user.name,
171
+ enableSorting: !1
172
+ }, {
173
+ accessorKey: "restaurantName",
174
+ header: () => a("hr.timesheet.columns.restaurant"),
175
+ cell: (t) => {
176
+ const e = t.row.original.restaurantCode, s = t.row.original.restaurantName;
177
+ return `${e ? e + " - " : ""}${s}`;
178
+ },
179
+ enableSorting: !0
180
+ }, {
181
+ accessorKey: "start",
182
+ header: () => a("hr.timesheet.columns.start"),
183
+ cell: (t) => t.row.original.start || "--",
184
+ enableSorting: !0
185
+ }, {
186
+ accessorKey: "end",
187
+ header: () => a("hr.timesheet.columns.end"),
188
+ cell: (t) => t.row.original.end || "--",
189
+ enableSorting: !0
190
+ }, {
191
+ name: "duration",
192
+ accessorKey: "duration",
193
+ header: () => a("hr.timesheet.columns.duration"),
194
+ cell: (t) => t.row.original.duration || "--",
195
+ enableSorting: !0
196
+ }], B = d({}), le = [{
197
+ accessorKey: "code",
198
+ size: 100,
199
+ header: () => a("hr.employee.columns.code"),
200
+ cell: (t) => t.row.original.code,
201
+ enableSorting: !1
202
+ }, {
203
+ accessorKey: "user",
204
+ header: () => a("hr.timesheet.columns.name"),
205
+ cell: (t) => {
206
+ const e = t.row.original;
207
+ if (typeof e.user == "string") {
208
+ const s = t.row.getIsExpanded();
209
+ return l("div", {
210
+ class: "flex items-center gap-8"
211
+ }, [l("div", {
212
+ onClick: (r) => {
213
+ r.stopPropagation(), t.row.getToggleExpandedHandler()(r);
214
+ }
215
+ }, [l(xe.FmButton, {
216
+ variant: "tertiary",
217
+ icon: s ? "keyboard_arrow_up" : "keyboard_arrow_down"
218
+ }, null)]), e.user]);
219
+ }
220
+ },
221
+ enableSorting: !1
222
+ }, {
223
+ accessorKey: "start",
224
+ header: () => a("hr.timesheet.columns.start"),
225
+ cell: (t) => {
226
+ const e = t.row.original;
227
+ return (e == null ? void 0 : e.start) || "--";
228
+ },
229
+ enableSorting: !1
230
+ }, {
231
+ accessorKey: "end",
232
+ header: () => a("hr.timesheet.columns.end"),
233
+ cell: (t) => {
234
+ const e = t.row.original;
235
+ return (e == null ? void 0 : e.end) || "--";
236
+ },
237
+ enableSorting: !1
238
+ }, {
239
+ name: "duration",
240
+ accessorKey: "duration",
241
+ header: () => a("hr.timesheet.columns.hourMinute"),
242
+ cell: (t) => {
243
+ const e = t.row.original;
244
+ return e.total ? `Total: ${e.total}` : e.duration;
245
+ },
246
+ enableSorting: !1
247
+ }], M = d(!1);
248
+ function q(t) {
249
+ m.value = t, T.value = v(m.value.startedAt).format("YYYY-MM-DD"), R.value = v(m.value.endedAt || m.value.startedAt).format("YYYY-MM-DD"), I.value = v(m.value.startedAt).format("HH:mm"), $.value = v(m.value.endedAt || m.value.startedAt).format("HH:mm"), M.value = !0;
250
+ }
251
+ const T = d(), I = d(), R = d(), $ = d(), m = d(), K = d("");
252
+ async function ne() {
253
+ const t = J(T.value, I.value), e = J(R.value, $.value);
254
+ if (v(t).isAfter(e)) {
255
+ K.value = a("hr.timesheet.checkOutMustBeforeCheckIn");
256
+ return;
257
+ }
258
+ S.minor(async () => {
259
+ await h.updateTimesheet(m.value, t, e);
260
+ }, {
261
+ successMessage: a("hr.timesheet.update.successMessage")
262
+ }), U(), M.value = !1;
263
+ }
264
+ const J = (t, e) => v(t).set("h", parseInt(e.split(":")[0])).set("m", parseInt(e.split(":")[1])).toISOString();
265
+ return Z([T, R, I, $], ([t, e, s, r]) => {
266
+ (t || e || s || r) && (K.value = "");
267
+ }), (t, e) => {
268
+ const s = u("FmAvatar"), r = u("FmDatePicker"), w = u("FmTimePicker"), y = u("FmIcon"), f = u("FmButton"), re = u("FmSideSheet"), Q = u("FmChip"), ie = u("FmDateRangePicker"), ue = u("FmMenuItem"), de = u("FmMenu"), ce = u("FmSpacer"), me = u("FmSearch"), W = u("FmTable");
269
+ return E(), P(ee, null, [l(re, {
270
+ modelValue: M.value,
271
+ "onUpdate:modelValue": e[5] || (e[5] = (o) => M.value = o),
272
+ "dismiss-away": "",
273
+ header: n(a)("hr.timesheet.update.title")
274
+ }, {
275
+ "side-sheet-footer": b(() => [i("div", Je, [l(f, {
276
+ label: n(a)("common.update"),
277
+ size: "md",
278
+ variant: "primary",
279
+ onClick: ne
280
+ }, null, 8, ["label"]), l(f, {
281
+ label: n(a)("common.cancel"),
282
+ size: "md",
283
+ variant: "secondary",
284
+ onClick: e[4] || (e[4] = (o) => M.value = !1)
285
+ }, null, 8, ["label"])])]),
286
+ default: b(() => [i("div", Oe, [i("div", Ae, [l(s, {
287
+ name: m.value.user.name,
288
+ initials: n(Me)(m.value.user.name),
289
+ size: "lg"
290
+ }, null, 8, ["name", "initials"]), i("div", Ke, [i("div", ze, O(n(a)("hr.timesheet.employeeName")), 1), i("div", Ne, O(m.value.user.name), 1)])]), i("div", Ue, [i("div", Be, O(n(a)("hr.timesheet.update.checkIn")), 1), i("div", Pe, [l(r, {
291
+ modelValue: T.value,
292
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => T.value = o),
293
+ disabled: !1,
294
+ label: n(a)("hr.timesheet.update.date")
295
+ }, null, 8, ["modelValue", "label"]), l(w, {
296
+ modelValue: I.value,
297
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => I.value = o),
298
+ label: n(a)("hr.timesheet.update.time")
299
+ }, null, 8, ["modelValue", "label"])])]), i("div", je, [i("div", He, O(n(a)("hr.timesheet.update.checkOut")), 1), i("div", Ge, [l(r, {
300
+ modelValue: R.value,
301
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => R.value = o),
302
+ disabled: !1,
303
+ label: n(a)("hr.timesheet.update.date")
304
+ }, null, 8, ["modelValue", "label"]), l(w, {
305
+ modelValue: $.value,
306
+ "onUpdate:modelValue": e[3] || (e[3] = (o) => $.value = o),
307
+ label: n(a)("hr.timesheet.update.time")
308
+ }, null, 8, ["modelValue", "label"])])]), K.value ? (E(), P("div", qe, [l(y, {
309
+ color: "#FF3B30",
310
+ name: "error",
311
+ size: "sm"
312
+ }), he(" " + O(K.value), 1)])) : ve("", !0)])]),
313
+ _: 1
314
+ }, 8, ["modelValue", "header"]), i("div", Qe, [i("div", We, [l(De, {
315
+ modelValue: A.value,
316
+ "onUpdate:modelValue": e[6] || (e[6] = (o) => A.value = o),
317
+ multiple: "",
318
+ items: ae.value,
319
+ variant: "dark",
320
+ "selected-prefix": n(a)("hr.role.columns.restaurants"),
321
+ placeholder: n(a)("hr.role.columns.restaurants"),
322
+ class: "!w-auto pt-[3px]"
323
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i("div", Xe, [l(ie, {
324
+ modelValue: n(L),
325
+ "onUpdate:modelValue": e[7] || (e[7] = (o) => ge(L) ? L.value = o : null),
326
+ "show-predefined-range": ""
327
+ }, {
328
+ "trigger-button": b(() => [l(Q, {
329
+ label: n(oe)
330
+ }, null, 8, ["label"])]),
331
+ _: 1
332
+ }, 8, ["modelValue"]), l(f, {
333
+ icon: "chevron_left",
334
+ variant: "tertiary",
335
+ onClick: e[8] || (e[8] = (o) => n(G)("subtract"))
336
+ }), l(f, {
337
+ icon: "chevron_right",
338
+ variant: "tertiary",
339
+ onClick: e[9] || (e[9] = (o) => n(G)("add"))
340
+ })]), l(de, {
341
+ class: "pt-[3px]"
342
+ }, {
343
+ "menu-button": b(() => [l(Q, {
344
+ label: _.value,
345
+ "right-icon": "keyboard_arrow_down"
346
+ }, null, 8, ["label"])]),
347
+ default: b(() => [(E(), P(ee, null, we(V, (o) => l(ue, {
348
+ key: o.value,
349
+ label: o.label,
350
+ onClick: (X) => p.value = o.value
351
+ }, null, 8, ["label", "onClick"])), 64))]),
352
+ _: 1
353
+ }), l(ce), l(me, {
354
+ modelValue: c.value,
355
+ "onUpdate:modelValue": e[10] || (e[10] = (o) => c.value = o),
356
+ class: "w-[320px]",
357
+ placeholder: n(a)("hr.timesheet.search.placeholder")
358
+ }, null, 8, ["modelValue", "placeholder"])]), l(Se, {
359
+ class: "w-full xs:px-16"
360
+ }, {
361
+ default: b(() => [i("div", Ze, [l(ke, {
362
+ "is-loading": Y.value,
363
+ "is-empty": p.value === "listView" ? z.value.length === 0 : N.value.length === 0,
364
+ "collapse-at": !1,
365
+ title: n(a)("hr.timesheet.noData.title"),
366
+ subtitle: ""
367
+ }, {
368
+ default: b(() => [p.value === "listView" ? (E(), te(W, {
369
+ key: 0,
370
+ class: "min-w-[640px]",
371
+ "column-defs": se,
372
+ "row-data": z.value,
373
+ "page-size": z.value.length,
374
+ loading: Y.value,
375
+ "pin-header-row": "",
376
+ "hide-footer": "",
377
+ "shrink-at": !1,
378
+ onRowClick: e[11] || (e[11] = (o) => q(o.original))
379
+ }, null, 8, ["row-data", "page-size", "loading"])) : (E(), te(W, {
380
+ key: 1,
381
+ class: "min-w-[640px] timesheet-user-view",
382
+ "column-defs": le,
383
+ "row-data": N.value,
384
+ "page-size": N.value.reduce((o, X) => o + 1 + X.timesheets.length, 0),
385
+ loading: Y.value,
386
+ "pin-header-row": "",
387
+ "shrink-at": !1,
388
+ "expanded-state": B.value,
389
+ "get-sub-row": (o) => o.timesheets,
390
+ "onUpdate:expandedState": e[12] || (e[12] = (o) => B.value = o),
391
+ onRowClick: e[13] || (e[13] = (o) => q(o.original))
392
+ }, null, 8, ["row-data", "page-size", "loading", "expanded-state", "get-sub-row"]))]),
393
+ _: 1
394
+ }, 8, ["is-loading", "is-empty", "title"])])]),
395
+ _: 1
396
+ })])], 64);
397
+ };
398
+ }
399
+ }), vt = /* @__PURE__ */ Ve(et, [["__scopeId", "data-v-63294af2"]]);
400
+ export {
401
+ vt as default
402
+ };
@@ -0,0 +1,58 @@
1
+ import { d as i } from "./dayjs.min-giCSI3N8.js";
2
+ import { defineStore as p, storeToRefs as T } from "pinia";
3
+ import { ref as l } from "vue";
4
+ import { b as c, g as y } from "./app-B9qAxMj1.js";
5
+ import { s as S } from "./iteration-Tyg43nH0.js";
6
+ import { i as f, f as g } from "./utils-BZkjJbju.js";
7
+ const u = {
8
+ async readTimesheets(t, e) {
9
+ return y(await c().get(`timesheet?start=${t}&end=${e}`));
10
+ },
11
+ async updateTimesheet(t, e) {
12
+ await c().put(`timesheet/${t}`, e);
13
+ }
14
+ };
15
+ function A(t) {
16
+ const e = t.map((n) => {
17
+ const { startedAt: s, endedAt: r } = n, a = i(f(s)), o = r ? i(f(r)) : null, m = (o == null ? void 0 : o.diff(a, "minute", !1)) || 0, h = o ? g(m) : "", d = "YYYY-MM-DD hh:mm a";
18
+ return {
19
+ ...n,
20
+ start: a.format(d),
21
+ end: o ? o.format(d) : "",
22
+ totalMin: m,
23
+ duration: h
24
+ };
25
+ });
26
+ return S(e, { selector: "start" });
27
+ }
28
+ const D = p("hrm-timesheet", () => {
29
+ const t = l([]);
30
+ async function e(s, r) {
31
+ const a = await u.readTimesheets(
32
+ i(s).startOf("day").toISOString(),
33
+ i(r).endOf("day").toISOString()
34
+ );
35
+ t.value = A(a);
36
+ }
37
+ async function n(s, r, a) {
38
+ await u.updateTimesheet(s.restaurantId, {
39
+ id: s._id,
40
+ startAt: r,
41
+ endAt: a
42
+ });
43
+ }
44
+ return {
45
+ timesheets: t,
46
+ readTimesheet: e,
47
+ updateTimesheet: n
48
+ };
49
+ }), b = () => {
50
+ const t = D();
51
+ return {
52
+ ...t,
53
+ ...T(t)
54
+ };
55
+ };
56
+ export {
57
+ b as u
58
+ };