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

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 (64) hide show
  1. package/dist/{ApprovalCodeList-Bw0E-hZl.js → ApprovalCodeList-gb0bre9J.js} +7 -7
  2. package/dist/{AuditLogList-CA-_t77n.js → AuditLogList-9cwS6bL7.js} +795 -719
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-LtjNCAFN.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DR-c15gr.js} +2 -2
  4. package/dist/{EmployeeList-D_bX0EhQ.js → EmployeeList-DjyoW1we.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-BBWlADve.js} +1 -1
  6. package/dist/{GrantUserList-Cg7ITk_M.js → GrantUserList-yU2NqFVO.js} +8 -8
  7. package/dist/{Main-Bl-Ocx1G.js → Main-4KwMqF3h.js} +5 -5
  8. package/dist/{Main-BaB4vgI5.js → Main-BS_Lk_eB.js} +1005 -999
  9. package/dist/{Main-D5wi42fp.js → Main-BuG7SPnC.js} +10 -10
  10. package/dist/MyPosProfile-CuDzRaRS.js +360 -0
  11. package/dist/{PermissionSetList-kgG9H3DX.js → PermissionSetList-D7SS1iAr.js} +30 -29
  12. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-y1YcZpGA.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-u1UlV2Aw.js} +902 -901
  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-CYkv2x_y.js} +1 -1
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-3Q8udk43.js → RoleForm.vue_vue_type_script_setup_true_lang-hiMgwiya.js} +9 -9
  15. package/dist/{RoleList-Cmz97HHP.js → RoleList-B3P-LQYV.js} +7 -7
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CggEy3OI.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang--dsZOhnv.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-B39k3SQH.js → ScheduleGeneralPage-Pq6ufiDu.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-C5j3D4eF.js → ScheduleModal.vue_vue_type_script_setup_true_lang-DKFJLsTW.js} +4 -4
  19. package/dist/{SchedulePage-AVmRkFi1.js → SchedulePage-8EAOfiJx.js} +189 -201
  20. package/dist/{SchedulePositionPage-3rE-O8CG.js → SchedulePositionPage-CGXeUnju.js} +3 -3
  21. package/dist/{SelectFilter-R7ry_GEg.js → SelectFilter-C-UEVLla.js} +1 -1
  22. package/dist/{TeamMemberList-CvDnIILn.js → TeamMemberList-Bd1O44Ur.js} +102 -101
  23. package/dist/TimesheetList-CSCmigCM.js +437 -0
  24. package/dist/{app-DKUCzcrc.js → app-BohKQtlz.js} +82 -14
  25. package/dist/app.js +1 -1
  26. package/dist/{approval-code-nsETgIry.js → approval-code-Bfvxsg8h.js} +4 -4
  27. package/dist/{dayjs.min-CtULWW1N.js → dayjs.min-C0MqTPg1.js} +1 -1
  28. package/dist/employee-DWxT78W2.js +172 -0
  29. package/dist/{grant-user-Dpa_Rl6j.js → grant-user-LZ3b6siI.js} +2 -2
  30. package/dist/{iteration-DpHBtiyr.js → index-DDDG-LHm.js} +698 -726
  31. package/dist/iteration-CcXrOMQe.js +30 -0
  32. package/dist/{lodash-YaHCUo_F.js → lodash-BRqMda7F.js} +1 -1
  33. package/dist/{member-grant-CEokFI3_.js → member-grant-a3AGCWfT.js} +2 -2
  34. package/dist/{restaurant-CDFKqEFm.js → restaurant-pL7vHt-H.js} +2 -2
  35. package/dist/{role-DyBVVlEA.js → role--EKCVqho.js} +8 -7
  36. package/dist/{rule-xErZqYmH.js → rule-Db3gFVHx.js} +83 -82
  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/src/views/my-pos-profile/components/PasscodeChangedDialog.vue.d.ts +1 -1
  52. package/dist/src/views/my-pos-profile/locales/index.d.ts +40 -0
  53. package/dist/style.css +1 -1
  54. package/dist/timesheet-NYW1P4rf.js +76 -0
  55. package/dist/tsconfig.app.tsbuildinfo +1 -1
  56. package/dist/{useAppStore-BqsvPsPB.js → useAppStore-DV13z6oc.js} +1 -1
  57. package/dist/{useLoading-BS1bnZg1.js → useLoading-Fcnnfywt.js} +1 -1
  58. package/dist/useMessage-_ywT_N9X.js +17 -0
  59. package/dist/{useReportPermissions-DJEhkyGc.js → useReportPermissions-BcyVoKVq.js} +13 -13
  60. package/package.json +3 -3
  61. package/dist/MyPosProfile-CUG_201f.js +0 -290
  62. package/dist/TimesheetList-DYoglTi8.js +0 -401
  63. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_d0c6fd51_lang-DBpzyQ17.js +0 -63
  64. package/dist/employee-DlsSqR3i.js +0 -210
@@ -1,401 +0,0 @@
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
- };
@@ -1,63 +0,0 @@
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
- };
@@ -1,210 +0,0 @@
1
- import { d as g } from "./dayjs.min-CtULWW1N.js";
2
- import { defineStore as $, storeToRefs as x } from "pinia";
3
- import { ref as y } from "vue";
4
- import { s as E } from "./iteration-DpHBtiyr.js";
5
- import { b as l, g as m } from "./app-DKUCzcrc.js";
6
- import { i as v } from "./utils-BZkjJbju.js";
7
- import { u as P } from "./role-DyBVVlEA.js";
8
- import { u as I } from "./restaurant-CDFKqEFm.js";
9
- const o = {
10
- async readEmployees() {
11
- return m(await l().get("/pos-users"));
12
- },
13
- async readEmployeesPage(e) {
14
- var t, i;
15
- return m(
16
- await l().get("/pos-users/paged", {
17
- params: {
18
- limit: e.limit,
19
- offset: e.offset,
20
- search: e.search,
21
- restaurantIds: (t = e.restaurantIds) != null && t.length ? e.restaurantIds : void 0,
22
- roleIds: (i = e.roleIds) != null && i.length ? e.roleIds : void 0,
23
- includeEmptyPasscode: e.includeEmptyPasscode || void 0
24
- }
25
- })
26
- );
27
- },
28
- async createEmployee(e) {
29
- return m(
30
- await l().post("/pos-users", e)
31
- ).employeeId;
32
- },
33
- async createMasterEmployee(e) {
34
- return m(
35
- await l().post("/pos-users/master-user", e)
36
- ).employeeId;
37
- },
38
- async migrateToMasterEmployee(e, t) {
39
- await l().put(`/pos-users/migrate/${e}`, t);
40
- },
41
- async updateEmployee(e, t) {
42
- await l().put(`/pos-users/${e}`, t);
43
- },
44
- async updateMasterEmployee(e, t) {
45
- await l().put(`/pos-users/master-user/${e}`, t);
46
- },
47
- async deleteEmployee(e) {
48
- await l().put(`/pos-users/${e._id}`, {
49
- user: e,
50
- roles: [],
51
- previousRoles: e.restaurants.map((t) => ({
52
- restaurantId: t.restaurantId,
53
- roleId: t.roleId
54
- }))
55
- });
56
- },
57
- async deleteMasterEmployee(e) {
58
- await l().put(`/pos-users/master-user/${e._id}`, {
59
- user: e,
60
- roles: [],
61
- previousRoles: e.restaurants.map((t) => ({
62
- restaurantId: t.restaurantId,
63
- roleId: t.roleId
64
- }))
65
- });
66
- },
67
- async generateEmployeePasscode(e) {
68
- return `${m(
69
- await l().post("/pos-users/generate-passcode", {
70
- restaurantIds: e.restaurantIds,
71
- excludePosUserId: e.excludePosUserId
72
- })
73
- )}`;
74
- },
75
- async syncUsersMeta() {
76
- await l().post("/pos-users/create-users-meta");
77
- }
78
- };
79
- async function T(e) {
80
- const t = P().roles.value, { restaurants: i } = I(), c = new Map(
81
- i.value.map((a) => [a._id, a.profile.name])
82
- ), u = new Map(t.map((a) => [a._id, a.name])), r = /* @__PURE__ */ new Map();
83
- for (const a of e) {
84
- const n = {
85
- restaurantId: a.restaurantId,
86
- restaurantName: c.get(a.restaurantId) || "",
87
- roleId: a.role,
88
- roleName: u.get(a.role) || ""
89
- }, d = r.get(a._id);
90
- if (!d) {
91
- r.set(a._id, {
92
- ...a,
93
- isRestricted: !1,
94
- since: g(v(a._id)).format("DD/MM/YYYY"),
95
- restaurants: [n]
96
- });
97
- continue;
98
- }
99
- d.restaurants.some((f) => f.restaurantId === a.restaurantId) || (d.restaurants = E([...d.restaurants, n], {
100
- selector: "restaurantName"
101
- }));
102
- }
103
- return E([...r.values()], { selector: "name" });
104
- }
105
- function M(e) {
106
- const { restaurants: t } = I(), i = P().roles.value, c = new Map(
107
- t.value.map((a) => [a._id, a])
108
- ), u = new Map(i.map((a) => [a._id, a.name])), r = e.restaurantRole[0];
109
- return {
110
- _id: e._id,
111
- name: e.name,
112
- code: e.code,
113
- passcode: e.passcode,
114
- isMasterUser: e.isMasterUser,
115
- isRestricted: e.isRestricted,
116
- restaurantId: (r == null ? void 0 : r.restaurantId) || "",
117
- role: (r == null ? void 0 : r.roleId) || "",
118
- since: g(v(e._id)).format("DD/MM/YYYY"),
119
- restaurants: E(
120
- e.restaurantRole.map((a) => {
121
- const n = c.get(a.restaurantId);
122
- return {
123
- restaurantId: a.restaurantId,
124
- restaurantName: (n == null ? void 0 : n.profile.name) || "",
125
- restaurantCode: (n == null ? void 0 : n.profile.code) ?? void 0,
126
- roleId: a.roleId,
127
- roleName: u.get(a.roleId) || ""
128
- };
129
- }),
130
- { selector: "restaurantName" }
131
- )
132
- };
133
- }
134
- const h = $("employee", () => {
135
- const e = I(), t = y([]), i = y([]), c = y(0), u = y(!1);
136
- async function r() {
137
- try {
138
- u.value = !0, await e.readRestaurants();
139
- const s = await o.readEmployees();
140
- t.value = await T(s);
141
- } finally {
142
- u.value = !1;
143
- }
144
- }
145
- async function a(s) {
146
- try {
147
- u.value = !0, await e.readRestaurants();
148
- const p = await o.readEmployeesPage(s);
149
- i.value = p.items.map(M), c.value = p.total;
150
- } finally {
151
- u.value = !1;
152
- }
153
- }
154
- async function n(s, p) {
155
- await e.readRestaurants();
156
- const w = p ?? (await o.readEmployeesPage({ ...s, limit: 1, offset: 0 })).total;
157
- return w === 0 ? [] : (await o.readEmployeesPage({ ...s, limit: w, offset: 0 })).items.map(M);
158
- }
159
- async function d(s) {
160
- return o.createEmployee(s);
161
- }
162
- async function f(s, p) {
163
- await o.updateEmployee(s, p);
164
- }
165
- async function _(s) {
166
- await o.deleteEmployee(s);
167
- }
168
- async function U(s) {
169
- await o.deleteMasterEmployee(s);
170
- }
171
- async function Y(s) {
172
- return o.createMasterEmployee(s);
173
- }
174
- async function N(s, p) {
175
- await o.updateMasterEmployee(s, p);
176
- }
177
- async function S(s, p) {
178
- await o.migrateToMasterEmployee(s, p);
179
- }
180
- async function D() {
181
- await o.syncUsersMeta();
182
- }
183
- return {
184
- employees: t,
185
- listEmployees: i,
186
- totalEmployees: c,
187
- isLoading: u,
188
- readEmployees: r,
189
- readEmployeesPage: a,
190
- readAllEmployeesPage: n,
191
- createEmployee: d,
192
- updateEmployee: f,
193
- deleteEmployee: _,
194
- createMasterEmployee: Y,
195
- updateMasterEmployee: N,
196
- deleteMasterEmployee: U,
197
- migrateToMasterUser: S,
198
- syncUsersMeta: D
199
- };
200
- }), B = () => {
201
- const e = h();
202
- return {
203
- ...e,
204
- ...x(e)
205
- };
206
- };
207
- export {
208
- o as E,
209
- B as u
210
- };