@feedmepos/mf-hrm-portal 2.0.8-dev.1 → 2.0.8-dev.11

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