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

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 (55) hide show
  1. package/dist/{ApprovalCodeList-NYJNwdDZ.js → ApprovalCodeList-Bw0E-hZl.js} +7 -7
  2. package/dist/{AuditLogList-Ghn4aBnn.js → AuditLogList-CA-_t77n.js} +5 -5
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BxZ9t3MZ.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-LtjNCAFN.js} +10 -10
  4. package/dist/{EmployeeList-jc8LTznV.js → EmployeeList-D_bX0EhQ.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-DLgm6oCz.js → FormSection.vue_vue_type_script_setup_true_lang-CyZxQa-b.js} +1 -1
  6. package/dist/{GrantUserList-BtPTpypR.js → GrantUserList-Cg7ITk_M.js} +8 -8
  7. package/dist/{Main-BizCV-_x.js → Main-BaB4vgI5.js} +11 -11
  8. package/dist/{Main-McMZU_cR.js → Main-Bl-Ocx1G.js} +5 -5
  9. package/dist/{Main-BF8hlYeV.js → Main-D5wi42fp.js} +10 -10
  10. package/dist/{MyPosProfile-BjeCnBvL.js → MyPosProfile-CUG_201f.js} +1 -1
  11. package/dist/{PermissionSetList-NWLoqFHC.js → PermissionSetList-kgG9H3DX.js} +66 -66
  12. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-y1YcZpGA.js +4207 -0
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-nwpdr7T7.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-fQyCtDXM.js} +19 -19
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-eT-dPsOX.js → RoleForm.vue_vue_type_script_setup_true_lang-3Q8udk43.js} +30 -30
  15. package/dist/{RoleList-CIfN10zu.js → RoleList-Cmz97HHP.js} +96 -105
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CMTXC_UR.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CggEy3OI.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-8vS1DUrk.js → ScheduleGeneralPage-B39k3SQH.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-Br4AcF1g.js → ScheduleModal.vue_vue_type_script_setup_true_lang-C5j3D4eF.js} +4 -4
  19. package/dist/{SchedulePage-DqbE1PoV.js → SchedulePage-AVmRkFi1.js} +9 -9
  20. package/dist/{SchedulePositionPage-DUnkT0Tp.js → SchedulePositionPage-3rE-O8CG.js} +3 -3
  21. package/dist/{SelectFilter-voMj4_j1.js → SelectFilter-R7ry_GEg.js} +2 -3
  22. package/dist/{TeamMemberList-DoEOWNDC.js → TeamMemberList-CvDnIILn.js} +184 -184
  23. package/dist/TimesheetList-DYoglTi8.js +401 -0
  24. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_d0c6fd51_lang-DBpzyQ17.js +63 -0
  25. package/dist/{app-CDCO87ji.js → app-DKUCzcrc.js} +5444 -4624
  26. package/dist/app.js +1 -1
  27. package/dist/{approval-code-CLE9s5dL.js → approval-code-nsETgIry.js} +1 -1
  28. package/dist/{dayjs.min-BW6-XAUB.js → dayjs.min-CtULWW1N.js} +1 -1
  29. package/dist/{employee-BaCU-FLC.js → employee-DlsSqR3i.js} +5 -5
  30. package/dist/{grant-user-DMtilLJx.js → grant-user-Dpa_Rl6j.js} +1 -1
  31. package/dist/{iteration-CPLGGFBb.js → iteration-DpHBtiyr.js} +1 -1
  32. package/dist/{lodash-snXoiw60.js → lodash-YaHCUo_F.js} +1 -1
  33. package/dist/member-grant-CEokFI3_.js +54 -0
  34. package/dist/restaurant-CDFKqEFm.js +52 -0
  35. package/dist/role-DyBVVlEA.js +97 -0
  36. package/dist/rule-xErZqYmH.js +842 -0
  37. package/dist/src/api/timesheet/index.d.ts +1 -1
  38. package/dist/src/helpers/permission-set.d.ts +1 -102
  39. package/dist/src/helpers/rule.d.ts +2 -2
  40. package/dist/src/stores/restaurant.d.ts +61 -1
  41. package/dist/src/stores/timesheet.d.ts +6 -6
  42. package/dist/src/views/audit-log/locales/index.d.ts +12 -0
  43. package/dist/style.css +1 -1
  44. package/dist/tsconfig.app.tsbuildinfo +1 -1
  45. package/dist/{useAppStore-pKAGQL6q.js → useAppStore-BqsvPsPB.js} +1 -1
  46. package/dist/{useLoading-D67DIqfk.js → useLoading-BS1bnZg1.js} +1 -1
  47. package/dist/{useReportPermissions-CfgnE0NY.js → useReportPermissions-DJEhkyGc.js} +5 -5
  48. package/package.json +3 -3
  49. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-UPcpeVD5.js +0 -4243
  50. package/dist/TimesheetList-BBv2SV96.js +0 -402
  51. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-h-bWBmpI.js +0 -58
  52. package/dist/member-grant-CJyOr-q0.js +0 -55
  53. package/dist/restaurant-BMlLIUqe.js +0 -51
  54. package/dist/role-DqcBOWHL.js +0 -93
  55. package/dist/rule-B5YNhGJ4.js +0 -788
@@ -0,0 +1,401 @@
1
+ import { ref as d, computed as p, defineComponent as fe, onMounted as he, watch as Z, resolveComponent as u, createElementBlock as P, openBlock as E, Fragment as ee, createVNode as s, createElementVNode as i, unref as n, withCtx as y, createCommentVNode as ge, toDisplayString as O, createTextVNode as we, isRef as ye, renderList as _e, createBlock as te, nextTick as be } from "vue";
2
+ import { d as f } from "./dayjs.min-CtULWW1N.js";
3
+ import { useI18n as xe } from "@feedmepos/mf-common";
4
+ import { useSnackbar as De, components as Se } from "@feedmepos/ui-library";
5
+ import { S as Ve } from "./SelectFilter-R7ry_GEg.js";
6
+ import { _ as Ce, a as ke } from "./app-DKUCzcrc.js";
7
+ import { _ as Fe } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
+ import { u as Me } from "./useLoading-BS1bnZg1.js";
9
+ import { g as Ye, s as Le } from "./iteration-DpHBtiyr.js";
10
+ import { f as Te } from "./utils-BZkjJbju.js";
11
+ import { n as Ie } from "./string-DZQ1uNjn.js";
12
+ import { u as Re } from "./employee-DlsSqR3i.js";
13
+ import { u as $e } from "./restaurant-CDFKqEFm.js";
14
+ import { u as Ee } from "./TimesheetList.vue_vue_type_style_index_0_scoped_d0c6fd51_lang-DBpzyQ17.js";
15
+ function Oe(_, a) {
16
+ return ["years", "months"].find((x) => {
17
+ const D = _.startOf(x), v = _.endOf(x);
18
+ return _.isSame(D, "day") && a.isSame(v, "day");
19
+ }) || "days";
20
+ }
21
+ function Ae() {
22
+ const _ = {
23
+ startDate: f().format("YYYY-MM-DD"),
24
+ endDate: f().format("YYYY-MM-DD")
25
+ }, a = d(_), b = p(() => {
26
+ if (!a.value) return "No dates selected.";
27
+ const v = a.value.startDate ?? "Start", w = a.value.endDate ?? "End";
28
+ return `${v} - ${w}`;
29
+ }), x = p(() => ({
30
+ startDate: new Date(a.value.startDate),
31
+ endDate: new Date(a.value.endDate)
32
+ }));
33
+ function D(v) {
34
+ const w = f(a.value.startDate), c = f(a.value.endDate), h = Oe(w, c), S = h === "days" ? c.diff(w, "days") + 1 : 1, V = v === "subtract" ? (C) => C.subtract(S, h) : (C) => C.add(S, h);
35
+ a.value = {
36
+ startDate: V(w).startOf(h).format("YYYY-MM-DD"),
37
+ endDate: V(c).endOf(h).format("YYYY-MM-DD")
38
+ };
39
+ }
40
+ return { dateRange: a, parsedDateRange: x, dateRangeLabel: b, setRange: D };
41
+ }
42
+ const Ke = {
43
+ class: "my-16 flex w-[350px] flex-col gap-40"
44
+ }, ze = {
45
+ class: "flex gap-16"
46
+ }, Be = {
47
+ class: "flex flex-col gap-4"
48
+ }, Ne = {
49
+ class: "fm-typo-body-md-400 text-fm-color-typo-secondary"
50
+ }, Ue = {
51
+ class: "fm-typo-body-md-700 text-fm-color-typo-primary"
52
+ }, Pe = {
53
+ class: "flex flex-col gap-8"
54
+ }, je = {
55
+ class: "fm-typo-body-xl-700"
56
+ }, He = {
57
+ class: "flex flex-col gap-24"
58
+ }, Ge = {
59
+ class: "flex flex-col gap-8"
60
+ }, qe = {
61
+ class: "fm-typo-body-xl-700"
62
+ }, Je = {
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
+ }, We = {
68
+ class: "flex items-center justify-start gap-8"
69
+ }, Xe = {
70
+ class: "space-y-8"
71
+ }, Ze = {
72
+ class: "flex items-start gap-8 flex-wrap xs:px-16"
73
+ }, et = {
74
+ class: "flex items-center gap-8"
75
+ }, tt = {
76
+ class: "flex h-full flex-col overflow-auto"
77
+ }, at = /* @__PURE__ */ fe({
78
+ __name: "TimesheetList",
79
+ setup(_) {
80
+ const {
81
+ t: a
82
+ } = xe(), b = De(), x = Me(b), D = [{
83
+ label: a("hr.timesheet.listView"),
84
+ value: "listView"
85
+ }, {
86
+ label: a("hr.timesheet.userView"),
87
+ value: "userView"
88
+ }], v = d("listView"), w = p(() => {
89
+ var e;
90
+ return (e = D.find((t) => t.value === v.value)) == null ? void 0 : e.label;
91
+ }), c = d(""), h = Ee(), S = Re(), V = $e(), C = p(() => S.employees.value), ae = p(() => new Map(C.value.map((e) => [e._id, e]))), oe = p(() => new Map(V.restaurants.value.map((e) => [e._id, e.profile.code]))), j = p(() => h.timesheets.value.map((l) => {
92
+ const r = oe.value.get(l.restaurantId), g = ae.value.get(l.user.id);
93
+ return {
94
+ ...l,
95
+ restaurantCode: r,
96
+ user: {
97
+ ...l.user,
98
+ code: g ? g.code : ""
99
+ }
100
+ };
101
+ })), z = p(() => j.value.filter((e) => {
102
+ var t, l;
103
+ return e.user.name.toLowerCase().includes(c.value.toLowerCase()) || e.restaurantName.toLowerCase().includes(c.value.toLowerCase()) || ((t = e.restaurantCode) == null ? void 0 : t.toLowerCase().includes(c.value.toLowerCase())) || ((l = e.user.code) == null ? void 0 : l.toLowerCase().includes(c.value.toLowerCase()));
104
+ })), H = p(() => {
105
+ const e = Ye(j.value, (l) => l.user.name), t = Object.entries(e).map(([l, r]) => {
106
+ const g = C.value.find(($) => $._id === r[0].user.id);
107
+ return {
108
+ key: l,
109
+ user: r[0].user.name,
110
+ code: g ? g.code : r[0].user.code || "",
111
+ timesheets: r,
112
+ total: Te(r.reduce(($, k) => $ + k.totalMin, 0))
113
+ };
114
+ });
115
+ return Le(t, {
116
+ selector: "user"
117
+ });
118
+ }), B = p(() => H.value.filter((e) => {
119
+ var t;
120
+ return e.user.toLowerCase().includes(c.value.toLowerCase()) || ((t = e.code) == null ? void 0 : t.toLowerCase().includes(c.value.toLowerCase()));
121
+ })), F = d(!1), N = async () => {
122
+ const {
123
+ startDate: e,
124
+ endDate: t
125
+ } = M.value;
126
+ F.value = !0;
127
+ try {
128
+ await h.readTimesheet(new Date(e), new Date(t), A.value), await be(), U.value = Object.fromEntries(Object.entries(new Array(H.value.length).fill(!0)));
129
+ } catch (l) {
130
+ b.open({
131
+ title: l instanceof Error ? l.message : `${l}`,
132
+ type: "error"
133
+ });
134
+ } finally {
135
+ F.value = !1;
136
+ }
137
+ };
138
+ he(async () => {
139
+ N();
140
+ try {
141
+ await V.readRestaurants(), S.employees.value.length === 0 && await S.readEmployees();
142
+ } catch (e) {
143
+ console.error("Failed to load timesheet dependencies:", e), b.open({
144
+ message: e instanceof Error ? e.message : String(e),
145
+ type: "error"
146
+ });
147
+ }
148
+ });
149
+ const A = d(), se = p(() => V.restaurants.value.filter((e) => e.managable).map((e) => ({
150
+ label: `${e.profile.code ? `${e.profile.code} - ` : ""}${e.profile.name}`,
151
+ value: e._id
152
+ }))), {
153
+ dateRange: M,
154
+ dateRangeLabel: le,
155
+ setRange: G
156
+ } = Ae();
157
+ Z([M, A], async () => {
158
+ N();
159
+ });
160
+ const ne = [{
161
+ accessorKey: "user.code",
162
+ size: 100,
163
+ header: () => a("hr.employee.columns.code"),
164
+ cell: (e) => e.row.original.user.code || "--",
165
+ enableSorting: !0
166
+ }, {
167
+ accessorKey: "user",
168
+ header: () => a("hr.timesheet.columns.name"),
169
+ cell: (e) => e.row.original.user.name,
170
+ enableSorting: !1
171
+ }, {
172
+ accessorKey: "restaurantName",
173
+ header: () => a("hr.timesheet.columns.restaurant"),
174
+ cell: (e) => {
175
+ const t = e.row.original.restaurantCode, l = e.row.original.restaurantName;
176
+ return `${t ? t + " - " : ""}${l}`;
177
+ },
178
+ enableSorting: !0
179
+ }, {
180
+ accessorKey: "start",
181
+ header: () => a("hr.timesheet.columns.start"),
182
+ cell: (e) => e.row.original.start || "--",
183
+ enableSorting: !0
184
+ }, {
185
+ accessorKey: "end",
186
+ header: () => a("hr.timesheet.columns.end"),
187
+ cell: (e) => e.row.original.end || "--",
188
+ enableSorting: !0
189
+ }, {
190
+ name: "duration",
191
+ accessorKey: "duration",
192
+ header: () => a("hr.timesheet.columns.duration"),
193
+ cell: (e) => e.row.original.duration || "--",
194
+ enableSorting: !0
195
+ }], U = d({}), re = [{
196
+ accessorKey: "code",
197
+ size: 100,
198
+ header: () => a("hr.employee.columns.code"),
199
+ cell: (e) => e.row.original.code,
200
+ enableSorting: !1
201
+ }, {
202
+ accessorKey: "user",
203
+ header: () => a("hr.timesheet.columns.name"),
204
+ cell: (e) => {
205
+ const t = e.row.original;
206
+ if (typeof t.user == "string") {
207
+ const l = e.row.getIsExpanded();
208
+ return s("div", {
209
+ class: "flex items-center gap-8"
210
+ }, [s("div", {
211
+ onClick: (r) => {
212
+ r.stopPropagation(), e.row.getToggleExpandedHandler()(r);
213
+ }
214
+ }, [s(Se.FmButton, {
215
+ variant: "tertiary",
216
+ icon: l ? "keyboard_arrow_up" : "keyboard_arrow_down"
217
+ }, null)]), t.user]);
218
+ }
219
+ },
220
+ enableSorting: !1
221
+ }, {
222
+ accessorKey: "start",
223
+ header: () => a("hr.timesheet.columns.start"),
224
+ cell: (e) => {
225
+ const t = e.row.original;
226
+ return (t == null ? void 0 : t.start) || "--";
227
+ },
228
+ enableSorting: !1
229
+ }, {
230
+ accessorKey: "end",
231
+ header: () => a("hr.timesheet.columns.end"),
232
+ cell: (e) => {
233
+ const t = e.row.original;
234
+ return (t == null ? void 0 : t.end) || "--";
235
+ },
236
+ enableSorting: !1
237
+ }, {
238
+ name: "duration",
239
+ accessorKey: "duration",
240
+ header: () => a("hr.timesheet.columns.hourMinute"),
241
+ cell: (e) => {
242
+ const t = e.row.original;
243
+ return t.total ? `Total: ${t.total}` : t.duration;
244
+ },
245
+ enableSorting: !1
246
+ }], Y = d(!1);
247
+ function q(e) {
248
+ m.value = e, L.value = f(m.value.startedAt).format("YYYY-MM-DD"), I.value = f(m.value.endedAt || m.value.startedAt).format("YYYY-MM-DD"), T.value = f(m.value.startedAt).format("HH:mm"), R.value = f(m.value.endedAt || m.value.startedAt).format("HH:mm"), Y.value = !0;
249
+ }
250
+ const L = d(), T = d(), I = d(), R = d(), m = d(), K = d("");
251
+ async function ie() {
252
+ const e = J(L.value, T.value), t = J(I.value, R.value);
253
+ if (f(e).isAfter(t)) {
254
+ K.value = a("hr.timesheet.checkOutMustBeforeCheckIn");
255
+ return;
256
+ }
257
+ x.minor(async () => {
258
+ await h.updateTimesheet(m.value, e, t);
259
+ }, {
260
+ successMessage: a("hr.timesheet.update.successMessage")
261
+ }), N(), Y.value = !1;
262
+ }
263
+ const J = (e, t) => f(e).set("h", parseInt(t.split(":")[0])).set("m", parseInt(t.split(":")[1])).toISOString();
264
+ return Z([L, I, T, R], ([e, t, l, r]) => {
265
+ (e || t || l || r) && (K.value = "");
266
+ }), (e, t) => {
267
+ const l = u("FmAvatar"), r = u("FmDatePicker"), g = u("FmTimePicker"), $ = u("FmIcon"), k = u("FmButton"), ue = u("FmSideSheet"), Q = u("FmChip"), de = u("FmDateRangePicker"), ce = u("FmMenuItem"), me = u("FmMenu"), pe = u("FmSpacer"), ve = u("FmSearch"), W = u("FmTable");
268
+ return E(), P(ee, null, [s(ue, {
269
+ modelValue: Y.value,
270
+ "onUpdate:modelValue": t[5] || (t[5] = (o) => Y.value = o),
271
+ "dismiss-away": "",
272
+ header: n(a)("hr.timesheet.update.title")
273
+ }, {
274
+ "side-sheet-footer": y(() => [i("div", We, [s(k, {
275
+ label: n(a)("common.update"),
276
+ size: "md",
277
+ variant: "primary",
278
+ onClick: ie
279
+ }, null, 8, ["label"]), s(k, {
280
+ label: n(a)("common.cancel"),
281
+ size: "md",
282
+ variant: "secondary",
283
+ onClick: t[4] || (t[4] = (o) => Y.value = !1)
284
+ }, null, 8, ["label"])])]),
285
+ default: y(() => [i("div", Ke, [i("div", ze, [s(l, {
286
+ name: m.value.user.name,
287
+ initials: n(Ie)(m.value.user.name),
288
+ size: "lg"
289
+ }, null, 8, ["name", "initials"]), i("div", Be, [i("div", Ne, O(n(a)("hr.timesheet.employeeName")), 1), i("div", Ue, O(m.value.user.name), 1)])]), i("div", Pe, [i("div", je, O(n(a)("hr.timesheet.update.checkIn")), 1), i("div", He, [s(r, {
290
+ modelValue: L.value,
291
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => L.value = o),
292
+ disabled: !1,
293
+ label: n(a)("hr.timesheet.update.date")
294
+ }, null, 8, ["modelValue", "label"]), s(g, {
295
+ modelValue: T.value,
296
+ "onUpdate:modelValue": t[1] || (t[1] = (o) => T.value = o),
297
+ label: n(a)("hr.timesheet.update.time")
298
+ }, null, 8, ["modelValue", "label"])])]), i("div", Ge, [i("div", qe, O(n(a)("hr.timesheet.update.checkOut")), 1), i("div", Je, [s(r, {
299
+ modelValue: I.value,
300
+ "onUpdate:modelValue": t[2] || (t[2] = (o) => I.value = o),
301
+ disabled: !1,
302
+ label: n(a)("hr.timesheet.update.date")
303
+ }, null, 8, ["modelValue", "label"]), s(g, {
304
+ modelValue: R.value,
305
+ "onUpdate:modelValue": t[3] || (t[3] = (o) => R.value = o),
306
+ label: n(a)("hr.timesheet.update.time")
307
+ }, null, 8, ["modelValue", "label"])])]), K.value ? (E(), P("div", Qe, [s($, {
308
+ color: "#FF3B30",
309
+ name: "error",
310
+ size: "sm"
311
+ }), we(" " + O(K.value), 1)])) : ge("", !0)])]),
312
+ _: 1
313
+ }, 8, ["modelValue", "header"]), i("div", Xe, [i("div", Ze, [s(Ve, {
314
+ modelValue: A.value,
315
+ "onUpdate:modelValue": t[6] || (t[6] = (o) => A.value = o),
316
+ multiple: "",
317
+ items: se.value,
318
+ variant: "dark",
319
+ "selected-prefix": n(a)("hr.role.columns.restaurants"),
320
+ placeholder: n(a)("hr.role.columns.restaurants"),
321
+ class: "!w-auto pt-[3px]"
322
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), i("div", et, [s(de, {
323
+ modelValue: n(M),
324
+ "onUpdate:modelValue": t[7] || (t[7] = (o) => ye(M) ? M.value = o : null),
325
+ "show-predefined-range": ""
326
+ }, {
327
+ "trigger-button": y(() => [s(Q, {
328
+ label: n(le)
329
+ }, null, 8, ["label"])]),
330
+ _: 1
331
+ }, 8, ["modelValue"]), s(k, {
332
+ icon: "chevron_left",
333
+ variant: "tertiary",
334
+ onClick: t[8] || (t[8] = (o) => n(G)("subtract"))
335
+ }), s(k, {
336
+ icon: "chevron_right",
337
+ variant: "tertiary",
338
+ onClick: t[9] || (t[9] = (o) => n(G)("add"))
339
+ })]), s(me, {
340
+ class: "pt-[3px]"
341
+ }, {
342
+ "menu-button": y(() => [s(Q, {
343
+ label: w.value,
344
+ "right-icon": "keyboard_arrow_down"
345
+ }, null, 8, ["label"])]),
346
+ default: y(() => [(E(), P(ee, null, _e(D, (o) => s(ce, {
347
+ key: o.value,
348
+ label: o.label,
349
+ onClick: (X) => v.value = o.value
350
+ }, null, 8, ["label", "onClick"])), 64))]),
351
+ _: 1
352
+ }), s(pe), s(ve, {
353
+ modelValue: c.value,
354
+ "onUpdate:modelValue": t[10] || (t[10] = (o) => c.value = o),
355
+ class: "w-[320px]",
356
+ placeholder: n(a)("hr.timesheet.search.placeholder")
357
+ }, null, 8, ["modelValue", "placeholder"])]), s(Ce, {
358
+ class: "w-full xs:px-16"
359
+ }, {
360
+ default: y(() => [i("div", tt, [s(Fe, {
361
+ "is-loading": F.value,
362
+ "is-empty": v.value === "listView" ? z.value.length === 0 : B.value.length === 0,
363
+ "collapse-at": !1,
364
+ title: n(a)("hr.timesheet.noData.title"),
365
+ subtitle: ""
366
+ }, {
367
+ default: y(() => [v.value === "listView" ? (E(), te(W, {
368
+ key: 0,
369
+ class: "min-w-[640px]",
370
+ "column-defs": ne,
371
+ "row-data": z.value,
372
+ "page-size": z.value.length,
373
+ loading: F.value,
374
+ "pin-header-row": "",
375
+ "hide-footer": "",
376
+ "shrink-at": !1,
377
+ onRowClick: t[11] || (t[11] = (o) => q(o.original))
378
+ }, null, 8, ["row-data", "page-size", "loading"])) : (E(), te(W, {
379
+ key: 1,
380
+ class: "min-w-[640px] timesheet-user-view",
381
+ "column-defs": re,
382
+ "row-data": B.value,
383
+ "page-size": B.value.reduce((o, X) => o + 1 + X.timesheets.length, 0),
384
+ loading: F.value,
385
+ "pin-header-row": "",
386
+ "shrink-at": !1,
387
+ "expanded-state": U.value,
388
+ "get-sub-row": (o) => o.timesheets,
389
+ "onUpdate:expandedState": t[12] || (t[12] = (o) => U.value = o),
390
+ onRowClick: t[13] || (t[13] = (o) => q(o.original))
391
+ }, null, 8, ["row-data", "page-size", "loading", "expanded-state", "get-sub-row"]))]),
392
+ _: 1
393
+ }, 8, ["is-loading", "is-empty", "title"])])]),
394
+ _: 1
395
+ })])], 64);
396
+ };
397
+ }
398
+ }), gt = /* @__PURE__ */ ke(at, [["__scopeId", "data-v-d0c6fd51"]]);
399
+ export {
400
+ gt as default
401
+ };
@@ -0,0 +1,63 @@
1
+ import { d as i } from "./dayjs.min-CtULWW1N.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-DKUCzcrc.js";
5
+ import { s as S } from "./iteration-DpHBtiyr.js";
6
+ import { i as f, f as g } from "./utils-BZkjJbju.js";
7
+ const u = {
8
+ async readTimesheets(t, s, r) {
9
+ return y(
10
+ await c().get("timesheet", {
11
+ params: { start: t, end: s, restaurantIds: r }
12
+ })
13
+ );
14
+ },
15
+ async updateTimesheet(t, s) {
16
+ await c().put(`timesheet/${t}`, s);
17
+ }
18
+ };
19
+ function A(t) {
20
+ const s = t.map((r) => {
21
+ const { startedAt: a, endedAt: o } = r, n = i(f(a)), e = o ? i(f(o)) : null, m = (e == null ? void 0 : e.diff(n, "minute", !1)) || 0, h = e ? g(m) : "", d = "YYYY-MM-DD hh:mm a";
22
+ return {
23
+ ...r,
24
+ start: n.format(d),
25
+ end: e ? e.format(d) : "",
26
+ totalMin: m,
27
+ duration: h
28
+ };
29
+ });
30
+ return S(s, { selector: "start" });
31
+ }
32
+ const D = p("timesheet", () => {
33
+ const t = l([]);
34
+ async function s(a, o, n) {
35
+ const e = await u.readTimesheets(
36
+ i(a).startOf("day").toISOString(),
37
+ i(o).endOf("day").toISOString(),
38
+ n
39
+ );
40
+ t.value = A(e);
41
+ }
42
+ async function r(a, o, n) {
43
+ await u.updateTimesheet(a.restaurantId, {
44
+ id: a._id,
45
+ startAt: o,
46
+ endAt: n
47
+ });
48
+ }
49
+ return {
50
+ timesheets: t,
51
+ readTimesheet: s,
52
+ updateTimesheet: r
53
+ };
54
+ }), x = () => {
55
+ const t = D();
56
+ return {
57
+ ...t,
58
+ ...T(t)
59
+ };
60
+ };
61
+ export {
62
+ x as u
63
+ };