taxtank-core 0.27.0 → 0.27.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/bundles/taxtank-core.umd.js +598 -284
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/depreciation.collection.js +10 -9
  4. package/esm2015/lib/db/Enums/depreciation-calculation.enum.js +2 -2
  5. package/esm2015/lib/db/Enums/sole-depreciation-method.enum.js +6 -0
  6. package/esm2015/lib/db/Models/sole/sole-business-activity.js +4 -0
  7. package/esm2015/lib/db/Models/sole/sole-business.js +1 -1
  8. package/esm2015/lib/db/Models/sole/sole-depreciation-method.js +4 -0
  9. package/esm2015/lib/db/Models/sole/sole-details.js +1 -1
  10. package/esm2015/lib/forms/sole/index.js +2 -1
  11. package/esm2015/lib/forms/sole/sole-business.form.js +3 -3
  12. package/esm2015/lib/forms/sole/sole-depreciation-method.form.js +10 -0
  13. package/esm2015/lib/models/depreciation/depreciation-group.enum.js +2 -1
  14. package/esm2015/lib/models/depreciation/depreciation-groups.const.js +7 -2
  15. package/esm2015/lib/models/depreciation/depreciation.js +32 -25
  16. package/esm2015/lib/models/endpoint/endpoints.const.js +8 -4
  17. package/esm2015/lib/models/event/app-event-type.enum.js +47 -42
  18. package/esm2015/lib/models/report/depreciation/depreciation-report-item.js +2 -2
  19. package/esm2015/lib/models/report/my-tax/my-tax-deductions/my-tax-deductions.js +2 -2
  20. package/esm2015/lib/models/sole/index.js +3 -1
  21. package/esm2015/lib/models/sole/sole-business-activity.js +4 -0
  22. package/esm2015/lib/models/sole/sole-business.js +10 -2
  23. package/esm2015/lib/models/sole/sole-depreciation-method.js +8 -0
  24. package/esm2015/lib/services/http/depreciation/depreciation-receipt/depreciation-receipt.service.js +40 -0
  25. package/esm2015/lib/services/http/depreciation/depreciation.service.js +79 -22
  26. package/esm2015/lib/services/http/depreciation/index.js +4 -0
  27. package/esm2015/lib/services/http/property/property.service.js +8 -1
  28. package/esm2015/lib/services/http/receipt/receipt.service.js +76 -0
  29. package/esm2015/lib/services/http/sole/index.js +3 -1
  30. package/esm2015/lib/services/http/sole/sole-business-activity/sole-business-activity.service.js +21 -0
  31. package/esm2015/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.js +62 -0
  32. package/esm2015/lib/services/http/transaction/transaction-receipt/transaction-receipt.service.js +20 -50
  33. package/esm2015/lib/services/http/transaction/transaction.service.js +12 -11
  34. package/esm2015/public-api.js +3 -3
  35. package/fesm2015/taxtank-core.js +502 -245
  36. package/fesm2015/taxtank-core.js.map +1 -1
  37. package/lib/collections/depreciation.collection.d.ts +2 -1
  38. package/lib/db/Enums/depreciation-calculation.enum.d.ts +2 -2
  39. package/lib/db/Enums/sole-depreciation-method.enum.d.ts +4 -0
  40. package/lib/db/Models/sole/sole-business-activity.d.ts +6 -0
  41. package/lib/db/Models/sole/sole-business.d.ts +2 -1
  42. package/lib/db/Models/sole/sole-depreciation-method.d.ts +10 -0
  43. package/lib/forms/sole/index.d.ts +1 -0
  44. package/lib/forms/sole/sole-business.form.d.ts +1 -1
  45. package/lib/forms/sole/sole-depreciation-method.form.d.ts +5 -0
  46. package/lib/models/depreciation/depreciation-group.enum.d.ts +2 -1
  47. package/lib/models/depreciation/depreciation.d.ts +9 -16
  48. package/lib/models/event/app-event-type.enum.d.ts +46 -41
  49. package/lib/models/sole/index.d.ts +2 -0
  50. package/lib/models/sole/sole-business-activity.d.ts +3 -0
  51. package/lib/models/sole/sole-business.d.ts +7 -1
  52. package/lib/models/sole/sole-depreciation-method.d.ts +4 -0
  53. package/lib/services/http/depreciation/depreciation-receipt/depreciation-receipt.service.d.ts +28 -0
  54. package/lib/services/http/depreciation/depreciation.service.d.ts +23 -7
  55. package/lib/services/http/depreciation/index.d.ts +3 -0
  56. package/lib/services/http/property/property.service.d.ts +1 -0
  57. package/lib/services/http/receipt/receipt.service.d.ts +62 -0
  58. package/lib/services/http/sole/index.d.ts +2 -0
  59. package/lib/services/http/sole/sole-business-activity/sole-business-activity.service.d.ts +11 -0
  60. package/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.d.ts +23 -0
  61. package/lib/services/http/transaction/transaction-receipt/transaction-receipt.service.d.ts +21 -21
  62. package/lib/services/http/transaction/transaction.service.d.ts +1 -0
  63. package/package.json +1 -1
  64. package/public-api.d.ts +2 -2
@@ -26,7 +26,8 @@ export declare class DepreciationCollection extends Collection<Depreciation> {
26
26
  getCapitalDepreciations(): this;
27
27
  getBorrowingExpenseDepreciations(): DepreciationCollection;
28
28
  getWrittenOffDepreciations(): DepreciationCollection;
29
- getLowValuePoolDepreciations(): DepreciationCollection;
29
+ getLVPDepreciations(): this;
30
+ getSBPDepreciations(): this;
30
31
  getCapitalProjects(): DepreciationCapitalProject[];
31
32
  /**
32
33
  * Get a new collection of depreciations related to vehicles
@@ -1,7 +1,7 @@
1
1
  export declare enum DepreciationCalculationEnum {
2
2
  PRIME_COST = 1,
3
3
  DIMINISHING = 2,
4
- CAPITAL = 3,
5
4
  LVP = 4,
6
- AMORTISATION = 5
5
+ AMORTISATION = 5,
6
+ SBP = 6
7
7
  }
@@ -0,0 +1,4 @@
1
+ export declare enum SoleDepreciationMethodEnum {
2
+ SBP = 1,
3
+ DEPRECIATION = 2
4
+ }
@@ -0,0 +1,6 @@
1
+ import { AbstractModel } from '../abstract-model';
2
+ export declare class SoleBusinessActivity extends AbstractModel {
3
+ name?: string;
4
+ code?: number;
5
+ id?: number;
6
+ }
@@ -8,15 +8,16 @@ import { Transaction } from '../transaction/transaction';
8
8
  import { Depreciation } from '../depreciation/depreciation';
9
9
  import { AbstractModel } from '../abstract-model';
10
10
  import { VehicleLogbook } from '../vehicle/vehicle-logbook';
11
+ import { SoleBusinessActivity } from './sole-business-activity';
11
12
  export declare class SoleBusiness extends AbstractModel {
12
13
  name?: string;
13
- code?: string;
14
14
  description?: string;
15
15
  website?: string;
16
16
  logo?: string;
17
17
  id?: number;
18
18
  deletedAt?: Date;
19
19
  user?: User;
20
+ activity?: SoleBusinessActivity;
20
21
  allocations?: SoleBusinessAllocation[];
21
22
  losses?: SoleBusinessLoss[];
22
23
  invoices?: SoleInvoice[];
@@ -0,0 +1,10 @@
1
+ import { User } from '../user/user';
2
+ import { SoleDepreciationMethodEnum } from '../../Enums/sole-depreciation-method.enum';
3
+ import { AbstractModel } from '../abstract-model';
4
+ export declare class SoleDepreciationMethod extends AbstractModel {
5
+ method?: SoleDepreciationMethodEnum;
6
+ closeBalance?: number;
7
+ id?: number;
8
+ financialYear?: number;
9
+ user?: User;
10
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './sole-business.form';
2
2
  export * from './sole-business-allocations.form';
3
3
  export * from './sole-contact.form';
4
+ export * from './sole-depreciation-method.form';
4
5
  export * from './sole-details.form';
5
6
  export * from './sole-invoice-template.form';
@@ -1,5 +1,5 @@
1
1
  import { AbstractForm } from '../abstract.form';
2
- import { SoleBusiness } from '../../models/sole/sole-business';
2
+ import { SoleBusiness } from '../../models';
3
3
  export declare class SoleBusinessForm extends AbstractForm<SoleBusiness> {
4
4
  constructor(business?: SoleBusiness);
5
5
  }
@@ -0,0 +1,5 @@
1
+ import { AbstractForm } from '../abstract.form';
2
+ import { SoleDepreciationMethod } from '../../models';
3
+ export declare class SoleDepreciationMethodForm extends AbstractForm<SoleDepreciationMethod> {
4
+ constructor(soleDepreciationMethod: SoleDepreciationMethod);
5
+ }
@@ -3,5 +3,6 @@ export declare enum DepreciationGroupEnum {
3
3
  PLANT_EQUIPMENT = 1,
4
4
  LOW_VALUE_POOL = 2,
5
5
  WRITTEN_OFF_ITEMS = 3,
6
- BORROWING_EXPENSES = 4
6
+ BORROWING_EXPENSES = 4,
7
+ SMALL_BUSINESS_POOL = 5
7
8
  }
@@ -8,6 +8,9 @@ import { IReceipt } from '../../interfaces/receipt.interface';
8
8
  import { Transaction } from '../transaction/transaction';
9
9
  import { Expense } from '../../interfaces/expense.interface';
10
10
  import { DepreciationReceipt } from './depreciation-receipt';
11
+ /**
12
+ * @TODO Alex: clarify grouping rules and refactor
13
+ */
11
14
  export declare class Depreciation extends DepreciationBase implements Expense, IReceipt {
12
15
  static WRITTEN_OFF_THRESHOLD: number;
13
16
  static LOW_VALUE_POOL_THRESHOLD: number;
@@ -29,24 +32,14 @@ export declare class Depreciation extends DepreciationBase implements Expense, I
29
32
  isCapital(): boolean;
30
33
  isBorrowingExpense(): boolean;
31
34
  isAsset(): boolean;
32
- /**
33
- * check if depreciation should be displayed in written off category
34
- * details in project documentation
35
- * @TODO new FinancialYear(this.writeOffDate) === new FinancialYear()
36
- */
37
- isWrittenOff(): boolean;
38
- /**
39
- * Check if depreciation is Plant & Equipment
40
- */
41
- isPlantEquipment(): boolean;
42
- /**
43
- * check if depreciation should be displayed in low value pool
44
- * details in project documentation
45
- * @TODO new FinancialYear(this.writeOffDate) === new FinancialYear()
46
- */
47
- isLowValuePool(): boolean;
35
+ isSBPCalculation(): boolean;
48
36
  isPrimeCost(): boolean;
49
37
  isDiminishing(): boolean;
38
+ isPlantEquipmentPool(): boolean;
39
+ isLVP(): boolean;
40
+ isSBP(): boolean;
41
+ isWrittenOff(): boolean;
42
+ get writeOffYear(): number;
50
43
  /**
51
44
  * Check if depreciation chart accounts heading related to vehicles category
52
45
  */
@@ -13,45 +13,50 @@ export declare enum AppEventTypeEnum {
13
13
  CURRENT_USER_GET_FAILED = 11,
14
14
  DEPRECIATION_DELETED = 12,
15
15
  DEPRECIATIONS_CREATED = 13,
16
- INCOME_SOURCES_CREATED = 14,
17
- INCOME_SOURCES_UPDATED = 15,
18
- INCOME_SOURCES_FORECASTS_CREATED = 16,
19
- INCOME_SOURCES_FORECASTS_UPDATED = 17,
20
- LOAN_UPDATED = 18,
21
- LOAN_PAYOUT_UPDATED = 19,
22
- MESSAGE_CREATED = 20,
23
- MESSAGE_FILE_CREATED = 21,
24
- MESSAGE_FILE_DELETED = 22,
25
- NOTIFICATION_ADDED = 23,
26
- PROPERTY_UPDATED_WITH_DOCUMENT = 24,
27
- PROPERTY_DOCUMENT_ADDED = 25,
28
- PROPERTY_MOVEMENT_CREATED = 26,
29
- PROPERTY_MOVEMENT_UPDATED = 27,
30
- PROPERTY_MOVEMENT_DELETED = 28,
31
- PROPERTY_SHARE_UPDATED = 29,
32
- PROPERTY_SALE_ADDED = 30,
33
- PROPERTY_SALE_DELETED = 31,
34
- PROPERTY_SUBSCRIPTION_ADDED = 32,
35
- PROPERTY_SUBSCRIPTION_DELETED = 33,
36
- PROPERTY_VALUATION_DOCUMENT_CREATED = 34,
37
- SERVICE_SUBSCRIPTION_UPDATED = 35,
38
- TAX_REVIEW_UPDATED = 36,
39
- TRANSACTION_CREATED = 37,
40
- TRANSACTION_DELETED = 38,
41
- TRANSACTION_UPDATED = 39,
42
- TRANSACTION_CREATED_WITH_NEW_RECEIPT = 40,
43
- TRANSACTION_UPDATED_WITH_NEW_RECEIPT = 41,
44
- TRANSACTION_UPDATED_WITH_DELETED_RECEIPT = 42,
45
- TRANSACTION_RECEIPT_CREATED = 43,
46
- TRANSACTION_RECEIPT_DELETED = 44,
47
- TRANSACTIONS_CREATED = 45,
48
- USER_UPDATED = 46,
49
- VEHICLE_CLAIM_UPDATED = 47,
50
- VEHICLE_CLAIM_CREATED = 48,
51
- VEHICLE_CLAIM_DETAILS_UPDATED = 49,
52
- VEHICLE_CLAIM_DETAILS_CREATED = 50,
53
- VEHICLE_LOGBOOK_CREATED = 51,
54
- VEHICLE_LOGBOOK_UPDATED = 52,
55
- VEHICLE_LOGBOOK_DELETED = 53,
56
- VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 54
16
+ DEPRECIATION_UPDATED_WITH_RECEIPT = 14,
17
+ DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT = 15,
18
+ DEPRECIATION_RECEIPT_CREATED = 16,
19
+ DEPRECIATION_RECEIPT_DELETED = 17,
20
+ INCOME_SOURCES_CREATED = 18,
21
+ INCOME_SOURCES_UPDATED = 19,
22
+ INCOME_SOURCES_FORECASTS_CREATED = 20,
23
+ INCOME_SOURCES_FORECASTS_UPDATED = 21,
24
+ LOAN_UPDATED = 22,
25
+ LOAN_PAYOUT_UPDATED = 23,
26
+ MESSAGE_CREATED = 24,
27
+ MESSAGE_FILE_CREATED = 25,
28
+ MESSAGE_FILE_DELETED = 26,
29
+ NOTIFICATION_ADDED = 27,
30
+ PROPERTY_DEPRECIATION_CALCULATION_UPDATED = 28,
31
+ PROPERTY_UPDATED_WITH_DOCUMENT = 29,
32
+ PROPERTY_DOCUMENT_ADDED = 30,
33
+ PROPERTY_MOVEMENT_CREATED = 31,
34
+ PROPERTY_MOVEMENT_UPDATED = 32,
35
+ PROPERTY_MOVEMENT_DELETED = 33,
36
+ PROPERTY_SHARE_UPDATED = 34,
37
+ PROPERTY_SALE_ADDED = 35,
38
+ PROPERTY_SALE_DELETED = 36,
39
+ PROPERTY_SUBSCRIPTION_ADDED = 37,
40
+ PROPERTY_SUBSCRIPTION_DELETED = 38,
41
+ PROPERTY_VALUATION_DOCUMENT_CREATED = 39,
42
+ SERVICE_SUBSCRIPTION_UPDATED = 40,
43
+ SOLE_DEPRECIATION_METHOD_UPDATED = 41,
44
+ TAX_REVIEW_UPDATED = 42,
45
+ TRANSACTION_CREATED = 43,
46
+ TRANSACTION_DELETED = 44,
47
+ TRANSACTION_UPDATED = 45,
48
+ TRANSACTION_UPDATED_WITH_RECEIPT = 46,
49
+ TRANSACTION_UPDATED_WITH_DELETED_RECEIPT = 47,
50
+ TRANSACTION_RECEIPT_CREATED = 48,
51
+ TRANSACTION_RECEIPT_DELETED = 49,
52
+ TRANSACTIONS_CREATED = 50,
53
+ USER_UPDATED = 51,
54
+ VEHICLE_CLAIM_UPDATED = 52,
55
+ VEHICLE_CLAIM_CREATED = 53,
56
+ VEHICLE_CLAIM_DETAILS_UPDATED = 54,
57
+ VEHICLE_CLAIM_DETAILS_CREATED = 55,
58
+ VEHICLE_LOGBOOK_CREATED = 56,
59
+ VEHICLE_LOGBOOK_UPDATED = 57,
60
+ VEHICLE_LOGBOOK_DELETED = 58,
61
+ VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 59
57
62
  }
@@ -1,7 +1,9 @@
1
1
  export * from './sole-business';
2
+ export * from './sole-business-activity';
2
3
  export * from './sole-business-allocation';
3
4
  export * from './sole-business-loss';
4
5
  export * from './sole-contact';
6
+ export * from './sole-depreciation-method';
5
7
  export * from './sole-details';
6
8
  export * from './sole-invoice';
7
9
  export * from './sole-invoice-item';
@@ -0,0 +1,3 @@
1
+ import { SoleBusinessActivity as SoleBusinessActivityBase } from "../../db/Models/sole/sole-business-activity";
2
+ export declare class SoleBusinessActivity extends SoleBusinessActivityBase {
3
+ }
@@ -4,11 +4,16 @@ import { SoleBusinessAllocation } from './sole-business-allocation';
4
4
  import { SoleBusinessLoss } from './sole-business-loss';
5
5
  import { SoleInvoice } from './sole-invoice';
6
6
  import { SoleInvoiceTemplate } from './sole-invoice-template';
7
- import { VehicleClaim } from '../vehicle/vehicle-claim';
7
+ import { VehicleClaim } from '../vehicle';
8
8
  import { Depreciation } from '../depreciation/depreciation';
9
9
  import { Transaction } from '../transaction/transaction';
10
10
  import { Photoable } from '../../interfaces/photoable';
11
+ import { SoleBusinessActivity } from '../../db/Models/sole/sole-business-activity';
11
12
  export declare class SoleBusiness extends SoleBusinessBase implements Photoable {
13
+ /**
14
+ * Maximum number of businesses that a person can have, according to the ATO
15
+ */
16
+ static businessesLimit: number;
12
17
  user: User;
13
18
  allocations: SoleBusinessAllocation[];
14
19
  losses: SoleBusinessLoss[];
@@ -17,6 +22,7 @@ export declare class SoleBusiness extends SoleBusinessBase implements Photoable
17
22
  vehicleClaims: VehicleClaim[];
18
23
  transactions: Transaction[];
19
24
  depreciations: Depreciation[];
25
+ activity: SoleBusinessActivity;
20
26
  getPhotoPlaceholder(): string;
21
27
  getPhoto(): string;
22
28
  }
@@ -0,0 +1,4 @@
1
+ import { SoleDepreciationMethod as SoleDepreciationMethodBase } from '../../db/Models/sole/sole-depreciation-method';
2
+ export declare class SoleDepreciationMethod extends SoleDepreciationMethodBase {
3
+ isSBP(): boolean;
4
+ }
@@ -0,0 +1,28 @@
1
+ import { DepreciationReceipt as DepreciationReceiptBase } from '../../../../db/Models/depreciation/depreciation-receipt';
2
+ import { DepreciationReceipt } from '../../../../models/depreciation/depreciation-receipt';
3
+ import { AppEventTypeEnum } from '../../../../models/event/app-event-type.enum';
4
+ import { Depreciation } from '../../../../models/depreciation/depreciation';
5
+ import { ReceiptService } from '../../receipt/receipt.service';
6
+ import { AssetEntityTypeEnum } from '../../../../interfaces/asset-entity-type.enum';
7
+ import { HttpClient } from '@angular/common/http';
8
+ import { EventDispatcherService } from '../../../event/event-dispatcher.service';
9
+ import { ToastService } from '../../../toast/toast.service';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * @Todo TT-2191 refactor service when receipts API will be updated
13
+ */
14
+ export declare class DepreciationReceiptService extends ReceiptService<Depreciation, DepreciationReceiptBase, DepreciationReceipt> {
15
+ protected http: HttpClient;
16
+ protected eventDispatcherService: EventDispatcherService;
17
+ protected environment: any;
18
+ protected toastService: ToastService;
19
+ modelClass: typeof DepreciationReceipt;
20
+ entityType: AssetEntityTypeEnum;
21
+ receiptCreatedEvent: AppEventTypeEnum;
22
+ receiptDeletedEvent: AppEventTypeEnum;
23
+ entityUpdatedWithDeletedReceiptEvent: AppEventTypeEnum;
24
+ entityUpdatedWithReceiptEvent: AppEventTypeEnum;
25
+ constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService);
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<DepreciationReceiptService, never>;
27
+ static ɵprov: i0.ɵɵInjectableDeclaration<DepreciationReceiptService>;
28
+ }
@@ -2,11 +2,20 @@ import { Observable } from 'rxjs';
2
2
  import { Depreciation as DepreciationBase } from '../../../db/Models/depreciation/depreciation';
3
3
  import { RestService } from '../rest/rest.service';
4
4
  import { Depreciation } from '../../../models/depreciation/depreciation';
5
- import { IEventListener } from '../../../interfaces/event-listener.interface';
5
+ import { HttpClient } from '@angular/common/http';
6
+ import { EventDispatcherService } from '../../event/event-dispatcher.service';
7
+ import { ToastService } from '../../toast/toast.service';
8
+ import { DepreciationReceiptService } from './depreciation-receipt/depreciation-receipt.service';
6
9
  import * as i0 from "@angular/core";
7
- export declare class DepreciationService extends RestService<DepreciationBase, Depreciation> implements IEventListener {
10
+ export declare class DepreciationService extends RestService<DepreciationBase, Depreciation> {
11
+ protected http: HttpClient;
12
+ protected eventDispatcherService: EventDispatcherService;
13
+ protected environment: any;
14
+ protected toastService: ToastService;
15
+ private depreciationReceiptService;
8
16
  modelClass: typeof Depreciation;
9
17
  url: string;
18
+ constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService, depreciationReceiptService: DepreciationReceiptService);
10
19
  /**
11
20
  * Add a single depreciation
12
21
  * @TODO add auto-generation for events
@@ -17,16 +26,14 @@ export declare class DepreciationService extends RestService<DepreciationBase, D
17
26
  * @TODO add auto-generation for events
18
27
  */
19
28
  addBatch(depreciations: Depreciation[]): Observable<Depreciation[]>;
29
+ update(depreciation: Depreciation): Observable<Depreciation>;
20
30
  /**
21
31
  * Listen to Depreciations events
22
32
  */
23
33
  listenEvents(): void;
24
34
  getOpenBalance(depreciation: Depreciation): Observable<number>;
25
- /**
26
- * Upload depreciation receipt
27
- * @param depreciation for which will be uploaded receipt
28
- */
29
- uploadReceipt(depreciation: Depreciation): void;
35
+ private listenReceiptAdded;
36
+ private listenReceiptDeleted;
30
37
  /**
31
38
  * Listen to EventDispatcherService event related to updated bank loan
32
39
  */
@@ -39,6 +46,15 @@ export declare class DepreciationService extends RestService<DepreciationBase, D
39
46
  * Listen to EventDispatcherService event related to updated vehicle claim
40
47
  */
41
48
  private listenVehicleClaimChanges;
49
+ private replaceInCache;
50
+ /**
51
+ * @TODO Alex: create common method resetCacheOn(events: AppEventType[])
52
+ */
53
+ private listenSoleDepreciationMethodChanges;
54
+ /**
55
+ * @TODO Alex: create common method resetCacheOn(events: AppEventType[])
56
+ */
57
+ private listenPropertyDepreciationCalculationChanges;
42
58
  static ɵfac: i0.ɵɵFactoryDeclaration<DepreciationService, never>;
43
59
  static ɵprov: i0.ɵɵInjectableDeclaration<DepreciationService>;
44
60
  }
@@ -0,0 +1,3 @@
1
+ export * from './depreciation.service';
2
+ export * from './depreciation-capital-project/depreciation-capital-project.service';
3
+ export * from './depreciation-receipt/depreciation-receipt.service';
@@ -26,6 +26,7 @@ export declare class PropertyService extends RestService<PropertyBase, Property>
26
26
  private listenSalesAdded;
27
27
  private listenSalesDeleted;
28
28
  update(property: Property): Observable<Property>;
29
+ updateDepreciationCalculation(property: Property): Observable<Property>;
29
30
  getByCategoryId(id: number): Observable<Property[]>;
30
31
  /**
31
32
  * Activate deactivated property
@@ -0,0 +1,62 @@
1
+ import { Type } from '@angular/core';
2
+ import { AssetEntityTypeEnum } from '../../../interfaces/asset-entity-type.enum';
3
+ import { IEventListener } from '../../../interfaces/event-listener.interface';
4
+ import { Transaction } from '../../../models/transaction/transaction';
5
+ import { Depreciation } from '../../../models/depreciation/depreciation';
6
+ import { AppEventTypeEnum } from '../../../models/event/app-event-type.enum';
7
+ import { TransactionReceipt as TransactionReceiptBase } from '../../../db/Models/transaction/transaction-receipt';
8
+ import { DepreciationReceipt as DepreciationReceiptBase } from '../../../db/Models/depreciation/depreciation-receipt';
9
+ import { Observable } from 'rxjs';
10
+ import { HttpClient } from '@angular/common/http';
11
+ import { EventDispatcherService } from '../../event/event-dispatcher.service';
12
+ import { ToastService } from '../../toast/toast.service';
13
+ import * as i0 from "@angular/core";
14
+ /**
15
+ * Abstract service class to work with transactions-like receipt files (transactions, depreciations, e.t.c.)
16
+ * @Todo TT-2191 refactor service when receipts API will be updated
17
+ */
18
+ export declare abstract class ReceiptService<ParentModel extends Transaction | Depreciation, BaseModel extends TransactionReceiptBase | DepreciationReceiptBase, Model extends BaseModel> implements IEventListener {
19
+ protected http: HttpClient;
20
+ protected eventDispatcherService: EventDispatcherService;
21
+ protected environment: any;
22
+ protected toastService: ToastService;
23
+ /**
24
+ * Needed to fulfill endpoint to API
25
+ */
26
+ abstract entityType: AssetEntityTypeEnum;
27
+ abstract modelClass: Type<Model>;
28
+ /**
29
+ * Event type that will be dispatched when receipt will be uploaded
30
+ */
31
+ abstract receiptCreatedEvent: AppEventTypeEnum;
32
+ /**
33
+ * Event type that will be dispatched when receipt will be deleted
34
+ */
35
+ abstract receiptDeletedEvent: AppEventTypeEnum;
36
+ /**
37
+ * Event type that will be dispatched when parent entity (transaction-like class) will be updated with attached receipt
38
+ */
39
+ abstract entityUpdatedWithReceiptEvent: AppEventTypeEnum;
40
+ /**
41
+ * Event type that will be dispatched when parent entity (transaction-like class) will be updated with deleted receipt
42
+ */
43
+ abstract entityUpdatedWithDeletedReceiptEvent: AppEventTypeEnum;
44
+ protected constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService);
45
+ listenEvents(): void;
46
+ /**
47
+ * Entity is necessary to take the ID and the receipt file from it.
48
+ */
49
+ add(receiptEntity: ParentModel): Observable<Model>;
50
+ delete(receiptEntity: ParentModel): Observable<void>;
51
+ /**
52
+ * Parent entity was updated with attached receipt
53
+ */
54
+ private listenParentWithReceiptUpdated;
55
+ /**
56
+ * Parent entity was updated, but receipt was removed
57
+ */
58
+ private listenParentWithoutReceiptUpdated;
59
+ private createModelInstance;
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReceiptService<any, any, any>, never>;
61
+ static ɵprov: i0.ɵɵInjectableDeclaration<ReceiptService<any, any, any>>;
62
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './sole-business/sole-business.service';
2
+ export * from './sole-business-activity/sole-business-activity.service';
2
3
  export * from './sole-contact/sole-contact.service';
4
+ export * from './sole-depreciation-method/sole-depreciation-method.service';
3
5
  export * from './sole-details/sole-details.service';
4
6
  export * from './sole-invoice-template/sole-invoice-template.service';
@@ -0,0 +1,11 @@
1
+ import { RestService } from '../../rest/rest.service';
2
+ import { SoleBusinessActivity as SoleBusinessActivityBase } from '../../../../db/Models/sole/sole-business-activity';
3
+ import { SoleBusinessActivity } from '../../../../models';
4
+ import * as i0 from "@angular/core";
5
+ export declare class SoleBusinessActivityService extends RestService<SoleBusinessActivityBase, SoleBusinessActivity> {
6
+ modelClass: typeof SoleBusinessActivity;
7
+ url: string;
8
+ isHydra: boolean;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<SoleBusinessActivityService, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<SoleBusinessActivityService>;
11
+ }
@@ -0,0 +1,23 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { SoleDepreciationMethod } from '../../../../models';
3
+ import { Observable, ReplaySubject } from 'rxjs';
4
+ import { EventDispatcherService } from '../../../event/event-dispatcher.service';
5
+ import { ToastService } from '../../../toast/toast.service';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * @TODO Alex: extend rest service when refactored
9
+ */
10
+ export declare class SoleDepreciationMethodService {
11
+ private http;
12
+ private environment;
13
+ private eventDispatcherService;
14
+ private toastService;
15
+ cache: SoleDepreciationMethod;
16
+ cacheSubject: ReplaySubject<SoleDepreciationMethod>;
17
+ url: string;
18
+ constructor(http: HttpClient, environment: any, eventDispatcherService: EventDispatcherService, toastService: ToastService);
19
+ get(): Observable<SoleDepreciationMethod>;
20
+ update(soleDepreciationMethod: SoleDepreciationMethod): Observable<SoleDepreciationMethod>;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<SoleDepreciationMethodService, never>;
22
+ static ɵprov: i0.ɵɵInjectableDeclaration<SoleDepreciationMethodService>;
23
+ }
@@ -1,28 +1,28 @@
1
1
  import { Transaction } from '../../../../models/transaction/transaction';
2
+ import { AppEventTypeEnum } from '../../../../models/event/app-event-type.enum';
3
+ import { ReceiptService } from '../../receipt/receipt.service';
4
+ import { AssetEntityTypeEnum } from '../../../../interfaces/asset-entity-type.enum';
5
+ import { TransactionReceipt as TransactionReceiptBase } from '../../../../db/Models/transaction/transaction-receipt';
6
+ import { TransactionReceipt } from '../../../../models/transaction/transaction-receipt';
2
7
  import { HttpClient } from '@angular/common/http';
3
8
  import { EventDispatcherService } from '../../../event/event-dispatcher.service';
4
- import { IEventListener } from '../../../../interfaces/event-listener.interface';
9
+ import { ToastService } from '../../../toast/toast.service';
5
10
  import * as i0 from "@angular/core";
6
- export declare class TransactionReceiptService implements IEventListener {
7
- private http;
8
- private eventDispatcherService;
9
- private environment;
10
- url: string;
11
- constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any);
12
- /**
13
- * Transaction instance is necessary to take the ID and the receipt file from it.
14
- */
15
- add(transaction: Transaction): void;
16
- /**
17
- * Transaction instance is necessary to take the ID and the receipt ID from it.
18
- */
19
- delete(transaction: Transaction): void;
20
- listenEvents(): void;
21
- private listenTransactionWithReceiptUpdated;
22
- /**
23
- * Case when transaction was updated, but receipt was removed
24
- */
25
- private listenTransactionWithoutReceiptUpdated;
11
+ /**
12
+ * @Todo TT-2191 refactor service when receipts API will be updated
13
+ */
14
+ export declare class TransactionReceiptService extends ReceiptService<Transaction, TransactionReceiptBase, TransactionReceipt> {
15
+ protected http: HttpClient;
16
+ protected eventDispatcherService: EventDispatcherService;
17
+ protected environment: any;
18
+ protected toastService: ToastService;
19
+ modelClass: typeof TransactionReceipt;
20
+ entityType: AssetEntityTypeEnum;
21
+ receiptCreatedEvent: AppEventTypeEnum;
22
+ receiptDeletedEvent: AppEventTypeEnum;
23
+ entityUpdatedWithReceiptEvent: AppEventTypeEnum;
24
+ entityUpdatedWithDeletedReceiptEvent: AppEventTypeEnum;
25
+ constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService);
26
26
  static ɵfac: i0.ɵɵFactoryDeclaration<TransactionReceiptService, never>;
27
27
  static ɵprov: i0.ɵɵInjectableDeclaration<TransactionReceiptService>;
28
28
  }
@@ -93,6 +93,7 @@ export declare class TransactionService extends RestService<TransactionBase, Tra
93
93
  private listenReceiptAdded;
94
94
  private listenReceiptDeleted;
95
95
  private listenVehicleClaimChanges;
96
+ private replaceInCache;
96
97
  static ɵfac: i0.ɵɵFactoryDeclaration<TransactionService, never>;
97
98
  static ɵprov: i0.ɵɵInjectableDeclaration<TransactionService>;
98
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.27.0",
3
+ "version": "0.27.3",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^12.2.3 || ~13.0.0",
package/public-api.d.ts CHANGED
@@ -99,6 +99,7 @@ export * from './lib/db/Enums/registration-invite-status.enum';
99
99
  export * from './lib/db/Enums/salary-forecast-frequency.enum';
100
100
  export * from './lib/db/Enums/service-notification-status.enum';
101
101
  export * from './lib/db/Enums/service-notification-type.enum';
102
+ export * from './lib/db/Enums/sole-depreciation-method.enum';
102
103
  export * from './lib/db/Enums/subscription/service-payment-status.enum';
103
104
  export * from './lib/db/Enums/subscription/service-price-recurring-interval.enum';
104
105
  export * from './lib/db/Enums/subscription/service-price-type.enum';
@@ -314,8 +315,7 @@ export * from './lib/services/http/firm/client-invite/client-invite.service';
314
315
  export * from './lib/services/http/firm/client-movement/client-movement.service';
315
316
  export * from './lib/services/http/firm/portfolio-report/client-portfolio-report.service';
316
317
  export * from './lib/services/http/firm/portfolio-report/client-portfolio-report.service';
317
- export * from './lib/services/http/depreciation/depreciation-capital-project/depreciation-capital-project.service';
318
- export * from './lib/services/http/depreciation/depreciation.service';
318
+ export * from './lib/services/http/depreciation';
319
319
  export * from './lib/services/http/document/document-folder/document-folder.service';
320
320
  export * from './lib/services/http/firm/employee/employee.service';
321
321
  export * from './lib/services/http/firm/employee-invite/employee-invite.service';