@acorex/modules 21.0.0-next.89 → 21.0.0-next.90
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-common.mjs +9 -9
- package/fesm2022/acorex-modules-common.mjs.map +1 -1
- package/fesm2022/{acorex-modules-conversation-acorex-modules-conversation-B_JcAHvL.mjs → acorex-modules-conversation-acorex-modules-conversation-Dc8te-PO.mjs} +364 -237
- package/fesm2022/acorex-modules-conversation-acorex-modules-conversation-Dc8te-PO.mjs.map +1 -0
- package/fesm2022/{acorex-modules-conversation-after-message-sent.command-DcrS7_vV.mjs → acorex-modules-conversation-after-message-sent.command-DxDe6o9N.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-after-message-sent.command-DcrS7_vV.mjs.map → acorex-modules-conversation-after-message-sent.command-DxDe6o9N.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-assist-delegated-agent-detail-popup.component-BCkJEAmX.mjs → acorex-modules-conversation-assist-delegated-agent-detail-popup.component-Dyx_n0bi.mjs} +3 -3
- package/fesm2022/{acorex-modules-conversation-assist-delegated-agent-detail-popup.component-BCkJEAmX.mjs.map → acorex-modules-conversation-assist-delegated-agent-detail-popup.component-Dyx_n0bi.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-comments-page.component-B6TJhe4T.mjs → acorex-modules-conversation-comments-page.component--g4ugC_L.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-comments-page.component-B6TJhe4T.mjs.map → acorex-modules-conversation-comments-page.component--g4ugC_L.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-emit-typing-indicator.command-CWRdPl-S.mjs → acorex-modules-conversation-emit-typing-indicator.command-BOldPLQ0.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-emit-typing-indicator.command-CWRdPl-S.mjs.map → acorex-modules-conversation-emit-typing-indicator.command-BOldPLQ0.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-mark-conversation-unread.command-CZlsLAsb.mjs → acorex-modules-conversation-mark-conversation-unread.command-O_zPrBQ0.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-mark-conversation-unread.command-CZlsLAsb.mjs.map → acorex-modules-conversation-mark-conversation-unread.command-O_zPrBQ0.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-retry-assist-response.command-Cly1-RKt.mjs → acorex-modules-conversation-retry-assist-response.command-DsB-CP3R.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-retry-assist-response.command-Cly1-RKt.mjs.map → acorex-modules-conversation-retry-assist-response.command-DsB-CP3R.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-send-assist-chat-message.command-D5QWTKqh.mjs → acorex-modules-conversation-send-assist-chat-message.command-g_NgPuxP.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-send-assist-chat-message.command-D5QWTKqh.mjs.map → acorex-modules-conversation-send-assist-chat-message.command-g_NgPuxP.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-start-assist-chat.command-DkSZj8fj.mjs → acorex-modules-conversation-start-assist-chat.command-DeMmJdd6.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-start-assist-chat.command-DkSZj8fj.mjs.map → acorex-modules-conversation-start-assist-chat.command-DeMmJdd6.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-conversation-sync-read-state.command-jiEsdxUB.mjs → acorex-modules-conversation-sync-read-state.command-4YxdwLaE.mjs} +2 -2
- package/fesm2022/{acorex-modules-conversation-sync-read-state.command-jiEsdxUB.mjs.map → acorex-modules-conversation-sync-read-state.command-4YxdwLaE.mjs.map} +1 -1
- package/fesm2022/acorex-modules-conversation.mjs +1 -1
- package/fesm2022/{acorex-modules-dashboard-management-acorex-modules-dashboard-management-DLuhOPFz.mjs → acorex-modules-dashboard-management-acorex-modules-dashboard-management-kph3UxDu.mjs} +94 -41
- package/fesm2022/acorex-modules-dashboard-management-acorex-modules-dashboard-management-kph3UxDu.mjs.map +1 -0
- package/fesm2022/{acorex-modules-dashboard-management-index-gjCiELmH.mjs → acorex-modules-dashboard-management-index-rp9dgARq.mjs} +2 -2
- package/fesm2022/{acorex-modules-dashboard-management-index-gjCiELmH.mjs.map → acorex-modules-dashboard-management-index-rp9dgARq.mjs.map} +1 -1
- package/fesm2022/acorex-modules-dashboard-management.mjs +1 -1
- package/fesm2022/{acorex-modules-document-management-drive-choose.component-DyJoXajP.mjs → acorex-modules-document-management-drive-choose.component-Dx1slMSA.mjs} +3 -3
- package/fesm2022/{acorex-modules-document-management-drive-choose.component-DyJoXajP.mjs.map → acorex-modules-document-management-drive-choose.component-Dx1slMSA.mjs.map} +1 -1
- package/fesm2022/acorex-modules-document-management.mjs +268 -351
- package/fesm2022/acorex-modules-document-management.mjs.map +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-acorex-modules-human-capital-management-VJ2NUSm1.mjs → acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs} +42 -21
- package/fesm2022/acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs.map +1 -0
- package/fesm2022/{acorex-modules-human-capital-management-approve-leave-request.command-FgXkyZR_.mjs → acorex-modules-human-capital-management-approve-leave-request.command-B_EBDijL.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-approve-leave-request.command-FgXkyZR_.mjs.map → acorex-modules-human-capital-management-approve-leave-request.command-B_EBDijL.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-assign-position-assignment.command-D2yCvifI.mjs → acorex-modules-human-capital-management-assign-position-assignment.command-ZzWBeTv1.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-assign-position-assignment.command-D2yCvifI.mjs.map → acorex-modules-human-capital-management-assign-position-assignment.command-ZzWBeTv1.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-cancel-leave-request.command-DnmsVNwU.mjs → acorex-modules-human-capital-management-cancel-leave-request.command-Bd3RvlNm.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-cancel-leave-request.command-DnmsVNwU.mjs.map → acorex-modules-human-capital-management-cancel-leave-request.command-Bd3RvlNm.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-edit-personal-info.command-B0ZUfbqn.mjs → acorex-modules-human-capital-management-edit-personal-info.command-Drbi1WMd.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-edit-personal-info.command-B0ZUfbqn.mjs.map → acorex-modules-human-capital-management-edit-personal-info.command-Drbi1WMd.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-edit-signature.command-h2kTqSg0.mjs → acorex-modules-human-capital-management-edit-signature.command-CRPqnXIj.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-edit-signature.command-h2kTqSg0.mjs.map → acorex-modules-human-capital-management-edit-signature.command-CRPqnXIj.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-reject-leave-request.command-BdrdgvbN.mjs → acorex-modules-human-capital-management-reject-leave-request.command-BC-1Kixd.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-reject-leave-request.command-BdrdgvbN.mjs.map → acorex-modules-human-capital-management-reject-leave-request.command-BC-1Kixd.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-revoke-position-assignment.command-S7Px6Y4B.mjs → acorex-modules-human-capital-management-revoke-position-assignment.command-Caylq9Rv.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-revoke-position-assignment.command-S7Px6Y4B.mjs.map → acorex-modules-human-capital-management-revoke-position-assignment.command-Caylq9Rv.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-start-leave-request-flow.command-C_tE-D_Y.mjs → acorex-modules-human-capital-management-start-leave-request-flow.command-BsEwA1VM.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-start-leave-request-flow.command-C_tE-D_Y.mjs.map → acorex-modules-human-capital-management-start-leave-request-flow.command-BsEwA1VM.mjs.map} +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-start-lifecycle-event-flow.command-mMP3Yy01.mjs → acorex-modules-human-capital-management-start-lifecycle-event-flow.command-B8xK2iTn.mjs} +2 -2
- package/fesm2022/{acorex-modules-human-capital-management-start-lifecycle-event-flow.command-mMP3Yy01.mjs.map → acorex-modules-human-capital-management-start-lifecycle-event-flow.command-B8xK2iTn.mjs.map} +1 -1
- package/fesm2022/acorex-modules-human-capital-management.mjs +1 -1
- package/fesm2022/acorex-modules-platform-dev-tools.mjs +2 -2
- package/fesm2022/acorex-modules-platform-dev-tools.mjs.map +1 -1
- package/fesm2022/acorex-modules-project-management.mjs +707 -424
- package/fesm2022/acorex-modules-project-management.mjs.map +1 -1
- package/fesm2022/acorex-modules-report-management.mjs +1 -1
- package/fesm2022/acorex-modules-report-management.mjs.map +1 -1
- package/fesm2022/acorex-modules-task-management-start-task-flow.command-HYdQOWDe.mjs +115 -0
- package/fesm2022/acorex-modules-task-management-start-task-flow.command-HYdQOWDe.mjs.map +1 -0
- package/fesm2022/{acorex-modules-task-management-task-board.page-DTWxd_vG.mjs → acorex-modules-task-management-task-board.page-BMTjJlry.mjs} +3 -3
- package/fesm2022/{acorex-modules-task-management-task-board.page-DTWxd_vG.mjs.map → acorex-modules-task-management-task-board.page-BMTjJlry.mjs.map} +1 -1
- package/fesm2022/acorex-modules-task-management.mjs +433 -460
- package/fesm2022/acorex-modules-task-management.mjs.map +1 -1
- package/fesm2022/{acorex-modules-timesheet-management-report-hours-by-project.query-z38wZLKJ.mjs → acorex-modules-timesheet-management-report-hours-by-project.query-CGc1Q6aB.mjs} +2 -2
- package/fesm2022/acorex-modules-timesheet-management-report-hours-by-project.query-CGc1Q6aB.mjs.map +1 -0
- package/fesm2022/{acorex-modules-timesheet-management-resolve-work-item-from-jira-issue.command-BDfvz6fH.mjs → acorex-modules-timesheet-management-resolve-work-item-from-jira-issue.command-AIcAUd3s.mjs} +2 -2
- package/fesm2022/{acorex-modules-timesheet-management-resolve-work-item-from-jira-issue.command-BDfvz6fH.mjs.map → acorex-modules-timesheet-management-resolve-work-item-from-jira-issue.command-AIcAUd3s.mjs.map} +1 -1
- package/fesm2022/acorex-modules-timesheet-management.mjs +8 -8
- package/fesm2022/acorex-modules-timesheet-management.mjs.map +1 -1
- package/fesm2022/acorex-modules-workplacesafety-management-control-hierarchy-diagram-widget-edit.component-CFF7X1MO.mjs +70 -0
- package/fesm2022/acorex-modules-workplacesafety-management-control-hierarchy-diagram-widget-edit.component-CFF7X1MO.mjs.map +1 -0
- package/fesm2022/acorex-modules-workplacesafety-management-control-hierarchy-diagram-widget-view.component-DwC2aHVt.mjs +70 -0
- package/fesm2022/acorex-modules-workplacesafety-management-control-hierarchy-diagram-widget-view.component-DwC2aHVt.mjs.map +1 -0
- package/fesm2022/acorex-modules-workplacesafety-management-control-hierarchy-diagram.types-DmzV305e.mjs +195 -0
- package/fesm2022/acorex-modules-workplacesafety-management-control-hierarchy-diagram.types-DmzV305e.mjs.map +1 -0
- package/fesm2022/acorex-modules-workplacesafety-management.mjs +139 -16
- package/fesm2022/acorex-modules-workplacesafety-management.mjs.map +1 -1
- package/package.json +2 -2
- package/types/acorex-modules-dashboard-management.d.ts +30 -11
- package/types/acorex-modules-document-management.d.ts +21 -5
- package/types/acorex-modules-human-capital-management.d.ts +4 -0
- package/types/acorex-modules-project-management.d.ts +46 -23
- package/types/acorex-modules-task-management.d.ts +80 -11
- package/types/acorex-modules-timesheet-management.d.ts +2 -2
- package/types/acorex-modules-workplacesafety-management.d.ts +7 -2
- package/fesm2022/acorex-modules-conversation-acorex-modules-conversation-B_JcAHvL.mjs.map +0 -1
- package/fesm2022/acorex-modules-dashboard-management-acorex-modules-dashboard-management-DLuhOPFz.mjs.map +0 -1
- package/fesm2022/acorex-modules-human-capital-management-acorex-modules-human-capital-management-VJ2NUSm1.mjs.map +0 -1
- package/fesm2022/acorex-modules-timesheet-management-report-hours-by-project.query-z38wZLKJ.mjs.map +0 -1
|
@@ -2,7 +2,7 @@ import { AXPSystemStatuses } from '@acorex/platform/contracts';
|
|
|
2
2
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { inject, Injectable } from '@angular/core';
|
|
5
|
-
import { R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
5
|
+
import { R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
/**
|
|
@@ -56,4 +56,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
56
56
|
}] });
|
|
57
57
|
|
|
58
58
|
export { ApproveLeaveRequestCommand };
|
|
59
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-approve-leave-request.command-
|
|
59
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-approve-leave-request.command-B_EBDijL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-approve-leave-request.command-
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-approve-leave-request.command-B_EBDijL.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/leave-request/commands/approve-leave-request.command.ts"],"sourcesContent":["import { AXPSystemStatuses } from '@acorex/platform/contracts';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '../../../contracts';\n\n//#region ---- Types ----\n\nexport interface ApproveLeaveRequestInput {\n id: string;\n reason?: string;\n note?: string;\n}\n\n//#endregion\n\n/**\n * Approve Leave Request Command\n * Updates the leave request status to Approved\n */\n@Injectable({ providedIn: 'root' })\nexport class ApproveLeaveRequestCommand implements AXPCommand<ApproveLeaveRequestInput, void> {\n //#region ---- Services ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ApproveLeaveRequestInput): Promise<AXPExecuteCommandResult<void>> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data<string, any>();\n\n // Update the leave request status to Approved\n const updateData: any = {\n statusId: AXPSystemStatuses.Approved.name,\n };\n\n // Add reason/note if provided (these fields might not exist in entity model)\n if (input.reason) {\n updateData.reason = input.reason;\n }\n if (input.note) {\n updateData.note = input.note;\n }\n\n await dataAccessor.update(input.id, updateData);\n\n return {\n success: true,\n };\n } catch (error: any) {\n console.error('[ApproveLeaveRequestCommand] Error:', error);\n return {\n success: false,\n message: {\n text: error.message || 'Failed to approve leave request',\n },\n };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAeA;AAEA;;;AAGG;MAEU,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA0C1D,IAAA;;;IApCC,MAAM,OAAO,CAAC,KAA+B,EAAA;AAC3C,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI;AACxE,iBAAA,IAAI,EAAe;;AAGtB,YAAA,MAAM,UAAU,GAAQ;AACtB,gBAAA,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,CAAC,IAAI;aAC1C;;AAGD,YAAA,IAAI,KAAK,CAAC,MAAM,EAAE;AAChB,gBAAA,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;YAClC;AACA,YAAA,IAAI,KAAK,CAAC,IAAI,EAAE;AACd,gBAAA,UAAU,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAC9B;YAEA,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC;YAE/C,OAAO;AACL,gBAAA,OAAO,EAAE,IAAI;aACd;QACH;QAAE,OAAO,KAAU,EAAE;AACnB,YAAA,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC;YAC3D,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI,iCAAiC;AACzD,iBAAA;aACF;QACH;IACF;8GA1CW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,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,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { AXPCommandService } from '@acorex/platform/runtime';
|
|
|
3
3
|
import { AXTranslationService } from '@acorex/core/translation';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import { inject, Injectable } from '@angular/core';
|
|
6
|
-
import { R as RootConfig, A as AXM_POSITION_ASSIGNMENT_STATUS } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
6
|
+
import { R as RootConfig, A as AXM_POSITION_ASSIGNMENT_STATUS } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
7
7
|
|
|
8
8
|
class AXMAssignPositionAssignmentCommand {
|
|
9
9
|
constructor() {
|
|
@@ -87,4 +87,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
87
87
|
}] });
|
|
88
88
|
|
|
89
89
|
export { AXMAssignPositionAssignmentCommand };
|
|
90
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-assign-position-assignment.command-
|
|
90
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-assign-position-assignment.command-ZzWBeTv1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-assign-position-assignment.command-
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-assign-position-assignment.command-ZzWBeTv1.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/organization-chart/commands/assign-position-assignment.command.ts"],"sourcesContent":["import { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPEntityDataSelectorService, AXPEntityDefinitionRegistryService } from '@acorex/platform/layout/entity';\nimport { AXPCommand, AXPCommandService } from '@acorex/platform/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { inject, Injectable } from '@angular/core';\nimport { RootConfig } from '../../../contracts';\nimport { AXM_POSITION_ASSIGNMENT_STATUS } from '../../../contracts';\n\nexport interface AXMAssignPositionAssignmentInput {\n __context__?: {\n data?: Record<string, unknown>;\n };\n data?: Record<string, unknown>;\n employeeId?: string;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXMAssignPositionAssignmentCommand implements AXPCommand<AXMAssignPositionAssignmentInput, unknown> {\n private readonly commandService = inject(AXPCommandService);\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly entitySelector = inject(AXPEntityDataSelectorService);\n private readonly translationService = inject(AXTranslationService);\n\n private readonly positionAssignmentSource = RootConfig.entities.positionAssignment.source;\n private readonly positionAssignmentEntityInfo = {\n module: RootConfig.module.name,\n name: RootConfig.entities.positionAssignment.name,\n title: RootConfig.entities.positionAssignment.title,\n };\n\n async execute(input: AXMAssignPositionAssignmentInput): Promise<AXPExecuteCommandResult<unknown>> {\n const payload = {\n ...((input?.__context__?.data ?? input?.data ?? {}) as Record<string, unknown>),\n };\n const rawEmployeeId = (input?.employeeId ?? payload['employeeId']) as string | undefined;\n const employeeId = rawEmployeeId && rawEmployeeId.trim().length > 0 ? rawEmployeeId : await this.selectEmployeeId();\n if (!employeeId) {\n return { success: false };\n }\n payload['employeeId'] = employeeId;\n payload['statusId'] = this.resolveStatusId(payload['startDate'], payload['endDate']);\n\n return (\n await this.commandService.execute('Entity:Create', {\n __context__: {\n entity: this.positionAssignmentSource,\n entityInfo: this.positionAssignmentEntityInfo,\n data: payload,\n options: {\n process: {\n redirect: false,\n },\n },\n },\n })\n ) ?? { success: false };\n }\n\n private async selectEmployeeId(): Promise<string | undefined> {\n const employeeEntity = await this.entityRegistry.resolve(RootConfig.module.name, RootConfig.entities.employee.name);\n if (!employeeEntity) {\n return undefined;\n }\n\n const title = await this.translationService.translateAsync(\n '@human-capital-management:organization-chart.node-actions.select-employee',\n );\n const result = await this.entitySelector.open({\n entity: employeeEntity,\n title,\n allowMultiple: false,\n columns: ['person.fullName', 'employeeCode'],\n });\n\n const selected = result?.items?.[0];\n const selectedId = selected?.['id'] ?? selected?.['_id'];\n return typeof selectedId === 'string' && selectedId.trim().length > 0 ? selectedId : undefined;\n }\n\n private resolveStatusId(startDate: unknown, endDate: unknown): string {\n const nowTime = Date.now();\n const startTime = this.parseTime(startDate);\n const endTime = this.parseTime(endDate);\n if (endTime !== undefined && endTime <= nowTime) {\n return AXM_POSITION_ASSIGNMENT_STATUS.expired;\n }\n if (startTime !== undefined && startTime > nowTime) {\n return AXM_POSITION_ASSIGNMENT_STATUS.scheduled;\n }\n return AXM_POSITION_ASSIGNMENT_STATUS.active;\n }\n\n private parseTime(value: unknown): number | undefined {\n if (!value) {\n return undefined;\n }\n const dateValue = value instanceof Date ? value : new Date(String(value));\n const time = dateValue.getTime();\n return Number.isFinite(time) ? time : undefined;\n }\n}\n\n"],"names":[],"mappings":";;;;;;;MAiBa,kCAAkC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XPSystemStatuses } from '@acorex/platform/contracts';
|
|
|
2
2
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { inject, Injectable } from '@angular/core';
|
|
5
|
-
import { R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
5
|
+
import { R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
/**
|
|
@@ -56,4 +56,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
56
56
|
}] });
|
|
57
57
|
|
|
58
58
|
export { CancelLeaveRequestCommand };
|
|
59
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-cancel-leave-request.command-
|
|
59
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-cancel-leave-request.command-Bd3RvlNm.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-cancel-leave-request.command-
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-cancel-leave-request.command-Bd3RvlNm.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/leave-request/commands/cancel-leave-request.command.ts"],"sourcesContent":["import { AXPSystemStatuses } from '@acorex/platform/contracts';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '../../../contracts';\n\n//#region ---- Types ----\n\nexport interface CancelLeaveRequestInput {\n id: string;\n reason?: string;\n note?: string;\n}\n\n//#endregion\n\n/**\n * Cancel Leave Request Command\n * Updates the leave request status to Cancelled\n */\n@Injectable({ providedIn: 'root' })\nexport class CancelLeaveRequestCommand implements AXPCommand<CancelLeaveRequestInput, void> {\n //#region ---- Services ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: CancelLeaveRequestInput): Promise<AXPExecuteCommandResult<void>> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data<string, any>();\n\n // Update the leave request status to Cancelled\n const updateData: any = {\n statusId: AXPSystemStatuses.Cancelled.name,\n };\n\n // Add reason/note if provided (these fields might not exist in entity model)\n if (input.reason) {\n updateData.reason = input.reason;\n }\n if (input.note) {\n updateData.note = input.note;\n }\n\n await dataAccessor.update(input.id, updateData);\n\n return {\n success: true,\n };\n } catch (error: any) {\n console.error('[CancelLeaveRequestCommand] Error:', error);\n return {\n success: false,\n message: {\n text: error.message || 'Failed to cancel leave request',\n },\n };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAeA;AAEA;;;AAGG;MAEU,yBAAyB,CAAA;AADtC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA0C1D,IAAA;;;IApCC,MAAM,OAAO,CAAC,KAA8B,EAAA;AAC1C,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI;AACxE,iBAAA,IAAI,EAAe;;AAGtB,YAAA,MAAM,UAAU,GAAQ;AACtB,gBAAA,QAAQ,EAAE,iBAAiB,CAAC,SAAS,CAAC,IAAI;aAC3C;;AAGD,YAAA,IAAI,KAAK,CAAC,MAAM,EAAE;AAChB,gBAAA,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;YAClC;AACA,YAAA,IAAI,KAAK,CAAC,IAAI,EAAE;AACd,gBAAA,UAAU,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAC9B;YAEA,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC;YAE/C,OAAO;AACL,gBAAA,OAAO,EAAE,IAAI;aACd;QACH;QAAE,OAAO,KAAU,EAAE;AACnB,YAAA,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC;YAC1D,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI,gCAAgC;AACxD,iBAAA;aACF;QACH;IACF;8GA1CW,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAzB,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,yBAAyB,cADZ,MAAM,EAAA,CAAA,CAAA;;2FACnB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -7,7 +7,7 @@ import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
8
|
import { inject, Injectable } from '@angular/core';
|
|
9
9
|
import { trim, isNil, isEmpty, cloneDeep, defaultTo, isArray, isString, isObject } from 'lodash-es';
|
|
10
|
-
import { b as AXMHcmProfileContextService } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
10
|
+
import { b as AXMHcmProfileContextService } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
11
11
|
import { AXPUserProfileIdentityService } from '@acorex/modules/auth';
|
|
12
12
|
import { RootConfig } from '@acorex/modules/security-management';
|
|
13
13
|
|
|
@@ -239,4 +239,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
239
239
|
}] });
|
|
240
240
|
|
|
241
241
|
export { AXMHcmEditPersonalInfoCommand };
|
|
242
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-edit-personal-info.command-
|
|
242
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-edit-personal-info.command-Drbi1WMd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-edit-personal-info.command-B0ZUfbqn.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/profile-page/sync-user-from-person.service.ts","../../../../libs/modules/human-capital-management/src/lib/features/profile-page/commands/edit-personal-info.command.ts"],"sourcesContent":["import { AXPUserProfileIdentityService } from '@acorex/modules/auth';\nimport {\n RootConfig as SecurityManagementRootConfig,\n AXMSecurityManagementUsersEntityModel,\n} from '@acorex/modules/security-management';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { Injectable, inject } from '@angular/core';\nimport { trim } from 'lodash-es';\n\n//#region ---- Sync payload ----\n\nexport interface AXMHcmSyncUserFromPersonInput {\n firstName: string;\n lastName: string;\n image?: string;\n}\n\n//#endregion\n\n//#region ---- Sync user from person service ----\n\n/**\n * Keeps the application user record and session display fields aligned with person identity updates.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMHcmSyncUserFromPersonService {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly identityService = inject(AXPUserProfileIdentityService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n async sync(userId: string, person: AXMHcmSyncUserFromPersonInput): Promise<void> {\n const displayName = trim(`${person.firstName} ${person.lastName}`);\n if (!displayName) {\n return;\n }\n\n const userData = this.entityService\n .withEntity(\n SecurityManagementRootConfig.module.name,\n SecurityManagementRootConfig.entities.users.name,\n )\n .data<string, AXMSecurityManagementUsersEntityModel>();\n\n await userData.update(userId, { displayName });\n\n await this.identityService.applySessionPatch({\n title: displayName,\n ...(person.image !== undefined ? { avatar: person.image } : {}),\n });\n }\n\n //#endregion\n}\n\n//#endregion\n","import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPWidgetsList } from '@acorex/platform/contracts';\nimport { RootConfig as PersonCoreRootConfig, AXMPersonCorePersonEntityModel } from '@acorex/modules/person-core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPLayoutBuilderService } from '@acorex/platform/layout/builder';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { cloneDeep, defaultTo, isArray, isEmpty, isNil, isObject, isString, trim } from 'lodash-es';\n\nimport { AXMHcmProfileContextService } from '../profile-context.service';\nimport { AXMHcmSyncUserFromPersonService } from '../sync-user-from-person.service';\n\n//#region ---- Repeater children (aligned with Person entity) ----\n\nconst PHONES_REPEATER_CHILDREN = [\n {\n type: AXPWidgetsList.Editors.ContactBox,\n mode: 'edit' as const,\n options: {\n type: 'phone',\n placeholder: '@person-core:persons.entities.person.fields.phone.placeholder',\n },\n },\n];\n\nconst EMAILS_REPEATER_CHILDREN = [\n {\n type: AXPWidgetsList.Editors.ContactBox,\n mode: 'edit' as const,\n options: {\n type: 'email',\n placeholder: '@person-core:persons.entities.person.fields.email.placeholder',\n },\n },\n];\n\n//#endregion\n\n//#region ---- Form context ----\n\ninterface AXMHcmEditPersonalInfoFormContext {\n firstName: string;\n lastName: string;\n phones: Array<{ value: string; label?: string }>;\n emails: Array<{ value: string; label?: string }>;\n}\n\n//#endregion\n\n//#region ---- Edit personal info command ----\n\n/** Opens a self-service dialog to update the linked person record and sync user display fields. */\n@Injectable({ providedIn: 'root' })\nexport class AXMHcmEditPersonalInfoCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly entityService = inject(AXPEntityService);\n private readonly profileContextService = inject(AXMHcmProfileContextService);\n private readonly syncUserService = inject(AXMHcmSyncUserFromPersonService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): Promise<AXPExecuteCommandResult<void>> {\n const profileContext = await this.profileContextService.resolve();\n if (isNil(profileContext)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.no-employee',\n ),\n },\n };\n }\n\n const personData = this.entityService\n .withEntity(PersonCoreRootConfig.module.name, PersonCoreRootConfig.entities.person.name)\n .data<string, AXMPersonCorePersonEntityModel>();\n\n const person = await personData.byKey(profileContext.personId);\n if (isNil(person)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.person-not-found',\n ),\n },\n };\n }\n\n const dialogTitle = await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPExecuteCommandResult<void>>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('lg')\n .setCloseButton(true)\n .setContext(this.buildFormContext(person))\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@general:terms.contact.first-name', (field) => {\n field.path('firstName');\n field.textBox({\n placeholder: '@general:terms.contact.first-name',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@general:terms.contact.last-name', (field) => {\n field.path('lastName');\n field.textBox({\n placeholder: '@general:terms.contact.last-name',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@person-core:persons.entities.person.groups.phones', (field) => {\n field.path('phones');\n field.customWidget(AXPWidgetsList.Layouts.RepeaterLayout, {\n hasControls: true,\n children: PHONES_REPEATER_CHILDREN,\n });\n })\n .formField('@person-core:persons.entities.person.groups.emails', (field) => {\n field.path('emails');\n field.customWidget(AXPWidgetsList.Layouts.RepeaterLayout, {\n hasControls: true,\n children: EMAILS_REPEATER_CHILDREN,\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@general:actions.save.title');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n\n const form = dialogRef.context() as AXMHcmEditPersonalInfoFormContext;\n const firstName = trim(form.firstName);\n const lastName = trim(form.lastName);\n\n if (isEmpty(firstName) || isEmpty(lastName)) {\n await this.showError(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.required-name',\n );\n throw new Error('First name and last name are required');\n }\n\n dialogRef.setLoading(true);\n try {\n const phones = this.normalizeContactItems(form.phones);\n const emails = this.normalizeContactItems(form.emails);\n\n await personData.update(profileContext.personId, {\n firstName,\n lastName,\n phones,\n emails,\n });\n\n await this.syncUserService.sync(profileContext.userId, {\n firstName,\n lastName,\n image: person.image,\n });\n\n const successTitle = await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return { success: true };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return result ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private buildFormContext(person: AXMPersonCorePersonEntityModel): AXMHcmEditPersonalInfoFormContext {\n return {\n firstName: defaultTo(person.firstName, ''),\n lastName: defaultTo(person.lastName, ''),\n phones: cloneDeep(defaultTo(person.phones, [])),\n emails: cloneDeep(defaultTo(person.emails, [])),\n };\n }\n\n /** Normalizes repeater contact rows to `{ value: string }[]`, matching Person entity storage. */\n private normalizeContactItems(items: unknown): Array<{ value: string }> {\n if (!isArray(items)) {\n return [];\n }\n\n return items\n .map((entry) => this.normalizeContactEntry(entry))\n .filter((entry) => !isEmpty(entry.value));\n }\n\n private normalizeContactEntry(entry: unknown): { value: string } {\n if (isString(entry)) {\n return { value: trim(entry) };\n }\n\n if (!isObject(entry) || isNil(entry)) {\n return { value: '' };\n }\n\n const record = entry as { value?: unknown; label?: string };\n const inner = record.value;\n\n if (isObject(inner) && !isNil(inner) && 'value' in inner) {\n const nested = inner as { value?: unknown };\n return { value: trim(String(nested.value ?? '')) };\n }\n\n return { value: trim(String(record.value ?? '')) };\n }\n\n private async showError(messageKey: string): Promise<void> {\n const content = await this.translateService.translateAsync(messageKey);\n const title = await this.translateService.translateAsync('@general:messages.generic.error.title');\n this.toastService.show({ color: 'danger', title, content, closeButton: true });\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["SecurityManagementRootConfig","PersonCoreRootConfig"],"mappings":";;;;;;;;;;;;;AAiBA;AAEA;AAEA;;AAEG;MAEU,+BAA+B,CAAA;AAD5C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA4BzE,IAAA;;;AAtBC,IAAA,MAAM,IAAI,CAAC,MAAc,EAAE,MAAqC,EAAA;AAC9D,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,SAAS,CAAA,CAAA,EAAI,MAAM,CAAC,QAAQ,CAAA,CAAE,CAAC;QAClE,IAAI,CAAC,WAAW,EAAE;YAChB;QACF;AAEA,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC;AACnB,aAAA,UAAU,CACTA,UAA4B,CAAC,MAAM,CAAC,IAAI,EACxCA,UAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI;AAEjD,aAAA,IAAI,EAAiD;QAExD,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC;AAE9C,QAAA,MAAM,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC;AAC3C,YAAA,KAAK,EAAE,WAAW;YAClB,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,GAAG,EA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,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,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,6BAA6B,cADhB,MAAM,EAAA,CAAA,CAAA;;2FACnB,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-edit-personal-info.command-Drbi1WMd.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/profile-page/sync-user-from-person.service.ts","../../../../libs/modules/human-capital-management/src/lib/features/profile-page/commands/edit-personal-info.command.ts"],"sourcesContent":["import { AXPUserProfileIdentityService } from '@acorex/modules/auth';\nimport {\n RootConfig as SecurityManagementRootConfig,\n AXMSecurityManagementUsersEntityModel,\n} from '@acorex/modules/security-management';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { Injectable, inject } from '@angular/core';\nimport { trim } from 'lodash-es';\n\n//#region ---- Sync payload ----\n\nexport interface AXMHcmSyncUserFromPersonInput {\n firstName: string;\n lastName: string;\n image?: string;\n}\n\n//#endregion\n\n//#region ---- Sync user from person service ----\n\n/**\n * Keeps the application user record and session display fields aligned with person identity updates.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMHcmSyncUserFromPersonService {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly identityService = inject(AXPUserProfileIdentityService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n async sync(userId: string, person: AXMHcmSyncUserFromPersonInput): Promise<void> {\n const displayName = trim(`${person.firstName} ${person.lastName}`);\n if (!displayName) {\n return;\n }\n\n const userData = this.entityService\n .withEntity(\n SecurityManagementRootConfig.module.name,\n SecurityManagementRootConfig.entities.users.name,\n )\n .data<string, AXMSecurityManagementUsersEntityModel>();\n\n await userData.update(userId, { displayName });\n\n await this.identityService.applySessionPatch({\n title: displayName,\n ...(person.image !== undefined ? { avatar: person.image } : {}),\n });\n }\n\n //#endregion\n}\n\n//#endregion\n","import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPWidgetsList } from '@acorex/platform/contracts';\nimport { RootConfig as PersonCoreRootConfig, AXMPersonCorePersonEntityModel } from '@acorex/modules/person-core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPLayoutBuilderService } from '@acorex/platform/layout/builder';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { cloneDeep, defaultTo, isArray, isEmpty, isNil, isObject, isString, trim } from 'lodash-es';\n\nimport { AXMHcmProfileContextService } from '../profile-context.service';\nimport { AXMHcmSyncUserFromPersonService } from '../sync-user-from-person.service';\n\n//#region ---- Repeater children (aligned with Person entity) ----\n\nconst PHONES_REPEATER_CHILDREN = [\n {\n type: AXPWidgetsList.Editors.ContactBox,\n mode: 'edit' as const,\n options: {\n type: 'phone',\n placeholder: '@person-core:persons.entities.person.fields.phone.placeholder',\n },\n },\n];\n\nconst EMAILS_REPEATER_CHILDREN = [\n {\n type: AXPWidgetsList.Editors.ContactBox,\n mode: 'edit' as const,\n options: {\n type: 'email',\n placeholder: '@person-core:persons.entities.person.fields.email.placeholder',\n },\n },\n];\n\n//#endregion\n\n//#region ---- Form context ----\n\ninterface AXMHcmEditPersonalInfoFormContext {\n firstName: string;\n lastName: string;\n phones: Array<{ value: string; label?: string }>;\n emails: Array<{ value: string; label?: string }>;\n}\n\n//#endregion\n\n//#region ---- Edit personal info command ----\n\n/** Opens a self-service dialog to update the linked person record and sync user display fields. */\n@Injectable({ providedIn: 'root' })\nexport class AXMHcmEditPersonalInfoCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly entityService = inject(AXPEntityService);\n private readonly profileContextService = inject(AXMHcmProfileContextService);\n private readonly syncUserService = inject(AXMHcmSyncUserFromPersonService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): Promise<AXPExecuteCommandResult<void>> {\n const profileContext = await this.profileContextService.resolve();\n if (isNil(profileContext)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.no-employee',\n ),\n },\n };\n }\n\n const personData = this.entityService\n .withEntity(PersonCoreRootConfig.module.name, PersonCoreRootConfig.entities.person.name)\n .data<string, AXMPersonCorePersonEntityModel>();\n\n const person = await personData.byKey(profileContext.personId);\n if (isNil(person)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.person-not-found',\n ),\n },\n };\n }\n\n const dialogTitle = await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPExecuteCommandResult<void>>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('lg')\n .setCloseButton(true)\n .setContext(this.buildFormContext(person))\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@general:terms.contact.first-name', (field) => {\n field.path('firstName');\n field.textBox({\n placeholder: '@general:terms.contact.first-name',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@general:terms.contact.last-name', (field) => {\n field.path('lastName');\n field.textBox({\n placeholder: '@general:terms.contact.last-name',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@person-core:persons.entities.person.groups.phones', (field) => {\n field.path('phones');\n field.customWidget(AXPWidgetsList.Layouts.RepeaterLayout, {\n hasControls: true,\n children: PHONES_REPEATER_CHILDREN,\n });\n })\n .formField('@person-core:persons.entities.person.groups.emails', (field) => {\n field.path('emails');\n field.customWidget(AXPWidgetsList.Layouts.RepeaterLayout, {\n hasControls: true,\n children: EMAILS_REPEATER_CHILDREN,\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@general:actions.save.title');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n\n const form = dialogRef.context() as AXMHcmEditPersonalInfoFormContext;\n const firstName = trim(form.firstName);\n const lastName = trim(form.lastName);\n\n if (isEmpty(firstName) || isEmpty(lastName)) {\n await this.showError(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.required-name',\n );\n throw new Error('First name and last name are required');\n }\n\n dialogRef.setLoading(true);\n try {\n const phones = this.normalizeContactItems(form.phones);\n const emails = this.normalizeContactItems(form.emails);\n\n await personData.update(profileContext.personId, {\n firstName,\n lastName,\n phones,\n emails,\n });\n\n await this.syncUserService.sync(profileContext.userId, {\n firstName,\n lastName,\n image: person.image,\n });\n\n const successTitle = await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-personal-info.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return { success: true };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return result ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private buildFormContext(person: AXMPersonCorePersonEntityModel): AXMHcmEditPersonalInfoFormContext {\n return {\n firstName: defaultTo(person.firstName, ''),\n lastName: defaultTo(person.lastName, ''),\n phones: cloneDeep(defaultTo(person.phones, [])),\n emails: cloneDeep(defaultTo(person.emails, [])),\n };\n }\n\n /** Normalizes repeater contact rows to `{ value: string }[]`, matching Person entity storage. */\n private normalizeContactItems(items: unknown): Array<{ value: string }> {\n if (!isArray(items)) {\n return [];\n }\n\n return items\n .map((entry) => this.normalizeContactEntry(entry))\n .filter((entry) => !isEmpty(entry.value));\n }\n\n private normalizeContactEntry(entry: unknown): { value: string } {\n if (isString(entry)) {\n return { value: trim(entry) };\n }\n\n if (!isObject(entry) || isNil(entry)) {\n return { value: '' };\n }\n\n const record = entry as { value?: unknown; label?: string };\n const inner = record.value;\n\n if (isObject(inner) && !isNil(inner) && 'value' in inner) {\n const nested = inner as { value?: unknown };\n return { value: trim(String(nested.value ?? '')) };\n }\n\n return { value: trim(String(record.value ?? '')) };\n }\n\n private async showError(messageKey: string): Promise<void> {\n const content = await this.translateService.translateAsync(messageKey);\n const title = await this.translateService.translateAsync('@general:messages.generic.error.title');\n this.toastService.show({ color: 'danger', title, content, closeButton: true });\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["SecurityManagementRootConfig","PersonCoreRootConfig"],"mappings":";;;;;;;;;;;;;AAiBA;AAEA;AAEA;;AAEG;MAEU,+BAA+B,CAAA;AAD5C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA4BzE,IAAA;;;AAtBC,IAAA,MAAM,IAAI,CAAC,MAAc,EAAE,MAAqC,EAAA;AAC9D,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,SAAS,CAAA,CAAA,EAAI,MAAM,CAAC,QAAQ,CAAA,CAAE,CAAC;QAClE,IAAI,CAAC,WAAW,EAAE;YAChB;QACF;AAEA,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC;AACnB,aAAA,UAAU,CACTA,UAA4B,CAAC,MAAM,CAAC,IAAI,EACxCA,UAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI;AAEjD,aAAA,IAAI,EAAiD;QAExD,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC;AAE9C,QAAA,MAAM,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC;AAC3C,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AAE,CAAC;IAChF;8GAhMW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,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,6BAA6B,cADhB,MAAM,EAAA,CAAA,CAAA;;2FACnB,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -5,7 +5,7 @@ import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { inject, Injectable } from '@angular/core';
|
|
7
7
|
import { isNil, defaultTo, isEmpty, trim } from 'lodash-es';
|
|
8
|
-
import { b as AXMHcmProfileContextService, R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
8
|
+
import { b as AXMHcmProfileContextService, R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
9
9
|
|
|
10
10
|
//#region ---- Edit signature command ----
|
|
11
11
|
/** Opens the shared signature editor for the current employee record. */
|
|
@@ -72,4 +72,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
72
72
|
}] });
|
|
73
73
|
|
|
74
74
|
export { AXMHcmEditSignatureCommand };
|
|
75
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-edit-signature.command-
|
|
75
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-edit-signature.command-CRPqnXIj.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-edit-signature.command-
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-edit-signature.command-CRPqnXIj.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/profile-page/commands/edit-signature.command.ts"],"sourcesContent":["import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPSignatureEditorService } from '@acorex/platform/layout/components';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, isEmpty, isNil, trim } from 'lodash-es';\n\nimport { RootConfig } from '../../../contracts';\nimport { AXMHumanCapitalManagementEmployeeEntityModel } from '../../../entities/employee/employee.types';\nimport { AXMHcmProfileContextService } from '../profile-context.service';\n\n//#region ---- Edit signature command ----\n\n/** Opens the shared signature editor for the current employee record. */\n@Injectable({ providedIn: 'root' })\nexport class AXMHcmEditSignatureCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly signatureEditorService = inject(AXPSignatureEditorService);\n private readonly entityService = inject(AXPEntityService);\n private readonly profileContextService = inject(AXMHcmProfileContextService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): Promise<AXPExecuteCommandResult<void>> {\n const profileContext = await this.profileContextService.resolve();\n if (isNil(profileContext)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-signature.messages.no-employee',\n ),\n },\n };\n }\n\n const employeeData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.employee.name)\n .data<string, AXMHumanCapitalManagementEmployeeEntityModel>();\n\n const employee = await employeeData.byKey(profileContext.employeeId);\n if (isNil(employee)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-signature.messages.employee-not-found',\n ),\n },\n };\n }\n\n const existingSignature = defaultTo(employee.signature, '');\n const submitActionKey = isEmpty(existingSignature)\n ? '@general:actions.save.title'\n : '@general:actions.update.title';\n\n const dialogTitle = await this.translateService.translateAsync(\n '@human-capital-management:profile-page.commands.edit-signature.dialog.title',\n );\n\n const result = await this.signatureEditorService.open({\n title: dialogTitle,\n value: existingSignature,\n submitActionKey,\n });\n\n if (result.action === 'cancel') {\n return { success: false };\n }\n\n const signature = trim(defaultTo(result.value, ''));\n await employeeData.update(profileContext.employeeId, { signature });\n\n const successTitle = await this.translateService.translateAsync(\n isEmpty(signature)\n ? '@human-capital-management:profile-page.commands.edit-signature.messages.removed'\n : '@human-capital-management:profile-page.commands.edit-signature.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n return { success: true };\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAaA;AAEA;MAEa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,sBAAsB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AAC1D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAC3D,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAmEjE,IAAA;;;AA7DC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE;AACjE,QAAA,IAAI,KAAK,CAAC,cAAc,CAAC,EAAE;YACzB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAC9C,qFAAqF,CACtF;AACF,iBAAA;aACF;QACH;AAEA,QAAA,MAAM,YAAY,GAAG,IAAI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,cAAE;cACA,iFAAiF,CACtF;AACD,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;AACjE,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B;8GAvEW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,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,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { AXPSystemStatuses } from '@acorex/platform/contracts';
|
|
|
2
2
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { inject, Injectable } from '@angular/core';
|
|
5
|
-
import { R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
5
|
+
import { R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
/**
|
|
@@ -59,4 +59,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
59
59
|
}] });
|
|
60
60
|
|
|
61
61
|
export { RejectLeaveRequestCommand };
|
|
62
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-reject-leave-request.command-
|
|
62
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-reject-leave-request.command-BC-1Kixd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-reject-leave-request.command-
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-reject-leave-request.command-BC-1Kixd.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/leave-request/commands/reject-leave-request.command.ts"],"sourcesContent":["import { AXPSystemStatuses } from '@acorex/platform/contracts';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '../../../contracts';\n\n//#region ---- Types ----\n\nexport interface RejectLeaveRequestInput {\n id: string;\n reason?: string;\n note?: string;\n}\n\n//#endregion\n\n/**\n * Reject Leave Request Command\n * Updates the leave request status to Rejected\n */\n@Injectable({ providedIn: 'root' })\nexport class RejectLeaveRequestCommand implements AXPCommand<RejectLeaveRequestInput, void> {\n //#region ---- Services ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: RejectLeaveRequestInput): Promise<AXPExecuteCommandResult<void>> {\n try {\n console.log('[RejectLeaveRequestCommand] Executing with input:', input);\n\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data<string, any>();\n\n // Update the leave request status to Rejected\n const updateData: any = {\n statusId: AXPSystemStatuses.Rejected.name,\n };\n\n // Add reason/note if provided (these fields might not exist in entity model)\n if (input.reason) {\n updateData.reason = input.reason;\n }\n if (input.note) {\n updateData.note = input.note;\n }\n\n console.log('[RejectLeaveRequestCommand] Updating entity with:', updateData);\n\n await dataAccessor.update(input.id, updateData);\n\n console.log('[RejectLeaveRequestCommand] Update successful');\n\n return {\n success: true,\n };\n } catch (error: any) {\n console.error('[RejectLeaveRequestCommand] Error:', error);\n return {\n success: false,\n message: {\n text: error.message || 'Failed to reject leave request',\n },\n };\n }\n }\n\n //#endregion\n}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A;aACF;QACH;IACF;8GAhDW,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAzB,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,yBAAyB,cADZ,MAAM,EAAA,CAAA,CAAA;;2FACnB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { AXTranslationService } from '@acorex/core/translation';
|
|
|
3
3
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import { inject, Injectable } from '@angular/core';
|
|
6
|
-
import { A as AXM_POSITION_ASSIGNMENT_STATUS, R as RootConfig, a as AXM_POSITION_ASSIGNMENT_OVERLAPPING_STATUS_IDS } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
6
|
+
import { A as AXM_POSITION_ASSIGNMENT_STATUS, R as RootConfig, a as AXM_POSITION_ASSIGNMENT_OVERLAPPING_STATUS_IDS } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
7
7
|
|
|
8
8
|
class AXMRevokePositionAssignmentByIdCommand {
|
|
9
9
|
constructor() {
|
|
@@ -105,4 +105,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
105
105
|
}] });
|
|
106
106
|
|
|
107
107
|
export { AXMRevokePositionAssignmentByIdCommand };
|
|
108
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-revoke-position-assignment.command-
|
|
108
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-revoke-position-assignment.command-Caylq9Rv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-revoke-position-assignment.command-
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-revoke-position-assignment.command-Caylq9Rv.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/organization-chart/commands/revoke-position-assignment.command.ts"],"sourcesContent":["import { AXDataSourceFilterOption } from '@acorex/cdk/common';\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { RootConfig } from '../../../contracts';\nimport {\n AXM_POSITION_ASSIGNMENT_OVERLAPPING_STATUS_IDS,\n AXM_POSITION_ASSIGNMENT_STATUS,\n} from '../../../contracts';\n\nexport interface AXMRevokePositionAssignmentByIdInput {\n __context__?: {\n data?: unknown;\n };\n data?: unknown;\n id?: unknown;\n positionId?: string;\n employeeId?: string;\n businessUnitId?: string;\n /** When true, do not show the revoke confirmation (caller already confirmed). */\n skipConfirmation?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXMRevokePositionAssignmentByIdCommand\n implements AXPCommand<AXMRevokePositionAssignmentByIdInput, { revokedCount: number }>\n{\n private readonly dialogService = inject(AXDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly entityService = inject(AXPEntityService);\n\n async execute(\n input: AXMRevokePositionAssignmentByIdInput,\n ): Promise<AXPExecuteCommandResult<{ revokedCount: number }>> {\n let ids = this.extractIds(input);\n if (!ids.length && input.positionId && input.employeeId) {\n ids = await this.findOverlappingLifecycleAssignmentIds(\n input.positionId,\n input.employeeId,\n input.businessUnitId,\n );\n }\n if (!ids.length) {\n if (input.skipConfirmation) {\n return { success: true, data: { revokedCount: 0 } };\n }\n return { success: false };\n }\n\n if (!input.skipConfirmation) {\n const confirmed = await this.confirmRevoke();\n if (!confirmed) {\n return { success: false };\n }\n }\n\n const payload: Record<string, unknown> = {\n endDate: new Date().toISOString(),\n statusId: AXM_POSITION_ASSIGNMENT_STATUS.revoked,\n };\n const data = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.positionAssignment.name)\n .data();\n for (const id of ids) {\n await data.update(id, payload as never);\n }\n\n return { success: true, data: { revokedCount: ids.length } };\n }\n\n private async confirmRevoke(): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@human-capital-management:position-assignments.entities.position-assignment.actions.revoke.confirm.title',\n );\n const message = await this.translationService.translateAsync(\n '@human-capital-management:position-assignments.entities.position-assignment.actions.revoke.confirm.message',\n );\n const result = await this.dialogService.confirm(title, message, 'danger', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n private extractIds(input: AXMRevokePositionAssignmentByIdInput): string[] {\n const raw = input?.__context__?.data ?? input?.data ?? input?.id ?? input;\n const values = Array.isArray(raw) ? raw : [raw];\n return values\n .map((value) => {\n if (typeof value === 'string') {\n return value;\n }\n if (value && typeof value === 'object') {\n const id = (value as { id?: unknown })['id'];\n return typeof id === 'string' ? id : '';\n }\n return '';\n })\n .filter((id) => id.trim().length > 0);\n }\n\n /**\n * Resolves assignment rows that still participate in overlap checks (active + scheduled).\n * Revoking only `active` left future-dated `scheduled` rows and blocked new assignments.\n */\n private async findOverlappingLifecycleAssignmentIds(\n positionId: string,\n employeeId: string,\n businessUnitId?: string,\n ): Promise<string[]> {\n const filters: AXDataSourceFilterOption[] = [\n { field: 'positionId', operator: { type: 'equal' }, value: positionId },\n { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },\n { field: 'statusId', operator: { type: 'in' }, value: [...AXM_POSITION_ASSIGNMENT_OVERLAPPING_STATUS_IDS] },\n ];\n if (businessUnitId) {\n filters.push({ field: 'businessUnitId', operator: { type: 'equal' }, value: businessUnitId });\n }\n\n const result = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.positionAssignment.name)\n .data()\n .query({\n skip: 0,\n take: 50,\n sort: [{ field: 'startDate', dir: 'desc' }],\n filter: { logic: 'and', filters },\n });\n\n const items = (result.items ?? []) as Array<{ id?: string }>;\n const seen = new Set<string>();\n const ids: string[] = [];\n for (const item of items) {\n const id = typeof item.id === 'string' && item.id.trim().length > 0 ? item.id.trim() : '';\n if (id && !seen.has(id)) {\n seen.add(id);\n ids.push(id);\n }\n }\n return ids;\n }\n}\n\n"],"names":[],"mappings":";;;;;;;MA2Ba,sCAAsC,CAAA;AADnD,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA6G1D,IAAA;IA3GC,MAAM,OAAO,CACX,KAA2C,EAAA;QAE3C,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;AAChC,QAAA,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE;AACvD,YAAA,GAAG,GAAG,MAAM,IAAI,CAAC,qCAAqC,CACpD,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,cAAc,CACrB;QACH;AACA,QAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;AACf,YAAA,IAAI,KAAK,CAAC,gBAAgB,EAAE;AAC1B,gBAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE;YACrD;AACA,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;AAEA,QAAA,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;AAC3B,YAAA,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,a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EAAA,IAAA,EAAA,sCAAsC,cADzB,MAAM,EAAA,CAAA,CAAA;;2FACnB,sCAAsC,EAAA,UAAA,EAAA,CAAA;kBADlD,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -6,7 +6,7 @@ import { AXPEntityService, AXPEntityStorageService, getRecordWorkflowInstanceId
|
|
|
6
6
|
import { AXPWorkflowManager, AXP_WORKFLOW_ENGINE } from '@acorex/platform/workflow';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
8
|
import { inject, Injectable } from '@angular/core';
|
|
9
|
-
import { R as RootConfig, d as AXMLeaveRequestOpenStatusIds } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
9
|
+
import { R as RootConfig, d as AXMLeaveRequestOpenStatusIds } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
10
10
|
|
|
11
11
|
//#region ---- Imports ----
|
|
12
12
|
//#endregion
|
|
@@ -239,4 +239,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
239
239
|
}] });
|
|
240
240
|
|
|
241
241
|
export { StartLeaveRequestFlowCommand };
|
|
242
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-start-leave-request-flow.command-
|
|
242
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-start-leave-request-flow.command-BsEwA1VM.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-modules-human-capital-management-start-leave-request-flow.command-C_tE-D_Y.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/leave-request/commands/start-leave-request-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXMultiLanguageString, AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSystemStatusType } from '@acorex/platform/contracts';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport {\n AXPEntityService,\n AXPEntityStorageService,\n getRecordWorkflowInstanceId,\n} from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport {\n AXP_WORKFLOW_ENGINE,\n AXPWorkflowEngine,\n AXPWorkflowManager,\n} from '@acorex/platform/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { RootConfig } from '../../../contracts';\nimport { AXMLeaveRequestOpenStatusIds } from '../../../contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface StartLeaveRequestFlowInput {\n __context__?: {\n options?: StartLeaveRequestFlowOptions;\n };\n workflowId?: string;\n employeeId?: string;\n employeeDisplayName?: string;\n leaveTypeId?: string;\n leaveTypeTitle?: AXMultiLanguageString | string;\n}\n\nexport interface StartLeaveRequestFlowOptions {\n workflowId: string;\n input: {\n employeeId?: string;\n employeeDisplayName?: string;\n leaveTypeId: string;\n leaveTypeTitle?: AXMultiLanguageString | string;\n };\n}\n\ninterface OpenLeaveRequestRow {\n id: string;\n workflowInfo?: { instanceId?: string | null; correlationId?: string | null };\n leaveType?: { title?: AXMultiLanguageString | string };\n}\n\n//#endregion\n\n/**\n * Starts the leave request workflow after ensuring at most one pending request per employee and leave type.\n */\n@Injectable({ providedIn: 'root' })\nexport class StartLeaveRequestFlowCommand implements AXPCommand<StartLeaveRequestFlowInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly dialogService = inject(AXDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly entityService = inject(AXPEntityService);\n private readonly entityStorageService = inject(AXPEntityStorageService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE, { optional: true });\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartLeaveRequestFlowInput): Promise<AXPExecuteCommandResult<void>> {\n const options = (input?.__context__?.options ?? input) as StartLeaveRequestFlowOptions;\n const flowInput = options.input;\n const workflowId = options.workflowId?.trim();\n const leaveTypeId = flowInput?.leaveTypeId?.trim();\n const employeeId = this.resolveFlowText(flowInput?.employeeId);\n const employeeDisplayName = this.resolveFlowText(flowInput?.employeeDisplayName);\n const leaveTypeTitleForWorkflow = this.coerceLeaveTypeTitleForWorkflow(flowInput?.leaveTypeTitle);\n const leaveTypeTitleDisplay = this.resolveFlowText(flowInput?.leaveTypeTitle);\n\n if (!workflowId || !leaveTypeId) {\n return { success: false, message: { text: 'Missing workflow or leave type context.' } };\n }\n\n try {\n const openRequests = employeeId\n ? await this.findOpenLeaveRequests(employeeId, leaveTypeId)\n : [];\n const orphanInstanceIds = employeeId\n ? await this.findOrphanRunningWorkflowInstanceIds(\n employeeId,\n leaveTypeId,\n workflowId,\n openRequests,\n )\n : [];\n\n if (openRequests.length > 0 || orphanInstanceIds.length > 0) {\n const confirmed = await this.confirmReplace(leaveTypeTitleDisplay);\n if (!confirmed) {\n return { success: false };\n }\n await this.closeOpenRuns(openRequests, orphanInstanceIds);\n }\n\n const correlationId = employeeId\n ? this.buildCorrelationId(employeeId, leaveTypeId, workflowId)\n : undefined;\n\n const startResult = await this.workflowManager.start(workflowId, {\n leaveTypeId,\n ...(leaveTypeTitleForWorkflow != null ? { leaveTypeTitle: leaveTypeTitleForWorkflow } : {}),\n ...(employeeId ? { employeeId, employeeDisplayName } : {}),\n ...(employeeId\n ? {\n refId: employeeId,\n refType: `${RootConfig.module.name}.Employee`,\n correlationId,\n }\n : {}),\n });\n\n if (!startResult.success) {\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Failed',\n content: startResult.error ?? 'Unknown error',\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: startResult.error ?? 'Unknown error' } };\n }\n\n return { success: true };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('[StartLeaveRequestFlowCommand]', error);\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Error',\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Open-run detection ----\n\n private async findOpenLeaveRequests(\n employeeId: string,\n leaveTypeId: string,\n ): Promise<OpenLeaveRequestRow[]> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data()\n .query({\n skip: 0,\n take: 10,\n filter: {\n logic: 'and',\n filters: [\n { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },\n { field: 'leaveTypeId', operator: { type: 'equal' }, value: leaveTypeId },\n {\n field: 'statusId',\n operator: { type: 'in' },\n value: [...AXMLeaveRequestOpenStatusIds],\n },\n ],\n },\n });\n\n return (page.items ?? []) as OpenLeaveRequestRow[];\n }\n\n private async findOrphanRunningWorkflowInstanceIds(\n employeeId: string,\n leaveTypeId: string,\n workflowId: string,\n openRequests: OpenLeaveRequestRow[],\n ): Promise<string[]> {\n const linkedInstanceIds = new Set(\n openRequests\n .map((row) => getRecordWorkflowInstanceId(row))\n .filter((id): id is string => !!id),\n );\n\n try {\n const page = await this.entityStorageService.query('WorkflowManagement.WorkflowInstance', {\n skip: 0,\n take: 50,\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'definitionId',\n operator: { type: 'equal' },\n value: workflowId,\n },\n { field: 'status', operator: { type: 'equal' }, value: 'Running' },\n ],\n },\n });\n\n const items = (page.items ?? []) as Array<{\n id?: string;\n workflowInstance?: { workflowState?: { input?: Record<string, unknown> } };\n }>;\n\n return items\n .filter((row) => {\n const id = row.id?.trim();\n if (!id || linkedInstanceIds.has(id)) {\n return false;\n }\n const runInput = row.workflowInstance?.workflowState?.input ?? {};\n return runInput['employeeId'] === employeeId && runInput['leaveTypeId'] === leaveTypeId;\n })\n .map((row) => row.id as string);\n } catch {\n return [];\n }\n }\n\n //#endregion\n\n //#region ---- Close and replace ----\n\n private async confirmReplace(leaveTypeTitle: string | undefined): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@human-capital-management:leave-requests.messages.replace-open.confirm.title',\n );\n const message = await this.translationService.translateAsync(\n '@human-capital-management:leave-requests.messages.replace-open.confirm.message',\n {\n params: {\n leaveTypeTitle: String(leaveTypeTitle ?? '').trim() || '—',\n },\n },\n );\n const result = await this.dialogService.confirm(title, message, 'warning', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n private async closeOpenRuns(\n openRequests: OpenLeaveRequestRow[],\n orphanInstanceIds: string[],\n ): Promise<void> {\n const data = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data();\n\n const supersedeNote = 'Closed to start a new leave request run.';\n\n for (const request of openRequests) {\n await data.update(request.id, {\n statusId: AXPSystemStatusType.Cancelled,\n reason: supersedeNote,\n } as never);\n\n const instanceId = getRecordWorkflowInstanceId(request);\n if (instanceId) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n for (const instanceId of orphanInstanceIds) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n private async cancelWorkflowInstance(instanceId: string): Promise<void> {\n const engine = this.workflowEngine as AXPWorkflowEngine | null;\n if (engine?.cancelInstance) {\n await engine.cancelInstance(instanceId, 'superseded');\n return;\n }\n\n const now = new Date().toISOString();\n try {\n await this.entityStorageService.updateOne('WorkflowManagement.WorkflowInstance', instanceId, {\n status: 'Finished',\n subStatus: 'Cancelled',\n finishedAt: now,\n updatedAt: now,\n });\n } catch (error: unknown) {\n console.warn('[StartLeaveRequestFlowCommand] Failed to cancel workflow instance:', instanceId, error);\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveFlowText(value: unknown): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value).trim();\n }\n return resolveMultiLanguageString(value as never, this.translationService.getActiveLang()).trim();\n }\n\n /** Preserves multi-language leave type titles on the workflow instance for locale-aware task labels. */\n private coerceLeaveTypeTitleForWorkflow(\n value: AXMultiLanguageString | string | undefined,\n ): AXMultiLanguageString | string | undefined {\n if (value == null) {\n return undefined;\n }\n if (typeof value === 'object') {\n return value;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n }\n\n private buildCorrelationId(employeeId: string, leaveTypeId: string, workflowId: string): string {\n return `${RootConfig.module.name}.Employee:${employeeId}:${leaveTypeId}:${workflowId}`;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AAqDA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC;AACtD,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;QAC5C,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AA2QlF,IAAA;;;IArQC,MAAM,OAAO,CAAC,KAAiC,EAAA;QAC7C,MAAM,OAAO,IAAI,KAAK,EAAE,WAAW,EAAE,OAAO,IAAI,KAAK,CAAiC;AACtF,QAAA,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK;QAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE;QAC7C,MAAM,WAAW,GAAG,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE;QAClD,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC;QAC9D,MAAM,mBAAmB,GAAG,IAAI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AAA,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,SAAS;IACjD;AAEQ,IAAA,kBAAkB,CAAC,UAAkB,EAAE,WAAmB,EAAE,UAAkB,EAAA;AACpF,QAAA,OAAO,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,UAAA,EAAa,UAAU,CAAA,CAAA,EAAI,WAAW,CAAA,CAAA,EAAI,UAAU,EAAE;IACxF;8GAjRW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,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,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-modules-human-capital-management-start-leave-request-flow.command-BsEwA1VM.mjs","sources":["../../../../libs/modules/human-capital-management/src/lib/features/leave-request/commands/start-leave-request-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXMultiLanguageString, AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSystemStatusType } from '@acorex/platform/contracts';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport {\n AXPEntityService,\n AXPEntityStorageService,\n getRecordWorkflowInstanceId,\n} from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport {\n AXP_WORKFLOW_ENGINE,\n AXPWorkflowEngine,\n AXPWorkflowManager,\n} from '@acorex/platform/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { RootConfig } from '../../../contracts';\nimport { AXMLeaveRequestOpenStatusIds } from '../../../contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface StartLeaveRequestFlowInput {\n __context__?: {\n options?: StartLeaveRequestFlowOptions;\n };\n workflowId?: string;\n employeeId?: string;\n employeeDisplayName?: string;\n leaveTypeId?: string;\n leaveTypeTitle?: AXMultiLanguageString | string;\n}\n\nexport interface StartLeaveRequestFlowOptions {\n workflowId: string;\n input: {\n employeeId?: string;\n employeeDisplayName?: string;\n leaveTypeId: string;\n leaveTypeTitle?: AXMultiLanguageString | string;\n };\n}\n\ninterface OpenLeaveRequestRow {\n id: string;\n workflowInfo?: { instanceId?: string | null; correlationId?: string | null };\n leaveType?: { title?: AXMultiLanguageString | string };\n}\n\n//#endregion\n\n/**\n * Starts the leave request workflow after ensuring at most one pending request per employee and leave type.\n */\n@Injectable({ providedIn: 'root' })\nexport class StartLeaveRequestFlowCommand implements AXPCommand<StartLeaveRequestFlowInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly dialogService = inject(AXDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly entityService = inject(AXPEntityService);\n private readonly entityStorageService = inject(AXPEntityStorageService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE, { optional: true });\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartLeaveRequestFlowInput): Promise<AXPExecuteCommandResult<void>> {\n const options = (input?.__context__?.options ?? input) as StartLeaveRequestFlowOptions;\n const flowInput = options.input;\n const workflowId = options.workflowId?.trim();\n const leaveTypeId = flowInput?.leaveTypeId?.trim();\n const employeeId = this.resolveFlowText(flowInput?.employeeId);\n const employeeDisplayName = this.resolveFlowText(flowInput?.employeeDisplayName);\n const leaveTypeTitleForWorkflow = this.coerceLeaveTypeTitleForWorkflow(flowInput?.leaveTypeTitle);\n const leaveTypeTitleDisplay = this.resolveFlowText(flowInput?.leaveTypeTitle);\n\n if (!workflowId || !leaveTypeId) {\n return { success: false, message: { text: 'Missing workflow or leave type context.' } };\n }\n\n try {\n const openRequests = employeeId\n ? await this.findOpenLeaveRequests(employeeId, leaveTypeId)\n : [];\n const orphanInstanceIds = employeeId\n ? await this.findOrphanRunningWorkflowInstanceIds(\n employeeId,\n leaveTypeId,\n workflowId,\n openRequests,\n )\n : [];\n\n if (openRequests.length > 0 || orphanInstanceIds.length > 0) {\n const confirmed = await this.confirmReplace(leaveTypeTitleDisplay);\n if (!confirmed) {\n return { success: false };\n }\n await this.closeOpenRuns(openRequests, orphanInstanceIds);\n }\n\n const correlationId = employeeId\n ? this.buildCorrelationId(employeeId, leaveTypeId, workflowId)\n : undefined;\n\n const startResult = await this.workflowManager.start(workflowId, {\n leaveTypeId,\n ...(leaveTypeTitleForWorkflow != null ? { leaveTypeTitle: leaveTypeTitleForWorkflow } : {}),\n ...(employeeId ? { employeeId, employeeDisplayName } : {}),\n ...(employeeId\n ? {\n refId: employeeId,\n refType: `${RootConfig.module.name}.Employee`,\n correlationId,\n }\n : {}),\n });\n\n if (!startResult.success) {\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Failed',\n content: startResult.error ?? 'Unknown error',\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: startResult.error ?? 'Unknown error' } };\n }\n\n return { success: true };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('[StartLeaveRequestFlowCommand]', error);\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Error',\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Open-run detection ----\n\n private async findOpenLeaveRequests(\n employeeId: string,\n leaveTypeId: string,\n ): Promise<OpenLeaveRequestRow[]> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data()\n .query({\n skip: 0,\n take: 10,\n filter: {\n logic: 'and',\n filters: [\n { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },\n { field: 'leaveTypeId', operator: { type: 'equal' }, value: leaveTypeId },\n {\n field: 'statusId',\n operator: { type: 'in' },\n value: [...AXMLeaveRequestOpenStatusIds],\n },\n ],\n },\n });\n\n return (page.items ?? []) as OpenLeaveRequestRow[];\n }\n\n private async findOrphanRunningWorkflowInstanceIds(\n employeeId: string,\n leaveTypeId: string,\n workflowId: string,\n openRequests: OpenLeaveRequestRow[],\n ): Promise<string[]> {\n const linkedInstanceIds = new Set(\n openRequests\n .map((row) => getRecordWorkflowInstanceId(row))\n .filter((id): id is string => !!id),\n );\n\n try {\n const page = await this.entityStorageService.query('WorkflowManagement.WorkflowInstance', {\n skip: 0,\n take: 50,\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'definitionId',\n operator: { type: 'equal' },\n value: workflowId,\n },\n { field: 'status', operator: { type: 'equal' }, value: 'Running' },\n ],\n },\n });\n\n const items = (page.items ?? []) as Array<{\n id?: string;\n workflowInstance?: { workflowState?: { input?: Record<string, unknown> } };\n }>;\n\n return items\n .filter((row) => {\n const id = row.id?.trim();\n if (!id || linkedInstanceIds.has(id)) {\n return false;\n }\n const runInput = row.workflowInstance?.workflowState?.input ?? {};\n return runInput['employeeId'] === employeeId && runInput['leaveTypeId'] === leaveTypeId;\n })\n .map((row) => row.id as string);\n } catch {\n return [];\n }\n }\n\n //#endregion\n\n //#region ---- Close and replace ----\n\n private async confirmReplace(leaveTypeTitle: string | undefined): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@human-capital-management:leave-requests.messages.replace-open.confirm.title',\n );\n const message = await this.translationService.translateAsync(\n '@human-capital-management:leave-requests.messages.replace-open.confirm.message',\n {\n params: {\n leaveTypeTitle: String(leaveTypeTitle ?? '').trim() || '—',\n },\n },\n );\n const result = await this.dialogService.confirm(title, message, 'warning', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n private async closeOpenRuns(\n openRequests: OpenLeaveRequestRow[],\n orphanInstanceIds: string[],\n ): Promise<void> {\n const data = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data();\n\n const supersedeNote = 'Closed to start a new leave request run.';\n\n for (const request of openRequests) {\n await data.update(request.id, {\n statusId: AXPSystemStatusType.Cancelled,\n reason: supersedeNote,\n } as never);\n\n const instanceId = getRecordWorkflowInstanceId(request);\n if (instanceId) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n for (const instanceId of orphanInstanceIds) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n private async cancelWorkflowInstance(instanceId: string): Promise<void> {\n const engine = this.workflowEngine as AXPWorkflowEngine | null;\n if (engine?.cancelInstance) {\n await engine.cancelInstance(instanceId, 'superseded');\n return;\n }\n\n const now = new Date().toISOString();\n try {\n await this.entityStorageService.updateOne('WorkflowManagement.WorkflowInstance', instanceId, {\n status: 'Finished',\n subStatus: 'Cancelled',\n finishedAt: now,\n updatedAt: now,\n });\n } catch (error: unknown) {\n console.warn('[StartLeaveRequestFlowCommand] Failed to cancel workflow instance:', instanceId, error);\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveFlowText(value: unknown): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value).trim();\n }\n return resolveMultiLanguageString(value as never, this.translationService.getActiveLang()).trim();\n }\n\n /** Preserves multi-language leave type titles on the workflow instance for locale-aware task labels. */\n private coerceLeaveTypeTitleForWorkflow(\n value: AXMultiLanguageString | string | undefined,\n ): AXMultiLanguageString | string | undefined {\n if (value == null) {\n return undefined;\n }\n if (typeof value === 'object') {\n return value;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n }\n\n private buildCorrelationId(employeeId: string, leaveTypeId: string, workflowId: string): string {\n return `${RootConfig.module.name}.Employee:${employeeId}:${leaveT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CAAA,CAAA,EAAI,WAAW,CAAA,CAAA,EAAI,UAAU,EAAE;IACxF;8GAjRW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,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,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -6,7 +6,7 @@ import { AXPEntityService, AXPEntityStorageService, getRecordWorkflowInstanceId
|
|
|
6
6
|
import { AXPWorkflowManager, AXP_WORKFLOW_ENGINE } from '@acorex/platform/workflow';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
8
|
import { inject, Injectable } from '@angular/core';
|
|
9
|
-
import { R as RootConfig, c as AXMLifecycleEventOpenStatusIds } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-
|
|
9
|
+
import { R as RootConfig, c as AXMLifecycleEventOpenStatusIds } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-BZwLfZkb.mjs';
|
|
10
10
|
|
|
11
11
|
//#region ---- Imports ----
|
|
12
12
|
//#endregion
|
|
@@ -241,4 +241,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
241
241
|
}] });
|
|
242
242
|
|
|
243
243
|
export { StartLifecycleEventFlowCommand };
|
|
244
|
-
//# sourceMappingURL=acorex-modules-human-capital-management-start-lifecycle-event-flow.command-
|
|
244
|
+
//# sourceMappingURL=acorex-modules-human-capital-management-start-lifecycle-event-flow.command-B8xK2iTn.mjs.map
|