@feedmepos/mf-hrm-portal 2.0.6-dev → 2.0.6-dev.2

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 (35) hide show
  1. package/dist/{AuditLogList-BxigxQv3.js → AuditLogList-vHCIpof0.js} +28 -28
  2. package/dist/{EmployeeList-DyvqwZtw.js → EmployeeList-CBhHexQI.js} +5 -5
  3. package/dist/{Main-B8tSMq-U.js → Main-C5Bpd6bc.js} +8 -8
  4. package/dist/{Main-CtH5MCty.js → Main-CEwaF3N8.js} +5 -5
  5. package/dist/PermissionSetList-Df-Ymw2O.js +337 -0
  6. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-zJrXXaE5.js +3355 -0
  7. package/dist/{RoleList-jykDD_zm.js → RoleList-CNdSo3ML.js} +6 -6
  8. package/dist/TeamMemberList-D_RxHSyg.js +988 -0
  9. package/dist/{TimesheetList-Bk1XF9xy.js → TimesheetList-Bq6sBnDH.js} +6 -6
  10. package/dist/{app-BPlaahxK.js → app-CoFcOv4s.js} +915 -807
  11. package/dist/app.js +2 -2
  12. package/dist/{dayjs.min-LweNOSZ_.js → dayjs.min-DYhmwGAk.js} +1 -1
  13. package/dist/{employee-DPfiL6rd.js → employee-BuQUeatq.js} +3 -3
  14. package/dist/{index-BAhsHYNv.js → index-CJbevkE_.js} +1 -1
  15. package/dist/{index-CBxn7cxI.js → index-CmgH764t.js} +2416 -2294
  16. package/dist/{lodash-D1uG3PY3.js → lodash-goefl10e.js} +1 -1
  17. package/dist/src/api/permission-assignment/index.d.ts +3 -0
  18. package/dist/src/api/report-query/index.d.ts +1 -0
  19. package/dist/src/composables/useCustomReportPermissions.d.ts +7 -0
  20. package/dist/src/helpers/permission-set.d.ts +32 -1
  21. package/dist/src/helpers/permission-set.test.d.ts +1 -0
  22. package/dist/src/helpers/rule.d.ts +4 -1
  23. package/dist/src/types/report-query.d.ts +1 -0
  24. package/dist/src/views/team/components/BasePermission.vue.d.ts +17 -0
  25. package/dist/{team-B1osnB4U.js → team-Dy2uK8pr.js} +1 -1
  26. package/dist/{timesheet-rte2utJf.js → timesheet-knvCGlOx.js} +2 -2
  27. package/dist/tsconfig.app.tsbuildinfo +1 -1
  28. package/dist/{useAppStore-CqrjwnF_.js → useAppStore-C3SLn6_I.js} +1 -1
  29. package/dist/{useLoading-B5IjfVEP.js → useLoading-BZMc7JLo.js} +1 -1
  30. package/dist/useReportPermissions-l-Ltg4HG.js +59 -0
  31. package/package.json +2 -2
  32. package/dist/PermissionSetList-DCONmOgn.js +0 -323
  33. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-07Dsea27.js +0 -3092
  34. package/dist/TeamMemberList-DMrPgF1l.js +0 -973
  35. package/dist/useReportPermissions-C4Q29AQJ.js +0 -65
@@ -1,22 +1,22 @@
1
- import { defineComponent as de, ref as h, computed as k, watch as R, resolveComponent as D, createElementBlock as f, openBlock as m, Fragment as F, createVNode as d, unref as n, withCtx as N, createElementVNode as e, createBlock as $, createCommentVNode as x, toDisplayString as s, renderList as re, createTextVNode as Y } from "vue";
2
- import { d as ce } from "./dayjs.min-LweNOSZ_.js";
1
+ import { defineComponent as de, ref as h, computed as k, watch as R, resolveComponent as D, createElementBlock as f, openBlock as m, Fragment as A, createVNode as d, unref as n, withCtx as N, createElementVNode as e, createBlock as $, createCommentVNode as x, toDisplayString as s, renderList as re, createTextVNode as Y } from "vue";
2
+ import { d as ce } from "./dayjs.min-DYhmwGAk.js";
3
3
  import { useI18n as ue, useCoreStore as me } from "@feedmepos/mf-common";
4
- import { G, _ as fe } from "./app-BPlaahxK.js";
4
+ import { F as J, _ as fe } from "./app-CoFcOv4s.js";
5
5
  import { _ as pe } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
6
6
  import { _ as ve } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
7
- import { components as J } from "@feedmepos/ui-library";
8
- import { g as _e, b as ge, p as Z } from "./index-CBxn7cxI.js";
9
- import { u as he } from "./team-B1osnB4U.js";
7
+ import { components as G } from "@feedmepos/ui-library";
8
+ import { g as _e, b as ge, p as Z } from "./index-CmgH764t.js";
9
+ import { u as he } from "./team-Dy2uK8pr.js";
10
10
  import { S as U } from "./SelectFilter-DUj7GBtT.js";
11
11
  const be = "/audit-logs", xe = {
12
12
  async read(i) {
13
- var O, g, L, w;
13
+ var F, g, L, w;
14
14
  const o = {
15
15
  limit: (i == null ? void 0 : i.limit) ?? 100,
16
16
  offset: (i == null ? void 0 : i.offset) ?? 0,
17
17
  ...i != null && i.from ? { from: i.from } : {},
18
18
  ...i != null && i.to ? { to: i.to } : {},
19
- ...(O = i == null ? void 0 : i.userIds) != null && O.length ? { userIds: i.userIds } : {},
19
+ ...(F = i == null ? void 0 : i.userIds) != null && F.length ? { userIds: i.userIds } : {},
20
20
  ...(g = i == null ? void 0 : i.subjects) != null && g.length ? { subjects: i.subjects } : {},
21
21
  ...(L = i == null ? void 0 : i.actions) != null && L.length ? { actions: i.actions } : {},
22
22
  ...(w = i == null ? void 0 : i.outcomes) != null && w.length ? { outcomes: i.outcomes } : {}
@@ -30,7 +30,7 @@ const be = "/audit-logs", xe = {
30
30
  const y = new URLSearchParams();
31
31
  for (const [p, b] of Object.entries(a))
32
32
  if (Array.isArray(b))
33
- for (const A of b) y.append(p, String(A));
33
+ for (const O of b) y.append(p, String(O));
34
34
  else b != null && y.append(p, String(b));
35
35
  return console.log("[AuditLogAPI] serialized query string:", y.toString()), y.toString();
36
36
  }
@@ -63,11 +63,11 @@ const be = "/audit-logs", xe = {
63
63
  class: "rounded-lg border border-fm-color-border-default"
64
64
  }, De = {
65
65
  class: "flex items-start justify-between gap-8 p-12"
66
- }, Oe = {
66
+ }, Fe = {
67
67
  class: "text-base font-bold leading-snug text-fm-color-typo-primary flex-1 min-w-0"
68
- }, Ae = {
68
+ }, Oe = {
69
69
  class: "audit-log-operation-label-detail font-semibold"
70
- }, Fe = {
70
+ }, Ae = {
71
71
  class: "space-y-12 p-12"
72
72
  }, Ne = {
73
73
  class: "text-xs text-fm-color-typo-secondary"
@@ -91,9 +91,9 @@ const be = "/audit-logs", xe = {
91
91
  class: "text-xs text-fm-color-typo-secondary"
92
92
  }, Ye = {
93
93
  class: "font-semibold"
94
- }, Ge = {
95
- key: 1
96
94
  }, Je = {
95
+ key: 1
96
+ }, Ge = {
97
97
  class: "text-xs text-fm-color-typo-secondary"
98
98
  }, Ze = {
99
99
  class: "font-semibold"
@@ -168,9 +168,9 @@ const be = "/audit-logs", xe = {
168
168
  setup(i) {
169
169
  const {
170
170
  t: o
171
- } = ue(), O = me(), g = he(), L = h(!1), w = h([]), a = h(null), y = h(!1), p = h(1), b = h(!1), A = ce().format("YYYY-MM-DD"), I = h({
172
- startDate: A,
173
- endDate: A
171
+ } = ue(), F = me(), g = he(), L = h(!1), w = h([]), a = h(null), y = h(!1), p = h(1), b = h(!1), O = ce().format("YYYY-MM-DD"), I = h({
172
+ startDate: O,
173
+ endDate: O
174
174
  }), C = h(), P = h(), T = h(), V = h();
175
175
  function H(l) {
176
176
  return typeof l == "string" ? [l] : Array.isArray(l) ? l.filter((t) => typeof t == "string") : [];
@@ -182,7 +182,7 @@ const be = "/audit-logs", xe = {
182
182
  const l = Z.flatMap((c) => H(c.subject).map((_) => ({
183
183
  label: c.label,
184
184
  value: _
185
- }))), t = Object.entries(G).map(([c, _]) => ({
185
+ }))), t = Object.entries(J).map(([c, _]) => ({
186
186
  label: _,
187
187
  value: c
188
188
  })), r = /* @__PURE__ */ new Set(), v = [];
@@ -227,7 +227,7 @@ const be = "/audit-logs", xe = {
227
227
  }), B = k(() => w.value);
228
228
  function z(l) {
229
229
  var t;
230
- return ((t = Z.find((r) => r.subject === l)) == null ? void 0 : t.label) ?? G[l];
230
+ return ((t = Z.find((r) => r.subject === l)) == null ? void 0 : t.label) ?? J[l];
231
231
  }
232
232
  const M = {
233
233
  allowed: "success",
@@ -249,7 +249,7 @@ const be = "/audit-logs", xe = {
249
249
  const t = l.row.original, r = g.userIdToName[t.userId], v = g.userIdToPhone[t.userId], c = g.userIdToEmail[t.userId];
250
250
  return d("div", {
251
251
  class: "flex items-center gap-8"
252
- }, [d(J.FmAvatar, {
252
+ }, [d(G.FmAvatar, {
253
253
  initials: r || t.userId,
254
254
  size: "sm",
255
255
  class: "shrink-0"
@@ -302,7 +302,7 @@ const be = "/audit-logs", xe = {
302
302
  enableSorting: !1,
303
303
  cell(l) {
304
304
  const t = l.row.original;
305
- return d(J.FmChip, {
305
+ return d(G.FmChip, {
306
306
  variant: M[t.outcome] ?? "neutral",
307
307
  label: t.outcome,
308
308
  compact: !0
@@ -366,13 +366,13 @@ const be = "/audit-logs", xe = {
366
366
  function ie() {
367
367
  y.value = !1, a.value = null;
368
368
  }
369
- return R(O.currentBusiness, (l) => {
369
+ return R(F.currentBusiness, (l) => {
370
370
  l && (p.value = 1, g.readTeamMembers(), j());
371
371
  }, {
372
372
  immediate: !0
373
373
  }), (l, t) => {
374
374
  const r = D("FmChip"), v = D("FmDateRangePicker"), c = D("FmTable"), _ = D("FmButton"), E = D("FmSideSheet");
375
- return m(), f(F, null, [d(pe, {
375
+ return m(), f(A, null, [d(pe, {
376
376
  heading: n(o)("auditLog.title")
377
377
  }, {
378
378
  default: N(() => [e("div", ye, [e("div", Le, [d(v, {
@@ -466,19 +466,19 @@ const be = "/audit-logs", xe = {
466
466
  u || ie();
467
467
  })
468
468
  }, {
469
- default: N(() => [a.value ? (m(), f("div", Ve, [e("div", je, [e("div", De, [e("div", Oe, [e("p", Ae, s(a.value.metadata.operationLabel || "-"), 1)]), d(r, {
469
+ default: N(() => [a.value ? (m(), f("div", Ve, [e("div", je, [e("div", De, [e("div", Fe, [e("p", Oe, s(a.value.metadata.operationLabel || "-"), 1)]), d(r, {
470
470
  variant: M[a.value.outcome] ?? "neutral",
471
471
  label: a.value.outcome,
472
472
  compact: ""
473
473
  }, null, 8, ["variant", "label"])]), t[7] || (t[7] = e("hr", {
474
474
  class: "border-fm-color-border-default"
475
- }, null, -1)), e("div", Fe, [e("div", null, [e("p", Ne, s(n(o)("auditLog.detail.timestamp")), 1), e("p", Ue, s(new Date(a.value.timestamp).toLocaleString()), 1)]), n(g).userIdToName[a.value.userId] ? (m(), f("div", Be, [e("p", Ee, s(n(o)("auditLog.detail.user")), 1), e("p", Re, s(n(g).userIdToName[a.value.userId]), 1)])) : x("", !0), e("div", null, [e("p", qe, s(n(o)("auditLog.detail.email")), 1), e("p", ze, s(n(g).userIdToEmail[a.value.userId] || a.value.userId), 1)]), e("div", null, [e("p", Me, s(n(o)("auditLog.detail.action")), 1), e("p", Ke, s(a.value.action), 1)]), e("div", null, [e("p", $e, s(n(o)("auditLog.detail.subject")), 1), e("p", Ye, s(z(a.value.subject) || a.value.subject), 1)]), a.value.field ? (m(), f("div", Ge, [e("p", Je, s(n(o)("auditLog.detail.field")), 1), e("p", Ze, s(a.value.field), 1)])) : x("", !0), e("div", null, [e("p", He, s(n(o)("auditLog.detail.business")), 1), e("p", Qe, s(a.value.businessId || "-"), 1)]), e("div", null, [e("p", We, s(n(o)("auditLog.detail.restaurant")), 1), e("p", Xe, s(a.value.restaurantId || "-"), 1)])])]), e("div", et, [e("div", tt, [e("p", ot, s(n(o)("auditLog.detail.metadata")), 1)]), t[8] || (t[8] = e("hr", {
475
+ }, null, -1)), e("div", Ae, [e("div", null, [e("p", Ne, s(n(o)("auditLog.detail.timestamp")), 1), e("p", Ue, s(new Date(a.value.timestamp).toLocaleString()), 1)]), n(g).userIdToName[a.value.userId] ? (m(), f("div", Be, [e("p", Ee, s(n(o)("auditLog.detail.user")), 1), e("p", Re, s(n(g).userIdToName[a.value.userId]), 1)])) : x("", !0), e("div", null, [e("p", qe, s(n(o)("auditLog.detail.email")), 1), e("p", ze, s(n(g).userIdToEmail[a.value.userId] || a.value.userId), 1)]), e("div", null, [e("p", Me, s(n(o)("auditLog.detail.action")), 1), e("p", Ke, s(a.value.action), 1)]), e("div", null, [e("p", $e, s(n(o)("auditLog.detail.subject")), 1), e("p", Ye, s(z(a.value.subject) || a.value.subject), 1)]), a.value.field ? (m(), f("div", Je, [e("p", Ge, s(n(o)("auditLog.detail.field")), 1), e("p", Ze, s(a.value.field), 1)])) : x("", !0), e("div", null, [e("p", He, s(n(o)("auditLog.detail.business")), 1), e("p", Qe, s(a.value.businessId || "-"), 1)]), e("div", null, [e("p", We, s(n(o)("auditLog.detail.restaurant")), 1), e("p", Xe, s(a.value.restaurantId || "-"), 1)])])]), e("div", et, [e("div", tt, [e("p", ot, s(n(o)("auditLog.detail.metadata")), 1)]), t[8] || (t[8] = e("hr", {
476
476
  class: "border-fm-color-border-default"
477
- }, null, -1)), e("div", at, [a.value.metadata.reason ? (m(), f("div", lt, [e("p", st, s(n(o)("auditLog.detail.reason")), 1), e("p", nt, s(a.value.metadata.reason), 1)])) : x("", !0), e("div", null, [e("p", it, s(n(o)("auditLog.detail.resolvedFrom")), 1), e("p", dt, s(a.value.metadata.resolvedFrom), 1)]), a.value.metadata.permissionSetId ? (m(), f("div", rt, [e("p", ct, s(n(o)("auditLog.detail.permissionSet")), 1), a.value.metadata.resolvedFrom === "systemPermissionSet" ? (m(), f(F, {
477
+ }, null, -1)), e("div", at, [a.value.metadata.reason ? (m(), f("div", lt, [e("p", st, s(n(o)("auditLog.detail.reason")), 1), e("p", nt, s(a.value.metadata.reason), 1)])) : x("", !0), e("div", null, [e("p", it, s(n(o)("auditLog.detail.resolvedFrom")), 1), e("p", dt, s(a.value.metadata.resolvedFrom), 1)]), a.value.metadata.permissionSetId ? (m(), f("div", rt, [e("p", ct, s(n(o)("auditLog.detail.permissionSet")), 1), a.value.metadata.resolvedFrom === "systemPermissionSet" ? (m(), f(A, {
478
478
  key: 0
479
- }, [e("p", ut, s(a.value.metadata.permissionSetName) + " (system)", 1), e("p", mt, s(a.value.metadata.permissionSetId), 1)], 64)) : (m(), f(F, {
479
+ }, [e("p", ut, s(a.value.metadata.permissionSetName) + " (system)", 1), e("p", mt, s(a.value.metadata.permissionSetId), 1)], 64)) : (m(), f(A, {
480
480
  key: 1
481
- }, [e("p", ft, s(a.value.metadata.permissionSetName || a.value.metadata.permissionSetId), 1), a.value.metadata.permissionSetName ? (m(), f("p", pt, s(a.value.metadata.permissionSetId), 1)) : x("", !0)], 64))])) : x("", !0), a.value.metadata.trace && a.value.metadata.trace.length > 0 ? (m(), f("div", vt, [e("p", _t, s(n(o)("auditLog.detail.permissionTrace")), 1), e("ol", gt, [(m(!0), f(F, null, re(a.value.metadata.trace, (u, S) => (m(), f("li", {
481
+ }, [e("p", ft, s(a.value.metadata.permissionSetName || a.value.metadata.permissionSetId), 1), a.value.metadata.permissionSetName ? (m(), f("p", pt, s(a.value.metadata.permissionSetId), 1)) : x("", !0)], 64))])) : x("", !0), a.value.metadata.trace && a.value.metadata.trace.length > 0 ? (m(), f("div", vt, [e("p", _t, s(n(o)("auditLog.detail.permissionTrace")), 1), e("ol", gt, [(m(!0), f(A, null, re(a.value.metadata.trace, (u, S) => (m(), f("li", {
482
482
  key: S,
483
483
  class: "flex items-center gap-6"
484
484
  }, [e("span", ht, s(S + 1), 1), e("span", bt, s(u), 1), S < a.value.metadata.trace.length - 1 ? (m(), f("span", xt, "→")) : x("", !0)]))), 128))])])) : x("", !0), e("div", null, [e("p", yt, s(n(o)("auditLog.detail.requestMethod")), 1), e("p", Lt, s(a.value.metadata.requestMethod), 1)]), e("div", null, [e("p", St, s(n(o)("auditLog.detail.requestPath")), 1), e("p", kt, s(a.value.metadata.requestPath), 1)]), a.value.metadata.requestBody && Object.keys(a.value.metadata.requestBody).length > 0 ? (m(), f("div", wt, [e("p", It, s(n(o)("auditLog.detail.requestBody")), 1), e("pre", Ct, s(JSON.stringify(a.value.metadata.requestBody, null, 2)), 1)])) : x("", !0)])])])) : x("", !0)]),
@@ -2,14 +2,14 @@ import { createElementBlock as $, openBlock as g, createElementVNode as m, toRaw
2
2
  import { useCoreStore as Fe, useI18n as we, RestaurantSelector as ce } from "@feedmepos/mf-common";
3
3
  import { useSnackbar as xe, components as Ue, useDialog as Ne, useBreakpoints as Be, FmButtonVariant as De } from "@feedmepos/ui-library";
4
4
  import { _ as Pe, S as pe } from "./SelectFilter-DUj7GBtT.js";
5
- import { _ as Te } from "./app-BPlaahxK.js";
5
+ import { _ as Te } from "./app-CoFcOv4s.js";
6
6
  import { _ as ze } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
7
7
  import { u as ke } from "./useSearch-B6WK1LBB.js";
8
- import { u as Se, E as Ae } from "./employee-DPfiL6rd.js";
9
- import { l as je } from "./lodash-D1uG3PY3.js";
8
+ import { u as Se, E as Ae } from "./employee-BuQUeatq.js";
9
+ import { l as je } from "./lodash-goefl10e.js";
10
10
  import { u as Ke, _ as ve, a as fe, b as Ge } from "./useRestaurantMap-D5BNPLKh.js";
11
- import { u as qe } from "./useLoading-B5IjfVEP.js";
12
- import { u as ue } from "./useAppStore-CqrjwnF_.js";
11
+ import { u as qe } from "./useLoading-BZMc7JLo.js";
12
+ import { u as ue } from "./useAppStore-C3SLn6_I.js";
13
13
  const He = {};
14
14
  function Je(S, O) {
15
15
  return g(), $("div", null, [...O[0] || (O[0] = [
@@ -3,16 +3,16 @@ import { useRouter as of, useRoute as cf } from "vue-router";
3
3
  import { useCoreStore as hf, useI18n as uf } from "@feedmepos/mf-common";
4
4
  import { _ as vf } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
5
5
  import { _ as pf } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
6
- import { u as df } from "./useAppStore-CqrjwnF_.js";
6
+ import { u as df } from "./useAppStore-C3SLn6_I.js";
7
7
  import "@feedmepos/ui-library";
8
8
  /* empty css */
9
- import { u as mf } from "./employee-DPfiL6rd.js";
10
- import "./lodash-D1uG3PY3.js";
11
- import "./index-CBxn7cxI.js";
12
- import { R as vt } from "./app-BPlaahxK.js";
13
- import "./useReportPermissions-C4Q29AQJ.js";
14
- import "./dayjs.min-LweNOSZ_.js";
15
- import "./timesheet-rte2utJf.js";
9
+ import { u as mf } from "./employee-BuQUeatq.js";
10
+ import "./lodash-goefl10e.js";
11
+ import "./index-CmgH764t.js";
12
+ import { R as vt } from "./app-CoFcOv4s.js";
13
+ import "./useReportPermissions-l-Ltg4HG.js";
14
+ import "./dayjs.min-DYhmwGAk.js";
15
+ import "./timesheet-knvCGlOx.js";
16
16
  var In = {};
17
17
  /*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
18
18
  var jt = {};
@@ -4,13 +4,13 @@ import { useI18n as N } from "@feedmepos/mf-common";
4
4
  import { _ as g } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
5
5
  import { _ as h } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
6
6
  import "@feedmepos/ui-library";
7
- import "./index-CBxn7cxI.js";
8
- import { R as v } from "./app-BPlaahxK.js";
9
- import "./useAppStore-CqrjwnF_.js";
10
- import "./index-BAhsHYNv.js";
7
+ import "./index-CmgH764t.js";
8
+ import { R as v } from "./app-CoFcOv4s.js";
9
+ import "./useAppStore-C3SLn6_I.js";
10
+ import "./index-CJbevkE_.js";
11
11
  /* empty css */
12
12
  /* empty css */
13
- import "./team-B1osnB4U.js";
13
+ import "./team-Dy2uK8pr.js";
14
14
  const w = { class: "space-y-24" }, P = /* @__PURE__ */ V({
15
15
  __name: "Main",
16
16
  setup(x) {
@@ -0,0 +1,337 @@
1
+ import { defineComponent as q, computed as S, resolveComponent as u, createElementBlock as E, openBlock as g, createElementVNode as y, createVNode as r, toDisplayString as N, unref as c, withCtx as P, createTextVNode as te, Fragment as X, renderList as oe, ref as b, createBlock as H, nextTick as ne, onMounted as ie, h as O } from "vue";
2
+ import { useI18n as M, useCoreStore as ae } from "@feedmepos/mf-common";
3
+ import { useSnackbar as Q, useDialog as le, useBreakpoints as re, components as me, FmButtonColorThemeVariant as ce, FmButtonVariant as ue } from "@feedmepos/ui-library";
4
+ import { _ as de } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
5
+ import { q as K, C as pe, u as Y, m as Z, p as G, v as fe, n as ve, o as A, x as Se, y as _e, z as be, A as he, D as Pe } from "./index-CmgH764t.js";
6
+ import { u as ge } from "./useLoading-BZMc7JLo.js";
7
+ import { i as J } from "./app-CoFcOv4s.js";
8
+ import { a as ye } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-zJrXXaE5.js";
9
+ const Fe = { class: "flex flex-row items-center gap-8" }, Ve = /* @__PURE__ */ q({
10
+ __name: "PermissionWithTooltip",
11
+ props: {
12
+ modelValue: {
13
+ type: Array,
14
+ required: !0
15
+ }
16
+ },
17
+ setup($) {
18
+ const { customReportPermissions: R } = K(), t = $, i = S(() => pe(t.modelValue, R.value)), { t: l } = M();
19
+ return (k, C) => {
20
+ const h = u("FmIcon"), F = u("FmTooltip");
21
+ return g(), E("div", Fe, [
22
+ y("span", null, N(c(l)("team.labels.allowed", { count: i.value.length })), 1),
23
+ r(F, {
24
+ variant: "plain",
25
+ placement: "top"
26
+ }, {
27
+ content: P(() => [
28
+ y("div", null, [
29
+ te(N(c(l)("team.labels.permission")) + " ", 1),
30
+ (g(!0), E(X, null, oe(i.value, (m, a) => (g(), E("div", {
31
+ key: `${m}-${a}`
32
+ }, " - " + N(m), 1))), 128))
33
+ ])
34
+ ]),
35
+ default: P(() => [
36
+ r(h, {
37
+ name: "info",
38
+ class: "cursor-pointer text-fm-color-neutral-gray-300"
39
+ })
40
+ ]),
41
+ _: 1
42
+ })
43
+ ]);
44
+ };
45
+ }
46
+ }), xe = { class: "fm-typo-en-title-md-600" }, we = { class: "flex items-center justify-start gap-8" }, Re = /* @__PURE__ */ q({
47
+ __name: "PermissionSetForm",
48
+ props: {
49
+ modelValue: {
50
+ type: Object,
51
+ default: () => ({})
52
+ }
53
+ },
54
+ setup($, { expose: R }) {
55
+ const t = $, { t: i } = M(), l = b(!1), k = S(() => {
56
+ var e;
57
+ return (e = t.modelValue) != null && e.id ? i("permissionSet.form.update.title") : i("permissionSet.form.create.title");
58
+ }), C = b(), h = Q(), F = ge(h), m = Y(), a = b({ ...t.modelValue }), d = b([]), p = b([]), D = [(e) => !!e || "Permission set name is required"], U = S(() => {
59
+ var e;
60
+ return (e = t.modelValue) != null && e.id ? i("permissionSet.form.update.confirmButtonLabel") : i("permissionSet.form.create.confirmButtonLabel");
61
+ }), W = S(
62
+ () => m.permissionSets.value.filter((e) => {
63
+ var s;
64
+ return e.id !== ((s = t.modelValue) == null ? void 0 : s.id);
65
+ }).map((e) => ({ label: e.name, value: e.id }))
66
+ ), V = S(
67
+ () => Z(d.value, m.permissionSets.value)
68
+ ), { customReportPermissions: L, isLoaded: n } = K(), o = new Set(
69
+ G.filter((e) => e.subject.startsWith(fe)).map((e) => e.subject)
70
+ ), f = S(() => {
71
+ const e = new Set(o);
72
+ for (const s of L.value) e.add(s.subject);
73
+ return e;
74
+ }), I = S(() => {
75
+ const e = /* @__PURE__ */ new Set();
76
+ for (const s of G)
77
+ s.category === J.reports && e.add(s.subject);
78
+ for (const s of L.value)
79
+ s.category === J.reports && e.add(s.subject);
80
+ return e;
81
+ });
82
+ async function z() {
83
+ var s, v;
84
+ await ne(), l.value = !l.value, a.value = { ...t.modelValue }, d.value = ((s = t.modelValue) == null ? void 0 : s.permissionSetIds) ?? [];
85
+ const e = ((v = t.modelValue) == null ? void 0 : v.permissions) ?? [];
86
+ p.value = ve(
87
+ A(V.value),
88
+ e
89
+ );
90
+ }
91
+ function T() {
92
+ const e = A(V.value), s = n.value ? f.value : o, v = Se(p.value, s), x = _e(v, I.value), w = be(x);
93
+ return he(e, w);
94
+ }
95
+ function ee() {
96
+ p.value = A(V.value);
97
+ }
98
+ async function se() {
99
+ var v, x;
100
+ const e = await ((v = C.value) == null ? void 0 : v.validateInputsWithoutSubmit()), s = (x = ae().currentBusiness.value) == null ? void 0 : x.id;
101
+ !(e != null && e.length) && s && F.minor(async () => {
102
+ var j;
103
+ const w = T();
104
+ if ((j = t.modelValue) != null && j.id) {
105
+ const B = {
106
+ name: a.value.name,
107
+ permissions: w,
108
+ permissionSetIds: d.value,
109
+ businessId: a.value.businessId
110
+ };
111
+ await m.updatePermissionSet(t.modelValue.id, B);
112
+ } else {
113
+ const B = {
114
+ name: a.value.name,
115
+ businessId: s,
116
+ permissions: w,
117
+ permissionSetIds: d.value
118
+ };
119
+ await m.createPermissionSet(B);
120
+ }
121
+ l.value = !1;
122
+ });
123
+ }
124
+ return R({
125
+ trigger: z
126
+ }), (e, s) => {
127
+ const v = u("FmTextField"), x = u("FmSelect"), w = u("FmForm"), j = u("FmButton"), B = u("FmSideSheet");
128
+ return g(), H(B, {
129
+ modelValue: l.value,
130
+ "onUpdate:modelValue": s[4] || (s[4] = (_) => l.value = _),
131
+ "max-width": 560,
132
+ "dismiss-away": ""
133
+ }, {
134
+ "side-sheet-header": P(() => [
135
+ y("p", xe, N(k.value), 1)
136
+ ]),
137
+ "side-sheet-footer": P(() => [
138
+ y("div", we, [
139
+ r(j, {
140
+ label: U.value,
141
+ size: "md",
142
+ variant: "primary",
143
+ type: "submit",
144
+ onClick: se
145
+ }, null, 8, ["label"]),
146
+ r(j, {
147
+ label: c(i)("common.cancel"),
148
+ size: "md",
149
+ variant: "secondary",
150
+ onClick: s[3] || (s[3] = (_) => l.value = !1)
151
+ }, null, 8, ["label"])
152
+ ])
153
+ ]),
154
+ default: P(() => [
155
+ r(w, {
156
+ ref_key: "formRef",
157
+ ref: C
158
+ }, {
159
+ default: P(() => [
160
+ r(v, {
161
+ modelValue: a.value.name,
162
+ "onUpdate:modelValue": s[0] || (s[0] = (_) => a.value.name = _),
163
+ label: c(i)("permissionSet.form.name"),
164
+ placeholder: c(i)("permissionSet.form.namePlaceholder"),
165
+ rules: D
166
+ }, null, 8, ["modelValue", "label", "placeholder"]),
167
+ r(x, {
168
+ modelValue: d.value,
169
+ "onUpdate:modelValue": [
170
+ s[1] || (s[1] = (_) => d.value = _),
171
+ ee
172
+ ],
173
+ multiselect: "",
174
+ searchable: "",
175
+ "search-debounce": 300,
176
+ items: W.value,
177
+ label: c(i)("permissionSet.form.includedSets"),
178
+ placeholder: c(i)("permissionSet.form.includedSetsPlaceholder"),
179
+ class: "mt-16"
180
+ }, null, 8, ["modelValue", "items", "label", "placeholder"]),
181
+ r(ye, {
182
+ modelValue: p.value,
183
+ "onUpdate:modelValue": s[2] || (s[2] = (_) => p.value = _),
184
+ "inherit-permissions": V.value,
185
+ class: "mt-24"
186
+ }, null, 8, ["modelValue", "inherit-permissions"])
187
+ ]),
188
+ _: 1
189
+ }, 512)
190
+ ]),
191
+ _: 1
192
+ }, 8, ["modelValue"]);
193
+ };
194
+ }
195
+ }), ke = { class: "space-y-8" }, Ce = { class: "flex justify-end xs:px-16" }, Ie = {
196
+ key: 0,
197
+ class: "overflow-auto"
198
+ }, Te = { class: "pb-64" }, Ue = /* @__PURE__ */ q({
199
+ __name: "PermissionSetList",
200
+ setup($, { expose: R }) {
201
+ const { t } = M(), { fetchCustomReportPermissions: i } = K(), l = Q(), k = le(), { breakpoints: C } = re(), h = b(""), F = S(() => {
202
+ var n;
203
+ return (n = d.value) == null ? void 0 : n.filter((o) => {
204
+ const f = h.value.toLowerCase();
205
+ return o.name.toLowerCase().includes(f);
206
+ });
207
+ }), m = b(), a = Y(), d = S(
208
+ () => a.permissionSets.value
209
+ ), p = b();
210
+ async function D() {
211
+ await a.readPermissionSets();
212
+ }
213
+ function U(n) {
214
+ var o;
215
+ p.value = n, (o = m.value) == null || o.trigger();
216
+ }
217
+ const W = [
218
+ {
219
+ accessorKey: "name",
220
+ header: () => t("permissionSet.table.columns.name")
221
+ },
222
+ {
223
+ accessorKey: "permission",
224
+ header: () => t("permissionSet.table.columns.permissions"),
225
+ enableSorting: !1,
226
+ cell(n) {
227
+ const o = n.row.original, f = Z(
228
+ [o.id],
229
+ a.permissionSets.value
230
+ ), I = A(f);
231
+ return O(Ve, { modelValue: I });
232
+ }
233
+ },
234
+ {
235
+ id: "action",
236
+ meta: {
237
+ cellClass: "pl-16",
238
+ headerContentClass: "-mx-16"
239
+ },
240
+ cell(n) {
241
+ return O("div", { class: "w-full flex justify-end items-center" }, [
242
+ O(me.FmButton, {
243
+ prependIcon: "delete",
244
+ variant: ue.Tertiary,
245
+ textColor: ce.NeutralGray400,
246
+ class: "flex flex-end",
247
+ onClick: (o) => {
248
+ o.stopPropagation(), L(n.row.original);
249
+ }
250
+ })
251
+ ]);
252
+ },
253
+ enableSorting: !1
254
+ }
255
+ ];
256
+ function V() {
257
+ var n;
258
+ p.value = void 0, (n = m.value) == null || n.trigger();
259
+ }
260
+ async function L(n) {
261
+ k.open({
262
+ title: t("permissionSet.form.delete.title"),
263
+ message: t("permissionSet.form.delete.confirmationMessage", { permissionSetName: n.name }),
264
+ minWidth: C.value.lg ? 588 : 0,
265
+ primaryActions: {
266
+ text: t("common.remove"),
267
+ close: !1,
268
+ variant: "destructive"
269
+ },
270
+ secondaryActions: { text: t("common.cancel"), close: !0 }
271
+ }).onPrimary(async () => {
272
+ try {
273
+ await a.deletePermissionSet(n.id), l.open({
274
+ message: t("permissionSet.form.delete.successMessage", { permissionSetName: n.name }),
275
+ type: "success"
276
+ });
277
+ } catch (o) {
278
+ const f = o instanceof Pe && o.status === 409 ? o.message.includes("referenced by") ? t("permissionSet.form.delete.setReferencedConflictError", {
279
+ permissionSetName: n.name
280
+ }) : t("permissionSet.form.delete.conflictError", { permissionSetName: n.name }) : o instanceof Error ? o.message : `${o}`;
281
+ l.open({ message: f, type: "error" });
282
+ }
283
+ k.close();
284
+ });
285
+ }
286
+ return ie(() => {
287
+ D(), i();
288
+ }), R({
289
+ create: V
290
+ }), (n, o) => {
291
+ const f = u("FmSearch"), I = u("FmTable"), z = u("FullWrapper");
292
+ return g(), E(X, null, [
293
+ r(Re, {
294
+ ref_key: "permissionSetFormRef",
295
+ ref: m,
296
+ "model-value": p.value
297
+ }, null, 8, ["model-value"]),
298
+ y("div", ke, [
299
+ y("div", Ce, [
300
+ r(f, {
301
+ modelValue: h.value,
302
+ "onUpdate:modelValue": o[0] || (o[0] = (T) => h.value = T),
303
+ class: "w-[320px] xs:w-full",
304
+ autofocus: "",
305
+ placeholder: c(t)("permissionSet.search.placeholder")
306
+ }, null, 8, ["modelValue", "placeholder"])
307
+ ]),
308
+ d.value.length > 0 ? (g(), E("div", Ie, [
309
+ y("div", Te, [
310
+ r(z, null, {
311
+ default: P(() => [
312
+ r(I, {
313
+ "column-defs": W,
314
+ "row-data": F.value,
315
+ "page-size": F.value.length,
316
+ "pin-header-row": "",
317
+ "hide-footer": "",
318
+ "shrink-at": !1,
319
+ onRowClick: o[1] || (o[1] = (T) => U(T.original))
320
+ }, null, 8, ["row-data", "page-size"])
321
+ ]),
322
+ _: 1
323
+ })
324
+ ])
325
+ ])) : (g(), H(c(de), {
326
+ key: 1,
327
+ title: c(t)("permissionSet.noData.title"),
328
+ subtitle: c(t)("permissionSet.noData.subtitle")
329
+ }, null, 8, ["title", "subtitle"]))
330
+ ])
331
+ ], 64);
332
+ };
333
+ }
334
+ });
335
+ export {
336
+ Ue as default
337
+ };