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