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