@acorex/modules 21.0.0-next.12 → 21.0.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data-management/index.d.ts +35 -2
- package/document-management/index.d.ts +76 -261
- package/fesm2022/acorex-modules-data-management.mjs +231 -2
- package/fesm2022/acorex-modules-data-management.mjs.map +1 -1
- package/fesm2022/acorex-modules-document-management.mjs +529 -2717
- package/fesm2022/acorex-modules-document-management.mjs.map +1 -1
- package/fesm2022/{acorex-modules-human-capital-management-leave-request.entity-BDSyXKSF.mjs → acorex-modules-human-capital-management-leave-request.entity-CviI9xJC.mjs} +2 -2
- package/fesm2022/acorex-modules-human-capital-management-leave-request.entity-CviI9xJC.mjs.map +1 -0
- package/fesm2022/acorex-modules-human-capital-management.mjs +350 -695
- package/fesm2022/acorex-modules-human-capital-management.mjs.map +1 -1
- package/fesm2022/{acorex-modules-task-management-task-board.page-Cgxdk78j.mjs → acorex-modules-task-management-task-board.page-B_S373L-.mjs} +47 -54
- package/fesm2022/acorex-modules-task-management-task-board.page-B_S373L-.mjs.map +1 -0
- package/fesm2022/acorex-modules-task-management.mjs +39 -11
- package/fesm2022/acorex-modules-task-management.mjs.map +1 -1
- package/fesm2022/acorex-modules-workflow-management-activity-definition.entity-BbBEPTBa.mjs +258 -0
- package/fesm2022/acorex-modules-workflow-management-activity-definition.entity-BbBEPTBa.mjs.map +1 -0
- package/fesm2022/acorex-modules-workflow-management-workflow-definition.entity-nJMBL0qt.mjs +371 -0
- package/fesm2022/acorex-modules-workflow-management-workflow-definition.entity-nJMBL0qt.mjs.map +1 -0
- package/fesm2022/acorex-modules-workflow-management-workflow-instance.entity-Pso0oRN5.mjs +313 -0
- package/fesm2022/acorex-modules-workflow-management-workflow-instance.entity-Pso0oRN5.mjs.map +1 -0
- package/fesm2022/acorex-modules-workflow-management.mjs +710 -2536
- package/fesm2022/acorex-modules-workflow-management.mjs.map +1 -1
- package/human-capital-management/index.d.ts +19 -79
- package/package.json +14 -14
- package/task-management/index.d.ts +12 -1
- package/workflow-management/index.d.ts +220 -265
- package/fesm2022/acorex-modules-human-capital-management-leave-request-task-popover.component-yGvT9kSL.mjs +0 -381
- package/fesm2022/acorex-modules-human-capital-management-leave-request-task-popover.component-yGvT9kSL.mjs.map +0 -1
- package/fesm2022/acorex-modules-human-capital-management-leave-request.entity-BDSyXKSF.mjs.map +0 -1
- package/fesm2022/acorex-modules-task-management-task-board.page-Cgxdk78j.mjs.map +0 -1
- package/fesm2022/acorex-modules-workflow-management-cartable-page.component-Bso0XRkJ.mjs +0 -296
- package/fesm2022/acorex-modules-workflow-management-cartable-page.component-Bso0XRkJ.mjs.map +0 -1
- package/fesm2022/acorex-modules-workflow-management-index-xB36g4F1.mjs +0 -469
- package/fesm2022/acorex-modules-workflow-management-index-xB36g4F1.mjs.map +0 -1
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import * as i1 from '@acorex/components/button';
|
|
2
|
+
import { AXButtonModule } from '@acorex/components/button';
|
|
3
|
+
import * as i2 from '@acorex/components/decorators';
|
|
4
|
+
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
5
|
+
import * as i4 from '@acorex/core/translation';
|
|
6
|
+
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
5
7
|
import { AXPCommandExecutor, AXPCommandEventsService, AXPRuntimeModule, provideCommandSetups } from '@acorex/platform/runtime';
|
|
8
|
+
import * as i3 from '@angular/common';
|
|
9
|
+
import { CommonModule } from '@angular/common';
|
|
6
10
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { inject, Injectable, DestroyRef, signal, NgModule, Injector } from '@angular/core';
|
|
11
|
+
import { inject, Injectable, input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, DestroyRef, signal, NgModule, Injector } from '@angular/core';
|
|
8
12
|
import { AXPLayoutBuilderService } from '@acorex/platform/layout/builder';
|
|
13
|
+
import { AXPSystemStatuses, AXPStatusProvider, systemStatusToDefinition, AXPSystemStatusType, AXP_STATUS_PROVIDERS, AXP_MENU_PROVIDER } from '@acorex/platform/common';
|
|
9
14
|
import { AXPTaskBadgeProvider, AXP_TASK_BADGE_PROVIDERS } from '@acorex/platform/layout/components';
|
|
15
|
+
import { AXPEntityService, AXP_ENTITY_DEFINITION_LOADER } from '@acorex/platform/layout/entity';
|
|
10
16
|
import { AXP_IDENTIFIER_RULES } from '@acorex/modules/identifier-management';
|
|
11
17
|
import { AXP_MODULE_MANIFEST_PROVIDER, AXP_FEATURE_DEFINITION_PROVIDER } from '@acorex/platform/core';
|
|
12
18
|
import { AXPSessionService, AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex/platform/auth';
|
|
13
|
-
import { CommonModule } from '@angular/common';
|
|
14
19
|
import { firstValueFrom } from 'rxjs';
|
|
15
20
|
|
|
16
21
|
const config = {
|
|
@@ -209,710 +214,370 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
209
214
|
}]
|
|
210
215
|
}] });
|
|
211
216
|
|
|
212
|
-
|
|
213
|
-
//#endregion
|
|
214
|
-
/**
|
|
215
|
-
* Leave Request Task Provider
|
|
216
|
-
*
|
|
217
|
-
* Integrates with workflow engine to show leave request tasks from work items.
|
|
218
|
-
* Uses work items created by workflow engine for human-task activities.
|
|
219
|
-
*
|
|
220
|
-
* Architecture:
|
|
221
|
-
* - Queries work items filtered by entityRefType = 'HumanCapitalManagement.LeaveRequest'
|
|
222
|
-
* - Loads related entity data from entityRefId
|
|
223
|
-
* - Maps work item status to task board status
|
|
224
|
-
* - Provides actions based on workflow activity definitions
|
|
225
|
-
*/
|
|
226
|
-
class AXMLeaveRequestTaskProvider extends AXPWorkflowTaskProvider {
|
|
217
|
+
class AXMLeaveRequestTaskPopoverComponent {
|
|
227
218
|
constructor() {
|
|
228
|
-
|
|
229
|
-
super(...arguments);
|
|
230
|
-
this.entityService = inject(AXPEntityService);
|
|
231
|
-
this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
|
|
232
|
-
this.workItemData = this.entityService
|
|
233
|
-
.withEntity('WorkflowManagement', 'WorkItem')
|
|
234
|
-
.data();
|
|
235
|
-
this.leaveRequestData = this.entityService
|
|
236
|
-
.withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)
|
|
237
|
-
.data();
|
|
219
|
+
this.task = input.required(...(ngDevMode ? [{ debugName: "task" }] : []));
|
|
238
220
|
this.commandExecutor = inject(AXPCommandExecutor);
|
|
239
|
-
this.translationService = inject(AXTranslationService);
|
|
240
221
|
this.dialogService = inject(AXPLeaveRequestDialogService);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
222
|
+
this.taskData = computed(() => {
|
|
223
|
+
const task = this.task();
|
|
224
|
+
return (task.data ||
|
|
225
|
+
task.payload);
|
|
226
|
+
}, ...(ngDevMode ? [{ debugName: "taskData" }] : []));
|
|
227
|
+
this.employeeName = computed(() => {
|
|
228
|
+
const data = this.taskData();
|
|
229
|
+
return data?.employee?.person?.displayName || this.task().reporter?.fullName || 'Unknown';
|
|
230
|
+
}, ...(ngDevMode ? [{ debugName: "employeeName" }] : []));
|
|
231
|
+
this.managerName = computed(() => {
|
|
232
|
+
const data = this.taskData();
|
|
233
|
+
return data?.employee?.manager?.person?.displayName || this.task().assignee?.fullName || '';
|
|
234
|
+
}, ...(ngDevMode ? [{ debugName: "managerName" }] : []));
|
|
235
|
+
this.leaveType = computed(() => {
|
|
236
|
+
const data = this.taskData();
|
|
237
|
+
// Extract leave type from task title or data
|
|
238
|
+
const title = this.task().title || '';
|
|
239
|
+
const parts = title.split(' - ');
|
|
240
|
+
return parts.length > 1 ? parts[1] : data?.leaveType?.title || 'N/A';
|
|
241
|
+
}, ...(ngDevMode ? [{ debugName: "leaveType" }] : []));
|
|
242
|
+
this.canApprove = computed(() => {
|
|
243
|
+
const statusId = this.task().status?.id;
|
|
244
|
+
return statusId === AXPSystemStatuses.Pending.name || statusId === AXPSystemStatuses.Rejected.name;
|
|
245
|
+
}, ...(ngDevMode ? [{ debugName: "canApprove" }] : []));
|
|
246
|
+
this.canReject = computed(() => {
|
|
247
|
+
const statusId = this.task().status?.id;
|
|
248
|
+
return statusId === AXPSystemStatuses.Pending.name || statusId === AXPSystemStatuses.Approved.name;
|
|
249
|
+
}, ...(ngDevMode ? [{ debugName: "canReject" }] : []));
|
|
250
|
+
this.canCancel = computed(() => {
|
|
251
|
+
const statusId = this.task().status?.id;
|
|
252
|
+
return statusId === AXPSystemStatuses.Pending.name || statusId === AXPSystemStatuses.Approved.name;
|
|
253
|
+
}, ...(ngDevMode ? [{ debugName: "canCancel" }] : []));
|
|
247
254
|
}
|
|
248
|
-
|
|
249
|
-
return
|
|
255
|
+
formatDate(date) {
|
|
256
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
257
|
+
year: 'numeric',
|
|
258
|
+
month: 'short',
|
|
259
|
+
day: 'numeric',
|
|
260
|
+
}).format(new Date(date));
|
|
250
261
|
}
|
|
251
|
-
|
|
252
|
-
|
|
262
|
+
calculateDuration() {
|
|
263
|
+
const start = new Date(this.task().startDate);
|
|
264
|
+
const end = new Date(this.task().endDate);
|
|
265
|
+
const diffTime = Math.abs(end.getTime() - start.getTime());
|
|
266
|
+
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
267
|
+
return diffDays + 1; // Include both start and end days
|
|
253
268
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
* Get tasks from work items for leave requests.
|
|
258
|
-
*
|
|
259
|
-
* Queries work items filtered by:
|
|
260
|
-
* - entityRefType = 'HumanCapitalManagement.LeaveRequest'
|
|
261
|
-
* - status (Pending, Claimed, InProgress)
|
|
262
|
-
* - assignee/claimant (if filter provided)
|
|
263
|
-
* - date range (if provided)
|
|
264
|
-
*
|
|
265
|
-
* Then loads related entity data and maps to task board format.
|
|
266
|
-
*/
|
|
267
|
-
async getTasks(options) {
|
|
268
|
-
console.log(`[LeaveRequestTaskProvider] 🔍 getTasks called with options:`, {
|
|
269
|
-
skip: options?.skip,
|
|
270
|
-
take: options?.take,
|
|
271
|
-
assigneeIds: options?.assigneeIds,
|
|
272
|
-
range: options?.range,
|
|
273
|
-
types: options?.types,
|
|
274
|
-
});
|
|
275
|
-
// Build filter for work items
|
|
276
|
-
const baseFilter = { logic: 'and', filters: [] };
|
|
277
|
-
const entityTypeValue = `${RootConfig.module.name}.${RootConfig.entities.leaveRequest.name}`;
|
|
278
|
-
const workflowNameValue = 'create-leave-request';
|
|
279
|
-
console.log(`[LeaveRequestTaskProvider] 📋 Building filters:`, {
|
|
280
|
-
entityType: entityTypeValue,
|
|
281
|
-
workflowName: workflowNameValue,
|
|
282
|
-
});
|
|
283
|
-
// Filter by entity type OR workflow instance definitionId
|
|
284
|
-
// Primary: entityRefType (set after entity creation)
|
|
285
|
-
// Fallback: instanceId from workflow instances with definitionId = 'create-leave-request'
|
|
286
|
-
// We'll use OR logic to catch both cases
|
|
287
|
-
const entityTypeFilter = {
|
|
288
|
-
field: 'entityRefType',
|
|
289
|
-
operator: { type: 'equal' },
|
|
290
|
-
value: entityTypeValue,
|
|
291
|
-
};
|
|
292
|
-
// Try to get workflow instance IDs for fallback
|
|
293
|
-
let workflowInstanceIds = [];
|
|
269
|
+
async handleApprove() {
|
|
270
|
+
const task = this.task();
|
|
271
|
+
const leaveRequestId = task.id;
|
|
294
272
|
try {
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
{
|
|
305
|
-
field: 'definitionId',
|
|
306
|
-
operator: { type: 'equal' },
|
|
307
|
-
value: workflowNameValue,
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
},
|
|
273
|
+
const dialogResult = await this.dialogService.showApprovalDialog();
|
|
274
|
+
if (dialogResult?.cancelled) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const commandKey = 'HumanCapitalManagement.LeaveRequest:Approve';
|
|
278
|
+
const result = await this.commandExecutor.execute(commandKey, {
|
|
279
|
+
id: leaveRequestId,
|
|
280
|
+
reason: dialogResult?.reason,
|
|
281
|
+
note: dialogResult?.note,
|
|
311
282
|
});
|
|
312
|
-
|
|
313
|
-
|
|
283
|
+
if (result?.success) {
|
|
284
|
+
// Optionally emit an event or refresh the task
|
|
285
|
+
console.log('Leave request approved successfully');
|
|
286
|
+
}
|
|
314
287
|
}
|
|
315
288
|
catch (error) {
|
|
316
|
-
console.
|
|
289
|
+
console.error('Failed to approve leave request:', error);
|
|
317
290
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
operator: { type: 'in' },
|
|
327
|
-
value: workflowInstanceIds,
|
|
328
|
-
},
|
|
329
|
-
],
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
else {
|
|
333
|
-
// Only use entityRefType if no workflow instances found
|
|
334
|
-
baseFilter.filters?.push(entityTypeFilter);
|
|
335
|
-
}
|
|
336
|
-
// Filter by status (exclude completed/cancelled)
|
|
337
|
-
baseFilter.filters?.push({
|
|
338
|
-
field: 'status',
|
|
339
|
-
operator: { type: 'in' },
|
|
340
|
-
value: ['Pending', 'Claimed', 'InProgress'],
|
|
341
|
-
});
|
|
342
|
-
// Filter by date range if provided
|
|
343
|
-
// Work items don't have startDate/endDate directly, but we can filter by createdAt or dueDate
|
|
344
|
-
// For now, we'll skip date range filtering to ensure work items are found
|
|
345
|
-
// TODO: Implement proper date range filtering based on entity data (startDate/endDate)
|
|
346
|
-
// if (options?.range?.from || options?.range?.end) {
|
|
347
|
-
// if (options.range.from) {
|
|
348
|
-
// baseFilter.filters?.push({
|
|
349
|
-
// field: 'createdAt',
|
|
350
|
-
// operator: { type: 'gte' as const },
|
|
351
|
-
// value: options.range.from,
|
|
352
|
-
// });
|
|
353
|
-
// }
|
|
354
|
-
//
|
|
355
|
-
// if (options.range.end) {
|
|
356
|
-
// // For end date, we want: dueDate <= end OR dueDate is null
|
|
357
|
-
// // This allows work items without dueDate to still appear
|
|
358
|
-
// baseFilter.filters?.push({
|
|
359
|
-
// logic: 'or',
|
|
360
|
-
// filters: [
|
|
361
|
-
// {
|
|
362
|
-
// field: 'dueDate',
|
|
363
|
-
// operator: { type: 'lte' as const },
|
|
364
|
-
// value: options.range.end,
|
|
365
|
-
// },
|
|
366
|
-
// {
|
|
367
|
-
// field: 'dueDate',
|
|
368
|
-
// operator: { type: 'isNull' as const },
|
|
369
|
-
// },
|
|
370
|
-
// ],
|
|
371
|
-
// });
|
|
372
|
-
// }
|
|
373
|
-
// }
|
|
374
|
-
// Filter by assignee/claimant
|
|
375
|
-
if (options?.assigneeIds && options.assigneeIds.length > 0) {
|
|
376
|
-
baseFilter.filters?.push({
|
|
377
|
-
logic: 'or',
|
|
378
|
-
filters: [
|
|
379
|
-
{
|
|
380
|
-
field: 'assignedUserId',
|
|
381
|
-
operator: { type: 'in' },
|
|
382
|
-
value: options.assigneeIds,
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
field: 'claimedByUserId',
|
|
386
|
-
operator: { type: 'in' },
|
|
387
|
-
value: options.assigneeIds,
|
|
388
|
-
},
|
|
389
|
-
],
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
console.log(`[LeaveRequestTaskProvider] 🔎 Query filter:`, JSON.stringify(baseFilter, null, 2));
|
|
393
|
-
// Query work items
|
|
394
|
-
const { items: workItems, total } = await this.workItemData.query({
|
|
395
|
-
skip: options?.skip ?? 0,
|
|
396
|
-
take: options?.take ?? 20,
|
|
397
|
-
filter: baseFilter,
|
|
398
|
-
});
|
|
399
|
-
console.log(`[LeaveRequestTaskProvider] 📦 Query result:`, {
|
|
400
|
-
total,
|
|
401
|
-
itemsCount: workItems.length,
|
|
402
|
-
workItems: workItems.map((wi) => ({
|
|
403
|
-
id: wi.id,
|
|
404
|
-
title: wi.title,
|
|
405
|
-
status: wi.status,
|
|
406
|
-
entityRefType: wi.entityRefType,
|
|
407
|
-
entityRefId: wi.entityRefId,
|
|
408
|
-
instanceId: wi.instanceId,
|
|
409
|
-
instanceDefinitionId: wi.instance?.definitionId,
|
|
410
|
-
instanceName: wi.instance?.name,
|
|
411
|
-
activityNodeId: wi.activityNodeId,
|
|
412
|
-
activityName: wi.activityName,
|
|
413
|
-
createdAt: wi.createdAt,
|
|
414
|
-
dueDate: wi.dueDate,
|
|
415
|
-
})),
|
|
416
|
-
});
|
|
417
|
-
// Debug: Log if no work items found
|
|
418
|
-
if (workItems.length === 0) {
|
|
419
|
-
console.warn(`[LeaveRequestTaskProvider] ⚠️ No work items found!`, {
|
|
420
|
-
filter: baseFilter,
|
|
421
|
-
entityTypeValue: `${RootConfig.module.name}.${RootConfig.entities.leaveRequest.name}`,
|
|
422
|
-
workflowNameValue: 'create-leave-request',
|
|
423
|
-
suggestion: 'Check if: 1) Workflow was started, 2) Human-task activity exists, 3) Work item was created, 4) entityRefType was set after entity creation',
|
|
424
|
-
});
|
|
425
|
-
// Fallback: Try to query all work items to see what we have
|
|
426
|
-
const allWorkItems = await this.workItemData.query({
|
|
427
|
-
skip: 0,
|
|
428
|
-
take: 10,
|
|
429
|
-
filter: {
|
|
430
|
-
logic: 'and',
|
|
431
|
-
filters: [
|
|
432
|
-
{
|
|
433
|
-
field: 'status',
|
|
434
|
-
operator: { type: 'in' },
|
|
435
|
-
value: ['Pending', 'Claimed', 'InProgress'],
|
|
436
|
-
},
|
|
437
|
-
],
|
|
438
|
-
},
|
|
439
|
-
});
|
|
440
|
-
console.log(`[LeaveRequestTaskProvider] 🔍 Fallback: Found ${allWorkItems.items.length} work items total (any entity):`, {
|
|
441
|
-
workItems: allWorkItems.items.map((wi) => ({
|
|
442
|
-
id: wi.id,
|
|
443
|
-
title: wi.title,
|
|
444
|
-
entityRefType: wi.entityRefType,
|
|
445
|
-
entityRefId: wi.entityRefId,
|
|
446
|
-
instanceId: wi.instanceId,
|
|
447
|
-
status: wi.status,
|
|
448
|
-
})),
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
// Load entity data for each work item and map to tasks
|
|
452
|
-
const tasks = [];
|
|
453
|
-
console.log(`[LeaveRequestTaskProvider] 🔄 Processing ${workItems.length} work items...`);
|
|
454
|
-
for (const workItem of workItems) {
|
|
455
|
-
try {
|
|
456
|
-
console.log(`[LeaveRequestTaskProvider] 📝 Processing work item:`, {
|
|
457
|
-
id: workItem.id,
|
|
458
|
-
title: workItem.title,
|
|
459
|
-
entityRefId: workItem.entityRefId,
|
|
460
|
-
entityRefType: workItem.entityRefType,
|
|
461
|
-
instanceId: workItem.instanceId,
|
|
462
|
-
instanceDefinitionId: workItem.instance?.definitionId,
|
|
463
|
-
});
|
|
464
|
-
// Load entity data if entityRefId is available
|
|
465
|
-
let entityData = null;
|
|
466
|
-
if (workItem.entityRefId) {
|
|
467
|
-
try {
|
|
468
|
-
console.log(`[LeaveRequestTaskProvider] 🔍 Loading entity data for entityRefId: ${workItem.entityRefId}`);
|
|
469
|
-
entityData = await this.leaveRequestData.byKey(workItem.entityRefId);
|
|
470
|
-
console.log(`[LeaveRequestTaskProvider] ✅ Entity data loaded:`, {
|
|
471
|
-
id: entityData?.id,
|
|
472
|
-
employee: entityData?.employee?.person?.displayName,
|
|
473
|
-
startDate: entityData?.startDate,
|
|
474
|
-
endDate: entityData?.endDate,
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
catch (error) {
|
|
478
|
-
console.warn(`[LeaveRequestTaskProvider] ⚠️ Failed to load entity data for ${workItem.entityRefId}:`, error);
|
|
479
|
-
// Continue without entity data - use work item data only
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
else {
|
|
483
|
-
console.log(`[LeaveRequestTaskProvider] ℹ️ No entityRefId, using work item data only`);
|
|
484
|
-
}
|
|
485
|
-
// Map work item to task
|
|
486
|
-
const task = this.mapWorkItemToTask(workItem, entityData);
|
|
487
|
-
console.log(`[LeaveRequestTaskProvider] ✅ Mapped to task:`, {
|
|
488
|
-
id: task.id,
|
|
489
|
-
title: task.title,
|
|
490
|
-
startDate: task.startDate,
|
|
491
|
-
endDate: task.endDate,
|
|
492
|
-
status: task.status,
|
|
493
|
-
});
|
|
494
|
-
tasks.push(task);
|
|
291
|
+
}
|
|
292
|
+
async handleReject() {
|
|
293
|
+
const task = this.task();
|
|
294
|
+
const leaveRequestId = task.id;
|
|
295
|
+
try {
|
|
296
|
+
const dialogResult = await this.dialogService.showRejectionDialog();
|
|
297
|
+
if (dialogResult?.cancelled) {
|
|
298
|
+
return;
|
|
495
299
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
300
|
+
const commandKey = 'HumanCapitalManagement.LeaveRequest:Reject';
|
|
301
|
+
const result = await this.commandExecutor.execute(commandKey, {
|
|
302
|
+
id: leaveRequestId,
|
|
303
|
+
reason: dialogResult?.reason,
|
|
304
|
+
note: dialogResult?.note,
|
|
305
|
+
});
|
|
306
|
+
if (result?.success) {
|
|
307
|
+
console.log('Leave request rejected successfully');
|
|
499
308
|
}
|
|
500
309
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Map work item to task board task format.
|
|
506
|
-
*/
|
|
507
|
-
mapWorkItemToTask(workItem, entityData) {
|
|
508
|
-
// Use entity data if available, otherwise use work item metadata
|
|
509
|
-
const statusId = entityData?.statusId ?? entityData?.status?.id ?? AXPSystemStatuses.Pending.name;
|
|
510
|
-
const statusTitle = entityData?.status?.title ??
|
|
511
|
-
this.translationService.translateSync(`@human-capital-management:leave-requests.states.${statusId}`);
|
|
512
|
-
// Extract dates from entity data or use work item dates
|
|
513
|
-
const startDate = entityData?.startDate
|
|
514
|
-
? new Date(entityData.startDate)
|
|
515
|
-
: (workItem.dueDate ? new Date(workItem.dueDate) : new Date());
|
|
516
|
-
const endDate = entityData?.endDate
|
|
517
|
-
? new Date(entityData.endDate)
|
|
518
|
-
: (workItem.dueDate ? new Date(workItem.dueDate) : new Date());
|
|
519
|
-
// Build title from entity data or work item
|
|
520
|
-
let title = workItem.title;
|
|
521
|
-
if (entityData) {
|
|
522
|
-
title = `${entityData.employee?.person?.displayName ?? ''} - ${this.translationService.translateSync(entityData.leaveType?.title ?? '')}`.trim();
|
|
523
|
-
if (!title)
|
|
524
|
-
title = workItem.title;
|
|
525
|
-
}
|
|
526
|
-
// Map work item status to task status
|
|
527
|
-
const taskStatus = this.mapWorkItemStatusToTaskStatus(workItem.status);
|
|
528
|
-
return {
|
|
529
|
-
id: workItem.id, // Use work item ID as task ID
|
|
530
|
-
title,
|
|
531
|
-
description: entityData?.reason ?? workItem.description ?? '',
|
|
532
|
-
startDate,
|
|
533
|
-
endDate,
|
|
534
|
-
allDay: true, // Leave requests are all-day events
|
|
535
|
-
assignee: workItem.assignedUser
|
|
536
|
-
? {
|
|
537
|
-
id: workItem.assignedUser.id,
|
|
538
|
-
type: 'user',
|
|
539
|
-
fullName: workItem.assignedUser.displayName,
|
|
540
|
-
}
|
|
541
|
-
: workItem.claimedByUser
|
|
542
|
-
? {
|
|
543
|
-
id: workItem.claimedByUser.id,
|
|
544
|
-
type: 'user',
|
|
545
|
-
fullName: workItem.claimedByUser.displayName,
|
|
546
|
-
}
|
|
547
|
-
: undefined,
|
|
548
|
-
index: 2,
|
|
549
|
-
status: taskStatus,
|
|
550
|
-
priority: this.mapWorkItemPriorityToTaskPriority(workItem.priority),
|
|
551
|
-
reporter: entityData?.employee
|
|
552
|
-
? {
|
|
553
|
-
id: entityData.employee.userId ?? entityData.employeeId,
|
|
554
|
-
type: 'user',
|
|
555
|
-
fullName: entityData.employee.person?.displayName ?? '',
|
|
556
|
-
}
|
|
557
|
-
: workItem.createdByUser
|
|
558
|
-
? {
|
|
559
|
-
id: workItem.createdByUser.id,
|
|
560
|
-
type: 'user',
|
|
561
|
-
fullName: workItem.createdByUser.displayName,
|
|
562
|
-
}
|
|
563
|
-
: {
|
|
564
|
-
id: '',
|
|
565
|
-
type: 'user',
|
|
566
|
-
fullName: '',
|
|
567
|
-
},
|
|
568
|
-
data: {
|
|
569
|
-
// Store entity data and work item metadata
|
|
570
|
-
entityData: entityData ?? null,
|
|
571
|
-
workItem: workItem,
|
|
572
|
-
workItemId: workItem.id,
|
|
573
|
-
instanceId: workItem.instanceId,
|
|
574
|
-
activityNodeId: workItem.activityNodeId,
|
|
575
|
-
entityRefId: workItem.entityRefId,
|
|
576
|
-
entityRefType: workItem.entityRefType,
|
|
577
|
-
}, // Additional metadata for task processing
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Map work item status to task board status.
|
|
582
|
-
*/
|
|
583
|
-
mapWorkItemStatusToTaskStatus(workItemStatus) {
|
|
584
|
-
// Map work item status to entity status
|
|
585
|
-
switch (workItemStatus) {
|
|
586
|
-
case 'Pending':
|
|
587
|
-
return {
|
|
588
|
-
id: AXPSystemStatuses.Pending.name,
|
|
589
|
-
title: this.translationService.translateSync('@human-capital-management:leave-requests.states.pending'),
|
|
590
|
-
};
|
|
591
|
-
case 'Claimed':
|
|
592
|
-
case 'InProgress':
|
|
593
|
-
return {
|
|
594
|
-
id: AXPSystemStatuses.Pending.name, // Still pending from entity perspective
|
|
595
|
-
title: this.translationService.translateSync('@human-capital-management:leave-requests.states.pending'),
|
|
596
|
-
};
|
|
597
|
-
case 'Completed':
|
|
598
|
-
return {
|
|
599
|
-
id: AXPSystemStatuses.Approved.name, // Completed work item = approved
|
|
600
|
-
title: this.translationService.translateSync('@human-capital-management:leave-requests.states.approved'),
|
|
601
|
-
};
|
|
602
|
-
case 'Rejected':
|
|
603
|
-
return {
|
|
604
|
-
id: AXPSystemStatuses.Rejected.name,
|
|
605
|
-
title: this.translationService.translateSync('@human-capital-management:leave-requests.states.rejected'),
|
|
606
|
-
};
|
|
607
|
-
case 'Cancelled':
|
|
608
|
-
return {
|
|
609
|
-
id: AXPSystemStatuses.Cancelled.name,
|
|
610
|
-
title: this.translationService.translateSync('@human-capital-management:leave-requests.states.cancelled'),
|
|
611
|
-
};
|
|
612
|
-
default:
|
|
613
|
-
return {
|
|
614
|
-
id: AXPSystemStatuses.Pending.name,
|
|
615
|
-
title: this.translationService.translateSync('@human-capital-management:leave-requests.states.pending'),
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* Map work item priority to task board priority.
|
|
621
|
-
*/
|
|
622
|
-
mapWorkItemPriorityToTaskPriority(workItemPriority) {
|
|
623
|
-
switch (workItemPriority) {
|
|
624
|
-
case 'Urgent':
|
|
625
|
-
return 'highest';
|
|
626
|
-
case 'High':
|
|
627
|
-
return 'high';
|
|
628
|
-
case 'Normal':
|
|
629
|
-
return 'medium';
|
|
630
|
-
case 'Low':
|
|
631
|
-
return 'low';
|
|
632
|
-
default:
|
|
633
|
-
return 'medium';
|
|
310
|
+
catch (error) {
|
|
311
|
+
console.error('Failed to reject leave request:', error);
|
|
634
312
|
}
|
|
635
313
|
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
async updateTasks(tasksToUpdate) {
|
|
644
|
-
const updatedTasks = [];
|
|
645
|
-
for (const task of tasksToUpdate) {
|
|
646
|
-
try {
|
|
647
|
-
const taskData = task.data;
|
|
648
|
-
const workItemId = taskData?.workItemId ?? task.id;
|
|
649
|
-
const entityRefId = taskData?.entityRefId;
|
|
650
|
-
// Update work item if task ID is work item ID
|
|
651
|
-
if (workItemId) {
|
|
652
|
-
const workItemUpdate = {};
|
|
653
|
-
if (task.status?.id) {
|
|
654
|
-
// Map task status back to work item status
|
|
655
|
-
const workItemStatus = this.mapTaskStatusToWorkItemStatus(String(task.status.id));
|
|
656
|
-
if (workItemStatus) {
|
|
657
|
-
workItemUpdate['status'] = workItemStatus;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
if (task.assignee?.id) {
|
|
661
|
-
workItemUpdate['assignedUserId'] = task.assignee.id;
|
|
662
|
-
}
|
|
663
|
-
if (Object.keys(workItemUpdate).length > 0) {
|
|
664
|
-
await this.workItemData.update(workItemId, workItemUpdate);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
// Update entity data if entityRefId is available
|
|
668
|
-
if (entityRefId) {
|
|
669
|
-
const entityUpdate = {};
|
|
670
|
-
if (task.status?.id) {
|
|
671
|
-
const statusId = task.status.id;
|
|
672
|
-
entityUpdate['statusId'] = statusId;
|
|
673
|
-
}
|
|
674
|
-
if (task.startDate) {
|
|
675
|
-
entityUpdate['startDate'] = task.startDate;
|
|
676
|
-
}
|
|
677
|
-
if (task.endDate) {
|
|
678
|
-
entityUpdate['endDate'] = task.endDate;
|
|
679
|
-
}
|
|
680
|
-
if (Object.keys(entityUpdate).length > 0) {
|
|
681
|
-
await this.leaveRequestData.update(entityRefId, entityUpdate);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
updatedTasks.push(task);
|
|
314
|
+
async handleCancel() {
|
|
315
|
+
const task = this.task();
|
|
316
|
+
const leaveRequestId = task.id;
|
|
317
|
+
try {
|
|
318
|
+
const dialogResult = await this.dialogService.showCancellationDialog();
|
|
319
|
+
if (dialogResult?.cancelled) {
|
|
320
|
+
return;
|
|
685
321
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
322
|
+
const commandKey = 'HumanCapitalManagement.LeaveRequest:Cancel';
|
|
323
|
+
const result = await this.commandExecutor.execute(commandKey, {
|
|
324
|
+
id: leaveRequestId,
|
|
325
|
+
reason: dialogResult?.reason,
|
|
326
|
+
note: dialogResult?.note,
|
|
327
|
+
});
|
|
328
|
+
if (result?.success) {
|
|
329
|
+
console.log('Leave request cancelled successfully');
|
|
689
330
|
}
|
|
690
331
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* Map task status to work item status.
|
|
695
|
-
*/
|
|
696
|
-
mapTaskStatusToWorkItemStatus(taskStatusId) {
|
|
697
|
-
switch (taskStatusId) {
|
|
698
|
-
case AXPSystemStatuses.Pending.name:
|
|
699
|
-
return 'Pending';
|
|
700
|
-
case AXPSystemStatuses.Approved.name:
|
|
701
|
-
return 'Completed';
|
|
702
|
-
case AXPSystemStatuses.Rejected.name:
|
|
703
|
-
return 'Rejected';
|
|
704
|
-
case AXPSystemStatuses.Cancelled.name:
|
|
705
|
-
return 'Cancelled';
|
|
706
|
-
default:
|
|
707
|
-
return null;
|
|
332
|
+
catch (error) {
|
|
333
|
+
console.error('Failed to cancel leave request:', error);
|
|
708
334
|
}
|
|
709
335
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
336
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXMLeaveRequestTaskPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
337
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: AXMLeaveRequestTaskPopoverComponent, isStandalone: true, selector: "axm-leave-request-task-popover", inputs: { task: { classPropertyName: "task", publicName: "task", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
338
|
+
<div class="leave-request-popover">
|
|
339
|
+
<!-- Employee Info -->
|
|
340
|
+
<div class="leave-request-popover__section">
|
|
341
|
+
<div class="leave-request-popover__section-header">
|
|
342
|
+
<i class="fa-light fa-user"></i>
|
|
343
|
+
<span>Employee Information</span>
|
|
344
|
+
</div>
|
|
345
|
+
<div class="leave-request-popover__section-content">
|
|
346
|
+
<div class="leave-request-popover__info-row">
|
|
347
|
+
<span class="leave-request-popover__label">Employee:</span>
|
|
348
|
+
<span class="leave-request-popover__value">{{ employeeName() }}</span>
|
|
349
|
+
</div>
|
|
350
|
+
@if (managerName(); as manager) {
|
|
351
|
+
<div class="leave-request-popover__info-row">
|
|
352
|
+
<span class="leave-request-popover__label">Manager:</span>
|
|
353
|
+
<span class="leave-request-popover__value">{{ manager }}</span>
|
|
354
|
+
</div>
|
|
355
|
+
}
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
<!-- Leave Details -->
|
|
360
|
+
<div class="leave-request-popover__section">
|
|
361
|
+
<div class="leave-request-popover__section-header">
|
|
362
|
+
<i class="fa-light fa-calendar"></i>
|
|
363
|
+
<span>Leave Details</span>
|
|
364
|
+
</div>
|
|
365
|
+
<div class="leave-request-popover__section-content">
|
|
366
|
+
<div class="leave-request-popover__info-row">
|
|
367
|
+
<span class="leave-request-popover__label">Leave Type:</span>
|
|
368
|
+
<span class="leave-request-popover__value">{{ leaveType() }}</span>
|
|
369
|
+
</div>
|
|
370
|
+
<div class="leave-request-popover__info-row">
|
|
371
|
+
<span class="leave-request-popover__label">Start Date:</span>
|
|
372
|
+
<span class="leave-request-popover__value">{{ formatDate(task().startDate) }}</span>
|
|
373
|
+
</div>
|
|
374
|
+
<div class="leave-request-popover__info-row">
|
|
375
|
+
<span class="leave-request-popover__label">End Date:</span>
|
|
376
|
+
<span class="leave-request-popover__value">{{ formatDate(task().endDate) }}</span>
|
|
377
|
+
</div>
|
|
378
|
+
<div class="leave-request-popover__info-row">
|
|
379
|
+
<span class="leave-request-popover__label">Duration:</span>
|
|
380
|
+
<span class="leave-request-popover__value">{{ calculateDuration() }} days</span>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
|
|
385
|
+
<!-- Reason -->
|
|
386
|
+
@if (task().description) {
|
|
387
|
+
<div class="leave-request-popover__section">
|
|
388
|
+
<div class="leave-request-popover__section-header">
|
|
389
|
+
<i class="fa-light fa-note-sticky"></i>
|
|
390
|
+
<span>Reason</span>
|
|
391
|
+
</div>
|
|
392
|
+
<div class="leave-request-popover__section-content">
|
|
393
|
+
<p class="leave-request-popover__reason">{{ task().description }}</p>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
<!-- Status -->
|
|
399
|
+
<div class="leave-request-popover__section">
|
|
400
|
+
<div class="leave-request-popover__section-header">
|
|
401
|
+
<i class="fa-light fa-flag"></i>
|
|
402
|
+
<span>Status</span>
|
|
403
|
+
</div>
|
|
404
|
+
<div class="leave-request-popover__section-content">
|
|
405
|
+
<div class="leave-request-popover__status-badge" [attr.data-status]="task().status.id">
|
|
406
|
+
{{ task().status.title }}
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
<!-- Actions -->
|
|
412
|
+
<div class="leave-request-popover__actions">
|
|
413
|
+
@if (canApprove()) {
|
|
414
|
+
<ax-button
|
|
415
|
+
[color]="'success'"
|
|
416
|
+
[look]="'blank'"
|
|
417
|
+
[text]="'@general:actions.approve.title' | translate | async"
|
|
418
|
+
(onClick)="handleApprove()"
|
|
419
|
+
class="leave-request-popover__action-btn"
|
|
420
|
+
>
|
|
421
|
+
<ax-prefix>
|
|
422
|
+
<i class="fa-light fa-check"></i>
|
|
423
|
+
</ax-prefix>
|
|
424
|
+
</ax-button>
|
|
730
425
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
426
|
+
|
|
427
|
+
@if (canReject()) {
|
|
428
|
+
<ax-button
|
|
429
|
+
[color]="'danger'"
|
|
430
|
+
[look]="'blank'"
|
|
431
|
+
[text]="'@general:actions.reject.title' | translate | async"
|
|
432
|
+
(onClick)="handleReject()"
|
|
433
|
+
class="leave-request-popover__action-btn"
|
|
434
|
+
>
|
|
435
|
+
<ax-prefix>
|
|
436
|
+
<i class="fa-light fa-xmark"></i>
|
|
437
|
+
</ax-prefix>
|
|
438
|
+
</ax-button>
|
|
738
439
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
440
|
+
|
|
441
|
+
@if (canCancel()) {
|
|
442
|
+
<ax-button
|
|
443
|
+
[color]="'secondary'"
|
|
444
|
+
[look]="'blank'"
|
|
445
|
+
[text]="'@general:actions.cancel.title' | translate | async"
|
|
446
|
+
(onClick)="handleCancel()"
|
|
447
|
+
class="leave-request-popover__action-btn"
|
|
448
|
+
>
|
|
449
|
+
<ax-prefix>
|
|
450
|
+
<i class="fa-light fa-ban"></i>
|
|
451
|
+
</ax-prefix>
|
|
452
|
+
</ax-button>
|
|
744
453
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
454
|
+
</div>
|
|
455
|
+
</div>
|
|
456
|
+
`, 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=pending]{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"], 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 }); }
|
|
457
|
+
}
|
|
458
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXMLeaveRequestTaskPopoverComponent, decorators: [{
|
|
459
|
+
type: Component,
|
|
460
|
+
args: [{ selector: 'axm-leave-request-task-popover', template: `
|
|
461
|
+
<div class="leave-request-popover">
|
|
462
|
+
<!-- Employee Info -->
|
|
463
|
+
<div class="leave-request-popover__section">
|
|
464
|
+
<div class="leave-request-popover__section-header">
|
|
465
|
+
<i class="fa-light fa-user"></i>
|
|
466
|
+
<span>Employee Information</span>
|
|
467
|
+
</div>
|
|
468
|
+
<div class="leave-request-popover__section-content">
|
|
469
|
+
<div class="leave-request-popover__info-row">
|
|
470
|
+
<span class="leave-request-popover__label">Employee:</span>
|
|
471
|
+
<span class="leave-request-popover__value">{{ employeeName() }}</span>
|
|
472
|
+
</div>
|
|
473
|
+
@if (managerName(); as manager) {
|
|
474
|
+
<div class="leave-request-popover__info-row">
|
|
475
|
+
<span class="leave-request-popover__label">Manager:</span>
|
|
476
|
+
<span class="leave-request-popover__value">{{ manager }}</span>
|
|
477
|
+
</div>
|
|
478
|
+
}
|
|
479
|
+
</div>
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
<!-- Leave Details -->
|
|
483
|
+
<div class="leave-request-popover__section">
|
|
484
|
+
<div class="leave-request-popover__section-header">
|
|
485
|
+
<i class="fa-light fa-calendar"></i>
|
|
486
|
+
<span>Leave Details</span>
|
|
487
|
+
</div>
|
|
488
|
+
<div class="leave-request-popover__section-content">
|
|
489
|
+
<div class="leave-request-popover__info-row">
|
|
490
|
+
<span class="leave-request-popover__label">Leave Type:</span>
|
|
491
|
+
<span class="leave-request-popover__value">{{ leaveType() }}</span>
|
|
492
|
+
</div>
|
|
493
|
+
<div class="leave-request-popover__info-row">
|
|
494
|
+
<span class="leave-request-popover__label">Start Date:</span>
|
|
495
|
+
<span class="leave-request-popover__value">{{ formatDate(task().startDate) }}</span>
|
|
496
|
+
</div>
|
|
497
|
+
<div class="leave-request-popover__info-row">
|
|
498
|
+
<span class="leave-request-popover__label">End Date:</span>
|
|
499
|
+
<span class="leave-request-popover__value">{{ formatDate(task().endDate) }}</span>
|
|
500
|
+
</div>
|
|
501
|
+
<div class="leave-request-popover__info-row">
|
|
502
|
+
<span class="leave-request-popover__label">Duration:</span>
|
|
503
|
+
<span class="leave-request-popover__value">{{ calculateDuration() }} days</span>
|
|
504
|
+
</div>
|
|
505
|
+
</div>
|
|
506
|
+
</div>
|
|
507
|
+
|
|
508
|
+
<!-- Reason -->
|
|
509
|
+
@if (task().description) {
|
|
510
|
+
<div class="leave-request-popover__section">
|
|
511
|
+
<div class="leave-request-popover__section-header">
|
|
512
|
+
<i class="fa-light fa-note-sticky"></i>
|
|
513
|
+
<span>Reason</span>
|
|
514
|
+
</div>
|
|
515
|
+
<div class="leave-request-popover__section-content">
|
|
516
|
+
<p class="leave-request-popover__reason">{{ task().description }}</p>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
<!-- Status -->
|
|
522
|
+
<div class="leave-request-popover__section">
|
|
523
|
+
<div class="leave-request-popover__section-header">
|
|
524
|
+
<i class="fa-light fa-flag"></i>
|
|
525
|
+
<span>Status</span>
|
|
526
|
+
</div>
|
|
527
|
+
<div class="leave-request-popover__section-content">
|
|
528
|
+
<div class="leave-request-popover__status-badge" [attr.data-status]="task().status.id">
|
|
529
|
+
{{ task().status.title }}
|
|
530
|
+
</div>
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
|
|
534
|
+
<!-- Actions -->
|
|
535
|
+
<div class="leave-request-popover__actions">
|
|
536
|
+
@if (canApprove()) {
|
|
537
|
+
<ax-button
|
|
538
|
+
[color]="'success'"
|
|
539
|
+
[look]="'blank'"
|
|
540
|
+
[text]="'@general:actions.approve.title' | translate | async"
|
|
541
|
+
(onClick)="handleApprove()"
|
|
542
|
+
class="leave-request-popover__action-btn"
|
|
543
|
+
>
|
|
544
|
+
<ax-prefix>
|
|
545
|
+
<i class="fa-light fa-check"></i>
|
|
546
|
+
</ax-prefix>
|
|
547
|
+
</ax-button>
|
|
811
548
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
const taskData = task.data;
|
|
826
|
-
const workItemId = taskData?.workItemId ?? task.id;
|
|
827
|
-
const entityRefId = taskData?.entityRefId;
|
|
828
|
-
// Add workflow work item actions
|
|
829
|
-
if (task.status?.id === AXPSystemStatuses.Pending.name) {
|
|
830
|
-
// Claim action (if not already claimed)
|
|
831
|
-
actions.push({
|
|
832
|
-
name: 'WorkflowManagement.WorkItem:Claim',
|
|
833
|
-
title: this.translationService.translateSync('@workflow-management:work-items.actions.claim.title'),
|
|
834
|
-
icon: 'fa-light fa-hand',
|
|
835
|
-
color: 'primary',
|
|
836
|
-
command: {
|
|
837
|
-
name: 'WorkflowManagement.WorkItem:Claim',
|
|
838
|
-
options: { id: workItemId, workItemId },
|
|
839
|
-
},
|
|
840
|
-
});
|
|
841
|
-
// Complete action (with approve/reject outcomes)
|
|
842
|
-
actions.push({
|
|
843
|
-
name: 'approveLeave',
|
|
844
|
-
title: this.translationService.translateSync('@general:actions.approve.title'),
|
|
845
|
-
icon: 'fa-light fa-check',
|
|
846
|
-
color: 'success',
|
|
847
|
-
command: {
|
|
848
|
-
name: 'approveLeave',
|
|
849
|
-
options: { id: entityRefId || workItemId, workItemId, entityRefId },
|
|
850
|
-
},
|
|
851
|
-
});
|
|
852
|
-
actions.push({
|
|
853
|
-
name: 'rejectLeave',
|
|
854
|
-
title: this.translationService.translateSync('@general:actions.reject.title'),
|
|
855
|
-
icon: 'fa-light fa-xmark',
|
|
856
|
-
color: 'danger',
|
|
857
|
-
command: {
|
|
858
|
-
name: 'rejectLeave',
|
|
859
|
-
options: { id: entityRefId || workItemId, workItemId, entityRefId },
|
|
860
|
-
},
|
|
861
|
-
});
|
|
549
|
+
|
|
550
|
+
@if (canReject()) {
|
|
551
|
+
<ax-button
|
|
552
|
+
[color]="'danger'"
|
|
553
|
+
[look]="'blank'"
|
|
554
|
+
[text]="'@general:actions.reject.title' | translate | async"
|
|
555
|
+
(onClick)="handleReject()"
|
|
556
|
+
class="leave-request-popover__action-btn"
|
|
557
|
+
>
|
|
558
|
+
<ax-prefix>
|
|
559
|
+
<i class="fa-light fa-xmark"></i>
|
|
560
|
+
</ax-prefix>
|
|
561
|
+
</ax-button>
|
|
862
562
|
}
|
|
863
|
-
|
|
864
|
-
if (
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
563
|
+
|
|
564
|
+
@if (canCancel()) {
|
|
565
|
+
<ax-button
|
|
566
|
+
[color]="'secondary'"
|
|
567
|
+
[look]="'blank'"
|
|
568
|
+
[text]="'@general:actions.cancel.title' | translate | async"
|
|
569
|
+
(onClick)="handleCancel()"
|
|
570
|
+
class="leave-request-popover__action-btn"
|
|
571
|
+
>
|
|
572
|
+
<ax-prefix>
|
|
573
|
+
<i class="fa-light fa-ban"></i>
|
|
574
|
+
</ax-prefix>
|
|
575
|
+
</ax-button>
|
|
876
576
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
}
|
|
882
|
-
async getStatuses() {
|
|
883
|
-
return [
|
|
884
|
-
{
|
|
885
|
-
index: 0,
|
|
886
|
-
key: AXPSystemStatuses.Pending.name,
|
|
887
|
-
title: await this.translationService.translateAsync('@human-capital-management:leave-requests.states.pending'),
|
|
888
|
-
color: 'warning',
|
|
889
|
-
},
|
|
890
|
-
{
|
|
891
|
-
index: 1,
|
|
892
|
-
key: AXPSystemStatuses.Approved.name,
|
|
893
|
-
title: await this.translationService.translateAsync('@human-capital-management:leave-requests.states.approved'),
|
|
894
|
-
color: 'success',
|
|
895
|
-
},
|
|
896
|
-
{
|
|
897
|
-
index: 2,
|
|
898
|
-
key: AXPSystemStatuses.Rejected.name,
|
|
899
|
-
title: await this.translationService.translateAsync('@human-capital-management:leave-requests.states.rejected'),
|
|
900
|
-
color: 'danger',
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
index: 3,
|
|
904
|
-
key: AXPSystemStatuses.Cancelled.name,
|
|
905
|
-
title: await this.translationService.translateAsync('@human-capital-management:leave-requests.states.cancelled'),
|
|
906
|
-
color: 'secondary',
|
|
907
|
-
},
|
|
908
|
-
];
|
|
909
|
-
}
|
|
910
|
-
//#endregion
|
|
911
|
-
//#region ---- Component ----
|
|
912
|
-
getComponent() {
|
|
913
|
-
return () => import('./acorex-modules-human-capital-management-leave-request-task-popover.component-yGvT9kSL.mjs').then((m) => m.AXMLeaveRequestTaskPopoverComponent);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
577
|
+
</div>
|
|
578
|
+
</div>
|
|
579
|
+
`, 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=pending]{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"] }]
|
|
580
|
+
}], propDecorators: { task: [{ type: i0.Input, args: [{ isSignal: true, alias: "task", required: true }] }] } });
|
|
916
581
|
|
|
917
582
|
//#endregion
|
|
918
583
|
//#region ---- Task Badge Provider ----
|
|
@@ -1072,11 +737,6 @@ class AXMLeaveRequestFeatureModule {
|
|
|
1072
737
|
useClass: AXMLeaveRequestBadgeProvider,
|
|
1073
738
|
multi: true,
|
|
1074
739
|
},
|
|
1075
|
-
{
|
|
1076
|
-
provide: AXP_WORKFLOW_TASK_PROVIDER,
|
|
1077
|
-
useClass: AXMLeaveRequestTaskProvider,
|
|
1078
|
-
multi: true,
|
|
1079
|
-
},
|
|
1080
740
|
{
|
|
1081
741
|
provide: AXP_STATUS_PROVIDERS,
|
|
1082
742
|
useClass: AXMLeaveRequestStatusProvider,
|
|
@@ -1108,11 +768,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1108
768
|
useClass: AXMLeaveRequestBadgeProvider,
|
|
1109
769
|
multi: true,
|
|
1110
770
|
},
|
|
1111
|
-
{
|
|
1112
|
-
provide: AXP_WORKFLOW_TASK_PROVIDER,
|
|
1113
|
-
useClass: AXMLeaveRequestTaskProvider,
|
|
1114
|
-
multi: true,
|
|
1115
|
-
},
|
|
1116
771
|
{
|
|
1117
772
|
provide: AXP_STATUS_PROVIDERS,
|
|
1118
773
|
useClass: AXMLeaveRequestStatusProvider,
|
|
@@ -1393,7 +1048,7 @@ class AXMHumanCapitalModuleEntityProvider {
|
|
|
1393
1048
|
case RootConfig.entities.leaveType.name:
|
|
1394
1049
|
return (await import('./acorex-modules-human-capital-management-leave-type.entity-CY81Nohl.mjs')).factory();
|
|
1395
1050
|
case RootConfig.entities.leaveRequest.name:
|
|
1396
|
-
return (await import('./acorex-modules-human-capital-management-leave-request.entity-
|
|
1051
|
+
return (await import('./acorex-modules-human-capital-management-leave-request.entity-CviI9xJC.mjs')).factory();
|
|
1397
1052
|
}
|
|
1398
1053
|
}
|
|
1399
1054
|
return null;
|
|
@@ -1494,5 +1149,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1494
1149
|
* Generated bundle index. Do not edit.
|
|
1495
1150
|
*/
|
|
1496
1151
|
|
|
1497
|
-
export { AXMHumanCapitalManagementModule, AXMLeaveRequestBadgeProvider,
|
|
1152
|
+
export { AXMHumanCapitalManagementModule, AXMLeaveRequestBadgeProvider, AXMLeaveRequestTaskPopoverComponent, AXMPermissionsKeys, AXPHumanCapitalManagementFeatureDefinitionProvider, AXPHumanCapitalManagementFeatureKeys, AXPHumanCapitalManagementMenuKeys, AXPLeaveRequestDialogService, HumanCapitalManagementManifest, RootConfig };
|
|
1498
1153
|
//# sourceMappingURL=acorex-modules-human-capital-management.mjs.map
|