@acorex-platform/module-timesheet-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.
- package/fesm2022/acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-8lA7h4rI.mjs +57 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-8lA7h4rI.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-approval-inbox.query-Wyz_jjxb.mjs +49 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-approval-inbox.query-Wyz_jjxb.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-DlAeGANo.mjs +54 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-DlAeGANo.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-compare-attendance-vs-timesheet.query-ZZym5nSx.mjs +91 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-compare-attendance-vs-timesheet.query-ZZym5nSx.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-contracts.mjs +200 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-contracts.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-create-time-entry.command-DS2EVLym.mjs +59 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-create-time-entry.command-DS2EVLym.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-delete-time-entry.command-5_ItHpnx.mjs +59 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-delete-time-entry.command-5_ItHpnx.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-D7V7SWUK.mjs +50 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-D7V7SWUK.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-my-timesheet-grid.query-DlDY3tdF.mjs +90 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-my-timesheet-grid.query-DlDY3tdF.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-CONxKPNm.mjs +56 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-CONxKPNm.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-DRr_c67L.mjs +56 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-DRr_c67L.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-report-billable-summary.query-BeLk4Of7.mjs +57 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-report-billable-summary.query-BeLk4Of7.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-report-hours-by-project.query-Sp8cLnTC.mjs +69 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-report-hours-by-project.query-Sp8cLnTC.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-report-hours-by-work-item.query-C8RU9Uc0.mjs +70 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-report-hours-by-work-item.query-C8RU9Uc0.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-submit-timesheet-period.command-C2qlQVIC.mjs +51 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-submit-timesheet-period.command-C2qlQVIC.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-team-timesheets.query-B0QpkVEI.mjs +51 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-team-timesheets.query-B0QpkVEI.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-timesheet-validation.service-DMrJn3HU.mjs +263 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-timesheet-validation.service-DMrJn3HU.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-update-time-entry.command-Do6s9OrI.mjs +60 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-update-time-entry.command-Do6s9OrI.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-work-item-search.query-BA2kvF-S.mjs +68 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-work-item-search.query-BA2kvF-S.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-workforce-exception-report.query-0q-AITic.mjs +40 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client-workforce-exception-report.query-0q-AITic.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client.mjs +891 -0
- package/fesm2022/acorex-platform-module-timesheet-management-client.mjs.map +1 -0
- package/package.json +28 -0
- package/types/acorex-platform-module-timesheet-management-client-contracts.d.ts +305 -0
- package/types/acorex-platform-module-timesheet-management-client.d.ts +54 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, Injectable } from '@angular/core';
|
|
4
|
+
import { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
5
|
+
import { A as AXMTimesheetValidationService } from './acorex-platform-module-timesheet-management-client-timesheet-validation.service-DMrJn3HU.mjs';
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
/**
|
|
9
|
+
* Deletes a time entry after validating the parent timesheet period is editable.
|
|
10
|
+
*/
|
|
11
|
+
class DeleteTimeEntryCommand {
|
|
12
|
+
constructor() {
|
|
13
|
+
//#region ---- Services & Dependencies ----
|
|
14
|
+
this.entityService = inject(AXPEntityService);
|
|
15
|
+
this.validationService = inject(AXMTimesheetValidationService);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ---- Command Implementation ----
|
|
19
|
+
async execute(input) {
|
|
20
|
+
try {
|
|
21
|
+
const dataAccessor = this.entityService
|
|
22
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)
|
|
23
|
+
.data();
|
|
24
|
+
const existing = await dataAccessor.byKey(input.id);
|
|
25
|
+
if (!existing) {
|
|
26
|
+
return { success: false, message: { text: 'Time entry not found.' } };
|
|
27
|
+
}
|
|
28
|
+
await this.assertPeriodEditable(existing.periodId);
|
|
29
|
+
await dataAccessor.delete(input.id);
|
|
30
|
+
return { success: true, kind: 'object', data: undefined };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const message = error instanceof Error ? error.message : 'Failed to delete time entry.';
|
|
34
|
+
console.error('[DeleteTimeEntryCommand] Error:', error);
|
|
35
|
+
return { success: false, message: { text: message } };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region ---- Private helpers ----
|
|
40
|
+
async assertPeriodEditable(periodId) {
|
|
41
|
+
const periodAccessor = this.entityService
|
|
42
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
43
|
+
.data();
|
|
44
|
+
const period = await periodAccessor.byKey(periodId);
|
|
45
|
+
if (!period) {
|
|
46
|
+
throw new Error('Timesheet period not found.');
|
|
47
|
+
}
|
|
48
|
+
this.validationService.assertPeriodAllowsTimeEntryEdits(period);
|
|
49
|
+
}
|
|
50
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DeleteTimeEntryCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
51
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DeleteTimeEntryCommand, providedIn: 'root' }); }
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DeleteTimeEntryCommand, decorators: [{
|
|
54
|
+
type: Injectable,
|
|
55
|
+
args: [{ providedIn: 'root' }]
|
|
56
|
+
}] });
|
|
57
|
+
|
|
58
|
+
export { DeleteTimeEntryCommand };
|
|
59
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-delete-time-entry.command-5_ItHpnx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-delete-time-entry.command-5_ItHpnx.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/time-entry/commands/delete-time-entry.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../../timesheet-period/timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface DeleteTimeEntryInput {\n id: string;\n}\n\n//#endregion\n\n/**\n * Deletes a time entry after validating the parent timesheet period is editable.\n */\n@Injectable({ providedIn: 'root' })\nexport class DeleteTimeEntryCommand implements AXPCommand<DeleteTimeEntryInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: DeleteTimeEntryInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const existing = await dataAccessor.byKey(input.id);\n if (!existing) {\n return { success: false, message: { text: 'Time entry not found.' } };\n }\n\n await this.assertPeriodEditable(existing.periodId);\n await dataAccessor.delete(input.id);\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to delete time entry.';\n console.error('[DeleteTimeEntryCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Private helpers ----\n\n private async assertPeriodEditable(periodId: string): Promise<void> {\n const periodAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await periodAccessor.byKey(periodId);\n if (!period) {\n throw new Error('Timesheet period not found.');\n }\n this.validationService.assertPeriodAllowsTimeEntryEdits(period);\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAgBA;AAEA;;AAEG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA6C3E,IAAA;;;IAvCC,MAAM,OAAO,CAAC,KAA2B,EAAA;AACvC,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,iBAAA,IAAI,EAAsD;YAE7D,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,QAAQ,EAAE;AACb,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE;YACvE;YAEA,MAAM,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAClD,MAAM,YAAY,CAAC,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UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, Injectable } from '@angular/core';
|
|
4
|
+
import { RootConfig, AXMTimesheetPeriodLockedStatusId } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
5
|
+
import { A as AXMTimesheetValidationService } from './acorex-platform-module-timesheet-management-client-timesheet-validation.service-DMrJn3HU.mjs';
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
/**
|
|
9
|
+
* Locks an approved timesheet period to prevent further edits.
|
|
10
|
+
*/
|
|
11
|
+
class LockTimesheetPeriodCommand {
|
|
12
|
+
constructor() {
|
|
13
|
+
//#region ---- Services & Dependencies ----
|
|
14
|
+
this.entityService = inject(AXPEntityService);
|
|
15
|
+
this.validationService = inject(AXMTimesheetValidationService);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ---- Command Implementation ----
|
|
19
|
+
async execute(input) {
|
|
20
|
+
try {
|
|
21
|
+
const dataAccessor = this.entityService
|
|
22
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
23
|
+
.data();
|
|
24
|
+
const period = await dataAccessor.byKey(input.id);
|
|
25
|
+
if (!period) {
|
|
26
|
+
return { success: false, message: { text: 'Timesheet period not found.' } };
|
|
27
|
+
}
|
|
28
|
+
this.validationService.assertCanLock(period);
|
|
29
|
+
await dataAccessor.update(input.id, {
|
|
30
|
+
statusId: AXMTimesheetPeriodLockedStatusId,
|
|
31
|
+
lockedAt: new Date().toISOString(),
|
|
32
|
+
});
|
|
33
|
+
return { success: true, kind: 'object', data: undefined };
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = error instanceof Error ? error.message : 'Failed to lock timesheet period.';
|
|
37
|
+
console.error('[LockTimesheetPeriodCommand] Error:', error);
|
|
38
|
+
return { success: false, message: { text: message } };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LockTimesheetPeriodCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
42
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LockTimesheetPeriodCommand, providedIn: 'root' }); }
|
|
43
|
+
}
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LockTimesheetPeriodCommand, decorators: [{
|
|
45
|
+
type: Injectable,
|
|
46
|
+
args: [{ providedIn: 'root' }]
|
|
47
|
+
}] });
|
|
48
|
+
|
|
49
|
+
export { LockTimesheetPeriodCommand };
|
|
50
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-D7V7SWUK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-lock-timesheet-period.command-D7V7SWUK.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/lock-timesheet-period.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { AXMTimesheetPeriodLockedStatusId, RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface LockTimesheetPeriodInput {\n id: string;\n}\n\n//#endregion\n\n/**\n * Locks an approved timesheet period to prevent further edits.\n */\n@Injectable({ providedIn: 'root' })\nexport class LockTimesheetPeriodCommand implements AXPCommand<LockTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: LockTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanLock(period);\n\n await dataAccessor.update(input.id, {\n statusId: AXMTimesheetPeriodLockedStatusId,\n lockedAt: new Date().toISOString(),\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to lock timesheet period.';\n console.error('[LockTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAeA;AAEA;;AAEG;MAEU,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAiC3E,IAAA;;;IA3BC,MAAM,OAAO,CAAC,KAA+B,EAAA;AAC3C,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI;AAC3E,iBAAA,IAAI,EAA4D;YAEnE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,E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erySuccessObject, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { groupBy, sumBy } from 'lodash';
|
|
6
|
+
import { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
/**
|
|
10
|
+
* Returns a weekly grid of time entries for the current employee and period.
|
|
11
|
+
*/
|
|
12
|
+
class AXMMyTimesheetGridQuery {
|
|
13
|
+
constructor() {
|
|
14
|
+
//#region ---- Services & Dependencies ----
|
|
15
|
+
this.entityService = inject(AXPEntityService);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ---- Query Execution ----
|
|
19
|
+
async fetch(input) {
|
|
20
|
+
try {
|
|
21
|
+
const periodAccessor = this.entityService
|
|
22
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
23
|
+
.data();
|
|
24
|
+
let period = null;
|
|
25
|
+
if (input.periodId) {
|
|
26
|
+
period = await periodAccessor.byKey(input.periodId);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const periodFilters = [
|
|
30
|
+
{ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },
|
|
31
|
+
];
|
|
32
|
+
if (input.startDate) {
|
|
33
|
+
periodFilters.push({ field: 'startDate', operator: { type: 'equal' }, value: input.startDate });
|
|
34
|
+
}
|
|
35
|
+
const periods = await periodAccessor.query({
|
|
36
|
+
skip: 0,
|
|
37
|
+
take: 1,
|
|
38
|
+
sort: [{ field: 'startDate', dir: 'desc' }],
|
|
39
|
+
filter: {
|
|
40
|
+
logic: 'and',
|
|
41
|
+
filters: periodFilters,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
period = periods.items[0] ?? null;
|
|
45
|
+
}
|
|
46
|
+
if (!period) {
|
|
47
|
+
return runtimeQuerySuccessObject({ period: null, days: [], totalSeconds: 0 });
|
|
48
|
+
}
|
|
49
|
+
const entryAccessor = this.entityService
|
|
50
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)
|
|
51
|
+
.data();
|
|
52
|
+
const entriesResult = await entryAccessor.query({
|
|
53
|
+
skip: 0,
|
|
54
|
+
take: 1000,
|
|
55
|
+
filter: {
|
|
56
|
+
logic: 'and',
|
|
57
|
+
filters: [
|
|
58
|
+
{ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },
|
|
59
|
+
{ field: 'periodId', operator: { type: 'equal' }, value: period.id },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const grouped = groupBy(entriesResult.items, (row) => row.entryDate);
|
|
64
|
+
const days = Object.keys(grouped)
|
|
65
|
+
.sort()
|
|
66
|
+
.map((date) => ({
|
|
67
|
+
date,
|
|
68
|
+
totalSeconds: sumBy(grouped[date], (row) => row.durationSeconds ?? 0),
|
|
69
|
+
entries: grouped[date],
|
|
70
|
+
}));
|
|
71
|
+
return runtimeQuerySuccessObject({
|
|
72
|
+
period,
|
|
73
|
+
days,
|
|
74
|
+
totalSeconds: sumBy(entriesResult.items, (row) => row.durationSeconds ?? 0),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return runtimeQueryFailure(error instanceof Error ? error.message : 'Failed to load my timesheet grid.');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMMyTimesheetGridQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
82
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMMyTimesheetGridQuery, providedIn: 'root' }); }
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMMyTimesheetGridQuery, decorators: [{
|
|
85
|
+
type: Injectable,
|
|
86
|
+
args: [{ providedIn: 'root' }]
|
|
87
|
+
}] });
|
|
88
|
+
|
|
89
|
+
export { AXMMyTimesheetGridQuery };
|
|
90
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-my-timesheet-grid.query-DlDY3tdF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-my-timesheet-grid.query-DlDY3tdF.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/reporting/queries/my-timesheet-grid.query.ts"],"sourcesContent":["import { AXPQuery, type AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXDataSourceFilterOption } from '@acorex/cdk/common';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessObject,\n type AXPRuntimeQueryResult,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { groupBy, sumBy } from 'lodash';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\n\n//#region ---- Types ----\n\nexport interface AXMMyTimesheetGridQueryInput {\n employeeId: string;\n periodId?: string;\n startDate?: string;\n endDate?: string;\n}\n\nexport interface AXMMyTimesheetGridDayCell {\n date: string;\n totalSeconds: number;\n entries: AXMTimesheetManagementTimeEntryEntityModel[];\n}\n\nexport interface AXMMyTimesheetGridQueryResult {\n period: AXMTimesheetManagementTimesheetPeriodEntityModel | null;\n days: AXMMyTimesheetGridDayCell[];\n totalSeconds: number;\n}\n\n//#endregion\n\n/**\n * Returns a weekly grid of time entries for the current employee and period.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMMyTimesheetGridQuery\n implements AXPQuery<AXMMyTimesheetGridQueryInput, AXMMyTimesheetGridQueryResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Query Execution ----\n\n async fetch(\n input: AXMMyTimesheetGridQueryInput,\n ): AXPQueryFetchResultPromise<AXMMyTimesheetGridQueryResult> {\n try {\n const periodAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n let period: AXMTimesheetManagementTimesheetPeriodEntityModel | null = null;\n\n if (input.periodId) {\n period = await periodAccessor.byKey(input.periodId);\n } else {\n const periodFilters: AXDataSourceFilterOption[] = [\n { field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },\n ];\n if (input.startDate) {\n periodFilters.push({ field: 'startDate', operator: { type: 'equal' }, value: input.startDate });\n }\n\n const periods = await periodAccessor.query({\n skip: 0,\n take: 1,\n sort: [{ field: 'startDate', dir: 'desc' }],\n filter: {\n logic: 'and',\n filters: periodFilters,\n },\n });\n period = periods.items[0] ?? null;\n }\n\n if (!period) {\n return runtimeQuerySuccessObject({ period: null, days: [], totalSeconds: 0 });\n }\n\n const entryAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const entriesResult = await entryAccessor.query({\n skip: 0,\n take: 1000,\n filter: {\n logic: 'and',\n filters: [\n { field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },\n { field: 'periodId', operator: { type: 'equal' }, value: period.id },\n ],\n },\n });\n\n const grouped = groupBy(entriesResult.items, (row) => row.entryDate);\n const days = Object.keys(grouped)\n .sort()\n .map((date) => ({\n date,\n totalSeconds: sumBy(grouped[date], (row) => row.durationSeconds ?? 0),\n entries: grouped[date],\n }));\n\n return runtimeQuerySuccessObject({\n period,\n days,\n totalSeconds: sumBy(entriesResult.items, (row) => row.durationSeconds ?? 0),\n });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Failed to load my timesheet grid.',\n );\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAoCA;AAEA;;AAEG;MAEU,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAgF1D,IAAA;;;IA1EC,MAAM,KAAK,CACT,KAAmC,EAAA;AAEnC,QAAA,IAAI;AACF,YAAA,MAAM,cAAc,GAAG,IAAI,CAAC;AACzB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI;AAC3E,iBAAA,IAAI,EAA4D;YAEnE,IAAI,MAAM,GAA4D,IAAI;AAE1E,YAAA,IAAI,KAAK,CAAC,QAAQ,EAAE;gBAClB,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;YACrD;iBAAO;AACL,gBAAA,MAAM,aAAa,GAA+B;AAChD,oBAAA,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE;iBAC9E;AACD,gBAAA,IAAI,KAAK,CAAC,SAAS,EAAE;oBACnB,aAAa,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;gBACjG;AAEA,gBAAA,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC;AACzC,oBAAA,IAAI,EAAE,CAAC;AACP,oBAAA,IAAI,E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AAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO;AAC7B,iBAAA,IAAI;AACJ,iBAAA,GAAG,CAAC,CAAC,IAAI,MAAM;gBACd,IAAI;AACJ,gBAAA,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,eAAe,IAAI,CAAC,CAAC;AACrE,gBAAA,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;AACvB,aAAA,CAAC,CAAC;AAEL,YAAA,OAAO,yBAAyB,CAAC;gBAC/B,MAAM;gBACN,IAAI;AACJ,gBAAA,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,eAAe,IAAI,CAAC,CAAC;AAC5E,aAAA,CAAC;QACJ;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,mBAAmB,CACxB,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,mCAAmC,CAC7E;QACH;IACF;8GAlFW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { isEmpty } from 'lodash';
|
|
6
|
+
import { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
7
|
+
import { A as AXMTimesheetValidationService } from './acorex-platform-module-timesheet-management-client-timesheet-validation.service-DMrJn3HU.mjs';
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
/**
|
|
11
|
+
* Rejects a timesheet period that is awaiting approval.
|
|
12
|
+
*/
|
|
13
|
+
class RejectTimesheetPeriodCommand {
|
|
14
|
+
constructor() {
|
|
15
|
+
//#region ---- Services & Dependencies ----
|
|
16
|
+
this.entityService = inject(AXPEntityService);
|
|
17
|
+
this.validationService = inject(AXMTimesheetValidationService);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ---- Command Implementation ----
|
|
21
|
+
async execute(input) {
|
|
22
|
+
try {
|
|
23
|
+
const dataAccessor = this.entityService
|
|
24
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
25
|
+
.data();
|
|
26
|
+
const period = await dataAccessor.byKey(input.id);
|
|
27
|
+
if (!period) {
|
|
28
|
+
return { success: false, message: { text: 'Timesheet period not found.' } };
|
|
29
|
+
}
|
|
30
|
+
this.validationService.assertCanReject(period);
|
|
31
|
+
if (isEmpty(input.rejectionReason?.trim())) {
|
|
32
|
+
return { success: false, message: { text: 'A rejection reason is required.' } };
|
|
33
|
+
}
|
|
34
|
+
await dataAccessor.update(input.id, {
|
|
35
|
+
statusId: AXPSystemStatusType.Rejected,
|
|
36
|
+
rejectedAt: new Date().toISOString(),
|
|
37
|
+
rejectionReason: input.rejectionReason?.trim(),
|
|
38
|
+
});
|
|
39
|
+
return { success: true, kind: 'object', data: undefined };
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const message = error instanceof Error ? error.message : 'Failed to reject timesheet period.';
|
|
43
|
+
console.error('[RejectTimesheetPeriodCommand] Error:', error);
|
|
44
|
+
return { success: false, message: { text: message } };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: RejectTimesheetPeriodCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
48
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: RejectTimesheetPeriodCommand, providedIn: 'root' }); }
|
|
49
|
+
}
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: RejectTimesheetPeriodCommand, decorators: [{
|
|
51
|
+
type: Injectable,
|
|
52
|
+
args: [{ providedIn: 'root' }]
|
|
53
|
+
}] });
|
|
54
|
+
|
|
55
|
+
export { RejectTimesheetPeriodCommand };
|
|
56
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-CONxKPNm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-reject-timesheet-period.command-CONxKPNm.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/reject-timesheet-period.command.ts"],"sourcesContent":["\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty } from 'lodash';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface RejectTimesheetPeriodInput {\n id: string;\n rejectionReason?: string;\n}\n\n//#endregion\n\n/**\n * Rejects a timesheet period that is awaiting approval.\n */\n@Injectable({ providedIn: 'root' })\nexport class RejectTimesheetPeriodCommand implements AXPCommand<RejectTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: RejectTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanReject(period);\n\n if (isEmpty(input.rejectionReason?.trim())) {\n return { success: false, message: { text: 'A rejection reason is required.' } };\n }\n\n await dataAccessor.update(input.id, {\n statusId: AXPSystemStatusType.Rejected,\n rejectedAt: new Date().toISOString(),\n rejectionReason: input.rejectionReason?.trim(),\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to reject timesheet period.';\n console.error('[RejectTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;AAmBA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAsC3E,IAAA;;;IAhCC,MAAM,OAAO,CAAC,KAAiC,EAAA;AAC7C,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC;AACvB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,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AAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
6
|
+
import { A as AXMTimesheetValidationService } from './acorex-platform-module-timesheet-management-client-timesheet-validation.service-DMrJn3HU.mjs';
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
/**
|
|
10
|
+
* Reopens a rejected or approved timesheet period back to draft.
|
|
11
|
+
*/
|
|
12
|
+
class ReopenTimesheetPeriodCommand {
|
|
13
|
+
constructor() {
|
|
14
|
+
//#region ---- Services & Dependencies ----
|
|
15
|
+
this.entityService = inject(AXPEntityService);
|
|
16
|
+
this.validationService = inject(AXMTimesheetValidationService);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region ---- Command Implementation ----
|
|
20
|
+
async execute(input) {
|
|
21
|
+
try {
|
|
22
|
+
const dataAccessor = this.entityService
|
|
23
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
24
|
+
.data();
|
|
25
|
+
const period = await dataAccessor.byKey(input.id);
|
|
26
|
+
if (!period) {
|
|
27
|
+
return { success: false, message: { text: 'Timesheet period not found.' } };
|
|
28
|
+
}
|
|
29
|
+
this.validationService.assertCanReopen(period);
|
|
30
|
+
await dataAccessor.update(input.id, {
|
|
31
|
+
statusId: AXPSystemStatusType.Draft,
|
|
32
|
+
submittedAt: undefined,
|
|
33
|
+
approvedAt: undefined,
|
|
34
|
+
approvedById: undefined,
|
|
35
|
+
rejectedAt: undefined,
|
|
36
|
+
rejectionReason: undefined,
|
|
37
|
+
lockedAt: undefined,
|
|
38
|
+
});
|
|
39
|
+
return { success: true, kind: 'object', data: undefined };
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const message = error instanceof Error ? error.message : 'Failed to reopen timesheet period.';
|
|
43
|
+
console.error('[ReopenTimesheetPeriodCommand] Error:', error);
|
|
44
|
+
return { success: false, message: { text: message } };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ReopenTimesheetPeriodCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
48
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ReopenTimesheetPeriodCommand, providedIn: 'root' }); }
|
|
49
|
+
}
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ReopenTimesheetPeriodCommand, decorators: [{
|
|
51
|
+
type: Injectable,
|
|
52
|
+
args: [{ providedIn: 'root' }]
|
|
53
|
+
}] });
|
|
54
|
+
|
|
55
|
+
export { ReopenTimesheetPeriodCommand };
|
|
56
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-DRr_c67L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-reopen-timesheet-period.command-DRr_c67L.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/reopen-timesheet-period.command.ts"],"sourcesContent":["\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimesheetPeriodEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport { AXMTimesheetValidationService } from '../timesheet-validation.service';\n\n//#region ---- Types ----\n\nexport interface ReopenTimesheetPeriodInput {\n id: string;\n}\n\n//#endregion\n\n/**\n * Reopens a rejected or approved timesheet period back to draft.\n */\n@Injectable({ providedIn: 'root' })\nexport class ReopenTimesheetPeriodCommand implements AXPCommand<ReopenTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ReopenTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const period = await dataAccessor.byKey(input.id);\n if (!period) {\n return { success: false, message: { text: 'Timesheet period not found.' } };\n }\n\n this.validationService.assertCanReopen(period);\n\n await dataAccessor.update(input.id, {\n statusId: AXPSystemStatusType.Draft,\n submittedAt: undefined,\n approvedAt: undefined,\n approvedById: undefined,\n rejectedAt: undefined,\n rejectionReason: undefined,\n lockedAt: undefined,\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to reopen timesheet period.';\n console.error('[ReopenTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"m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AAK,CAAC,OAAO,GAAG,oCAAoC;AAC7F,YAAA,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC;AAC7D,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QACvD;IACF;8GAvCW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { runtimeQuerySuccessObject, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { sumBy } from 'lodash';
|
|
6
|
+
import { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
/**
|
|
10
|
+
* Summarizes billable vs non-billable hours for a date range.
|
|
11
|
+
*/
|
|
12
|
+
class AXMReportBillableSummaryQuery {
|
|
13
|
+
constructor() {
|
|
14
|
+
//#region ---- Services & Dependencies ----
|
|
15
|
+
this.entityService = inject(AXPEntityService);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ---- Query Execution ----
|
|
19
|
+
async fetch(input) {
|
|
20
|
+
try {
|
|
21
|
+
const entryAccessor = this.entityService
|
|
22
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)
|
|
23
|
+
.data();
|
|
24
|
+
const filters = [
|
|
25
|
+
{ field: 'entryDate', operator: { type: 'gte' }, value: input.startDate },
|
|
26
|
+
{ field: 'entryDate', operator: { type: 'lte' }, value: input.endDate },
|
|
27
|
+
];
|
|
28
|
+
if (input.employeeId) {
|
|
29
|
+
filters.unshift({ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId });
|
|
30
|
+
}
|
|
31
|
+
const result = await entryAccessor.query({
|
|
32
|
+
skip: 0,
|
|
33
|
+
take: 5000,
|
|
34
|
+
filter: { logic: 'and', filters },
|
|
35
|
+
});
|
|
36
|
+
const billableSeconds = sumBy(result.items.filter((row) => row.isBillable), (row) => row.durationSeconds ?? 0);
|
|
37
|
+
const totalSeconds = sumBy(result.items, (row) => row.durationSeconds ?? 0);
|
|
38
|
+
return runtimeQuerySuccessObject({
|
|
39
|
+
billableSeconds,
|
|
40
|
+
nonBillableSeconds: totalSeconds - billableSeconds,
|
|
41
|
+
totalSeconds,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return runtimeQueryFailure(error instanceof Error ? error.message : 'Failed to load billable summary report.');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportBillableSummaryQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
49
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportBillableSummaryQuery, providedIn: 'root' }); }
|
|
50
|
+
}
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportBillableSummaryQuery, decorators: [{
|
|
52
|
+
type: Injectable,
|
|
53
|
+
args: [{ providedIn: 'root' }]
|
|
54
|
+
}] });
|
|
55
|
+
|
|
56
|
+
export { AXMReportBillableSummaryQuery };
|
|
57
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-report-billable-summary.query-BeLk4Of7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-report-billable-summary.query-BeLk4Of7.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/reporting/queries/report-billable-summary.query.ts"],"sourcesContent":["import { AXPQuery, type AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXDataSourceFilterOption } from '@acorex/cdk/common';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessObject,\n type AXPRuntimeQueryResult,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { sumBy } from 'lodash';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\n\n//#region ---- Types ----\n\nexport interface AXMReportBillableSummaryQueryInput {\n employeeId?: string;\n startDate: string;\n endDate: string;\n}\n\nexport interface AXMReportBillableSummaryQueryResult {\n billableSeconds: number;\n nonBillableSeconds: number;\n totalSeconds: number;\n}\n\n//#endregion\n\n/**\n * Summarizes billable vs non-billable hours for a date range.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMReportBillableSummaryQuery\n implements AXPQuery<AXMReportBillableSummaryQueryInput, AXMReportBillableSummaryQueryResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Query Execution ----\n\n async fetch(\n input: AXMReportBillableSummaryQueryInput,\n ): AXPQueryFetchResultPromise<AXMReportBillableSummaryQueryResult> {\n try {\n const entryAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const filters: AXDataSourceFilterOption[] = [\n { field: 'entryDate', operator: { type: 'gte' }, value: input.startDate },\n { field: 'entryDate', operator: { type: 'lte' }, value: input.endDate },\n ];\n\n if (input.employeeId) {\n filters.unshift({ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId });\n }\n\n const result = await entryAccessor.query({\n skip: 0,\n take: 5000,\n filter: { logic: 'and', filters },\n });\n\n const billableSeconds = sumBy(\n result.items.filter((row) => row.isBillable),\n (row) => row.durationSeconds ?? 0,\n );\n const totalSeconds = sumBy(result.items, (row) => row.durationSeconds ?? 0);\n\n return runtimeQuerySuccessObject({\n billableSeconds,\n nonBillableSeconds: totalSeconds - billableSeconds,\n totalSeconds,\n });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Failed to load billable summary report.',\n );\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AA4BA;AAEA;;AAEG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAgD1D,IAAA;;;IA1CC,MAAM,KAAK,CACT,KAAyC,EAAA;AAEzC,QAAA,IAAI;AACF,YAAA,MAAM,aAAa,GAAG,IAAI,CAAC;AACxB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AACrE,iBAAA,IAAI,EAAsD;AAE7D,YAAA,MAAM,OAAO,GAA+B;AAC1C,gBAAA,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE;AACzE,gBAAA,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAA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EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,cADhB,MAAM,EAAA,CAAA,CAAA;;2FACnB,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { runtimeQuerySuccessObject, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { groupBy, sumBy } from 'lodash';
|
|
6
|
+
import { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
/**
|
|
10
|
+
* Aggregates logged hours by project for a date range.
|
|
11
|
+
*/
|
|
12
|
+
class AXMReportHoursByProjectQuery {
|
|
13
|
+
constructor() {
|
|
14
|
+
//#region ---- Services & Dependencies ----
|
|
15
|
+
this.entityService = inject(AXPEntityService);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ---- Query Execution ----
|
|
19
|
+
async fetch(input) {
|
|
20
|
+
try {
|
|
21
|
+
const entries = await this.loadEntries(input);
|
|
22
|
+
const grouped = groupBy(entries, (row) => row.projectId ?? '__none__');
|
|
23
|
+
const rows = Object.entries(grouped).map(([key, items]) => {
|
|
24
|
+
const first = items[0];
|
|
25
|
+
return {
|
|
26
|
+
projectId: key === '__none__' ? undefined : key,
|
|
27
|
+
projectName: first?.project?.title,
|
|
28
|
+
totalSeconds: sumBy(items, (row) => row.durationSeconds ?? 0),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
return runtimeQuerySuccessObject({
|
|
32
|
+
rows,
|
|
33
|
+
totalSeconds: sumBy(entries, (row) => row.durationSeconds ?? 0),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return runtimeQueryFailure(error instanceof Error ? error.message : 'Failed to load hours by project report.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ---- Private helpers ----
|
|
42
|
+
async loadEntries(input) {
|
|
43
|
+
const entryAccessor = this.entityService
|
|
44
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)
|
|
45
|
+
.data();
|
|
46
|
+
const filters = [
|
|
47
|
+
{ field: 'entryDate', operator: { type: 'gte' }, value: input.startDate },
|
|
48
|
+
{ field: 'entryDate', operator: { type: 'lte' }, value: input.endDate },
|
|
49
|
+
];
|
|
50
|
+
if (input.employeeId) {
|
|
51
|
+
filters.unshift({ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId });
|
|
52
|
+
}
|
|
53
|
+
const result = await entryAccessor.query({
|
|
54
|
+
skip: 0,
|
|
55
|
+
take: 5000,
|
|
56
|
+
filter: { logic: 'and', filters },
|
|
57
|
+
});
|
|
58
|
+
return result.items;
|
|
59
|
+
}
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportHoursByProjectQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
61
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportHoursByProjectQuery, providedIn: 'root' }); }
|
|
62
|
+
}
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportHoursByProjectQuery, decorators: [{
|
|
64
|
+
type: Injectable,
|
|
65
|
+
args: [{ providedIn: 'root' }]
|
|
66
|
+
}] });
|
|
67
|
+
|
|
68
|
+
export { AXMReportHoursByProjectQuery };
|
|
69
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-report-hours-by-project.query-Sp8cLnTC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-report-hours-by-project.query-Sp8cLnTC.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/reporting/queries/report-hours-by-project.query.ts"],"sourcesContent":["import { AXPQuery, type AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXDataSourceFilterOption } from '@acorex/cdk/common';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessObject,\n type AXPRuntimeQueryResult,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { groupBy, sumBy } from 'lodash';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\n\n//#region ---- Types ----\n\nexport interface AXMReportHoursByProjectQueryInput {\n employeeId?: string;\n startDate: string;\n endDate: string;\n}\n\nexport interface AXMReportHoursByProjectRow {\n projectId?: string;\n projectName?: string;\n totalSeconds: number;\n}\n\nexport interface AXMReportHoursByProjectQueryResult {\n rows: AXMReportHoursByProjectRow[];\n totalSeconds: number;\n}\n\n//#endregion\n\n/**\n * Aggregates logged hours by project for a date range.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMReportHoursByProjectQuery\n implements AXPQuery<AXMReportHoursByProjectQueryInput, AXMReportHoursByProjectQueryResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Query Execution ----\n\n async fetch(\n input: AXMReportHoursByProjectQueryInput,\n ): AXPQueryFetchResultPromise<AXMReportHoursByProjectQueryResult> {\n try {\n const entries = await this.loadEntries(input);\n const grouped = groupBy(entries, (row) => row.projectId ?? '__none__');\n\n const rows = Object.entries(grouped).map(([key, items]) => {\n const first = items[0];\n return {\n projectId: key === '__none__' ? undefined : key,\n projectName: first?.project?.title,\n totalSeconds: sumBy(items, (row) => row.durationSeconds ?? 0),\n };\n });\n\n return runtimeQuerySuccessObject({\n rows,\n totalSeconds: sumBy(entries, (row) => row.durationSeconds ?? 0),\n });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Failed to load hours by project report.',\n );\n }\n }\n\n //#endregion\n\n //#region ---- Private helpers ----\n\n private async loadEntries(input: AXMReportHoursByProjectQueryInput): Promise<AXMTimesheetManagementTimeEntryEntityModel[]> {\n const entryAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const filters: AXDataSourceFilterOption[] = [\n { field: 'entryDate', operator: { type: 'gte' }, value: input.startDate },\n { field: 'entryDate', operator: { type: 'lte' }, value: input.endDate },\n ];\n\n if (input.employeeId) {\n filters.unshift({ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId });\n }\n\n const result = await entryAccessor.query({\n skip: 0,\n take: 5000,\n filter: { logic: 'and', filters },\n });\n\n return result.items;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAiCA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA6D1D,IAAA;;;IAvDC,MAAM,KAAK,CACT,KAAwC,EAAA;AAExC,QAAA,IAAI;YACF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7C,YAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,SAAS,IAAI,UAAU,CAAC;AAEtE,YAAA,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AACxD,g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AE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QAChG;AAEA,QAAA,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC;AACvC,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;AAClC,SAAA,CAAC;QAEF,OAAO,MAAM,CAAC,KAAK;IACrB;8GA/DW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { runtimeQuerySuccessObject, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { groupBy, sumBy } from 'lodash';
|
|
6
|
+
import { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
/**
|
|
10
|
+
* Aggregates logged hours by work item for a date range.
|
|
11
|
+
*/
|
|
12
|
+
class AXMReportHoursByWorkItemQuery {
|
|
13
|
+
constructor() {
|
|
14
|
+
//#region ---- Services & Dependencies ----
|
|
15
|
+
this.entityService = inject(AXPEntityService);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ---- Query Execution ----
|
|
19
|
+
async fetch(input) {
|
|
20
|
+
try {
|
|
21
|
+
const entries = await this.loadEntries(input);
|
|
22
|
+
const grouped = groupBy(entries, (row) => row.workItemId);
|
|
23
|
+
const rows = Object.entries(grouped).map(([workItemId, items]) => {
|
|
24
|
+
const first = items[0];
|
|
25
|
+
return {
|
|
26
|
+
workItemId,
|
|
27
|
+
workItemCode: first?.workItem?.code ?? first?.workItemSnapshot?.title,
|
|
28
|
+
workItemTitle: first?.workItemSnapshot?.title ?? first?.workItem?.title,
|
|
29
|
+
totalSeconds: sumBy(items, (row) => row.durationSeconds ?? 0),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return runtimeQuerySuccessObject({
|
|
33
|
+
rows,
|
|
34
|
+
totalSeconds: sumBy(entries, (row) => row.durationSeconds ?? 0),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return runtimeQueryFailure(error instanceof Error ? error.message : 'Failed to load hours by work item report.');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region ---- Private helpers ----
|
|
43
|
+
async loadEntries(input) {
|
|
44
|
+
const entryAccessor = this.entityService
|
|
45
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)
|
|
46
|
+
.data();
|
|
47
|
+
const filters = [
|
|
48
|
+
{ field: 'entryDate', operator: { type: 'gte' }, value: input.startDate },
|
|
49
|
+
{ field: 'entryDate', operator: { type: 'lte' }, value: input.endDate },
|
|
50
|
+
];
|
|
51
|
+
if (input.employeeId) {
|
|
52
|
+
filters.unshift({ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId });
|
|
53
|
+
}
|
|
54
|
+
const result = await entryAccessor.query({
|
|
55
|
+
skip: 0,
|
|
56
|
+
take: 5000,
|
|
57
|
+
filter: { logic: 'and', filters },
|
|
58
|
+
});
|
|
59
|
+
return result.items;
|
|
60
|
+
}
|
|
61
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportHoursByWorkItemQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
62
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportHoursByWorkItemQuery, providedIn: 'root' }); }
|
|
63
|
+
}
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMReportHoursByWorkItemQuery, decorators: [{
|
|
65
|
+
type: Injectable,
|
|
66
|
+
args: [{ providedIn: 'root' }]
|
|
67
|
+
}] });
|
|
68
|
+
|
|
69
|
+
export { AXMReportHoursByWorkItemQuery };
|
|
70
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-report-hours-by-work-item.query-C8RU9Uc0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-report-hours-by-work-item.query-C8RU9Uc0.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/reporting/queries/report-hours-by-work-item.query.ts"],"sourcesContent":["import { AXPQuery, type AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXDataSourceFilterOption } from '@acorex/cdk/common';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessObject,\n type AXPRuntimeQueryResult,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { groupBy, sumBy } from 'lodash';\nimport { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';\nimport type { AXMTimesheetManagementTimeEntryEntityModel } from '@acorex-platform/module-timesheet-management-client/contracts';\n\n//#region ---- Types ----\n\nexport interface AXMReportHoursByWorkItemQueryInput {\n employeeId?: string;\n startDate: string;\n endDate: string;\n}\n\nexport interface AXMReportHoursByWorkItemRow {\n workItemId: string;\n workItemCode?: string;\n workItemTitle?: string;\n totalSeconds: number;\n}\n\nexport interface AXMReportHoursByWorkItemQueryResult {\n rows: AXMReportHoursByWorkItemRow[];\n totalSeconds: number;\n}\n\n//#endregion\n\n/**\n * Aggregates logged hours by work item for a date range.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMReportHoursByWorkItemQuery\n implements AXPQuery<AXMReportHoursByWorkItemQueryInput, AXMReportHoursByWorkItemQueryResult>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Query Execution ----\n\n async fetch(\n input: AXMReportHoursByWorkItemQueryInput,\n ): AXPQueryFetchResultPromise<AXMReportHoursByWorkItemQueryResult> {\n try {\n const entries = await this.loadEntries(input);\n const grouped = groupBy(entries, (row) => row.workItemId);\n\n const rows = Object.entries(grouped).map(([workItemId, items]) => {\n const first = items[0];\n return {\n workItemId,\n workItemCode: first?.workItem?.code ?? first?.workItemSnapshot?.title,\n workItemTitle: first?.workItemSnapshot?.title ?? first?.workItem?.title,\n totalSeconds: sumBy(items, (row) => row.durationSeconds ?? 0),\n };\n });\n\n return runtimeQuerySuccessObject({\n rows,\n totalSeconds: sumBy(entries, (row) => row.durationSeconds ?? 0),\n });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Failed to load hours by work item report.',\n );\n }\n }\n\n //#endregion\n\n //#region ---- Private helpers ----\n\n private async loadEntries(input: AXMReportHoursByWorkItemQueryInput): Promise<AXMTimesheetManagementTimeEntryEntityModel[]> {\n const entryAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const filters: AXDataSourceFilterOption[] = [\n { field: 'entryDate', operator: { type: 'gte' }, value: input.startDate },\n { field: 'entryDate', operator: { type: 'lte' }, value: input.endDate },\n ];\n\n if (input.employeeId) {\n filters.unshift({ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId });\n }\n\n const result = await entryAccessor.query({\n skip: 0,\n take: 5000,\n filter: { logic: 'and', filters },\n });\n\n return result.items;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAkCA;AAEA;;AAEG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA8D1D,IAAA;;;IAxDC,MAAM,KAAK,CACT,KAAyC,EAAA;AAEzC,QAAA,IAAI;YACF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7C,YAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,UAAU,CAAC;AAEzD,YAAA,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,KAAI;AAC/D,gBAAA,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;gBACtB,OAAO;oBACL,UAAU;oBACV,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,KAAK,EAAE,gBAAgB,EAAE,KAAK;oBACrE,aAAa,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,IAAI,KAAK,EAAE,QAAQ,EAAE,KAAK;AACvE,oBAAA,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,eAAe,IAAI,CAAC,CAAC;iBAC9D;AACH,YAAA,CAAC,CAAC;AAEF,YAAA,OAAO,yBAAyB,CAAC;gBAC/B,IAAI;AACJ,gBAAA,YAAY,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,eAAe,IA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