taxtank-core 0.32.2 → 0.32.5
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/esm2022/lib/collections/vehicle/best-vehicle-logbook.collection.mjs +39 -44
- package/esm2022/lib/collections/vehicle/vehicle-logbook.collection.mjs +9 -32
- package/esm2022/lib/models/financial-year/financial-year.mjs +4 -2
- package/esm2022/lib/models/vehicle/vehicle-logbook.mjs +9 -8
- package/esm2022/lib/services/http/vehicle/vehicle-claim.service.mjs +4 -23
- package/fesm2022/taxtank-core.mjs +60 -102
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/lib/collections/vehicle/best-vehicle-logbook.collection.d.ts +10 -12
- package/lib/collections/vehicle/vehicle-logbook.collection.d.ts +3 -16
- package/lib/models/financial-year/financial-year.d.ts +1 -1
- package/lib/models/vehicle/vehicle-logbook.d.ts +0 -2
- package/lib/services/http/vehicle/vehicle-claim.service.d.ts +3 -9
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VehicleLogbook } from '../../models';
|
|
2
2
|
import { VehicleLogbookCollection } from './vehicle-logbook.collection';
|
|
3
3
|
import { DateRange } from 'moment-range';
|
|
4
4
|
/**
|
|
@@ -6,7 +6,6 @@ import { DateRange } from 'moment-range';
|
|
|
6
6
|
* Docs: https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
|
|
7
7
|
*/
|
|
8
8
|
export declare class BestVehicleLogbookCollection extends VehicleLogbookCollection {
|
|
9
|
-
private isSole;
|
|
10
9
|
/**
|
|
11
10
|
* Logbook claimable period duration in milliseconds.
|
|
12
11
|
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
|
|
@@ -24,8 +23,14 @@ export declare class BestVehicleLogbookCollection extends VehicleLogbookCollecti
|
|
|
24
23
|
/**
|
|
25
24
|
* Best period may be calculated only when user has logbooks minimum for VehicleLogbook.bestPeriodWeeks
|
|
26
25
|
*/
|
|
27
|
-
isBestPeriodExist(logbooks
|
|
28
|
-
|
|
26
|
+
static isBestPeriodExist(logbooks: VehicleLogbookCollection): boolean;
|
|
27
|
+
static getPeriods(logbooks: VehicleLogbookCollection): DateRange[];
|
|
28
|
+
/**
|
|
29
|
+
* Get claimable date range for passed logbook
|
|
30
|
+
* @param logbook logbook instance for range calculation
|
|
31
|
+
* @param isBackward Flag false - range for logbook + duration; flag true - range for logbook - duration. Used for extra case, when we should add an extra date range for the last logbook
|
|
32
|
+
*/
|
|
33
|
+
static getPeriodByLogbook(logbook: VehicleLogbook, isBackward?: boolean): DateRange;
|
|
29
34
|
/**
|
|
30
35
|
* Set Date Range with the biggest work usage percent
|
|
31
36
|
* Range duration is defined as BestVehicleLogbookCollection.periodDuration by the ATO
|
|
@@ -39,12 +44,5 @@ export declare class BestVehicleLogbookCollection extends VehicleLogbookCollecti
|
|
|
39
44
|
* Find and return range with the biggest workUsage percent.
|
|
40
45
|
*/
|
|
41
46
|
private calculateBestPeriod;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Get claimable date range for passed logbook
|
|
45
|
-
* @param logbook logbook instance for range calculation
|
|
46
|
-
* @param isBackward Flag false - range for logbook + duration; flag true - range for logbook - duration. Used for extra case, when we should add an extra date range for the last logbook
|
|
47
|
-
*/
|
|
48
|
-
private getPeriodByLogbook;
|
|
49
|
-
static fromLogbooks(logbooks: VehicleLogbookCollection, isSole?: boolean): BestVehicleLogbookCollection | null;
|
|
47
|
+
static fromLogbooks(logbooks: VehicleLogbookCollection): BestVehicleLogbookCollection | null;
|
|
50
48
|
}
|
|
@@ -2,27 +2,14 @@ import { Collection } from '../collection';
|
|
|
2
2
|
import { VehicleClaim, VehicleLogbook } from '../../models';
|
|
3
3
|
import { BestVehicleLogbookCollection } from './best-vehicle-logbook.collection';
|
|
4
4
|
export declare class VehicleLogbookCollection extends Collection<VehicleLogbook> {
|
|
5
|
-
/**
|
|
6
|
-
* Get collection of non-personal logbooks (work-related, sole-related).
|
|
7
|
-
* @TODO Vik: Best period: move this and related logic to backend
|
|
8
|
-
*/
|
|
9
|
-
getClaimableLogbooks(isSole?: boolean): this;
|
|
10
5
|
/**
|
|
11
6
|
* Calculate total kilometers traveled
|
|
12
7
|
*/
|
|
13
8
|
get kilometers(): number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @TODO Alex: TT-2089 replace with getter
|
|
17
|
-
*/
|
|
18
|
-
get workUsage(): number;
|
|
19
|
-
getWorkUsageByTank(isSole: boolean): number;
|
|
20
|
-
/**
|
|
21
|
-
* Get list of logbooks related to passed vehicle claim
|
|
22
|
-
*/
|
|
23
|
-
getByVehicleClaim(vehicleClaim: VehicleClaim): this;
|
|
9
|
+
getWorkUsage(vehicleClaim?: VehicleClaim): number;
|
|
10
|
+
getClaimable(vehicleClaim?: VehicleClaim): this;
|
|
24
11
|
/**
|
|
25
12
|
* get collection of logbooks with the biggest work usage for {@link BestVehicleLogbookCollection.periodDuration}
|
|
26
13
|
*/
|
|
27
|
-
getBest(
|
|
14
|
+
getBest(): BestVehicleLogbookCollection | null;
|
|
28
15
|
}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { VehicleClaim as VehicleClaimBase } from '../../../db/Models/vehicle/vehicle-claim';
|
|
2
2
|
import { VehicleClaim } from '../../../models';
|
|
3
3
|
import { RestService } from '../rest/rest-old.service';
|
|
4
|
-
import { IEventListener } from '../../../interfaces';
|
|
5
4
|
import { Observable } from 'rxjs';
|
|
6
5
|
import { UserRolesEnum } from '../../../db/Enums/user-roles.enum';
|
|
6
|
+
import { BestVehicleLogbookCollection } from '../../../collections';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
|
-
export declare class VehicleClaimService extends RestService<VehicleClaimBase, VehicleClaim>
|
|
8
|
+
export declare class VehicleClaimService extends RestService<VehicleClaimBase, VehicleClaim> {
|
|
9
9
|
modelClass: typeof VehicleClaim;
|
|
10
10
|
url: string;
|
|
11
11
|
roles: UserRolesEnum[];
|
|
12
|
-
listenEvents(): void;
|
|
13
12
|
add(model: VehicleClaim): Observable<VehicleClaim>;
|
|
14
13
|
update(model: VehicleClaim, queryParams?: object): Observable<VehicleClaim>;
|
|
15
|
-
/**
|
|
16
|
-
* Details changes may affect vehicle claims:
|
|
17
|
-
* when details method changed, all claims current values become 0
|
|
18
|
-
*/
|
|
19
|
-
private listenVehicleClaimDetailsChanges;
|
|
20
14
|
/**
|
|
21
15
|
* Update workUsage for all vehicle claims if logbook best period changed
|
|
22
16
|
* @TODO Vik: Best period move this and related logic to backend
|
|
23
17
|
*/
|
|
24
|
-
|
|
18
|
+
updateWorkUsage(bestLogbooks: BestVehicleLogbookCollection): Observable<VehicleClaim[]>;
|
|
25
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<VehicleClaimService, never>;
|
|
26
20
|
static ɵprov: i0.ɵɵInjectableDeclaration<VehicleClaimService>;
|
|
27
21
|
}
|