@acorex/modules 21.0.0-next.43 → 21.0.0-next.44
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/fesm2022/acorex-modules-ai-management.mjs +31 -225
- package/fesm2022/acorex-modules-ai-management.mjs.map +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-acorex-modules-human-capital-management-Bwk3-2wy.mjs → acorex-modules-human-capital-management-acorex-modules-human-capital-management-hImDhzkB.mjs} +16 -19
- package/fesm2022/acorex-modules-human-capital-management-acorex-modules-human-capital-management-hImDhzkB.mjs.map +1 -0
- package/fesm2022/{acorex-modules-human-capital-management-approve-leave-request.command-B5aSubCY.mjs → acorex-modules-human-capital-management-approve-leave-request.command-DujyJOvo.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-approve-leave-request.command-B5aSubCY.mjs.map → acorex-modules-human-capital-management-approve-leave-request.command-DujyJOvo.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-assign-position-assignment.command-l8dGe3kg.mjs → acorex-modules-human-capital-management-assign-position-assignment.command-BPB9vaCn.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-assign-position-assignment.command-l8dGe3kg.mjs.map → acorex-modules-human-capital-management-assign-position-assignment.command-BPB9vaCn.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-cancel-leave-request.command-CeV-5Y5n.mjs → acorex-modules-human-capital-management-cancel-leave-request.command-BdPUdhbU.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-cancel-leave-request.command-CeV-5Y5n.mjs.map → acorex-modules-human-capital-management-cancel-leave-request.command-BdPUdhbU.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-employee.entity-DNgt9yQm.mjs → acorex-modules-human-capital-management-employee.entity-CgmF-WPf.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-employee.entity-DNgt9yQm.mjs.map → acorex-modules-human-capital-management-employee.entity-CgmF-WPf.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-employment-type.entity-rq8-Bauc.mjs → acorex-modules-human-capital-management-employment-type.entity-Chio_E9S.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-employment-type.entity-rq8-Bauc.mjs.map → acorex-modules-human-capital-management-employment-type.entity-Chio_E9S.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-leave-request.entity-DlQJw4F6.mjs → acorex-modules-human-capital-management-leave-request.entity--9iGu0H7.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-leave-request.entity-DlQJw4F6.mjs.map → acorex-modules-human-capital-management-leave-request.entity--9iGu0H7.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-leave-type.entity-D5J2oOuY.mjs → acorex-modules-human-capital-management-leave-type.entity-O0j4P2oU.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-leave-type.entity-D5J2oOuY.mjs.map → acorex-modules-human-capital-management-leave-type.entity-O0j4P2oU.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-position-assignment.entity-D7mKhxYp.mjs → acorex-modules-human-capital-management-position-assignment.entity-Bg6omEy_.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-position-assignment.entity-D7mKhxYp.mjs.map → acorex-modules-human-capital-management-position-assignment.entity-Bg6omEy_.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-reject-leave-request.command-C4AWFOmG.mjs → acorex-modules-human-capital-management-reject-leave-request.command-ZNGufyB1.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-reject-leave-request.command-C4AWFOmG.mjs.map → acorex-modules-human-capital-management-reject-leave-request.command-ZNGufyB1.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-revoke-position-assignment.command-BSJhBW3p.mjs → acorex-modules-human-capital-management-revoke-position-assignment.command-C8pwJExa.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-revoke-position-assignment.command-BSJhBW3p.mjs.map → acorex-modules-human-capital-management-revoke-position-assignment.command-C8pwJExa.mjs.map} +1 -1
- package/fesm2022/acorex-modules-human-capital-management.mjs +1 -1
- package/fesm2022/{acorex-modules-organization-management-acorex-modules-organization-management-Dqhk5reQ.mjs → acorex-modules-organization-management-acorex-modules-organization-management-CGzZcKEy.mjs} +141 -578
- package/fesm2022/acorex-modules-organization-management-acorex-modules-organization-management-CGzZcKEy.mjs.map +1 -0
- package/fesm2022/{acorex-modules-organization-management-add-business-unit-to-business-unit.command-pnxqURIQ.mjs → acorex-modules-organization-management-add-business-unit-to-business-unit.command-BEJyfR3P.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-add-business-unit-to-business-unit.command-pnxqURIQ.mjs.map → acorex-modules-organization-management-add-business-unit-to-business-unit.command-BEJyfR3P.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-add-position-to-business-unit.command-DbHKd1Nd.mjs → acorex-modules-organization-management-add-position-to-business-unit.command-DKgxg9q5.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-add-position-to-business-unit.command-DbHKd1Nd.mjs.map → acorex-modules-organization-management-add-position-to-business-unit.command-DKgxg9q5.mjs.map} +1 -1
- package/fesm2022/acorex-modules-organization-management-add-team-to-business-unit.command-DJJT7BXT.mjs +130 -0
- package/fesm2022/acorex-modules-organization-management-add-team-to-business-unit.command-DJJT7BXT.mjs.map +1 -0
- package/fesm2022/{acorex-modules-organization-management-business-unit.entity-FsF290Im.mjs → acorex-modules-organization-management-business-unit.entity-BAp38sib.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-business-unit.entity-FsF290Im.mjs.map → acorex-modules-organization-management-business-unit.entity-BAp38sib.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-chart.entity-_OJkO2zX.mjs → acorex-modules-organization-management-chart.entity-WfmpWj8R.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-chart.entity-_OJkO2zX.mjs.map → acorex-modules-organization-management-chart.entity-WfmpWj8R.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-company.entity-Dw7_BvxV.mjs → acorex-modules-organization-management-company.entity-BUVLrwjq.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-company.entity-Dw7_BvxV.mjs.map → acorex-modules-organization-management-company.entity-BUVLrwjq.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-entity.provider-BWw2RN_V.mjs → acorex-modules-organization-management-entity.provider-DH3eUGTu.mjs} +15 -15
- package/fesm2022/{acorex-modules-organization-management-entity.provider-BWw2RN_V.mjs.map → acorex-modules-organization-management-entity.provider-DH3eUGTu.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-feature-definition.provider-D3WYwpy0.mjs → acorex-modules-organization-management-feature-definition.provider-DuScrBze.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-feature-definition.provider-D3WYwpy0.mjs.map → acorex-modules-organization-management-feature-definition.provider-DuScrBze.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-job-definition-pages-component.provider-CnS_nu1v.mjs → acorex-modules-organization-management-job-definition-pages-component.provider-D-J9JCsU.mjs} +3 -3
- package/fesm2022/{acorex-modules-organization-management-job-definition-pages-component.provider-CnS_nu1v.mjs.map → acorex-modules-organization-management-job-definition-pages-component.provider-D-J9JCsU.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-job-definition-responsibilities-page.component-ZTopEh2M.mjs → acorex-modules-organization-management-job-definition-responsibilities-page.component-Dsy5rFGw.mjs} +3 -3
- package/fesm2022/{acorex-modules-organization-management-job-definition-responsibilities-page.component-ZTopEh2M.mjs.map → acorex-modules-organization-management-job-definition-responsibilities-page.component-Dsy5rFGw.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-job-definition-skills-page.component-Yyzwqg0v.mjs → acorex-modules-organization-management-job-definition-skills-page.component-B73wLPby.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-job-definition-skills-page.component-Yyzwqg0v.mjs.map → acorex-modules-organization-management-job-definition-skills-page.component-B73wLPby.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-job-definition.entity-DJjmv1hf.mjs → acorex-modules-organization-management-job-definition.entity-B7mWKYqb.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-job-definition.entity-DJjmv1hf.mjs.map → acorex-modules-organization-management-job-definition.entity-B7mWKYqb.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-job-level.datasource-DJH3zaNN.mjs → acorex-modules-organization-management-job-level.datasource-DibRoKXR.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-job-level.datasource-DJH3zaNN.mjs.map → acorex-modules-organization-management-job-level.datasource-DibRoKXR.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-job-level.entity-DBEFEBzu.mjs → acorex-modules-organization-management-job-level.entity-C_MzeTw5.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-job-level.entity-DBEFEBzu.mjs.map → acorex-modules-organization-management-job-level.entity-C_MzeTw5.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-menu.provider-yGn338K1.mjs → acorex-modules-organization-management-menu.provider-CQeJINzl.mjs} +3 -2
- package/fesm2022/{acorex-modules-organization-management-menu.provider-yGn338K1.mjs.map → acorex-modules-organization-management-menu.provider-CQeJINzl.mjs.map} +1 -1
- package/fesm2022/acorex-modules-organization-management-org-chart-default-node-contribution.provider-D3hCHSr_.mjs +228 -0
- package/fesm2022/acorex-modules-organization-management-org-chart-default-node-contribution.provider-D3hCHSr_.mjs.map +1 -0
- package/fesm2022/acorex-modules-organization-management-org-chart-employee-flyout-contribution.provider-Bv0I-45L.mjs +182 -0
- package/fesm2022/acorex-modules-organization-management-org-chart-employee-flyout-contribution.provider-Bv0I-45L.mjs.map +1 -0
- package/fesm2022/acorex-modules-organization-management-org-chart-position-employee-node-contribution.provider-DbfYza8q.mjs +170 -0
- package/fesm2022/acorex-modules-organization-management-org-chart-position-employee-node-contribution.provider-DbfYza8q.mjs.map +1 -0
- package/fesm2022/acorex-modules-organization-management-org-chart-ux-node-contribution.provider-C9APxguL.mjs +334 -0
- package/fesm2022/acorex-modules-organization-management-org-chart-ux-node-contribution.provider-C9APxguL.mjs.map +1 -0
- package/fesm2022/{acorex-modules-organization-management-org-chart.page-C1J123cl.mjs → acorex-modules-organization-management-org-chart.page-BcHO5kKP.mjs} +104 -19
- package/fesm2022/acorex-modules-organization-management-org-chart.page-BcHO5kKP.mjs.map +1 -0
- package/fesm2022/{acorex-modules-organization-management-permission-definition.provider-B1f668X4.mjs → acorex-modules-organization-management-permission-definition.provider-BcIRJpBt.mjs} +3 -2
- package/fesm2022/{acorex-modules-organization-management-permission-definition.provider-B1f668X4.mjs.map → acorex-modules-organization-management-permission-definition.provider-BcIRJpBt.mjs.map} +1 -1
- package/fesm2022/acorex-modules-organization-management-permission.keys-DwZNBc12.mjs +56 -0
- package/fesm2022/acorex-modules-organization-management-permission.keys-DwZNBc12.mjs.map +1 -0
- package/fesm2022/{acorex-modules-organization-management-position.entity-BvSjM5Hs.mjs → acorex-modules-organization-management-position.entity-DBOpLtSI.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-position.entity-BvSjM5Hs.mjs.map → acorex-modules-organization-management-position.entity-DBOpLtSI.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-remove-position-from-business-unit.command-CPdbVSno.mjs → acorex-modules-organization-management-remove-position-from-business-unit.command-TqYgfnsy.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-remove-position-from-business-unit.command-CPdbVSno.mjs.map → acorex-modules-organization-management-remove-position-from-business-unit.command-TqYgfnsy.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-replace-position-assignee.command-CQRcVN6R.mjs → acorex-modules-organization-management-replace-position-assignee.command-BJ2gn0-A.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-replace-position-assignee.command-CQRcVN6R.mjs.map → acorex-modules-organization-management-replace-position-assignee.command-BJ2gn0-A.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-responsibilities-matrix-widget-edit.component-Ce3T04Qb.mjs → acorex-modules-organization-management-responsibilities-matrix-widget-edit.component-CZdMLIL-.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-responsibilities-matrix-widget-edit.component-Ce3T04Qb.mjs.map → acorex-modules-organization-management-responsibilities-matrix-widget-edit.component-CZdMLIL-.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-responsibilities-matrix-widget-view.component-CIr7JDX-.mjs → acorex-modules-organization-management-responsibilities-matrix-widget-view.component-BBo97rDN.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-responsibilities-matrix-widget-view.component-CIr7JDX-.mjs.map → acorex-modules-organization-management-responsibilities-matrix-widget-view.component-BBo97rDN.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-responsibilities-matrix.component-BXWso7Ga.mjs → acorex-modules-organization-management-responsibilities-matrix.component-D9oH_Fbb.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-responsibilities-matrix.component-BXWso7Ga.mjs.map → acorex-modules-organization-management-responsibilities-matrix.component-D9oH_Fbb.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-responsibility-level.entity-DB04XTJ8.mjs → acorex-modules-organization-management-responsibility-level.entity-D6IG9Zc7.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-responsibility-level.entity-DB04XTJ8.mjs.map → acorex-modules-organization-management-responsibility-level.entity-D6IG9Zc7.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-responsibility.entity-BMqhYqJS.mjs → acorex-modules-organization-management-responsibility.entity-BosNxYjW.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-responsibility.entity-BMqhYqJS.mjs.map → acorex-modules-organization-management-responsibility.entity-BosNxYjW.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-settings.provider-BhIJkbq_.mjs → acorex-modules-organization-management-settings.provider-CL9C9UXA.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-settings.provider-BhIJkbq_.mjs.map → acorex-modules-organization-management-settings.provider-CL9C9UXA.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-team-business-unit.entity-DkTtZv7y.mjs → acorex-modules-organization-management-team-business-unit.entity-CYFGTcHe.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-team-business-unit.entity-DkTtZv7y.mjs.map → acorex-modules-organization-management-team-business-unit.entity-CYFGTcHe.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-team-member-role.entity-DPqEPpkP.mjs → acorex-modules-organization-management-team-member-role.entity-B5vNDne0.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-team-member-role.entity-DPqEPpkP.mjs.map → acorex-modules-organization-management-team-member-role.entity-B5vNDne0.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-organization-management-team-member.entity-IN-CPv5W.mjs → acorex-modules-organization-management-team-member.entity-DsKuxCRB.mjs} +14 -2
- package/fesm2022/acorex-modules-organization-management-team-member.entity-DsKuxCRB.mjs.map +1 -0
- package/fesm2022/{acorex-modules-organization-management-team.entity-D7B8ulFX.mjs → acorex-modules-organization-management-team.entity-Cg30cho_.mjs} +2 -2
- package/fesm2022/{acorex-modules-organization-management-team.entity-D7B8ulFX.mjs.map → acorex-modules-organization-management-team.entity-Cg30cho_.mjs.map} +1 -1
- package/fesm2022/acorex-modules-organization-management.mjs +1 -1
- package/fesm2022/{acorex-modules-task-management-acorex-modules-task-management-CWlgXg_u.mjs → acorex-modules-task-management-acorex-modules-task-management-DDUq9FpA.mjs} +178 -14
- package/fesm2022/acorex-modules-task-management-acorex-modules-task-management-DDUq9FpA.mjs.map +1 -0
- package/fesm2022/{acorex-modules-task-management-task-board.page-Bxpga0DN.mjs → acorex-modules-task-management-task-board.page-C6j-_aSD.mjs} +106 -68
- package/fesm2022/acorex-modules-task-management-task-board.page-C6j-_aSD.mjs.map +1 -0
- package/fesm2022/acorex-modules-task-management.mjs +1 -1
- package/organization-management/README.md +1 -1
- package/package.json +2 -2
- package/types/acorex-modules-ai-management.d.ts +25 -67
- package/types/acorex-modules-organization-management.d.ts +128 -69
- package/types/acorex-modules-task-management.d.ts +12 -1
- package/fesm2022/acorex-modules-human-capital-management-acorex-modules-human-capital-management-Bwk3-2wy.mjs.map +0 -1
- package/fesm2022/acorex-modules-organization-management-acorex-modules-organization-management-Dqhk5reQ.mjs.map +0 -1
- package/fesm2022/acorex-modules-organization-management-org-chart.page-C1J123cl.mjs.map +0 -1
- package/fesm2022/acorex-modules-organization-management-team-member.entity-IN-CPv5W.mjs.map +0 -1
- package/fesm2022/acorex-modules-task-management-acorex-modules-task-management-CWlgXg_u.mjs.map +0 -1
- package/fesm2022/acorex-modules-task-management-task-board.page-Bxpga0DN.mjs.map +0 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { AXTranslationService, createMultiLanguageString, resolveMultiLanguageString } from '@acorex/core/translation';
|
|
2
|
+
import { AXPSessionService } from '@acorex/platform/auth';
|
|
3
|
+
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
4
|
+
import { AXPCommandService } from '@acorex/platform/runtime';
|
|
5
|
+
import { AXPWorkflowService } from '@acorex/platform/workflow';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { inject, LOCALE_ID, Injectable } from '@angular/core';
|
|
8
|
+
import { h as AXMOrganizationManagementCommandKeys, R as RootConfig } from './acorex-modules-organization-management-acorex-modules-organization-management-CGzZcKEy.mjs';
|
|
9
|
+
import { A as AXPOrganizationManagementPermissionKeys } from './acorex-modules-organization-management-permission.keys-DwZNBc12.mjs';
|
|
10
|
+
|
|
11
|
+
//#region ---- Imports ----
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ---- Module Constants ----
|
|
14
|
+
const orgChartNodeActionKey = (suffix) => `@organization-management:organization-chart.node-actions.${suffix}`;
|
|
15
|
+
//#endregion
|
|
16
|
+
class AXMOrgChartDefaultNodeContributionProvider {
|
|
17
|
+
constructor() {
|
|
18
|
+
//#region ---- Services & Dependencies ----
|
|
19
|
+
this.commandService = inject(AXPCommandService);
|
|
20
|
+
this.workflowService = inject(AXPWorkflowService);
|
|
21
|
+
this.sessionService = inject(AXPSessionService);
|
|
22
|
+
this.entityService = inject(AXPEntityService);
|
|
23
|
+
this.localeId = inject(LOCALE_ID);
|
|
24
|
+
this.translationService = inject(AXTranslationService);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ---- Menu Actions ----
|
|
28
|
+
async getMenuActions(context) {
|
|
29
|
+
if (context.nodeKind !== 'company-root' && context.nodeKind !== 'business-unit') {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
const businessUnitId = this.resolveBusinessUnitId(context);
|
|
33
|
+
const parentId = context.nodeKind === 'business-unit' ? businessUnitId : undefined;
|
|
34
|
+
const typeAllowsDirectPositions = context.nodeKind === 'business-unit' && businessUnitId
|
|
35
|
+
? await this.resolveTypeAllowsDirectPositions(context, businessUnitId)
|
|
36
|
+
: false;
|
|
37
|
+
/** When true, a separator goes after the last “Add BU by type” row before the Add position row. */
|
|
38
|
+
const hasPositionRowAfterBuTypes = context.nodeKind === 'business-unit' && Boolean(businessUnitId) && typeAllowsDirectPositions;
|
|
39
|
+
const canCreateBusinessUnit = this.authorize(AXPOrganizationManagementPermissionKeys.BusinessUnit.Create);
|
|
40
|
+
const canUpdateBusinessUnit = this.authorize(AXPOrganizationManagementPermissionKeys.BusinessUnit.Update);
|
|
41
|
+
const canDeleteBusinessUnit = this.authorize(AXPOrganizationManagementPermissionKeys.BusinessUnit.Delete);
|
|
42
|
+
const canViewPosition = this.authorize(AXPOrganizationManagementPermissionKeys.Position.View);
|
|
43
|
+
const canCreateTeam = this.authorize(AXPOrganizationManagementPermissionKeys.Team.Create);
|
|
44
|
+
const buTypeRows = await this.loadBusinessUnitTypes();
|
|
45
|
+
const addNewBuKey = orgChartNodeActionKey('add-new-bu-with-type');
|
|
46
|
+
const addBuActions = await Promise.all(buTypeRows.map(async (row, index) => ({
|
|
47
|
+
id: `organization-management.add-bu-type.${row.id}`,
|
|
48
|
+
title: await this.menuTitleDualLocale(addNewBuKey, { type: row.title }),
|
|
49
|
+
nestedInAddFlyout: true,
|
|
50
|
+
icon: 'fa-light fa-sitemap',
|
|
51
|
+
order: 10 + index,
|
|
52
|
+
disabled: !canCreateBusinessUnit,
|
|
53
|
+
break: hasPositionRowAfterBuTypes && index === buTypeRows.length - 1 && buTypeRows.length > 0 ? 'after' : undefined,
|
|
54
|
+
execute: async () => {
|
|
55
|
+
await this.commandService.execute(AXMOrganizationManagementCommandKeys.OrganizationChart.AddBusinessUnitToBusinessUnit, { parentBusinessUnitId: parentId, typeId: row.id });
|
|
56
|
+
await context.refreshChart();
|
|
57
|
+
},
|
|
58
|
+
})));
|
|
59
|
+
const addPositionToBuAction = context.nodeKind === 'business-unit' && businessUnitId && typeAllowsDirectPositions
|
|
60
|
+
? {
|
|
61
|
+
id: 'organization-management.add-position-to-business-unit',
|
|
62
|
+
title: orgChartNodeActionKey('add-new-position'),
|
|
63
|
+
nestedInAddFlyout: true,
|
|
64
|
+
icon: 'fa-light fa-briefcase',
|
|
65
|
+
order: 10 + buTypeRows.length,
|
|
66
|
+
disabled: !canUpdateBusinessUnit || !canViewPosition,
|
|
67
|
+
execute: async () => {
|
|
68
|
+
const result = await this.commandService.execute(AXMOrganizationManagementCommandKeys.OrganizationChart.AddPositionToBusinessUnit, { businessUnitId });
|
|
69
|
+
if (result?.success) {
|
|
70
|
+
await context.refreshChart();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
: null;
|
|
75
|
+
const addNewTeamToBuAction = context.nodeKind === 'business-unit' && businessUnitId
|
|
76
|
+
? {
|
|
77
|
+
id: 'organization-management.org-chart.add-new-team',
|
|
78
|
+
title: orgChartNodeActionKey('add-new-team'),
|
|
79
|
+
nestedInAddFlyout: true,
|
|
80
|
+
icon: 'fa-light fa-people-group',
|
|
81
|
+
order: 10 + buTypeRows.length + (addPositionToBuAction ? 1 : 0),
|
|
82
|
+
disabled: !canCreateTeam,
|
|
83
|
+
execute: async () => {
|
|
84
|
+
const result = await this.commandService.execute(AXMOrganizationManagementCommandKeys.OrganizationChart.AddTeamToBusinessUnit, { businessUnitId });
|
|
85
|
+
if (result?.success) {
|
|
86
|
+
await context.refreshChart();
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
: null;
|
|
91
|
+
const removeBuActions = context.nodeKind === 'business-unit'
|
|
92
|
+
? [
|
|
93
|
+
{
|
|
94
|
+
id: 'organization-management.remove-bu',
|
|
95
|
+
title: orgChartNodeActionKey('remove'),
|
|
96
|
+
icon: 'fa-light fa-trash',
|
|
97
|
+
color: 'danger',
|
|
98
|
+
order: 120,
|
|
99
|
+
break: 'before',
|
|
100
|
+
disabled: !canDeleteBusinessUnit || !businessUnitId,
|
|
101
|
+
execute: async () => {
|
|
102
|
+
await this.workflowService.execute('delete-entity', {
|
|
103
|
+
entity: RootConfig.entities.businessUnit.source,
|
|
104
|
+
data: { id: businessUnitId },
|
|
105
|
+
options: { process: { showResult: true } },
|
|
106
|
+
});
|
|
107
|
+
await context.refreshChart();
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
]
|
|
111
|
+
: [];
|
|
112
|
+
return [
|
|
113
|
+
...addBuActions,
|
|
114
|
+
...(addPositionToBuAction ? [addPositionToBuAction] : []),
|
|
115
|
+
...(addNewTeamToBuAction ? [addNewTeamToBuAction] : []),
|
|
116
|
+
...removeBuActions,
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region ---- Authorization ----
|
|
121
|
+
authorize(permission) {
|
|
122
|
+
return this.sessionService.authorize(permission);
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region ---- Menu Labels ----
|
|
126
|
+
/**
|
|
127
|
+
* Resolves copy for menu rows: nested `translate` bindings do not pass interpolation params into the pipe;
|
|
128
|
+
* use per-locale strings via {@link createMultiLanguageString}.
|
|
129
|
+
*
|
|
130
|
+
* TODO: Remove this dual-locale pre-resolution once we can pass interpolation params through
|
|
131
|
+
* {@link AXPMultiLanguageString} and/or the menu `translate` pipe (see `@acorex/components/menu` item template).
|
|
132
|
+
*/
|
|
133
|
+
async menuTitleDualLocale(key, params) {
|
|
134
|
+
const [enUs, faIr] = await Promise.all([
|
|
135
|
+
this.translationService.translateAsync(key, { lang: 'en-US', params }),
|
|
136
|
+
this.translationService.translateAsync(key, { lang: 'fa-IR', params }),
|
|
137
|
+
]);
|
|
138
|
+
return createMultiLanguageString(enUs, faIr);
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region ---- Business Unit Types ----
|
|
142
|
+
/**
|
|
143
|
+
* Resolves whether the BU's type allows direct positions (metadata from chart, nested type, or type lookup).
|
|
144
|
+
*/
|
|
145
|
+
async resolveTypeAllowsDirectPositions(context, businessUnitId) {
|
|
146
|
+
const fromMeta = context.node.metadata?.['typeAllowsDirectPositions'];
|
|
147
|
+
if (typeof fromMeta === 'boolean') {
|
|
148
|
+
return fromMeta;
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
const bu = await this.entityService
|
|
152
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.businessUnit.name)
|
|
153
|
+
.data()
|
|
154
|
+
.byKey(businessUnitId);
|
|
155
|
+
const row = bu;
|
|
156
|
+
const nested = row?.type?.allowsDirectPositions;
|
|
157
|
+
if (typeof nested === 'boolean') {
|
|
158
|
+
return nested;
|
|
159
|
+
}
|
|
160
|
+
const typeId = row?.typeId?.trim();
|
|
161
|
+
if (typeId) {
|
|
162
|
+
const ty = await this.entityService
|
|
163
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)
|
|
164
|
+
.data()
|
|
165
|
+
.byKey(typeId);
|
|
166
|
+
return ty?.allowsDirectPositions !== false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
// fall through
|
|
171
|
+
}
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
async loadBusinessUnitTypes() {
|
|
175
|
+
try {
|
|
176
|
+
const result = await this.entityService
|
|
177
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)
|
|
178
|
+
.data()
|
|
179
|
+
.query({
|
|
180
|
+
skip: 0,
|
|
181
|
+
take: 500,
|
|
182
|
+
sort: [{ field: 'title', dir: 'asc' }],
|
|
183
|
+
});
|
|
184
|
+
const items = (result.items ?? []);
|
|
185
|
+
return items
|
|
186
|
+
.map((row) => {
|
|
187
|
+
const id = String(row.id ?? '');
|
|
188
|
+
const title = this.resolveBusinessUnitTypeLabel(row);
|
|
189
|
+
return { id, title: title || (row.name ?? '').trim() || id };
|
|
190
|
+
})
|
|
191
|
+
.filter((row) => row.id.length > 0);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* API rows use {@link AXPMultiLanguageString} for `title`; treating it as a string breaks `.trim()` and drops all types.
|
|
199
|
+
*/
|
|
200
|
+
resolveBusinessUnitTypeLabel(row) {
|
|
201
|
+
const raw = row.title;
|
|
202
|
+
if (raw == null) {
|
|
203
|
+
return '';
|
|
204
|
+
}
|
|
205
|
+
if (typeof raw === 'string') {
|
|
206
|
+
return raw.trim();
|
|
207
|
+
}
|
|
208
|
+
return resolveMultiLanguageString(raw, this.localeId).trim();
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region ---- Node Metadata ----
|
|
212
|
+
resolveBusinessUnitId(context) {
|
|
213
|
+
if (context.nodeKind === 'business-unit') {
|
|
214
|
+
return (context.node.entity?.id ??
|
|
215
|
+
context.node.metadata?.['businessUnitId'] ??
|
|
216
|
+
context.node.metadata?.['unitId']);
|
|
217
|
+
}
|
|
218
|
+
return context.node.metadata?.['businessUnitId'];
|
|
219
|
+
}
|
|
220
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartDefaultNodeContributionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
221
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartDefaultNodeContributionProvider }); }
|
|
222
|
+
}
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartDefaultNodeContributionProvider, decorators: [{
|
|
224
|
+
type: Injectable
|
|
225
|
+
}] });
|
|
226
|
+
|
|
227
|
+
export { AXMOrgChartDefaultNodeContributionProvider };
|
|
228
|
+
//# sourceMappingURL=acorex-modules-organization-management-org-chart-default-node-contribution.provider-D3hCHSr_.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-modules-organization-management-org-chart-default-node-contribution.provider-D3hCHSr_.mjs","sources":["../../../../libs/modules/organization-management/src/lib/features/organization-chart/contributions/org-chart-default-node-contribution.provider.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXTranslationService, createMultiLanguageString, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex/platform/auth';\nimport type { AXPMultiLanguageString } from '@acorex/platform/core';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommandService } from '@acorex/platform/runtime';\nimport { AXPWorkflowService } from '@acorex/platform/workflow';\nimport { inject, Injectable, LOCALE_ID } from '@angular/core';\nimport { AXMOrganizationManagementCommandKeys } from '../../../commands.keys';\nimport { RootConfig } from '../../../const';\nimport { AXPOrganizationManagementPermissionKeys } from '../../../permission.keys';\nimport {\n AXMOrgChartNodeContributionContext,\n AXMOrgChartNodeContributionProvider,\n AXMOrgChartNodeMenuAction,\n} from '../tokens/org-chart-node-contribution.token';\n\n//#endregion\n\n//#region ---- Module Constants ----\n\nconst orgChartNodeActionKey = (suffix: string): string =>\n `@organization-management:organization-chart.node-actions.${suffix}`;\n\n//#endregion\n\n@Injectable()\nexport class AXMOrgChartDefaultNodeContributionProvider implements AXMOrgChartNodeContributionProvider {\n //#region ---- Services & Dependencies ----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly workflowService = inject(AXPWorkflowService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly entityService = inject(AXPEntityService);\n private readonly localeId = inject(LOCALE_ID);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Menu Actions ----\n\n async getMenuActions(context: AXMOrgChartNodeContributionContext): Promise<AXMOrgChartNodeMenuAction[]> {\n if (context.nodeKind !== 'company-root' && context.nodeKind !== 'business-unit') {\n return [];\n }\n\n const businessUnitId = this.resolveBusinessUnitId(context);\n const parentId = context.nodeKind === 'business-unit' ? businessUnitId : undefined;\n\n const typeAllowsDirectPositions =\n context.nodeKind === 'business-unit' && businessUnitId\n ? await this.resolveTypeAllowsDirectPositions(context, businessUnitId)\n : false;\n\n /** When true, a separator goes after the last “Add BU by type” row before the Add position row. */\n const hasPositionRowAfterBuTypes =\n context.nodeKind === 'business-unit' && Boolean(businessUnitId) && typeAllowsDirectPositions;\n\n const canCreateBusinessUnit = this.authorize(AXPOrganizationManagementPermissionKeys.BusinessUnit.Create);\n const canUpdateBusinessUnit = this.authorize(AXPOrganizationManagementPermissionKeys.BusinessUnit.Update);\n const canDeleteBusinessUnit = this.authorize(AXPOrganizationManagementPermissionKeys.BusinessUnit.Delete);\n const canViewPosition = this.authorize(AXPOrganizationManagementPermissionKeys.Position.View);\n const canCreateTeam = this.authorize(AXPOrganizationManagementPermissionKeys.Team.Create);\n\n const buTypeRows = await this.loadBusinessUnitTypes();\n const addNewBuKey = orgChartNodeActionKey('add-new-bu-with-type');\n const addBuActions: AXMOrgChartNodeMenuAction[] = await Promise.all(\n buTypeRows.map(async (row, index) => ({\n id: `organization-management.add-bu-type.${row.id}`,\n title: await this.menuTitleDualLocale(addNewBuKey, { type: row.title }),\n nestedInAddFlyout: true,\n icon: 'fa-light fa-sitemap',\n order: 10 + index,\n disabled: !canCreateBusinessUnit,\n break: hasPositionRowAfterBuTypes && index === buTypeRows.length - 1 && buTypeRows.length > 0 ? 'after' : undefined,\n execute: async () => {\n await this.commandService.execute(\n AXMOrganizationManagementCommandKeys.OrganizationChart.AddBusinessUnitToBusinessUnit,\n { parentBusinessUnitId: parentId, typeId: row.id },\n );\n await context.refreshChart();\n },\n })),\n );\n\n const addPositionToBuAction: AXMOrgChartNodeMenuAction | null =\n context.nodeKind === 'business-unit' && businessUnitId && typeAllowsDirectPositions\n ? {\n id: 'organization-management.add-position-to-business-unit',\n title: orgChartNodeActionKey('add-new-position'),\n nestedInAddFlyout: true,\n icon: 'fa-light fa-briefcase',\n order: 10 + buTypeRows.length,\n disabled: !canUpdateBusinessUnit || !canViewPosition,\n execute: async () => {\n const result = await this.commandService.execute(\n AXMOrganizationManagementCommandKeys.OrganizationChart.AddPositionToBusinessUnit,\n { businessUnitId },\n );\n if (result?.success) {\n await context.refreshChart();\n }\n },\n }\n : null;\n\n const addNewTeamToBuAction: AXMOrgChartNodeMenuAction | null =\n context.nodeKind === 'business-unit' && businessUnitId\n ? {\n id: 'organization-management.org-chart.add-new-team',\n title: orgChartNodeActionKey('add-new-team'),\n nestedInAddFlyout: true,\n icon: 'fa-light fa-people-group',\n order: 10 + buTypeRows.length + (addPositionToBuAction ? 1 : 0),\n disabled: !canCreateTeam,\n execute: async () => {\n const result = await this.commandService.execute(\n AXMOrganizationManagementCommandKeys.OrganizationChart.AddTeamToBusinessUnit,\n { businessUnitId },\n );\n if (result?.success) {\n await context.refreshChart();\n }\n },\n }\n : null;\n\n const removeBuActions: AXMOrgChartNodeMenuAction[] =\n context.nodeKind === 'business-unit'\n ? [\n {\n id: 'organization-management.remove-bu',\n title: orgChartNodeActionKey('remove'),\n icon: 'fa-light fa-trash',\n color: 'danger',\n order: 120,\n break: 'before',\n disabled: !canDeleteBusinessUnit || !businessUnitId,\n execute: async () => {\n await this.workflowService.execute('delete-entity', {\n entity: RootConfig.entities.businessUnit.source,\n data: { id: businessUnitId },\n options: { process: { showResult: true } },\n });\n await context.refreshChart();\n },\n },\n ]\n : [];\n\n return [\n ...addBuActions,\n ...(addPositionToBuAction ? [addPositionToBuAction] : []),\n ...(addNewTeamToBuAction ? [addNewTeamToBuAction] : []),\n ...removeBuActions,\n ];\n }\n\n //#endregion\n\n //#region ---- Authorization ----\n\n private authorize(permission: string): boolean {\n return this.sessionService.authorize(permission);\n }\n\n //#endregion\n\n //#region ---- Menu Labels ----\n\n /**\n * Resolves copy for menu rows: nested `translate` bindings do not pass interpolation params into the pipe;\n * use per-locale strings via {@link createMultiLanguageString}.\n *\n * TODO: Remove this dual-locale pre-resolution once we can pass interpolation params through\n * {@link AXPMultiLanguageString} and/or the menu `translate` pipe (see `@acorex/components/menu` item template).\n */\n private async menuTitleDualLocale(\n key: string,\n params: Record<string, string | number>,\n ): Promise<ReturnType<typeof createMultiLanguageString>> {\n const [enUs, faIr] = await Promise.all([\n this.translationService.translateAsync(key, { lang: 'en-US', params }),\n this.translationService.translateAsync(key, { lang: 'fa-IR', params }),\n ]);\n return createMultiLanguageString(enUs, faIr);\n }\n\n //#endregion\n\n //#region ---- Business Unit Types ----\n\n /**\n * Resolves whether the BU's type allows direct positions (metadata from chart, nested type, or type lookup).\n */\n private async resolveTypeAllowsDirectPositions(\n context: AXMOrgChartNodeContributionContext,\n businessUnitId: string,\n ): Promise<boolean> {\n const fromMeta = context.node.metadata?.['typeAllowsDirectPositions'];\n if (typeof fromMeta === 'boolean') {\n return fromMeta;\n }\n try {\n const bu = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.businessUnit.name)\n .data()\n .byKey(businessUnitId);\n const row = bu as { type?: { allowsDirectPositions?: boolean }; typeId?: string } | null;\n const nested = row?.type?.allowsDirectPositions;\n if (typeof nested === 'boolean') {\n return nested;\n }\n const typeId = row?.typeId?.trim();\n if (typeId) {\n const ty = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)\n .data()\n .byKey(typeId);\n return (ty as { allowsDirectPositions?: boolean } | null)?.allowsDirectPositions !== false;\n }\n } catch {\n // fall through\n }\n return true;\n }\n\n private async loadBusinessUnitTypes(): Promise<Array<{ id: string; title: string }>> {\n try {\n const result = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)\n .data()\n .query({\n skip: 0,\n take: 500,\n sort: [{ field: 'title', dir: 'asc' }],\n });\n const items = (result.items ?? []) as Array<{ id: string; title?: unknown; name?: string }>;\n return items\n .map((row) => {\n const id = String(row.id ?? '');\n const title = this.resolveBusinessUnitTypeLabel(row);\n return { id, title: title || (row.name ?? '').trim() || id };\n })\n .filter((row) => row.id.length > 0);\n } catch {\n return [];\n }\n }\n\n /**\n * API rows use {@link AXPMultiLanguageString} for `title`; treating it as a string breaks `.trim()` and drops all types.\n */\n private resolveBusinessUnitTypeLabel(row: { title?: unknown; name?: string }): string {\n const raw = row.title;\n if (raw == null) {\n return '';\n }\n if (typeof raw === 'string') {\n return raw.trim();\n }\n return resolveMultiLanguageString(raw as AXPMultiLanguageString, this.localeId).trim();\n }\n\n //#endregion\n\n //#region ---- Node Metadata ----\n\n private resolveBusinessUnitId(context: AXMOrgChartNodeContributionContext): string | undefined {\n if (context.nodeKind === 'business-unit') {\n return (\n context.node.entity?.id ??\n (context.node.metadata?.['businessUnitId'] as string | undefined) ??\n (context.node.metadata?.['unitId'] as string | undefined)\n );\n }\n return context.node.metadata?.['businessUnitId'] as string | undefined;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AAkBA;AAEA;AAEA,MAAM,qBAAqB,GAAG,CAAC,MAAc,KAC3C,CAAA,yDAAA,EAA4D,MAAM,CAAA,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,QAAA,IAAI,GAAG,IAAI,IAAI,EAAE;AACf,YAAA,OAAO,EAAE;QACX;AACA,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAC3B,YAAA,OAAO,GAAG,CAAC,IAAI,EAAE;QACnB;QACA,OAAO,0BAA0B,CAAC,GAA6B,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE;IACxF;;;AAMQ,IAAA,qBAAqB,CAAC,OAA2C,EAAA;AACvE,QAAA,IAAI,OAAO,CAAC,QAAQ,KAAK,eAAe,EAAE;AACxC,YAAA,QACE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE;AACtB,gBAAA,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAwB;gBAChE,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAwB;QAE7D;QACA,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAuB;IACxE;8GA1PW,0CAA0C,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA1C,0CAA0C,EAAA,CAAA,CAAA;;2FAA1C,0CAA0C,EAAA,UAAA,EAAA,CAAA;kBADtD;;;;;"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { AXDialogService } from '@acorex/components/dialog';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { AXPSessionService } from '@acorex/platform/auth';
|
|
4
|
+
import { AXPEntityDefinitionRegistryService, AXPEntityDataSelectorService } from '@acorex/platform/layout/entity';
|
|
5
|
+
import { AXPCommandService } from '@acorex/platform/runtime';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { inject, Injectable } from '@angular/core';
|
|
8
|
+
import { R as RootConfig, j as axmResolveOrgChartFlyoutEmployeeId, k as AXM_ORG_CHART_EMPLOYEE_SUBMENU_ICON, l as AXM_ORG_CHART_EMPLOYEE_SUBMENU_TITLE_I18N_KEY, f as AXM_ORG_CHART_EMPLOYEE_SUBMENU_GROUP_ID } from './acorex-modules-organization-management-acorex-modules-organization-management-CGzZcKEy.mjs';
|
|
9
|
+
import { A as AXPOrganizationManagementPermissionKeys } from './acorex-modules-organization-management-permission.keys-DwZNBc12.mjs';
|
|
10
|
+
|
|
11
|
+
//#region ---- Imports ----
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ---- Constants ----
|
|
14
|
+
const actionKey = (suffix) => `@organization-management:organization-chart.node-actions.${suffix}`;
|
|
15
|
+
const HCM_EMPLOYEE_MODULE = 'HumanCapitalManagement';
|
|
16
|
+
const HCM_EMPLOYEE_NAME = 'Employee';
|
|
17
|
+
const HCM_EMPLOYEE_SOURCE = `${HCM_EMPLOYEE_MODULE}.${HCM_EMPLOYEE_NAME}`;
|
|
18
|
+
const employeeViewPermission = 'HumanCapitalManagement:Permission:Employee.View';
|
|
19
|
+
//#endregion
|
|
20
|
+
/**
|
|
21
|
+
* **Employee** context-submenu: open employee record (`Entity:OpenDetails`), HR placeholders, schedule, add-to-team — plus chat/email from extensions.
|
|
22
|
+
* Shown for {@link AXMOrgChartNodeKind} `employee` and for company / business unit / filled position when an
|
|
23
|
+
* assigned person id is available; hidden when head or top role is vacant.
|
|
24
|
+
*/
|
|
25
|
+
class AXMOrgChartEmployeeFlyoutContributionProvider {
|
|
26
|
+
constructor() {
|
|
27
|
+
//#region ---- Services & Dependencies ----
|
|
28
|
+
this.commandService = inject(AXPCommandService);
|
|
29
|
+
this.sessionService = inject(AXPSessionService);
|
|
30
|
+
this.dialogService = inject(AXDialogService);
|
|
31
|
+
this.translationService = inject(AXTranslationService);
|
|
32
|
+
this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
|
|
33
|
+
this.entityDataSelector = inject(AXPEntityDataSelectorService);
|
|
34
|
+
this.teamMemberEntityInfo = {
|
|
35
|
+
module: RootConfig.module.name,
|
|
36
|
+
name: RootConfig.entities.teamMember.name,
|
|
37
|
+
title: RootConfig.entities.teamMember.title,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ---- AXMOrgChartNodeContributionProvider ----
|
|
42
|
+
async getMenuActions(context) {
|
|
43
|
+
const employeeId = axmResolveOrgChartFlyoutEmployeeId(context);
|
|
44
|
+
if (!employeeId) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
return this.buildFlyoutActions(context, employeeId);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region ---- Flyout actions ----
|
|
51
|
+
buildFlyoutActions(context, employeeId) {
|
|
52
|
+
void context;
|
|
53
|
+
const canViewEmployee = this.authorize(employeeViewPermission);
|
|
54
|
+
const canTeam = this.authorize(AXPOrganizationManagementPermissionKeys.Team.Create);
|
|
55
|
+
return [
|
|
56
|
+
this.withEmployeeSubmenu({
|
|
57
|
+
id: 'organization-management.org-chart.open-employee-details',
|
|
58
|
+
title: actionKey('open'),
|
|
59
|
+
icon: 'fa-light fa-arrow-up-right-from-square',
|
|
60
|
+
order: 35,
|
|
61
|
+
disabled: !canViewEmployee,
|
|
62
|
+
execute: async () => {
|
|
63
|
+
await this.commandService.execute('Entity:OpenDetails', {
|
|
64
|
+
entity: HCM_EMPLOYEE_SOURCE,
|
|
65
|
+
data: { id: employeeId },
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
this.withEmployeeSubmenu({
|
|
70
|
+
id: 'organization-management.org-chart.hr-transfer',
|
|
71
|
+
title: actionKey('hr-workflow-transfer'),
|
|
72
|
+
icon: 'fa-light fa-right-left',
|
|
73
|
+
order: 60,
|
|
74
|
+
submenuSectionBreak: true,
|
|
75
|
+
execute: async () => {
|
|
76
|
+
await this.showPlaceholder(actionKey('placeholders.hr-workflow.title'), actionKey('placeholders.hr-workflow.transfer'));
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
this.withEmployeeSubmenu({
|
|
80
|
+
id: 'organization-management.org-chart.hr-promotion',
|
|
81
|
+
title: actionKey('hr-workflow-promotion'),
|
|
82
|
+
icon: 'fa-light fa-arrow-trend-up',
|
|
83
|
+
order: 61,
|
|
84
|
+
execute: async () => {
|
|
85
|
+
await this.showPlaceholder(actionKey('placeholders.hr-workflow.title'), actionKey('placeholders.hr-workflow.promotion'));
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
this.withEmployeeSubmenu({
|
|
89
|
+
id: 'organization-management.org-chart.hr-offboarding',
|
|
90
|
+
title: actionKey('hr-workflow-offboarding'),
|
|
91
|
+
icon: 'fa-light fa-door-open',
|
|
92
|
+
order: 62,
|
|
93
|
+
execute: async () => {
|
|
94
|
+
await this.showPlaceholder(actionKey('placeholders.hr-workflow.title'), actionKey('placeholders.hr-workflow.offboarding'));
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
this.withEmployeeSubmenu({
|
|
98
|
+
id: 'organization-management.org-chart.schedule-meeting',
|
|
99
|
+
title: actionKey('schedule-meeting'),
|
|
100
|
+
icon: 'fa-light fa-calendar-plus',
|
|
101
|
+
order: 70,
|
|
102
|
+
submenuSectionBreak: true,
|
|
103
|
+
execute: async () => {
|
|
104
|
+
await this.showPlaceholder(actionKey('placeholders.schedule-meeting.title'), actionKey('placeholders.schedule-meeting.message'));
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
this.withEmployeeSubmenu({
|
|
108
|
+
id: 'organization-management.org-chart.add-to-team',
|
|
109
|
+
title: actionKey('add-to-team'),
|
|
110
|
+
icon: 'fa-light fa-user-plus',
|
|
111
|
+
order: 75,
|
|
112
|
+
/** Trailing group break: separator after the Employee row on the root menu (inner last-row break is normalized away). */
|
|
113
|
+
break: 'after',
|
|
114
|
+
disabled: !canTeam,
|
|
115
|
+
execute: async (ctx) => {
|
|
116
|
+
await this.openTeamSelectorThenCreateTeamMember(ctx, employeeId);
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Picks a team via {@link AXPEntityDataSelectorService}, then opens **Create Team Member** with both `teamId` and
|
|
123
|
+
* `employeeId` set.
|
|
124
|
+
*/
|
|
125
|
+
async openTeamSelectorThenCreateTeamMember(ctx, employeeId) {
|
|
126
|
+
const teamEntity = await this.entityRegistry.resolve(RootConfig.module.name, RootConfig.entities.team.name);
|
|
127
|
+
if (!teamEntity) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const title = await this.translationService.translateAsync(actionKey('add-to-team-select-team'));
|
|
131
|
+
const pick = await this.entityDataSelector.open({
|
|
132
|
+
entity: teamEntity,
|
|
133
|
+
title,
|
|
134
|
+
allowMultiple: false,
|
|
135
|
+
});
|
|
136
|
+
const teamId = pick?.items?.[0]?.id;
|
|
137
|
+
if (teamId == null || String(teamId).trim().length === 0) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const result = await this.commandService.execute('Entity:Create', {
|
|
141
|
+
__context__: {
|
|
142
|
+
entity: RootConfig.entities.teamMember.source,
|
|
143
|
+
entityInfo: this.teamMemberEntityInfo,
|
|
144
|
+
data: { employeeId, teamId: String(teamId).trim() },
|
|
145
|
+
options: {
|
|
146
|
+
process: {
|
|
147
|
+
redirect: false,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
if (result?.success) {
|
|
153
|
+
await ctx.refreshChart();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
withEmployeeSubmenu(action) {
|
|
157
|
+
return {
|
|
158
|
+
...action,
|
|
159
|
+
submenuGroupId: AXM_ORG_CHART_EMPLOYEE_SUBMENU_GROUP_ID,
|
|
160
|
+
submenuGroupTitle: AXM_ORG_CHART_EMPLOYEE_SUBMENU_TITLE_I18N_KEY,
|
|
161
|
+
submenuGroupIcon: AXM_ORG_CHART_EMPLOYEE_SUBMENU_ICON,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region ---- Resolvers ----
|
|
166
|
+
authorize(permission) {
|
|
167
|
+
return this.sessionService.authorize(permission);
|
|
168
|
+
}
|
|
169
|
+
async showPlaceholder(titleKey, messageKey) {
|
|
170
|
+
const title = await this.translationService.translateAsync(titleKey);
|
|
171
|
+
const message = await this.translationService.translateAsync(messageKey);
|
|
172
|
+
await this.dialogService.alert(title, message, 'primary');
|
|
173
|
+
}
|
|
174
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartEmployeeFlyoutContributionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
175
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartEmployeeFlyoutContributionProvider }); }
|
|
176
|
+
}
|
|
177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartEmployeeFlyoutContributionProvider, decorators: [{
|
|
178
|
+
type: Injectable
|
|
179
|
+
}] });
|
|
180
|
+
|
|
181
|
+
export { AXMOrgChartEmployeeFlyoutContributionProvider };
|
|
182
|
+
//# sourceMappingURL=acorex-modules-organization-management-org-chart-employee-flyout-contribution.provider-Bv0I-45L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-modules-organization-management-org-chart-employee-flyout-contribution.provider-Bv0I-45L.mjs","sources":["../../../../libs/modules/organization-management/src/lib/features/organization-chart/contributions/org-chart-employee-flyout-contribution.provider.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex/platform/auth';\nimport { AXPEntityDataSelectorService, AXPEntityDefinitionRegistryService } from '@acorex/platform/layout/entity';\nimport { AXPCommandService } from '@acorex/platform/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { RootConfig } from '../../../const';\nimport { AXPOrganizationManagementPermissionKeys } from '../../../permission.keys';\nimport {\n AXM_ORG_CHART_EMPLOYEE_SUBMENU_GROUP_ID,\n AXM_ORG_CHART_EMPLOYEE_SUBMENU_ICON,\n AXM_ORG_CHART_EMPLOYEE_SUBMENU_TITLE_I18N_KEY,\n} from '../constants/org-chart-employee-submenu.const';\nimport {\n AXMOrgChartNodeContributionContext,\n AXMOrgChartNodeContributionProvider,\n AXMOrgChartNodeMenuAction,\n} from '../tokens/org-chart-node-contribution.token';\nimport { axmResolveOrgChartFlyoutEmployeeId } from '../utils/org-chart-resolve-flyout-employee-id.util';\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst actionKey = (suffix: string): string =>\n `@organization-management:organization-chart.node-actions.${suffix}`;\n\nconst HCM_EMPLOYEE_MODULE = 'HumanCapitalManagement';\nconst HCM_EMPLOYEE_NAME = 'Employee';\nconst HCM_EMPLOYEE_SOURCE = `${HCM_EMPLOYEE_MODULE}.${HCM_EMPLOYEE_NAME}`;\n\nconst employeeViewPermission = 'HumanCapitalManagement:Permission:Employee.View';\n\n//#endregion\n\n/**\n * **Employee** context-submenu: open employee record (`Entity:OpenDetails`), HR placeholders, schedule, add-to-team — plus chat/email from extensions.\n * Shown for {@link AXMOrgChartNodeKind} `employee` and for company / business unit / filled position when an\n * assigned person id is available; hidden when head or top role is vacant.\n */\n@Injectable()\nexport class AXMOrgChartEmployeeFlyoutContributionProvider implements AXMOrgChartNodeContributionProvider {\n //#region ---- Services & Dependencies ----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly dialogService = inject(AXDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly entityDataSelector = inject(AXPEntityDataSelectorService);\n\n private readonly teamMemberEntityInfo = {\n module: RootConfig.module.name,\n name: RootConfig.entities.teamMember.name,\n title: RootConfig.entities.teamMember.title,\n };\n\n //#endregion\n\n //#region ---- AXMOrgChartNodeContributionProvider ----\n\n async getMenuActions(context: AXMOrgChartNodeContributionContext): Promise<AXMOrgChartNodeMenuAction[]> {\n const employeeId = axmResolveOrgChartFlyoutEmployeeId(context);\n if (!employeeId) {\n return [];\n }\n return this.buildFlyoutActions(context, employeeId);\n }\n\n //#endregion\n\n //#region ---- Flyout actions ----\n\n private buildFlyoutActions(\n context: AXMOrgChartNodeContributionContext,\n employeeId: string,\n ): AXMOrgChartNodeMenuAction[] {\n void context;\n const canViewEmployee = this.authorize(employeeViewPermission);\n const canTeam = this.authorize(AXPOrganizationManagementPermissionKeys.Team.Create);\n\n return [\n this.withEmployeeSubmenu({\n id: 'organization-management.org-chart.open-employee-details',\n title: actionKey('open'),\n icon: 'fa-light fa-arrow-up-right-from-square',\n order: 35,\n disabled: !canViewEmployee,\n execute: async () => {\n await this.commandService.execute('Entity:OpenDetails', {\n entity: HCM_EMPLOYEE_SOURCE,\n data: { id: employeeId },\n });\n },\n }),\n this.withEmployeeSubmenu({\n id: 'organization-management.org-chart.hr-transfer',\n title: actionKey('hr-workflow-transfer'),\n icon: 'fa-light fa-right-left',\n order: 60,\n submenuSectionBreak: true,\n execute: async () => {\n await this.showPlaceholder(\n actionKey('placeholders.hr-workflow.title'),\n actionKey('placeholders.hr-workflow.transfer'),\n );\n },\n }),\n this.withEmployeeSubmenu({\n id: 'organization-management.org-chart.hr-promotion',\n title: actionKey('hr-workflow-promotion'),\n icon: 'fa-light fa-arrow-trend-up',\n order: 61,\n execute: async () => {\n await this.showPlaceholder(\n actionKey('placeholders.hr-workflow.title'),\n actionKey('placeholders.hr-workflow.promotion'),\n );\n },\n }),\n this.withEmployeeSubmenu({\n id: 'organization-management.org-chart.hr-offboarding',\n title: actionKey('hr-workflow-offboarding'),\n icon: 'fa-light fa-door-open',\n order: 62,\n execute: async () => {\n await this.showPlaceholder(\n actionKey('placeholders.hr-workflow.title'),\n actionKey('placeholders.hr-workflow.offboarding'),\n );\n },\n }),\n this.withEmployeeSubmenu({\n id: 'organization-management.org-chart.schedule-meeting',\n title: actionKey('schedule-meeting'),\n icon: 'fa-light fa-calendar-plus',\n order: 70,\n submenuSectionBreak: true,\n execute: async () => {\n await this.showPlaceholder(\n actionKey('placeholders.schedule-meeting.title'),\n actionKey('placeholders.schedule-meeting.message'),\n );\n },\n }),\n this.withEmployeeSubmenu({\n id: 'organization-management.org-chart.add-to-team',\n title: actionKey('add-to-team'),\n icon: 'fa-light fa-user-plus',\n order: 75,\n /** Trailing group break: separator after the Employee row on the root menu (inner last-row break is normalized away). */\n break: 'after',\n disabled: !canTeam,\n execute: async (ctx) => {\n await this.openTeamSelectorThenCreateTeamMember(ctx, employeeId);\n },\n }),\n ];\n }\n\n /**\n * Picks a team via {@link AXPEntityDataSelectorService}, then opens **Create Team Member** with both `teamId` and\n * `employeeId` set.\n */\n private async openTeamSelectorThenCreateTeamMember(\n ctx: AXMOrgChartNodeContributionContext,\n employeeId: string,\n ): Promise<void> {\n const teamEntity = await this.entityRegistry.resolve(RootConfig.module.name, RootConfig.entities.team.name);\n if (!teamEntity) {\n return;\n }\n const title = await this.translationService.translateAsync(actionKey('add-to-team-select-team'));\n const pick = await this.entityDataSelector.open({\n entity: teamEntity,\n title,\n allowMultiple: false,\n });\n const teamId = pick?.items?.[0]?.id;\n if (teamId == null || String(teamId).trim().length === 0) {\n return;\n }\n\n const result = await this.commandService.execute('Entity:Create', {\n __context__: {\n entity: RootConfig.entities.teamMember.source,\n entityInfo: this.teamMemberEntityInfo,\n data: { employeeId, teamId: String(teamId).trim() },\n options: {\n process: {\n redirect: false,\n },\n },\n },\n });\n if (result?.success) {\n await ctx.refreshChart();\n }\n }\n\n private withEmployeeSubmenu(\n action: AXMOrgChartNodeMenuAction,\n ): AXMOrgChartNodeMenuAction {\n return {\n ...action,\n submenuGroupId: AXM_ORG_CHART_EMPLOYEE_SUBMENU_GROUP_ID,\n submenuGroupTitle: AXM_ORG_CHART_EMPLOYEE_SUBMENU_TITLE_I18N_KEY,\n submenuGroupIcon: AXM_ORG_CHART_EMPLOYEE_SUBMENU_ICON,\n };\n }\n\n //#endregion\n\n //#region ---- Resolvers ----\n\n private authorize(permission: string): boolean {\n return this.sessionService.authorize(permission);\n }\n\n private async showPlaceholder(titleKey: string, messageKey: string): Promise<void> {\n const title = await this.translationService.translateAsync(titleKey);\n const message = await this.translationService.translateAsync(messageKey);\n await this.dialogService.alert(title, message, 'primary');\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AAsBA;AAEA;AAEA,MAAM,SAAS,GAAG,CAAC,MAAc,KAC/B,CAAA,yDAAA,EAA4D,MAAM,CAAA,CAAE;AAEtE,MAAM,mBAAmB,GAAG,wBAAwB;AACpD,MAAM,iBAAiB,GAAG,UAAU;AACpC,MAAM,mBAAmB,GAAG,CAAA,EAAG,mBAAmB,CAAA,CAAA,EAAI,iBAAiB,EAAE;AAEzE,MAAM,sBAAsB,GAAG,iDAAiD;AAEhF;AAEA;;;;AAIG;MAEU,6CAA6C,CAAA;AAD1D,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC3D,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAEzD,QAAA,IAAA,CAAA,oBAAoB,GAAG;AACtC,YAAA,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAC9B,YAAA,IAAI,EAAE,UA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}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { AXPSessionService } from '@acorex/platform/auth';
|
|
2
|
+
import { AXPCommandService } from '@acorex/platform/runtime';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { R as RootConfig, i as AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND, h as AXMOrganizationManagementCommandKeys } from './acorex-modules-organization-management-acorex-modules-organization-management-CGzZcKEy.mjs';
|
|
6
|
+
import { A as AXPOrganizationManagementPermissionKeys } from './acorex-modules-organization-management-permission.keys-DwZNBc12.mjs';
|
|
7
|
+
|
|
8
|
+
//#region ---- Imports ----
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ---- Module Constants ----
|
|
11
|
+
const orgChartNodeActionKey = (suffix) => `@organization-management:organization-chart.node-actions.${suffix}`;
|
|
12
|
+
const POSITION_ENTITY_SOURCE = RootConfig.entities.position.source;
|
|
13
|
+
const positionAssignmentCreatePermission = 'HumanCapitalManagement:Permission:PositionAssignment.Create';
|
|
14
|
+
const positionAssignmentEditPermission = 'HumanCapitalManagement:Permission:PositionAssignment.Edit';
|
|
15
|
+
//#endregion
|
|
16
|
+
/**
|
|
17
|
+
* Context menu actions for org chart **position** nodes (structure / location / etc.).
|
|
18
|
+
*/
|
|
19
|
+
class AXMOrgChartPositionEmployeeNodeContributionProvider {
|
|
20
|
+
constructor() {
|
|
21
|
+
//#region ---- Services & Dependencies ----
|
|
22
|
+
this.commandService = inject(AXPCommandService);
|
|
23
|
+
this.sessionService = inject(AXPSessionService);
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region ---- AXMOrgChartNodeContributionProvider Implementation ----
|
|
27
|
+
async getMenuActions(context) {
|
|
28
|
+
if (context.nodeKind === 'position') {
|
|
29
|
+
return this.getPositionNodeActions(context);
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region ---- Position Node Actions ----
|
|
35
|
+
getPositionNodeActions(context) {
|
|
36
|
+
const positionId = this.resolvePositionId(context);
|
|
37
|
+
if (!positionId) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const businessUnitId = this.resolveBusinessUnitIdForPosition(context);
|
|
41
|
+
const vacant = context.node.metadata?.['vacant'] === true;
|
|
42
|
+
const occupant = context.node.metadata?.['occupant'];
|
|
43
|
+
const occupantEmployeeId = typeof occupant?.['employeeId'] === 'string' && occupant['employeeId'].trim().length > 0
|
|
44
|
+
? occupant['employeeId'].trim()
|
|
45
|
+
: undefined;
|
|
46
|
+
const canUpdateBusinessUnit = this.authorize(AXPOrganizationManagementPermissionKeys.BusinessUnit.Update);
|
|
47
|
+
const canCreateAssignment = this.authorize(positionAssignmentCreatePermission);
|
|
48
|
+
const canEditAssignment = this.authorize(positionAssignmentEditPermission);
|
|
49
|
+
const actions = [];
|
|
50
|
+
if (vacant && businessUnitId) {
|
|
51
|
+
actions.push({
|
|
52
|
+
id: 'organization-management.assign-employee-to-position-from-chart',
|
|
53
|
+
title: orgChartNodeActionKey('assign-employee-to-position'),
|
|
54
|
+
icon: 'fa-light fa-user-plus',
|
|
55
|
+
order: 110,
|
|
56
|
+
disabled: !canCreateAssignment,
|
|
57
|
+
execute: async (ctx) => {
|
|
58
|
+
const pid = this.resolvePositionId(ctx);
|
|
59
|
+
const buId = this.resolveBusinessUnitIdForPosition(ctx);
|
|
60
|
+
if (!pid || !buId) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const result = await this.commandService.execute(AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND, {
|
|
64
|
+
data: {
|
|
65
|
+
businessUnitId: buId,
|
|
66
|
+
positionId: pid,
|
|
67
|
+
isPrimary: false,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (result?.success) {
|
|
71
|
+
await ctx.refreshChart();
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (!vacant && occupantEmployeeId && businessUnitId) {
|
|
77
|
+
actions.push({
|
|
78
|
+
id: 'organization-management.replace-position-assignee-from-chart',
|
|
79
|
+
title: orgChartNodeActionKey('assign-new-employee-to-position'),
|
|
80
|
+
icon: 'fa-light fa-arrows-rotate',
|
|
81
|
+
order: 115,
|
|
82
|
+
disabled: !canCreateAssignment || !canEditAssignment,
|
|
83
|
+
execute: async (ctx) => {
|
|
84
|
+
const pid = this.resolvePositionId(ctx);
|
|
85
|
+
const buId = this.resolveBusinessUnitIdForPosition(ctx);
|
|
86
|
+
const occ = ctx.node.metadata?.['occupant'];
|
|
87
|
+
const eid = typeof occ?.['employeeId'] === 'string' && occ['employeeId'].trim().length > 0
|
|
88
|
+
? occ['employeeId'].trim()
|
|
89
|
+
: '';
|
|
90
|
+
if (!pid || !buId || !eid) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const result = await this.commandService.execute(AXMOrganizationManagementCommandKeys.OrganizationChart.ReplacePositionAssignee, { businessUnitId: buId, positionId: pid, currentEmployeeId: eid });
|
|
94
|
+
if (result?.success) {
|
|
95
|
+
await ctx.refreshChart();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (businessUnitId) {
|
|
101
|
+
actions.push({
|
|
102
|
+
id: 'organization-management.remove-position-from-unit-from-chart',
|
|
103
|
+
title: orgChartNodeActionKey('remove-from-unit'),
|
|
104
|
+
icon: 'fa-light fa-link-slash',
|
|
105
|
+
color: 'danger',
|
|
106
|
+
order: 120,
|
|
107
|
+
disabled: !canUpdateBusinessUnit,
|
|
108
|
+
execute: async (ctx) => {
|
|
109
|
+
const pid = this.resolvePositionId(ctx);
|
|
110
|
+
const buId = this.resolveBusinessUnitIdForPosition(ctx);
|
|
111
|
+
if (!pid || !buId) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const occ = ctx.node.metadata?.['occupant'];
|
|
115
|
+
const occId = typeof occ?.['employeeId'] === 'string' && occ['employeeId'].trim().length > 0
|
|
116
|
+
? occ['employeeId'].trim()
|
|
117
|
+
: undefined;
|
|
118
|
+
const result = await this.commandService.execute(AXMOrganizationManagementCommandKeys.OrganizationChart.RemovePositionFromBusinessUnit, {
|
|
119
|
+
businessUnitId: buId,
|
|
120
|
+
positionId: pid,
|
|
121
|
+
...(occId ? { occupantEmployeeId: occId } : {}),
|
|
122
|
+
});
|
|
123
|
+
if (result?.success) {
|
|
124
|
+
await ctx.refreshChart();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return actions;
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region ---- Resolvers & Authorization ----
|
|
133
|
+
authorize(permission) {
|
|
134
|
+
return this.sessionService.authorize(permission);
|
|
135
|
+
}
|
|
136
|
+
resolvePositionId(context) {
|
|
137
|
+
const entity = context.node.entity;
|
|
138
|
+
if (entity?.id != null && this.isPositionEntityType(entity.type)) {
|
|
139
|
+
const id = String(entity.id).trim();
|
|
140
|
+
return id.length > 0 ? id : undefined;
|
|
141
|
+
}
|
|
142
|
+
const metaPid = context.node.metadata?.['positionId'];
|
|
143
|
+
if (typeof metaPid === 'string' && metaPid.trim().length > 0) {
|
|
144
|
+
return metaPid.trim();
|
|
145
|
+
}
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
isPositionEntityType(entityType) {
|
|
149
|
+
if (!entityType || typeof entityType !== 'string') {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return entityType === POSITION_ENTITY_SOURCE || entityType.endsWith('.Position');
|
|
153
|
+
}
|
|
154
|
+
resolveBusinessUnitIdForPosition(context) {
|
|
155
|
+
const meta = context.node.metadata ?? {};
|
|
156
|
+
const a = meta['businessUnitId'];
|
|
157
|
+
const b = meta['organizationalUnitId'];
|
|
158
|
+
const raw = (typeof a === 'string' && a.trim().length > 0 ? a : typeof b === 'string' ? b : '');
|
|
159
|
+
const id = String(raw).trim();
|
|
160
|
+
return id.length > 0 ? id : undefined;
|
|
161
|
+
}
|
|
162
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartPositionEmployeeNodeContributionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
163
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartPositionEmployeeNodeContributionProvider }); }
|
|
164
|
+
}
|
|
165
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMOrgChartPositionEmployeeNodeContributionProvider, decorators: [{
|
|
166
|
+
type: Injectable
|
|
167
|
+
}] });
|
|
168
|
+
|
|
169
|
+
export { AXMOrgChartPositionEmployeeNodeContributionProvider };
|
|
170
|
+
//# sourceMappingURL=acorex-modules-organization-management-org-chart-position-employee-node-contribution.provider-DbfYza8q.mjs.map
|