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