@feedmepos/mf-hrm-portal 2.3.2-dev.2 → 2.3.2-dev.20

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 (82) hide show
  1. package/dist/{ApprovalCodeList-sHnINTik.js → ApprovalCodeList-eCTF8Rwt.js} +7 -7
  2. package/dist/AuditLogList-YzR5ysmN.js +2021 -0
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BbsPesWY.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang--660w-zJ.js} +2 -2
  4. package/dist/{EmployeeList-D4oy5hXz.js → EmployeeList-C2ctTGCo.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-Cl053Tg1.js → FormSection.vue_vue_type_script_setup_true_lang-DWvJM14K.js} +1 -1
  6. package/dist/{GrantUserList-LWpqhl-5.js → GrantUserList-BoN1MUkB.js} +8 -8
  7. package/dist/{Main-PBJjfzBg.js → Main-BLmTdeYO.js} +5 -5
  8. package/dist/{Main-BWKb-QIE.js → Main-CIldvI5X.js} +2274 -2280
  9. package/dist/{Main-CVGiOYpC.js → Main-Di-083Pw.js} +29 -29
  10. package/dist/MyPosProfile-CctvT3RF.js +360 -0
  11. package/dist/{PermissionSetList-D2qZVlF4.js → PermissionSetList-BzvVAzwG.js} +126 -126
  12. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-JgrJvMly.js +4212 -0
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DRGTxOMW.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-BdjAh48A.js} +414 -448
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-DFDTw0lj.js → RoleForm.vue_vue_type_script_setup_true_lang-WCNUeA3G.js} +74 -74
  15. package/dist/{RoleList-DG0crFzW.js → RoleList-wPupuMBG.js} +7 -7
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-Cs0rhCa3.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DcBIt4DL.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-C4J6jYtG.js → ScheduleGeneralPage-NCKqPyt5.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-3UqO6uPu.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CG5Xxj3Q.js} +4 -4
  19. package/dist/{SchedulePage-ICzggri0.js → SchedulePage-BZ5bKLly.js} +197 -209
  20. package/dist/{SchedulePositionPage-BshUCd_C.js → SchedulePositionPage-CwHd3rf2.js} +3 -3
  21. package/dist/{SelectFilter-D9T0nFvG.js → SelectFilter-DLZNvKwI.js} +2 -3
  22. package/dist/TeamMemberList-D8uWsS0J.js +2082 -0
  23. package/dist/TimesheetList-K6doo0BX.js +408 -0
  24. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BLqgALLe.js → TimesheetList.vue_vue_type_style_index_0_scoped_ffd7f807_lang-DFoIix3D.js} +7 -7
  25. package/dist/{app-n6d4AmtP.js → app-BGzac7xv.js} +5618 -4632
  26. package/dist/app.js +1 -1
  27. package/dist/{approval-code-1j1OoXt1.js → approval-code-BBNbWSqR.js} +4 -4
  28. package/dist/{dayjs.min-DdNivv4b.js → dayjs.min-ey-9Jb-9.js} +20 -20
  29. package/dist/employee-D_COMGXq.js +237 -0
  30. package/dist/{grant-user-BmTyexk3.js → grant-user-CTTTpewT.js} +2 -2
  31. package/dist/{iteration-y_jodvfN.js → index-CTqdA7gA.js} +573 -558
  32. package/dist/{lodash-B2eWEGH4.js → lodash-DNSDZgnL.js} +1 -1
  33. package/dist/member-grant-5DnD17dB.js +54 -0
  34. package/dist/restaurant-qoOY3iMJ.js +49 -0
  35. package/dist/role-BEbd5Qsi.js +91 -0
  36. package/dist/rule-BLG5i_xT.js +845 -0
  37. package/dist/src/api/audit-log/index.d.ts +2 -0
  38. package/dist/src/api/my-pos-profile/index.d.ts +1 -3
  39. package/dist/src/composables/useTenant.d.ts +11 -0
  40. package/dist/src/helpers/employee-merge.d.ts +33 -0
  41. package/dist/src/helpers/iteration.d.ts +9 -2
  42. package/dist/src/helpers/permission-set.d.ts +1 -102
  43. package/dist/src/helpers/restaurant-lookup.d.ts +19 -0
  44. package/dist/src/helpers/role-merge.d.ts +11 -0
  45. package/dist/src/helpers/rule.d.ts +2 -2
  46. package/dist/src/router/courtGuard.d.ts +4 -0
  47. package/dist/src/stores/approval-code.d.ts +1 -1
  48. package/dist/src/stores/employee.d.ts +2 -2
  49. package/dist/src/stores/grant-user.d.ts +1 -1
  50. package/dist/src/stores/permission-assignment.d.ts +2 -2
  51. package/dist/src/stores/permission-set.d.ts +2 -2
  52. package/dist/src/stores/restaurant.d.ts +2 -2
  53. package/dist/src/stores/role.d.ts +2 -2
  54. package/dist/src/stores/team.d.ts +2 -2
  55. package/dist/src/stores/timesheet.d.ts +2 -2
  56. package/dist/src/types/my-pos-profile.d.ts +2 -3
  57. package/dist/src/views/audit-log/constants.d.ts +1 -1
  58. package/dist/src/views/audit-log/locales/index.d.ts +56 -0
  59. package/dist/src/views/audit-log/useTraceIdDeepLink.d.ts +19 -0
  60. package/dist/src/views/hr/locales/index.d.ts +4 -4
  61. package/dist/src/views/hr/timesheet/timesheet-view.d.ts +29 -0
  62. package/dist/src/views/my-pos-profile/components/PasscodeChangedDialog.vue.d.ts +1 -1
  63. package/dist/src/views/my-pos-profile/locales/index.d.ts +40 -4
  64. package/dist/style.css +1 -1
  65. package/dist/tsconfig.app.tsbuildinfo +1 -1
  66. package/dist/{useAppStore-BPARQyvJ.js → useAppStore-BwUs5XGY.js} +1 -1
  67. package/dist/{useLoading-iPESFb6R.js → useLoading-DmAqc_Gx.js} +1 -1
  68. package/dist/useMessage-_ywT_N9X.js +17 -0
  69. package/dist/useReportPermissions-PEzIBX1U.js +80 -0
  70. package/dist/useSsoProviders-CwLbvOdH.js +41 -0
  71. package/package.json +5 -5
  72. package/dist/AuditLogList-C9C2emU9.js +0 -1950
  73. package/dist/MyPosProfile-BQCBFMFw.js +0 -301
  74. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-ZSREAS1r.js +0 -4243
  75. package/dist/TeamMemberList-C970Iqlj.js +0 -2086
  76. package/dist/TimesheetList-nxhr0EWj.js +0 -402
  77. package/dist/employee-BlfleiCU.js +0 -210
  78. package/dist/member-grant-CzZUdO_s.js +0 -55
  79. package/dist/restaurant-Dl6yx37M.js +0 -51
  80. package/dist/role-DfZi7Ssk.js +0 -93
  81. package/dist/rule-ChmhcGgA.js +0 -788
  82. package/dist/useReportPermissions-By-BoJZb.js +0 -82
@@ -1,402 +0,0 @@
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-DdNivv4b.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-D9T0nFvG.js";
6
- import { _ as Se, a as Ve } from "./app-n6d4AmtP.js";
7
- import { _ as ke } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
8
- import { u as Ce } from "./useLoading-iPESFb6R.js";
9
- import { g as Fe, s as Ye } from "./iteration-y_jodvfN.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-BlfleiCU.js";
13
- import { u as Ie } from "./restaurant-Dl6yx37M.js";
14
- import { u as Re } from "./TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BLqgALLe.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
- };
@@ -1,210 +0,0 @@
1
- import { d as g } from "./dayjs.min-DdNivv4b.js";
2
- import { defineStore as $, storeToRefs as x } from "pinia";
3
- import { ref as y } from "vue";
4
- import { s as E } from "./iteration-y_jodvfN.js";
5
- import { b as l, g as m } from "./app-n6d4AmtP.js";
6
- import { i as v } from "./utils-BZkjJbju.js";
7
- import { u as P } from "./role-DfZi7Ssk.js";
8
- import { u as I } from "./restaurant-Dl6yx37M.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
- };
@@ -1,55 +0,0 @@
1
- import { m as i, s as u } from "./app-n6d4AmtP.js";
2
- import { n as a, l as m, q as l, o as d, m as p } from "./rule-ChmhcGgA.js";
3
- const f = [
4
- i.Subject.Business.restaurant,
5
- i.Subject.Business.role,
6
- i.Subject.Restaurant.restaurant,
7
- i.Subject.Business.inventory_stock
8
- ], n = (s) => f.includes(s.subject);
9
- function P(s, r) {
10
- return r.length > 0 || s.some((e) => !e.inverted && !n(e));
11
- }
12
- function j(s) {
13
- return s.filter(n);
14
- }
15
- const R = {
16
- customPermissions: [],
17
- permissions: [],
18
- permissionSetIds: [],
19
- posUser: void 0
20
- };
21
- function E(s) {
22
- const r = a(
23
- m(s.userPermissions, s.reportSubjects),
24
- s.defaultReportSubjects
25
- ), { posUser: e, savedPosUser: o } = s;
26
- return {
27
- customPermissions: l(
28
- p(s.inheritedPermissions),
29
- d(r)
30
- ),
31
- permissions: r.filter((t) => !t.inverted).map((t) => ({ ...t, subject: u(t.subject) })),
32
- permissionSetIds: s.permissionSetIds,
33
- posUser: e ? {
34
- ...e,
35
- name: e.name || (o == null ? void 0 : o.name) || s.fallbackName,
36
- code: e.code || (o == null ? void 0 : o.code) || "",
37
- passcode: e.passcode,
38
- roles: e.roles.filter((t) => !!t.roleId)
39
- } : e === null ? null : void 0
40
- };
41
- }
42
- function h(s, r) {
43
- const { posUser: e, ...o } = s;
44
- if (!e || !r || e.passcode !== r.passcode) return { ...o, posUser: e };
45
- const { passcode: t, ...c } = e;
46
- return { ...o, posUser: c };
47
- }
48
- export {
49
- R as E,
50
- f as W,
51
- E as b,
52
- P as h,
53
- h as t,
54
- j as w
55
- };