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