@feedmepos/mf-hrm-portal 2.1.1-dev.3 → 2.1.1-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/ApprovalCodeList-B0PLZwav.js +758 -0
  2. package/dist/AuditLogList-CRXwPImZ.js +1611 -0
  3. package/dist/ConditionFormHost.vue_vue_type_script_setup_true_lang-zJwkM_Xb.js +387 -0
  4. package/dist/EmployeeList-DN2pnXcS.js +884 -0
  5. package/dist/GrantUserList-DoyxknJZ.js +464 -0
  6. package/dist/{Main-cskEZ3k_.js → Main-B5BKGpLg.js} +1033 -1029
  7. package/dist/Main-BGONIxo8.js +122 -0
  8. package/dist/{Main-DLlpEU3j.js → Main-DQj4xtkB.js} +7 -7
  9. package/dist/PermissionSetList-4uIU9FvN.js +393 -0
  10. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-D0luaKDb.js +4122 -0
  11. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-BJp9hEfv.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DVVSBIx2.js} +1 -0
  12. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js +42 -0
  13. package/dist/RoleList-Bj5Y5jd_.js +685 -0
  14. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
  15. package/dist/TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js +37 -0
  16. package/dist/TeamMemberList-Byjlca2Y.js +1216 -0
  17. package/dist/{TimesheetList-B1H_6zfP.js → TimesheetList-DwIcsOM-.js} +118 -112
  18. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_91afda4e_lang-DeTpbaRk.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-B9qlQ6KG.js} +2 -2
  19. package/dist/{app-DX-PG6wx.js → app-BZwE2coe.js} +5407 -2374
  20. package/dist/app.js +1 -1
  21. package/dist/{dayjs.min-BJrHE7oz.js → dayjs.min-BXBPls4m.js} +1 -1
  22. package/dist/{employee-BJcqtqLM.js → employee-CJTbs1f7.js} +3 -3
  23. package/dist/{iteration-Cfaqt-0s.js → iteration-BCbIbdHR.js} +1 -1
  24. package/dist/{lodash-ClKqCmlZ.js → lodash-CUIS1iIz.js} +1 -1
  25. package/dist/{role-CR_-nBDY.js → role-CzXchcSS.js} +1 -1
  26. package/dist/rule-BO6xj2Xa.js +1058 -0
  27. package/dist/src/api/audit-log/index.d.ts +6 -0
  28. package/dist/src/components/CheckboxInput.vue.d.ts +1 -1
  29. package/dist/src/components/button/ResponsiveFabButton.vue.d.ts +7 -1
  30. package/dist/src/components/table/TableEmptyState.vue.d.ts +7 -15
  31. package/dist/src/composables/useBasePermission.d.ts +2 -1
  32. package/dist/src/composables/useConditionDraft.d.ts +40 -0
  33. package/dist/src/composables/useCoverConditionOverride.d.ts +61 -0
  34. package/dist/src/helpers/business-timezone.d.ts +22 -0
  35. package/dist/src/helpers/filter.d.ts +15 -0
  36. package/dist/src/helpers/permission-reconcile.d.ts +15 -0
  37. package/dist/src/helpers/permission-reconcile.test.d.ts +1 -0
  38. package/dist/src/helpers/permission-set.d.ts +8 -4
  39. package/dist/src/helpers/rule.d.ts +2 -1
  40. package/dist/src/stores/permission-set.d.ts +12 -3
  41. package/dist/src/types/approval-code.d.ts +22 -7
  42. package/dist/src/types/audit-log.d.ts +1 -1
  43. package/dist/src/views/approval-code/components/ApprovalCodeCreatedDialog.vue.d.ts +9 -0
  44. package/dist/src/views/approval-code/components/ApprovalCodeForm.vue.d.ts +6 -1
  45. package/dist/src/views/approval-code/locales/index.d.ts +40 -0
  46. package/dist/src/views/audit-log/event-line.d.ts +13 -0
  47. package/dist/src/views/audit-log/locales/index.d.ts +296 -0
  48. package/dist/src/views/audit-log/snapshot-diff.d.ts +11 -0
  49. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +1 -0
  50. package/dist/src/views/team/components/BasePermission.vue.d.ts +13 -0
  51. package/dist/src/views/team/condition-builders/ConditionFormHost.vue.d.ts +22 -0
  52. package/dist/src/views/team/condition-builders/ConditionFormRenderer.vue.d.ts +23 -0
  53. package/dist/src/views/team/condition-builders/component-map.d.ts +4 -0
  54. package/dist/src/views/team/condition-builders/condition-form-dedupe.d.ts +23 -0
  55. package/dist/src/views/team/locales/index.d.ts +80 -0
  56. package/dist/style.css +1 -1
  57. package/dist/tsconfig.app.tsbuildinfo +1 -1
  58. package/dist/useDebounce-B8ZPVS5C.js +15 -0
  59. package/dist/{useReportPermissions-ybHA26cJ.js → useReportPermissions-Q-xLwz5N.js} +3 -3
  60. package/package.json +2 -2
  61. package/dist/ApprovalCodeList-BH5sgVMU.js +0 -638
  62. package/dist/AuditLogList-Q4L5Te8O.js +0 -1145
  63. package/dist/CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js +0 -58
  64. package/dist/EmployeeList-GtKmJZbf.js +0 -899
  65. package/dist/GrantUserList-CnLjOi5_.js +0 -468
  66. package/dist/Main-Cn7Dawg4.js +0 -120
  67. package/dist/PermissionSetList-C2fK2pTz.js +0 -357
  68. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CMh0DL1_.js +0 -3458
  69. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +0 -38
  70. package/dist/RoleList-CcuT1ERb.js +0 -567
  71. package/dist/TeamMemberList-Dfs2iNdC.js +0 -1131
  72. package/dist/rule-BB-3S-2R.js +0 -996
  73. package/dist/useDebounce-CWb5QR9G.js +0 -28
@@ -0,0 +1,122 @@
1
+ import { defineComponent as F, computed as n, ref as y, watch as S, resolveComponent as f, createBlock as m, openBlock as p, withCtx as _, createElementVNode as b, createVNode as B, createCommentVNode as T, normalizeClass as G, toDisplayString as q, resolveDynamicComponent as x } from "vue";
2
+ import { useRoute as E, useRouter as $ } from "vue-router";
3
+ import { useI18n as I, useCoreStore as z } from "@feedmepos/mf-common";
4
+ import { useSnackbar as M } from "@feedmepos/ui-library";
5
+ import { _ as j } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js";
6
+ import { _ as H } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
7
+ import { u as J } from "./restaurant-YOVMuuFY.js";
8
+ import { u as K } from "./role-CzXchcSS.js";
9
+ import { u as Q } from "./grant-user-CQZaTzVt.js";
10
+ import { u as W } from "./approval-code-Q4666xp5.js";
11
+ import { R as u } from "./app-BZwE2coe.js";
12
+ const X = { class: "space-y-24" }, ie = /* @__PURE__ */ F({
13
+ __name: "Main",
14
+ setup(Y) {
15
+ const { t: a } = I(), l = E(), d = $(), V = M(), { sessionUser: h, currentBusiness: A } = z(), { readRestaurants: P } = J(), { readRoles: L } = K(), { readGrantUsers: O } = Q(), { readApprovalCodes: k } = W(), o = n(() => {
16
+ var t;
17
+ return !!((t = h.value) != null && t.role.isAdmin);
18
+ }), R = y(), g = y(), s = n({
19
+ get: () => l.name === u.POS_GRANT ? "grants" : "codes",
20
+ set: (t) => {
21
+ d.push({
22
+ name: t === "grants" ? u.POS_GRANT : u.APPROVAL_CODE,
23
+ query: d.currentRoute.value.query
24
+ });
25
+ }
26
+ }), v = n(() => {
27
+ const t = [];
28
+ return o.value && t.push({
29
+ label: a("posAccess.tabs.grants"),
30
+ subTitle: a("posAccess.tabs.grantsDescription"),
31
+ value: "grants",
32
+ createButtonLabel: a("grantUser.actions.create"),
33
+ createButtonAction: () => {
34
+ var e;
35
+ return (e = g.value) == null ? void 0 : e.create();
36
+ }
37
+ }), t.push({
38
+ label: a("posAccess.tabs.codes"),
39
+ subTitle: a("posAccess.tabs.codesDescription"),
40
+ value: "codes",
41
+ createButtonLabel: a("approvalCode.actions.create"),
42
+ createButtonAction: () => {
43
+ var e;
44
+ return (e = R.value) == null ? void 0 : e.create();
45
+ }
46
+ }), t;
47
+ }), c = n(
48
+ () => v.value.find((t) => t.value === s.value) ?? v.value[0]
49
+ ), N = n(() => o.value ? a("posAccess.title") : a("approvalCode.title"));
50
+ return S(
51
+ [o, () => l.name],
52
+ () => {
53
+ !o.value && l.name === u.POS_GRANT && d.replace({ name: u.APPROVAL_CODE, query: l.query });
54
+ },
55
+ { immediate: !0 }
56
+ ), S(
57
+ [A, o],
58
+ async () => {
59
+ var t;
60
+ if ((t = A.value) != null && t._id)
61
+ try {
62
+ const e = [P(), k()];
63
+ o.value && e.push(L(), O()), await Promise.all(e);
64
+ } catch (e) {
65
+ console.error("Failed to load POS access dependencies:", e), V.open({
66
+ message: e instanceof Error ? e.message : String(e),
67
+ type: "error"
68
+ });
69
+ }
70
+ },
71
+ { immediate: !0 }
72
+ ), (t, e) => {
73
+ const D = f("FmSpacer"), U = f("FmTabs"), w = f("RouterView");
74
+ return p(), m(H, { heading: N.value }, {
75
+ "append-heading": _(() => {
76
+ var r;
77
+ return [
78
+ B(D),
79
+ (r = c.value) != null && r.createButtonLabel ? (p(), m(j, {
80
+ key: 0,
81
+ icon: "add",
82
+ label: c.value.createButtonLabel,
83
+ onClick: e[0] || (e[0] = (i) => c.value.createButtonAction())
84
+ }, null, 8, ["label"])) : T("", !0)
85
+ ];
86
+ }),
87
+ default: _(() => {
88
+ var r;
89
+ return [
90
+ b("div", X, [
91
+ b("div", null, [
92
+ o.value ? (p(), m(U, {
93
+ key: 0,
94
+ modelValue: s.value,
95
+ "onUpdate:modelValue": e[1] || (e[1] = (i) => s.value = i),
96
+ items: v.value
97
+ }, null, 8, ["modelValue", "items"])) : T("", !0),
98
+ b("p", {
99
+ class: G(["text-fm-color-typo-secondary", { "mt-8": o.value }])
100
+ }, q((r = c.value) == null ? void 0 : r.subTitle), 3)
101
+ ]),
102
+ B(w, null, {
103
+ default: _(({ Component: i }) => [
104
+ (p(), m(x(i), {
105
+ ref: (C) => {
106
+ s.value === "codes" && (R.value = C), s.value === "grants" && (g.value = C);
107
+ }
108
+ }, null, 512))
109
+ ]),
110
+ _: 1
111
+ })
112
+ ])
113
+ ];
114
+ }),
115
+ _: 1
116
+ }, 8, ["heading"]);
117
+ };
118
+ }
119
+ });
120
+ export {
121
+ ie as default
122
+ };
@@ -1,18 +1,18 @@
1
1
  import { defineComponent as M, ref as R, computed as s, resolveComponent as i, createBlock as c, openBlock as p, withCtx as l, createElementVNode as S, createVNode as d, resolveDynamicComponent as g, createCommentVNode as y, createTextVNode as A, toDisplayString as C } from "vue";
2
2
  import { useRouter as N, useRoute as h } from "vue-router";
3
3
  import { useI18n as k } from "@feedmepos/mf-common";
4
- import { _ as x } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
4
+ import { _ as x } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js";
5
5
  import { _ as F } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
6
6
  import { u as w } from "./restaurant-YOVMuuFY.js";
7
7
  import "@feedmepos/ui-library";
8
- import "./rule-BB-3S-2R.js";
9
- import "./lodash-ClKqCmlZ.js";
10
- import "./iteration-Cfaqt-0s.js";
8
+ import "./rule-BO6xj2Xa.js";
9
+ import "./lodash-CUIS1iIz.js";
10
+ import "./iteration-BCbIbdHR.js";
11
11
  import "./useAppStore-DNTlIeMv.js";
12
- import { R as v } from "./app-DX-PG6wx.js";
13
- import "./role-CR_-nBDY.js";
12
+ import { R as v } from "./app-BZwE2coe.js";
13
+ import "./role-CzXchcSS.js";
14
14
  /* empty css */
15
- import "./PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-BJp9hEfv.js";
15
+ import "./PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DVVSBIx2.js";
16
16
  const $ = { class: "space-y-24" }, Z = /* @__PURE__ */ M({
17
17
  __name: "Main",
18
18
  setup(q) {
@@ -0,0 +1,393 @@
1
+ import { defineComponent as Z, ref as f, computed as h, watch as ue, resolveComponent as _, createBlock as de, openBlock as ee, unref as r, withCtx as C, createVNode as m, createElementVNode as y, toDisplayString as G, nextTick as pe, onMounted as fe, createElementBlock as ve, Fragment as Se, h as S } from "vue";
2
+ import { useI18n as se, useCoreStore as he } from "@feedmepos/mf-common";
3
+ import { useSnackbar as oe, useDialog as te, useBreakpoints as ne, components as H } from "@feedmepos/ui-library";
4
+ import { v as Q, _ as _e } from "./app-BZwE2coe.js";
5
+ import { _ as be } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
6
+ import { u as ge, _ as Pe } from "./useDiscardConfirm-DPhEV6v0.js";
7
+ import { u as ie, c as M, i as ae, p as Y, j as ye, d as we, m as L, o as xe, q as Fe, s as ke, n as Ce, w as Ie } from "./rule-BO6xj2Xa.js";
8
+ import { l as j } from "./lodash-CUIS1iIz.js";
9
+ import { c as Re } from "./iteration-BCbIbdHR.js";
10
+ import { u as Ve } from "./useLoading-BH02lYns.js";
11
+ import { _ as Ee } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-D0luaKDb.js";
12
+ import { A as je } from "./restaurant-YOVMuuFY.js";
13
+ const Te = { class: "flex w-full items-center justify-between" }, $e = { class: "fm-typo-en-title-md-600" }, Be = { class: "fm-typo-en-title-sm-600 mt-24" }, Le = { class: "flex items-center justify-start gap-8" }, Ae = /* @__PURE__ */ Z({
14
+ __name: "PermissionSetForm",
15
+ props: {
16
+ modelValue: {
17
+ type: Object,
18
+ default: () => ({})
19
+ }
20
+ },
21
+ setup(K, { expose: A }) {
22
+ const o = K, { t: i } = se(), v = f(!1), T = h(() => {
23
+ var e;
24
+ return (e = o.modelValue) != null && e.id ? i("permissionSet.form.update.title") : i("permissionSet.form.create.title");
25
+ }), I = f(), D = oe(), w = te(), { breakpoints: R } = ne(), V = Ve(D), l = ie(), d = f({ ...o.modelValue }), a = f([]), p = f([]), $ = [(e) => !!e || i("permissionSet.form.nameRequired")], q = h(() => {
26
+ var e;
27
+ return (e = o.modelValue) != null && e.id ? i("permissionSet.form.update.confirmButtonLabel") : i("permissionSet.form.create.confirmButtonLabel");
28
+ }), N = h(
29
+ () => l.permissionSets.value.filter((e) => {
30
+ var s;
31
+ return e.id !== ((s = o.modelValue) == null ? void 0 : s.id);
32
+ }).map((e) => ({ label: e.name, value: e.id }))
33
+ ), E = h(
34
+ () => M(a.value, l.permissionSets.value)
35
+ ), {
36
+ fetchCustomReportPermissions: n,
37
+ customReportPermissions: t,
38
+ isLoaded: c
39
+ } = ae(), b = new Set(
40
+ Y.filter((e) => e.subject.startsWith(ye)).map((e) => e.subject)
41
+ ), g = h(() => {
42
+ const e = new Set(b);
43
+ for (const s of t.value) e.add(s.subject);
44
+ return e;
45
+ }), O = h(() => {
46
+ const e = /* @__PURE__ */ new Set();
47
+ for (const s of Y)
48
+ s.category === Q.reports && e.add(s.subject);
49
+ for (const s of t.value)
50
+ s.category === Q.reports && e.add(s.subject);
51
+ return e;
52
+ }), P = f({ name: "", permissionSetIds: [], userPermissions: [] });
53
+ async function z() {
54
+ var s, u;
55
+ await pe(), v.value = !v.value, d.value = { ...o.modelValue }, a.value = ((s = o.modelValue) == null ? void 0 : s.permissionSetIds) ?? [];
56
+ const e = ((u = o.modelValue) == null ? void 0 : u.permissions) ?? [];
57
+ p.value = we(
58
+ L(E.value),
59
+ e
60
+ ), P.value = {
61
+ name: d.value.name ?? "",
62
+ permissionSetIds: [...a.value],
63
+ userPermissions: Re(p.value)
64
+ };
65
+ }
66
+ ue(v, async (e) => {
67
+ e && await n();
68
+ });
69
+ const U = ge(
70
+ () => !j.isEqual(d.value.name ?? "", P.value.name) || !j.isEqual(a.value, P.value.permissionSetIds) || !j.isEqual(p.value, P.value.userPermissions),
71
+ () => {
72
+ v.value = !1;
73
+ }
74
+ );
75
+ function re() {
76
+ const e = L(E.value), s = c.value ? g.value : b, u = xe(p.value, s), x = Fe(u, O.value), F = ke(x);
77
+ return Ce(e, F);
78
+ }
79
+ function J(e) {
80
+ return L(
81
+ M(e, l.permissionSets.value)
82
+ );
83
+ }
84
+ function X(e) {
85
+ p.value = J(e);
86
+ }
87
+ function le(e) {
88
+ const s = [...e ?? []];
89
+ if (j.isEqual(s, a.value)) return;
90
+ const u = !j.isEqual(
91
+ p.value,
92
+ J(a.value)
93
+ );
94
+ if (a.value = s, !u) {
95
+ X(s);
96
+ return;
97
+ }
98
+ w.open({
99
+ title: i("permissionSet.form.overrideInherited.title"),
100
+ message: i("permissionSet.form.overrideInherited.message"),
101
+ minWidth: R.value.lg ? 588 : 0,
102
+ primaryActions: {
103
+ text: i("permissionSet.form.overrideInherited.override"),
104
+ close: !1
105
+ },
106
+ secondaryActions: {
107
+ text: i("permissionSet.form.overrideInherited.keepCurrent"),
108
+ close: !0
109
+ }
110
+ }).onPrimary(() => {
111
+ X(s), w.close();
112
+ });
113
+ }
114
+ async function me() {
115
+ var u, x;
116
+ const e = await ((u = I.value) == null ? void 0 : u.validateInputsWithoutSubmit()), s = (x = he().currentBusiness.value) == null ? void 0 : x.id;
117
+ !(e != null && e.length) && s && V.minor(async () => {
118
+ var B;
119
+ const F = re();
120
+ if ((B = o.modelValue) != null && B.id) {
121
+ const k = {
122
+ name: d.value.name,
123
+ permissions: F,
124
+ permissionSetIds: a.value,
125
+ businessId: d.value.businessId
126
+ };
127
+ await l.updatePermissionSet(o.modelValue.id, k);
128
+ } else {
129
+ const k = {
130
+ name: d.value.name,
131
+ businessId: s,
132
+ permissions: F,
133
+ permissionSetIds: a.value
134
+ };
135
+ await l.createPermissionSet(k);
136
+ }
137
+ v.value = !1;
138
+ });
139
+ }
140
+ return A({
141
+ trigger: z
142
+ }), (e, s) => {
143
+ const u = _("FmIcon"), x = _("FmTextField"), F = _("FmSelect"), B = _("FmForm"), k = _("FmButton"), ce = _("FmSideSheet");
144
+ return ee(), de(ce, {
145
+ "model-value": v.value,
146
+ "max-width": 960,
147
+ "close-button": !1,
148
+ "onOn:clickedAway": r(U)
149
+ }, {
150
+ "side-sheet-header": C(() => [
151
+ y("div", Te, [
152
+ y("p", $e, G(T.value), 1),
153
+ m(u, {
154
+ name: "close",
155
+ size: "md",
156
+ class: "cursor-pointer",
157
+ onClick: r(U)
158
+ }, null, 8, ["onClick"])
159
+ ])
160
+ ]),
161
+ "side-sheet-footer": C(() => [
162
+ y("div", Le, [
163
+ m(k, {
164
+ label: q.value,
165
+ size: "md",
166
+ variant: "primary",
167
+ type: "submit",
168
+ onClick: me
169
+ }, null, 8, ["label"]),
170
+ m(k, {
171
+ label: r(i)("common.cancel"),
172
+ size: "md",
173
+ variant: "secondary",
174
+ onClick: r(U)
175
+ }, null, 8, ["label", "onClick"])
176
+ ])
177
+ ]),
178
+ default: C(() => [
179
+ m(B, {
180
+ ref_key: "formRef",
181
+ ref: I
182
+ }, {
183
+ default: C(() => [
184
+ m(x, {
185
+ modelValue: d.value.name,
186
+ "onUpdate:modelValue": s[0] || (s[0] = (W) => d.value.name = W),
187
+ label: r(i)("permissionSet.form.name"),
188
+ placeholder: r(i)("permissionSet.form.namePlaceholder"),
189
+ rules: $
190
+ }, null, 8, ["modelValue", "label", "placeholder"]),
191
+ m(F, {
192
+ "model-value": a.value,
193
+ multiselect: "",
194
+ searchable: "",
195
+ "search-debounce": 300,
196
+ items: N.value,
197
+ label: r(i)("permissionSet.form.includedSets"),
198
+ placeholder: r(i)("permissionSet.form.includedSetsPlaceholder"),
199
+ class: "mt-16",
200
+ "onUpdate:modelValue": le
201
+ }, null, 8, ["model-value", "items", "label", "placeholder"]),
202
+ y("div", Be, G(r(i)("team.memberForm.permissions.title")), 1),
203
+ m(Ee, {
204
+ modelValue: p.value,
205
+ "onUpdate:modelValue": s[1] || (s[1] = (W) => p.value = W),
206
+ "inherit-permissions": E.value,
207
+ class: "mt-16"
208
+ }, null, 8, ["modelValue", "inherit-permissions"])
209
+ ]),
210
+ _: 1
211
+ }, 512)
212
+ ]),
213
+ _: 1
214
+ }, 8, ["model-value", "onOn:clickedAway"]);
215
+ };
216
+ }
217
+ }), De = { class: "space-y-8" }, qe = { class: "flex justify-end xs:px-16" }, Ne = { class: "flex flex-col h-full overflow-auto" }, Ze = /* @__PURE__ */ Z({
218
+ __name: "PermissionSetList",
219
+ setup(K, { expose: A }) {
220
+ const { t: o } = se(), { customReportPermissions: i, fetchCustomReportPermissions: v } = ae(), T = oe(), I = te(), { breakpoints: D } = ne(), w = f(""), R = h(() => {
221
+ var n;
222
+ return (n = d.value) == null ? void 0 : n.filter((t) => {
223
+ const c = w.value.toLowerCase();
224
+ return t.name.toLowerCase().includes(c);
225
+ });
226
+ }), V = f(), l = ie(), d = h(
227
+ () => l.permissionSets.value
228
+ ), a = f();
229
+ async function p() {
230
+ await l.readPermissionSets();
231
+ }
232
+ function $(n) {
233
+ var t;
234
+ a.value = n, (t = V.value) == null || t.trigger();
235
+ }
236
+ const q = [
237
+ {
238
+ accessorKey: "name",
239
+ header: () => o("permissionSet.table.columns.name")
240
+ },
241
+ {
242
+ accessorKey: "permission",
243
+ header: () => o("permissionSet.table.columns.permissions"),
244
+ enableSorting: !1,
245
+ cell(n) {
246
+ const t = n.row.original, c = M(
247
+ [t.id],
248
+ l.permissionSets.value
249
+ ), b = L(c), g = b.length, O = Ie(
250
+ b,
251
+ i.value
252
+ );
253
+ return S("div", { class: "flex items-center gap-8" }, [
254
+ S("span", o("team.labels.allowed", { count: g })),
255
+ S(
256
+ H.FmTooltip,
257
+ { variant: "plain", placement: "top" },
258
+ {
259
+ default: () => S(H.FmIcon, {
260
+ name: "info",
261
+ class: "cursor-pointer text-fm-color-neutral-gray-300"
262
+ }),
263
+ content: () => S("div", [
264
+ o("team.labels.permission"),
265
+ ...O.map(
266
+ (P, z) => S("div", { key: `${P}-${z}` }, `- ${P}`)
267
+ )
268
+ ])
269
+ }
270
+ )
271
+ ]);
272
+ }
273
+ },
274
+ {
275
+ id: "action",
276
+ size: 52,
277
+ meta: {
278
+ cellClass: "pl-16",
279
+ headerContentClass: "-mx-16"
280
+ },
281
+ cell(n) {
282
+ const t = n.row.original;
283
+ return S(
284
+ "div",
285
+ {
286
+ class: "flex w-full items-center justify-end",
287
+ onClick: (c) => c.stopPropagation()
288
+ },
289
+ [
290
+ S(Pe, {
291
+ items: [
292
+ { label: o("common.update"), onClick: () => $(t) },
293
+ {
294
+ label: o("common.remove"),
295
+ onClick: () => E(t),
296
+ itemClass: "text-fm-color-typo-error"
297
+ }
298
+ ]
299
+ })
300
+ ]
301
+ );
302
+ },
303
+ enableSorting: !1
304
+ }
305
+ ];
306
+ function N() {
307
+ var n;
308
+ a.value = void 0, (n = V.value) == null || n.trigger();
309
+ }
310
+ async function E(n) {
311
+ I.open({
312
+ title: o("permissionSet.form.delete.title"),
313
+ message: o("permissionSet.form.delete.confirmationMessage", { permissionSetName: n.name }),
314
+ minWidth: D.value.lg ? 588 : 0,
315
+ primaryActions: {
316
+ text: o("common.remove"),
317
+ close: !1,
318
+ variant: "destructive"
319
+ },
320
+ secondaryActions: { text: o("common.cancel"), close: !0 }
321
+ }).onPrimary(async () => {
322
+ try {
323
+ await l.deletePermissionSet(n.id), T.open({
324
+ message: o("permissionSet.form.delete.successMessage", { permissionSetName: n.name }),
325
+ type: "success"
326
+ });
327
+ } catch (t) {
328
+ const c = t instanceof je && t.status === 409 ? t.message.includes("referenced by") ? o("permissionSet.form.delete.setReferencedConflictError", {
329
+ permissionSetName: n.name
330
+ }) : o("permissionSet.form.delete.conflictError", { permissionSetName: n.name }) : t instanceof Error ? t.message : `${t}`;
331
+ T.open({ message: c, type: "error" });
332
+ }
333
+ I.close();
334
+ });
335
+ }
336
+ return fe(() => {
337
+ p(), v();
338
+ }), A({
339
+ create: N
340
+ }), (n, t) => {
341
+ const c = _("FmSearch"), b = _("FmTable");
342
+ return ee(), ve(Se, null, [
343
+ m(Ae, {
344
+ ref_key: "permissionSetFormRef",
345
+ ref: V,
346
+ "model-value": a.value
347
+ }, null, 8, ["model-value"]),
348
+ y("div", De, [
349
+ y("div", qe, [
350
+ m(c, {
351
+ modelValue: w.value,
352
+ "onUpdate:modelValue": t[0] || (t[0] = (g) => w.value = g),
353
+ class: "w-[320px] xs:w-full",
354
+ autofocus: "",
355
+ placeholder: r(o)("permissionSet.search.placeholder")
356
+ }, null, 8, ["modelValue", "placeholder"])
357
+ ]),
358
+ m(_e, null, {
359
+ default: C(() => [
360
+ y("div", Ne, [
361
+ m(be, {
362
+ "is-loading": r(l).isLoading.value,
363
+ "is-empty": R.value.length === 0,
364
+ "collapse-at": !1,
365
+ title: r(o)("permissionSet.noData.title"),
366
+ subtitle: r(o)("permissionSet.noData.subtitle")
367
+ }, {
368
+ default: C(() => [
369
+ m(b, {
370
+ "column-defs": q,
371
+ "row-data": R.value,
372
+ "page-size": R.value.length,
373
+ loading: r(l).isLoading.value,
374
+ "pin-header-row": "",
375
+ "hide-footer": "",
376
+ "shrink-at": !1,
377
+ onRowClick: t[1] || (t[1] = (g) => $(g.original))
378
+ }, null, 8, ["row-data", "page-size", "loading"])
379
+ ]),
380
+ _: 1
381
+ }, 8, ["is-loading", "is-empty", "title", "subtitle"])
382
+ ])
383
+ ]),
384
+ _: 1
385
+ })
386
+ ])
387
+ ], 64);
388
+ };
389
+ }
390
+ });
391
+ export {
392
+ Ze as default
393
+ };