@feedmepos/mf-hrm-portal 2.3.2-dev.11 → 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-DoNoFW6w.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-C1dLOPFb.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BZQNDOg7.js} +10 -10
  4. package/dist/{EmployeeList-BX9gy9WG.js → EmployeeList-CRI7XjzX.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-iCgTyICI.js → FormSection.vue_vue_type_script_setup_true_lang-y9_hxba6.js} +1 -1
  6. package/dist/{GrantUserList-DNvmmlDI.js → GrantUserList-DbMngkpK.js} +8 -8
  7. package/dist/{Main-BHmY7VHC.js → Main-BsFUfsmP.js} +29 -29
  8. package/dist/{Main-SzU5H5uC.js → Main-CrnM6wr8.js} +623 -629
  9. package/dist/{Main-2NivoQNg.js → Main-D4Zq5AXi.js} +5 -5
  10. package/dist/{MyPosProfile-2W5mT5d5.js → MyPosProfile-B4cE47im.js} +1 -1
  11. package/dist/{PermissionSetList-BCAm8rHm.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-DYbfmF2P.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-COX-N0k6.js} +33 -33
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-o4mXv2hT.js → RoleForm.vue_vue_type_script_setup_true_lang-D8V8KWiL.js} +41 -41
  15. package/dist/{RoleList-BXkyCeH0.js → RoleList-BC-c7fqn.js} +105 -96
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DOxRdHY1.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DBbuSrXV.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-4hV53-q6.js → ScheduleGeneralPage-eytzOZQr.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-D5jOHLA1.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CP-kToVO.js} +4 -4
  19. package/dist/{SchedulePage-CqNa_p32.js → SchedulePage-B0QirzAk.js} +17 -17
  20. package/dist/{SchedulePositionPage-7xYBe1xd.js → SchedulePositionPage-BAE-NQvL.js} +3 -3
  21. package/dist/{SelectFilter-Dy2Nv1_D.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-C37qvNnc.js → app-B9qAxMj1.js} +3516 -3470
  26. package/dist/app.js +1 -1
  27. package/dist/{approval-code-B7rpc4Oe.js → approval-code-CTgj9q6m.js} +1 -1
  28. package/dist/{dayjs.min-D35yhU4A.js → dayjs.min-giCSI3N8.js} +22 -22
  29. package/dist/employee-BD3NXG8h.js +210 -0
  30. package/dist/{grant-user-CostZ0Md.js → grant-user-jeTFzGU1.js} +1 -1
  31. package/dist/{index-DPiNc7mn.js → iteration-Tyg43nH0.js} +726 -698
  32. package/dist/{lodash-C8MGI_QW.js → lodash-CZsDR_DU.js} +1 -1
  33. package/dist/{member-grant-CktOoicv.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-EYBPBkv_.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-BmBJPo1_.js → useAppStore-CkUZ2H5h.js} +1 -1
  49. package/dist/{useLoading-BtyGXkm_.js → useLoading-DJHJM5E0.js} +1 -1
  50. package/dist/useReportPermissions-2dfIX21b.js +80 -0
  51. package/dist/{useSsoProviders-CZrTNgfp.js → useSsoProviders-BarGHndw.js} +1 -1
  52. package/package.json +2 -2
  53. package/dist/AuditLogList-D5M0cl8g.js +0 -2026
  54. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-e2vu_Mcn.js +0 -4208
  55. package/dist/TeamMemberList-okhiXdLg.js +0 -2087
  56. package/dist/TimesheetList-BKj9OnJW.js +0 -437
  57. package/dist/employee-Bn6HTMxg.js +0 -172
  58. package/dist/iteration-CcXrOMQe.js +0 -30
  59. package/dist/restaurant-BgvuJL8G.js +0 -52
  60. package/dist/role-D8G5QOG1.js +0 -98
  61. package/dist/timesheet-D6jBeR-V.js +0 -76
  62. package/dist/useReportPermissions-C8z7EA7v.js +0 -82
@@ -1,437 +0,0 @@
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-D35yhU4A.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-Dy2Nv1_D.js";
6
- import { _ as Me } from "./app-C37qvNnc.js";
7
- import { _ as xe } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
- import { u as ke } from "./useLoading-BtyGXkm_.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-BgvuJL8G.js";
13
- import { u as Te } from "./timesheet-D6jBeR-V.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
- };
@@ -1,172 +0,0 @@
1
- import { d as S } from "./dayjs.min-D35yhU4A.js";
2
- import { defineStore as _, storeToRefs as $ } from "pinia";
3
- import { ref as u } from "vue";
4
- import "./index-DPiNc7mn.js";
5
- import { b as n, g as m } from "./app-C37qvNnc.js";
6
- import { s as h } from "./iteration-CcXrOMQe.js";
7
- import { i as T } from "./utils-BZkjJbju.js";
8
- import { u as x } from "./role-D8G5QOG1.js";
9
- import { u as f } from "./restaurant-BgvuJL8G.js";
10
- const r = {
11
- async readEmployeesPage(e) {
12
- var s, l;
13
- return m(
14
- await n().get("/pos-users/paged", {
15
- params: {
16
- limit: e.limit,
17
- offset: e.offset,
18
- search: e.search,
19
- restaurantIds: (s = e.restaurantIds) != null && s.length ? e.restaurantIds : void 0,
20
- roleIds: (l = e.roleIds) != null && l.length ? e.roleIds : void 0,
21
- includeEmptyPasscode: e.includeEmptyPasscode || void 0
22
- }
23
- })
24
- );
25
- },
26
- async createEmployee(e) {
27
- return m(
28
- await n().post("/pos-users", e)
29
- ).employeeId;
30
- },
31
- async createMasterEmployee(e) {
32
- return m(
33
- await n().post("/pos-users/master-user", e)
34
- ).employeeId;
35
- },
36
- async migrateToMasterEmployee(e, s) {
37
- await n().put(`/pos-users/migrate/${e}`, s);
38
- },
39
- async updateEmployee(e, s) {
40
- await n().put(`/pos-users/${e}`, s);
41
- },
42
- async updateMasterEmployee(e, s) {
43
- await n().put(`/pos-users/master-user/${e}`, s);
44
- },
45
- async deleteEmployee(e) {
46
- await n().put(`/pos-users/${e._id}`, {
47
- user: e,
48
- roles: [],
49
- previousRoles: e.restaurants.map((s) => ({
50
- restaurantId: s.restaurantId,
51
- roleId: s.roleId
52
- }))
53
- });
54
- },
55
- async deleteMasterEmployee(e) {
56
- await n().put(`/pos-users/master-user/${e._id}`, {
57
- user: e,
58
- roles: [],
59
- previousRoles: e.restaurants.map((s) => ({
60
- restaurantId: s.restaurantId,
61
- roleId: s.roleId
62
- }))
63
- });
64
- },
65
- async generateEmployeePasscode(e) {
66
- return `${m(
67
- await n().post("/pos-users/generate-passcode", {
68
- restaurantIds: e.restaurantIds,
69
- excludePosUserId: e.excludePosUserId
70
- })
71
- )}`;
72
- },
73
- async syncUsersMeta() {
74
- await n().post("/pos-users/create-users-meta");
75
- }
76
- };
77
- function E(e) {
78
- const { restaurants: s } = f(), l = x().roles.value, c = new Map(
79
- s.value.map((a) => [a._id, a])
80
- ), d = new Map(l.map((a) => [a._id, a.name])), p = e.restaurantRole[0];
81
- return {
82
- _id: e._id,
83
- name: e.name,
84
- code: e.code,
85
- passcode: e.passcode,
86
- isMasterUser: e.isMasterUser,
87
- isRestricted: e.isRestricted,
88
- restaurantId: (p == null ? void 0 : p.restaurantId) || "",
89
- role: (p == null ? void 0 : p.roleId) || "",
90
- since: S(T(e._id)).format("DD/MM/YYYY"),
91
- restaurants: h(
92
- e.restaurantRole.map((a) => {
93
- const i = c.get(a.restaurantId);
94
- return {
95
- restaurantId: a.restaurantId,
96
- restaurantName: (i == null ? void 0 : i.profile.name) || "",
97
- restaurantCode: (i == null ? void 0 : i.profile.code) ?? void 0,
98
- roleId: a.roleId,
99
- roleName: d.get(a.roleId) || ""
100
- };
101
- }),
102
- { selector: "restaurantName" }
103
- )
104
- };
105
- }
106
- const D = _("hrm-employee", () => {
107
- const e = f(), s = u([]), l = u([]), c = u(0), d = u(!1);
108
- async function p(t) {
109
- try {
110
- d.value = !0, await e.readRestaurants();
111
- const o = await r.readEmployeesPage(t);
112
- l.value = o.items.map(E), c.value = o.total;
113
- } finally {
114
- d.value = !1;
115
- }
116
- }
117
- async function a(t, o) {
118
- await e.readRestaurants();
119
- const y = o ?? (await r.readEmployeesPage({ ...t, limit: 1, offset: 0 })).total;
120
- return y === 0 ? [] : (await r.readEmployeesPage({ ...t, limit: y, offset: 0 })).items.map(E);
121
- }
122
- async function i(t) {
123
- return r.createEmployee(t);
124
- }
125
- async function I(t, o) {
126
- await r.updateEmployee(t, o);
127
- }
128
- async function w(t) {
129
- await r.deleteEmployee(t);
130
- }
131
- async function M(t) {
132
- await r.deleteMasterEmployee(t);
133
- }
134
- async function g(t) {
135
- return r.createMasterEmployee(t);
136
- }
137
- async function v(t, o) {
138
- await r.updateMasterEmployee(t, o);
139
- }
140
- async function P(t, o) {
141
- await r.migrateToMasterEmployee(t, o);
142
- }
143
- async function U() {
144
- await r.syncUsersMeta();
145
- }
146
- return {
147
- employees: s,
148
- listEmployees: l,
149
- totalEmployees: c,
150
- isLoading: d,
151
- readEmployeesPage: p,
152
- readAllEmployeesPage: a,
153
- createEmployee: i,
154
- updateEmployee: I,
155
- deleteEmployee: w,
156
- createMasterEmployee: g,
157
- updateMasterEmployee: v,
158
- deleteMasterEmployee: M,
159
- migrateToMasterUser: P,
160
- syncUsersMeta: U
161
- };
162
- }), z = () => {
163
- const e = D();
164
- return {
165
- ...e,
166
- ...$(e)
167
- };
168
- };
169
- export {
170
- r as E,
171
- z as u
172
- };
@@ -1,30 +0,0 @@
1
- function d(e, r = []) {
2
- const c = JSON.parse(JSON.stringify(e));
3
- return r.length > 0 && r.forEach((s) => {
4
- c[s] !== void 0 && delete c[s];
5
- }), c;
6
- }
7
- function f(e, r) {
8
- return r === void 0 ? e : typeof r == "function" ? r(e) : `${e[r]}`;
9
- }
10
- function g(e, r) {
11
- return d(e).sort((s, u) => {
12
- let n = f(s, r == null ? void 0 : r.selector), t = f(u, r == null ? void 0 : r.selector);
13
- if (r != null && r.descending) {
14
- const [a, l] = [n, t];
15
- n = l, t = a;
16
- }
17
- return n.localeCompare(t, "en", { numeric: !0, sensitivity: "base" });
18
- });
19
- }
20
- function i(e, r) {
21
- return e.reduce((c, s) => {
22
- const u = f(s, r);
23
- return c[u] = [...c[u] || [], s], c;
24
- }, {});
25
- }
26
- export {
27
- d as c,
28
- i as g,
29
- g as s
30
- };
@@ -1,52 +0,0 @@
1
- import { defineStore as m, storeToRefs as y } from "pinia";
2
- import { ref as i, computed as R } from "vue";
3
- import { useCoreStore as g } from "@feedmepos/mf-common";
4
- import { b as f, g as w } from "./app-C37qvNnc.js";
5
- const I = {
6
- async readRestaurants() {
7
- return w(await f().get("/hr-restaurants"));
8
- },
9
- async saveOperationalHours(e, a) {
10
- await f(`restaurants/${e}/schedules`).patch(
11
- "operational-hours",
12
- { operatingHours: a }
13
- );
14
- }
15
- }, h = m("hrm-restaurant", () => {
16
- const { currentBusiness: e } = g(), a = i([]), v = R(() => new Map(a.value.map((r) => [r._id, r]))), o = i(!1), u = i(null);
17
- let t = null, s = null;
18
- async function p(r = !1) {
19
- var c, d;
20
- const n = ((c = e.value) == null ? void 0 : c._id) ?? ((d = e.value) == null ? void 0 : d.id) ?? null;
21
- if (!n) {
22
- a.value = [], u.value = null, t = null, s = null;
23
- return;
24
- }
25
- if (u.value && u.value !== n && (a.value = [], u.value = null), s && s !== n && (t = null, s = null), !r && u.value === n) return;
26
- if (!r && t && s === n)
27
- return await t;
28
- let l = null;
29
- try {
30
- o.value = !0, l = (async () => {
31
- a.value = await I.readRestaurants(), u.value = n;
32
- })(), t = l, s = n, await l;
33
- } finally {
34
- t === l && (t = null, s = null), o.value = !1;
35
- }
36
- }
37
- return {
38
- restaurants: a,
39
- restaurantsById: v,
40
- isLoading: o,
41
- readRestaurants: p
42
- };
43
- }), A = () => {
44
- const e = h();
45
- return {
46
- ...e,
47
- ...y(e)
48
- };
49
- };
50
- export {
51
- A as u
52
- };