@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,57 @@
|
|
|
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 { isEmpty } from 'lodash';
|
|
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
|
+
* Applies an administrative adjustment to an approved or locked timesheet period.
|
|
11
|
+
*/
|
|
12
|
+
class AdminAdjustTimesheetPeriodCommand {
|
|
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
|
+
if (isEmpty(input.adjustmentNote?.trim())) {
|
|
23
|
+
return { success: false, message: { text: 'An adjustment note is required.' } };
|
|
24
|
+
}
|
|
25
|
+
const dataAccessor = this.entityService
|
|
26
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
27
|
+
.data();
|
|
28
|
+
const period = await dataAccessor.byKey(input.id);
|
|
29
|
+
if (!period) {
|
|
30
|
+
return { success: false, message: { text: 'Timesheet period not found.' } };
|
|
31
|
+
}
|
|
32
|
+
this.validationService.assertCanAdminAdjust(period);
|
|
33
|
+
const updateData = {
|
|
34
|
+
rejectionReason: input.adjustmentNote.trim(),
|
|
35
|
+
};
|
|
36
|
+
if (input.totalSeconds != null) {
|
|
37
|
+
updateData.totalSeconds = input.totalSeconds;
|
|
38
|
+
}
|
|
39
|
+
await dataAccessor.update(input.id, updateData);
|
|
40
|
+
return { success: true, kind: 'object', data: undefined };
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const message = error instanceof Error ? error.message : 'Failed to adjust timesheet period.';
|
|
44
|
+
console.error('[AdminAdjustTimesheetPeriodCommand] Error:', error);
|
|
45
|
+
return { success: false, message: { text: message } };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AdminAdjustTimesheetPeriodCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
49
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AdminAdjustTimesheetPeriodCommand, providedIn: 'root' }); }
|
|
50
|
+
}
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AdminAdjustTimesheetPeriodCommand, decorators: [{
|
|
52
|
+
type: Injectable,
|
|
53
|
+
args: [{ providedIn: 'root' }]
|
|
54
|
+
}] });
|
|
55
|
+
|
|
56
|
+
export { AdminAdjustTimesheetPeriodCommand };
|
|
57
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-8lA7h4rI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-admin-adjust-timesheet-period.command-8lA7h4rI.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/admin-adjust-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 { 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 AdminAdjustTimesheetPeriodInput {\n id: string;\n totalSeconds?: number;\n adjustmentNote: string;\n}\n\n//#endregion\n\n/**\n * Applies an administrative adjustment to an approved or locked timesheet period.\n */\n@Injectable({ providedIn: 'root' })\nexport class AdminAdjustTimesheetPeriodCommand implements AXPCommand<AdminAdjustTimesheetPeriodInput, 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: AdminAdjustTimesheetPeriodInput): AXPCommandExecuteResultPromise<void> {\n try {\n if (isEmpty(input.adjustmentNote?.trim())) {\n return { success: false, message: { text: 'An adjustment note is required.' } };\n }\n\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.assertCanAdminAdjust(period);\n\n const updateData: Partial<AXMTimesheetManagementTimesheetPeriodEntityModel> = {\n rejectionReason: input.adjustmentNote.trim(),\n };\n\n if (input.totalSeconds != null) {\n updateData.totalSeconds = input.totalSeconds;\n }\n\n await dataAccessor.update(input.id, updateData);\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to adjust timesheet period.';\n console.error('[AdminAdjustTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AAkBA;AAEA;;AAEG;MAEU,iCAAiC,CAAA;AAD9C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA0C3E,IAAA;;;IApCC,MAAM,OAAO,CAAC,KAAsC,EAAA;AAClD,QAAA,IAAI;YACF,IAAI,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE;AACzC,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,iCAAiC,EAAE,EAAE;YACjF;AAEA,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,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,OAAO,EAAE,OAAO,EAAE,KA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1,49 @@
|
|
|
1
|
+
import { AXPSystemStatusType, runtimeQuerySuccessCollection, 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 { RootConfig } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
/**
|
|
9
|
+
* Returns timesheet periods awaiting approval for the approval inbox.
|
|
10
|
+
*/
|
|
11
|
+
class AXMApprovalInboxQuery {
|
|
12
|
+
constructor() {
|
|
13
|
+
//#region ---- Services & Dependencies ----
|
|
14
|
+
this.entityService = inject(AXPEntityService);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region ---- Query Execution ----
|
|
18
|
+
async fetch(input) {
|
|
19
|
+
try {
|
|
20
|
+
const opts = input ?? {};
|
|
21
|
+
const periodAccessor = this.entityService
|
|
22
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
23
|
+
.data();
|
|
24
|
+
const result = await periodAccessor.query({
|
|
25
|
+
skip: opts.skip ?? 0,
|
|
26
|
+
take: opts.take ?? 50,
|
|
27
|
+
sort: [{ field: 'submittedAt', dir: 'desc' }],
|
|
28
|
+
filter: {
|
|
29
|
+
field: 'statusId',
|
|
30
|
+
operator: { type: 'equal' },
|
|
31
|
+
value: AXPSystemStatusType.WaitingApproval,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
return runtimeQuerySuccessCollection({ items: result.items, total: result.total });
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return runtimeQueryFailure(error instanceof Error ? error.message : 'Failed to load approval inbox.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMApprovalInboxQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
41
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMApprovalInboxQuery, providedIn: 'root' }); }
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMApprovalInboxQuery, decorators: [{
|
|
44
|
+
type: Injectable,
|
|
45
|
+
args: [{ providedIn: 'root' }]
|
|
46
|
+
}] });
|
|
47
|
+
|
|
48
|
+
export { AXMApprovalInboxQuery };
|
|
49
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-approval-inbox.query-Wyz_jjxb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-approval-inbox.query-Wyz_jjxb.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/reporting/queries/approval-inbox.query.ts"],"sourcesContent":["import { AXPQuery, type AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPSystemStatusType,\n runtimeQueryFailure,\n runtimeQuerySuccessCollection,\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 { RootConfig } 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 AXMApprovalInboxQueryInput {\n approverEmployeeId?: string;\n skip?: number;\n take?: number;\n}\n\n//#endregion\n\n/**\n * Returns timesheet periods awaiting approval for the approval inbox.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMApprovalInboxQuery\n implements AXPQuery<AXMApprovalInboxQueryInput, AXMTimesheetManagementTimesheetPeriodEntityModel>\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?: AXMApprovalInboxQueryInput | null,\n ): AXPQueryFetchResultPromise<AXMTimesheetManagementTimesheetPeriodEntityModel> {\n try {\n const opts = input ?? {};\n const periodAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)\n .data<string, AXMTimesheetManagementTimesheetPeriodEntityModel>();\n\n const result = await periodAccessor.query({\n skip: opts.skip ?? 0,\n take: opts.take ?? 50,\n sort: [{ field: 'submittedAt', dir: 'desc' }],\n filter: {\n field: 'statusId',\n operator: { type: 'equal' },\n value: AXPSystemStatusType.WaitingApproval,\n },\n });\n\n return runtimeQuerySuccessCollection({ items: result.items, total: result.total });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Failed to load approval inbox.',\n );\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;AAqBA;AAEA;;AAEG;MAEU,qBAAqB,CAAA;AADlC,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAmC1D,IAAA;;;IA7BC,MAAM,KAAK,CACT,KAAyC,EAAA;AAEzC,QAAA,IAAI;AACF,YAAA,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;AACxB,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;AAEnE,YAAA,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC;AACxC,gBAAA,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;AACpB,gBAAA,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;gBACrB,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAC7C,gBAAA,MAAM,EAAE;AACN,oBAAA,KAAK,EAAE,UAAU;AACjB,oBAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;oBAC3B,KAAK,EAAE,mBAAmB,CAAC,eAAe;AAC3C,iBAAA;AACF,aAAA,CAAC;AAEF,YAAA,OAAO,6BAA6B,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QACpF;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,mBAAmB,CACxB,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,gCAAgC,CAC1E;QACH;IACF;8GArCW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArB,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,qBAAqB,cADR,MAAM,EAAA,CAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
3
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
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
|
+
* Approves a timesheet period that is awaiting approval.
|
|
12
|
+
*/
|
|
13
|
+
class ApproveTimesheetPeriodCommand {
|
|
14
|
+
constructor() {
|
|
15
|
+
//#region ---- Services & Dependencies ----
|
|
16
|
+
this.entityService = inject(AXPEntityService);
|
|
17
|
+
this.validationService = inject(AXMTimesheetValidationService);
|
|
18
|
+
this.sessionService = inject(AXPSessionService);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ---- Command Implementation ----
|
|
22
|
+
async execute(input) {
|
|
23
|
+
try {
|
|
24
|
+
const dataAccessor = this.entityService
|
|
25
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timesheetPeriod.name)
|
|
26
|
+
.data();
|
|
27
|
+
const period = await dataAccessor.byKey(input.id);
|
|
28
|
+
if (!period) {
|
|
29
|
+
return { success: false, message: { text: 'Timesheet period not found.' } };
|
|
30
|
+
}
|
|
31
|
+
this.validationService.assertCanApprove(period);
|
|
32
|
+
await dataAccessor.update(input.id, {
|
|
33
|
+
statusId: AXPSystemStatusType.Approved,
|
|
34
|
+
approvedAt: new Date().toISOString(),
|
|
35
|
+
approvedById: this.sessionService.user?.id,
|
|
36
|
+
});
|
|
37
|
+
return { success: true, kind: 'object', data: undefined };
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : 'Failed to approve timesheet period.';
|
|
41
|
+
console.error('[ApproveTimesheetPeriodCommand] Error:', error);
|
|
42
|
+
return { success: false, message: { text: message } };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ApproveTimesheetPeriodCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
46
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ApproveTimesheetPeriodCommand, providedIn: 'root' }); }
|
|
47
|
+
}
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ApproveTimesheetPeriodCommand, decorators: [{
|
|
49
|
+
type: Injectable,
|
|
50
|
+
args: [{ providedIn: 'root' }]
|
|
51
|
+
}] });
|
|
52
|
+
|
|
53
|
+
export { ApproveTimesheetPeriodCommand };
|
|
54
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-DlAeGANo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-approve-timesheet-period.command-DlAeGANo.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/timesheet-period/commands/approve-timesheet-period.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\n\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 ApproveTimesheetPeriodInput {\n id: string;\n note?: string;\n}\n\n//#endregion\n\n/**\n * Approves a timesheet period that is awaiting approval.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApproveTimesheetPeriodCommand implements AXPCommand<ApproveTimesheetPeriodInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly validationService = inject(AXMTimesheetValidationService);\n private readonly sessionService = inject(AXPSessionService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: ApproveTimesheetPeriodInput): 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.assertCanApprove(period);\n\n await dataAccessor.update(input.id, {\n statusId: AXPSystemStatusType.Approved,\n approvedAt: new Date().toISOString(),\n approvedById: this.sessionService.user?.id,\n });\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to approve timesheet period.';\n console.error('[ApproveTimesheetPeriodCommand] Error:', error);\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;AAkBA;AAEA;;AAEG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,6BAA6B,CAAC;AACzD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAkC5D,IAAA;;;IA5BC,MAAM,OAAO,CAAC,KAAkC,EAAA;AAC9C,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,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,OA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
|
1
|
+
import { runtimeQuerySuccessObject, runtimeQueryFailure } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { RootConfig } from '@acorex-platform/module-attendance-management-client/contracts';
|
|
3
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
6
|
+
import { defaultTo } from 'lodash';
|
|
7
|
+
import { RootConfig as RootConfig$1 } from '@acorex-platform/module-timesheet-management-client/contracts';
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ---- Query ----
|
|
11
|
+
/**
|
|
12
|
+
* Read-only reconciliation query comparing attendance worked time vs logged timesheet hours.
|
|
13
|
+
*/
|
|
14
|
+
class AXMCompareAttendanceVsTimesheetQuery {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.entityService = inject(AXPEntityService);
|
|
17
|
+
}
|
|
18
|
+
async fetch(input) {
|
|
19
|
+
try {
|
|
20
|
+
const threshold = defaultTo(input.varianceThresholdSeconds, 1800);
|
|
21
|
+
const summaryAccessor = this.entityService
|
|
22
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.attendanceDailySummary.name)
|
|
23
|
+
.data();
|
|
24
|
+
const entryAccessor = this.entityService
|
|
25
|
+
.withEntity(RootConfig$1.module.name, RootConfig$1.entities.timeEntry.name)
|
|
26
|
+
.data();
|
|
27
|
+
const dateRangeFilters = [
|
|
28
|
+
{ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },
|
|
29
|
+
{ field: 'workDate', operator: { type: 'gte' }, value: input.fromDate },
|
|
30
|
+
{ field: 'workDate', operator: { type: 'lte' }, value: input.toDate },
|
|
31
|
+
];
|
|
32
|
+
const entryDateRangeFilters = [
|
|
33
|
+
{ field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },
|
|
34
|
+
{ field: 'entryDate', operator: { type: 'gte' }, value: input.fromDate },
|
|
35
|
+
{ field: 'entryDate', operator: { type: 'lte' }, value: input.toDate },
|
|
36
|
+
];
|
|
37
|
+
const summaries = await summaryAccessor.query({
|
|
38
|
+
skip: 0,
|
|
39
|
+
take: 1000,
|
|
40
|
+
filter: { logic: 'and', filters: dateRangeFilters },
|
|
41
|
+
});
|
|
42
|
+
const entries = await entryAccessor.query({
|
|
43
|
+
skip: 0,
|
|
44
|
+
take: 5000,
|
|
45
|
+
filter: { logic: 'and', filters: entryDateRangeFilters },
|
|
46
|
+
});
|
|
47
|
+
const attendanceByDate = new Map();
|
|
48
|
+
for (const row of summaries.items) {
|
|
49
|
+
const date = row.workDate?.slice(0, 10);
|
|
50
|
+
if (date) {
|
|
51
|
+
attendanceByDate.set(date, defaultTo(row.workedSeconds, 0));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const timesheetByDate = new Map();
|
|
55
|
+
for (const row of entries.items) {
|
|
56
|
+
const date = row.entryDate?.slice(0, 10);
|
|
57
|
+
if (date) {
|
|
58
|
+
timesheetByDate.set(date, defaultTo(timesheetByDate.get(date), 0) + defaultTo(row.durationSeconds, 0));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const dates = new Set([...attendanceByDate.keys(), ...timesheetByDate.keys()]);
|
|
62
|
+
const rows = [...dates]
|
|
63
|
+
.sort()
|
|
64
|
+
.map((date) => {
|
|
65
|
+
const attendanceWorkedSeconds = defaultTo(attendanceByDate.get(date), 0);
|
|
66
|
+
const timesheetLoggedSeconds = defaultTo(timesheetByDate.get(date), 0);
|
|
67
|
+
const varianceSeconds = Math.abs(attendanceWorkedSeconds - timesheetLoggedSeconds);
|
|
68
|
+
return {
|
|
69
|
+
date,
|
|
70
|
+
attendanceWorkedSeconds,
|
|
71
|
+
timesheetLoggedSeconds,
|
|
72
|
+
varianceSeconds,
|
|
73
|
+
exceedsThreshold: varianceSeconds > threshold,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
return runtimeQuerySuccessObject({ rows });
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return runtimeQueryFailure(error instanceof Error ? error.message : 'Failed to compare attendance vs timesheet.');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMCompareAttendanceVsTimesheetQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
83
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMCompareAttendanceVsTimesheetQuery, providedIn: 'root' }); }
|
|
84
|
+
}
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMCompareAttendanceVsTimesheetQuery, decorators: [{
|
|
86
|
+
type: Injectable,
|
|
87
|
+
args: [{ providedIn: 'root' }]
|
|
88
|
+
}] });
|
|
89
|
+
|
|
90
|
+
export { AXMCompareAttendanceVsTimesheetQuery };
|
|
91
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-compare-attendance-vs-timesheet.query-ZZym5nSx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-compare-attendance-vs-timesheet.query-ZZym5nSx.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/reporting/queries/compare-attendance-vs-timesheet.query.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { 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 { RootConfig as AttendanceRootConfig } from '@acorex-platform/module-attendance-management-client/contracts';\nimport type { AXMAttendanceManagementAttendanceDailySummaryEntityModel } from '@acorex-platform/module-attendance-management-client/contracts';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo } 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//#endregion\n\n//#region ---- Types ----\n\nexport interface AXMCompareAttendanceVsTimesheetQueryInput {\n employeeId: string;\n fromDate: string;\n toDate: string;\n varianceThresholdSeconds?: number;\n}\n\nexport interface AXMCompareAttendanceVsTimesheetRow {\n date: string;\n attendanceWorkedSeconds: number;\n timesheetLoggedSeconds: number;\n varianceSeconds: number;\n exceedsThreshold: boolean;\n}\n\nexport interface AXMCompareAttendanceVsTimesheetQueryResult {\n rows: AXMCompareAttendanceVsTimesheetRow[];\n}\n\n//#endregion\n\n//#region ---- Query ----\n\n/**\n * Read-only reconciliation query comparing attendance worked time vs logged timesheet hours.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMCompareAttendanceVsTimesheetQuery\n implements AXPQuery<AXMCompareAttendanceVsTimesheetQueryInput, AXMCompareAttendanceVsTimesheetQueryResult>\n{\n private readonly entityService = inject(AXPEntityService);\n\n async fetch(\n input: AXMCompareAttendanceVsTimesheetQueryInput,\n ): AXPQueryFetchResultPromise<AXMCompareAttendanceVsTimesheetQueryResult> {\n try {\n const threshold = defaultTo(input.varianceThresholdSeconds, 1800);\n const summaryAccessor = this.entityService\n .withEntity(AttendanceRootConfig.module.name, AttendanceRootConfig.entities.attendanceDailySummary.name)\n .data<string, AXMAttendanceManagementAttendanceDailySummaryEntityModel>();\n const entryAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const dateRangeFilters: AXDataSourceFilterOption[] = [\n { field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },\n { field: 'workDate', operator: { type: 'gte' }, value: input.fromDate },\n { field: 'workDate', operator: { type: 'lte' }, value: input.toDate },\n ];\n\n const entryDateRangeFilters: AXDataSourceFilterOption[] = [\n { field: 'employeeId', operator: { type: 'equal' }, value: input.employeeId },\n { field: 'entryDate', operator: { type: 'gte' }, value: input.fromDate },\n { field: 'entryDate', operator: { type: 'lte' }, value: input.toDate },\n ];\n\n const summaries = await summaryAccessor.query({\n skip: 0,\n take: 1000,\n filter: { logic: 'and', filters: dateRangeFilters },\n });\n\n const entries = await entryAccessor.query({\n skip: 0,\n take: 5000,\n filter: { logic: 'and', filters: entryDateRangeFilters },\n });\n\n const attendanceByDate = new Map<string, number>();\n for (const row of summaries.items) {\n const date = row.workDate?.slice(0, 10);\n if (date) {\n attendanceByDate.set(date, defaultTo(row.workedSeconds, 0));\n }\n }\n\n const timesheetByDate = new Map<string, number>();\n for (const row of entries.items) {\n const date = row.entryDate?.slice(0, 10);\n if (date) {\n timesheetByDate.set(date, defaultTo(timesheetByDate.get(date), 0) + defaultTo(row.durationSeconds, 0));\n }\n }\n\n const dates = new Set([...attendanceByDate.keys(), ...timesheetByDate.keys()]);\n const rows: AXMCompareAttendanceVsTimesheetRow[] = [...dates]\n .sort()\n .map((date) => {\n const attendanceWorkedSeconds = defaultTo(attendanceByDate.get(date), 0);\n const timesheetLoggedSeconds = defaultTo(timesheetByDate.get(date), 0);\n const varianceSeconds = Math.abs(attendanceWorkedSeconds - timesheetLoggedSeconds);\n return {\n date,\n attendanceWorkedSeconds,\n timesheetLoggedSeconds,\n varianceSeconds,\n exceedsThreshold: varianceSeconds > threshold,\n };\n });\n\n return runtimeQuerySuccessObject({ rows });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Failed to compare attendance vs timesheet.',\n );\n }\n }\n}\n\n//#endregion\n"],"names":["AttendanceRootConfig","RootConfig"],"mappings":";;;;;;;;AAyCA;AAEA;AAEA;;AAEG;MAEU,oCAAoC,CAAA;AADjD,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,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ADvB,MAAM,EAAA,CAAA,CAAA;;2FACnB,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBADhD,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
|
|
3
|
+
//#region ---- Module Config ----
|
|
4
|
+
const config = {
|
|
5
|
+
i18n: 'timesheet-management',
|
|
6
|
+
module: 'TimesheetManagement',
|
|
7
|
+
route: 'timesheet-management',
|
|
8
|
+
};
|
|
9
|
+
const RootConfig = {
|
|
10
|
+
config,
|
|
11
|
+
module: {
|
|
12
|
+
name: config.module,
|
|
13
|
+
route: config.route,
|
|
14
|
+
title: `@${config.i18n}:module.title`,
|
|
15
|
+
icon: 'fa-light fa-clock',
|
|
16
|
+
},
|
|
17
|
+
entities: {
|
|
18
|
+
workItem: {
|
|
19
|
+
name: 'WorkItem',
|
|
20
|
+
source: `${config.module}.WorkItem`,
|
|
21
|
+
title: `@${config.i18n}:work-items.entities.work-item.title`,
|
|
22
|
+
titlePlural: `@${config.i18n}:work-items.entities.work-item.plural`,
|
|
23
|
+
icon: 'fa-light fa-list-check',
|
|
24
|
+
},
|
|
25
|
+
timesheetPeriod: {
|
|
26
|
+
name: 'TimesheetPeriod',
|
|
27
|
+
source: `${config.module}.TimesheetPeriod`,
|
|
28
|
+
title: `@${config.i18n}:timesheet-periods.entities.timesheet-period.title`,
|
|
29
|
+
titlePlural: `@${config.i18n}:timesheet-periods.entities.timesheet-period.plural`,
|
|
30
|
+
icon: 'fa-light fa-calendar-week',
|
|
31
|
+
},
|
|
32
|
+
timeEntry: {
|
|
33
|
+
name: 'TimeEntry',
|
|
34
|
+
source: `${config.module}.TimeEntry`,
|
|
35
|
+
title: `@${config.i18n}:time-entries.entities.time-entry.title`,
|
|
36
|
+
titlePlural: `@${config.i18n}:time-entries.entities.time-entry.plural`,
|
|
37
|
+
icon: 'fa-light fa-hourglass-half',
|
|
38
|
+
},
|
|
39
|
+
timesheetCorrection: {
|
|
40
|
+
name: 'TimesheetCorrection',
|
|
41
|
+
source: `${config.module}.TimesheetCorrection`,
|
|
42
|
+
title: `@${config.i18n}:timesheet-corrections.entities.timesheet-correction.title`,
|
|
43
|
+
titlePlural: `@${config.i18n}:timesheet-corrections.entities.timesheet-correction.plural`,
|
|
44
|
+
icon: 'fa-light fa-pen-to-square',
|
|
45
|
+
},
|
|
46
|
+
timesheetPolicy: {
|
|
47
|
+
name: 'TimesheetPolicy',
|
|
48
|
+
source: `${config.module}.TimesheetPolicy`,
|
|
49
|
+
title: `@${config.i18n}:timesheet-policies.entities.timesheet-policy.title`,
|
|
50
|
+
titlePlural: `@${config.i18n}:timesheet-policies.entities.timesheet-policy.plural`,
|
|
51
|
+
icon: 'fa-light fa-sliders',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
pages: {
|
|
55
|
+
myTimesheet: {
|
|
56
|
+
path: 'my-timesheet',
|
|
57
|
+
title: `@${config.i18n}:pages.my-timesheet.title`,
|
|
58
|
+
icon: 'fa-light fa-calendar-week',
|
|
59
|
+
},
|
|
60
|
+
approvalInbox: {
|
|
61
|
+
path: 'approval-inbox',
|
|
62
|
+
title: `@${config.i18n}:pages.approval-inbox.title`,
|
|
63
|
+
icon: 'fa-light fa-inbox',
|
|
64
|
+
},
|
|
65
|
+
teamTimesheets: {
|
|
66
|
+
path: 'team-timesheets',
|
|
67
|
+
title: `@${config.i18n}:pages.team-timesheets.title`,
|
|
68
|
+
icon: 'fa-light fa-users',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Projects & Work capabilities used by this module.
|
|
76
|
+
* Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).
|
|
77
|
+
*/
|
|
78
|
+
const AXPProjectsWorkPermissionKeys = {
|
|
79
|
+
Access: 'ProjectsWork:Permission:Access',
|
|
80
|
+
MaintainProjects: 'ProjectsWork:Permission:MaintainProjects',
|
|
81
|
+
MaintainTasks: 'ProjectsWork:Permission:MaintainTasks',
|
|
82
|
+
ViewAllTasks: 'ProjectsWork:Permission:ViewAllTasks',
|
|
83
|
+
MaintainTimesheets: 'ProjectsWork:Permission:MaintainTimesheets',
|
|
84
|
+
ManageTimesheetActions: 'ProjectsWork:Permission:ManageTimesheetActions',
|
|
85
|
+
ViewTimesheetReports: 'ProjectsWork:Permission:ViewTimesheetReports',
|
|
86
|
+
Setup: 'ProjectsWork:Permission:Setup',
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Prefer {@link AXPProjectsWorkPermissionKeys}.
|
|
90
|
+
* Legacy nested shape kept so existing imports compile during migration.
|
|
91
|
+
*/
|
|
92
|
+
const AXMTimesheetManagementPermissions = {
|
|
93
|
+
TimesheetManagement: {
|
|
94
|
+
WorkItem: {
|
|
95
|
+
Management: AXPProjectsWorkPermissionKeys.Setup,
|
|
96
|
+
View: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
97
|
+
Create: AXPProjectsWorkPermissionKeys.Setup,
|
|
98
|
+
Update: AXPProjectsWorkPermissionKeys.Setup,
|
|
99
|
+
Delete: AXPProjectsWorkPermissionKeys.Setup,
|
|
100
|
+
},
|
|
101
|
+
TimesheetPeriod: {
|
|
102
|
+
Management: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
103
|
+
View: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
104
|
+
Create: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
105
|
+
Update: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
106
|
+
Delete: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
107
|
+
TeamView: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,
|
|
108
|
+
Approve: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,
|
|
109
|
+
AdminAdjust: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,
|
|
110
|
+
},
|
|
111
|
+
TimeEntry: {
|
|
112
|
+
Management: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
113
|
+
View: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
114
|
+
Create: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
115
|
+
Update: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
116
|
+
Delete: AXPProjectsWorkPermissionKeys.MaintainTimesheets,
|
|
117
|
+
},
|
|
118
|
+
TimesheetCorrection: {
|
|
119
|
+
Management: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,
|
|
120
|
+
View: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,
|
|
121
|
+
Approve: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,
|
|
122
|
+
},
|
|
123
|
+
TimesheetPolicy: {
|
|
124
|
+
Management: AXPProjectsWorkPermissionKeys.Setup,
|
|
125
|
+
View: AXPProjectsWorkPermissionKeys.Setup,
|
|
126
|
+
},
|
|
127
|
+
TimesheetReport: {
|
|
128
|
+
View: AXPProjectsWorkPermissionKeys.ViewTimesheetReports,
|
|
129
|
+
Export: AXPProjectsWorkPermissionKeys.ViewTimesheetReports,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
//#region ---- Menu Keys ----
|
|
135
|
+
const AXMTimesheetManagementMenuKeys = {
|
|
136
|
+
Root: 'TimesheetManagement:Menu',
|
|
137
|
+
MyTimesheet: 'TimesheetManagement:Menu:MyTimesheet',
|
|
138
|
+
PeriodHistory: 'TimesheetManagement:Menu:PeriodHistory',
|
|
139
|
+
ApprovalInbox: 'TimesheetManagement:Menu:ApprovalInbox',
|
|
140
|
+
TeamTimesheets: 'TimesheetManagement:Menu:TeamTimesheets',
|
|
141
|
+
WorkItems: 'TimesheetManagement:Menu:WorkItems',
|
|
142
|
+
Reports: 'TimesheetManagement:Menu:Reports',
|
|
143
|
+
Configuration: 'TimesheetManagement:Menu:Configuration',
|
|
144
|
+
Policies: 'TimesheetManagement:Menu:Policies',
|
|
145
|
+
};
|
|
146
|
+
//#endregion
|
|
147
|
+
|
|
148
|
+
//#region ---- Feature Keys ----
|
|
149
|
+
const AXMTimesheetManagementFeatureKeys = {
|
|
150
|
+
TimesheetEntry: 'TimesheetManagement:Feature:Timesheet.Entry',
|
|
151
|
+
TimesheetApproval: 'TimesheetManagement:Feature:Timesheet.Approval',
|
|
152
|
+
TimesheetReporting: 'TimesheetManagement:Feature:Timesheet.Reporting',
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
155
|
+
|
|
156
|
+
//#region ---- Command Keys ----
|
|
157
|
+
const AXMTimesheetManagementCommandKeys = {
|
|
158
|
+
WorkItemResolveFromJira: 'TimesheetManagement.WorkItem:ResolveFromJiraIssue',
|
|
159
|
+
TimeEntryCreate: 'TimesheetManagement.TimeEntry:Create',
|
|
160
|
+
TimeEntryUpdate: 'TimesheetManagement.TimeEntry:Update',
|
|
161
|
+
TimeEntryDelete: 'TimesheetManagement.TimeEntry:Delete',
|
|
162
|
+
TimesheetPeriodSubmit: 'TimesheetManagement.TimesheetPeriod:Submit',
|
|
163
|
+
TimesheetPeriodApprove: 'TimesheetManagement.TimesheetPeriod:Approve',
|
|
164
|
+
TimesheetPeriodReject: 'TimesheetManagement.TimesheetPeriod:Reject',
|
|
165
|
+
TimesheetPeriodReopen: 'TimesheetManagement.TimesheetPeriod:Reopen',
|
|
166
|
+
TimesheetPeriodLock: 'TimesheetManagement.TimesheetPeriod:Lock',
|
|
167
|
+
TimesheetPeriodAdminAdjust: 'TimesheetManagement.TimesheetPeriod:AdminAdjust',
|
|
168
|
+
};
|
|
169
|
+
//#endregion
|
|
170
|
+
|
|
171
|
+
//#region ---- Timesheet period open statuses ----
|
|
172
|
+
/** Statuses that block creating another open period for the same employee and date range. */
|
|
173
|
+
const AXMTimesheetPeriodOpenStatusIds = [
|
|
174
|
+
AXPSystemStatusType.Draft,
|
|
175
|
+
AXPSystemStatusType.WaitingApproval,
|
|
176
|
+
];
|
|
177
|
+
/** Statuses where time entries cannot be edited. */
|
|
178
|
+
const AXMTimesheetPeriodLockedStatusId = 'locked';
|
|
179
|
+
const AXMTimesheetPeriodLockedStatusIds = [
|
|
180
|
+
AXPSystemStatusType.Approved,
|
|
181
|
+
AXMTimesheetPeriodLockedStatusId,
|
|
182
|
+
];
|
|
183
|
+
//#endregion
|
|
184
|
+
|
|
185
|
+
//#endregion
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
192
|
+
|
|
193
|
+
//#endregion
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Generated bundle index. Do not edit.
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
export { AXMTimesheetManagementCommandKeys, AXMTimesheetManagementFeatureKeys, AXMTimesheetManagementMenuKeys, AXMTimesheetManagementPermissions, AXMTimesheetPeriodLockedStatusId, AXMTimesheetPeriodLockedStatusIds, AXMTimesheetPeriodOpenStatusIds, AXPProjectsWorkPermissionKeys, RootConfig };
|
|
200
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-contracts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-contracts.mjs","sources":["../../../../libs/modules/timesheet-management/contracts/src/root-config.ts","../../../../libs/modules/timesheet-management/contracts/src/permission.keys.ts","../../../../libs/modules/timesheet-management/contracts/src/menu.keys.ts","../../../../libs/modules/timesheet-management/contracts/src/features.keys.ts","../../../../libs/modules/timesheet-management/contracts/src/commands.keys.ts","../../../../libs/modules/timesheet-management/contracts/src/timesheet-period-status.constants.ts","../../../../libs/modules/timesheet-management/contracts/src/entities/time-entry/time-entry.types.ts","../../../../libs/modules/timesheet-management/contracts/src/entities/timesheet-correction/timesheet-correction.types.ts","../../../../libs/modules/timesheet-management/contracts/src/entities/timesheet-period/timesheet-period.types.ts","../../../../libs/modules/timesheet-management/contracts/src/entities/timesheet-policy/timesheet-policy.types.ts","../../../../libs/modules/timesheet-management/contracts/src/entities/work-item/work-item.types.ts","../../../../libs/modules/timesheet-management/contracts/src/acorex-platform-module-timesheet-management-client-contracts.ts"],"sourcesContent":["//#region ---- Module Config ----\n\nconst config = {\n i18n: 'timesheet-management',\n module: 'TimesheetManagement',\n route: 'timesheet-management',\n};\n\nexport const RootConfig = {\n config,\n module: {\n name: config.module,\n route: config.route,\n title: `@${config.i18n}:module.title`,\n icon: 'fa-light fa-clock',\n },\n entities: {\n workItem: {\n name: 'WorkItem',\n source: `${config.module}.WorkItem`,\n title: `@${config.i18n}:work-items.entities.work-item.title`,\n titlePlural: `@${config.i18n}:work-items.entities.work-item.plural`,\n icon: 'fa-light fa-list-check',\n },\n timesheetPeriod: {\n name: 'TimesheetPeriod',\n source: `${config.module}.TimesheetPeriod`,\n title: `@${config.i18n}:timesheet-periods.entities.timesheet-period.title`,\n titlePlural: `@${config.i18n}:timesheet-periods.entities.timesheet-period.plural`,\n icon: 'fa-light fa-calendar-week',\n },\n timeEntry: {\n name: 'TimeEntry',\n source: `${config.module}.TimeEntry`,\n title: `@${config.i18n}:time-entries.entities.time-entry.title`,\n titlePlural: `@${config.i18n}:time-entries.entities.time-entry.plural`,\n icon: 'fa-light fa-hourglass-half',\n },\n timesheetCorrection: {\n name: 'TimesheetCorrection',\n source: `${config.module}.TimesheetCorrection`,\n title: `@${config.i18n}:timesheet-corrections.entities.timesheet-correction.title`,\n titlePlural: `@${config.i18n}:timesheet-corrections.entities.timesheet-correction.plural`,\n icon: 'fa-light fa-pen-to-square',\n },\n timesheetPolicy: {\n name: 'TimesheetPolicy',\n source: `${config.module}.TimesheetPolicy`,\n title: `@${config.i18n}:timesheet-policies.entities.timesheet-policy.title`,\n titlePlural: `@${config.i18n}:timesheet-policies.entities.timesheet-policy.plural`,\n icon: 'fa-light fa-sliders',\n },\n },\n pages: {\n myTimesheet: {\n path: 'my-timesheet',\n title: `@${config.i18n}:pages.my-timesheet.title`,\n icon: 'fa-light fa-calendar-week',\n },\n approvalInbox: {\n path: 'approval-inbox',\n title: `@${config.i18n}:pages.approval-inbox.title`,\n icon: 'fa-light fa-inbox',\n },\n teamTimesheets: {\n path: 'team-timesheets',\n title: `@${config.i18n}:pages.team-timesheets.title`,\n icon: 'fa-light fa-users',\n },\n },\n};\n\n//#endregion\n","/**\n * Projects & Work capabilities used by this module.\n * Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).\n */\nexport const AXPProjectsWorkPermissionKeys = {\n Access: 'ProjectsWork:Permission:Access',\n MaintainProjects: 'ProjectsWork:Permission:MaintainProjects',\n MaintainTasks: 'ProjectsWork:Permission:MaintainTasks',\n ViewAllTasks: 'ProjectsWork:Permission:ViewAllTasks',\n MaintainTimesheets: 'ProjectsWork:Permission:MaintainTimesheets',\n ManageTimesheetActions: 'ProjectsWork:Permission:ManageTimesheetActions',\n ViewTimesheetReports: 'ProjectsWork:Permission:ViewTimesheetReports',\n Setup: 'ProjectsWork:Permission:Setup',\n} as const;\n\n/**\n * @deprecated Prefer {@link AXPProjectsWorkPermissionKeys}.\n * Legacy nested shape kept so existing imports compile during migration.\n */\nexport const AXMTimesheetManagementPermissions = {\n TimesheetManagement: {\n WorkItem: {\n Management: AXPProjectsWorkPermissionKeys.Setup,\n View: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n Create: AXPProjectsWorkPermissionKeys.Setup,\n Update: AXPProjectsWorkPermissionKeys.Setup,\n Delete: AXPProjectsWorkPermissionKeys.Setup,\n },\n TimesheetPeriod: {\n Management: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n View: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n Create: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n Update: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n Delete: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n TeamView: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,\n Approve: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,\n AdminAdjust: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,\n },\n TimeEntry: {\n Management: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n View: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n Create: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n Update: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n Delete: AXPProjectsWorkPermissionKeys.MaintainTimesheets,\n },\n TimesheetCorrection: {\n Management: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,\n View: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,\n Approve: AXPProjectsWorkPermissionKeys.ManageTimesheetActions,\n },\n TimesheetPolicy: {\n Management: AXPProjectsWorkPermissionKeys.Setup,\n View: AXPProjectsWorkPermissionKeys.Setup,\n },\n TimesheetReport: {\n View: AXPProjectsWorkPermissionKeys.ViewTimesheetReports,\n Export: AXPProjectsWorkPermissionKeys.ViewTimesheetReports,\n },\n },\n} as const;\n","//#region ---- Menu Keys ----\n\nexport const AXMTimesheetManagementMenuKeys = {\n Root: 'TimesheetManagement:Menu',\n MyTimesheet: 'TimesheetManagement:Menu:MyTimesheet',\n PeriodHistory: 'TimesheetManagement:Menu:PeriodHistory',\n ApprovalInbox: 'TimesheetManagement:Menu:ApprovalInbox',\n TeamTimesheets: 'TimesheetManagement:Menu:TeamTimesheets',\n WorkItems: 'TimesheetManagement:Menu:WorkItems',\n Reports: 'TimesheetManagement:Menu:Reports',\n Configuration: 'TimesheetManagement:Menu:Configuration',\n Policies: 'TimesheetManagement:Menu:Policies',\n};\n\n//#endregion\n","//#region ---- Feature Keys ----\n\nexport const AXMTimesheetManagementFeatureKeys = {\n TimesheetEntry: 'TimesheetManagement:Feature:Timesheet.Entry',\n TimesheetApproval: 'TimesheetManagement:Feature:Timesheet.Approval',\n TimesheetReporting: 'TimesheetManagement:Feature:Timesheet.Reporting',\n};\n\n//#endregion\n","//#region ---- Command Keys ----\n\nexport const AXMTimesheetManagementCommandKeys = {\n WorkItemResolveFromJira: 'TimesheetManagement.WorkItem:ResolveFromJiraIssue',\n TimeEntryCreate: 'TimesheetManagement.TimeEntry:Create',\n TimeEntryUpdate: 'TimesheetManagement.TimeEntry:Update',\n TimeEntryDelete: 'TimesheetManagement.TimeEntry:Delete',\n TimesheetPeriodSubmit: 'TimesheetManagement.TimesheetPeriod:Submit',\n TimesheetPeriodApprove: 'TimesheetManagement.TimesheetPeriod:Approve',\n TimesheetPeriodReject: 'TimesheetManagement.TimesheetPeriod:Reject',\n TimesheetPeriodReopen: 'TimesheetManagement.TimesheetPeriod:Reopen',\n TimesheetPeriodLock: 'TimesheetManagement.TimesheetPeriod:Lock',\n TimesheetPeriodAdminAdjust: 'TimesheetManagement.TimesheetPeriod:AdminAdjust',\n};\n\n//#endregion\n","import { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\n\n//#region ---- Timesheet period open statuses ----\n\n/** Statuses that block creating another open period for the same employee and date range. */\nexport const AXMTimesheetPeriodOpenStatusIds = [\n AXPSystemStatusType.Draft,\n AXPSystemStatusType.WaitingApproval,\n] as const;\n\n/** Statuses where time entries cannot be edited. */\nexport const AXMTimesheetPeriodLockedStatusId = 'locked' as const;\n\nexport const AXMTimesheetPeriodLockedStatusIds = [\n AXPSystemStatusType.Approved,\n AXMTimesheetPeriodLockedStatusId,\n] as const;\n\n//#endregion\n","import type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMTimesheetWorkItemSnapshot } from '../work-item/work-item.types';\n\n//#region ---- Time Entry Types ----\n\nexport interface AXMTimesheetManagementTimeEntryEntityModel extends AXPEntityModel<string> {\n employeeId: string;\n employee?: { id: string; employeeCode?: string; person?: { fullName?: string } };\n periodId: string;\n period?: { id: string; startDate?: string; endDate?: string; statusId?: string };\n workItemId: string;\n workItem?: { id: string; code?: string; title?: string };\n projectId?: string;\n project?: { id: string; title?: string };\n startedAt?: string;\n endedAt?: string;\n durationSeconds: number;\n description?: string;\n isBillable: boolean;\n entryDate: string;\n timezone: string;\n workItemSnapshot?: AXMTimesheetWorkItemSnapshot;\n}\n\n//#endregion\n","import type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\n\n//#region ---- Timesheet Correction Types ----\n\nexport type AXMTimesheetCorrectionStatusId =\n | typeof AXPSystemStatusType.WaitingApproval\n | typeof AXPSystemStatusType.Approved\n | typeof AXPSystemStatusType.Rejected;\n\nexport interface AXMTimesheetCorrectionChange {\n timeEntryId: string;\n field: string;\n oldValue: unknown;\n newValue: unknown;\n}\n\nexport interface AXMTimesheetManagementTimesheetCorrectionEntityModel extends AXPEntityModel<string> {\n periodId: string;\n period?: { id: string; startDate?: string; endDate?: string };\n requestedById: string;\n reason: string;\n statusId: AXMTimesheetCorrectionStatusId;\n changes: AXMTimesheetCorrectionChange[];\n reviewedById?: string;\n reviewedAt?: string;\n}\n\n//#endregion\n","import type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\n\n//#region ---- Timesheet Period Types ----\n\nexport type AXMTimesheetPeriodType = 'Weekly' | 'Biweekly' | 'Monthly';\n\nexport type AXMTimesheetPeriodStatusId =\n | typeof AXPSystemStatusType.Draft\n | typeof AXPSystemStatusType.WaitingApproval\n | typeof AXPSystemStatusType.Approved\n | typeof AXPSystemStatusType.Rejected\n | 'locked';\n\nexport interface AXMTimesheetManagementTimesheetPeriodEntityModel extends AXPEntityModel<string> {\n employeeId: string;\n employee?: { id: string; employeeCode?: string; person?: { fullName?: string } };\n periodType: AXMTimesheetPeriodType;\n startDate: string;\n endDate: string;\n statusId: AXMTimesheetPeriodStatusId;\n submittedAt?: string;\n approvedAt?: string;\n approvedById?: string;\n rejectedAt?: string;\n rejectionReason?: string;\n lockedAt?: string;\n totalSeconds?: number;\n timezone: string;\n}\n\n//#endregion\n","import type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMTimesheetPeriodType } from '../timesheet-period/timesheet-period.types';\n\n//#region ---- Timesheet Policy Types ----\n\nexport type AXMTimesheetOverlapPolicy = 'reject' | 'warn';\n\nexport interface AXMTimesheetManagementTimesheetPolicyEntityModel extends AXPEntityModel<string> {\n name: string;\n maxDailyHours?: number;\n maxWeeklyHours?: number;\n requireDescription: boolean;\n allowFutureDates: boolean;\n overlapPolicy: AXMTimesheetOverlapPolicy;\n periodTypeDefault: AXMTimesheetPeriodType;\n isDefault: boolean;\n}\n\n//#endregion\n","import type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#region ---- Work Item Types ----\n\nexport type AXMTimesheetWorkItemSourceType = 'Internal' | 'Jira' | 'Task';\n\nexport interface AXMTimesheetWorkItemSourceRef {\n system: 'internal' | 'jira' | 'task';\n jiraInstanceId?: string;\n jiraIssueId?: string;\n jiraIssueKey?: string;\n taskId?: string;\n internalCode?: string;\n}\n\nexport interface AXMTimesheetWorkItemSnapshot {\n title: string;\n subtitle?: string;\n projectKey?: string;\n statusName?: string;\n capturedAt: string;\n}\n\nexport interface AXMTimesheetManagementWorkItemEntityModel extends AXPEntityModel<string> {\n code: string;\n title: AXPMultiLanguageString;\n sourceType: AXMTimesheetWorkItemSourceType;\n sourceRef?: AXMTimesheetWorkItemSourceRef;\n snapshot?: AXMTimesheetWorkItemSnapshot;\n isBillableDefault: boolean;\n isActive: boolean;\n employeeId?: string;\n employee?: { id: string; employeeCode?: string; person?: { fullName?: string } };\n projectId?: string;\n project?: { id: string; title?: string };\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;AAEA,MAAM,MAAM,GAAG;AACb,IAAA,IAAI,EAAE,sBAAsB;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AAE,4CAA4C;AACnE,IAAA,sBAAsB,EAAE,6CAA6C;AACrE,IAAA,qBAAqB,EAAE,4CAA4C;AACnE,IAAA,qBAAqB,EAAE,4CAA4C;AACnE,IAAA,mBAAmB,EAAE,0CAA0C;AAC/D,IAAA,0BAA0B,EAAE,iDAAiD;;AAG/E;;ACbA;AAEA;AACO,MAAM,+BAA+B,GAAG;AAC7C,IAAA,mBAAmB,CAAC,KAAK;AACzB,IAAA,mBAAmB,CAAC,eAAe;;AAGrC;AACO,MAAM,gCAAgC,GAAG;AAEzC,MAAM,iCAAiC,GAAG;AAC/C,IAAA,mBAAmB,CAAC,QAAQ;IAC5B,gCAAgC;;AAGlC;;ACMA;;ACIA;;ACGA;;ACbA;;ACoBA;;ACtCA;;AAEG;;;;"}
|
|
@@ -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
|
+
* Creates a time entry after validating the parent timesheet period is editable.
|
|
10
|
+
*/
|
|
11
|
+
class CreateTimeEntryCommand {
|
|
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
|
+
await this.assertPeriodEditable(input.periodId);
|
|
22
|
+
const dataAccessor = this.entityService
|
|
23
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)
|
|
24
|
+
.data();
|
|
25
|
+
const id = await dataAccessor.create(input);
|
|
26
|
+
const entity = await dataAccessor.byKey(id);
|
|
27
|
+
if (!entity) {
|
|
28
|
+
return { success: false, message: { text: 'Time entry not found after creation.' } };
|
|
29
|
+
}
|
|
30
|
+
return { success: true, kind: 'object', data: entity };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const message = error instanceof Error ? error.message : 'Failed to create time entry.';
|
|
34
|
+
console.error('[CreateTimeEntryCommand] 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: CreateTimeEntryCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
51
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CreateTimeEntryCommand, providedIn: 'root' }); }
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CreateTimeEntryCommand, decorators: [{
|
|
54
|
+
type: Injectable,
|
|
55
|
+
args: [{ providedIn: 'root' }]
|
|
56
|
+
}] });
|
|
57
|
+
|
|
58
|
+
export { CreateTimeEntryCommand };
|
|
59
|
+
//# sourceMappingURL=acorex-platform-module-timesheet-management-client-create-time-entry.command-DS2EVLym.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-timesheet-management-client-create-time-entry.command-DS2EVLym.mjs","sources":["../../../../libs/modules/timesheet-management/client/src/lib/features/time-entry/commands/create-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 type CreateTimeEntryInput = Omit<AXMTimesheetManagementTimeEntryEntityModel, 'id'>;\n\n//#endregion\n\n/**\n * Creates a time entry after validating the parent timesheet period is editable.\n */\n@Injectable({ providedIn: 'root' })\nexport class CreateTimeEntryCommand implements AXPCommand<CreateTimeEntryInput, AXMTimesheetManagementTimeEntryEntityModel> {\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(\n input: CreateTimeEntryInput,\n ): AXPCommandExecuteResultPromise<AXMTimesheetManagementTimeEntryEntityModel> {\n try {\n await this.assertPeriodEditable(input.periodId);\n\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.timeEntry.name)\n .data<string, AXMTimesheetManagementTimeEntryEntityModel>();\n\n const id = await dataAccessor.create(input);\n const entity = await dataAccessor.byKey(id);\n if (!entity) {\n return { success: false, message: { text: 'Time entry not found after creation.' } };\n }\n\n return { success: true, kind: 'object', data: entity };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to create time entry.';\n console.error('[CreateTimeEntryCommand] 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":";;;;;;AAcA;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;AA+C3E,IAAA;;;IAzCC,MAAM,OAAO,CACX,KAA2B,EAAA;AAE3B,QAAA,IAAI;YACF,MAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC;AAE/C,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,EAAE,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,sC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