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