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