@feedmepos/mf-hrm-portal 2.0.6-dev → 2.0.7-dev

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 (34) hide show
  1. package/dist/{AuditLogList-BxigxQv3.js → AuditLogList-COq6WH3T.js} +12 -12
  2. package/dist/{EmployeeList-DyvqwZtw.js → EmployeeList-CtosIPFL.js} +5 -5
  3. package/dist/{Main-CtH5MCty.js → Main-B4YdcrGe.js} +5 -5
  4. package/dist/{Main-B8tSMq-U.js → Main-CdsqeB2G.js} +8 -8
  5. package/dist/PermissionSetList-BUORArci.js +327 -0
  6. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-ChqCTn1L.js +3333 -0
  7. package/dist/{RoleList-jykDD_zm.js → RoleList-D1NGE2IC.js} +6 -6
  8. package/dist/TeamMemberList-auSjZRNz.js +979 -0
  9. package/dist/{TimesheetList-Bk1XF9xy.js → TimesheetList-B8yCkaxb.js} +6 -6
  10. package/dist/{app-BPlaahxK.js → app-CB3ye-CT.js} +785 -688
  11. package/dist/app.js +1 -1
  12. package/dist/{dayjs.min-LweNOSZ_.js → dayjs.min-DOxEzdpe.js} +1 -1
  13. package/dist/{employee-DPfiL6rd.js → employee-G0pQg8_6.js} +3 -3
  14. package/dist/{index-CBxn7cxI.js → index-Beu6IuhT.js} +1803 -1735
  15. package/dist/{index-BAhsHYNv.js → index-DQArLkVB.js} +1 -1
  16. package/dist/{lodash-D1uG3PY3.js → lodash-COjtwv4w.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 +9 -0
  21. package/dist/src/helpers/rule.d.ts +4 -1
  22. package/dist/src/types/report-query.d.ts +1 -0
  23. package/dist/src/views/team/components/BasePermission.vue.d.ts +17 -0
  24. package/dist/{team-B1osnB4U.js → team-CEtKQK6n.js} +1 -1
  25. package/dist/{timesheet-rte2utJf.js → timesheet-DZF9D3QQ.js} +2 -2
  26. package/dist/tsconfig.app.tsbuildinfo +1 -1
  27. package/dist/{useAppStore-CqrjwnF_.js → useAppStore-9lbKMy_9.js} +1 -1
  28. package/dist/{useLoading-B5IjfVEP.js → useLoading-BIIvuJcM.js} +1 -1
  29. package/dist/useReportPermissions-BXQ0-WwK.js +59 -0
  30. package/package.json +1 -1
  31. package/dist/PermissionSetList-DCONmOgn.js +0 -323
  32. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-07Dsea27.js +0 -3092
  33. package/dist/TeamMemberList-DMrPgF1l.js +0 -973
  34. package/dist/useReportPermissions-C4Q29AQJ.js +0 -65
@@ -1,7 +1,7 @@
1
1
  import { defineStore as f, storeToRefs as v } from "pinia";
2
2
  import { ref as b } from "vue";
3
3
  import { useCoreStore as I, baseClientInstance as w } from "@feedmepos/mf-common";
4
- import { g as l, b as d, s as R } from "./index-CBxn7cxI.js";
4
+ import { g as l, b as d, s as R } from "./index-Beu6IuhT.js";
5
5
  const p = {
6
6
  async readRoles() {
7
7
  return l(await d().get("/pos-roles"));
@@ -1,6 +1,6 @@
1
1
  import { computed as I, isRef as L, watch as M } from "vue";
2
2
  import { SnackbarPosition as y } from "@feedmepos/ui-library";
3
- import { a as w, v } from "./useAppStore-CqrjwnF_.js";
3
+ import { a as w, v } from "./useAppStore-9lbKMy_9.js";
4
4
  const E = (r) => {
5
5
  async function d(u, e) {
6
6
  var l, a;
@@ -0,0 +1,59 @@
1
+ import { computed as u, ref as r } from "vue";
2
+ import { e as y, a as l, R } from "./index-Beu6IuhT.js";
3
+ import { useCoreStore as h } from "@feedmepos/mf-common";
4
+ import "./app-CB3ye-CT.js";
5
+ const n = r([]), c = r(!1), t = r(!1), d = r(null);
6
+ function K() {
7
+ const m = h();
8
+ async function f() {
9
+ var o;
10
+ const s = (o = m.currentBusiness.value) == null ? void 0 : o.id;
11
+ if (s && (d.value !== s && (n.value = [], c.value = !1, t.value = !1, d.value = s), !(c.value || t.value))) {
12
+ t.value = !0;
13
+ try {
14
+ n.value = await R.fetchReportPermissions(s), c.value = !0;
15
+ } catch (e) {
16
+ console.warn("Failed to fetch dynamic report permissions, using hardcoded only:", e), n.value = [];
17
+ } finally {
18
+ t.value = !1;
19
+ }
20
+ }
21
+ }
22
+ const i = y.filter(
23
+ (s) => s.subject === l.F_RULE_SUBJECT.enum.report && s.conditions
24
+ ), p = u(() => {
25
+ const s = new Set(
26
+ i.map((e) => {
27
+ const a = typeof e.conditions == "string" ? JSON.parse(e.conditions) : e.conditions;
28
+ return a == null ? void 0 : a.name;
29
+ })
30
+ ), o = n.value.filter((e) => !s.has(e.permissionKey)).map((e) => ({
31
+ label: e.name,
32
+ subject: l.F_RULE_SUBJECT.enum.report,
33
+ actions: ["read"],
34
+ conditions: { name: e.permissionKey },
35
+ inverted: !1,
36
+ reason: ""
37
+ }));
38
+ return [...i, ...o];
39
+ }), v = u(() => {
40
+ const s = new Set(
41
+ i.map((o) => {
42
+ const e = typeof o.conditions == "string" ? JSON.parse(o.conditions) : o.conditions;
43
+ return e == null ? void 0 : e.name;
44
+ })
45
+ );
46
+ for (const o of n.value)
47
+ s.add(o.permissionKey);
48
+ return s;
49
+ });
50
+ return {
51
+ fetchReportPermissions: f,
52
+ allReportPermissions: p,
53
+ availableReportKeys: v,
54
+ isLoading: u(() => t.value)
55
+ };
56
+ }
57
+ export {
58
+ K as u
59
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-hrm-portal",
3
- "version": "2.0.6-dev",
3
+ "version": "2.0.7-dev",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,323 +0,0 @@
1
- import { defineComponent as W, computed as g, resolveComponent as c, createElementBlock as B, openBlock as F, createElementVNode as P, createVNode as i, toDisplayString as N, unref as r, withCtx as y, createTextVNode as H, Fragment as O, renderList as J, ref as _, createBlock as M, nextTick as Q, onMounted as X, h as U } from "vue";
2
- import { useI18n as j, useCoreStore as Y } from "@feedmepos/mf-common";
3
- import { useSnackbar as q, useDialog as Z, useBreakpoints as ee, components as se, FmButtonColorThemeVariant as te, FmButtonVariant as oe } from "@feedmepos/ui-library";
4
- import { _ as ne } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
5
- import { z as le, u as K, m as G, n as ie, o as R, w as ae, x as re, A as me } from "./index-CBxn7cxI.js";
6
- import { u as ue } from "./useLoading-B5IjfVEP.js";
7
- import { a as ce } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-07Dsea27.js";
8
- const de = { class: "flex flex-row items-center gap-8" }, pe = /* @__PURE__ */ W({
9
- __name: "PermissionWithTooltip",
10
- props: {
11
- modelValue: {
12
- type: Array,
13
- required: !0
14
- }
15
- },
16
- setup(T) {
17
- const w = T, e = g(() => le(w.modelValue)), { t: l } = j();
18
- return (m, $) => {
19
- const f = c("FmIcon"), V = c("FmTooltip");
20
- return F(), B("div", de, [
21
- P("span", null, N(r(l)("team.labels.allowed", { count: e.value.length })), 1),
22
- i(V, {
23
- variant: "plain",
24
- placement: "top"
25
- }, {
26
- content: y(() => [
27
- P("div", null, [
28
- H(N(r(l)("team.labels.permission")) + " ", 1),
29
- (F(!0), B(O, null, J(e.value, (v, a) => (F(), B("div", {
30
- key: `${v}-${a}`
31
- }, " - " + N(v), 1))), 128))
32
- ])
33
- ]),
34
- default: y(() => [
35
- i(f, {
36
- name: "info",
37
- class: "cursor-pointer text-fm-color-neutral-gray-300"
38
- })
39
- ]),
40
- _: 1
41
- })
42
- ]);
43
- };
44
- }
45
- }), fe = { class: "fm-typo-en-title-md-600" }, ve = { class: "flex items-center justify-start gap-8" }, Se = /* @__PURE__ */ W({
46
- __name: "PermissionSetForm",
47
- props: {
48
- modelValue: {
49
- type: Object,
50
- default: () => ({})
51
- }
52
- },
53
- setup(T, { expose: w }) {
54
- const e = T, { t: l } = j(), m = _(!1), $ = g(() => {
55
- var t;
56
- return (t = e.modelValue) != null && t.id ? l("permissionSet.form.update.title") : l("permissionSet.form.create.title");
57
- }), f = _(), V = q(), v = ue(V), a = K(), d = _({ ...e.modelValue }), u = _([]), h = _([]), A = [(t) => !!t || "Permission set name is required"], D = g(() => {
58
- var t;
59
- return (t = e.modelValue) != null && t.id ? l("permissionSet.form.update.confirmButtonLabel") : l("permissionSet.form.create.confirmButtonLabel");
60
- }), z = g(
61
- () => a.permissionSets.value.filter((t) => {
62
- var s;
63
- return t.id !== ((s = e.modelValue) == null ? void 0 : s.id);
64
- }).map((t) => ({ label: t.name, value: t.id }))
65
- ), x = g(
66
- () => G(u.value, a.permissionSets.value)
67
- );
68
- async function n() {
69
- var s, b;
70
- await Q(), m.value = !m.value, d.value = { ...e.modelValue }, u.value = ((s = e.modelValue) == null ? void 0 : s.permissionSetIds) ?? [];
71
- const t = ((b = e.modelValue) == null ? void 0 : b.permissions) ?? [];
72
- h.value = ie(
73
- R(x.value),
74
- t
75
- );
76
- }
77
- function o() {
78
- const t = R(x.value), s = ae(h.value);
79
- return re(t, s);
80
- }
81
- function p() {
82
- h.value = R(x.value);
83
- }
84
- async function k() {
85
- var b, E;
86
- const t = await ((b = f.value) == null ? void 0 : b.validateInputsWithoutSubmit()), s = (E = Y().currentBusiness.value) == null ? void 0 : E.id;
87
- !(t != null && t.length) && s && v.minor(async () => {
88
- var C;
89
- const L = o();
90
- if ((C = e.modelValue) != null && C.id) {
91
- const I = {
92
- name: d.value.name,
93
- permissions: L,
94
- permissionSetIds: u.value,
95
- businessId: d.value.businessId
96
- };
97
- await a.updatePermissionSet(e.modelValue.id, I);
98
- } else {
99
- const I = {
100
- name: d.value.name,
101
- businessId: s,
102
- permissions: L,
103
- permissionSetIds: u.value
104
- };
105
- await a.createPermissionSet(I);
106
- }
107
- m.value = !1;
108
- });
109
- }
110
- return w({
111
- trigger: n
112
- }), (t, s) => {
113
- const b = c("FmTextField"), E = c("FmSelect"), L = c("FmForm"), C = c("FmButton"), I = c("FmSideSheet");
114
- return F(), M(I, {
115
- modelValue: m.value,
116
- "onUpdate:modelValue": s[4] || (s[4] = (S) => m.value = S),
117
- "max-width": 560,
118
- "dismiss-away": ""
119
- }, {
120
- "side-sheet-header": y(() => [
121
- P("p", fe, N($.value), 1)
122
- ]),
123
- "side-sheet-footer": y(() => [
124
- P("div", ve, [
125
- i(C, {
126
- label: D.value,
127
- size: "md",
128
- variant: "primary",
129
- type: "submit",
130
- onClick: k
131
- }, null, 8, ["label"]),
132
- i(C, {
133
- label: r(l)("common.cancel"),
134
- size: "md",
135
- variant: "secondary",
136
- onClick: s[3] || (s[3] = (S) => m.value = !1)
137
- }, null, 8, ["label"])
138
- ])
139
- ]),
140
- default: y(() => [
141
- i(L, {
142
- ref_key: "formRef",
143
- ref: f
144
- }, {
145
- default: y(() => [
146
- i(b, {
147
- modelValue: d.value.name,
148
- "onUpdate:modelValue": s[0] || (s[0] = (S) => d.value.name = S),
149
- label: r(l)("permissionSet.form.name"),
150
- placeholder: r(l)("permissionSet.form.namePlaceholder"),
151
- rules: A
152
- }, null, 8, ["modelValue", "label", "placeholder"]),
153
- i(E, {
154
- modelValue: u.value,
155
- "onUpdate:modelValue": [
156
- s[1] || (s[1] = (S) => u.value = S),
157
- p
158
- ],
159
- multiselect: "",
160
- searchable: "",
161
- "search-debounce": 300,
162
- items: z.value,
163
- label: r(l)("permissionSet.form.includedSets"),
164
- placeholder: r(l)("permissionSet.form.includedSetsPlaceholder"),
165
- class: "mt-16"
166
- }, null, 8, ["modelValue", "items", "label", "placeholder"]),
167
- i(ce, {
168
- modelValue: h.value,
169
- "onUpdate:modelValue": s[2] || (s[2] = (S) => h.value = S),
170
- "inherit-permissions": x.value,
171
- class: "mt-24"
172
- }, null, 8, ["modelValue", "inherit-permissions"])
173
- ]),
174
- _: 1
175
- }, 512)
176
- ]),
177
- _: 1
178
- }, 8, ["modelValue"]);
179
- };
180
- }
181
- }), _e = { class: "space-y-8" }, he = { class: "flex justify-end xs:px-16" }, be = {
182
- key: 0,
183
- class: "overflow-auto"
184
- }, ge = { class: "pb-64" }, Ce = /* @__PURE__ */ W({
185
- __name: "PermissionSetList",
186
- setup(T, { expose: w }) {
187
- const { t: e } = j(), l = q(), m = Z(), { breakpoints: $ } = ee(), f = _(""), V = g(() => {
188
- var n;
189
- return (n = d.value) == null ? void 0 : n.filter((o) => {
190
- const p = f.value.toLowerCase();
191
- return o.name.toLowerCase().includes(p);
192
- });
193
- }), v = _(), a = K(), d = g(
194
- () => a.permissionSets.value
195
- ), u = _();
196
- async function h() {
197
- await a.readPermissionSets();
198
- }
199
- function A(n) {
200
- var o;
201
- u.value = n, (o = v.value) == null || o.trigger();
202
- }
203
- const D = [
204
- {
205
- accessorKey: "name",
206
- header: () => e("permissionSet.table.columns.name")
207
- },
208
- {
209
- accessorKey: "permission",
210
- header: () => e("permissionSet.table.columns.permissions"),
211
- enableSorting: !1,
212
- cell(n) {
213
- const o = n.row.original, p = G(
214
- [o.id],
215
- a.permissionSets.value
216
- ), k = R(p);
217
- return U(pe, { modelValue: k });
218
- }
219
- },
220
- {
221
- id: "action",
222
- meta: {
223
- cellClass: "pl-16",
224
- headerContentClass: "-mx-16"
225
- },
226
- cell(n) {
227
- return U("div", { class: "w-full flex justify-end items-center" }, [
228
- U(se.FmButton, {
229
- prependIcon: "delete",
230
- variant: oe.Tertiary,
231
- textColor: te.NeutralGray400,
232
- class: "flex flex-end",
233
- onClick: (o) => {
234
- o.stopPropagation(), x(n.row.original);
235
- }
236
- })
237
- ]);
238
- },
239
- enableSorting: !1
240
- }
241
- ];
242
- function z() {
243
- var n;
244
- u.value = void 0, (n = v.value) == null || n.trigger();
245
- }
246
- async function x(n) {
247
- m.open({
248
- title: e("permissionSet.form.delete.title"),
249
- message: e("permissionSet.form.delete.confirmationMessage", { permissionSetName: n.name }),
250
- minWidth: $.value.lg ? 588 : 0,
251
- primaryActions: {
252
- text: e("common.remove"),
253
- close: !1,
254
- variant: "destructive"
255
- },
256
- secondaryActions: { text: e("common.cancel"), close: !0 }
257
- }).onPrimary(async () => {
258
- try {
259
- await a.deletePermissionSet(n.id), l.open({
260
- message: e("permissionSet.form.delete.successMessage", { permissionSetName: n.name }),
261
- type: "success"
262
- });
263
- } catch (o) {
264
- const p = o instanceof me && o.status === 409 ? o.message.includes("referenced by") ? e("permissionSet.form.delete.setReferencedConflictError", {
265
- permissionSetName: n.name
266
- }) : e("permissionSet.form.delete.conflictError", { permissionSetName: n.name }) : o instanceof Error ? o.message : `${o}`;
267
- l.open({ message: p, type: "error" });
268
- }
269
- m.close();
270
- });
271
- }
272
- return X(() => {
273
- h();
274
- }), w({
275
- create: z
276
- }), (n, o) => {
277
- const p = c("FmSearch"), k = c("FmTable"), t = c("FullWrapper");
278
- return F(), B(O, null, [
279
- i(Se, {
280
- ref_key: "permissionSetFormRef",
281
- ref: v,
282
- "model-value": u.value
283
- }, null, 8, ["model-value"]),
284
- P("div", _e, [
285
- P("div", he, [
286
- i(p, {
287
- modelValue: f.value,
288
- "onUpdate:modelValue": o[0] || (o[0] = (s) => f.value = s),
289
- class: "w-[320px] xs:w-full",
290
- autofocus: "",
291
- placeholder: r(e)("permissionSet.search.placeholder")
292
- }, null, 8, ["modelValue", "placeholder"])
293
- ]),
294
- d.value.length > 0 ? (F(), B("div", be, [
295
- P("div", ge, [
296
- i(t, null, {
297
- default: y(() => [
298
- i(k, {
299
- "column-defs": D,
300
- "row-data": V.value,
301
- "page-size": V.value.length,
302
- "pin-header-row": "",
303
- "hide-footer": "",
304
- "shrink-at": !1,
305
- onRowClick: o[1] || (o[1] = (s) => A(s.original))
306
- }, null, 8, ["row-data", "page-size"])
307
- ]),
308
- _: 1
309
- })
310
- ])
311
- ])) : (F(), M(r(ne), {
312
- key: 1,
313
- title: r(e)("permissionSet.noData.title"),
314
- subtitle: r(e)("permissionSet.noData.subtitle")
315
- }, null, 8, ["title", "subtitle"]))
316
- ])
317
- ], 64);
318
- };
319
- }
320
- });
321
- export {
322
- Ce as default
323
- };