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