@acorex-platform/module-human-capital-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 (31) hide show
  1. package/fesm2022/acorex-platform-module-human-capital-management-client-acorex-platform-module-human-capital-management-client-DlWna0Lz.mjs +2297 -0
  2. package/fesm2022/acorex-platform-module-human-capital-management-client-acorex-platform-module-human-capital-management-client-DlWna0Lz.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-human-capital-management-client-approve-leave-request.command-Om_S0k9L.mjs +58 -0
  4. package/fesm2022/acorex-platform-module-human-capital-management-client-approve-leave-request.command-Om_S0k9L.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-human-capital-management-client-assign-position-assignment.command-2iHIogn6.mjs +111 -0
  6. package/fesm2022/acorex-platform-module-human-capital-management-client-assign-position-assignment.command-2iHIogn6.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-human-capital-management-client-cancel-leave-request.command-DGriRFiQ.mjs +58 -0
  8. package/fesm2022/acorex-platform-module-human-capital-management-client-cancel-leave-request.command-DGriRFiQ.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-human-capital-management-client-contracts.mjs +193 -0
  10. package/fesm2022/acorex-platform-module-human-capital-management-client-contracts.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-personal-info.command-DK947cW5.mjs +241 -0
  12. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-personal-info.command-DK947cW5.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-signature.command-CKrcMxqr.mjs +76 -0
  14. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-signature.command-CKrcMxqr.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component-DrRuKQ6Q.mjs +87 -0
  16. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component-DrRuKQ6Q.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component.provider-DPH0YiDP.mjs +23 -0
  18. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component.provider-DPH0YiDP.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-human-capital-management-client-reject-leave-request.command-O9gipd8g.mjs +61 -0
  20. package/fesm2022/acorex-platform-module-human-capital-management-client-reject-leave-request.command-O9gipd8g.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-human-capital-management-client-revoke-position-assignment.command-DmVlDQ8_.mjs +108 -0
  22. package/fesm2022/acorex-platform-module-human-capital-management-client-revoke-position-assignment.command-DmVlDQ8_.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs +248 -0
  24. package/fesm2022/acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs +250 -0
  26. package/fesm2022/acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-human-capital-management-client.mjs +2 -0
  28. package/fesm2022/acorex-platform-module-human-capital-management-client.mjs.map +1 -0
  29. package/package.json +28 -0
  30. package/types/acorex-platform-module-human-capital-management-client-contracts.d.ts +331 -0
  31. package/types/acorex-platform-module-human-capital-management-client.d.ts +114 -0
@@ -0,0 +1,2297 @@
1
+ import { AXPSystemStatuses, AXPStatusProvider, systemStatusToDefinition, AXPSystemStatusType, resolveMultiLanguageString as resolveMultiLanguageString$1, hasMultiLanguageContent } from '@acorex-platform/framework-shared/core';
2
+ import { AXPTaskBadgeProvider, AXPResourceAppointmentBoardProvider, AXP_TASK_BADGE_PROVIDERS, USER_CARD_ITEMS_HOOK, AXP_RESOURCE_APPOINTMENT_PROVIDER, AXP_PAGE_COMPONENT_PROVIDER } from '@acorex-platform/framework-client/layout/components';
3
+ import { AXPEntityService, AXP_ENTITY_CONFIG_TOKEN } from '@acorex-platform/framework-client/layout/entity';
4
+ import { AXPCommandEventsService, AXPCommandExecutor, AXPRuntimeModule, provideCommandSetups, AXPCommandService } from '@acorex-platform/framework-client/runtime';
5
+ import * as i0 from '@angular/core';
6
+ import { inject, DestroyRef, signal, Injectable, input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule, LOCALE_ID } from '@angular/core';
7
+ import { get, merge, first } from 'lodash';
8
+ import { RootConfig, AXPHumanCapitalManagementFeatureKeys, AXPHumanCapitalManagementCommandKeys, AXM_POSITION_ASSIGNMENT_STATUS, AXPPeopleOrganizationPermissionKeys, AXPHumanCapitalManagementMenuKeys, HCM_CATALOG_SCOPE_HR } from '@acorex-platform/module-human-capital-management-client/contracts';
9
+ import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';
10
+ import * as i4 from '@acorex/core/translation';
11
+ import { AXTranslationService, AXTranslationModule, resolveMultiLanguageString } from '@acorex/core/translation';
12
+ import * as i1 from '@acorex/components/button';
13
+ import { AXButtonModule } from '@acorex/components/button';
14
+ import * as i2 from '@acorex/components/decorators';
15
+ import { AXDecoratorModule } from '@acorex/components/decorators';
16
+ import { AXPTaskPopoverComponent } from '@acorex-platform/module-task-management-client';
17
+ import * as i3 from '@angular/common';
18
+ import { CommonModule } from '@angular/common';
19
+ import { AXP_RESOURCE_APPOINTMENT_PAGE_CONFIG } from '@acorex-platform/module-common-client';
20
+ import { AXM_ORG_CHART_NODE_CONTRIBUTOR } from '@acorex-platform/module-organization-management-client';
21
+ import { AXPSessionService, AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';
22
+ import { AXP_STATUS_PROVIDERS, AXP_PROTECTED_ROUTE_GUARDS, AXP_MENU_PROVIDER } from '@acorex-platform/framework-client/common';
23
+ import { AXP_MODULE_MANIFEST_PROVIDER, AXP_FEATURE_DEFINITION_PROVIDER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER, provideLazyProvider } from '@acorex-platform/framework-client/core';
24
+ import { ROUTES } from '@angular/router';
25
+ import { AXPCommonMenuKeys, AXPCommonPermissionGroupKeys } from '@acorex-platform/module-common-client/contracts';
26
+ import { firstValueFrom } from 'rxjs';
27
+ import { AXPEntityCommandScope } from '@acorex-platform/framework-shared/entity';
28
+ import { AXCalendarService } from '@acorex/core/date-time';
29
+ import { isUserProfileSectionsGroupRequested, PROFILE_PAGE_SECTIONS_HOOK, PROFILE_PAGE_GROUPS_HOOK } from '@acorex-platform/module-auth-client';
30
+
31
+ //#endregion
32
+ //#region ---- Task Badge Provider ----
33
+ class AXMLeaveRequestBadgeProvider extends AXPTaskBadgeProvider {
34
+ //#endregion
35
+ constructor() {
36
+ super();
37
+ //#region ---- Services & Dependencies ----
38
+ this.entityService = inject(AXPEntityService);
39
+ this.leaveRequestData = this.entityService
40
+ .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)
41
+ .data();
42
+ this.commandEvents = inject(AXPCommandEventsService);
43
+ this.destroyRef = inject(DestroyRef);
44
+ //#endregion
45
+ //#region ---- Signals & Properties ----
46
+ this.key = 'leave-request-badge';
47
+ this.count = signal(0, /* @ts-ignore */
48
+ ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
49
+ void this.refresh();
50
+ const unsubscribe = this.commandEvents.listen((event) => {
51
+ if (this.isLeaveRequestCommandEvent(event)) {
52
+ void this.handleCommandEvent(event);
53
+ }
54
+ });
55
+ this.destroyRef.onDestroy(unsubscribe);
56
+ }
57
+ //#region ---- Badge Actions ----
58
+ /**
59
+ * Forces badge count recalculation by querying the leave request entity service.
60
+ */
61
+ async refresh() {
62
+ const baseFilters = [
63
+ {
64
+ field: 'statusId',
65
+ operator: { type: 'equal' },
66
+ value: AXPSystemStatuses.WaitingApproval.name,
67
+ },
68
+ ];
69
+ const result = await this.leaveRequestData.query({
70
+ skip: 0,
71
+ take: 99,
72
+ filter: {
73
+ logic: 'and',
74
+ filters: baseFilters,
75
+ },
76
+ });
77
+ this.count.set(result.total);
78
+ }
79
+ /**
80
+ * Returns true when the command event targets the leave request entity.
81
+ */
82
+ isLeaveRequestCommandEvent(event) {
83
+ const leaveRequestSource = RootConfig.entities.leaveRequest.source;
84
+ if (event.key.startsWith(`${leaveRequestSource}:`)) {
85
+ return true;
86
+ }
87
+ const context = event.input;
88
+ const entity = get(context, 'entity');
89
+ const entityInfo = get(context, 'entityInfo');
90
+ if (entity === leaveRequestSource || get(entityInfo, 'source') === leaveRequestSource) {
91
+ return true;
92
+ }
93
+ return (get(entityInfo, 'module') === RootConfig.module.name &&
94
+ get(entityInfo, 'name') === RootConfig.entities.leaveRequest.name);
95
+ }
96
+ /**
97
+ * Handles command execution events and refreshes the badge when targeted leave request commands succeed.
98
+ */
99
+ async handleCommandEvent(event) {
100
+ if (!event || event.stage !== 'after' || !event.success) {
101
+ return;
102
+ }
103
+ await this.refresh();
104
+ }
105
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestBadgeProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
106
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestBadgeProvider }); }
107
+ }
108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestBadgeProvider, decorators: [{
109
+ type: Injectable
110
+ }], ctorParameters: () => [] });
111
+
112
+ class AXMLeaveRequestResourceAppointmentProvider extends AXPResourceAppointmentBoardProvider {
113
+ constructor() {
114
+ super(...arguments);
115
+ this.entityService = inject(AXPEntityService);
116
+ }
117
+ get name() {
118
+ return 'leave-request';
119
+ }
120
+ get title() {
121
+ return '@human-capital-management:leave-requests.entities.leave-request.plural';
122
+ }
123
+ get icon() {
124
+ return RootConfig.entities.leaveRequest.icon;
125
+ }
126
+ async getList(filter) {
127
+ const leaveRequestDataAccessor = this.entityService
128
+ .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)
129
+ .data();
130
+ const employeeDataAccessor = this.entityService
131
+ .withEntity(RootConfig.module.name, RootConfig.entities.employee.name)
132
+ .data();
133
+ const fieldFilters = [];
134
+ if (filter?.range?.from) {
135
+ fieldFilters.push({
136
+ field: 'startDate',
137
+ operator: { type: 'gte' },
138
+ value: filter.range.from,
139
+ });
140
+ }
141
+ if (filter?.range?.end) {
142
+ fieldFilters.push({
143
+ field: 'endDate',
144
+ operator: { type: 'lte' },
145
+ value: filter.range.end,
146
+ });
147
+ }
148
+ const employee = await employeeDataAccessor.query();
149
+ const { items } = await leaveRequestDataAccessor.query({
150
+ skip: 0,
151
+ take: 1000,
152
+ ...(fieldFilters.length
153
+ ? {
154
+ filter: {
155
+ logic: 'and',
156
+ filters: fieldFilters,
157
+ },
158
+ }
159
+ : {}),
160
+ });
161
+ const result = employee.items.map((employee) => ({
162
+ id: employee.id,
163
+ title: employee.person?.fullName ?? '',
164
+ description: 'description', //TODO fill later
165
+ icon: 'icon',
166
+ appointments: items
167
+ .filter((item) => item.employeeId === employee.id)
168
+ .map((item) => ({
169
+ id: item.id,
170
+ title: item.leaveType?.title ?? '',
171
+ startDate: item.startDate,
172
+ endDate: item.endDate,
173
+ resourceId: item.employeeId,
174
+ description: item.reason,
175
+ allDay: false,
176
+ })),
177
+ }));
178
+ return result;
179
+ // const resourcesMap = new Map<string | number, AXPResourceAppointmentResource>();
180
+ // for (const leave of items) {
181
+ // const resourceId: string | number = leave.employeeId ?? 'unassigned';
182
+ // let resource = resourcesMap.get(resourceId);
183
+ // if (!resource) {
184
+ // resource = {
185
+ // id: resourceId,
186
+ // title: leave.employee?.person?.displayName ?? '@general:terms.people.employee',
187
+ // appointments: [],
188
+ // };
189
+ // resourcesMap.set(resourceId, resource);
190
+ // }
191
+ // const task: AXPResourceAppointmentItem = {
192
+ // id: leave.id,
193
+ // title: leave.leaveType?.title ?? '@human-capital-management:leave-requests.entities.leave-request.title',
194
+ // description: leave.reason,
195
+ // startDate: leave.startDate,
196
+ // endDate: leave.endDate,
197
+ // allDay: false,
198
+ // resourceId,
199
+ // };
200
+ // resource.appointments.push(task);
201
+ // }
202
+ // return Array.from(resourcesMap.values());
203
+ }
204
+ async getStatuses() {
205
+ const waitingApproval = AXPSystemStatuses.WaitingApproval;
206
+ const approved = AXPSystemStatuses.Approved;
207
+ const rejected = AXPSystemStatuses.Rejected;
208
+ const cancelled = AXPSystemStatuses.Cancelled;
209
+ const statuses = [
210
+ { key: waitingApproval.name, index: 0, title: waitingApproval.title, color: waitingApproval.color },
211
+ { key: approved.name, index: 1, title: approved.title, color: approved.color },
212
+ { key: rejected.name, index: 2, title: rejected.title, color: rejected.color },
213
+ { key: cancelled.name, index: 3, title: cancelled.title, color: cancelled.color },
214
+ ];
215
+ return statuses;
216
+ }
217
+ async getActions(
218
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
219
+ context) {
220
+ // Actions can be wired to existing approve/reject/cancel commands later.
221
+ // For now, return an empty list so the board works without a context menu.
222
+ return [];
223
+ }
224
+ async executeCommand(
225
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
226
+ command) {
227
+ // No-op for now – commands are handled by existing leave request commands elsewhere.
228
+ return { success: true, kind: 'object', data: undefined };
229
+ }
230
+ }
231
+
232
+ class AXPLeaveRequestDialogService {
233
+ constructor() {
234
+ this.layoutBuilder = inject(AXPLayoutBuilderService);
235
+ this.translationService = inject(AXTranslationService);
236
+ }
237
+ async showRejectionDialog() {
238
+ const result = await this.layoutBuilder
239
+ .create()
240
+ .dialog(dialog => {
241
+ dialog
242
+ .setTitle('@general:actions.reject.title')
243
+ .setMessage('@human-capital-management:leave-requests.components.rejection-dialog.message')
244
+ .setContext({ reason: '', note: '' })
245
+ .content(flex => {
246
+ flex
247
+ .setDirection('column')
248
+ .formField('@human-capital-management:leave-requests.components.rejection-dialog.fields.reason-label', field => {
249
+ field.path('reason');
250
+ field.largeTextBox({
251
+ placeholder: '@human-capital-management:leave-requests.components.rejection-dialog.fields.reason-placeholder',
252
+ maxLength: 500
253
+ });
254
+ })
255
+ .formField('@human-capital-management:leave-requests.components.rejection-dialog.fields.note-label', field => {
256
+ field.path('note');
257
+ field.largeTextBox({
258
+ placeholder: '@human-capital-management:leave-requests.components.rejection-dialog.fields.note-placeholder',
259
+ maxLength: 1000
260
+ });
261
+ });
262
+ })
263
+ .setActions(actions => {
264
+ actions.cancel('@general:actions.cancel.title').submit('@general:actions.reject.title');
265
+ })
266
+ .onAction(async (dialogRef) => {
267
+ const context = dialogRef.context();
268
+ const action = dialogRef.action();
269
+ if (!context || action === 'cancel') {
270
+ return { reason: undefined, note: undefined, cancelled: true };
271
+ }
272
+ return {
273
+ reason: context['reason'],
274
+ note: context['note'],
275
+ cancelled: false
276
+ };
277
+ });
278
+ })
279
+ .show();
280
+ return result;
281
+ }
282
+ async showCancellationDialog() {
283
+ const result = await this.layoutBuilder
284
+ .create()
285
+ .dialog(dialog => {
286
+ dialog
287
+ .setTitle('@general:actions.cancel.title')
288
+ .setMessage('@human-capital-management:leave-requests.components.cancellation-dialog.message')
289
+ .setContext({ reason: '', note: '' })
290
+ .content(flex => {
291
+ flex
292
+ .setDirection('column')
293
+ .formField('@human-capital-management:leave-requests.components.cancellation-dialog.fields.reason-label', field => {
294
+ field.path('reason');
295
+ field.largeTextBox({
296
+ placeholder: '@human-capital-management:leave-requests.components.cancellation-dialog.fields.reason-placeholder',
297
+ maxLength: 500
298
+ });
299
+ })
300
+ .formField('@human-capital-management:leave-requests.components.cancellation-dialog.fields.note-label', field => {
301
+ field.path('note');
302
+ field.largeTextBox({
303
+ placeholder: '@human-capital-management:leave-requests.components.cancellation-dialog.fields.note-placeholder',
304
+ maxLength: 1000
305
+ });
306
+ });
307
+ })
308
+ .setActions(actions => {
309
+ actions.cancel('@general:actions.close.title').submit('@general:actions.cancel.title');
310
+ })
311
+ .onAction(async (dialogRef) => {
312
+ const context = dialogRef.context();
313
+ const action = dialogRef.action();
314
+ if (!context || action === 'cancel') {
315
+ return { reason: undefined, note: undefined, cancelled: true };
316
+ }
317
+ return {
318
+ reason: context['reason'],
319
+ note: context['note'],
320
+ cancelled: false
321
+ };
322
+ });
323
+ })
324
+ .show();
325
+ return result;
326
+ }
327
+ async showApprovalDialog() {
328
+ const result = await this.layoutBuilder
329
+ .create()
330
+ .dialog(dialog => {
331
+ dialog
332
+ .setTitle('@general:actions.approve.title')
333
+ .setMessage('@human-capital-management:leave-requests.components.approval-dialog.message')
334
+ .setContext({ note: '' })
335
+ .content(flex => {
336
+ flex
337
+ .setDirection('column')
338
+ .formField('@human-capital-management:leave-requests.components.approval-dialog.fields.note-label', field => {
339
+ field.path('note');
340
+ field.largeTextBox({
341
+ placeholder: '@human-capital-management:leave-requests.components.approval-dialog.fields.note-placeholder',
342
+ maxLength: 1000
343
+ });
344
+ });
345
+ })
346
+ .setActions(actions => {
347
+ actions.cancel('@general:actions.cancel.title').submit('@general:actions.approve.title');
348
+ })
349
+ .onAction(async (dialogRef) => {
350
+ const context = dialogRef.context();
351
+ const action = dialogRef.action();
352
+ if (!context || action === 'cancel') {
353
+ return { note: undefined, cancelled: true };
354
+ }
355
+ return {
356
+ note: context['note'],
357
+ cancelled: false
358
+ };
359
+ });
360
+ })
361
+ .show();
362
+ return result;
363
+ }
364
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPLeaveRequestDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
365
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPLeaveRequestDialogService, providedIn: 'root' }); }
366
+ }
367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPLeaveRequestDialogService, decorators: [{
368
+ type: Injectable,
369
+ args: [{
370
+ providedIn: 'root'
371
+ }]
372
+ }] });
373
+
374
+ class AXMLeaveRequestTaskPopoverComponent extends AXPTaskPopoverComponent {
375
+ constructor() {
376
+ super(...arguments);
377
+ this.task = input.required(/* @ts-ignore */
378
+ ...(ngDevMode ? [{ debugName: "task" }] : /* istanbul ignore next */ []));
379
+ this.commandExecutor = inject(AXPCommandExecutor);
380
+ this.dialogService = inject(AXPLeaveRequestDialogService);
381
+ this.taskData = computed(() => {
382
+ const task = this.task();
383
+ return (task.data ||
384
+ task.payload);
385
+ }, /* @ts-ignore */
386
+ ...(ngDevMode ? [{ debugName: "taskData" }] : /* istanbul ignore next */ []));
387
+ this.employeeName = computed(() => {
388
+ const data = this.taskData();
389
+ return this.task().reporter?.fullName || 'Unknown';
390
+ }, /* @ts-ignore */
391
+ ...(ngDevMode ? [{ debugName: "employeeName" }] : /* istanbul ignore next */ []));
392
+ this.managerName = computed(() => {
393
+ const data = this.taskData();
394
+ return data?.employee?.manager?.person?.fullName || '';
395
+ }, /* @ts-ignore */
396
+ ...(ngDevMode ? [{ debugName: "managerName" }] : /* istanbul ignore next */ []));
397
+ this.leaveType = computed(() => {
398
+ const data = this.taskData();
399
+ // Extract leave type from task title or data
400
+ const title = this.task().title || '';
401
+ const parts = title.split(' - ');
402
+ return parts.length > 1 ? parts[1] : data?.leaveType?.title || 'N/A';
403
+ }, /* @ts-ignore */
404
+ ...(ngDevMode ? [{ debugName: "leaveType" }] : /* istanbul ignore next */ []));
405
+ this.canApprove = computed(() => {
406
+ const statusId = this.task().status?.id;
407
+ return statusId === AXPSystemStatuses.WaitingApproval.name || statusId === AXPSystemStatuses.Rejected.name;
408
+ }, /* @ts-ignore */
409
+ ...(ngDevMode ? [{ debugName: "canApprove" }] : /* istanbul ignore next */ []));
410
+ this.canReject = computed(() => {
411
+ const statusId = this.task().status?.id;
412
+ return statusId === AXPSystemStatuses.WaitingApproval.name || statusId === AXPSystemStatuses.Approved.name;
413
+ }, /* @ts-ignore */
414
+ ...(ngDevMode ? [{ debugName: "canReject" }] : /* istanbul ignore next */ []));
415
+ this.canCancel = computed(() => {
416
+ const statusId = this.task().status?.id;
417
+ return statusId === AXPSystemStatuses.WaitingApproval.name || statusId === AXPSystemStatuses.Approved.name;
418
+ }, /* @ts-ignore */
419
+ ...(ngDevMode ? [{ debugName: "canCancel" }] : /* istanbul ignore next */ []));
420
+ }
421
+ formatDate(date) {
422
+ return new Intl.DateTimeFormat('en-US', {
423
+ year: 'numeric',
424
+ month: 'short',
425
+ day: 'numeric',
426
+ }).format(new Date(date));
427
+ }
428
+ calculateDuration() {
429
+ const start = new Date(this.task().startDate);
430
+ const end = new Date(this.task().endDate);
431
+ const diffTime = Math.abs(end.getTime() - start.getTime());
432
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
433
+ return diffDays + 1; // Include both start and end days
434
+ }
435
+ async handleApprove() {
436
+ const task = this.task();
437
+ const leaveRequestId = task.id;
438
+ try {
439
+ const dialogResult = await this.dialogService.showApprovalDialog();
440
+ if (dialogResult?.cancelled) {
441
+ return;
442
+ }
443
+ const commandKey = 'HumanCapitalManagement.LeaveRequest:Approve';
444
+ const result = await this.commandExecutor.execute(commandKey, {
445
+ id: leaveRequestId,
446
+ reason: dialogResult?.reason,
447
+ note: dialogResult?.note,
448
+ });
449
+ if (result?.success) {
450
+ // Optionally emit an event or refresh the task
451
+ console.log('Leave request approved successfully');
452
+ }
453
+ }
454
+ catch (error) {
455
+ console.error('Failed to approve leave request:', error);
456
+ }
457
+ }
458
+ async handleReject() {
459
+ const task = this.task();
460
+ const leaveRequestId = task.id;
461
+ try {
462
+ const dialogResult = await this.dialogService.showRejectionDialog();
463
+ if (dialogResult?.cancelled) {
464
+ return;
465
+ }
466
+ const commandKey = 'HumanCapitalManagement.LeaveRequest:Reject';
467
+ const result = await this.commandExecutor.execute(commandKey, {
468
+ id: leaveRequestId,
469
+ reason: dialogResult?.reason,
470
+ note: dialogResult?.note,
471
+ });
472
+ if (result?.success) {
473
+ console.log('Leave request rejected successfully');
474
+ }
475
+ }
476
+ catch (error) {
477
+ console.error('Failed to reject leave request:', error);
478
+ }
479
+ }
480
+ async handleCancel() {
481
+ const task = this.task();
482
+ const leaveRequestId = task.id;
483
+ try {
484
+ const dialogResult = await this.dialogService.showCancellationDialog();
485
+ if (dialogResult?.cancelled) {
486
+ return;
487
+ }
488
+ const commandKey = 'HumanCapitalManagement.LeaveRequest:Cancel';
489
+ const result = await this.commandExecutor.execute(commandKey, {
490
+ id: leaveRequestId,
491
+ reason: dialogResult?.reason,
492
+ note: dialogResult?.note,
493
+ });
494
+ if (result?.success) {
495
+ console.log('Leave request cancelled successfully');
496
+ }
497
+ }
498
+ catch (error) {
499
+ console.error('Failed to cancel leave request:', error);
500
+ }
501
+ }
502
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestTaskPopoverComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
503
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMLeaveRequestTaskPopoverComponent, isStandalone: true, selector: "axm-leave-request-task-popover", inputs: { task: { classPropertyName: "task", publicName: "task", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
504
+ <div class="leave-request-popover">
505
+ <!-- Employee Info -->
506
+ <div class="leave-request-popover__section">
507
+ <div class="leave-request-popover__section-header">
508
+ <i class="fa-light fa-user"></i>
509
+ <span>Employee Information</span>
510
+ </div>
511
+ <div class="leave-request-popover__section-content">
512
+ <div class="leave-request-popover__info-row">
513
+ <span class="leave-request-popover__label">Employee:</span>
514
+ <span class="leave-request-popover__value">{{ employeeName() }}</span>
515
+ </div>
516
+ @if (managerName(); as manager) {
517
+ <div class="leave-request-popover__info-row">
518
+ <span class="leave-request-popover__label">Manager:</span>
519
+ <span class="leave-request-popover__value">{{ manager }}</span>
520
+ </div>
521
+ }
522
+ </div>
523
+ </div>
524
+
525
+ <!-- Leave Details -->
526
+ <div class="leave-request-popover__section">
527
+ <div class="leave-request-popover__section-header">
528
+ <i class="fa-light fa-calendar"></i>
529
+ <span>Leave Details</span>
530
+ </div>
531
+ <div class="leave-request-popover__section-content">
532
+ <div class="leave-request-popover__info-row">
533
+ <span class="leave-request-popover__label">Leave Type:</span>
534
+ <span class="leave-request-popover__value">{{ leaveType() }}</span>
535
+ </div>
536
+ <div class="leave-request-popover__info-row">
537
+ <span class="leave-request-popover__label">Start Date:</span>
538
+ <span class="leave-request-popover__value">{{ formatDate(task().startDate) }}</span>
539
+ </div>
540
+ <div class="leave-request-popover__info-row">
541
+ <span class="leave-request-popover__label">End Date:</span>
542
+ <span class="leave-request-popover__value">{{ formatDate(task().endDate) }}</span>
543
+ </div>
544
+ <div class="leave-request-popover__info-row">
545
+ <span class="leave-request-popover__label">Duration:</span>
546
+ <span class="leave-request-popover__value">{{ calculateDuration() }} days</span>
547
+ </div>
548
+ </div>
549
+ </div>
550
+
551
+ <!-- Reason -->
552
+ @if (task().description) {
553
+ <div class="leave-request-popover__section">
554
+ <div class="leave-request-popover__section-header">
555
+ <i class="fa-light fa-note-sticky"></i>
556
+ <span>Reason</span>
557
+ </div>
558
+ <div class="leave-request-popover__section-content">
559
+ <p class="leave-request-popover__reason">{{ task().description }}</p>
560
+ </div>
561
+ </div>
562
+ }
563
+
564
+ <!-- Status -->
565
+ <div class="leave-request-popover__section">
566
+ <div class="leave-request-popover__section-header">
567
+ <i class="fa-light fa-flag"></i>
568
+ <span>Status</span>
569
+ </div>
570
+ <div class="leave-request-popover__section-content">
571
+ <div class="leave-request-popover__status-badge" [attr.data-status]="task().status.id">
572
+ {{ task().status.title }}
573
+ </div>
574
+ </div>
575
+ </div>
576
+
577
+ <!-- Actions -->
578
+ <div class="leave-request-popover__actions">
579
+ @if (canApprove()) {
580
+ <ax-button
581
+ [color]="'success'"
582
+ [look]="'blank'"
583
+ [text]="'@general:actions.approve.title' | translate | async"
584
+ (onClick)="handleApprove()"
585
+ class="leave-request-popover__action-btn"
586
+ >
587
+ <ax-prefix>
588
+ <i class="fa-light fa-check"></i>
589
+ </ax-prefix>
590
+ </ax-button>
591
+ }
592
+
593
+ @if (canReject()) {
594
+ <ax-button
595
+ [color]="'danger'"
596
+ [look]="'blank'"
597
+ [text]="'@general:actions.reject.title' | translate | async"
598
+ (onClick)="handleReject()"
599
+ class="leave-request-popover__action-btn"
600
+ >
601
+ <ax-prefix>
602
+ <i class="fa-light fa-xmark"></i>
603
+ </ax-prefix>
604
+ </ax-button>
605
+ }
606
+
607
+ @if (canCancel()) {
608
+ <ax-button
609
+ [color]="'secondary'"
610
+ [look]="'blank'"
611
+ [text]="'@general:actions.cancel.title' | translate | async"
612
+ (onClick)="handleCancel()"
613
+ class="leave-request-popover__action-btn"
614
+ >
615
+ <ax-prefix>
616
+ <i class="fa-light fa-ban"></i>
617
+ </ax-prefix>
618
+ </ax-button>
619
+ }
620
+ </div>
621
+ </div>
622
+ `, isInline: true, styles: [".leave-request-popover{padding:12px;display:flex;flex-direction:column;gap:10px;min-width:280px;max-width:360px}.leave-request-popover__section{display:flex;flex-direction:column;gap:6px}.leave-request-popover__section-header{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;color:var(--ax-sys-color-text-primary);padding-bottom:6px;border-bottom:1px solid var(--ax-sys-color-border)}.leave-request-popover__section-header i{font-size:13px;color:var(--ax-sys-color-text-neutral-600)}.leave-request-popover__section-content{display:flex;flex-direction:column;gap:6px}.leave-request-popover__info-row{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;font-size:12px;line-height:1.4}.leave-request-popover__label{color:var(--ax-sys-color-text-neutral-600);font-weight:500;flex-shrink:0}.leave-request-popover__value{color:var(--ax-sys-color-text-primary);text-align:right;word-break:break-word}.leave-request-popover__reason{margin:0;padding:8px;background:var(--ax-sys-color-lighter-surface);border-radius:4px;font-size:12px;line-height:1.4;color:var(--ax-sys-color-text-primary)}.leave-request-popover__status-badge{display:inline-block;padding:3px 10px;border-radius:10px;font-size:11px;font-weight:500;text-transform:capitalize}.leave-request-popover__status-badge[data-status=waiting-approval]{background:var(--ax-sys-color-warning-lightest);color:var(--ax-sys-color-warning)}.leave-request-popover__status-badge[data-status=approved]{background:var(--ax-sys-color-success-lightest);color:var(--ax-sys-color-success)}.leave-request-popover__status-badge[data-status=rejected]{background:var(--ax-sys-color-danger-lightest);color:var(--ax-sys-color-danger)}.leave-request-popover__status-badge[data-status=cancelled]{background:var(--ax-sys-color-neutral-lightest);color:var(--ax-sys-color-neutral)}.leave-request-popover__actions{display:flex;gap:6px;flex-wrap:wrap;padding-top:8px;border-top:1px solid var(--ax-sys-color-border)}.leave-request-popover__action-btn{flex:1;min-width:90px}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
623
+ }
624
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestTaskPopoverComponent, decorators: [{
625
+ type: Component,
626
+ args: [{ selector: 'axm-leave-request-task-popover', template: `
627
+ <div class="leave-request-popover">
628
+ <!-- Employee Info -->
629
+ <div class="leave-request-popover__section">
630
+ <div class="leave-request-popover__section-header">
631
+ <i class="fa-light fa-user"></i>
632
+ <span>Employee Information</span>
633
+ </div>
634
+ <div class="leave-request-popover__section-content">
635
+ <div class="leave-request-popover__info-row">
636
+ <span class="leave-request-popover__label">Employee:</span>
637
+ <span class="leave-request-popover__value">{{ employeeName() }}</span>
638
+ </div>
639
+ @if (managerName(); as manager) {
640
+ <div class="leave-request-popover__info-row">
641
+ <span class="leave-request-popover__label">Manager:</span>
642
+ <span class="leave-request-popover__value">{{ manager }}</span>
643
+ </div>
644
+ }
645
+ </div>
646
+ </div>
647
+
648
+ <!-- Leave Details -->
649
+ <div class="leave-request-popover__section">
650
+ <div class="leave-request-popover__section-header">
651
+ <i class="fa-light fa-calendar"></i>
652
+ <span>Leave Details</span>
653
+ </div>
654
+ <div class="leave-request-popover__section-content">
655
+ <div class="leave-request-popover__info-row">
656
+ <span class="leave-request-popover__label">Leave Type:</span>
657
+ <span class="leave-request-popover__value">{{ leaveType() }}</span>
658
+ </div>
659
+ <div class="leave-request-popover__info-row">
660
+ <span class="leave-request-popover__label">Start Date:</span>
661
+ <span class="leave-request-popover__value">{{ formatDate(task().startDate) }}</span>
662
+ </div>
663
+ <div class="leave-request-popover__info-row">
664
+ <span class="leave-request-popover__label">End Date:</span>
665
+ <span class="leave-request-popover__value">{{ formatDate(task().endDate) }}</span>
666
+ </div>
667
+ <div class="leave-request-popover__info-row">
668
+ <span class="leave-request-popover__label">Duration:</span>
669
+ <span class="leave-request-popover__value">{{ calculateDuration() }} days</span>
670
+ </div>
671
+ </div>
672
+ </div>
673
+
674
+ <!-- Reason -->
675
+ @if (task().description) {
676
+ <div class="leave-request-popover__section">
677
+ <div class="leave-request-popover__section-header">
678
+ <i class="fa-light fa-note-sticky"></i>
679
+ <span>Reason</span>
680
+ </div>
681
+ <div class="leave-request-popover__section-content">
682
+ <p class="leave-request-popover__reason">{{ task().description }}</p>
683
+ </div>
684
+ </div>
685
+ }
686
+
687
+ <!-- Status -->
688
+ <div class="leave-request-popover__section">
689
+ <div class="leave-request-popover__section-header">
690
+ <i class="fa-light fa-flag"></i>
691
+ <span>Status</span>
692
+ </div>
693
+ <div class="leave-request-popover__section-content">
694
+ <div class="leave-request-popover__status-badge" [attr.data-status]="task().status.id">
695
+ {{ task().status.title }}
696
+ </div>
697
+ </div>
698
+ </div>
699
+
700
+ <!-- Actions -->
701
+ <div class="leave-request-popover__actions">
702
+ @if (canApprove()) {
703
+ <ax-button
704
+ [color]="'success'"
705
+ [look]="'blank'"
706
+ [text]="'@general:actions.approve.title' | translate | async"
707
+ (onClick)="handleApprove()"
708
+ class="leave-request-popover__action-btn"
709
+ >
710
+ <ax-prefix>
711
+ <i class="fa-light fa-check"></i>
712
+ </ax-prefix>
713
+ </ax-button>
714
+ }
715
+
716
+ @if (canReject()) {
717
+ <ax-button
718
+ [color]="'danger'"
719
+ [look]="'blank'"
720
+ [text]="'@general:actions.reject.title' | translate | async"
721
+ (onClick)="handleReject()"
722
+ class="leave-request-popover__action-btn"
723
+ >
724
+ <ax-prefix>
725
+ <i class="fa-light fa-xmark"></i>
726
+ </ax-prefix>
727
+ </ax-button>
728
+ }
729
+
730
+ @if (canCancel()) {
731
+ <ax-button
732
+ [color]="'secondary'"
733
+ [look]="'blank'"
734
+ [text]="'@general:actions.cancel.title' | translate | async"
735
+ (onClick)="handleCancel()"
736
+ class="leave-request-popover__action-btn"
737
+ >
738
+ <ax-prefix>
739
+ <i class="fa-light fa-ban"></i>
740
+ </ax-prefix>
741
+ </ax-button>
742
+ }
743
+ </div>
744
+ </div>
745
+ `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CommonModule, AXButtonModule, AXDecoratorModule, AXTranslationModule], styles: [".leave-request-popover{padding:12px;display:flex;flex-direction:column;gap:10px;min-width:280px;max-width:360px}.leave-request-popover__section{display:flex;flex-direction:column;gap:6px}.leave-request-popover__section-header{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;color:var(--ax-sys-color-text-primary);padding-bottom:6px;border-bottom:1px solid var(--ax-sys-color-border)}.leave-request-popover__section-header i{font-size:13px;color:var(--ax-sys-color-text-neutral-600)}.leave-request-popover__section-content{display:flex;flex-direction:column;gap:6px}.leave-request-popover__info-row{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;font-size:12px;line-height:1.4}.leave-request-popover__label{color:var(--ax-sys-color-text-neutral-600);font-weight:500;flex-shrink:0}.leave-request-popover__value{color:var(--ax-sys-color-text-primary);text-align:right;word-break:break-word}.leave-request-popover__reason{margin:0;padding:8px;background:var(--ax-sys-color-lighter-surface);border-radius:4px;font-size:12px;line-height:1.4;color:var(--ax-sys-color-text-primary)}.leave-request-popover__status-badge{display:inline-block;padding:3px 10px;border-radius:10px;font-size:11px;font-weight:500;text-transform:capitalize}.leave-request-popover__status-badge[data-status=waiting-approval]{background:var(--ax-sys-color-warning-lightest);color:var(--ax-sys-color-warning)}.leave-request-popover__status-badge[data-status=approved]{background:var(--ax-sys-color-success-lightest);color:var(--ax-sys-color-success)}.leave-request-popover__status-badge[data-status=rejected]{background:var(--ax-sys-color-danger-lightest);color:var(--ax-sys-color-danger)}.leave-request-popover__status-badge[data-status=cancelled]{background:var(--ax-sys-color-neutral-lightest);color:var(--ax-sys-color-neutral)}.leave-request-popover__actions{display:flex;gap:6px;flex-wrap:wrap;padding-top:8px;border-top:1px solid var(--ax-sys-color-border)}.leave-request-popover__action-btn{flex:1;min-width:90px}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
746
+ }], propDecorators: { task: [{ type: i0.Input, args: [{ isSignal: true, alias: "task", required: true }] }] } });
747
+
748
+ //#region ---- Imports ----
749
+ //#endregion
750
+ //#region ---- Feature Definition Provider ----
751
+ /**
752
+ * Human Capital Management Feature Definition Provider.
753
+ * Provides feature definitions for the Human Capital Management module.
754
+ */
755
+ class AXPHumanCapitalManagementFeatureDefinitionProvider {
756
+ async provide(context) {
757
+ context.addFeature(AXPHumanCapitalManagementFeatureKeys.EmployeeManagement, {
758
+ title: '@human-capital-management:features.employee-management.title',
759
+ description: '@human-capital-management:features.employee-management.description',
760
+ defaultValue: true,
761
+ type: 'boolean',
762
+ });
763
+ context.addFeature(AXPHumanCapitalManagementFeatureKeys.LeaveManagement, {
764
+ title: '@human-capital-management:features.leave-management.title',
765
+ description: '@human-capital-management:features.leave-management.description',
766
+ defaultValue: true,
767
+ type: 'boolean',
768
+ });
769
+ context.addFeature(AXPHumanCapitalManagementFeatureKeys.LifecycleManagement, {
770
+ title: '@human-capital-management:features.lifecycle-management.title',
771
+ description: '@human-capital-management:features.lifecycle-management.description',
772
+ defaultValue: true,
773
+ type: 'boolean',
774
+ });
775
+ }
776
+ }
777
+ //#endregion
778
+
779
+ //#region ---- Imports ----
780
+ //#endregion
781
+ //#region ---- Lifecycle event status ----
782
+ /**
783
+ * Status lifecycle for lifecycle events: In progress → Waiting sign-off → Completed (or Cancelled).
784
+ */
785
+ class AXMLifecycleEventStatusProvider extends AXPStatusProvider {
786
+ constructor() {
787
+ super(...arguments);
788
+ this.key = 'human-capital-management.status.lifecycle-event';
789
+ this.statuses = [
790
+ systemStatusToDefinition(AXPSystemStatusType.InProgress, {
791
+ title: '@human-capital-management:lifecycle-events.states.in-progress',
792
+ generateView: true,
793
+ }),
794
+ systemStatusToDefinition(AXPSystemStatusType.WaitingSignOff, {
795
+ generateView: true,
796
+ }),
797
+ systemStatusToDefinition(AXPSystemStatusType.Completed, {
798
+ title: '@human-capital-management:lifecycle-events.states.completed',
799
+ generateView: true,
800
+ }),
801
+ systemStatusToDefinition(AXPSystemStatusType.Cancelled, {
802
+ title: '@human-capital-management:lifecycle-events.states.cancelled',
803
+ generateView: true,
804
+ }),
805
+ ];
806
+ this.transitions = [
807
+ {
808
+ from: AXPSystemStatusType.InProgress,
809
+ to: AXPSystemStatusType.WaitingSignOff,
810
+ title: '@human-capital-management:lifecycle-events.transitions.await-sign-off',
811
+ },
812
+ {
813
+ from: AXPSystemStatusType.WaitingSignOff,
814
+ to: AXPSystemStatusType.Completed,
815
+ title: '@human-capital-management:lifecycle-events.transitions.complete',
816
+ },
817
+ {
818
+ from: AXPSystemStatusType.WaitingSignOff,
819
+ to: AXPSystemStatusType.Cancelled,
820
+ title: '@general:statuses.transitions.cancel',
821
+ },
822
+ {
823
+ from: AXPSystemStatusType.InProgress,
824
+ to: AXPSystemStatusType.Cancelled,
825
+ title: '@general:statuses.transitions.cancel',
826
+ },
827
+ ];
828
+ this.defaultStatus = AXPSystemStatusType.InProgress;
829
+ }
830
+ }
831
+ //#endregion
832
+
833
+ class AXMLifecycleEventFeatureModule {
834
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLifecycleEventFeatureModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
835
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMLifecycleEventFeatureModule, imports: [AXPRuntimeModule] }); }
836
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLifecycleEventFeatureModule, providers: [
837
+ {
838
+ provide: AXP_STATUS_PROVIDERS,
839
+ useClass: AXMLifecycleEventStatusProvider,
840
+ multi: true,
841
+ },
842
+ provideCommandSetups([
843
+ {
844
+ key: AXPHumanCapitalManagementCommandKeys.LifecycleEvent.StartFlow,
845
+ command: () => import('./acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs').then((c) => c.StartLifecycleEventFlowCommand),
846
+ },
847
+ ]),
848
+ ], imports: [AXPRuntimeModule] }); }
849
+ }
850
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLifecycleEventFeatureModule, decorators: [{
851
+ type: NgModule,
852
+ args: [{
853
+ imports: [AXPRuntimeModule],
854
+ providers: [
855
+ {
856
+ provide: AXP_STATUS_PROVIDERS,
857
+ useClass: AXMLifecycleEventStatusProvider,
858
+ multi: true,
859
+ },
860
+ provideCommandSetups([
861
+ {
862
+ key: AXPHumanCapitalManagementCommandKeys.LifecycleEvent.StartFlow,
863
+ command: () => import('./acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs').then((c) => c.StartLifecycleEventFlowCommand),
864
+ },
865
+ ]),
866
+ ],
867
+ }]
868
+ }] });
869
+
870
+ //#region ---- Imports ----
871
+ //#endregion
872
+ //#region ---- Leave Request Status Provider ----
873
+ /**
874
+ * Leave request status provider defining lifecycle states: Waiting approval, Approved, Rejected, Cancelled.
875
+ * Used by the status plugin to manage leave request status transitions and metadata.
876
+ */
877
+ class AXMLeaveRequestStatusProvider extends AXPStatusProvider {
878
+ constructor() {
879
+ super(...arguments);
880
+ this.key = 'human-capital-management.status.leave-request';
881
+ this.statuses = [
882
+ systemStatusToDefinition(AXPSystemStatusType.WaitingApproval, {
883
+ title: '@human-capital-management:leave-requests.states.waiting-approval',
884
+ generateView: true,
885
+ }),
886
+ systemStatusToDefinition(AXPSystemStatusType.Approved, {
887
+ title: '@human-capital-management:leave-requests.states.approved',
888
+ generateView: true,
889
+ }),
890
+ systemStatusToDefinition(AXPSystemStatusType.Rejected, {
891
+ title: '@human-capital-management:leave-requests.states.rejected',
892
+ generateView: true,
893
+ }),
894
+ systemStatusToDefinition(AXPSystemStatusType.Cancelled, {
895
+ title: '@human-capital-management:leave-requests.states.cancelled',
896
+ generateView: true,
897
+ }),
898
+ ];
899
+ this.transitions = [
900
+ {
901
+ from: AXPSystemStatusType.WaitingApproval,
902
+ to: AXPSystemStatusType.Approved,
903
+ title: '@general:statuses.transitions.approve',
904
+ requiresApproval: true
905
+ },
906
+ {
907
+ from: AXPSystemStatusType.WaitingApproval,
908
+ to: AXPSystemStatusType.Rejected,
909
+ title: '@general:statuses.transitions.reject',
910
+ requiresApproval: true
911
+ },
912
+ {
913
+ from: AXPSystemStatusType.WaitingApproval,
914
+ to: AXPSystemStatusType.Cancelled,
915
+ title: '@general:statuses.transitions.cancel',
916
+ requiresApproval: true
917
+ },
918
+ {
919
+ from: AXPSystemStatusType.Approved,
920
+ to: AXPSystemStatusType.Cancelled,
921
+ title: '@general:statuses.transitions.cancel',
922
+ requiresApproval: true
923
+ },
924
+ ];
925
+ this.defaultStatus = AXPSystemStatusType.WaitingApproval;
926
+ }
927
+ }
928
+ //#endregion
929
+
930
+ class AXMLeaveRequestFeatureModule {
931
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestFeatureModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
932
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestFeatureModule, imports: [CommonModule, AXPRuntimeModule] }); }
933
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestFeatureModule, providers: [
934
+ {
935
+ provide: AXP_TASK_BADGE_PROVIDERS,
936
+ useClass: AXMLeaveRequestBadgeProvider,
937
+ multi: true,
938
+ },
939
+ {
940
+ provide: AXP_STATUS_PROVIDERS,
941
+ useClass: AXMLeaveRequestStatusProvider,
942
+ multi: true,
943
+ },
944
+ provideCommandSetups([
945
+ {
946
+ key: AXPHumanCapitalManagementCommandKeys.LeaveRequest.StartFlow,
947
+ command: () => import('./acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs').then((c) => c.StartLeaveRequestFlowCommand),
948
+ },
949
+ {
950
+ key: 'HumanCapitalManagement.LeaveRequest:Approve',
951
+ command: () => import('./acorex-platform-module-human-capital-management-client-approve-leave-request.command-Om_S0k9L.mjs').then((c) => c.ApproveLeaveRequestCommand),
952
+ },
953
+ {
954
+ key: 'HumanCapitalManagement.LeaveRequest:Reject',
955
+ command: () => import('./acorex-platform-module-human-capital-management-client-reject-leave-request.command-O9gipd8g.mjs').then((c) => c.RejectLeaveRequestCommand),
956
+ },
957
+ {
958
+ key: 'HumanCapitalManagement.LeaveRequest:Cancel',
959
+ command: () => import('./acorex-platform-module-human-capital-management-client-cancel-leave-request.command-DGriRFiQ.mjs').then((c) => c.CancelLeaveRequestCommand),
960
+ },
961
+ ]),
962
+ ], imports: [CommonModule, AXPRuntimeModule] }); }
963
+ }
964
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLeaveRequestFeatureModule, decorators: [{
965
+ type: NgModule,
966
+ args: [{
967
+ imports: [CommonModule, AXPRuntimeModule],
968
+ providers: [
969
+ {
970
+ provide: AXP_TASK_BADGE_PROVIDERS,
971
+ useClass: AXMLeaveRequestBadgeProvider,
972
+ multi: true,
973
+ },
974
+ {
975
+ provide: AXP_STATUS_PROVIDERS,
976
+ useClass: AXMLeaveRequestStatusProvider,
977
+ multi: true,
978
+ },
979
+ provideCommandSetups([
980
+ {
981
+ key: AXPHumanCapitalManagementCommandKeys.LeaveRequest.StartFlow,
982
+ command: () => import('./acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs').then((c) => c.StartLeaveRequestFlowCommand),
983
+ },
984
+ {
985
+ key: 'HumanCapitalManagement.LeaveRequest:Approve',
986
+ command: () => import('./acorex-platform-module-human-capital-management-client-approve-leave-request.command-Om_S0k9L.mjs').then((c) => c.ApproveLeaveRequestCommand),
987
+ },
988
+ {
989
+ key: 'HumanCapitalManagement.LeaveRequest:Reject',
990
+ command: () => import('./acorex-platform-module-human-capital-management-client-reject-leave-request.command-O9gipd8g.mjs').then((c) => c.RejectLeaveRequestCommand),
991
+ },
992
+ {
993
+ key: 'HumanCapitalManagement.LeaveRequest:Cancel',
994
+ command: () => import('./acorex-platform-module-human-capital-management-client-cancel-leave-request.command-DGriRFiQ.mjs').then((c) => c.CancelLeaveRequestCommand),
995
+ },
996
+ ]),
997
+ ],
998
+ }]
999
+ }] });
1000
+
1001
+ //#region ---- Imports ----
1002
+ //#endregion
1003
+ //#region ---- Custom Status Names ----
1004
+ const OnLeave = 'on-leave';
1005
+ const Terminated = 'terminated';
1006
+ //#endregion
1007
+ //#region ---- Employee Status Provider ----
1008
+ /**
1009
+ * Employee status provider defining standard lifecycle states: Active, On Leave, Suspended, Terminated, Pending.
1010
+ * Used by the status plugin to manage employee status transitions and metadata.
1011
+ */
1012
+ class AXMEmployeeStatusProvider extends AXPStatusProvider {
1013
+ constructor() {
1014
+ super(...arguments);
1015
+ this.key = 'human-capital-management.status.employee';
1016
+ this.defaultStatus = AXPSystemStatusType.Active;
1017
+ this.statuses = [
1018
+ systemStatusToDefinition(AXPSystemStatusType.Active, {
1019
+ title: '@human-capital-management:employees.states.active',
1020
+ generateView: true,
1021
+ }),
1022
+ {
1023
+ name: OnLeave,
1024
+ title: '@human-capital-management:employees.states.on-leave',
1025
+ icon: 'fa-light fa-umbrella-beach',
1026
+ color: 'info',
1027
+ order: 2,
1028
+ isInitial: false,
1029
+ isFinal: false,
1030
+ generateView: true,
1031
+ },
1032
+ systemStatusToDefinition(AXPSystemStatusType.Suspended, {
1033
+ title: '@human-capital-management:employees.states.suspended',
1034
+ generateView: true,
1035
+ }),
1036
+ {
1037
+ name: Terminated,
1038
+ title: '@human-capital-management:employees.states.terminated',
1039
+ icon: 'fa-light fa-user-xmark',
1040
+ color: 'danger',
1041
+ order: 4,
1042
+ isInitial: false,
1043
+ isFinal: true,
1044
+ generateView: true,
1045
+ },
1046
+ systemStatusToDefinition(AXPSystemStatusType.Pending, {
1047
+ title: '@human-capital-management:employees.states.pending',
1048
+ generateView: true,
1049
+ }),
1050
+ ];
1051
+ this.transitions = [
1052
+ {
1053
+ from: AXPSystemStatusType.Pending,
1054
+ to: AXPSystemStatusType.Active,
1055
+ title: '@human-capital-management:employees.transitions.activate',
1056
+ },
1057
+ {
1058
+ from: AXPSystemStatusType.Active,
1059
+ to: OnLeave,
1060
+ title: '@human-capital-management:employees.transitions.start-leave',
1061
+ },
1062
+ {
1063
+ from: OnLeave,
1064
+ to: AXPSystemStatusType.Active,
1065
+ title: '@human-capital-management:employees.transitions.return-from-leave',
1066
+ },
1067
+ {
1068
+ from: AXPSystemStatusType.Active,
1069
+ to: AXPSystemStatusType.Suspended,
1070
+ title: '@human-capital-management:employees.transitions.suspend',
1071
+ },
1072
+ {
1073
+ from: AXPSystemStatusType.Suspended,
1074
+ to: AXPSystemStatusType.Active,
1075
+ title: '@human-capital-management:employees.transitions.resume',
1076
+ },
1077
+ {
1078
+ from: AXPSystemStatusType.Active,
1079
+ to: Terminated,
1080
+ title: '@human-capital-management:employees.transitions.terminate',
1081
+ },
1082
+ {
1083
+ from: OnLeave,
1084
+ to: Terminated,
1085
+ title: '@human-capital-management:employees.transitions.terminate',
1086
+ },
1087
+ {
1088
+ from: AXPSystemStatusType.Suspended,
1089
+ to: Terminated,
1090
+ title: '@human-capital-management:employees.transitions.terminate',
1091
+ },
1092
+ ];
1093
+ }
1094
+ }
1095
+ //#endregion
1096
+
1097
+ //#region ---- Imports ----
1098
+ //#endregion
1099
+ //#region ---- Position Assignment Status Provider ----
1100
+ /**
1101
+ * Position assignment lifecycle statuses used by status plugin badges and filters.
1102
+ */
1103
+ class AXMPositionAssignmentStatusProvider extends AXPStatusProvider {
1104
+ constructor() {
1105
+ super(...arguments);
1106
+ this.key = 'human-capital-management.status.position-assignment';
1107
+ this.defaultStatus = AXM_POSITION_ASSIGNMENT_STATUS.active;
1108
+ this.statuses = [
1109
+ systemStatusToDefinition(AXM_POSITION_ASSIGNMENT_STATUS.active, {
1110
+ title: '@human-capital-management:position-assignments.states.active',
1111
+ generateView: true,
1112
+ }),
1113
+ {
1114
+ name: AXM_POSITION_ASSIGNMENT_STATUS.scheduled,
1115
+ title: '@human-capital-management:position-assignments.states.scheduled',
1116
+ icon: 'fa-light fa-calendar-clock',
1117
+ color: 'info',
1118
+ order: 2,
1119
+ isInitial: false,
1120
+ isFinal: false,
1121
+ generateView: true,
1122
+ },
1123
+ {
1124
+ name: AXM_POSITION_ASSIGNMENT_STATUS.expired,
1125
+ title: '@human-capital-management:position-assignments.states.expired',
1126
+ icon: 'fa-light fa-clock-rotate-left',
1127
+ color: 'warning',
1128
+ order: 3,
1129
+ isInitial: false,
1130
+ isFinal: true,
1131
+ generateView: true,
1132
+ },
1133
+ {
1134
+ name: AXM_POSITION_ASSIGNMENT_STATUS.revoked,
1135
+ title: '@human-capital-management:position-assignments.states.revoked',
1136
+ icon: 'fa-light fa-user-slash',
1137
+ color: 'danger',
1138
+ order: 4,
1139
+ isInitial: false,
1140
+ isFinal: true,
1141
+ generateView: true,
1142
+ },
1143
+ ];
1144
+ this.transitions = [];
1145
+ }
1146
+ }
1147
+ //#endregion
1148
+
1149
+ //#region ---- Imports ----
1150
+ //#endregion
1151
+ //#region ---- Manifest Definition ----
1152
+ /**
1153
+ * Human Capital Management Module Manifest.
1154
+ * Defines module metadata, features, and provider references.
1155
+ */
1156
+ const HumanCapitalManagementManifest = {
1157
+ name: RootConfig.module.name,
1158
+ version: '1.0.0',
1159
+ title: RootConfig.module.title,
1160
+ icon: RootConfig.module.icon,
1161
+ i18n: RootConfig.config.i18n,
1162
+ type: 'domain',
1163
+ domain: 'human-capital',
1164
+ // Module dependencies
1165
+ dependencies: [
1166
+ 'OrganizationManagement',
1167
+ 'PersonCore',
1168
+ 'LocationManagement',
1169
+ 'DocumentManagement',
1170
+ 'AssessmentManagement',
1171
+ 'WorkflowManagement',
1172
+ 'DataManagement',
1173
+ ],
1174
+ };
1175
+ //#endregion
1176
+
1177
+ class AXMMenuProvider {
1178
+ constructor() {
1179
+ this.entityService = inject(AXPEntityService);
1180
+ this.sessionService = inject(AXPSessionService);
1181
+ }
1182
+ async provide(context) {
1183
+ const isAuthorized = await firstValueFrom(this.sessionService.isAuthorized$);
1184
+ if (!isAuthorized) {
1185
+ return;
1186
+ }
1187
+ const module = RootConfig.module;
1188
+ const keys = AXPPeopleOrganizationPermissionKeys;
1189
+ const organizationMenu = context.find(AXPCommonMenuKeys.Organization);
1190
+ if (!organizationMenu.exists) {
1191
+ context.addItems([
1192
+ {
1193
+ name: AXPCommonMenuKeys.Organization,
1194
+ priority: 8000,
1195
+ text: '@organization-management:module.menus.root.title',
1196
+ type: 'menu',
1197
+ icon: 'fa-light fa-sitemap',
1198
+ children: [],
1199
+ },
1200
+ ]);
1201
+ }
1202
+ context.find(AXPCommonMenuKeys.Organization).addItems([
1203
+ {
1204
+ name: AXPHumanCapitalManagementMenuKeys.Employees,
1205
+ text: '@human-capital-management:employees.menus.employees.title',
1206
+ path: this.entityService.createPath(module.name, RootConfig.entities.employee.name),
1207
+ priority: 10,
1208
+ icon: RootConfig.entities.employee.icon,
1209
+ policy: {
1210
+ permissions: [keys.MaintainEmployees],
1211
+ features: [AXPHumanCapitalManagementFeatureKeys.EmployeeManagement],
1212
+ },
1213
+ },
1214
+ {
1215
+ name: AXPHumanCapitalManagementMenuKeys.LeaveRequests,
1216
+ text: '@human-capital-management:leave-requests.menus.leave-requests.title',
1217
+ path: this.entityService.createPath(module.name, RootConfig.entities.leaveRequest.name),
1218
+ priority: 20,
1219
+ icon: RootConfig.entities.leaveRequest.icon,
1220
+ badgeKey: 'leave-request-badge',
1221
+ policy: {
1222
+ permissions: [keys.ManageEmployeeActions],
1223
+ features: [AXPHumanCapitalManagementFeatureKeys.LeaveManagement],
1224
+ },
1225
+ },
1226
+ ]);
1227
+ const orgConfigMenu = context.find(AXPCommonMenuKeys.OrganizationConfig);
1228
+ if (!orgConfigMenu.exists) {
1229
+ context.find(AXPCommonMenuKeys.Configuration).addItems([
1230
+ {
1231
+ name: AXPCommonMenuKeys.OrganizationConfig,
1232
+ priority: 8600,
1233
+ text: '@organization-management:module.menus.configuration.title',
1234
+ icon: module.icon,
1235
+ type: 'menu',
1236
+ children: [],
1237
+ },
1238
+ ]);
1239
+ }
1240
+ context.find(AXPCommonMenuKeys.OrganizationConfig).addItems([
1241
+ {
1242
+ name: AXPHumanCapitalManagementMenuKeys.EmploymentTypes,
1243
+ text: '@human-capital-management:employment-types.menus.employment-types.title',
1244
+ path: this.entityService.createPath(module.name, RootConfig.entities.employmentType.name),
1245
+ priority: 8,
1246
+ icon: RootConfig.entities.employmentType.icon,
1247
+ policy: {
1248
+ permissions: [keys.Setup],
1249
+ features: [AXPHumanCapitalManagementFeatureKeys.EmployeeManagement],
1250
+ },
1251
+ },
1252
+ {
1253
+ name: AXPHumanCapitalManagementMenuKeys.LeaveTypes,
1254
+ text: '@human-capital-management:leave-types.menus.leave-types.title',
1255
+ path: this.entityService.createPath(module.name, RootConfig.entities.leaveType.name),
1256
+ priority: 9,
1257
+ icon: RootConfig.entities.leaveType.icon,
1258
+ policy: {
1259
+ permissions: [keys.Setup],
1260
+ features: [AXPHumanCapitalManagementFeatureKeys.LeaveManagement],
1261
+ },
1262
+ },
1263
+ {
1264
+ name: AXPHumanCapitalManagementMenuKeys.LifecycleEventTypes,
1265
+ text: '@human-capital-management:lifecycle-event-types.menus.lifecycle-event-types.title',
1266
+ path: this.entityService.createPath(module.name, RootConfig.entities.lifecycleEventType.name),
1267
+ priority: 10,
1268
+ icon: RootConfig.entities.lifecycleEventType.icon,
1269
+ policy: {
1270
+ permissions: [keys.Setup],
1271
+ features: [AXPHumanCapitalManagementFeatureKeys.LifecycleManagement],
1272
+ },
1273
+ },
1274
+ ]);
1275
+ }
1276
+ }
1277
+
1278
+ //#region ---- Imports ----
1279
+ //#endregion
1280
+ //#region ---- Constants ----
1281
+ const orgChartNodeActionKey = (suffix) => `@human-capital-management:organization-chart.node-actions.${suffix}`;
1282
+ const positionAssignmentSubmenuGroupId = 'position-assignment';
1283
+ //#endregion
1284
+ class AXMHcmOrgChartNodeContributionProvider {
1285
+ constructor() {
1286
+ //#region ---- Services & Dependencies ----
1287
+ this.commandService = inject(AXPCommandService);
1288
+ this.sessionService = inject(AXPSessionService);
1289
+ }
1290
+ //#endregion
1291
+ //#region ---- AXMOrgChartNodeContributionProvider Implementation ----
1292
+ async getMenuActions(context) {
1293
+ if (context.nodeKind !== 'company-root' && context.nodeKind !== 'business-unit') {
1294
+ return [];
1295
+ }
1296
+ const businessUnitId = this.resolveBusinessUnitId(context);
1297
+ const positionId = this.resolveManagerPositionId(context);
1298
+ const hasManager = this.hasAssignedManager(context);
1299
+ const shouldShowVacantAssignAction = context.nodeKind === 'business-unit' && this.hasVacantBusinessUnitHead(context);
1300
+ const canMaintainOrganization = this.sessionService.authorize(AXPPeopleOrganizationPermissionKeys.MaintainOrganization);
1301
+ const canCreatePositionAssignment = canMaintainOrganization;
1302
+ const canEditPositionAssignment = canMaintainOrganization;
1303
+ const assignVacantHeadAction = shouldShowVacantAssignAction
1304
+ ? {
1305
+ id: 'organization-management.assign-employee-to-head',
1306
+ title: orgChartNodeActionKey('assign-manager'),
1307
+ icon: 'fa-light fa-user-plus',
1308
+ order: 95,
1309
+ submenuGroupId: positionAssignmentSubmenuGroupId,
1310
+ submenuGroupTitle: orgChartNodeActionKey('position-assignment'),
1311
+ submenuGroupIcon: 'fa-light fa-user-tie',
1312
+ disabled: !canCreatePositionAssignment || !businessUnitId || !positionId,
1313
+ execute: async () => {
1314
+ if (!businessUnitId || !positionId) {
1315
+ return;
1316
+ }
1317
+ const result = await this.commandService.execute(AXPHumanCapitalManagementCommandKeys.PositionAssignment.Assign, {
1318
+ data: {
1319
+ businessUnitId,
1320
+ positionId,
1321
+ isPrimary: true,
1322
+ },
1323
+ });
1324
+ if (result?.success) {
1325
+ await context.refreshChart();
1326
+ }
1327
+ },
1328
+ }
1329
+ : null;
1330
+ const managerAction = {
1331
+ id: 'organization-management.assign-manager',
1332
+ title: hasManager ? orgChartNodeActionKey('change-manager') : orgChartNodeActionKey('assign-manager'),
1333
+ icon: 'fa-light fa-user-tie',
1334
+ order: 100,
1335
+ submenuGroupId: positionAssignmentSubmenuGroupId,
1336
+ submenuGroupTitle: orgChartNodeActionKey('position-assignment'),
1337
+ submenuGroupIcon: 'fa-light fa-user-tie',
1338
+ disabled: !canCreatePositionAssignment || !businessUnitId || !positionId,
1339
+ execute: async () => {
1340
+ if (!businessUnitId || !positionId) {
1341
+ return;
1342
+ }
1343
+ const result = await this.commandService.execute(AXPHumanCapitalManagementCommandKeys.PositionAssignment.Assign, {
1344
+ data: {
1345
+ businessUnitId,
1346
+ positionId,
1347
+ isPrimary: true,
1348
+ },
1349
+ });
1350
+ if (result?.success) {
1351
+ await context.refreshChart();
1352
+ }
1353
+ },
1354
+ };
1355
+ const revokeManagerAction = {
1356
+ id: 'organization-management.revoke-manager',
1357
+ title: orgChartNodeActionKey('revoke-manager-assignment'),
1358
+ icon: 'fa-light fa-user-minus',
1359
+ color: 'danger',
1360
+ order: 110,
1361
+ submenuGroupId: positionAssignmentSubmenuGroupId,
1362
+ submenuGroupTitle: orgChartNodeActionKey('position-assignment'),
1363
+ submenuGroupIcon: 'fa-light fa-user-tie',
1364
+ disabled: !canEditPositionAssignment || !hasManager || !positionId,
1365
+ execute: async () => {
1366
+ if (!positionId) {
1367
+ return;
1368
+ }
1369
+ const employeeId = this.resolveManagerEmployeeId(context);
1370
+ if (!employeeId) {
1371
+ return;
1372
+ }
1373
+ const result = await this.commandService.execute(AXPHumanCapitalManagementCommandKeys.PositionAssignment.Revoke, {
1374
+ positionId,
1375
+ employeeId,
1376
+ businessUnitId,
1377
+ });
1378
+ if (result?.success) {
1379
+ await context.refreshChart();
1380
+ }
1381
+ },
1382
+ };
1383
+ return [
1384
+ ...(assignVacantHeadAction ? [assignVacantHeadAction] : []),
1385
+ ...(!shouldShowVacantAssignAction ? [managerAction] : []),
1386
+ ...(hasManager ? [revokeManagerAction] : []),
1387
+ ];
1388
+ }
1389
+ //#endregion
1390
+ //#region ---- Node Metadata ----
1391
+ resolveBusinessUnitId(context) {
1392
+ if (context.nodeKind === 'business-unit') {
1393
+ return (context.node.entity?.id ??
1394
+ context.node.metadata?.['businessUnitId'] ??
1395
+ context.node.metadata?.['unitId']);
1396
+ }
1397
+ // Company root (merged-executive chart): corporate scope is often `mergedCorporateBusinessUnitId`, not `businessUnitId`.
1398
+ const meta = context.node.metadata;
1399
+ return (meta?.['businessUnitId'] ??
1400
+ meta?.['mergedCorporateBusinessUnitId']);
1401
+ }
1402
+ resolveManagerPositionId(context) {
1403
+ const metadata = context.node.metadata ?? {};
1404
+ const topRole = metadata['topRole'];
1405
+ const unitHead = metadata['unitHead'];
1406
+ return (unitHead?.['positionId'] ??
1407
+ topRole?.['positionId'] ??
1408
+ metadata['headPositionId']);
1409
+ }
1410
+ hasAssignedManager(context) {
1411
+ const metadata = context.node.metadata ?? {};
1412
+ if (context.nodeKind === 'company-root') {
1413
+ const topRole = metadata['topRole'];
1414
+ if (!topRole) {
1415
+ return false;
1416
+ }
1417
+ const vacant = topRole['vacant'] === true;
1418
+ const employeeName = topRole['employeeName'];
1419
+ return !vacant && typeof employeeName === 'string' && employeeName.trim().length > 0;
1420
+ }
1421
+ if (context.nodeKind === 'business-unit') {
1422
+ const unitHead = metadata['unitHead'];
1423
+ if (!unitHead) {
1424
+ return false;
1425
+ }
1426
+ const vacant = unitHead['vacant'] === true;
1427
+ const employeeName = unitHead['employeeName'];
1428
+ return !vacant && typeof employeeName === 'string' && employeeName.trim().length > 0;
1429
+ }
1430
+ return false;
1431
+ }
1432
+ resolveManagerEmployeeId(context) {
1433
+ const metadata = context.node.metadata ?? {};
1434
+ if (context.nodeKind === 'company-root') {
1435
+ const topRole = metadata['topRole'];
1436
+ const employeeId = topRole?.['employeeId'];
1437
+ return typeof employeeId === 'string' && employeeId.trim().length > 0 ? employeeId : undefined;
1438
+ }
1439
+ if (context.nodeKind === 'business-unit') {
1440
+ const unitHead = metadata['unitHead'];
1441
+ const employeeId = unitHead?.['employeeId'];
1442
+ return typeof employeeId === 'string' && employeeId.trim().length > 0 ? employeeId : undefined;
1443
+ }
1444
+ return undefined;
1445
+ }
1446
+ hasVacantBusinessUnitHead(context) {
1447
+ if (context.nodeKind !== 'business-unit') {
1448
+ return false;
1449
+ }
1450
+ const metadata = context.node.metadata ?? {};
1451
+ const unitHead = metadata['unitHead'];
1452
+ return unitHead?.['vacant'] === true;
1453
+ }
1454
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHcmOrgChartNodeContributionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1455
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHcmOrgChartNodeContributionProvider }); }
1456
+ }
1457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHcmOrgChartNodeContributionProvider, decorators: [{
1458
+ type: Injectable
1459
+ }] });
1460
+
1461
+ /**
1462
+ * Manager approval due date for leave requests:
1463
+ * one calendar day before leave start, or the start date when leave begins today.
1464
+ */
1465
+ function resolveLeaveRequestManagerApprovalDueDate(calendarService, startDateRaw) {
1466
+ const start = coerceLocalDay(calendarService, startDateRaw);
1467
+ if (!start) {
1468
+ return null;
1469
+ }
1470
+ const today = calendarService.now().startOf('day');
1471
+ const startDay = calendarService.create(start).startOf('day');
1472
+ if (startDay.date.getTime() === today.date.getTime()) {
1473
+ return startDay.date;
1474
+ }
1475
+ return startDay.add('day', -1).date;
1476
+ }
1477
+ function coerceLocalDay(calendarService, value) {
1478
+ if (value == null || value === '') {
1479
+ return null;
1480
+ }
1481
+ if (value instanceof Date) {
1482
+ return Number.isNaN(value.getTime()) ? null : value;
1483
+ }
1484
+ if (typeof value === 'string') {
1485
+ const trimmed = value.trim();
1486
+ if (!trimmed) {
1487
+ return null;
1488
+ }
1489
+ try {
1490
+ return calendarService.create(trimmed).startOf('day').date;
1491
+ }
1492
+ catch {
1493
+ return null;
1494
+ }
1495
+ }
1496
+ return null;
1497
+ }
1498
+
1499
+ //#region ---- Imports ----
1500
+ //#endregion
1501
+ /**
1502
+ * Expression-evaluator scope for leave request "Create" dropdown items (leave type templates).
1503
+ */
1504
+ class AXMHumanCapitalManagementLeaveRequestExpressionEvaluatorScopeProvider {
1505
+ constructor() {
1506
+ //#region ---- Services & Dependencies ----
1507
+ this.entityService = inject(AXPEntityService);
1508
+ this.translation = inject(AXTranslationService);
1509
+ this.calendarService = inject(AXCalendarService);
1510
+ //#endregion
1511
+ }
1512
+ //#endregion
1513
+ //#region ---- AXPExpressionEvaluatorScopeProvider ----
1514
+ async provide(context) {
1515
+ context.addScope(RootConfig.module.name, {
1516
+ /**
1517
+ * Due date for the manager leave-approval human task (workflow expression helper).
1518
+ * One day before leave start; when leave starts today, due date is the start date.
1519
+ */
1520
+ leaveRequestManagerApprovalDueDate: (startDateRaw) => resolveLeaveRequestManagerApprovalDueDate(this.calendarService, startDateRaw),
1521
+ /**
1522
+ * Loads leave types and returns toolbar child actions.
1523
+ * Types with workflowConfig run `HumanCapitalManagement.LeaveRequest:StartFlow`.
1524
+ */
1525
+ LeaveRequests: async () => {
1526
+ try {
1527
+ const locale = this.translation.getActiveLang();
1528
+ const page = await this.entityService
1529
+ .withEntity(RootConfig.module.name, RootConfig.entities.leaveType.name)
1530
+ .data()
1531
+ .query({ skip: 0, take: 500 });
1532
+ const rows = (page.items ?? []);
1533
+ const sorted = [...rows].sort((a, b) => {
1534
+ const ta = resolveMultiLanguageString(a.title, locale).trim() || a.id;
1535
+ const tb = resolveMultiLanguageString(b.title, locale).trim() || b.id;
1536
+ return ta.localeCompare(tb, locale, { sensitivity: 'base' });
1537
+ });
1538
+ return sorted.map((row) => {
1539
+ const title = resolveMultiLanguageString(row.title, locale).trim() || row.id;
1540
+ const workflowConfig = row.workflowConfig;
1541
+ const workflowId = workflowConfig?.workflowName?.trim();
1542
+ const defaultInput = workflowConfig?.defaultInput ?? {};
1543
+ const guidedFlowCommand = workflowId
1544
+ ? {
1545
+ name: AXPHumanCapitalManagementCommandKeys.LeaveRequest.StartFlow,
1546
+ options: {
1547
+ workflowId,
1548
+ input: merge({
1549
+ employeeId: '{{ context.eval("id") }}',
1550
+ employeeDisplayName: '{{ context.eval("person.fullName") }}',
1551
+ leaveTypeId: row.id,
1552
+ leaveTypeTitle: row.title,
1553
+ }, defaultInput),
1554
+ },
1555
+ }
1556
+ : undefined;
1557
+ const notImplementedToastCommand = {
1558
+ name: 'workflow-activity:show-toast',
1559
+ options: {
1560
+ message: '@human-capital-management:leave-requests.messages.request-not-implemented',
1561
+ type: 'warning',
1562
+ },
1563
+ };
1564
+ return {
1565
+ name: `start-leave-request-${row.id}`,
1566
+ title,
1567
+ icon: 'fa-light fa-calendar-plus',
1568
+ color: 'default',
1569
+ command: guidedFlowCommand ?? notImplementedToastCommand,
1570
+ priority: 'primary',
1571
+ type: 'info',
1572
+ scope: AXPEntityCommandScope.TypeLevel,
1573
+ };
1574
+ });
1575
+ }
1576
+ catch (error) {
1577
+ console.error(`${RootConfig.module.name}.LeaveRequests failed:`, error instanceof Error ? error.message : error);
1578
+ return [];
1579
+ }
1580
+ },
1581
+ });
1582
+ }
1583
+ }
1584
+
1585
+ //#region ---- Imports ----
1586
+ //#endregion
1587
+ //#region ---- Icon helpers ----
1588
+ /** Dropdown items render `fa-light {{ suffix }}`; strip a leading FA style token from full icon classes. */
1589
+ function lifecycleEventMenuIconSuffix(icon) {
1590
+ const trimmed = icon?.trim();
1591
+ if (!trimmed) {
1592
+ return 'fa-circle-plus';
1593
+ }
1594
+ const rest = trimmed.replace(/^(fa-(?:duotone|solid|regular|light|thin|brands))\s+/i, '').trim();
1595
+ return rest || 'fa-circle-plus';
1596
+ }
1597
+ //#endregion
1598
+ /**
1599
+ * Expression-evaluator scope for lifecycle event "Start" dropdown items (event type templates).
1600
+ */
1601
+ class AXMHumanCapitalManagementLifecycleEventExpressionEvaluatorScopeProvider {
1602
+ constructor() {
1603
+ //#region ---- Services & Dependencies ----
1604
+ this.entityService = inject(AXPEntityService);
1605
+ this.translation = inject(AXTranslationService);
1606
+ //#endregion
1607
+ }
1608
+ //#endregion
1609
+ //#region ---- AXPExpressionEvaluatorScopeProvider ----
1610
+ async provide(context) {
1611
+ context.addScope(RootConfig.module.name, {
1612
+ /**
1613
+ * Loads lifecycle event types and returns toolbar child actions.
1614
+ * Templates that define onboarding/offboarding targets run `HumanCapitalManagement.LifecycleEvent:StartFlow`;
1615
+ * other types show a not-implemented toast until wired.
1616
+ */
1617
+ LifecycleEvents: async () => {
1618
+ try {
1619
+ const locale = this.translation.getActiveLang();
1620
+ const page = await this.entityService
1621
+ .withEntity(RootConfig.module.name, RootConfig.entities.lifecycleEventType.name)
1622
+ .data()
1623
+ .query({ skip: 0, take: 500 });
1624
+ const rows = (page.items ?? []);
1625
+ const sorted = [...rows].sort((a, b) => {
1626
+ const ta = resolveMultiLanguageString(a.title, locale).trim() || a.id;
1627
+ const tb = resolveMultiLanguageString(b.title, locale).trim() || b.id;
1628
+ return ta.localeCompare(tb, locale, { sensitivity: 'base' });
1629
+ });
1630
+ return sorted.map((row) => {
1631
+ const menuTitle = resolveMultiLanguageString(row.title, locale).trim() || row.id;
1632
+ const workflowConfig = row.workflowConfig;
1633
+ const workflowId = workflowConfig?.workflowName?.trim();
1634
+ const defaultInput = workflowConfig?.defaultInput ?? {};
1635
+ const questionnaireId = get(defaultInput, 'questionnaireId');
1636
+ const guidedFlowCommand = workflowId && questionnaireId
1637
+ ? {
1638
+ name: AXPHumanCapitalManagementCommandKeys.LifecycleEvent.StartFlow,
1639
+ options: {
1640
+ workflowId,
1641
+ input: {
1642
+ employeeId: '{{ context.eval("id") }}',
1643
+ employeeDisplayName: '{{ context.eval("person.fullName") }}',
1644
+ eventTypeId: row.id,
1645
+ eventTypeTitle: row.title,
1646
+ questionnaireId,
1647
+ },
1648
+ },
1649
+ }
1650
+ : undefined;
1651
+ const notImplementedToastCommand = {
1652
+ name: 'workflow-activity:show-toast',
1653
+ options: {
1654
+ message: '@human-capital-management:lifecycle-events.messages.event-not-implemented',
1655
+ type: 'warning',
1656
+ },
1657
+ };
1658
+ return {
1659
+ name: `start-lifecycle-event-${row.id}`,
1660
+ title: menuTitle,
1661
+ icon: lifecycleEventMenuIconSuffix(row.icon),
1662
+ color: 'default',
1663
+ command: guidedFlowCommand ?? notImplementedToastCommand,
1664
+ priority: 'primary',
1665
+ type: 'info',
1666
+ scope: AXPEntityCommandScope.TypeLevel,
1667
+ };
1668
+ });
1669
+ }
1670
+ catch (error) {
1671
+ console.error(`${RootConfig.module.name}.LifecycleEvents failed:`, error instanceof Error ? error.message : error);
1672
+ return [];
1673
+ }
1674
+ },
1675
+ });
1676
+ }
1677
+ }
1678
+
1679
+ //#endregion
1680
+ //#region ---- Constants ----
1681
+ const QUESTIONNAIRE = 'AssessmentManagement.Questionnaire';
1682
+ const QUESTION_BANK_ITEM = 'AssessmentManagement.QuestionBankItem';
1683
+ const WORKFLOW_DEFINITION = 'WorkflowManagement.WorkflowDefinition';
1684
+ const HCM_CATALOG_TARGETS = [QUESTIONNAIRE, QUESTION_BANK_ITEM, WORKFLOW_DEFINITION];
1685
+ //#endregion
1686
+ //#region ---- Provider ----
1687
+ class AXMHumanCapitalManagementCatalogScopeDefinitionProvider {
1688
+ async items() {
1689
+ return [
1690
+ {
1691
+ name: HCM_CATALOG_SCOPE_HR,
1692
+ title: '@human-capital-management:catalog-scopes.hr.title',
1693
+ description: '@human-capital-management:catalog-scopes.hr.description',
1694
+ targets: [...HCM_CATALOG_TARGETS],
1695
+ icon: 'fa-light fa-people-arrows',
1696
+ cssClass: 'warning-lighter',
1697
+ order: 10,
1698
+ },
1699
+ ];
1700
+ }
1701
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHumanCapitalManagementCatalogScopeDefinitionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1702
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHumanCapitalManagementCatalogScopeDefinitionProvider }); }
1703
+ }
1704
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHumanCapitalManagementCatalogScopeDefinitionProvider, decorators: [{
1705
+ type: Injectable
1706
+ }] });
1707
+
1708
+ //#endregion
1709
+ //#region ---- HCM profile context service ----
1710
+ /** Resolves the current user's employee and linked person for self-service profile flows. */
1711
+ class AXMHcmProfileContextService {
1712
+ constructor() {
1713
+ //#region ----- Services & Dependencies -----
1714
+ this.sessionService = inject(AXPSessionService);
1715
+ this.entityService = inject(AXPEntityService);
1716
+ //#endregion
1717
+ //#region ----- State -----
1718
+ this.cachedUserId = null;
1719
+ this.inflight = null;
1720
+ }
1721
+ //#endregion
1722
+ //#region ----- Public API -----
1723
+ async resolve() {
1724
+ const userId = this.sessionService.user?.id;
1725
+ if (!userId) {
1726
+ this.clearCache();
1727
+ return null;
1728
+ }
1729
+ if (this.cachedUserId === userId && this.cachedContext !== undefined) {
1730
+ return this.cachedContext;
1731
+ }
1732
+ if (this.inflight && this.cachedUserId === userId) {
1733
+ return this.inflight;
1734
+ }
1735
+ this.cachedUserId = userId;
1736
+ this.inflight = this.loadContext(userId).finally(() => {
1737
+ this.inflight = null;
1738
+ });
1739
+ this.cachedContext = await this.inflight;
1740
+ return this.cachedContext;
1741
+ }
1742
+ clearCache() {
1743
+ this.cachedUserId = null;
1744
+ this.cachedContext = undefined;
1745
+ this.inflight = null;
1746
+ }
1747
+ //#endregion
1748
+ //#region ----- Private Methods -----
1749
+ async loadContext(userId) {
1750
+ const employeeResult = await this.entityService
1751
+ .withEntity(RootConfig.module.name, RootConfig.entities.employee.name)
1752
+ .data()
1753
+ .query({
1754
+ filter: {
1755
+ field: 'userId',
1756
+ operator: { type: 'equal' },
1757
+ value: userId,
1758
+ },
1759
+ take: 1,
1760
+ skip: 0,
1761
+ });
1762
+ const employee = first(employeeResult.items);
1763
+ const employeeId = get(employee, 'id');
1764
+ const personId = get(employee, 'personId');
1765
+ if (!employeeId || !personId) {
1766
+ return null;
1767
+ }
1768
+ return { userId, employeeId, personId };
1769
+ }
1770
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHcmProfileContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1771
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHcmProfileContextService, providedIn: 'root' }); }
1772
+ }
1773
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHcmProfileContextService, decorators: [{
1774
+ type: Injectable,
1775
+ args: [{ providedIn: 'root' }]
1776
+ }] });
1777
+
1778
+ //#region ---- Helpers ----
1779
+ const comingSoon = (messageKey) => ({
1780
+ name: 'auth:profile-coming-soon',
1781
+ options: { messageKey },
1782
+ });
1783
+ //#endregion
1784
+ //#region ---- Human capital profile sections ----
1785
+ /** Overrides account identity sections for employees and contributes HR profile sections. */
1786
+ const HumanCapitalProfileSectionsHookProvider = {
1787
+ key: PROFILE_PAGE_SECTIONS_HOOK,
1788
+ priority: 20,
1789
+ execute: async (payload) => {
1790
+ const requestsRequested = isUserProfileSectionsGroupRequested(payload, 'requests');
1791
+ const accountRequested = isUserProfileSectionsGroupRequested(payload, 'account');
1792
+ if (!accountRequested && !requestsRequested) {
1793
+ return payload;
1794
+ }
1795
+ const profileContextService = inject(AXMHcmProfileContextService);
1796
+ const profileContext = accountRequested ? await profileContextService.resolve() : null;
1797
+ const baseSections = profileContext
1798
+ ? payload.sections.filter((section) => section.id !== 'basic-info' && section.id !== 'signature')
1799
+ : payload.sections;
1800
+ const identitySections = profileContext
1801
+ ? [
1802
+ {
1803
+ id: 'basic-info',
1804
+ groupId: 'account',
1805
+ title: '@auth:profile-page.sections.basic-info.title',
1806
+ description: '@auth:profile-page.sections.basic-info.description',
1807
+ icon: 'far fa-address-card',
1808
+ priority: 10,
1809
+ layout: { colSpan: 6 },
1810
+ actions: [
1811
+ {
1812
+ name: 'edit-basic-info',
1813
+ title: '@auth:profile-page.sections.basic-info.actions.edit',
1814
+ icon: 'far fa-pen',
1815
+ command: { name: AXPHumanCapitalManagementCommandKeys.Profile.EditPersonalInfo },
1816
+ },
1817
+ ],
1818
+ },
1819
+ {
1820
+ id: 'signature',
1821
+ groupId: 'account',
1822
+ title: '@auth:profile-page.sections.signature.title',
1823
+ description: '@auth:profile-page.sections.signature.description',
1824
+ icon: 'far fa-signature',
1825
+ priority: 20,
1826
+ layout: { colSpan: 6 },
1827
+ actions: [
1828
+ {
1829
+ name: 'edit-signature',
1830
+ title: '@auth:profile-page.sections.signature.actions.manage',
1831
+ icon: 'far fa-pen',
1832
+ command: { name: AXPHumanCapitalManagementCommandKeys.Profile.EditSignature },
1833
+ },
1834
+ ],
1835
+ },
1836
+ ]
1837
+ : [];
1838
+ const requestSections = requestsRequested
1839
+ ? [
1840
+ {
1841
+ id: 'my-leave-requests',
1842
+ groupId: 'requests',
1843
+ title: '@human-capital-management:profile-page.sections.my-leave-requests.title',
1844
+ description: '@human-capital-management:profile-page.sections.my-leave-requests.description',
1845
+ icon: 'far fa-calendar-days',
1846
+ priority: 20,
1847
+ layout: { colSpan: 6 },
1848
+ actions: [
1849
+ {
1850
+ name: 'view-my-leave-requests',
1851
+ title: '@human-capital-management:profile-page.sections.my-leave-requests.actions.manage',
1852
+ icon: 'far fa-arrow-right',
1853
+ command: comingSoon('@human-capital-management:profile-page.commands.view-my-leave-requests.coming-soon'),
1854
+ },
1855
+ ],
1856
+ },
1857
+ ]
1858
+ : [];
1859
+ return {
1860
+ ...payload,
1861
+ sections: [...baseSections, ...identitySections, ...requestSections],
1862
+ };
1863
+ },
1864
+ };
1865
+ //#endregion
1866
+
1867
+ /** Lazy Documents tab host; fetches drive context on first visit. */
1868
+ const PROFILE_DOCUMENTS_PANEL_COMPONENT_KEY = 'hcm.profile-documents-panel';
1869
+ /** Same page component key registered by document-management `documents` plugin. */
1870
+ const DOCUMENT_DRIVE_PAGE_COMPONENT_KEY = 'entity-document-drive-page';
1871
+
1872
+ //#region ----- Imports -----
1873
+ //#endregion
1874
+ //#region ----- Human capital profile documents group -----
1875
+ /**
1876
+ * Adds the Documents profile tab when the session user has a linked Employee.
1877
+ * Drive content is fetched when the tab is first opened.
1878
+ */
1879
+ const HumanCapitalProfileDocumentsGroupsHookProvider = {
1880
+ key: PROFILE_PAGE_GROUPS_HOOK,
1881
+ priority: 35,
1882
+ execute: async (payload) => {
1883
+ const profileContext = await inject(AXMHcmProfileContextService).resolve();
1884
+ if (!profileContext?.employeeId) {
1885
+ return payload;
1886
+ }
1887
+ return {
1888
+ ...payload,
1889
+ groups: [
1890
+ ...payload.groups,
1891
+ {
1892
+ id: 'documents',
1893
+ title: '@human-capital-management:profile-page.groups.documents.title',
1894
+ icon: 'far fa-folder-open',
1895
+ priority: 35,
1896
+ content: {
1897
+ mode: 'component',
1898
+ componentKey: PROFILE_DOCUMENTS_PANEL_COMPONENT_KEY,
1899
+ },
1900
+ },
1901
+ ],
1902
+ };
1903
+ },
1904
+ };
1905
+ //#endregion
1906
+
1907
+ //#region ----- Helpers -----
1908
+ const POSITION_LABEL = '@human-capital-management:employees.entities.employee.fields.primary-position';
1909
+ const BUSINESS_UNIT_LABEL = '@human-capital-management:employees.entities.employee.fields.primary-business-unit';
1910
+ function asDisplayTitle(value, locale) {
1911
+ return resolveMultiLanguageString$1(value, locale).trim();
1912
+ }
1913
+ function pickActiveAssignment(items) {
1914
+ const active = items.filter((item) => item.statusId === AXM_POSITION_ASSIGNMENT_STATUS.active);
1915
+ return active.find((item) => item.isPrimary === true) ?? first(active);
1916
+ }
1917
+ function orgRows(positionTitle, businessUnitTitle) {
1918
+ const rows = [];
1919
+ if (positionTitle && hasMultiLanguageContent(positionTitle)) {
1920
+ rows.push({
1921
+ id: 'hcm.primary-position',
1922
+ label: POSITION_LABEL,
1923
+ value: positionTitle,
1924
+ priority: 10,
1925
+ });
1926
+ }
1927
+ if (businessUnitTitle && hasMultiLanguageContent(businessUnitTitle)) {
1928
+ rows.push({
1929
+ id: 'hcm.primary-business-unit',
1930
+ label: BUSINESS_UNIT_LABEL,
1931
+ value: businessUnitTitle,
1932
+ priority: 20,
1933
+ });
1934
+ }
1935
+ return rows;
1936
+ }
1937
+ async function loadActiveAssignment(entityService, employeeId) {
1938
+ const result = await entityService
1939
+ .withEntity(RootConfig.module.name, RootConfig.entities.positionAssignment.name)
1940
+ .data()
1941
+ .query({
1942
+ skip: 0,
1943
+ take: 50,
1944
+ sort: [{ field: 'startDate', dir: 'desc' }],
1945
+ filter: {
1946
+ logic: 'and',
1947
+ filters: [
1948
+ { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },
1949
+ { field: 'statusId', operator: { type: 'equal' }, value: AXM_POSITION_ASSIGNMENT_STATUS.active },
1950
+ ],
1951
+ },
1952
+ });
1953
+ return pickActiveAssignment(result.items ?? []);
1954
+ }
1955
+ //#endregion
1956
+ //#region ----- Human capital user-card items -----
1957
+ /**
1958
+ * Contributes the employee's current position and business unit as user-card badges.
1959
+ * Prefers the denormalized active primary assignment; falls back to the first active position assignment.
1960
+ */
1961
+ const HumanCapitalUserCardItemsHookProvider = {
1962
+ key: USER_CARD_ITEMS_HOOK,
1963
+ priority: 20,
1964
+ execute: async (payload) => {
1965
+ const userId = payload.userId?.trim();
1966
+ if (!userId) {
1967
+ return payload;
1968
+ }
1969
+ const entityService = inject(AXPEntityService);
1970
+ const locale = inject(LOCALE_ID);
1971
+ try {
1972
+ const employeeResult = await entityService
1973
+ .withEntity(RootConfig.module.name, RootConfig.entities.employee.name)
1974
+ .data()
1975
+ .query({
1976
+ filter: {
1977
+ field: 'userId',
1978
+ operator: { type: 'equal' },
1979
+ value: userId,
1980
+ },
1981
+ take: 1,
1982
+ skip: 0,
1983
+ });
1984
+ const employee = first(employeeResult.items);
1985
+ if (!employee?.id) {
1986
+ return payload;
1987
+ }
1988
+ let positionTitle = asDisplayTitle(employee.activePrimaryPosition?.title, locale);
1989
+ let businessUnitTitle = asDisplayTitle(employee.activePrimaryBusinessUnit?.title, locale);
1990
+ if (!positionTitle || !businessUnitTitle) {
1991
+ const assignment = await loadActiveAssignment(entityService, employee.id);
1992
+ if (assignment) {
1993
+ positionTitle = positionTitle || asDisplayTitle(assignment.position?.title, locale);
1994
+ businessUnitTitle = businessUnitTitle || asDisplayTitle(assignment.businessUnit?.title, locale);
1995
+ }
1996
+ }
1997
+ const rows = orgRows(positionTitle, businessUnitTitle);
1998
+ if (!rows.length) {
1999
+ return payload;
2000
+ }
2001
+ return {
2002
+ ...payload,
2003
+ rows: [...payload.rows, ...rows],
2004
+ };
2005
+ }
2006
+ catch {
2007
+ return payload;
2008
+ }
2009
+ },
2010
+ };
2011
+ //#endregion
2012
+
2013
+ //#endregion
2014
+ //#region ---- Permission Definition Provider ----
2015
+ /**
2016
+ * Registers HCM-owned People & Organization capabilities into the shared domain groups.
2017
+ */
2018
+ class AXMPermissionDefinitionProvider {
2019
+ async define(context) {
2020
+ const keys = AXPPeopleOrganizationPermissionKeys;
2021
+ const groups = AXPCommonPermissionGroupKeys;
2022
+ const P = '@common:people-organization.permissions';
2023
+ const G = '@common:permission-groups';
2024
+ context.addGroup(groups.PeopleOrganization.Root, `${G}.people-organization.title`, `${G}.people-organization.description`, { order: 10 });
2025
+ context
2026
+ .addGroup(groups.PeopleOrganization.Workforce, `${G}.people-organization-workforce.title`, `${G}.people-organization-workforce.description`, { parent: groups.PeopleOrganization.Root, order: 20 })
2027
+ .addPermission(keys.MaintainEmployees, `${P}.maintain-employees.title`, `${P}.maintain-employees.description`)
2028
+ .endPermission()
2029
+ .addPermission(keys.ManageEmployeeActions, `${P}.manage-employee-actions.title`, `${P}.manage-employee-actions.description`)
2030
+ .endPermission()
2031
+ .endGroup();
2032
+ }
2033
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPermissionDefinitionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2034
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPermissionDefinitionProvider }); }
2035
+ }
2036
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPermissionDefinitionProvider, decorators: [{
2037
+ type: Injectable
2038
+ }] });
2039
+
2040
+ //#region ---- Appointment Board Route ----
2041
+ function createAppointmentBoardRoute() {
2042
+ const config = inject(AXP_ENTITY_CONFIG_TOKEN);
2043
+ return {
2044
+ path: `:app/${RootConfig.pages.appointmentBoard.path}/:provider-name`,
2045
+ canActivate: [...AXP_PROTECTED_ROUTE_GUARDS],
2046
+ data: { rootLayout: true },
2047
+ loadComponent: () => config.viewers.root(),
2048
+ children: [
2049
+ {
2050
+ path: '',
2051
+ loadComponent: () => import('@acorex-platform/module-common-client').then((c) => c.AXPResourceAppointmentPageComponent),
2052
+ providers: [
2053
+ {
2054
+ provide: AXP_RESOURCE_APPOINTMENT_PAGE_CONFIG,
2055
+ useValue: {
2056
+ pageTitle: RootConfig.pages.appointmentBoard.title,
2057
+ pageDescription: '@human-capital-management:leave-requests.menus.appointment-board.description',
2058
+ pageIcon: RootConfig.pages.appointmentBoard.icon,
2059
+ breadcrumbs: [{ title: RootConfig.module.title }],
2060
+ showResourceHeaders: true,
2061
+ showUnassignedAppointments: true,
2062
+ },
2063
+ },
2064
+ ],
2065
+ },
2066
+ ],
2067
+ };
2068
+ }
2069
+ //#endregion
2070
+ class AXMHumanCapitalManagementModule {
2071
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHumanCapitalManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2072
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMHumanCapitalManagementModule, imports: [CommonModule,
2073
+ AXPRuntimeModule,
2074
+ AXMLeaveRequestFeatureModule,
2075
+ AXMLifecycleEventFeatureModule] }); }
2076
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHumanCapitalManagementModule, providers: [
2077
+ // Appointment Board route
2078
+ {
2079
+ provide: ROUTES,
2080
+ multi: true,
2081
+ useFactory: () => [createAppointmentBoardRoute()],
2082
+ },
2083
+ {
2084
+ provide: AXP_RESOURCE_APPOINTMENT_PROVIDER,
2085
+ useClass: AXMLeaveRequestResourceAppointmentProvider,
2086
+ multi: true,
2087
+ },
2088
+ // Module-specific providers (not part of manifest system)
2089
+ {
2090
+ provide: AXP_STATUS_PROVIDERS,
2091
+ useClass: AXMEmployeeStatusProvider,
2092
+ multi: true,
2093
+ },
2094
+ {
2095
+ provide: AXP_STATUS_PROVIDERS,
2096
+ useClass: AXMPositionAssignmentStatusProvider,
2097
+ multi: true,
2098
+ },
2099
+ // Module Manifest Provider
2100
+ {
2101
+ provide: AXP_MODULE_MANIFEST_PROVIDER,
2102
+ useValue: HumanCapitalManagementManifest,
2103
+ multi: true,
2104
+ },
2105
+ // Provider references (now using tokens)
2106
+ {
2107
+ provide: AXP_PERMISSION_DEFINITION_PROVIDER,
2108
+ useClass: AXMPermissionDefinitionProvider,
2109
+ multi: true,
2110
+ },
2111
+ {
2112
+ provide: AXP_MENU_PROVIDER,
2113
+ useClass: AXMMenuProvider,
2114
+ multi: true,
2115
+ },
2116
+ {
2117
+ provide: AXP_FEATURE_DEFINITION_PROVIDER,
2118
+ useClass: AXPHumanCapitalManagementFeatureDefinitionProvider,
2119
+ multi: true,
2120
+ },
2121
+ {
2122
+ provide: AXM_ORG_CHART_NODE_CONTRIBUTOR,
2123
+ useClass: AXMHcmOrgChartNodeContributionProvider,
2124
+ multi: true,
2125
+ },
2126
+ {
2127
+ provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
2128
+ useClass: AXMHumanCapitalManagementLifecycleEventExpressionEvaluatorScopeProvider,
2129
+ multi: true,
2130
+ },
2131
+ {
2132
+ provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
2133
+ useClass: AXMHumanCapitalManagementLeaveRequestExpressionEvaluatorScopeProvider,
2134
+ multi: true,
2135
+ },
2136
+ {
2137
+ provide: AXP_CATALOG_SCOPE_DEFINITION_PROVIDER,
2138
+ useClass: AXMHumanCapitalManagementCatalogScopeDefinitionProvider,
2139
+ multi: true,
2140
+ },
2141
+ {
2142
+ provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,
2143
+ useValue: HumanCapitalProfileSectionsHookProvider,
2144
+ multi: true,
2145
+ },
2146
+ {
2147
+ provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,
2148
+ useValue: HumanCapitalProfileDocumentsGroupsHookProvider,
2149
+ multi: true,
2150
+ },
2151
+ {
2152
+ provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,
2153
+ useValue: HumanCapitalUserCardItemsHookProvider,
2154
+ multi: true,
2155
+ },
2156
+ provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-human-capital-management-client-profile-documents-panel.component.provider-DPH0YiDP.mjs').then((module) => module.AXMHcmProfileDocumentsPanelComponentProvider)),
2157
+ provideCommandSetups([
2158
+ {
2159
+ key: AXPHumanCapitalManagementCommandKeys.PositionAssignment.Assign,
2160
+ command: () => import('./acorex-platform-module-human-capital-management-client-assign-position-assignment.command-2iHIogn6.mjs').then((c) => c.AXMAssignPositionAssignmentCommand),
2161
+ },
2162
+ {
2163
+ key: AXPHumanCapitalManagementCommandKeys.PositionAssignment.Revoke,
2164
+ command: () => import('./acorex-platform-module-human-capital-management-client-revoke-position-assignment.command-DmVlDQ8_.mjs').then((c) => c.AXMRevokePositionAssignmentByIdCommand),
2165
+ },
2166
+ {
2167
+ key: AXPHumanCapitalManagementCommandKeys.Profile.EditPersonalInfo,
2168
+ command: () => import('./acorex-platform-module-human-capital-management-client-edit-personal-info.command-DK947cW5.mjs').then((c) => c.AXMHcmEditPersonalInfoCommand),
2169
+ },
2170
+ {
2171
+ key: AXPHumanCapitalManagementCommandKeys.Profile.EditSignature,
2172
+ command: () => import('./acorex-platform-module-human-capital-management-client-edit-signature.command-CKrcMxqr.mjs').then((c) => c.AXMHcmEditSignatureCommand),
2173
+ },
2174
+ ]),
2175
+ ], imports: [CommonModule,
2176
+ AXPRuntimeModule,
2177
+ AXMLeaveRequestFeatureModule,
2178
+ AXMLifecycleEventFeatureModule] }); }
2179
+ }
2180
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMHumanCapitalManagementModule, decorators: [{
2181
+ type: NgModule,
2182
+ args: [{
2183
+ imports: [
2184
+ CommonModule,
2185
+ AXPRuntimeModule,
2186
+ AXMLeaveRequestFeatureModule,
2187
+ AXMLifecycleEventFeatureModule,
2188
+ ],
2189
+ providers: [
2190
+ // Appointment Board route
2191
+ {
2192
+ provide: ROUTES,
2193
+ multi: true,
2194
+ useFactory: () => [createAppointmentBoardRoute()],
2195
+ },
2196
+ {
2197
+ provide: AXP_RESOURCE_APPOINTMENT_PROVIDER,
2198
+ useClass: AXMLeaveRequestResourceAppointmentProvider,
2199
+ multi: true,
2200
+ },
2201
+ // Module-specific providers (not part of manifest system)
2202
+ {
2203
+ provide: AXP_STATUS_PROVIDERS,
2204
+ useClass: AXMEmployeeStatusProvider,
2205
+ multi: true,
2206
+ },
2207
+ {
2208
+ provide: AXP_STATUS_PROVIDERS,
2209
+ useClass: AXMPositionAssignmentStatusProvider,
2210
+ multi: true,
2211
+ },
2212
+ // Module Manifest Provider
2213
+ {
2214
+ provide: AXP_MODULE_MANIFEST_PROVIDER,
2215
+ useValue: HumanCapitalManagementManifest,
2216
+ multi: true,
2217
+ },
2218
+ // Provider references (now using tokens)
2219
+ {
2220
+ provide: AXP_PERMISSION_DEFINITION_PROVIDER,
2221
+ useClass: AXMPermissionDefinitionProvider,
2222
+ multi: true,
2223
+ },
2224
+ {
2225
+ provide: AXP_MENU_PROVIDER,
2226
+ useClass: AXMMenuProvider,
2227
+ multi: true,
2228
+ },
2229
+ {
2230
+ provide: AXP_FEATURE_DEFINITION_PROVIDER,
2231
+ useClass: AXPHumanCapitalManagementFeatureDefinitionProvider,
2232
+ multi: true,
2233
+ },
2234
+ {
2235
+ provide: AXM_ORG_CHART_NODE_CONTRIBUTOR,
2236
+ useClass: AXMHcmOrgChartNodeContributionProvider,
2237
+ multi: true,
2238
+ },
2239
+ {
2240
+ provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
2241
+ useClass: AXMHumanCapitalManagementLifecycleEventExpressionEvaluatorScopeProvider,
2242
+ multi: true,
2243
+ },
2244
+ {
2245
+ provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
2246
+ useClass: AXMHumanCapitalManagementLeaveRequestExpressionEvaluatorScopeProvider,
2247
+ multi: true,
2248
+ },
2249
+ {
2250
+ provide: AXP_CATALOG_SCOPE_DEFINITION_PROVIDER,
2251
+ useClass: AXMHumanCapitalManagementCatalogScopeDefinitionProvider,
2252
+ multi: true,
2253
+ },
2254
+ {
2255
+ provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,
2256
+ useValue: HumanCapitalProfileSectionsHookProvider,
2257
+ multi: true,
2258
+ },
2259
+ {
2260
+ provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,
2261
+ useValue: HumanCapitalProfileDocumentsGroupsHookProvider,
2262
+ multi: true,
2263
+ },
2264
+ {
2265
+ provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,
2266
+ useValue: HumanCapitalUserCardItemsHookProvider,
2267
+ multi: true,
2268
+ },
2269
+ provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-human-capital-management-client-profile-documents-panel.component.provider-DPH0YiDP.mjs').then((module) => module.AXMHcmProfileDocumentsPanelComponentProvider)),
2270
+ provideCommandSetups([
2271
+ {
2272
+ key: AXPHumanCapitalManagementCommandKeys.PositionAssignment.Assign,
2273
+ command: () => import('./acorex-platform-module-human-capital-management-client-assign-position-assignment.command-2iHIogn6.mjs').then((c) => c.AXMAssignPositionAssignmentCommand),
2274
+ },
2275
+ {
2276
+ key: AXPHumanCapitalManagementCommandKeys.PositionAssignment.Revoke,
2277
+ command: () => import('./acorex-platform-module-human-capital-management-client-revoke-position-assignment.command-DmVlDQ8_.mjs').then((c) => c.AXMRevokePositionAssignmentByIdCommand),
2278
+ },
2279
+ {
2280
+ key: AXPHumanCapitalManagementCommandKeys.Profile.EditPersonalInfo,
2281
+ command: () => import('./acorex-platform-module-human-capital-management-client-edit-personal-info.command-DK947cW5.mjs').then((c) => c.AXMHcmEditPersonalInfoCommand),
2282
+ },
2283
+ {
2284
+ key: AXPHumanCapitalManagementCommandKeys.Profile.EditSignature,
2285
+ command: () => import('./acorex-platform-module-human-capital-management-client-edit-signature.command-CKrcMxqr.mjs').then((c) => c.AXMHcmEditSignatureCommand),
2286
+ },
2287
+ ]),
2288
+ ],
2289
+ }]
2290
+ }] });
2291
+
2292
+ /**
2293
+ * Generated bundle index. Do not edit.
2294
+ */
2295
+
2296
+ export { AXMHcmProfileContextService as A, DOCUMENT_DRIVE_PAGE_COMPONENT_KEY as D, HumanCapitalManagementManifest as H, PROFILE_DOCUMENTS_PANEL_COMPONENT_KEY as P, AXMHumanCapitalManagementModule as a, AXMLeaveRequestBadgeProvider as b, AXMLeaveRequestResourceAppointmentProvider as c, AXMLeaveRequestTaskPopoverComponent as d, AXPHumanCapitalManagementFeatureDefinitionProvider as e, AXPLeaveRequestDialogService as f };
2297
+ //# sourceMappingURL=acorex-platform-module-human-capital-management-client-acorex-platform-module-human-capital-management-client-DlWna0Lz.mjs.map