@acorex-platform/module-organization-management-client 0.0.21

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 (53) hide show
  1. package/fesm2022/acorex-platform-module-organization-management-client-acorex-platform-module-organization-management-client-Dn8Ss1nL.mjs +433 -0
  2. package/fesm2022/acorex-platform-module-organization-management-client-acorex-platform-module-organization-management-client-Dn8Ss1nL.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-organization-management-client-add-business-unit-to-business-unit.command-CA2uZQyC.mjs +161 -0
  4. package/fesm2022/acorex-platform-module-organization-management-client-add-business-unit-to-business-unit.command-CA2uZQyC.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-organization-management-client-add-position-to-business-unit.command-F7jD3jKs.mjs +137 -0
  6. package/fesm2022/acorex-platform-module-organization-management-client-add-position-to-business-unit.command-F7jD3jKs.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-organization-management-client-add-team-to-business-unit.command-BLQFjhS5.mjs +127 -0
  8. package/fesm2022/acorex-platform-module-organization-management-client-add-team-to-business-unit.command-BLQFjhS5.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-organization-management-client-contracts.mjs +468 -0
  10. package/fesm2022/acorex-platform-module-organization-management-client-contracts.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-organization-management-client-feature-definition.provider-BQKtvXOM.mjs +19 -0
  12. package/fesm2022/acorex-platform-module-organization-management-client-feature-definition.provider-BQKtvXOM.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-organization-management-client-generate-org-chart.command-DJnFJKuo.mjs +91 -0
  14. package/fesm2022/acorex-platform-module-organization-management-client-generate-org-chart.command-DJnFJKuo.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-matrix-page.utils-DD3jLujN.mjs +61 -0
  16. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-matrix-page.utils-DD3jLujN.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-pages-component.provider-BNhXJfjr.mjs +28 -0
  18. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-pages-component.provider-BNhXJfjr.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-responsibilities-page.component-BlUzsSy3.mjs +237 -0
  20. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-responsibilities-page.component-BlUzsSy3.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-skills-page.component--pyAaXB4.mjs +233 -0
  22. package/fesm2022/acorex-platform-module-organization-management-client-job-definition-skills-page.component--pyAaXB4.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-organization-management-client-menu.provider-BgRoEC48.mjs +175 -0
  24. package/fesm2022/acorex-platform-module-organization-management-client-menu.provider-BgRoEC48.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-default-node-contribution.provider-BQ0ihb43.mjs +229 -0
  26. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-default-node-contribution.provider-BQ0ihb43.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-employee-flyout-contribution.provider-Bz8nVm04.mjs +179 -0
  28. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-employee-flyout-contribution.provider-Bz8nVm04.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-position-employee-node-contribution.provider-BTicXn9n.mjs +168 -0
  30. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-position-employee-node-contribution.provider-BTicXn9n.mjs.map +1 -0
  31. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-ux-node-contribution.provider-C5TItnOp.mjs +338 -0
  32. package/fesm2022/acorex-platform-module-organization-management-client-org-chart-ux-node-contribution.provider-C5TItnOp.mjs.map +1 -0
  33. package/fesm2022/acorex-platform-module-organization-management-client-org-chart.page-g_3oPPH0.mjs +3744 -0
  34. package/fesm2022/acorex-platform-module-organization-management-client-org-chart.page-g_3oPPH0.mjs.map +1 -0
  35. package/fesm2022/acorex-platform-module-organization-management-client-permission-definition.provider-CiCdTBGo.mjs +43 -0
  36. package/fesm2022/acorex-platform-module-organization-management-client-permission-definition.provider-CiCdTBGo.mjs.map +1 -0
  37. package/fesm2022/acorex-platform-module-organization-management-client-remove-position-from-business-unit.command-BFQVTpfy.mjs +91 -0
  38. package/fesm2022/acorex-platform-module-organization-management-client-remove-position-from-business-unit.command-BFQVTpfy.mjs.map +1 -0
  39. package/fesm2022/acorex-platform-module-organization-management-client-replace-position-assignee.command-CSgERqLG.mjs +64 -0
  40. package/fesm2022/acorex-platform-module-organization-management-client-replace-position-assignee.command-CSgERqLG.mjs.map +1 -0
  41. package/fesm2022/acorex-platform-module-organization-management-client-responsibilities-matrix-widget-edit.component-DHmUxlnu.mjs +143 -0
  42. package/fesm2022/acorex-platform-module-organization-management-client-responsibilities-matrix-widget-edit.component-DHmUxlnu.mjs.map +1 -0
  43. package/fesm2022/acorex-platform-module-organization-management-client-responsibilities-matrix-widget-view.component-BkLZhXhM.mjs +65 -0
  44. package/fesm2022/acorex-platform-module-organization-management-client-responsibilities-matrix-widget-view.component-BkLZhXhM.mjs.map +1 -0
  45. package/fesm2022/acorex-platform-module-organization-management-client-responsibilities-matrix.component-DqO6xE2p.mjs +400 -0
  46. package/fesm2022/acorex-platform-module-organization-management-client-responsibilities-matrix.component-DqO6xE2p.mjs.map +1 -0
  47. package/fesm2022/acorex-platform-module-organization-management-client-settings.provider-Dnrkq9Ku.mjs +432 -0
  48. package/fesm2022/acorex-platform-module-organization-management-client-settings.provider-Dnrkq9Ku.mjs.map +1 -0
  49. package/fesm2022/acorex-platform-module-organization-management-client.mjs +2 -0
  50. package/fesm2022/acorex-platform-module-organization-management-client.mjs.map +1 -0
  51. package/package.json +28 -0
  52. package/types/acorex-platform-module-organization-management-client-contracts.d.ts +501 -0
  53. package/types/acorex-platform-module-organization-management-client.d.ts +273 -0
@@ -0,0 +1,161 @@
1
+ import { AXDialogService } from '@acorex/components/dialog';
2
+ import { AXToastService } from '@acorex/components/toast';
3
+ import { AXTranslationService } from '@acorex/core/translation';
4
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
5
+ import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
6
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
7
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
8
+ import * as i0 from '@angular/core';
9
+ import { inject, Injectable } from '@angular/core';
10
+ import { RootConfig, AXPPeopleOrganizationPermissionKeys, AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND } from '@acorex-platform/module-organization-management-client/contracts';
11
+
12
+ class AXMAddBusinessUnitToBusinessUnitCommand {
13
+ constructor() {
14
+ //#region ---- Services & Dependencies ----
15
+ this.commandService = inject(AXPCommandService);
16
+ this.entityService = inject(AXPEntityService);
17
+ this.translationService = inject(AXTranslationService);
18
+ this.dialogService = inject(AXDialogService);
19
+ this.toastService = inject(AXToastService);
20
+ this.sessionService = inject(AXPSessionService);
21
+ }
22
+ //#endregion
23
+ //#region ---- Command ----
24
+ async execute(input) {
25
+ const typeId = input?.typeId?.trim() ?? '';
26
+ if (!typeId) {
27
+ return { success: false };
28
+ }
29
+ const parentId = this.normalizeOptionalId(input?.parentBusinessUnitId);
30
+ const createResult = await this.commandService.execute('Entity:Create', {
31
+ entity: RootConfig.entities.businessUnit.source,
32
+ entityInfo: {
33
+ module: RootConfig.module.name,
34
+ name: RootConfig.entities.businessUnit.name,
35
+ title: RootConfig.entities.businessUnit.title,
36
+ parentKey: 'parentId',
37
+ },
38
+ data: {
39
+ ...(parentId ? { parentId } : {}),
40
+ typeId,
41
+ },
42
+ options: {
43
+ process: {
44
+ redirect: false,
45
+ },
46
+ },
47
+ });
48
+ if (!createResult?.success) {
49
+ return { success: false };
50
+ }
51
+ const childBusinessUnitId = this.extractCreatedEntityId(runtimeCommandPayloadData(createResult));
52
+ if (!childBusinessUnitId) {
53
+ return { success: false };
54
+ }
55
+ if (!(await this.typeAllowsDirectPositions(typeId))) {
56
+ return { success: true, kind: 'object', data: { childBusinessUnitId } };
57
+ }
58
+ if (!this.sessionService.authorize(AXPPeopleOrganizationPermissionKeys.MaintainOrganization)) {
59
+ return { success: true, kind: 'object', data: { childBusinessUnitId } };
60
+ }
61
+ if (!(await this.confirmAssignHeadNow())) {
62
+ return { success: true, kind: 'object', data: { childBusinessUnitId } };
63
+ }
64
+ const headPositionId = await this.resolveHeadPositionId(childBusinessUnitId);
65
+ if (!headPositionId) {
66
+ await this.showMissingHeadPositionHint();
67
+ return { success: true, kind: 'object', data: { childBusinessUnitId } };
68
+ }
69
+ const assignResult = await this.commandService.execute(AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND, {
70
+ data: {
71
+ businessUnitId: childBusinessUnitId,
72
+ positionId: headPositionId,
73
+ isPrimary: true,
74
+ },
75
+ });
76
+ return { success: true, kind: 'object',
77
+ data: {
78
+ childBusinessUnitId,
79
+ headAssignCompleted: assignResult?.success === true,
80
+ },
81
+ };
82
+ }
83
+ //#endregion
84
+ //#region ---- Helpers ----
85
+ /**
86
+ * When false, the business unit type cannot hold direct positions (no head-assignment prompt after create).
87
+ */
88
+ async typeAllowsDirectPositions(businessUnitTypeId) {
89
+ const id = businessUnitTypeId.trim();
90
+ if (!id) {
91
+ return true;
92
+ }
93
+ try {
94
+ const row = await this.entityService
95
+ .withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)
96
+ .data()
97
+ .byKey(id);
98
+ return row?.allowsDirectPositions !== false;
99
+ }
100
+ catch {
101
+ return true;
102
+ }
103
+ }
104
+ normalizeOptionalId(value) {
105
+ if (value == null) {
106
+ return undefined;
107
+ }
108
+ const s = String(value).trim();
109
+ return s.length > 0 ? s : undefined;
110
+ }
111
+ extractCreatedEntityId(data) {
112
+ if (data == null || typeof data !== 'object') {
113
+ return '';
114
+ }
115
+ const record = data;
116
+ const item = record['item'] ?? data;
117
+ if (item == null || typeof item !== 'object') {
118
+ return '';
119
+ }
120
+ const id = item['id'];
121
+ if (typeof id === 'string') {
122
+ return id.trim();
123
+ }
124
+ if (typeof id === 'number' && Number.isFinite(id)) {
125
+ return String(id);
126
+ }
127
+ return '';
128
+ }
129
+ async confirmAssignHeadNow() {
130
+ const title = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.assign-head-after-bu-create.title');
131
+ const message = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.assign-head-after-bu-create.message');
132
+ const result = await this.dialogService.confirm(title, message, 'primary', 'horizontal', false, 'cancel');
133
+ return result.result === true;
134
+ }
135
+ async resolveHeadPositionId(businessUnitId) {
136
+ const buData = this.entityService
137
+ .withEntity(RootConfig.module.name, RootConfig.entities.businessUnit.name)
138
+ .data();
139
+ const row = await buData.byKey(businessUnitId);
140
+ const raw = row?.headPositionId;
141
+ if (typeof raw === 'string') {
142
+ const id = raw.trim();
143
+ return id.length > 0 ? id : '';
144
+ }
145
+ return '';
146
+ }
147
+ async showMissingHeadPositionHint() {
148
+ const title = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.assign-head-missing-head-position.title');
149
+ const content = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.assign-head-missing-head-position.message');
150
+ this.toastService.show({ color: 'warning', title, content });
151
+ }
152
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddBusinessUnitToBusinessUnitCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
153
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddBusinessUnitToBusinessUnitCommand, providedIn: 'root' }); }
154
+ }
155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddBusinessUnitToBusinessUnitCommand, decorators: [{
156
+ type: Injectable,
157
+ args: [{ providedIn: 'root' }]
158
+ }] });
159
+
160
+ export { AXMAddBusinessUnitToBusinessUnitCommand };
161
+ //# sourceMappingURL=acorex-platform-module-organization-management-client-add-business-unit-to-business-unit.command-CA2uZQyC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-organization-management-client-add-business-unit-to-business-unit.command-CA2uZQyC.mjs","sources":["../../../../libs/modules/organization-management/client/src/lib/features/organization-chart/commands/add-business-unit-to-business-unit.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPRuntimeCommandResult, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport {\n AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND,\n AXPPeopleOrganizationPermissionKeys\n} from '@acorex-platform/module-organization-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-organization-management-client/contracts';\nimport type { AXMOrganizationManagementBusinessUnitEntityModel } from '@acorex-platform/module-organization-management-client/contracts';\n\n//#endregion\n\nexport interface AXMAddBusinessUnitToBusinessUnitInput {\n /** Parent BU when adding under a business unit; omit or empty from company root. */\n parentBusinessUnitId?: string | null;\n typeId: string;\n}\n\nexport interface AXMAddBusinessUnitToBusinessUnitResult {\n childBusinessUnitId: string;\n /** True when HCM position assignment for the unit head completed successfully. */\n headAssignCompleted?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXMAddBusinessUnitToBusinessUnitCommand\n implements AXPCommand<AXMAddBusinessUnitToBusinessUnitInput, AXMAddBusinessUnitToBusinessUnitResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly sessionService = inject(AXPSessionService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(\n input: AXMAddBusinessUnitToBusinessUnitInput,\n ): AXPCommandExecuteResultPromise<AXMAddBusinessUnitToBusinessUnitResult> {\n const typeId = input?.typeId?.trim() ?? '';\n if (!typeId) {\n return { success: false };\n }\n\n const parentId = this.normalizeOptionalId(input?.parentBusinessUnitId);\n\n const createResult = await this.commandService.execute('Entity:Create', {\n entity: RootConfig.entities.businessUnit.source,\n entityInfo: {\n module: RootConfig.module.name,\n name: RootConfig.entities.businessUnit.name,\n title: RootConfig.entities.businessUnit.title,\n parentKey: 'parentId',\n },\n data: {\n ...(parentId ? { parentId } : {}),\n typeId,\n },\n options: {\n process: {\n redirect: false,\n },\n },\n \n });\n\n if (!createResult?.success) {\n return { success: false };\n }\n\n const childBusinessUnitId = this.extractCreatedEntityId(runtimeCommandPayloadData(createResult));\n if (!childBusinessUnitId) {\n return { success: false };\n }\n\n if (!(await this.typeAllowsDirectPositions(typeId))) {\n return { success: true, kind: 'object', data: { childBusinessUnitId } };\n }\n\n if (!this.sessionService.authorize(AXPPeopleOrganizationPermissionKeys.MaintainOrganization)) {\n return { success: true, kind: 'object', data: { childBusinessUnitId } };\n }\n\n if (!(await this.confirmAssignHeadNow())) {\n return { success: true, kind: 'object', data: { childBusinessUnitId } };\n }\n\n const headPositionId = await this.resolveHeadPositionId(childBusinessUnitId);\n if (!headPositionId) {\n await this.showMissingHeadPositionHint();\n return { success: true, kind: 'object', data: { childBusinessUnitId } };\n }\n\n const assignResult = await this.commandService.execute(AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND, {\n data: {\n businessUnitId: childBusinessUnitId,\n positionId: headPositionId,\n isPrimary: true,\n },\n });\n\n return { success: true, kind: 'object',\n data: {\n childBusinessUnitId,\n headAssignCompleted: assignResult?.success === true,\n },\n };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * When false, the business unit type cannot hold direct positions (no head-assignment prompt after create).\n */\n private async typeAllowsDirectPositions(businessUnitTypeId: string): Promise<boolean> {\n const id = businessUnitTypeId.trim();\n if (!id) {\n return true;\n }\n try {\n const row = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)\n .data()\n .byKey(id);\n return (row as { allowsDirectPositions?: boolean } | null)?.allowsDirectPositions !== false;\n } catch {\n return true;\n }\n }\n\n private normalizeOptionalId(value: unknown): string | undefined {\n if (value == null) {\n return undefined;\n }\n const s = String(value).trim();\n return s.length > 0 ? s : undefined;\n }\n\n private extractCreatedEntityId(data: unknown): string {\n if (data == null || typeof data !== 'object') {\n return '';\n }\n const record = data as Record<string, unknown>;\n const item = record['item'] ?? data;\n if (item == null || typeof item !== 'object') {\n return '';\n }\n const id = (item as Record<string, unknown>)['id'];\n if (typeof id === 'string') {\n return id.trim();\n }\n if (typeof id === 'number' && Number.isFinite(id)) {\n return String(id);\n }\n return '';\n }\n\n private async confirmAssignHeadNow(): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.assign-head-after-bu-create.title',\n );\n const message = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.assign-head-after-bu-create.message',\n );\n const result = await this.dialogService.confirm(title, message, 'primary', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n private async resolveHeadPositionId(businessUnitId: string): Promise<string> {\n const buData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.businessUnit.name)\n .data<string, AXMOrganizationManagementBusinessUnitEntityModel>();\n const row = await buData.byKey(businessUnitId);\n const raw = row?.headPositionId;\n if (typeof raw === 'string') {\n const id = raw.trim();\n return id.length > 0 ? id : '';\n }\n return '';\n }\n\n private async showMissingHeadPositionHint(): Promise<void> {\n const title = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.assign-head-missing-head-position.title',\n );\n const content = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.assign-head-missing-head-position.message',\n );\n this.toastService.show({ color: 'warning', title, content });\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;;MAkCa,uCAAuC,CAAA;AADpD,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAoK5D,IAAA;;;IA9JC,MAAM,OAAO,CACX,KAA4C,EAAA;QAE5C,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;QAC1C,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;QAEA,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,CAAC;QAEtE,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,eAAe,EAAE;AACtE,YAAA,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM;AAC/C,YAAA,UAAU,EAAE;AACV,gBAAA,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAC9B,gBAAA,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI;AAC3C,gBAAA,KAAK,EAAE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;;"}
@@ -0,0 +1,137 @@
1
+ import { AXDialogService } from '@acorex/components/dialog';
2
+ import { AXTranslationService } from '@acorex/core/translation';
3
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
4
+ import { AXPEntityService, AXPEntityDefinitionRegistryService, AXPEntityDataSelectorService } from '@acorex-platform/framework-client/layout/entity';
5
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
6
+ import * as i0 from '@angular/core';
7
+ import { inject, Injectable } from '@angular/core';
8
+ import { RootConfig, AXPPeopleOrganizationPermissionKeys, AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND } from '@acorex-platform/module-organization-management-client/contracts';
9
+
10
+ class AXMAddPositionToBusinessUnitCommand {
11
+ constructor() {
12
+ //#region ---- Services & Dependencies ----
13
+ this.commandService = inject(AXPCommandService);
14
+ this.entityService = inject(AXPEntityService);
15
+ this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
16
+ this.entitySelector = inject(AXPEntityDataSelectorService);
17
+ this.translationService = inject(AXTranslationService);
18
+ this.dialogService = inject(AXDialogService);
19
+ this.sessionService = inject(AXPSessionService);
20
+ }
21
+ //#endregion
22
+ //#region ---- Command ----
23
+ async execute(input) {
24
+ const businessUnitId = input?.businessUnitId?.trim() ?? '';
25
+ if (!businessUnitId) {
26
+ return { success: false };
27
+ }
28
+ const buData = this.entityService
29
+ .withEntity(RootConfig.module.name, RootConfig.entities.businessUnit.name)
30
+ .data();
31
+ const businessUnit = await buData.byKey(businessUnitId);
32
+ if (!businessUnit?.id) {
33
+ return { success: false };
34
+ }
35
+ if (!(await this.businessUnitTypeAllowsDirectPositions(businessUnit))) {
36
+ const text = await this.translationService.translateAsync('@organization-management:organization-chart.commands.add-position.type-not-allowed');
37
+ return { success: false, message: { text } };
38
+ }
39
+ const existingIds = this.normalizePositionIds(businessUnit.positionIds);
40
+ const positionEntity = await this.entityRegistry.resolve(RootConfig.module.name, RootConfig.entities.position.name);
41
+ if (!positionEntity) {
42
+ return { success: false };
43
+ }
44
+ const selectTitle = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.select-position');
45
+ const selectorResult = await this.entitySelector.open({
46
+ entity: positionEntity,
47
+ title: selectTitle,
48
+ allowMultiple: false,
49
+ columns: ['code', 'title'],
50
+ });
51
+ const selected = selectorResult?.items?.[0];
52
+ const rawPositionId = selected?.['id'] ?? selected?.['_id'];
53
+ const positionId = typeof rawPositionId === 'string' && rawPositionId.trim().length > 0 ? rawPositionId : '';
54
+ if (!positionId) {
55
+ return { success: false };
56
+ }
57
+ if (existingIds.includes(positionId)) {
58
+ return { success: true, kind: 'object', data: { businessUnitId, positionId } };
59
+ }
60
+ const nextPositionIds = [...existingIds, positionId];
61
+ try {
62
+ await buData.update(businessUnitId, { positionIds: nextPositionIds });
63
+ }
64
+ catch {
65
+ return { success: false };
66
+ }
67
+ const canAssign = this.sessionService.authorize(AXPPeopleOrganizationPermissionKeys.MaintainOrganization);
68
+ if (canAssign && (await this.confirmAssignEmployee())) {
69
+ await this.commandService.execute(AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND, {
70
+ data: {
71
+ businessUnitId,
72
+ positionId,
73
+ isPrimary: false,
74
+ },
75
+ });
76
+ }
77
+ return { success: true, kind: 'object', data: { businessUnitId, positionId } };
78
+ }
79
+ //#endregion
80
+ //#region ---- Helpers ----
81
+ /**
82
+ * Returns false when the business unit type explicitly disallows direct positions; true otherwise.
83
+ */
84
+ async businessUnitTypeAllowsDirectPositions(bu) {
85
+ const nested = bu.type?.allowsDirectPositions;
86
+ if (nested === false) {
87
+ return false;
88
+ }
89
+ if (nested === true) {
90
+ return true;
91
+ }
92
+ const typeId = bu.typeId?.trim();
93
+ if (!typeId) {
94
+ return true;
95
+ }
96
+ try {
97
+ const row = await this.entityService
98
+ .withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)
99
+ .data()
100
+ .byKey(typeId);
101
+ return row?.allowsDirectPositions !== false;
102
+ }
103
+ catch {
104
+ return true;
105
+ }
106
+ }
107
+ normalizePositionIds(value) {
108
+ if (value == null) {
109
+ return [];
110
+ }
111
+ if (Array.isArray(value)) {
112
+ return value.map((v) => String(v ?? '').trim()).filter((id) => id.length > 0);
113
+ }
114
+ if (typeof value === 'string') {
115
+ return value
116
+ .split(',')
117
+ .map((id) => id.trim())
118
+ .filter((id) => id.length > 0);
119
+ }
120
+ return [];
121
+ }
122
+ async confirmAssignEmployee() {
123
+ const title = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.assign-employee-confirm.title');
124
+ const message = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.assign-employee-confirm.message');
125
+ const result = await this.dialogService.confirm(title, message, 'primary', 'horizontal', false, 'cancel');
126
+ return result.result === true;
127
+ }
128
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddPositionToBusinessUnitCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
129
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddPositionToBusinessUnitCommand, providedIn: 'root' }); }
130
+ }
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddPositionToBusinessUnitCommand, decorators: [{
132
+ type: Injectable,
133
+ args: [{ providedIn: 'root' }]
134
+ }] });
135
+
136
+ export { AXMAddPositionToBusinessUnitCommand };
137
+ //# sourceMappingURL=acorex-platform-module-organization-management-client-add-position-to-business-unit.command-F7jD3jKs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-organization-management-client-add-position-to-business-unit.command-F7jD3jKs.mjs","sources":["../../../../libs/modules/organization-management/client/src/lib/features/organization-chart/commands/add-position-to-business-unit.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport {\n AXPEntityDataSelectorService,\n AXPEntityDefinitionRegistryService,\n AXPEntityService,\n} from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport {\n AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND,\n AXPPeopleOrganizationPermissionKeys\n} from '@acorex-platform/module-organization-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-organization-management-client/contracts';\nimport type { AXMOrganizationManagementBusinessUnitEntityModel } from '@acorex-platform/module-organization-management-client/contracts';\n\n//#endregion\n\nexport interface AXMAddPositionToBusinessUnitInput {\n businessUnitId: string;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXMAddPositionToBusinessUnitCommand\n implements AXPCommand<AXMAddPositionToBusinessUnitInput, { businessUnitId: string; positionId: string }>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly entityService = inject(AXPEntityService);\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly entitySelector = inject(AXPEntityDataSelectorService);\n private readonly translationService = inject(AXTranslationService);\n private readonly dialogService = inject(AXDialogService);\n private readonly sessionService = inject(AXPSessionService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(\n input: AXMAddPositionToBusinessUnitInput,\n ): AXPCommandExecuteResultPromise<{ businessUnitId: string; positionId: string }> {\n const businessUnitId = input?.businessUnitId?.trim() ?? '';\n if (!businessUnitId) {\n return { success: false };\n }\n\n const buData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.businessUnit.name)\n .data<string, AXMOrganizationManagementBusinessUnitEntityModel>();\n\n const businessUnit = await buData.byKey(businessUnitId);\n if (!businessUnit?.id) {\n return { success: false };\n }\n\n if (!(await this.businessUnitTypeAllowsDirectPositions(businessUnit))) {\n const text = await this.translationService.translateAsync(\n '@organization-management:organization-chart.commands.add-position.type-not-allowed',\n );\n return { success: false, message: { text } };\n }\n\n const existingIds = this.normalizePositionIds(businessUnit.positionIds);\n const positionEntity = await this.entityRegistry.resolve(\n RootConfig.module.name,\n RootConfig.entities.position.name,\n );\n if (!positionEntity) {\n return { success: false };\n }\n\n const selectTitle = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.select-position',\n );\n\n const selectorResult = await this.entitySelector.open({\n entity: positionEntity,\n title: selectTitle,\n allowMultiple: false,\n columns: ['code', 'title'],\n });\n\n const selected = selectorResult?.items?.[0];\n const rawPositionId = selected?.['id'] ?? selected?.['_id'];\n const positionId = typeof rawPositionId === 'string' && rawPositionId.trim().length > 0 ? rawPositionId : '';\n if (!positionId) {\n return { success: false };\n }\n\n if (existingIds.includes(positionId)) {\n return { success: true, kind: 'object', data: { businessUnitId, positionId } };\n }\n\n const nextPositionIds = [...existingIds, positionId];\n\n try {\n await buData.update(businessUnitId, { positionIds: nextPositionIds });\n } catch {\n return { success: false };\n }\n\n const canAssign = this.sessionService.authorize(AXPPeopleOrganizationPermissionKeys.MaintainOrganization);\n if (canAssign && (await this.confirmAssignEmployee())) {\n await this.commandService.execute(AXM_HCM_POSITION_ASSIGNMENT_ASSIGN_COMMAND, {\n data: {\n businessUnitId,\n positionId,\n isPrimary: false,\n },\n });\n }\n\n return { success: true, kind: 'object', data: { businessUnitId, positionId } };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * Returns false when the business unit type explicitly disallows direct positions; true otherwise.\n */\n private async businessUnitTypeAllowsDirectPositions(\n bu: AXMOrganizationManagementBusinessUnitEntityModel,\n ): Promise<boolean> {\n const nested = bu.type?.allowsDirectPositions;\n if (nested === false) {\n return false;\n }\n if (nested === true) {\n return true;\n }\n const typeId = bu.typeId?.trim();\n if (!typeId) {\n return true;\n }\n try {\n const row = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.businessUnitType.name)\n .data()\n .byKey(typeId);\n return (row as { allowsDirectPositions?: boolean } | null)?.allowsDirectPositions !== false;\n } catch {\n return true;\n }\n }\n\n private normalizePositionIds(value: unknown): string[] {\n if (value == null) {\n return [];\n }\n if (Array.isArray(value)) {\n return value.map((v) => String(v ?? '').trim()).filter((id) => id.length > 0);\n }\n if (typeof value === 'string') {\n return value\n .split(',')\n .map((id) => id.trim())\n .filter((id) => id.length > 0);\n }\n return [];\n }\n\n private async confirmAssignEmployee(): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.assign-employee-confirm.title',\n );\n const message = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.assign-employee-confirm.message',\n );\n const result = await this.dialogService.confirm(title, message, 'primary', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;MA6Ba,mCAAmC,CAAA;AADhD,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC3D,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,4BAA4B,CAAC;AACrD,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA+I5D,IAAA;;;IAzIC,MAAM,OAAO,CACX,KAAwC,EAAA;QAExC,MAAM,cAAc,GAAG,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE;QAC1D,IAAI,CAAC,cAAc,EAAE;AACn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,CAAC,GAAG;iBACT,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE;AACrB,iBAAA,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;QAClC;AACA,QAAA,OAAO,EAAE;IACX;AAEQ,IAAA,MAAM,qBAAqB,GAAA;QACjC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CACxD,wFAAwF,CACzF;QACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAC1D,0FAA0F,CAC3F;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC;AACzG,QAAA,OAAO,MAAM,CAAC,MAAM,KAAK,IAAI;IAC/B;8GAvJW,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mCAAmC,cADtB,MAAM,EAAA,CAAA,CAAA;;2FACnB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAD/C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,127 @@
1
+ import { AXDialogService } from '@acorex/components/dialog';
2
+ import { AXToastService } from '@acorex/components/toast';
3
+ import { AXTranslationService } from '@acorex/core/translation';
4
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
5
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
6
+ import * as i0 from '@angular/core';
7
+ import { inject, Injectable } from '@angular/core';
8
+ import { RootConfig } from '@acorex-platform/module-organization-management-client/contracts';
9
+
10
+ /**
11
+ * Opens **Team** create (`Entity:Create`), then links the new team to the given business unit via **TeamBusinessUnit**
12
+ * (`isPrimary: true`, `effectiveFrom` = today) and optionally navigates to the team record.
13
+ */
14
+ class AXMAddTeamToBusinessUnitCommand {
15
+ constructor() {
16
+ //#region ---- Services & Dependencies ----
17
+ this.commandService = inject(AXPCommandService);
18
+ this.entityService = inject(AXPEntityService);
19
+ this.dialogService = inject(AXDialogService);
20
+ this.toastService = inject(AXToastService);
21
+ this.translationService = inject(AXTranslationService);
22
+ }
23
+ //#endregion
24
+ //#region ---- AXPCommand ----
25
+ async execute(input) {
26
+ const businessUnitId = input?.businessUnitId?.trim() ?? '';
27
+ if (!businessUnitId) {
28
+ return { success: false };
29
+ }
30
+ const createResult = await this.commandService.execute('Entity:Create', {
31
+ entity: RootConfig.entities.team.source,
32
+ entityInfo: {
33
+ module: RootConfig.module.name,
34
+ name: RootConfig.entities.team.name,
35
+ title: RootConfig.entities.team.title,
36
+ },
37
+ data: {},
38
+ options: {
39
+ process: {
40
+ redirect: false,
41
+ },
42
+ },
43
+ });
44
+ if (!createResult?.success) {
45
+ return { success: false };
46
+ }
47
+ const teamId = this.extractCreatedEntityId(createResult.data);
48
+ if (!teamId) {
49
+ return { success: false };
50
+ }
51
+ let linkSucceeded = false;
52
+ try {
53
+ await this.entityService
54
+ .withEntity(RootConfig.module.name, RootConfig.entities.teamBusinessUnit.name)
55
+ .data()
56
+ .create({
57
+ teamId,
58
+ businessUnitId,
59
+ isPrimary: true,
60
+ effectiveFrom: this.todayLocalDateOnly(),
61
+ });
62
+ linkSucceeded = true;
63
+ }
64
+ catch (e) {
65
+ const content = e instanceof Error
66
+ ? e.message
67
+ : await this.translationService.translateAsync('@general:messages.generic.error.description');
68
+ const title = await this.translationService.translateAsync('@general:messages.generic.error.title');
69
+ this.toastService.show({ color: 'warning', title, content });
70
+ }
71
+ if (await this.confirmOpenTeamDetails(linkSucceeded)) {
72
+ await this.commandService.execute('Entity:OpenDetails', {
73
+ entity: RootConfig.entities.team.source,
74
+ data: { id: teamId },
75
+ });
76
+ }
77
+ return { success: true, kind: 'object', data: { teamId } };
78
+ }
79
+ //#endregion
80
+ //#region ---- Helpers ----
81
+ /**
82
+ * Local calendar date as `YYYY-MM-DD` for {@link AXMOrganizationManagementTeamBusinessUnitEntityModel.effectiveFrom}.
83
+ */
84
+ todayLocalDateOnly() {
85
+ const d = new Date();
86
+ const y = d.getFullYear();
87
+ const m = String(d.getMonth() + 1).padStart(2, '0');
88
+ const day = String(d.getDate()).padStart(2, '0');
89
+ return `${y}-${m}-${day}`;
90
+ }
91
+ async confirmOpenTeamDetails(linkSucceeded) {
92
+ const title = await this.translationService.translateAsync('@organization-management:organization-chart.node-actions.navigate-to-team-after-create.title');
93
+ const messageKey = linkSucceeded
94
+ ? '@organization-management:organization-chart.node-actions.navigate-to-team-after-create.message'
95
+ : '@organization-management:organization-chart.node-actions.navigate-to-team-after-create.message-link-failed';
96
+ const message = await this.translationService.translateAsync(messageKey);
97
+ const result = await this.dialogService.confirm(title, message, 'primary', 'horizontal', false, 'cancel');
98
+ return result.result === true;
99
+ }
100
+ extractCreatedEntityId(data) {
101
+ if (data == null || typeof data !== 'object') {
102
+ return '';
103
+ }
104
+ const record = data;
105
+ const item = record['item'] ?? data;
106
+ if (item == null || typeof item !== 'object') {
107
+ return '';
108
+ }
109
+ const id = item['id'];
110
+ if (typeof id === 'string') {
111
+ return id.trim();
112
+ }
113
+ if (typeof id === 'number' && Number.isFinite(id)) {
114
+ return String(id);
115
+ }
116
+ return '';
117
+ }
118
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddTeamToBusinessUnitCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
119
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddTeamToBusinessUnitCommand, providedIn: 'root' }); }
120
+ }
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAddTeamToBusinessUnitCommand, decorators: [{
122
+ type: Injectable,
123
+ args: [{ providedIn: 'root' }]
124
+ }] });
125
+
126
+ export { AXMAddTeamToBusinessUnitCommand };
127
+ //# sourceMappingURL=acorex-platform-module-organization-management-client-add-team-to-business-unit.command-BLQFjhS5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-organization-management-client-add-team-to-business-unit.command-BLQFjhS5.mjs","sources":["../../../../libs/modules/organization-management/client/src/lib/features/organization-chart/commands/add-team-to-business-unit.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport type { AXMOrganizationManagementTeamBusinessUnitEntityModel } from '@acorex-platform/module-organization-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-organization-management-client/contracts';\n\n//#endregion\n\nexport interface AXMAddTeamToBusinessUnitInput {\n businessUnitId: string;\n}\n\nexport interface AXMAddTeamToBusinessUnitResult {\n teamId: string;\n}\n\n/**\n * Opens **Team** create (`Entity:Create`), then links the new team to the given business unit via **TeamBusinessUnit**\n * (`isPrimary: true`, `effectiveFrom` = today) and optionally navigates to the team record.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMAddTeamToBusinessUnitCommand\n implements AXPCommand<AXMAddTeamToBusinessUnitInput, AXMAddTeamToBusinessUnitResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly entityService = inject(AXPEntityService);\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- AXPCommand ----\n\n async execute(\n input: AXMAddTeamToBusinessUnitInput,\n ): AXPCommandExecuteResultPromise<AXMAddTeamToBusinessUnitResult> {\n const businessUnitId = input?.businessUnitId?.trim() ?? '';\n if (!businessUnitId) {\n return { success: false };\n }\n\n const createResult = await this.commandService.execute('Entity:Create', {\n entity: RootConfig.entities.team.source,\n entityInfo: {\n module: RootConfig.module.name,\n name: RootConfig.entities.team.name,\n title: RootConfig.entities.team.title,\n },\n data: {},\n options: {\n process: {\n redirect: false,\n },\n },\n \n });\n\n if (!createResult?.success) {\n return { success: false };\n }\n\n const teamId = this.extractCreatedEntityId(createResult.data);\n if (!teamId) {\n return { success: false };\n }\n\n let linkSucceeded = false;\n try {\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.teamBusinessUnit.name)\n .data<string, AXMOrganizationManagementTeamBusinessUnitEntityModel>()\n .create({\n teamId,\n businessUnitId,\n isPrimary: true,\n effectiveFrom: this.todayLocalDateOnly(),\n });\n linkSucceeded = true;\n } catch (e) {\n const content =\n e instanceof Error\n ? e.message\n : await this.translationService.translateAsync('@general:messages.generic.error.description');\n const title = await this.translationService.translateAsync('@general:messages.generic.error.title');\n this.toastService.show({ color: 'warning', title, content });\n }\n\n if (await this.confirmOpenTeamDetails(linkSucceeded)) {\n await this.commandService.execute('Entity:OpenDetails', {\n entity: RootConfig.entities.team.source,\n data: { id: teamId },\n });\n }\n\n return { success: true, kind: 'object', data: { teamId } };\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * Local calendar date as `YYYY-MM-DD` for {@link AXMOrganizationManagementTeamBusinessUnitEntityModel.effectiveFrom}.\n */\n private todayLocalDateOnly(): string {\n const d = new Date();\n const y = d.getFullYear();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n return `${y}-${m}-${day}`;\n }\n\n private async confirmOpenTeamDetails(linkSucceeded: boolean): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@organization-management:organization-chart.node-actions.navigate-to-team-after-create.title',\n );\n const messageKey = linkSucceeded\n ? '@organization-management:organization-chart.node-actions.navigate-to-team-after-create.message'\n : '@organization-management:organization-chart.node-actions.navigate-to-team-after-create.message-link-failed';\n const message = await this.translationService.translateAsync(messageKey);\n const result = await this.dialogService.confirm(title, message, 'primary', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n private extractCreatedEntityId(data: unknown): string {\n if (data == null || typeof data !== 'object') {\n return '';\n }\n const record = data as Record<string, unknown>;\n const item = record['item'] ?? data;\n if (item == null || typeof item !== 'object') {\n return '';\n }\n const id = (item as Record<string, unknown>)['id'];\n if (typeof id === 'string') {\n return id.trim();\n }\n if (typeof id === 'number' && Number.isFinite(id)) {\n return String(id);\n }\n return '';\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;AAuBA;;;AAGG;MAEU,+BAA+B,CAAA;AAD5C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAqHnE,IAAA;;;IA/GC,MAAM,OAAO,CACX,KAAoC,EAAA;QAEpC,MAAM,cAAc,GAAG,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE;QAC1D,IAAI,CAAC,cAAc,EAAE;AACnB,YAAA,OAAO,EAAE,OAA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