@feedmepos/mf-hrm-portal 2.0.10 → 2.0.11-dev

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 (44) hide show
  1. package/dist/AuditLogList-C7QcWwHq.js +941 -0
  2. package/dist/EmployeeList-CQzS4gXV.js +690 -0
  3. package/dist/{Main-D9233aXd.js → Main-6td6JhCb.js} +1055 -1054
  4. package/dist/{Main-6YVJ8qeK.js → Main-BhNhmkn8.js} +4 -4
  5. package/dist/{Main-BSaeTSWh.js → Main-Bu-UNnSQ.js} +6 -6
  6. package/dist/{PermissionSetList-vA7XmeDX.js → PermissionSetList-IG15Aj5D.js} +124 -128
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CrL1DmdL.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CDA9oDkd.js} +707 -707
  8. package/dist/RoleList-Cziztrpo.js +519 -0
  9. package/dist/TeamMemberList-DwxhZcrA.js +1081 -0
  10. package/dist/{TimesheetList-HsH2fi2o.js → TimesheetList-D_JT5iyS.js} +74 -74
  11. package/dist/{app-CvSQBSNk.js → app-h2mRYtCE.js} +4 -4
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-Cje6yZS4.js → dayjs.min-QbzmY4D1.js} +1 -1
  14. package/dist/employee-CY4sYUu8.js +232 -0
  15. package/dist/{index-CUPMZ2Nm.js → index-BLm_-G4e.js} +104 -81
  16. package/dist/{index-J8WRP1Mb.js → index-CBgvOHm7.js} +1 -1
  17. package/dist/{iteration-tLtr3UA8.js → iteration-J_5O7DIo.js} +2 -2
  18. package/dist/{lodash-CrQQQutG.js → lodash-btS1GWf0.js} +1 -1
  19. package/dist/src/api/employee/index.d.ts +4 -3
  20. package/dist/src/api/team/index.d.ts +3 -1
  21. package/dist/src/components/table/TablePagination.vue.d.ts +14 -0
  22. package/dist/src/composables/useDebounce.d.ts +9 -0
  23. package/dist/src/stores/employee.d.ts +515 -6
  24. package/dist/src/stores/team.d.ts +6 -0
  25. package/dist/src/types/employee.d.ts +35 -1
  26. package/dist/src/types/team.d.ts +18 -2
  27. package/dist/src/views/hr/employee/EmployeeForm.vue.d.ts +6 -2
  28. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +3 -0
  29. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +9 -0
  30. package/dist/src/views/team/member/TeamMemberMasterUser.vue.d.ts +5 -5
  31. package/dist/style.css +1 -1
  32. package/dist/{timesheet-Cj5r4laf.js → timesheet-B4Vja79b.js} +3 -3
  33. package/dist/tsconfig.app.tsbuildinfo +1 -1
  34. package/dist/{useAppStore-BFge6TcH.js → useAppStore-CEidzV7L.js} +1 -1
  35. package/dist/useDebounce-Cnv3r01W.js +83 -0
  36. package/dist/{useLoading-D5jjAdvm.js → useLoading-fH82N_CS.js} +1 -1
  37. package/dist/{useReportPermissions-BeIK2wRH.js → useReportPermissions-BZS4zPhT.js} +3 -3
  38. package/package.json +1 -1
  39. package/dist/AuditLogList-DICsmRKu.js +0 -915
  40. package/dist/EmployeeList-BeTBQG6y.js +0 -621
  41. package/dist/RoleList-BwZRlJSm.js +0 -499
  42. package/dist/TeamMemberList-DqMVgyU0.js +0 -989
  43. package/dist/employee-Bvza5QKq.js +0 -145
  44. package/dist/team-eAkNf8XU.js +0 -33
@@ -1,915 +0,0 @@
1
- import { defineComponent as Ce, ref as p, computed as S, onMounted as dt, onBeforeUnmount as ct, watch as oe, resolveComponent as O, createElementBlock as f, openBlock as c, createBlock as se, createCommentVNode as T, createElementVNode as l, Fragment as ee, renderList as ne, withCtx as z, createVNode as r, toDisplayString as i, unref as n, nextTick as mt } from "vue";
2
- import { d as v } from "./dayjs.min-Cje6yZS4.js";
3
- import { useI18n as Ae, useCoreStore as ft } from "@feedmepos/mf-common";
4
- import { I as Te, _ as vt } from "./app-CvSQBSNk.js";
5
- import { components as Ve } from "@feedmepos/ui-library";
6
- import { g as pt, b as gt } from "./iteration-tLtr3UA8.js";
7
- import { S as ce } from "./SelectFilter-DUj7GBtT.js";
8
- import { _ as bt } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
- import { _ as ht } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
10
- import { p as Pe } from "./index-CUPMZ2Nm.js";
11
- import { u as _t } from "./team-eAkNf8XU.js";
12
- const be = [
13
- { key: "all", label: "All", subjectPrefixes: [] },
14
- { key: "inventory", label: "Inventory", subjectPrefixes: ["business::inventory", "inventory"] },
15
- { key: "report", label: "Report", subjectPrefixes: ["business::report", "report"] },
16
- { key: "hrm", label: "HRM", subjectPrefixes: ["business::hrm", "hrm"] },
17
- { key: "payment", label: "Payment", subjectPrefixes: ["business::payment", "payment"] },
18
- { key: "menu", label: "Menu", subjectPrefixes: ["business::menu", "menu"] },
19
- { key: "crm", label: "CRM", subjectPrefixes: ["business::crm", "crm"] }
20
- // Add more as modules are revamped with new actionguard:
21
- // { key: 'restaurantOperation', label: 'Restaurant Operation', subjectPrefixes: ['restaurant'] },
22
- ], yt = "/audit-logs", Oe = {
23
- async read(s) {
24
- var h, V, E, F, k;
25
- const a = {
26
- limit: (s == null ? void 0 : s.limit) ?? 100,
27
- offset: (s == null ? void 0 : s.offset) ?? 0,
28
- ...s != null && s.from ? { from: s.from } : {},
29
- ...s != null && s.to ? { to: s.to } : {},
30
- ...(h = s == null ? void 0 : s.userIds) != null && h.length ? { userIds: s.userIds } : {},
31
- ...(V = s == null ? void 0 : s.subjects) != null && V.length ? { subjects: s.subjects } : {},
32
- ...(E = s == null ? void 0 : s.subjectPrefixes) != null && E.length ? { subjectPrefixes: s.subjectPrefixes } : {},
33
- ...(F = s == null ? void 0 : s.actions) != null && F.length ? { actions: s.actions } : {},
34
- ...(k = s == null ? void 0 : s.outcomes) != null && k.length ? { outcomes: s.outcomes } : {}
35
- };
36
- return console.log("[AuditLogAPI] request params:", a), pt(
37
- await gt().get(yt, {
38
- params: a,
39
- // Serialize arrays as repeated params: key=val1&key=val2
40
- // (NestJS @Query expects this; axios default adds brackets which break matching)
41
- paramsSerializer: (o) => {
42
- const D = new URLSearchParams();
43
- for (const [g, _] of Object.entries(o))
44
- if (Array.isArray(_))
45
- for (const j of _) D.append(g, String(j));
46
- else _ != null && D.append(g, String(_));
47
- return console.log("[AuditLogAPI] serialized query string:", D.toString()), D.toString();
48
- }
49
- })
50
- );
51
- }
52
- }, xt = { class: "flex h-[46px] items-center gap-8 rounded-sm px-16 hover:bg-fm-color-opacity-sm" }, Lt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, St = {
53
- "data-more-measure": "",
54
- class: "flex h-[46px] items-center gap-8 rounded-sm px-16"
55
- }, kt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, wt = /* @__PURE__ */ Ce({
56
- __name: "AuditLogModuleTabs",
57
- props: {
58
- modelValue: {},
59
- items: {}
60
- },
61
- emits: ["update:modelValue"],
62
- setup(s, { emit: a }) {
63
- const h = s, V = a, { t: E } = Ae(), F = p(!1), k = p(null), o = p(null), D = p([]), g = p(0), _ = p(0);
64
- let j = null;
65
- async function K() {
66
- if (await mt(), !o.value) return;
67
- const m = o.value.querySelectorAll("[data-tab-measure]");
68
- D.value = Array.from(m).map((Y) => Y.offsetWidth);
69
- const b = o.value.querySelector("[data-more-measure]");
70
- g.value = (b == null ? void 0 : b.offsetWidth) ?? 0;
71
- }
72
- const q = S(() => {
73
- const m = h.items.length;
74
- if (m === 0) return 0;
75
- if (!_.value || D.value.length !== m) return m;
76
- const b = D.value;
77
- if (b.reduce((u, J) => u + J, 0) <= _.value) return m;
78
- const I = g.value;
79
- let B = 0, N = 0;
80
- for (let u = 0; u < m && !(B + b[u] + I > _.value); u++)
81
- B += b[u], N++;
82
- return N;
83
- }), R = S(() => {
84
- const m = q.value, b = h.items.length;
85
- if (m >= b) return [...h.items];
86
- const Y = h.items.slice(0, m), I = h.items.find((C) => C.value === h.modelValue);
87
- if (!I || Y.some((C) => C.value === I.value)) return Y;
88
- if (m === 0) return [I];
89
- const B = h.items.findIndex((C) => C.value === I.value), N = D.value, u = g.value, J = N[B] ?? 0;
90
- let y = m, ie = N.slice(0, y - 1).reduce((C, ae) => C + ae, 0);
91
- for (; y > 1 && ie + J + u > _.value; )
92
- y--, ie = N.slice(0, y - 1).reduce((C, ae) => C + ae, 0);
93
- return [...h.items.slice(0, Math.max(y - 1, 0)), I];
94
- }), U = S(() => {
95
- const m = new Set(R.value.map((b) => b.value));
96
- return h.items.filter((b) => !m.has(b.value));
97
- });
98
- function $(m) {
99
- F.value = !1, V("update:modelValue", m);
100
- }
101
- return dt(async () => {
102
- await K(), k.value && (_.value = k.value.clientWidth, j = new ResizeObserver(() => {
103
- k.value && (_.value = k.value.clientWidth);
104
- }), j.observe(k.value));
105
- }), ct(() => {
106
- j == null || j.disconnect(), j = null;
107
- }), oe(
108
- () => h.items,
109
- () => {
110
- K();
111
- },
112
- { deep: !0 }
113
- ), (m, b) => {
114
- const Y = O("FmTab"), I = O("FmIcon"), B = O("FmMenuItem"), N = O("FmMenu");
115
- return c(), f("div", {
116
- ref_key: "containerRef",
117
- ref: k,
118
- class: "relative flex w-full flex-row items-center"
119
- }, [
120
- (c(!0), f(ee, null, ne(R.value, (u) => (c(), se(Y, {
121
- key: u.value,
122
- "model-value": s.modelValue,
123
- label: u.label,
124
- badge: u.badge,
125
- disabled: u.disabled,
126
- value: u.value,
127
- "onUpdate:modelValue": $
128
- }, null, 8, ["model-value", "label", "badge", "disabled", "value"]))), 128)),
129
- U.value.length > 0 ? (c(), se(N, {
130
- key: 0,
131
- "show-menu": F.value,
132
- class: "max-w-[360px] min-w-[90px] rounded-sm",
133
- placement: "bottom-start",
134
- onMenuChanged: b[0] || (b[0] = (u) => F.value = u)
135
- }, {
136
- "menu-button": z(() => [
137
- l("div", xt, [
138
- r(I, { name: "more_vert" }),
139
- l("span", Lt, i(n(E)("auditLog.modules.more")), 1)
140
- ])
141
- ]),
142
- default: z(() => [
143
- (c(!0), f(ee, null, ne(U.value, (u) => (c(), se(B, {
144
- key: u.value,
145
- "model-value": s.modelValue === u.value,
146
- label: u.label,
147
- disabled: u.disabled,
148
- onClick: (J) => $(u.value)
149
- }, null, 8, ["model-value", "label", "disabled", "onClick"]))), 128))
150
- ]),
151
- _: 1
152
- }, 8, ["show-menu"])) : T("", !0),
153
- l("div", {
154
- ref_key: "measurerRef",
155
- ref: o,
156
- "aria-hidden": "true",
157
- class: "pointer-events-none invisible absolute -left-[9999px] -top-[9999px] flex flex-row items-center"
158
- }, [
159
- (c(!0), f(ee, null, ne(s.items, (u) => (c(), f("div", {
160
- key: `measure-${u.value}`,
161
- "data-tab-measure": ""
162
- }, [
163
- r(Y, {
164
- "model-value": s.modelValue,
165
- label: u.label,
166
- badge: u.badge,
167
- disabled: u.disabled,
168
- value: u.value
169
- }, null, 8, ["model-value", "label", "badge", "disabled", "value"])
170
- ]))), 128)),
171
- l("div", St, [
172
- r(I, { name: "more_vert" }),
173
- l("span", kt, i(n(E)("auditLog.modules.more")), 1)
174
- ])
175
- ], 512)
176
- ], 512);
177
- };
178
- }
179
- }), Mt = {
180
- class: "flex flex-col gap-4 p-12 w-[260px]"
181
- }, Ft = {
182
- class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
183
- }, Dt = {
184
- class: "flex min-h-0 flex-1 flex-col gap-16"
185
- }, It = {
186
- class: "space-y-16"
187
- }, Tt = {
188
- class: "flex flex-wrap items-center gap-8"
189
- }, Vt = {
190
- class: "w-fit"
191
- }, Pt = {
192
- key: 0,
193
- class: "w-fit"
194
- }, Ot = {
195
- class: "w-fit"
196
- }, jt = {
197
- class: "w-fit"
198
- }, Ct = {
199
- class: "flex h-full flex-col"
200
- }, At = {
201
- key: 0,
202
- class: "flex shrink-0 items-center justify-end border-t border-fm-color-border-default py-4"
203
- }, Et = {
204
- class: "text-sm text-fm-color-typo-secondary"
205
- }, Rt = {
206
- key: 0,
207
- class: "space-y-12 p-4 text-sm"
208
- }, Ut = {
209
- class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
210
- }, $t = {
211
- class: "min-w-0 flex-1"
212
- }, Yt = {
213
- class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
214
- }, Bt = {
215
- class: "rounded-lg border border-fm-color-border-default p-12"
216
- }, Nt = {
217
- class: "space-y-12"
218
- }, Kt = {
219
- class: "text-xs text-fm-color-typo-secondary"
220
- }, qt = {
221
- class: "font-semibold"
222
- }, zt = {
223
- class: "text-xs text-fm-color-typo-secondary"
224
- }, Ht = {
225
- class: "font-semibold"
226
- }, Wt = {
227
- class: "text-xs text-fm-color-typo-secondary"
228
- }, Gt = {
229
- class: "break-all font-semibold"
230
- }, Jt = {
231
- class: "text-xs text-fm-color-typo-secondary"
232
- }, Xt = {
233
- class: "font-semibold"
234
- }, Zt = {
235
- key: 0
236
- }, Qt = {
237
- class: "text-xs text-fm-color-typo-secondary"
238
- }, ea = {
239
- class: "break-all font-mono text-xs font-semibold"
240
- }, ta = {
241
- class: "text-xs text-fm-color-typo-secondary"
242
- }, aa = {
243
- class: "break-all font-mono text-xs font-semibold"
244
- }, la = {
245
- class: "text-xs text-fm-color-typo-secondary"
246
- }, oa = {
247
- class: "font-semibold"
248
- }, sa = {
249
- key: 0,
250
- class: "rounded-lg border border-fm-color-border-default"
251
- }, na = {
252
- class: "p-12"
253
- }, ia = {
254
- class: "text-base font-bold text-fm-color-typo-primary"
255
- }, ua = {
256
- class: "space-y-12 p-12"
257
- }, ra = {
258
- class: "text-xs text-fm-color-typo-secondary"
259
- }, da = {
260
- class: "font-semibold"
261
- }, ca = {
262
- class: "rounded-lg border border-fm-color-border-default"
263
- }, ma = {
264
- class: "p-12"
265
- }, fa = {
266
- class: "text-base font-bold text-fm-color-typo-primary"
267
- }, va = {
268
- class: "space-y-12 p-12"
269
- }, pa = {
270
- class: "text-xs text-fm-color-typo-secondary"
271
- }, ga = {
272
- class: "font-semibold"
273
- }, ba = {
274
- key: 0
275
- }, ha = {
276
- class: "text-xs text-fm-color-typo-secondary"
277
- }, _a = {
278
- key: 0,
279
- class: "font-semibold"
280
- }, ya = {
281
- key: 1,
282
- class: "break-all font-mono text-xs text-fm-color-typo-secondary"
283
- }, xa = {
284
- key: 1
285
- }, La = {
286
- class: "text-xs text-fm-color-typo-secondary"
287
- }, Sa = {
288
- class: "font-semibold whitespace-pre-line"
289
- }, ka = {
290
- class: "text-xs text-fm-color-typo-secondary"
291
- }, wa = {
292
- class: "font-semibold"
293
- }, Ma = {
294
- class: "text-xs text-fm-color-typo-secondary"
295
- }, Fa = {
296
- class: "break-all font-mono text-xs font-semibold"
297
- }, Da = {
298
- key: 2
299
- }, Ia = {
300
- class: "text-xs text-fm-color-typo-secondary"
301
- }, Ta = {
302
- class: "mt-4 space-y-4"
303
- }, Va = {
304
- class: "flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-fm-color-primary-default text-xs font-bold text-white"
305
- }, Pa = {
306
- class: "text-xs font-semibold"
307
- }, Oa = {
308
- key: 0,
309
- class: "text-fm-color-typo-secondary"
310
- }, ja = {
311
- key: 3
312
- }, Ca = {
313
- class: "text-xs text-fm-color-typo-secondary"
314
- }, Aa = {
315
- class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
316
- }, he = 100, _e = 1e3, Ea = "YYYY-MM-DD HH:mm", M = "YYYY-MM-DD", je = "audit-log-export-fields", Xa = /* @__PURE__ */ Ce({
317
- __name: "AuditLogList",
318
- setup(s) {
319
- const {
320
- t: a
321
- } = Ae(), h = ft(), V = _t(), E = p(!1), F = p(!1), k = p([]), o = p(null), D = p(!1), g = p(1), _ = p(!1), j = v().format("YYYY-MM-DD"), K = p({
322
- startDate: `${j} 00:00`,
323
- endDate: `${j} 23:59`
324
- }), q = p(), R = p(), U = p(), $ = p(), m = p("all");
325
- function b(e) {
326
- return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
327
- }
328
- const Y = S(() => be.map(({
329
- key: e
330
- }) => ({
331
- label: a(`auditLog.modules.${e}`),
332
- value: e
333
- }))), I = S(() => be.find((e) => e.key === m.value) ?? be[0]), B = S(() => m.value === "all"), N = S(() => V.members.map((e) => ({
334
- label: e.name,
335
- value: e.doc.userId
336
- }))), u = S(() => {
337
- const e = Pe.flatMap((L) => b(L.subject).map((A) => ({
338
- label: L.label,
339
- value: A
340
- }))), t = Object.entries(Te).map(([L, A]) => ({
341
- label: A,
342
- value: L
343
- })), x = /* @__PURE__ */ new Set(), w = [];
344
- for (const L of [...e, ...t])
345
- x.has(L.value) || (x.add(L.value), w.push(L));
346
- return w;
347
- });
348
- function J(e, t) {
349
- const x = t.toLowerCase();
350
- return e.label.toLowerCase().includes(x) || e.value.replace(/^business::/, "").toLowerCase().includes(x) ? !0 : e.value.toLowerCase().includes(x);
351
- }
352
- const y = S(() => ({
353
- manage: a("auditLog.action.manage"),
354
- create: a("auditLog.action.create"),
355
- read: a("auditLog.action.read"),
356
- update: a("auditLog.action.update"),
357
- delete: a("auditLog.action.delete")
358
- })), ie = S(() => [{
359
- label: y.value.manage,
360
- value: "manage"
361
- }, {
362
- label: y.value.create,
363
- value: "create"
364
- }, {
365
- label: y.value.read,
366
- value: "read"
367
- }, {
368
- label: y.value.update,
369
- value: "update"
370
- }, {
371
- label: y.value.delete,
372
- value: "delete"
373
- }]), te = S(() => ({
374
- allowed: a("auditLog.outcome.success"),
375
- denied: a("auditLog.outcome.failed"),
376
- skipped: a("auditLog.outcome.skipped")
377
- })), C = S(() => [{
378
- label: te.value.allowed,
379
- value: "allowed"
380
- }, {
381
- label: te.value.denied,
382
- value: "denied"
383
- }, {
384
- label: te.value.skipped,
385
- value: "skipped"
386
- }]), ae = S(() => ({
387
- admin: a("auditLog.detail.resolvedFromValue.admin"),
388
- staff: a("auditLog.detail.resolvedFromValue.staff"),
389
- permissionSet: a("auditLog.detail.resolvedFromValue.permissionSet"),
390
- systemPermissionSet: a("auditLog.detail.resolvedFromValue.systemPermissionSet"),
391
- custom: a("auditLog.detail.resolvedFromValue.custom"),
392
- "no-match": a("auditLog.detail.resolvedFromValue.noMatch"),
393
- unknown: a("auditLog.detail.resolvedFromValue.unknown")
394
- })), Ee = S(() => ({
395
- GET: y.value.read,
396
- POST: y.value.create,
397
- PUT: y.value.update,
398
- PATCH: y.value.update,
399
- DELETE: y.value.delete
400
- })), ye = {
401
- allowed: "success",
402
- denied: "critical",
403
- skipped: "warning"
404
- }, Re = S(() => {
405
- const {
406
- startDate: e,
407
- endDate: t
408
- } = K.value;
409
- return e && t ? `${e} – ${t}` : e || t || a("auditLog.dateRange.placeholder");
410
- }), Ue = S(() => [{
411
- label: a("date.predefinedRanges.today"),
412
- value: {
413
- startDate: v().format(M),
414
- endDate: v().format(M)
415
- }
416
- }, {
417
- label: a("date.predefinedRanges.yesterday"),
418
- value: {
419
- startDate: v().subtract(1, "day").format(M),
420
- endDate: v().subtract(1, "day").format(M)
421
- }
422
- }, {
423
- label: a("date.predefinedRanges.thisWeek"),
424
- value: {
425
- startDate: v().startOf("week").format(M),
426
- endDate: v().endOf("week").format(M)
427
- }
428
- }, {
429
- label: a("date.predefinedRanges.lastWeek"),
430
- value: {
431
- startDate: v().subtract(1, "week").startOf("week").format(M),
432
- endDate: v().subtract(1, "week").endOf("week").format(M)
433
- }
434
- }, {
435
- label: a("date.predefinedRanges.last7Days"),
436
- value: {
437
- startDate: v().subtract(7, "day").format(M),
438
- endDate: v().subtract(1, "day").format(M)
439
- }
440
- }, {
441
- label: a("date.predefinedRanges.thisMonth"),
442
- value: {
443
- startDate: v().startOf("month").format(M),
444
- endDate: v().endOf("month").format(M)
445
- }
446
- }, {
447
- label: a("date.predefinedRanges.lastMonth"),
448
- value: {
449
- startDate: v().subtract(1, "month").startOf("month").format(M),
450
- endDate: v().subtract(1, "month").endOf("month").format(M)
451
- }
452
- }]);
453
- function me(e) {
454
- var t;
455
- return ((t = Pe.find((x) => x.subject === e)) == null ? void 0 : t.label) ?? Te[e];
456
- }
457
- function ue(e) {
458
- return V.userIdToName[e.userId] || e.userId;
459
- }
460
- function xe(e) {
461
- return V.userIdToPhone[e.userId] || "-";
462
- }
463
- function $e(e) {
464
- return V.userIdToEmail[e.userId] || "-";
465
- }
466
- function Le(e) {
467
- return v(e).format("DD MMM YYYY, HH:mm");
468
- }
469
- function Ye(e) {
470
- return v(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
471
- }
472
- function Se(e) {
473
- return y.value[e] ?? e;
474
- }
475
- function fe(e) {
476
- return e.metadata.operationLabel ?? Se(e.action);
477
- }
478
- function ve(e) {
479
- return te.value[e];
480
- }
481
- function Be(e) {
482
- return ae.value[e] ?? e;
483
- }
484
- function Ne(e) {
485
- return e.metadata.requestMethod ? Ee.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : Se(e.action);
486
- }
487
- function ke(e) {
488
- const t = String(e ?? "");
489
- return `"${(/^[=+\-@\t\r]/.test(t) ? `'${t}` : t).replace(/"/g, '""')}"`;
490
- }
491
- const pe = [{
492
- key: "timestamp",
493
- labelKey: "auditLog.exportFields.timestamp",
494
- getValue: (e) => Le(e.timestamp),
495
- defaultSelected: !0
496
- }, {
497
- key: "userName",
498
- labelKey: "auditLog.exportFields.userName",
499
- getValue: (e) => ue(e),
500
- defaultSelected: !0
501
- }, {
502
- key: "userPhone",
503
- labelKey: "auditLog.exportFields.userPhone",
504
- getValue: (e) => xe(e),
505
- defaultSelected: !0
506
- }, {
507
- key: "subject",
508
- labelKey: "auditLog.exportFields.subject",
509
- getValue: (e) => me(e.subject) ?? e.subject,
510
- defaultSelected: !0
511
- }, {
512
- key: "action",
513
- labelKey: "auditLog.exportFields.action",
514
- getValue: (e) => e.action,
515
- defaultSelected: !0
516
- }, {
517
- key: "operation",
518
- labelKey: "auditLog.exportFields.operation",
519
- getValue: (e) => fe(e),
520
- defaultSelected: !0
521
- }, {
522
- key: "outcome",
523
- labelKey: "auditLog.exportFields.outcome",
524
- getValue: (e) => ve(e.outcome),
525
- defaultSelected: !0
526
- }, {
527
- key: "businessId",
528
- labelKey: "auditLog.exportFields.businessId",
529
- getValue: (e) => e.businessId,
530
- defaultSelected: !1
531
- }, {
532
- key: "restaurantId",
533
- labelKey: "auditLog.exportFields.restaurantId",
534
- getValue: (e) => e.restaurantId,
535
- defaultSelected: !1
536
- }, {
537
- key: "country",
538
- labelKey: "auditLog.exportFields.country",
539
- getValue: (e) => e.country,
540
- defaultSelected: !1
541
- }, {
542
- key: "resolvedFrom",
543
- labelKey: "auditLog.exportFields.resolvedFrom",
544
- getValue: (e) => {
545
- var t;
546
- return (t = e.metadata) == null ? void 0 : t.resolvedFrom;
547
- },
548
- defaultSelected: !1
549
- }, {
550
- key: "requestMethod",
551
- labelKey: "auditLog.exportFields.requestMethod",
552
- getValue: (e) => {
553
- var t;
554
- return (t = e.metadata) == null ? void 0 : t.requestMethod;
555
- },
556
- defaultSelected: !1
557
- }, {
558
- key: "requestPath",
559
- labelKey: "auditLog.exportFields.requestPath",
560
- getValue: (e) => {
561
- var t;
562
- return (t = e.metadata) == null ? void 0 : t.requestPath;
563
- },
564
- defaultSelected: !1
565
- }];
566
- function Ke() {
567
- try {
568
- const e = localStorage.getItem(je);
569
- if (e) {
570
- const t = JSON.parse(e);
571
- if (Array.isArray(t) && t.length > 0) return new Set(t);
572
- }
573
- } catch {
574
- }
575
- return new Set(pe.filter((e) => e.defaultSelected).map((e) => e.key));
576
- }
577
- const X = p(Ke());
578
- function qe(e) {
579
- const t = new Set(X.value);
580
- if (t.has(e)) {
581
- if (t.size <= 1) return;
582
- t.delete(e);
583
- } else
584
- t.add(e);
585
- X.value = t;
586
- try {
587
- localStorage.setItem(je, JSON.stringify([...t]));
588
- } catch {
589
- }
590
- }
591
- async function ze() {
592
- var e, t, x, w, L, A;
593
- if (!F.value) {
594
- F.value = !0;
595
- try {
596
- const {
597
- startDate: H,
598
- endDate: W
599
- } = K.value, G = I.value.subjectPrefixes, de = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), d = W ? re(W) : null, Q = d && d < de ? d : de, Ze = {
600
- ...H ? {
601
- from: re(H)
602
- } : {},
603
- to: Q,
604
- ...(e = q.value) != null && e.length ? {
605
- userIds: q.value
606
- } : {},
607
- ...B.value && ((t = R.value) != null && t.length) ? {
608
- subjects: R.value
609
- } : {},
610
- ...G.length ? {
611
- subjectPrefixes: [...G]
612
- } : {},
613
- ...(x = $.value) != null && x.length ? {
614
- actions: $.value
615
- } : {},
616
- ...(w = U.value) != null && w.length ? {
617
- outcomes: U.value
618
- } : {}
619
- }, we = [];
620
- let Me = 0;
621
- for (; ; ) {
622
- const P = await Oe.read({
623
- ...Ze,
624
- limit: _e,
625
- offset: Me
626
- });
627
- if (we.push(...P), P.length < _e) break;
628
- Me += _e;
629
- }
630
- const Fe = pe.filter((P) => X.value.has(P.key)), Qe = Fe.map((P) => a(P.labelKey)), et = we.map((P) => Fe.map((rt) => rt.getValue(P) ?? "")), ge = -(/* @__PURE__ */ new Date()).getTimezoneOffset(), tt = ge >= 0 ? "+" : "-", at = String(Math.floor(Math.abs(ge) / 60)).padStart(2, "0"), lt = String(Math.abs(ge) % 60).padStart(2, "0"), ot = `UTC${tt}${at}:${lt}`, De = ((L = h.currentBusiness.value) == null ? void 0 : L.name) || "", st = [H, W].filter(Boolean).join(" – "), nt = [...[[a("auditLog.title")], [`${a("auditLog.frontMatter.date")}: ${st}`], ...De ? [[`${a("auditLog.frontMatter.business")}: ${De}`]] : [], [`${a("auditLog.frontMatter.generatedBy")}: ${v().format("DD MMM YYYY, HH:mm")} (${ot})`], []].map((P) => P.map(ke).join(",")), ...[Qe, ...et].map((P) => P.map(ke).join(","))].join(`
631
- `), it = `audit-log_${(((A = h.currentBusiness.value) == null ? void 0 : A.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${v().format("YYYYMMDD_HHmmss")}.csv`, ut = new Blob([`\uFEFF${nt}`], {
632
- type: "text/csv;charset=utf-8;"
633
- }), Ie = window.URL.createObjectURL(ut), le = document.createElement("a");
634
- le.href = Ie, le.download = it, document.body.appendChild(le), le.click(), le.remove(), window.URL.revokeObjectURL(Ie);
635
- } finally {
636
- F.value = !1;
637
- }
638
- }
639
- }
640
- const He = [{
641
- accessorKey: "timestamp",
642
- header: () => a("auditLog.columns.timestamp"),
643
- cell(e) {
644
- return Le(e.row.original.timestamp);
645
- }
646
- }, {
647
- accessorKey: "userId",
648
- header: () => a("auditLog.columns.user"),
649
- enableSorting: !1,
650
- size: 220,
651
- cell(e) {
652
- const t = e.row.original;
653
- return r("div", {
654
- class: "flex items-center gap-8"
655
- }, [r(Ve.FmAvatar, {
656
- initials: ue(t),
657
- size: "sm",
658
- class: "shrink-0"
659
- }, null), r("div", {
660
- class: "min-w-0"
661
- }, [r("p", {
662
- class: "truncate font-semibold"
663
- }, [ue(t)]), r("p", {
664
- class: "truncate text-fm-color-typo-secondary"
665
- }, [xe(t)])])]);
666
- }
667
- }, {
668
- accessorKey: "subject",
669
- header: () => a("auditLog.columns.role"),
670
- meta: {
671
- cellClass: "text-left"
672
- },
673
- cell(e) {
674
- const t = e.row.original;
675
- return r("div", {
676
- class: "text-left"
677
- }, [me(t.subject) ?? t.subject]);
678
- }
679
- }, {
680
- accessorKey: "action",
681
- header: () => a("auditLog.columns.action"),
682
- enableSorting: !1,
683
- size: 280,
684
- meta: {
685
- cellSpanClass: "audit-log-action-label"
686
- },
687
- cell(e) {
688
- return fe(e.row.original);
689
- }
690
- }, {
691
- accessorKey: "outcome",
692
- header: () => a("auditLog.columns.outcome"),
693
- enableSorting: !1,
694
- cell(e) {
695
- const t = e.row.original;
696
- return r(Ve.FmChip, {
697
- variant: ye[t.outcome] ?? "neutral",
698
- label: ve(t.outcome),
699
- compact: !0
700
- }, null);
701
- }
702
- }];
703
- function re(e) {
704
- const t = v(e, Ea);
705
- return new Date(t.year(), t.month(), t.date(), t.hour(), t.minute(), 0).toISOString().slice(0, 19).replace("T", " ");
706
- }
707
- async function Z() {
708
- var e, t, x, w;
709
- E.value = !0;
710
- try {
711
- const {
712
- startDate: L,
713
- endDate: A
714
- } = K.value, H = (g.value - 1) * he, W = I.value.subjectPrefixes, G = await Oe.read({
715
- limit: he,
716
- offset: H,
717
- ...L ? {
718
- from: re(L)
719
- } : {},
720
- ...A ? {
721
- to: re(A)
722
- } : {},
723
- ...(e = q.value) != null && e.length ? {
724
- userIds: q.value
725
- } : {},
726
- ...B.value && ((t = R.value) != null && t.length) ? {
727
- subjects: R.value
728
- } : {},
729
- ...W.length ? {
730
- subjectPrefixes: [...W]
731
- } : {},
732
- ...(x = $.value) != null && x.length ? {
733
- actions: $.value
734
- } : {},
735
- ...(w = U.value) != null && w.length ? {
736
- outcomes: U.value
737
- } : {}
738
- });
739
- k.value = G, _.value = G.length === he;
740
- } finally {
741
- E.value = !1;
742
- }
743
- }
744
- oe(K, () => {
745
- g.value = 1, Z();
746
- }), oe([q, R, U, $], () => {
747
- g.value = 1, Z();
748
- }), oe(m, () => {
749
- g.value = 1, Z();
750
- });
751
- async function We() {
752
- g.value > 1 && (g.value--, await Z());
753
- }
754
- async function Ge() {
755
- _.value && (g.value++, await Z());
756
- }
757
- function Je(e) {
758
- o.value = e, D.value = !0;
759
- }
760
- function Xe() {
761
- D.value = !1, o.value = null;
762
- }
763
- return oe(h.currentBusiness, (e) => {
764
- e && (g.value = 1, V.readTeamMembers(), Z());
765
- }, {
766
- immediate: !0
767
- }), (e, t) => {
768
- const x = O("FmSpacer"), w = O("FmButton"), L = O("FmMenuItem"), A = O("FmMenu"), H = O("FmChip"), W = O("FmDateRangePicker"), G = O("FmTable"), de = O("FmSideSheet");
769
- return c(), f(ee, null, [r(bt, {
770
- heading: n(a)("auditLog.title")
771
- }, {
772
- "append-heading": z(() => [r(x), r(w, {
773
- variant: "primary",
774
- "prepend-icon": "upload",
775
- label: n(a)("auditLog.export"),
776
- disabled: k.value.length === 0 || F.value || n(V).isLoading || n(V).members.length === 0,
777
- loading: F.value,
778
- onClick: ze
779
- }, null, 8, ["label", "disabled", "loading"]), r(A, {
780
- "close-on-click": !1,
781
- "z-index": 50
782
- }, {
783
- "menu-button": z(() => [r(w, {
784
- variant: "tertiary",
785
- icon: "settings",
786
- "aria-label": n(a)("auditLog.exportSettings.title"),
787
- disabled: F.value
788
- }, null, 8, ["aria-label", "disabled"])]),
789
- default: z(() => [l("div", Mt, [l("p", Ft, i(n(a)("auditLog.exportSettings.title")), 1), (c(), f(ee, null, ne(pe, (d) => r(L, {
790
- key: d.key,
791
- label: n(a)(d.labelKey),
792
- "has-checkbox": "",
793
- "model-value": X.value.has(d.key),
794
- disabled: X.value.has(d.key) && X.value.size === 1,
795
- onClick: (Q) => qe(d.key)
796
- }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
797
- _: 1
798
- })]),
799
- default: z(() => [l("div", Dt, [l("div", It, [r(wt, {
800
- modelValue: m.value,
801
- "onUpdate:modelValue": t[0] || (t[0] = (d) => m.value = d),
802
- items: Y.value
803
- }, null, 8, ["modelValue", "items"]), l("div", Tt, [r(W, {
804
- modelValue: K.value,
805
- "onUpdate:modelValue": t[1] || (t[1] = (d) => K.value = d),
806
- "show-predefined-range": "",
807
- "show-time": "",
808
- "predefined-range": Ue.value
809
- }, {
810
- "trigger-button": z(() => [r(H, {
811
- label: Re.value,
812
- icon: "calendar_month"
813
- }, null, 8, ["label"])]),
814
- _: 1
815
- }, 8, ["modelValue", "predefined-range"]), l("div", Vt, [r(ce, {
816
- modelValue: q.value,
817
- "onUpdate:modelValue": t[2] || (t[2] = (d) => q.value = d),
818
- items: N.value,
819
- multiple: "",
820
- variant: "dark",
821
- placeholder: n(a)("auditLog.filter.user_placeholder"),
822
- "selected-prefix": n(a)("auditLog.filter.selected_user_prefix"),
823
- "chip-icon": "account_circle"
824
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), B.value ? (c(), f("div", Pt, [r(ce, {
825
- modelValue: R.value,
826
- "onUpdate:modelValue": t[3] || (t[3] = (d) => R.value = d),
827
- items: u.value,
828
- "filter-fn": J,
829
- multiple: "",
830
- variant: "dark",
831
- placeholder: n(a)("auditLog.filter.subject_placeholder"),
832
- "selected-prefix": n(a)("auditLog.filter.selected_subject_prefix"),
833
- "chip-icon": "badge"
834
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])) : T("", !0), l("div", Ot, [r(ce, {
835
- modelValue: $.value,
836
- "onUpdate:modelValue": t[4] || (t[4] = (d) => $.value = d),
837
- items: ie.value,
838
- multiple: "",
839
- variant: "dark",
840
- placeholder: n(a)("auditLog.filter.action_placeholder"),
841
- "selected-prefix": n(a)("auditLog.filter.selected_action_prefix"),
842
- searchable: !1
843
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), l("div", jt, [r(ce, {
844
- modelValue: U.value,
845
- "onUpdate:modelValue": t[5] || (t[5] = (d) => U.value = d),
846
- items: C.value,
847
- multiple: "",
848
- variant: "dark",
849
- placeholder: n(a)("auditLog.filter.status_placeholder"),
850
- "selected-prefix": n(a)("auditLog.filter.selected_status_prefix"),
851
- searchable: !1,
852
- "chip-icon": "check_circle"
853
- }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])])]), !E.value && k.value.length === 0 ? (c(), se(n(ht), {
854
- key: 0,
855
- title: n(a)("auditLog.noData.title"),
856
- subtitle: n(a)("auditLog.noData.subtitle")
857
- }, null, 8, ["title", "subtitle"])) : (c(), se(vt, {
858
- key: 1
859
- }, {
860
- default: z(() => [l("div", Ct, [r(G, {
861
- "column-defs": He,
862
- "row-data": k.value,
863
- "page-size": k.value.length,
864
- loading: E.value,
865
- "pin-header-row": "",
866
- "hide-footer": "",
867
- class: "min-h-0 flex-1 cursor-pointer",
868
- onRowClick: t[6] || (t[6] = (d) => Je(d.original))
869
- }, null, 8, ["row-data", "page-size", "loading"]), g.value > 1 || _.value ? (c(), f("div", At, [r(w, {
870
- variant: "tertiary",
871
- icon: "chevron_left",
872
- disabled: g.value === 1,
873
- "aria-label": n(a)("auditLog.pagination.prevPage"),
874
- onClick: We
875
- }, null, 8, ["disabled", "aria-label"]), l("span", Et, i(n(a)("auditLog.pagination.page", {
876
- page: g.value
877
- })), 1), r(w, {
878
- variant: "tertiary",
879
- icon: "chevron_right",
880
- disabled: !_.value,
881
- "aria-label": n(a)("auditLog.pagination.nextPage"),
882
- onClick: Ge
883
- }, null, 8, ["disabled", "aria-label"])])) : T("", !0)])]),
884
- _: 1
885
- }))])]),
886
- _: 1
887
- }, 8, ["heading"]), r(de, {
888
- header: n(a)("auditLog.detail.header"),
889
- "model-value": D.value,
890
- "max-width": 480,
891
- "dismiss-away": "",
892
- "onUpdate:modelValue": t[7] || (t[7] = (d) => {
893
- d || Xe();
894
- })
895
- }, {
896
- default: z(() => [o.value ? (c(), f("div", Rt, [l("div", Ut, [l("div", $t, [l("p", Yt, i(fe(o.value)), 1)]), r(H, {
897
- variant: ye[o.value.outcome] ?? "neutral",
898
- label: ve(o.value.outcome),
899
- compact: ""
900
- }, null, 8, ["variant", "label"])]), l("div", Bt, [l("div", Nt, [l("div", null, [l("p", Kt, i(n(a)("auditLog.detail.date")), 1), l("p", qt, i(Ye(o.value.timestamp)), 1)]), l("div", null, [l("p", zt, i(n(a)("auditLog.detail.user")), 1), l("p", Ht, i(ue(o.value)), 1)]), l("div", null, [l("p", Wt, i(n(a)("auditLog.detail.email")), 1), l("p", Gt, i($e(o.value)), 1)]), l("div", null, [l("p", Jt, i(n(a)("auditLog.detail.role")), 1), l("p", Xt, i(me(o.value.subject) || o.value.subject), 1)]), o.value.field ? (c(), f("div", Zt, [l("p", Qt, i(n(a)("auditLog.detail.field")), 1), l("p", ea, i(o.value.field), 1)])) : T("", !0), l("div", null, [l("p", ta, i(n(a)("auditLog.detail.business")), 1), l("p", aa, i(o.value.businessId || "-"), 1)]), l("div", null, [l("p", la, i(n(a)("auditLog.detail.restaurant")), 1), l("p", oa, i(o.value.restaurantId || "-"), 1)])])]), o.value.metadata.operationLabel ? (c(), f("div", sa, [l("div", na, [l("p", ia, i(n(a)("auditLog.detail.changeDetails")), 1)]), t[8] || (t[8] = l("hr", {
901
- class: "border-fm-color-border-default"
902
- }, null, -1)), l("div", ua, [l("div", null, [l("p", ra, i(n(a)("auditLog.detail.eventType")), 1), l("p", da, i(o.value.metadata.operationLabel), 1)])])])) : T("", !0), l("div", ca, [l("div", ma, [l("p", fa, i(n(a)("auditLog.detail.metadata")), 1)]), t[9] || (t[9] = l("hr", {
903
- class: "border-fm-color-border-default"
904
- }, null, -1)), l("div", va, [l("div", null, [l("p", pa, i(n(a)("auditLog.detail.resolvedFrom")), 1), l("p", ga, i(Be(o.value.metadata.resolvedFrom)), 1)]), (o.value.metadata.resolvedFrom === "permissionSet" || o.value.metadata.resolvedFrom === "systemPermissionSet") && (o.value.metadata.permissionSetName || o.value.metadata.permissionSetId) ? (c(), f("div", ba, [l("p", ha, i(n(a)("auditLog.detail.permissionSet")), 1), o.value.metadata.permissionSetName ? (c(), f("p", _a, i(o.value.metadata.permissionSetName), 1)) : T("", !0), o.value.metadata.permissionSetId ? (c(), f("p", ya, i(o.value.metadata.permissionSetId), 1)) : T("", !0)])) : T("", !0), o.value.metadata.reason ? (c(), f("div", xa, [l("p", La, i(n(a)("auditLog.detail.reason")), 1), l("p", Sa, i(o.value.metadata.reason), 1)])) : T("", !0), l("div", null, [l("p", ka, i(n(a)("auditLog.detail.requestMethod")), 1), l("p", wa, i(Ne(o.value)), 1)]), l("div", null, [l("p", Ma, i(n(a)("auditLog.detail.requestPath")), 1), l("p", Fa, i(o.value.metadata.requestPath || "-"), 1)]), o.value.metadata.trace && o.value.metadata.trace.length > 0 ? (c(), f("div", Da, [l("p", Ia, i(n(a)("auditLog.detail.permissionTrace")), 1), l("ol", Ta, [(c(!0), f(ee, null, ne(o.value.metadata.trace, (d, Q) => (c(), f("li", {
905
- key: Q,
906
- class: "flex items-center gap-6"
907
- }, [l("span", Va, i(Q + 1), 1), l("span", Pa, i(d), 1), Q < o.value.metadata.trace.length - 1 ? (c(), f("span", Oa, "→")) : T("", !0)]))), 128))])])) : T("", !0), o.value.metadata.requestBody && Object.keys(o.value.metadata.requestBody).length > 0 ? (c(), f("div", ja, [l("p", Ca, i(n(a)("auditLog.detail.requestBody")), 1), l("pre", Aa, i(JSON.stringify(o.value.metadata.requestBody, null, 2)), 1)])) : T("", !0)])])])) : T("", !0)]),
908
- _: 1
909
- }, 8, ["header", "model-value"])], 64);
910
- };
911
- }
912
- });
913
- export {
914
- Xa as default
915
- };