@feedmepos/mf-hrm-portal 2.0.8-dev.12 → 2.0.8-dev.14

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 (28) hide show
  1. package/dist/AuditLogList-CEGtohT7.js +734 -0
  2. package/dist/{EmployeeList-CVnIGntI.js → EmployeeList-B5_KnyrU.js} +5 -5
  3. package/dist/{Main-q8IGKAH2.js → Main-Ayry4ijA.js} +6 -6
  4. package/dist/{Main-CMiYmjMk.js → Main-Dksmkrg_.js} +9 -9
  5. package/dist/{Main-bmpvqNUB.js → Main-g3IbbAEf.js} +4 -4
  6. package/dist/{PermissionSetList-0kvdLTQ2.js → PermissionSetList-BoqxRXoi.js} +28 -28
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DdwUIbD4.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-B4ZJlGuT.js} +738 -738
  8. package/dist/{RoleList-DjxZzgZk.js → RoleList-Cx_JPfNr.js} +7 -7
  9. package/dist/{TeamMemberList-PmbUeFns.js → TeamMemberList-CDY7Y_qm.js} +8 -8
  10. package/dist/{TimesheetList-Cs_8p1TE.js → TimesheetList-BYieGfIy.js} +7 -7
  11. package/dist/{app-PYFafU8x.js → app-p4cgjZ-r.js} +104 -68
  12. package/dist/app.js +2 -2
  13. package/dist/{dayjs.min-DjR87Y9e.js → dayjs.min-BRO-vkLx.js} +1 -1
  14. package/dist/{employee-snwYlork.js → employee-CCBUMHaJ.js} +4 -4
  15. package/dist/{index-DPEw4kQP.js → index-rMjkDl2r.js} +1 -1
  16. package/dist/{index-QNkZDIo5.js → index-sEHzMXB6.js} +2 -2
  17. package/dist/{iteration-BwzU2yPh.js → iteration-CnyH8-jG.js} +1 -1
  18. package/dist/{lodash-8jIJCGdn.js → lodash-CKmCoqNR.js} +1 -1
  19. package/dist/src/api/audit-log/index.d.ts +1 -0
  20. package/dist/src/views/audit-log/locales/index.d.ts +36 -0
  21. package/dist/{team-Dl33dbDU.js → team-Mco_xubK.js} +1 -1
  22. package/dist/{timesheet-BVMwsxuV.js → timesheet-Bb0TM0P8.js} +3 -3
  23. package/dist/tsconfig.app.tsbuildinfo +1 -1
  24. package/dist/{useAppStore-gNcJGfxF.js → useAppStore-BCOsvBrB.js} +1 -1
  25. package/dist/{useLoading-DuapEOya.js → useLoading-BSoKX5sI.js} +1 -1
  26. package/dist/{useReportPermissions-C-f7TyvQ.js → useReportPermissions-D70w_EzG.js} +3 -3
  27. package/package.json +1 -1
  28. package/dist/AuditLogList-CZSE61OK.js +0 -708
@@ -0,0 +1,734 @@
1
+ import { defineComponent as Qe, ref as _, computed as b, watch as G, resolveComponent as w, createElementBlock as p, openBlock as m, Fragment as le, createVNode as u, unref as s, withCtx as M, createElementVNode as o, createBlock as ge, createCommentVNode as h, toDisplayString as n, renderList as _e } from "vue";
2
+ import { d as X } from "./dayjs.min-BRO-vkLx.js";
3
+ import { useI18n as We, useCoreStore as et } from "@feedmepos/mf-common";
4
+ import { h as se, F as be, _ as tt } from "./app-p4cgjZ-r.js";
5
+ import { components as he } from "@feedmepos/ui-library";
6
+ import { g as ot, b as at } from "./iteration-CnyH8-jG.js";
7
+ import { S as Z } from "./SelectFilter-DUj7GBtT.js";
8
+ import { _ as lt } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
+ import { _ as st } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
10
+ import { p as ye } from "./index-sEHzMXB6.js";
11
+ import { u as nt } from "./team-Mco_xubK.js";
12
+ const it = "/audit-logs", xe = {
13
+ async read(i) {
14
+ var R, x, P, k, F;
15
+ const a = {
16
+ limit: (i == null ? void 0 : i.limit) ?? 100,
17
+ offset: (i == null ? void 0 : i.offset) ?? 0,
18
+ ...i != null && i.from ? { from: i.from } : {},
19
+ ...i != null && i.to ? { to: i.to } : {},
20
+ ...(R = i == null ? void 0 : i.userIds) != null && R.length ? { userIds: i.userIds } : {},
21
+ ...(x = i == null ? void 0 : i.subjects) != null && x.length ? { subjects: i.subjects } : {},
22
+ ...(P = i == null ? void 0 : i.subjectPrefixes) != null && P.length ? { subjectPrefixes: i.subjectPrefixes } : {},
23
+ ...(k = i == null ? void 0 : i.actions) != null && k.length ? { actions: i.actions } : {},
24
+ ...(F = i == null ? void 0 : i.outcomes) != null && F.length ? { outcomes: i.outcomes } : {}
25
+ };
26
+ return console.log("[AuditLogAPI] request params:", a), ot(
27
+ await at().get(it, {
28
+ params: a,
29
+ // Serialize arrays as repeated params: key=val1&key=val2
30
+ // (NestJS @Query expects this; axios default adds brackets which break matching)
31
+ paramsSerializer: (l) => {
32
+ const I = new URLSearchParams();
33
+ for (const [g, L] of Object.entries(l))
34
+ if (Array.isArray(L))
35
+ for (const z of L) I.append(g, String(z));
36
+ else L != null && I.append(g, String(L));
37
+ return console.log("[AuditLogAPI] serialized query string:", I.toString()), I.toString();
38
+ }
39
+ })
40
+ );
41
+ }
42
+ }, dt = {
43
+ class: "flex flex-col gap-4 p-12 w-[260px]"
44
+ }, ut = {
45
+ class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
46
+ }, rt = {
47
+ class: "flex min-h-0 flex-1 flex-col gap-16"
48
+ }, ct = {
49
+ class: "space-y-16"
50
+ }, mt = {
51
+ class: "flex flex-wrap items-center gap-8"
52
+ }, ft = {
53
+ class: "w-fit"
54
+ }, pt = {
55
+ key: 0,
56
+ class: "w-fit"
57
+ }, vt = {
58
+ class: "w-fit"
59
+ }, gt = {
60
+ class: "w-fit"
61
+ }, _t = {
62
+ class: "flex h-full flex-col"
63
+ }, bt = {
64
+ key: 0,
65
+ class: "flex shrink-0 items-center justify-end border-t border-fm-color-border-default py-4"
66
+ }, ht = {
67
+ class: "text-sm text-fm-color-typo-secondary"
68
+ }, yt = {
69
+ key: 0,
70
+ class: "space-y-12 p-4 text-sm"
71
+ }, xt = {
72
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
73
+ }, Lt = {
74
+ class: "min-w-0 flex-1"
75
+ }, St = {
76
+ class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
77
+ }, kt = {
78
+ class: "rounded-lg border border-fm-color-border-default p-12"
79
+ }, wt = {
80
+ class: "space-y-12"
81
+ }, Ft = {
82
+ class: "text-xs text-fm-color-typo-secondary"
83
+ }, It = {
84
+ class: "font-semibold"
85
+ }, Vt = {
86
+ class: "text-xs text-fm-color-typo-secondary"
87
+ }, Pt = {
88
+ class: "font-semibold"
89
+ }, Tt = {
90
+ class: "text-xs text-fm-color-typo-secondary"
91
+ }, Et = {
92
+ class: "break-all font-semibold"
93
+ }, Ot = {
94
+ class: "text-xs text-fm-color-typo-secondary"
95
+ }, Ct = {
96
+ class: "font-semibold"
97
+ }, jt = {
98
+ key: 0
99
+ }, Dt = {
100
+ class: "text-xs text-fm-color-typo-secondary"
101
+ }, Mt = {
102
+ class: "break-all font-mono text-xs font-semibold"
103
+ }, At = {
104
+ class: "text-xs text-fm-color-typo-secondary"
105
+ }, Ut = {
106
+ class: "break-all font-mono text-xs font-semibold"
107
+ }, Nt = {
108
+ class: "text-xs text-fm-color-typo-secondary"
109
+ }, Kt = {
110
+ class: "font-semibold"
111
+ }, Rt = {
112
+ key: 0,
113
+ class: "rounded-lg border border-fm-color-border-default"
114
+ }, qt = {
115
+ class: "p-12"
116
+ }, Bt = {
117
+ class: "text-base font-bold text-fm-color-typo-primary"
118
+ }, Yt = {
119
+ class: "space-y-12 p-12"
120
+ }, zt = {
121
+ class: "text-xs text-fm-color-typo-secondary"
122
+ }, $t = {
123
+ class: "font-semibold"
124
+ }, Ht = {
125
+ class: "rounded-lg border border-fm-color-border-default"
126
+ }, Jt = {
127
+ class: "p-12"
128
+ }, Gt = {
129
+ class: "text-base font-bold text-fm-color-typo-primary"
130
+ }, Xt = {
131
+ class: "space-y-12 p-12"
132
+ }, Zt = {
133
+ class: "text-xs text-fm-color-typo-secondary"
134
+ }, Qt = {
135
+ class: "font-semibold"
136
+ }, Wt = {
137
+ key: 0
138
+ }, eo = {
139
+ class: "text-xs text-fm-color-typo-secondary"
140
+ }, to = {
141
+ key: 0,
142
+ class: "font-semibold"
143
+ }, oo = {
144
+ key: 1,
145
+ class: "break-all font-mono text-xs text-fm-color-typo-secondary"
146
+ }, ao = {
147
+ key: 1
148
+ }, lo = {
149
+ class: "text-xs text-fm-color-typo-secondary"
150
+ }, so = {
151
+ class: "font-semibold whitespace-pre-line"
152
+ }, no = {
153
+ class: "text-xs text-fm-color-typo-secondary"
154
+ }, io = {
155
+ class: "font-semibold"
156
+ }, uo = {
157
+ class: "text-xs text-fm-color-typo-secondary"
158
+ }, ro = {
159
+ class: "break-all font-mono text-xs font-semibold"
160
+ }, co = {
161
+ key: 2
162
+ }, mo = {
163
+ class: "text-xs text-fm-color-typo-secondary"
164
+ }, fo = {
165
+ class: "mt-4 space-y-4"
166
+ }, po = {
167
+ 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"
168
+ }, vo = {
169
+ class: "text-xs font-semibold"
170
+ }, go = {
171
+ key: 0,
172
+ class: "text-fm-color-typo-secondary"
173
+ }, _o = {
174
+ key: 3
175
+ }, bo = {
176
+ class: "text-xs text-fm-color-typo-secondary"
177
+ }, ho = {
178
+ 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"
179
+ }, ne = 100, ie = 1e3, Le = "audit-log-export-fields", Oo = /* @__PURE__ */ Qe({
180
+ __name: "AuditLogList",
181
+ setup(i) {
182
+ const {
183
+ t: a
184
+ } = We(), R = et(), x = nt(), P = _(!1), k = _(!1), F = _([]), l = _(null), I = _(!1), g = _(1), L = _(!1), z = X().format("YYYY-MM-DD"), A = _({
185
+ startDate: z,
186
+ endDate: z
187
+ }), T = _(), E = _(), O = _(), C = _(), q = _("all");
188
+ function Se(e) {
189
+ return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
190
+ }
191
+ const ke = b(() => se.map(({
192
+ key: e
193
+ }) => ({
194
+ label: a(`auditLog.modules.${e}`),
195
+ value: e
196
+ }))), de = b(() => se.find((e) => e.key === q.value) ?? se[0]), Q = b(() => q.value === "all"), we = b(() => x.members.map((e) => ({
197
+ label: e.name,
198
+ value: e.doc.userId
199
+ }))), Fe = b(() => {
200
+ const e = ye.flatMap((c) => Se(c.subject).map((v) => ({
201
+ label: c.label,
202
+ value: v
203
+ }))), t = Object.entries(be).map(([c, v]) => ({
204
+ label: v,
205
+ value: c
206
+ })), r = /* @__PURE__ */ new Set(), f = [];
207
+ for (const c of [...e, ...t])
208
+ r.has(c.value) || (r.add(c.value), f.push(c));
209
+ return f;
210
+ });
211
+ function Ie(e, t) {
212
+ const r = t.toLowerCase();
213
+ return e.label.toLowerCase().includes(r) || e.value.replace(/^business::/, "").toLowerCase().includes(r) ? !0 : e.value.toLowerCase().includes(r);
214
+ }
215
+ const y = b(() => ({
216
+ manage: a("auditLog.action.manage"),
217
+ create: a("auditLog.action.create"),
218
+ read: a("auditLog.action.read"),
219
+ update: a("auditLog.action.update"),
220
+ delete: a("auditLog.action.delete")
221
+ })), Ve = b(() => [{
222
+ label: y.value.manage,
223
+ value: "manage"
224
+ }, {
225
+ label: y.value.create,
226
+ value: "create"
227
+ }, {
228
+ label: y.value.read,
229
+ value: "read"
230
+ }, {
231
+ label: y.value.update,
232
+ value: "update"
233
+ }, {
234
+ label: y.value.delete,
235
+ value: "delete"
236
+ }]), $ = b(() => ({
237
+ allowed: a("auditLog.outcome.success"),
238
+ denied: a("auditLog.outcome.failed"),
239
+ skipped: a("auditLog.outcome.skipped")
240
+ })), Pe = b(() => [{
241
+ label: $.value.allowed,
242
+ value: "allowed"
243
+ }, {
244
+ label: $.value.denied,
245
+ value: "denied"
246
+ }, {
247
+ label: $.value.skipped,
248
+ value: "skipped"
249
+ }]), Te = b(() => ({
250
+ admin: a("auditLog.detail.resolvedFromValue.admin"),
251
+ staff: a("auditLog.detail.resolvedFromValue.staff"),
252
+ permissionSet: a("auditLog.detail.resolvedFromValue.permissionSet"),
253
+ systemPermissionSet: a("auditLog.detail.resolvedFromValue.systemPermissionSet"),
254
+ custom: a("auditLog.detail.resolvedFromValue.custom"),
255
+ "no-match": a("auditLog.detail.resolvedFromValue.noMatch"),
256
+ unknown: a("auditLog.detail.resolvedFromValue.unknown")
257
+ })), Ee = b(() => ({
258
+ GET: y.value.read,
259
+ POST: y.value.create,
260
+ PUT: y.value.update,
261
+ PATCH: y.value.update,
262
+ DELETE: y.value.delete
263
+ })), ue = {
264
+ allowed: "success",
265
+ denied: "critical",
266
+ skipped: "warning"
267
+ }, Oe = b(() => {
268
+ const {
269
+ startDate: e,
270
+ endDate: t
271
+ } = A.value;
272
+ return e && t ? `${e} – ${t}` : e || t || a("auditLog.dateRange.placeholder");
273
+ });
274
+ function W(e) {
275
+ var t;
276
+ return ((t = ye.find((r) => r.subject === e)) == null ? void 0 : t.label) ?? be[e];
277
+ }
278
+ function H(e) {
279
+ return x.userIdToName[e.userId] || e.userId;
280
+ }
281
+ function re(e) {
282
+ return x.userIdToPhone[e.userId] || "-";
283
+ }
284
+ function Ce(e) {
285
+ return x.userIdToEmail[e.userId] || "-";
286
+ }
287
+ function ce(e) {
288
+ return X(e).format("DD MMM YYYY, HH:mm");
289
+ }
290
+ function je(e) {
291
+ return X(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
292
+ }
293
+ function me(e) {
294
+ return y.value[e] ?? e;
295
+ }
296
+ function ee(e) {
297
+ return e.metadata.operationLabel ?? me(e.action);
298
+ }
299
+ function te(e) {
300
+ return $.value[e];
301
+ }
302
+ function De(e) {
303
+ return Te.value[e] ?? e;
304
+ }
305
+ function Me(e) {
306
+ return e.metadata.requestMethod ? Ee.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : me(e.action);
307
+ }
308
+ function Ae(e) {
309
+ const t = String(e ?? "");
310
+ return `"${(/^[=+\-@\t\r]/.test(t) ? `'${t}` : t).replace(/"/g, '""')}"`;
311
+ }
312
+ const oe = [{
313
+ key: "timestamp",
314
+ labelKey: "auditLog.exportFields.timestamp",
315
+ getValue: (e) => ce(e.timestamp),
316
+ defaultSelected: !0
317
+ }, {
318
+ key: "userName",
319
+ labelKey: "auditLog.exportFields.userName",
320
+ getValue: (e) => H(e),
321
+ defaultSelected: !0
322
+ }, {
323
+ key: "userPhone",
324
+ labelKey: "auditLog.exportFields.userPhone",
325
+ getValue: (e) => re(e),
326
+ defaultSelected: !0
327
+ }, {
328
+ key: "subject",
329
+ labelKey: "auditLog.exportFields.subject",
330
+ getValue: (e) => W(e.subject) ?? e.subject,
331
+ defaultSelected: !0
332
+ }, {
333
+ key: "action",
334
+ labelKey: "auditLog.exportFields.action",
335
+ getValue: (e) => e.action,
336
+ defaultSelected: !0
337
+ }, {
338
+ key: "operation",
339
+ labelKey: "auditLog.exportFields.operation",
340
+ getValue: (e) => ee(e),
341
+ defaultSelected: !0
342
+ }, {
343
+ key: "outcome",
344
+ labelKey: "auditLog.exportFields.outcome",
345
+ getValue: (e) => te(e.outcome),
346
+ defaultSelected: !0
347
+ }, {
348
+ key: "businessId",
349
+ labelKey: "auditLog.exportFields.businessId",
350
+ getValue: (e) => e.businessId,
351
+ defaultSelected: !1
352
+ }, {
353
+ key: "restaurantId",
354
+ labelKey: "auditLog.exportFields.restaurantId",
355
+ getValue: (e) => e.restaurantId,
356
+ defaultSelected: !1
357
+ }, {
358
+ key: "country",
359
+ labelKey: "auditLog.exportFields.country",
360
+ getValue: (e) => e.country,
361
+ defaultSelected: !1
362
+ }, {
363
+ key: "resolvedFrom",
364
+ labelKey: "auditLog.exportFields.resolvedFrom",
365
+ getValue: (e) => {
366
+ var t;
367
+ return (t = e.metadata) == null ? void 0 : t.resolvedFrom;
368
+ },
369
+ defaultSelected: !1
370
+ }, {
371
+ key: "requestMethod",
372
+ labelKey: "auditLog.exportFields.requestMethod",
373
+ getValue: (e) => {
374
+ var t;
375
+ return (t = e.metadata) == null ? void 0 : t.requestMethod;
376
+ },
377
+ defaultSelected: !1
378
+ }, {
379
+ key: "requestPath",
380
+ labelKey: "auditLog.exportFields.requestPath",
381
+ getValue: (e) => {
382
+ var t;
383
+ return (t = e.metadata) == null ? void 0 : t.requestPath;
384
+ },
385
+ defaultSelected: !1
386
+ }];
387
+ function Ue() {
388
+ try {
389
+ const e = localStorage.getItem(Le);
390
+ if (e) {
391
+ const t = JSON.parse(e);
392
+ if (Array.isArray(t) && t.length > 0) return new Set(t);
393
+ }
394
+ } catch {
395
+ }
396
+ return new Set(oe.filter((e) => e.defaultSelected).map((e) => e.key));
397
+ }
398
+ const U = _(Ue());
399
+ function Ne(e) {
400
+ const t = new Set(U.value);
401
+ if (t.has(e)) {
402
+ if (t.size <= 1) return;
403
+ t.delete(e);
404
+ } else
405
+ t.add(e);
406
+ U.value = t;
407
+ try {
408
+ localStorage.setItem(Le, JSON.stringify([...t]));
409
+ } catch {
410
+ }
411
+ }
412
+ async function Ke() {
413
+ var e, t, r, f, c;
414
+ if (!k.value) {
415
+ k.value = !0;
416
+ try {
417
+ const {
418
+ startDate: v,
419
+ endDate: K
420
+ } = A.value, V = de.value.subjectPrefixes, j = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), B = K ? J(K, !0) : null, ae = B && B < j ? B : j, d = {
421
+ ...v ? {
422
+ from: J(v)
423
+ } : {},
424
+ to: ae,
425
+ ...(e = T.value) != null && e.length ? {
426
+ userIds: T.value
427
+ } : {},
428
+ ...Q.value && ((t = E.value) != null && t.length) ? {
429
+ subjects: E.value
430
+ } : {},
431
+ ...V.length ? {
432
+ subjectPrefixes: [...V]
433
+ } : {},
434
+ ...(r = C.value) != null && r.length ? {
435
+ actions: C.value
436
+ } : {},
437
+ ...(f = O.value) != null && f.length ? {
438
+ outcomes: O.value
439
+ } : {}
440
+ }, D = [];
441
+ let fe = 0;
442
+ for (; ; ) {
443
+ const S = await xe.read({
444
+ ...d,
445
+ limit: ie,
446
+ offset: fe
447
+ });
448
+ if (D.push(...S), S.length < ie) break;
449
+ fe += ie;
450
+ }
451
+ const pe = oe.filter((S) => U.value.has(S.key)), $e = pe.map((S) => a(S.labelKey)), He = D.map((S) => pe.map((Ze) => Ze.getValue(S) ?? "")), Je = [$e, ...He].map((S) => S.map(Ae).join(",")).join(`
452
+ `), Ge = `audit-log_${(((c = R.currentBusiness.value) == null ? void 0 : c.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${X().format("YYYYMMDD_HHmmss")}.csv`, Xe = new Blob([`\uFEFF${Je}`], {
453
+ type: "text/csv;charset=utf-8;"
454
+ }), ve = window.URL.createObjectURL(Xe), Y = document.createElement("a");
455
+ Y.href = ve, Y.download = Ge, document.body.appendChild(Y), Y.click(), Y.remove(), window.URL.revokeObjectURL(ve);
456
+ } finally {
457
+ k.value = !1;
458
+ }
459
+ }
460
+ }
461
+ const Re = [{
462
+ accessorKey: "timestamp",
463
+ header: () => a("auditLog.columns.timestamp"),
464
+ cell(e) {
465
+ return ce(e.row.original.timestamp);
466
+ }
467
+ }, {
468
+ accessorKey: "userId",
469
+ header: () => a("auditLog.columns.user"),
470
+ enableSorting: !1,
471
+ size: 220,
472
+ cell(e) {
473
+ const t = e.row.original;
474
+ return u("div", {
475
+ class: "flex items-center gap-8"
476
+ }, [u(he.FmAvatar, {
477
+ initials: H(t),
478
+ size: "sm",
479
+ class: "shrink-0"
480
+ }, null), u("div", {
481
+ class: "min-w-0"
482
+ }, [u("p", {
483
+ class: "truncate font-semibold"
484
+ }, [H(t)]), u("p", {
485
+ class: "truncate text-fm-color-typo-secondary"
486
+ }, [re(t)])])]);
487
+ }
488
+ }, {
489
+ accessorKey: "subject",
490
+ header: () => a("auditLog.columns.role"),
491
+ meta: {
492
+ cellClass: "text-left"
493
+ },
494
+ cell(e) {
495
+ const t = e.row.original;
496
+ return u("div", {
497
+ class: "text-left"
498
+ }, [W(t.subject) ?? t.subject]);
499
+ }
500
+ }, {
501
+ accessorKey: "action",
502
+ header: () => a("auditLog.columns.action"),
503
+ enableSorting: !1,
504
+ size: 280,
505
+ meta: {
506
+ cellSpanClass: "audit-log-action-label"
507
+ },
508
+ cell(e) {
509
+ return ee(e.row.original);
510
+ }
511
+ }, {
512
+ accessorKey: "outcome",
513
+ header: () => a("auditLog.columns.outcome"),
514
+ enableSorting: !1,
515
+ cell(e) {
516
+ const t = e.row.original;
517
+ return u(he.FmChip, {
518
+ variant: ue[t.outcome] ?? "neutral",
519
+ label: te(t.outcome),
520
+ compact: !0
521
+ }, null);
522
+ }
523
+ }];
524
+ function J(e, t = !1) {
525
+ const [r, f, c] = e.split("-").map(Number), v = new Date(r, f - 1, c);
526
+ return t && v.setDate(v.getDate() + 1), v.toISOString().slice(0, 19).replace("T", " ");
527
+ }
528
+ async function N() {
529
+ var e, t, r, f;
530
+ P.value = !0;
531
+ try {
532
+ const {
533
+ startDate: c,
534
+ endDate: v
535
+ } = A.value, K = (g.value - 1) * ne, V = de.value.subjectPrefixes, j = await xe.read({
536
+ limit: ne,
537
+ offset: K,
538
+ ...c ? {
539
+ from: J(c)
540
+ } : {},
541
+ ...v ? {
542
+ to: J(v, !0)
543
+ } : {},
544
+ ...(e = T.value) != null && e.length ? {
545
+ userIds: T.value
546
+ } : {},
547
+ ...Q.value && ((t = E.value) != null && t.length) ? {
548
+ subjects: E.value
549
+ } : {},
550
+ ...V.length ? {
551
+ subjectPrefixes: [...V]
552
+ } : {},
553
+ ...(r = C.value) != null && r.length ? {
554
+ actions: C.value
555
+ } : {},
556
+ ...(f = O.value) != null && f.length ? {
557
+ outcomes: O.value
558
+ } : {}
559
+ });
560
+ F.value = j, L.value = j.length === ne;
561
+ } finally {
562
+ P.value = !1;
563
+ }
564
+ }
565
+ G(A, () => {
566
+ g.value = 1, N();
567
+ }), G([T, E, O, C], () => {
568
+ g.value = 1, N();
569
+ }), G(q, () => {
570
+ g.value = 1, N();
571
+ });
572
+ async function qe() {
573
+ g.value > 1 && (g.value--, await N());
574
+ }
575
+ async function Be() {
576
+ L.value && (g.value++, await N());
577
+ }
578
+ function Ye(e) {
579
+ l.value = e, I.value = !0;
580
+ }
581
+ function ze() {
582
+ I.value = !1, l.value = null;
583
+ }
584
+ return G(R.currentBusiness, (e) => {
585
+ e && (g.value = 1, x.readTeamMembers(), N());
586
+ }, {
587
+ immediate: !0
588
+ }), (e, t) => {
589
+ const r = w("FmSpacer"), f = w("FmButton"), c = w("FmMenuItem"), v = w("FmMenu"), K = w("FmTabs"), V = w("FmChip"), j = w("FmDateRangePicker"), B = w("FmTable"), ae = w("FmSideSheet");
590
+ return m(), p(le, null, [u(lt, {
591
+ heading: s(a)("auditLog.title")
592
+ }, {
593
+ "append-heading": M(() => [u(r), u(f, {
594
+ variant: "primary",
595
+ "prepend-icon": "upload",
596
+ label: s(a)("auditLog.export"),
597
+ disabled: F.value.length === 0 || k.value || s(x).isLoading || s(x).members.length === 0,
598
+ loading: k.value,
599
+ onClick: Ke
600
+ }, null, 8, ["label", "disabled", "loading"]), u(v, {
601
+ "close-on-click": !1,
602
+ "z-index": 50
603
+ }, {
604
+ "menu-button": M(() => [u(f, {
605
+ variant: "tertiary",
606
+ icon: "settings",
607
+ "aria-label": s(a)("auditLog.exportSettings.title"),
608
+ disabled: k.value
609
+ }, null, 8, ["aria-label", "disabled"])]),
610
+ default: M(() => [o("div", dt, [o("p", ut, n(s(a)("auditLog.exportSettings.title")), 1), (m(), p(le, null, _e(oe, (d) => u(c, {
611
+ key: d.key,
612
+ label: s(a)(d.labelKey),
613
+ "has-checkbox": "",
614
+ "model-value": U.value.has(d.key),
615
+ disabled: U.value.has(d.key) && U.value.size === 1,
616
+ onClick: (D) => Ne(d.key)
617
+ }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
618
+ _: 1
619
+ })]),
620
+ default: M(() => [o("div", rt, [o("div", ct, [u(K, {
621
+ modelValue: q.value,
622
+ "onUpdate:modelValue": t[0] || (t[0] = (d) => q.value = d),
623
+ items: ke.value
624
+ }, null, 8, ["modelValue", "items"]), o("div", mt, [u(j, {
625
+ modelValue: A.value,
626
+ "onUpdate:modelValue": t[1] || (t[1] = (d) => A.value = d),
627
+ "show-predefined-range": ""
628
+ }, {
629
+ "trigger-button": M(() => [u(V, {
630
+ label: Oe.value,
631
+ icon: "calendar_month"
632
+ }, null, 8, ["label"])]),
633
+ _: 1
634
+ }, 8, ["modelValue"]), o("div", ft, [u(Z, {
635
+ modelValue: T.value,
636
+ "onUpdate:modelValue": t[2] || (t[2] = (d) => T.value = d),
637
+ items: we.value,
638
+ multiple: "",
639
+ variant: "dark",
640
+ placeholder: s(a)("auditLog.filter.user_placeholder"),
641
+ "selected-prefix": s(a)("auditLog.filter.selected_user_prefix"),
642
+ "chip-icon": "account_circle"
643
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), Q.value ? (m(), p("div", pt, [u(Z, {
644
+ modelValue: E.value,
645
+ "onUpdate:modelValue": t[3] || (t[3] = (d) => E.value = d),
646
+ items: Fe.value,
647
+ "filter-fn": Ie,
648
+ multiple: "",
649
+ variant: "dark",
650
+ placeholder: s(a)("auditLog.filter.subject_placeholder"),
651
+ "selected-prefix": s(a)("auditLog.filter.selected_subject_prefix"),
652
+ "chip-icon": "badge"
653
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])) : h("", !0), o("div", vt, [u(Z, {
654
+ modelValue: C.value,
655
+ "onUpdate:modelValue": t[4] || (t[4] = (d) => C.value = d),
656
+ items: Ve.value,
657
+ multiple: "",
658
+ variant: "dark",
659
+ placeholder: s(a)("auditLog.filter.action_placeholder"),
660
+ "selected-prefix": s(a)("auditLog.filter.selected_action_prefix"),
661
+ searchable: !1
662
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), o("div", gt, [u(Z, {
663
+ modelValue: O.value,
664
+ "onUpdate:modelValue": t[5] || (t[5] = (d) => O.value = d),
665
+ items: Pe.value,
666
+ multiple: "",
667
+ variant: "dark",
668
+ placeholder: s(a)("auditLog.filter.status_placeholder"),
669
+ "selected-prefix": s(a)("auditLog.filter.selected_status_prefix"),
670
+ searchable: !1,
671
+ "chip-icon": "check_circle"
672
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])])]), !P.value && F.value.length === 0 ? (m(), ge(s(st), {
673
+ key: 0,
674
+ title: s(a)("auditLog.noData.title"),
675
+ subtitle: s(a)("auditLog.noData.subtitle")
676
+ }, null, 8, ["title", "subtitle"])) : (m(), ge(tt, {
677
+ key: 1
678
+ }, {
679
+ default: M(() => [o("div", _t, [u(B, {
680
+ "column-defs": Re,
681
+ "row-data": F.value,
682
+ "page-size": F.value.length,
683
+ loading: P.value,
684
+ "pin-header-row": "",
685
+ "hide-footer": "",
686
+ class: "min-h-0 flex-1 cursor-pointer",
687
+ onRowClick: t[6] || (t[6] = (d) => Ye(d.original))
688
+ }, null, 8, ["row-data", "page-size", "loading"]), g.value > 1 || L.value ? (m(), p("div", bt, [u(f, {
689
+ variant: "tertiary",
690
+ icon: "chevron_left",
691
+ disabled: g.value === 1,
692
+ "aria-label": s(a)("auditLog.pagination.prevPage"),
693
+ onClick: qe
694
+ }, null, 8, ["disabled", "aria-label"]), o("span", ht, n(s(a)("auditLog.pagination.page", {
695
+ page: g.value
696
+ })), 1), u(f, {
697
+ variant: "tertiary",
698
+ icon: "chevron_right",
699
+ disabled: !L.value,
700
+ "aria-label": s(a)("auditLog.pagination.nextPage"),
701
+ onClick: Be
702
+ }, null, 8, ["disabled", "aria-label"])])) : h("", !0)])]),
703
+ _: 1
704
+ }))])]),
705
+ _: 1
706
+ }, 8, ["heading"]), u(ae, {
707
+ header: s(a)("auditLog.detail.header"),
708
+ "model-value": I.value,
709
+ "max-width": 480,
710
+ "dismiss-away": "",
711
+ "onUpdate:modelValue": t[7] || (t[7] = (d) => {
712
+ d || ze();
713
+ })
714
+ }, {
715
+ default: M(() => [l.value ? (m(), p("div", yt, [o("div", xt, [o("div", Lt, [o("p", St, n(ee(l.value)), 1)]), u(V, {
716
+ variant: ue[l.value.outcome] ?? "neutral",
717
+ label: te(l.value.outcome),
718
+ compact: ""
719
+ }, null, 8, ["variant", "label"])]), o("div", kt, [o("div", wt, [o("div", null, [o("p", Ft, n(s(a)("auditLog.detail.date")), 1), o("p", It, n(je(l.value.timestamp)), 1)]), o("div", null, [o("p", Vt, n(s(a)("auditLog.detail.user")), 1), o("p", Pt, n(H(l.value)), 1)]), o("div", null, [o("p", Tt, n(s(a)("auditLog.detail.email")), 1), o("p", Et, n(Ce(l.value)), 1)]), o("div", null, [o("p", Ot, n(s(a)("auditLog.detail.role")), 1), o("p", Ct, n(W(l.value.subject) || l.value.subject), 1)]), l.value.field ? (m(), p("div", jt, [o("p", Dt, n(s(a)("auditLog.detail.field")), 1), o("p", Mt, n(l.value.field), 1)])) : h("", !0), o("div", null, [o("p", At, n(s(a)("auditLog.detail.business")), 1), o("p", Ut, n(l.value.businessId || "-"), 1)]), o("div", null, [o("p", Nt, n(s(a)("auditLog.detail.restaurant")), 1), o("p", Kt, n(l.value.restaurantId || "-"), 1)])])]), l.value.metadata.operationLabel ? (m(), p("div", Rt, [o("div", qt, [o("p", Bt, n(s(a)("auditLog.detail.changeDetails")), 1)]), t[8] || (t[8] = o("hr", {
720
+ class: "border-fm-color-border-default"
721
+ }, null, -1)), o("div", Yt, [o("div", null, [o("p", zt, n(s(a)("auditLog.detail.eventType")), 1), o("p", $t, n(l.value.metadata.operationLabel), 1)])])])) : h("", !0), o("div", Ht, [o("div", Jt, [o("p", Gt, n(s(a)("auditLog.detail.metadata")), 1)]), t[9] || (t[9] = o("hr", {
722
+ class: "border-fm-color-border-default"
723
+ }, null, -1)), o("div", Xt, [o("div", null, [o("p", Zt, n(s(a)("auditLog.detail.resolvedFrom")), 1), o("p", Qt, n(De(l.value.metadata.resolvedFrom)), 1)]), (l.value.metadata.resolvedFrom === "permissionSet" || l.value.metadata.resolvedFrom === "systemPermissionSet") && (l.value.metadata.permissionSetName || l.value.metadata.permissionSetId) ? (m(), p("div", Wt, [o("p", eo, n(s(a)("auditLog.detail.permissionSet")), 1), l.value.metadata.permissionSetName ? (m(), p("p", to, n(l.value.metadata.permissionSetName), 1)) : h("", !0), l.value.metadata.permissionSetId ? (m(), p("p", oo, n(l.value.metadata.permissionSetId), 1)) : h("", !0)])) : h("", !0), l.value.metadata.reason ? (m(), p("div", ao, [o("p", lo, n(s(a)("auditLog.detail.reason")), 1), o("p", so, n(l.value.metadata.reason), 1)])) : h("", !0), o("div", null, [o("p", no, n(s(a)("auditLog.detail.requestMethod")), 1), o("p", io, n(Me(l.value)), 1)]), o("div", null, [o("p", uo, n(s(a)("auditLog.detail.requestPath")), 1), o("p", ro, n(l.value.metadata.requestPath || "-"), 1)]), l.value.metadata.trace && l.value.metadata.trace.length > 0 ? (m(), p("div", co, [o("p", mo, n(s(a)("auditLog.detail.permissionTrace")), 1), o("ol", fo, [(m(!0), p(le, null, _e(l.value.metadata.trace, (d, D) => (m(), p("li", {
724
+ key: D,
725
+ class: "flex items-center gap-6"
726
+ }, [o("span", po, n(D + 1), 1), o("span", vo, n(d), 1), D < l.value.metadata.trace.length - 1 ? (m(), p("span", go, "→")) : h("", !0)]))), 128))])])) : h("", !0), l.value.metadata.requestBody && Object.keys(l.value.metadata.requestBody).length > 0 ? (m(), p("div", _o, [o("p", bo, n(s(a)("auditLog.detail.requestBody")), 1), o("pre", ho, n(JSON.stringify(l.value.metadata.requestBody, null, 2)), 1)])) : h("", !0)])])])) : h("", !0)]),
727
+ _: 1
728
+ }, 8, ["header", "model-value"])], 64);
729
+ };
730
+ }
731
+ });
732
+ export {
733
+ Oo as default
734
+ };