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