@feedmepos/mf-hrm-portal 1.1.6-dev → 2.0.0
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.
- package/dist/AuditLogList-Cm3ueTso.js +474 -0
- package/dist/EmployeeList-vMcIqBU_.js +626 -0
- package/dist/{main-C370wsCl.js → Main-CeGYov-a.js} +1502 -1531
- package/dist/Main-gHCENd4i.js +86 -0
- package/dist/{PageLayout.vue_vue_type_script_setup_true_lang-DuwNwJDM.js → PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js} +2 -2
- package/dist/PermissionSetList-Dw69OYF4.js +323 -0
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-bvPOPUhu.js +3092 -0
- package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +38 -0
- package/dist/RoleList-D1CrixYc.js +497 -0
- package/dist/{useSearch-C25VELOk.js → SelectFilter-NbXrJ4iH.js} +90 -101
- package/dist/TeamMemberList-M0Q8CP4h.js +973 -0
- package/dist/{TimesheetList-qaolOL4w.js → TimesheetList-BmOfy0pc.js} +31 -29
- package/dist/api/audit-log/index.d.ts +14 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/permission-assignment/index.d.ts +10 -0
- package/dist/api/permission-set/index.d.ts +8 -0
- package/dist/api/report-query/index.d.ts +5 -0
- package/dist/api/team/index.d.ts +2 -1
- package/dist/app-RUdgf-7_.js +3286 -0
- package/dist/app.js +1 -1
- package/dist/components/AppForm.vue.d.ts +3 -2
- package/dist/components/CheckboxInput.vue.d.ts +10 -4
- package/dist/components/CollapsibleWrapper.vue.d.ts +3 -2
- package/dist/components/form/SelectFilter.vue.d.ts +3 -2
- package/dist/components/layout/FormColumn.vue.d.ts +6 -3
- package/dist/components/layout/FormItem.vue.d.ts +2 -1
- package/dist/components/layout/FormSection.vue.d.ts +2 -1
- package/dist/components/layout/FullWrapper.vue.d.ts +6 -3
- package/dist/components/layout/PageLayout.vue.d.ts +2 -1
- package/dist/components/menu/BottomSheetMenu.vue.d.ts +2 -1
- package/dist/components/menu/BottomSheetMenuItem.vue.d.ts +6 -3
- package/dist/components/table/EmptyDataTemplate/index.vue.d.ts +6 -3
- package/dist/composables/useAppStore.d.ts +6 -6
- package/dist/composables/useDateRange.d.ts +1 -1
- package/dist/composables/useReportPermissions.d.ts +14 -0
- package/dist/composables/useRestaurantMap.d.ts +4 -8
- package/dist/composables/useSheet.d.ts +1 -1
- package/dist/dayjs.min-D9w2-Exz.js +282 -0
- package/dist/employee-B3jBmvNJ.js +144 -0
- package/dist/helpers/permission-set.d.ts +69 -0
- package/dist/helpers/portal-user.d.ts +8 -0
- package/dist/helpers/rule.d.ts +5 -4
- package/dist/index-BMVQbdBd.js +827 -0
- package/dist/index-BS6B6k7h.js +10340 -0
- package/dist/{empty-placeholder-ey8LJtN1.js → index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js} +43 -2
- package/dist/{lodash-B5BTJU4_.js → lodash-CglPbFKR.js} +326 -343
- package/dist/router/shared.d.ts +4 -1
- package/dist/stores/employee.d.ts +4 -4
- package/dist/stores/permission-assignment.d.ts +277 -0
- package/dist/stores/permission-set.d.ts +265 -0
- package/dist/stores/role.d.ts +4 -4
- package/dist/stores/team.d.ts +300 -0
- package/dist/stores/timesheet.d.ts +19 -19
- package/dist/style.css +1 -1
- package/dist/team-afjBSzOz.js +33 -0
- package/dist/{timesheet-Cy-jSzje.js → timesheet-fOBJOS1i.js} +14 -14
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/types/audit-log.d.ts +1 -0
- package/dist/types/permission-assignment.d.ts +20 -0
- package/dist/types/permission-set.d.ts +24 -0
- package/dist/types/report-query.d.ts +6 -0
- package/dist/types/team.d.ts +13 -3
- package/dist/useAppStore-D-SLROq6.js +168 -0
- package/dist/useLoading-CLQGJW7G.js +99 -0
- package/dist/useReportPermissions-Cx4ghxj6.js +65 -0
- package/dist/{useRestaurantMap-CpS9-OSq.js → useRestaurantMap-D5BNPLKh.js} +7 -7
- package/dist/useSearch-B6WK1LBB.js +15 -0
- package/dist/views/audit-log/locales/index.d.ts +295 -0
- package/dist/views/hr/employee/{components/EmployeeForm.vue.d.ts → EmployeeForm.vue.d.ts} +10 -7
- package/dist/views/team/Main.vue.d.ts +2 -0
- package/dist/views/team/components/BasePermission.vue.d.ts +64 -0
- package/dist/views/team/components/{TeamMemberConditionPermission.vue.d.ts → ConditionPermission.vue.d.ts} +14 -1
- package/dist/views/team/components/InheritPermissionTooltip.vue.d.ts +14 -0
- package/dist/views/team/components/PermissionWithTooltip.vue.d.ts +14 -0
- package/dist/views/team/components/PortalPermissionEditor.vue.d.ts +68 -28
- package/dist/views/team/components/{TeamMemberRolePermission.vue.d.ts → PosRolePermission.vue.d.ts} +14 -1
- package/dist/views/team/locales/index.d.ts +200 -4
- package/dist/views/team/{components → member}/AddMemberForm.vue.d.ts +1 -0
- package/dist/views/team/member/TeamMemberList.vue.d.ts +4 -0
- package/dist/views/team/member/TeamMemberMasterUser.vue.d.ts +55 -0
- package/dist/views/team/permission-set/PermissionSetForm.vue.d.ts +19 -0
- package/dist/views/team/permission-set/PermissionSetList.vue.d.ts +5 -0
- package/package.json +15 -8
- package/dist/EmployeeList-CP42mLpi.js +0 -605
- package/dist/RoleList-CsctaXlu.js +0 -492
- package/dist/TeamMemberList-DtXoUa5K.js +0 -1508
- package/dist/app-G_Dbs0OJ.js +0 -1202
- package/dist/employee-BTWpYxn5.js +0 -449
- package/dist/index-8ift6lz3.js +0 -57
- package/dist/rule-CM7JgjNr.js +0 -142112
- package/dist/types/permission.d.ts +0 -4
- package/dist/useAppStore-zINIo0LR.js +0 -93
- package/dist/useLoading-CWBRIBiy.js +0 -141
- package/dist/views/team/components/TeamMemberBasePermission.vue.d.ts +0 -36
- package/dist/views/team/components/TeamMemberMasterUser.vue.d.ts +0 -718
- /package/dist/views/{hr/main.vue.d.ts → audit-log/AuditLogList.vue.d.ts} +0 -0
- /package/dist/views/{team/TeamMemberList.vue.d.ts → hr/Main.vue.d.ts} +0 -0
- /package/dist/views/team/{components → member}/MemberInfo.vue.d.ts +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { d as T } from "./dayjs.min-D9w2-Exz.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-BS6B6k7h.js";
|
|
6
|
+
import { u as x } from "./useAppStore-D-SLROq6.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
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { InheritedPermission, IFdtoPermissionSet } from '@/types/permission-set';
|
|
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[];
|
|
19
|
+
/**
|
|
20
|
+
* Transform permission sets by grouping role names by collection IDs for a specific field
|
|
21
|
+
* @param permissionSets - Array of permission sets with their permissions
|
|
22
|
+
* @param field - The field name to extract collection IDs from (e.g., 'restaurantId', 'warehouseId')
|
|
23
|
+
* @param resource - The collection of resource (e.g., list of restaurants, warehouses)
|
|
24
|
+
* @returns Array of objects containing collection ID and associated role names
|
|
25
|
+
*/
|
|
26
|
+
export declare function transformByCollection(permissionSets: IFdtoPermissionSet[], field: string, resourceIds: string[]): InheritedPermission[];
|
|
27
|
+
/**
|
|
28
|
+
* Combine base permissions (permissions set) with user permissions
|
|
29
|
+
* @param basePermissions - Base permissions
|
|
30
|
+
* @param overridePermissions - User permissions
|
|
31
|
+
* @returns Combined permissions
|
|
32
|
+
* Return combined result with below criteria:
|
|
33
|
+
* - If base has it and user doesn't, return base permission with { inverted: true }
|
|
34
|
+
* - If user has it and base doesn't, return user permission
|
|
35
|
+
* - If base and user has it, nothing return
|
|
36
|
+
* For permission with conditions (collection: warehouses, roles, restaurants)
|
|
37
|
+
* - If base conditions different from user conditions, return rule with { inverted: true } and conditions on collection ids to be denied
|
|
38
|
+
* - If base has conditions and user doesn't, return base with { inverted: true } without conditions, essentially denied all access
|
|
39
|
+
* - If user has conditions and base doesn't, return user's rule (user added)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getOverridePermissions(basePermissions: FdoPermissionRule[], overridePermissions: FdoPermissionRule[]): FdoPermissionRule[];
|
|
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[];
|
|
49
|
+
/**
|
|
50
|
+
* Combine base permissions with override permissions to get effective permissions
|
|
51
|
+
* @param basePermissions - Base permissions from permission sets
|
|
52
|
+
* @param overridePermissions - Override permissions from permission user
|
|
53
|
+
* @returns - Combined effective permissions
|
|
54
|
+
*/
|
|
55
|
+
export declare function getEffectivePermissions(basePermissions: FdoPermissionRule[], overridePermissions: FdoPermissionRule[]): FdoPermissionRule[];
|
|
56
|
+
/**
|
|
57
|
+
* Compute the initial permissions for the permission editor.
|
|
58
|
+
*
|
|
59
|
+
* Like `getEffectivePermissions`, but also preserves "orphaned" inverted rules — denials whose
|
|
60
|
+
* subject is NOT present in any base permission set (i.e. they target system-expanded subjects,
|
|
61
|
+
* not permission-set-inherited subjects). These denials seed `visitedSetIds` in
|
|
62
|
+
* `expandWithSystemPermissionSets` to block runtime re-expansion of system sets that the user
|
|
63
|
+
* explicitly unchecked. Without them the editor would initialise without the denial guard and
|
|
64
|
+
* those subjects would reappear as checked the next time the form opens.
|
|
65
|
+
*
|
|
66
|
+
* Inverted rules whose subject IS in base are handled correctly by `getEffectivePermissions`
|
|
67
|
+
* already (they cancel the inherited grant) and do not need special treatment here.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getEditorPermissions(basePermissions: FdoPermissionRule[], customPermissions: FdoPermissionRule[]): FdoPermissionRule[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FTeamMember, IFdtoPortalUser } from '@/types/team';
|
|
2
|
+
/**
|
|
3
|
+
* Combine portal user data with permission assignment and return as team member data
|
|
4
|
+
* @param doc
|
|
5
|
+
* @param options
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function portalUserToTeamMember(doc: IFdtoPortalUser): FTeamMember;
|
package/dist/helpers/rule.d.ts
CHANGED
|
@@ -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;
|
|
@@ -14,15 +14,16 @@ export declare function ruleExtension(rule: FdoPermissionRule): {
|
|
|
14
14
|
fields?: string[] | null | undefined;
|
|
15
15
|
inverted?: boolean | null | undefined;
|
|
16
16
|
subject: string;
|
|
17
|
-
actions: ("
|
|
17
|
+
actions: ("update" | "create" | "read" | "delete" | "manage")[];
|
|
18
18
|
};
|
|
19
19
|
export declare function getMaxDiscount(rules: FdoPermissionRule[]): number;
|
|
20
|
-
export declare function getManagableRestaurantIds(rules: RawRule[]): string[] | null;
|
|
20
|
+
export declare function getManagableRestaurantIds(rules: (FdoPermissionRule | RawRule)[]): string[] | null;
|
|
21
21
|
export declare function hasAdminRule(rules: FdoPermissionRule[]): boolean;
|
|
22
|
-
export declare function usableRoleIds(rules: RawRule[]): string[] | null;
|
|
22
|
+
export declare function usableRoleIds(rules: (FdoPermissionRule | RawRule)[]): string[] | null;
|
|
23
23
|
export declare function fromValue(values: string[], maxDiscountPercentage: number): {
|
|
24
24
|
subject: string;
|
|
25
25
|
actions: ("delete" | "update" | "create" | "read" | "manage")[];
|
|
26
26
|
conditions: object;
|
|
27
27
|
}[];
|
|
28
28
|
export declare function toRule(v: string): Rule;
|
|
29
|
+
export declare function mapAndSortPermissions(permissions: Array<FdoPermissionRule | RawRule>): string[];
|