@feedmepos/mf-hrm-portal 1.1.3-dev.4 → 1.1.3-dev.7

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 (37) hide show
  1. package/dist/{AuditLogList-BeigpKv1.js → AuditLogList-n6xAYZGv.js} +127 -139
  2. package/dist/EmployeeList-D9rLxXo5.js +626 -0
  3. package/dist/{Main-iC9TGp41.js → Main-BCa8A1rV.js} +5 -5
  4. package/dist/{Main-DWnVJGpe.js → Main-zQF3GD9j.js} +10 -9
  5. package/dist/PermissionSetList-EsoA_anf.js +338 -0
  6. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DqWrIJPe.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BA1LS-wd.js} +454 -447
  7. package/dist/RoleList-Cfv9wKaN.js +494 -0
  8. package/dist/TeamMemberList-HkvCqzPj.js +945 -0
  9. package/dist/{TimesheetList-C4_i17S7.js → TimesheetList-B0e-Muws.js} +25 -24
  10. package/dist/api/index.d.ts +1 -0
  11. package/dist/api/report-query/index.d.ts +5 -0
  12. package/dist/{app-BRpUSeEf.js → app-DKSPx49S.js} +1449 -867
  13. package/dist/app.js +1 -1
  14. package/dist/composables/useReportPermissions.d.ts +14 -0
  15. package/dist/{dayjs.min-Dfq8fN9X.js → dayjs.min-DZJQ_JpV.js} +1 -1
  16. package/dist/employee-DKRqMph9.js +144 -0
  17. package/dist/helpers/permission-set.d.ts +22 -0
  18. package/dist/helpers/rule.d.ts +1 -1
  19. package/dist/{index-CvpJyEnB.js → index-BwyUbhZj.js} +1 -1
  20. package/dist/{index-nVxD4_on.js → index-D09s817L.js} +5017 -3187
  21. package/dist/{lodash-Cbt71kLf.js → lodash-CL6AaeJB.js} +1 -1
  22. package/dist/stores/permission-set.d.ts +15 -0
  23. package/dist/{team-CZZo-waE.js → team-DEjtUFVl.js} +1 -1
  24. package/dist/{timesheet-DuYLbiJ_.js → timesheet-B0usAfjL.js} +2 -2
  25. package/dist/tsconfig.app.tsbuildinfo +1 -1
  26. package/dist/types/permission-set.d.ts +4 -0
  27. package/dist/types/report-query.d.ts +6 -0
  28. package/dist/{useAppStore-Dt1nUJ4t.js → useAppStore-DfaKfSuR.js} +34 -46
  29. package/dist/{useLoading-CjyXOp7A.js → useLoading-D2AX24ph.js} +1 -1
  30. package/dist/useReportPermissions-CwsHq61C.js +65 -0
  31. package/dist/views/team/locales/index.d.ts +12 -0
  32. package/package.json +2 -2
  33. package/dist/EmployeeList-pCs8sKuU.js +0 -607
  34. package/dist/PermissionSetList-BLmeu-lo.js +0 -283
  35. package/dist/RoleList-DyOF2uRf.js +0 -496
  36. package/dist/TeamMemberList-Ck2gpjCC.js +0 -952
  37. package/dist/employee-BZxYvY4n.js +0 -172
package/dist/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as e, i as r, r as o } from "./app-BRpUSeEf.js";
1
+ import { b as e, i as r, r as o } from "./app-DKSPx49S.js";
2
2
  export {
3
3
  e as FmApp,
4
4
  r as i18nMessages,
@@ -0,0 +1,14 @@
1
+ export declare function useReportPermissions(): {
2
+ fetchReportPermissions: () => Promise<void>;
3
+ allReportPermissions: import("vue").ComputedRef<{
4
+ reason?: string | null | undefined;
5
+ conditions?: any;
6
+ fields?: string[] | null | undefined;
7
+ inverted?: boolean | null | undefined;
8
+ label: string;
9
+ subject: string;
10
+ actions: ("update" | "create" | "read" | "delete" | "manage")[];
11
+ }[]>;
12
+ availableReportKeys: import("vue").ComputedRef<Set<string>>;
13
+ isLoading: import("vue").ComputedRef<boolean>;
14
+ };
@@ -1,4 +1,4 @@
1
- import { g as Q, a as K } from "./app-BRpUSeEf.js";
1
+ import { g as Q, c as K } from "./app-DKSPx49S.js";
2
2
  var E = { exports: {} };
3
3
  (function(V, X) {
4
4
  (function(W, k) {
@@ -0,0 +1,144 @@
1
+ import { d as T } from "./dayjs.min-DZJQ_JpV.js";
2
+ import { defineStore as _, storeToRefs as U } from "pinia";
3
+ import { ref as I } from "vue";
4
+ import { useCoreStore as $ } from "@feedmepos/mf-common";
5
+ import { b as r, g as o, t as b, k as S, s as v } from "./index-D09s817L.js";
6
+ import { u as x } from "./useAppStore-DfaKfSuR.js";
7
+ const n = {
8
+ async readEmployees() {
9
+ return o(await r().get("/pos-users"));
10
+ },
11
+ async createEmployee(e) {
12
+ return o(await r().post("/pos-users", e));
13
+ },
14
+ async createMasterEmployee(e) {
15
+ return o(await r().post("/pos-users/master-user", e));
16
+ },
17
+ async migrateToMasterEmployee(e, t) {
18
+ return o(await r().put(`/pos-users/migrate/${e}`, t));
19
+ },
20
+ async updateEmployee(e, t) {
21
+ return o(await r().put(`/pos-users/${e}`, t));
22
+ },
23
+ async updateMasterEmployee(e, t) {
24
+ return o(await r().put(`/pos-users/master-user/${e}`, t));
25
+ },
26
+ async deleteEmployee(e) {
27
+ return o(
28
+ await r().put(`/pos-users/${e._id}`, {
29
+ user: e,
30
+ roles: []
31
+ })
32
+ );
33
+ },
34
+ async deleteMasterEmployee(e) {
35
+ return o(
36
+ await r().put(`/pos-users/master-user/${e._id}`, {
37
+ user: e,
38
+ roles: []
39
+ })
40
+ );
41
+ },
42
+ async generateEmployeePasscode() {
43
+ return `${o(await r().get("/pos-users/generate-passcode"))}`;
44
+ },
45
+ async syncUsersMeta() {
46
+ await r().post("/pos-users/create-users-meta");
47
+ }
48
+ };
49
+ async function i(e) {
50
+ const t = x().roles.value, { restaurants: d } = $(), M = e.reduce((u, l) => {
51
+ var w;
52
+ const { _id: E, restaurantId: m } = l, p = u.findIndex((s) => s._id === E), g = ((w = d.value.find((s) => s._id === m)) == null ? void 0 : w.profile.name) || "", c = t.find((s) => s._id === l.role), f = {
53
+ restaurantId: m,
54
+ restaurantName: g,
55
+ roleId: (c == null ? void 0 : c._id) || "",
56
+ roleName: (c == null ? void 0 : c.name) || ""
57
+ };
58
+ return p < 0 ? u.push({
59
+ ...l,
60
+ since: T(S(E)).format("DD/MM/YYYY"),
61
+ restaurants: [f]
62
+ }) : u[p].restaurants.some((s) => s.restaurantId === m) || (u[p].restaurants = v([...u[p].restaurants, f], {
63
+ selector: "restaurantName"
64
+ })), u;
65
+ }, []);
66
+ return v(M, { selector: "name" });
67
+ }
68
+ const D = _("employee", () => {
69
+ const e = I([]), t = I(!1), d = I([]);
70
+ async function M() {
71
+ try {
72
+ t.value = !0;
73
+ const s = await n.readEmployees();
74
+ e.value = await i(s);
75
+ } catch (s) {
76
+ console.log("Error reading employees:", s);
77
+ } finally {
78
+ t.value = !1;
79
+ }
80
+ }
81
+ async function u(s) {
82
+ const a = await n.createEmployee(s);
83
+ e.value = await i(a);
84
+ }
85
+ async function l(s, a) {
86
+ const y = await n.updateEmployee(s, a);
87
+ e.value = await i(y);
88
+ }
89
+ async function E(s) {
90
+ const a = await n.deleteEmployee(s);
91
+ e.value = await i(a);
92
+ }
93
+ async function m(s) {
94
+ const a = await n.deleteMasterEmployee(s);
95
+ e.value = await i(a);
96
+ }
97
+ async function p(s) {
98
+ const a = await n.createMasterEmployee(s);
99
+ e.value = await i(a);
100
+ }
101
+ async function g(s, a) {
102
+ const y = await n.updateMasterEmployee(s, a);
103
+ e.value = await i(y);
104
+ }
105
+ async function c(s, a) {
106
+ const y = await n.migrateToMasterEmployee(s, a);
107
+ e.value = await i(y);
108
+ }
109
+ async function f() {
110
+ try {
111
+ d.value = await b.readTeamMemberPosUserIds();
112
+ } catch (s) {
113
+ console.log("Error reading team member pos user ids:", s);
114
+ }
115
+ }
116
+ async function w() {
117
+ await n.syncUsersMeta();
118
+ }
119
+ return {
120
+ employees: e,
121
+ restrictEmployeeIds: d,
122
+ isLoading: t,
123
+ readEmployees: M,
124
+ createEmployee: u,
125
+ updateEmployee: l,
126
+ deleteEmployee: E,
127
+ createMasterEmployee: p,
128
+ updateMasterEmployee: g,
129
+ deleteMasterEmployee: m,
130
+ migrateToMasterUser: c,
131
+ readTeamMemberPosUserIds: f,
132
+ syncUsersMeta: w
133
+ };
134
+ }), R = () => {
135
+ const e = D();
136
+ return {
137
+ ...e,
138
+ ...U(e)
139
+ };
140
+ };
141
+ export {
142
+ n as E,
143
+ R as u
144
+ };
@@ -1,5 +1,21 @@
1
1
  import type { InheritedPermission, IFdtoPermissionSet } from '@/types/permission-set';
2
2
  import type { FdoPermissionRule } from '@feedmepos/core/entity';
3
+ /**
4
+ * Recursively collect all permission sets following permissionSetIds links.
5
+ * Returns a flat, deduplicated list in depth-first order (parent before children).
6
+ * Cycle-safe via the visited set.
7
+ */
8
+ export declare function collectAllPermissionSets(setIds: string[], allSets: IFdtoPermissionSet[], visited?: Set<string>): IFdtoPermissionSet[];
9
+ /**
10
+ * Compute the effective permissions from a list of permission sets.
11
+ *
12
+ * Unlike a raw `mergePermissionSet().map(...)`, this correctly handles sets that store
13
+ * override diffs (inverted rules): it first merges all grants and denials from the sets,
14
+ * then applies the denials on top of the grants via `getEffectivePermissions`, producing a
15
+ * clean list of effective grants only. This ensures that subjects removed by a child set's
16
+ * inversion are not incorrectly shown as granted.
17
+ */
18
+ export declare function mergeToEffectivePermissions(sets: IFdtoPermissionSet[]): FdoPermissionRule[];
3
19
  /**
4
20
  * Transform permission sets by grouping role names by collection IDs for a specific field
5
21
  * @param permissionSets - Array of permission sets with their permissions
@@ -24,6 +40,12 @@ export declare function transformByCollection(permissionSets: IFdtoPermissionSet
24
40
  */
25
41
  export declare function getOverridePermissions(basePermissions: FdoPermissionRule[], overridePermissions: FdoPermissionRule[]): FdoPermissionRule[];
26
42
  export declare function materializeSystemPermissionSetOverrides(overridePermissions: FdoPermissionRule[]): FdoPermissionRule[];
43
+ /**
44
+ * Strip positive rules whose subject would be re-injected by system permission set expansion.
45
+ * These need not be persisted to DB — expansion re-adds them at runtime.
46
+ * Inverted rules (explicit user denials) are always preserved.
47
+ */
48
+ export declare function stripSystemExpandedPositives(permissions: FdoPermissionRule[]): FdoPermissionRule[];
27
49
  /**
28
50
  * Combine base permissions with override permissions to get effective permissions
29
51
  * @param basePermissions - Base permissions from permission sets
@@ -1,7 +1,7 @@
1
1
  import type { RawRule } from '@casl/ability';
2
2
  import { F_RULE_SUBJECT, type FdoPermissionRule } from '@feedmepos/core/entity';
3
3
  import type { Rule } from '../types/role';
4
- export declare function filterPermissions(permissions: FdoPermissionRule[], subject: F_RULE_SUBJECT): string;
4
+ export declare function filterPermissions(permissions: FdoPermissionRule[], subject: F_RULE_SUBJECT, availablePermissions?: FdoPermissionRule[]): string;
5
5
  export declare function ruleExtension(rule: FdoPermissionRule): {
6
6
  conditions: any;
7
7
  isDiscountOperation: boolean;
@@ -2,7 +2,7 @@ var oe = Object.defineProperty;
2
2
  var se = (_, h, y) => h in _ ? oe(_, h, { enumerable: !0, configurable: !0, writable: !0, value: y }) : _[h] = y;
3
3
  var ot = (_, h, y) => se(_, typeof h != "symbol" ? h + "" : h, y);
4
4
  import { readonly as Nt, ref as Rt } from "vue";
5
- import { a as st } from "./app-BRpUSeEf.js";
5
+ import { c as st } from "./app-DKSPx49S.js";
6
6
  var Pt = { exports: {} };
7
7
  (function(_, h) {
8
8
  (function(y, p) {