taxtank-core 0.16.11 → 0.17.0

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 (73) hide show
  1. package/bundles/taxtank-core.umd.js +140 -218
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/bank-transaction.collection.js +1 -1
  4. package/esm2015/lib/collections/collection-dictionary.js +16 -1
  5. package/esm2015/lib/collections/depreciation.collection.js +2 -2
  6. package/esm2015/lib/collections/exportable.collection.js +17 -0
  7. package/esm2015/lib/collections/loan/loan-payment.collection.js +31 -0
  8. package/esm2015/lib/collections/loan/loan.collection.js +18 -0
  9. package/esm2015/lib/collections/report/property/property-report-item-transaction.collection.js +1 -1
  10. package/esm2015/lib/collections/report/vehicle-expense/vehicle-expense.collection.js +1 -1
  11. package/esm2015/lib/collections/transaction/transaction-allocation.collection.js +40 -0
  12. package/esm2015/lib/collections/transaction/transaction.collection.js +167 -0
  13. package/esm2015/lib/models/bank/bank-transaction.js +1 -1
  14. package/esm2015/lib/models/export/export-cell-type.enum.js +10 -0
  15. package/esm2015/lib/models/export/export-cell.js +6 -0
  16. package/esm2015/lib/models/export/export-data-table.js +1 -7
  17. package/esm2015/lib/models/income-source/income-source-chart-data.js +1 -1
  18. package/esm2015/lib/models/loan/loan-payment.js +2 -24
  19. package/esm2015/lib/models/logbook/vehicle-claim.js +1 -1
  20. package/esm2015/lib/models/property/property-equity-chart-data.js +1 -1
  21. package/esm2015/lib/models/report/property/property-report-item-transaction.js +1 -1
  22. package/esm2015/lib/models/transaction/transaction.js +1 -1
  23. package/esm2015/lib/services/account-setup/account-setup.service.js +2 -2
  24. package/esm2015/lib/services/bank/bank-account-calculation.service.js +1 -1
  25. package/esm2015/lib/services/bank/bank-transaction-calculation.service.js +1 -1
  26. package/esm2015/lib/services/export/export-formatter.service.js +31 -0
  27. package/esm2015/lib/services/http/bank/basiq/basiq.service.js +5 -79
  28. package/esm2015/lib/services/pdf/pdf.service.js +9 -4
  29. package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +1 -1
  30. package/esm2015/lib/services/report/property/property-transaction-report.service.js +2 -2
  31. package/esm2015/lib/services/transaction/transaction-calculation.service.js +2 -2
  32. package/esm2015/public-api.js +7 -10
  33. package/fesm2015/taxtank-core.js +121 -203
  34. package/fesm2015/taxtank-core.js.map +1 -1
  35. package/lib/collections/bank-transaction.collection.d.ts +1 -1
  36. package/lib/collections/collection-dictionary.d.ts +5 -0
  37. package/lib/collections/depreciation.collection.d.ts +1 -1
  38. package/lib/collections/exportable.collection.d.ts +9 -0
  39. package/lib/collections/loan/loan-payment.collection.d.ts +7 -0
  40. package/lib/collections/{loan.collection.d.ts → loan/loan.collection.d.ts} +2 -2
  41. package/lib/collections/report/property/property-report-item-transaction.collection.d.ts +1 -1
  42. package/lib/collections/report/vehicle-expense/vehicle-expense.collection.d.ts +1 -1
  43. package/lib/collections/{transaction-allocation.collection.d.ts → transaction/transaction-allocation.collection.d.ts} +6 -6
  44. package/lib/collections/{transaction.collection.d.ts → transaction/transaction.collection.d.ts} +9 -5
  45. package/lib/models/bank/bank-transaction.d.ts +1 -1
  46. package/lib/models/export/export-cell-type.enum.d.ts +8 -0
  47. package/lib/models/export/export-cell.d.ts +8 -0
  48. package/lib/models/export/export-data-table.d.ts +3 -2
  49. package/lib/models/income-source/income-source-chart-data.d.ts +1 -1
  50. package/lib/models/loan/loan-payment.d.ts +1 -5
  51. package/lib/models/logbook/vehicle-claim.d.ts +1 -1
  52. package/lib/models/property/property-equity-chart-data.d.ts +1 -1
  53. package/lib/models/report/property/property-report-item-transaction.d.ts +1 -1
  54. package/lib/models/transaction/transaction.d.ts +1 -1
  55. package/lib/services/bank/bank-account-calculation.service.d.ts +1 -1
  56. package/lib/services/bank/bank-transaction-calculation.service.d.ts +1 -1
  57. package/lib/services/export/export-formatter.service.d.ts +11 -0
  58. package/lib/services/http/bank/basiq/basiq.service.d.ts +2 -29
  59. package/lib/services/pdf/pdf.service.d.ts +3 -0
  60. package/lib/services/property/property-calculation/property-calculation.service.d.ts +2 -2
  61. package/lib/services/report/property/property-transaction-report.service.d.ts +1 -1
  62. package/lib/services/transaction/transaction-calculation.service.d.ts +2 -2
  63. package/package.json +1 -1
  64. package/public-api.d.ts +6 -9
  65. package/esm2015/lib/collections/loan.collection.js +0 -18
  66. package/esm2015/lib/collections/transaction-allocation.collection.js +0 -40
  67. package/esm2015/lib/collections/transaction.collection.js +0 -143
  68. package/esm2015/lib/interfaces/exportable.interface.js +0 -2
  69. package/esm2015/lib/services/data-table/data-table.service.js +0 -47
  70. package/esm2015/lib/services/property/property-holding-costs/property-holding-costs.service.js +0 -53
  71. package/lib/interfaces/exportable.interface.d.ts +0 -9
  72. package/lib/services/data-table/data-table.service.d.ts +0 -19
  73. package/lib/services/property/property-holding-costs/property-holding-costs.service.d.ts +0 -24
@@ -4,7 +4,7 @@ import { IncomeSource } from '../models/income-source/income-source';
4
4
  import { BankAccount } from '../models/bank/bank-account';
5
5
  import { Collection } from './collection';
6
6
  import { CollectionDictionary } from './collection-dictionary';
7
- import { TransactionAllocationCollection } from './transaction-allocation.collection';
7
+ import { TransactionAllocationCollection } from './transaction/transaction-allocation.collection';
8
8
  /**
9
9
  * Collection of bank transactions.
10
10
  * IMPORTANT: Create this collection based on bank transactions from TransactionAllocationService
@@ -40,6 +40,11 @@ export declare class CollectionDictionary<Collection extends BaseCollection<obje
40
40
  */
41
41
  createCollection(items?: object[]): Collection;
42
42
  length(): number;
43
+ /**
44
+ * @Todo find a better solution to get list of the sorted keys
45
+ * Get array of the "keys" by provided order
46
+ */
47
+ getSortedKeys(isDesc?: boolean): string[];
43
48
  /**
44
49
  * Group collection items by passed path into items object
45
50
  */
@@ -2,7 +2,7 @@ import { TankTypeEnum } from '../db/Enums/tank-type.enum';
2
2
  import { Collection } from './collection';
3
3
  import { Depreciation } from '../models/depreciation/depreciation';
4
4
  import { DepreciationCapitalProject } from '../models/depreciation/depreciation-capital-project';
5
- import { TransactionCollection } from './transaction.collection';
5
+ import { TransactionCollection } from './transaction/transaction.collection';
6
6
  import { ChartAccountsCategoryEnum } from '../db/Enums/chart-accounts-category.enum';
7
7
  export declare class DepreciationCollection extends Collection<Depreciation> {
8
8
  /**
@@ -0,0 +1,9 @@
1
+ import { Collection } from './collection';
2
+ import { ExportDataTable } from '../models/export/export-data-table';
3
+ import { ExportCell } from '../models/export/export-cell';
4
+ export declare abstract class ExportableCollection<Model extends object> extends Collection<Model> {
5
+ abstract getExportHeader(type?: string): string[];
6
+ abstract getExportBody(type?: string): ExportCell[][];
7
+ getExportFooter(type?: string): ExportCell[];
8
+ export(type?: string): ExportDataTable;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { ExportableCollection } from '../exportable.collection';
2
+ import { ExportCell } from '../../models/export/export-cell';
3
+ import { LoanPayment } from '../../models/loan/loan-payment';
4
+ export declare class LoanPaymentCollection extends ExportableCollection<LoanPayment> {
5
+ getExportHeader(): string[];
6
+ getExportBody(): ExportCell[][];
7
+ }
@@ -1,5 +1,5 @@
1
- import { Collection } from './collection';
2
- import { Loan } from '../models/loan/loan';
1
+ import { Collection } from '../collection';
2
+ import { Loan } from '../../models/loan/loan';
3
3
  export declare class LoanCollection extends Collection<Loan> {
4
4
  /**
5
5
  * Get new collection of loans filtered by bank accounts ids
@@ -1,5 +1,5 @@
1
1
  import { Collection } from '../../collection';
2
- import { TransactionCollection } from '../../transaction.collection';
2
+ import { TransactionCollection } from '../../transaction/transaction.collection';
3
3
  import { ChartAccounts } from '../../../models/chart-accounts/chart-accounts';
4
4
  import { PropertyReportItemCollection } from './property-report-item.collection';
5
5
  import { PropertyCollection } from '../../property/property.collection';
@@ -1,6 +1,6 @@
1
1
  import { Collection } from '../../collection';
2
2
  import { VehicleExpense } from '../../../models/report/vehicle-expense/vehicle-expense';
3
- import { TransactionCollection } from '../../transaction.collection';
3
+ import { TransactionCollection } from '../../transaction/transaction.collection';
4
4
  import { DepreciationCollection } from '../../depreciation.collection';
5
5
  import { VehicleClaim } from '../../../models/logbook/vehicle-claim';
6
6
  export declare class VehicleExpenseCollection extends Collection<VehicleExpense> {
@@ -1,9 +1,9 @@
1
- import { Collection } from './collection';
2
- import { TransactionAllocation } from '../models/transaction/transaction-allocation';
3
- import { BankTransactionCollection } from './bank-transaction.collection';
4
- import { CollectionDictionary } from './collection-dictionary';
5
- import { Transaction } from '../models/transaction/transaction';
6
- import { BankTransaction } from '../models/bank/bank-transaction';
1
+ import { Collection } from '../collection';
2
+ import { TransactionAllocation } from '../../models/transaction/transaction-allocation';
3
+ import { BankTransactionCollection } from '../bank-transaction.collection';
4
+ import { CollectionDictionary } from '../collection-dictionary';
5
+ import { Transaction } from '../../models/transaction/transaction';
6
+ import { BankTransaction } from '../../models/bank/bank-transaction';
7
7
  export declare class TransactionAllocationCollection extends Collection<TransactionAllocation> {
8
8
  get amount(): number;
9
9
  getByTransactionsIds(ids: number[]): TransactionAllocationCollection;
@@ -1,12 +1,13 @@
1
- import { Collection } from './collection';
2
- import { Transaction } from '../models/transaction/transaction';
1
+ import { Transaction } from '../../models/transaction/transaction';
3
2
  import { TransactionAllocationCollection } from './transaction-allocation.collection';
4
- import { ChartAccountsCategoryEnum } from '../db/Enums/chart-accounts-category.enum';
5
- import { TankTypeEnum } from '../db/Enums/tank-type.enum';
3
+ import { ChartAccountsCategoryEnum } from '../../db/Enums/chart-accounts-category.enum';
4
+ import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
5
+ import { ExportCell } from '../../models/export/export-cell';
6
+ import { ExportableCollection } from '../exportable.collection';
6
7
  /**
7
8
  * Collection of transactions
8
9
  */
9
- export declare class TransactionCollection extends Collection<Transaction> {
10
+ export declare class TransactionCollection extends ExportableCollection<Transaction> {
10
11
  /**
11
12
  * Get total amount of all transactions in the collection
12
13
  */
@@ -77,4 +78,7 @@ export declare class TransactionCollection extends Collection<Transaction> {
77
78
  * Get new transaction collection filtered by tank type
78
79
  */
79
80
  getByTankType(tankType: TankTypeEnum): this;
81
+ getExportHeader(): string[];
82
+ getExportFooter(): ExportCell[];
83
+ getExportBody(): ExportCell[][];
80
84
  }
@@ -1,7 +1,7 @@
1
1
  import { BankTransaction as BankTransactionBase } from '../../db/Models/bank/bank-transaction';
2
2
  import { TransactionOperationEnum } from '../../db/Enums/transaction-operation.enum';
3
3
  import { Transaction } from '../transaction/transaction';
4
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
4
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
5
5
  export declare class BankTransaction extends BankTransactionBase {
6
6
  allocatedAmount: number;
7
7
  unallocatedAmount: number;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * type of export table column value
3
+ */
4
+ export declare enum ExportCellTypeEnum {
5
+ STRING = 0,
6
+ CURRENCY = 1,
7
+ DATE = 2
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ExportCellTypeEnum } from './export-cell-type.enum';
2
+ /**
3
+ * export table column
4
+ */
5
+ export declare class ExportCell {
6
+ value: any;
7
+ type: ExportCellTypeEnum;
8
+ }
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Data table structure suitable for export
3
3
  */
4
+ import { ExportCell } from './export-cell';
4
5
  export declare class ExportDataTable {
5
6
  caption?: string;
6
7
  header: string[];
7
- rows: string[][];
8
- footer: string[];
8
+ body: ExportCell[][];
9
+ footer: ExportCell[][];
9
10
  }
@@ -1,4 +1,4 @@
1
- import { TransactionCollection } from '../../collections/transaction.collection';
1
+ import { TransactionCollection } from '../../collections/transaction/transaction.collection';
2
2
  import { IChartData } from '../../interfaces/chart-data.interface';
3
3
  /**
4
4
  * Income sources chart data
@@ -1,10 +1,7 @@
1
- import { DataTableExportable } from '../../interfaces/table-exportable.interface';
2
- import { ExportRow } from '../export/export-row';
3
- export declare const EXPORT_DATA_TABLE_COLUMNS: string[];
4
1
  /**
5
2
  * Loan payment class
6
3
  */
7
- export declare class LoanPayment implements DataTableExportable {
4
+ export declare class LoanPayment {
8
5
  date: Date;
9
6
  interestAccrued: number;
10
7
  interestBalance: number;
@@ -14,5 +11,4 @@ export declare class LoanPayment implements DataTableExportable {
14
11
  principalPaid: number;
15
12
  payout: number;
16
13
  totalOwed: number;
17
- toDataTableRows(): ExportRow[];
18
14
  }
@@ -2,7 +2,7 @@ import { VehicleClaim as VehicleClaimBase } from '../../db/Models/vehicle/vehicl
2
2
  import { VehicleClaimMethodEnum } from '../../db/Enums/vehicle-claim-method.enum';
3
3
  import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
4
4
  import { Transaction } from '../transaction/transaction';
5
- import { TransactionCollection } from '../../collections/transaction.collection';
5
+ import { TransactionCollection } from '../../collections/transaction/transaction.collection';
6
6
  export declare class VehicleClaim extends VehicleClaimBase {
7
7
  kmsLimit: number;
8
8
  financialYear: number;
@@ -1,7 +1,7 @@
1
1
  import { PropertyEquityChartItem } from './property-equity-chart-item';
2
2
  import { PropertyCollection } from '../../collections/property/property.collection';
3
3
  import { BankAccountCollection } from '../../collections/bank-account.collection';
4
- import { LoanCollection } from '../../collections/loan.collection';
4
+ import { LoanCollection } from '../../collections/loan/loan.collection';
5
5
  import { PropertyEquityChartTypeEnum } from './property-equity-chart-type.enum';
6
6
  import { Property } from './property';
7
7
  /**
@@ -1,5 +1,5 @@
1
1
  import { PropertyReportItem } from './property-report-item';
2
- import { TransactionCollection } from '../../../collections/transaction.collection';
2
+ import { TransactionCollection } from '../../../collections/transaction/transaction.collection';
3
3
  import { Property } from '../../property/property';
4
4
  import { ChartAccounts } from '../../chart-accounts/chart-accounts';
5
5
  /**
@@ -9,7 +9,7 @@ import { TransactionMetadata } from './transaction-metadata';
9
9
  import { Loan } from '../loan/loan';
10
10
  import { TransactionAllocation } from './transaction-allocation';
11
11
  import { IReceipt } from '../../interfaces/receipt.interface';
12
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
12
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
13
13
  import { Depreciation } from '../depreciation/depreciation';
14
14
  import { Expense } from '../../interfaces/expense.interface';
15
15
  export declare class Transaction extends TransactionBase implements Expense, IReceipt {
@@ -1,6 +1,6 @@
1
1
  import { BankAccountCollection } from '../../collections/bank-account.collection';
2
2
  import { BankTransactionCollection } from '../../collections/bank-transaction.collection';
3
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
3
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
4
4
  import { BankTransactionCalculationService } from './bank-transaction-calculation.service';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class BankAccountCalculationService {
@@ -1,6 +1,6 @@
1
1
  import { BankTransactionCollection } from '../../collections/bank-transaction.collection';
2
2
  import { BankTransaction } from '../../models/bank/bank-transaction';
3
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
3
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * @TODO move to collection
@@ -0,0 +1,11 @@
1
+ import { ExportCell } from '../../models/export/export-cell';
2
+ import { CurrencyPipe, DatePipe } from '@angular/common';
3
+ import * as i0 from "@angular/core";
4
+ export declare class ExportFormatterService {
5
+ private currencyPipe;
6
+ private datePipe;
7
+ constructor(currencyPipe: CurrencyPipe, datePipe: DatePipe);
8
+ format(rows: ExportCell[][]): string[][];
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<ExportFormatterService, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<ExportFormatterService>;
11
+ }
@@ -1,17 +1,15 @@
1
1
  import { Observable, ReplaySubject } from 'rxjs';
2
2
  import { BankAccount as BankAccountBase } from '../../../../db/Models/bank/bank-account';
3
- import { RestService } from '../../rest/rest.service';
4
3
  import { BankAccount } from '../../../../models/bank/bank-account';
4
+ import { RestService } from '../../rest/rest.service';
5
5
  import { BasiqToken } from '../../../../models/bank/basiq-token';
6
6
  import { BankConnection } from '../../../../models/bank/bank-connection';
7
- import { IEventListener } from '../../../../interfaces/event-listener.interface';
8
- import { User } from '../../../../models/user/user';
9
7
  import * as i0 from "@angular/core";
10
8
  /**
11
9
  * basiq is a middleman between bank and user
12
10
  * service is responsible for fetching bank related information
13
11
  */
14
- export declare class BasiqService extends RestService<BankAccountBase, BankAccount> implements IEventListener {
12
+ export declare class BasiqService extends RestService<BankAccountBase, BankAccount> {
15
13
  token: BasiqToken;
16
14
  tokenSubject: ReplaySubject<BasiqToken>;
17
15
  url: string;
@@ -20,32 +18,11 @@ export declare class BasiqService extends RestService<BankAccountBase, BankAccou
20
18
  * Listen events from Event Dispatcher service
21
19
  */
22
20
  listenEvents(): void;
23
- /**
24
- * Update user's basiq consents data on backend
25
- */
26
- confirmConsents(): Observable<void>;
27
- /**
28
- * Notify backend to update connections
29
- */
30
- updateConnections(): Observable<void>;
31
21
  /**
32
22
  * access token to use basiq connect ui iframe
33
23
  */
34
24
  getToken(): Observable<BasiqToken>;
35
- /**
36
- * Get list of user's bank conections
37
- */
38
25
  getConnections(): Observable<BankConnection[]>;
39
- /**
40
- * Listen response from basiq UI to handle result.
41
- * @param isBasiqConsentExist flag from User.ClientDetails - true if user confirmed basiq consent
42
- * @param callback function we run after basiq UI work is finished
43
- */
44
- listenBasiqResponse(isBasiqConsentExist: boolean, callback: () => any): void;
45
- /**
46
- * Get URL with filled params to run basiq UI iframe
47
- */
48
- generateBasiqConsentUrl(user: User): Observable<string>;
49
26
  /**
50
27
  * Listen to EventDispatcherService event related to added Bank connection
51
28
  */
@@ -54,10 +31,6 @@ export declare class BasiqService extends RestService<BankAccountBase, BankAccou
54
31
  * listen to notifications to update basiq accounts list
55
32
  */
56
33
  private listenNotifications;
57
- /**
58
- * Update user's basiq connections when user confirmed basiq consent
59
- */
60
- private listenBasiqConcentUpdated;
61
34
  static ɵfac: i0.ɵɵFactoryDeclaration<BasiqService, never>;
62
35
  static ɵprov: i0.ɵɵInjectableDeclaration<BasiqService>;
63
36
  }
@@ -1,7 +1,10 @@
1
1
  import { ExportDataTable } from '../../models/export/export-data-table';
2
2
  import { PdfSettings } from '../../models/pdf/pdf-settings';
3
+ import { ExportFormatterService } from '../export/export-formatter.service';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class PdfService {
6
+ private formatter;
7
+ constructor(formatter: ExportFormatterService);
5
8
  /**
6
9
  * Export file from provided HTML tables
7
10
  */
@@ -1,9 +1,9 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { BankAccountCollection } from '../../../collections/bank-account.collection';
3
3
  import { DepreciationCollection } from '../../../collections/depreciation.collection';
4
- import { LoanCollection } from '../../../collections/loan.collection';
4
+ import { LoanCollection } from '../../../collections/loan/loan.collection';
5
5
  import { PropertyCollection } from '../../../collections/property/property.collection';
6
- import { TransactionCollection } from '../../../collections/transaction.collection';
6
+ import { TransactionCollection } from '../../../collections/transaction/transaction.collection';
7
7
  import * as i0 from "@angular/core";
8
8
  /**
9
9
  * Service with calculations methods for properties related with other entities.
@@ -8,7 +8,7 @@ import { ChartAccounts } from '../../../models/chart-accounts/chart-accounts';
8
8
  import { DepreciationCollection } from '../../../collections/depreciation.collection';
9
9
  import { Collection } from '../../../collections/collection';
10
10
  import { CollectionDictionary } from '../../../collections/collection-dictionary';
11
- import { TransactionCollection } from '../../../collections/transaction.collection';
11
+ import { TransactionCollection } from '../../../collections/transaction/transaction.collection';
12
12
  import { PropertyReportItemCollection } from '../../../collections/report/property/property-report-item.collection';
13
13
  import * as i0 from "@angular/core";
14
14
  /**
@@ -1,5 +1,5 @@
1
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
2
- import { TransactionCollection } from '../../collections/transaction.collection';
1
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
2
+ import { TransactionCollection } from '../../collections/transaction/transaction.collection';
3
3
  import { Transaction } from '../../models/transaction/transaction';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.16.11",
3
+ "version": "0.17.0",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^12.2.3 || ~13.0.0",
package/public-api.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * Public API Surface of tt-core
3
- */
4
1
  export * from './lib/tt-core.module';
5
2
  /**
6
3
  * Collections
@@ -17,7 +14,8 @@ export * from './lib/collections/depreciation.collection';
17
14
  export * from './lib/collections/depreciation-forecast.collection';
18
15
  export * from './lib/collections/employee.collection';
19
16
  export * from './lib/collections/income-source.collection';
20
- export * from './lib/collections/loan.collection';
17
+ export * from './lib/collections/loan/loan.collection';
18
+ export * from './lib/collections/loan/loan-payment.collection';
21
19
  export * from './lib/collections/message.collection';
22
20
  export * from './lib/collections/message-document.collection';
23
21
  export * from './lib/collections/property/property.collection';
@@ -30,11 +28,12 @@ export * from './lib/collections/report/vehicle-expense/vehicle-expense.collecti
30
28
  export * from './lib/collections/subscription/service-subscription.collection';
31
29
  export * from './lib/collections/tax-summary/report-item.collection';
32
30
  export * from './lib/collections/tax-review.collection';
33
- export * from './lib/collections/transaction-allocation.collection';
34
- export * from './lib/collections/transaction.collection';
31
+ export * from './lib/collections/transaction/transaction-allocation.collection';
32
+ export * from './lib/collections/transaction/transaction.collection';
35
33
  export * from './lib/collections/user-event-setting.collection';
36
34
  export * from './lib/collections/vehicle.collection';
37
35
  export * from './lib/collections/vehicle-logbook.collection';
36
+ export * from './lib/collections/exportable.collection';
38
37
  /**
39
38
  * DB models
40
39
  */
@@ -310,7 +309,7 @@ export * from './lib/services/http/firm/client-income/client-income-types.servic
310
309
  export * from './lib/services/event/event-dispatcher.service';
311
310
  export * from './lib/services/event/sse.service';
312
311
  export * from './lib/services/http/firm/firm.service';
313
- export * from './lib/services/data-table/data-table.service';
312
+ export * from './lib/services/export/export-formatter.service';
314
313
  export * from './lib/services/header-title/header-title.service';
315
314
  export * from './lib/services/http/income-source/income-source.service';
316
315
  export * from './lib/services/http/income-source/income-source-forecast/income-source-forecast.service';
@@ -326,7 +325,6 @@ export * from './lib/services/report/property/property-transaction-report.servic
326
325
  export * from './lib/services/property/corelogic/corelogic.service';
327
326
  export * from './lib/services/http/property/property.service';
328
327
  export * from './lib/services/property/property-calculation/property-calculation.service';
329
- export * from './lib/services/property/property-holding-costs/property-holding-costs.service';
330
328
  export * from './lib/services/http/property/property-category/property-category.service';
331
329
  export * from './lib/services/http/property/property-document/property-document.service';
332
330
  export * from './lib/services/http/property/property-share/property-share.service';
@@ -367,7 +365,6 @@ export * from './lib/interfaces/event-listener.interface';
367
365
  export * from './lib/interfaces/income-source-forecast.interface';
368
366
  export * from './lib/interfaces/option.interface';
369
367
  export * from './lib/interfaces/photoable';
370
- export * from './lib/interfaces/exportable.interface';
371
368
  export * from './lib/interfaces/receipt.interface';
372
369
  export * from './lib/interfaces/tank.interface';
373
370
  export * from './lib/interfaces/table-exportable.interface';
@@ -1,18 +0,0 @@
1
- import { Collection } from './collection';
2
- export class LoanCollection extends Collection {
3
- /**
4
- * Get new collection of loans filtered by bank accounts ids
5
- * @param ids list of bank accounts ids for filter
6
- */
7
- getByBankAccountsIds(ids) {
8
- return new LoanCollection(this.items.filter((loan) => { var _a; return ids.includes((_a = loan.bankAccount) === null || _a === void 0 ? void 0 : _a.id); }));
9
- }
10
- /**
11
- * Get single loan by bank account id
12
- * @param id id of bank account
13
- */
14
- getByBankAccountId(id) {
15
- return this.items.find((loan) => { var _a; return ((_a = loan.bankAccount) === null || _a === void 0 ? void 0 : _a.id) === id; });
16
- }
17
- }
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hbi5jb2xsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvdHQtY29yZS9zcmMvbGliL2NvbGxlY3Rpb25zL2xvYW4uY29sbGVjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUF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ZXJbXSk6IExvYW5Db2xsZWN0aW9uIHtcbiAgICByZXR1cm4gbmV3IExvYW5Db2xsZWN0aW9uKFxuICAgICAgdGhpcy5pdGVtcy5maWx0ZXIoKGxvYW46IExvYW4pOiBib29sZWFuID0+IGlkcy5pbmNsdWRlcyhsb2FuLmJhbmtBY2NvdW50Py5pZCkpXG4gICAgKTtcbiAgfVxuXG4gIC8qKlxuICAgKiBHZXQgc2luZ2xlIGxvYW4gYnkgYmFuayBhY2NvdW50IGlkXG4gICAqIEBwYXJhbSBpZCBpZCBvZiBiYW5rIGFjY291bnRcbiAgICovXG4gIGdldEJ5QmFua0FjY291bnRJZChpZDogbnVtYmVyKTogTG9hbiB7XG4gICAgcmV0dXJuIHRoaXMuaXRlbXMuZmluZCgobG9hbjogTG9hbik6IGJvb2xlYW4gPT4gbG9hbi5iYW5rQWNjb3VudD8uaWQgPT09IGlkKTtcbiAgfVxufVxuIl19
@@ -1,40 +0,0 @@
1
- import { Collection } from './collection';
2
- import { CollectionDictionary } from './collection-dictionary';
3
- export class TransactionAllocationCollection extends Collection {
4
- get amount() {
5
- return this.sumBy('amount');
6
- }
7
- getByTransactionsIds(ids) {
8
- return new TransactionAllocationCollection(this.items.filter((allocation) => ids.includes(allocation.transaction.id)));
9
- }
10
- getByBankTransactionsIds(ids) {
11
- return new TransactionAllocationCollection(this.items.filter((allocation) => ids.includes(allocation.bankTransaction.id)));
12
- }
13
- /**
14
- * Group allocations by bank account via bank transactions collection
15
- */
16
- groupByBankAccount(bankTransactions) {
17
- // Group bank transactions by bank account id
18
- const bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount.id');
19
- // Create empty dictionary of transaction allocations
20
- const allocationsByBankAccount = new CollectionDictionary(new TransactionAllocationCollection([]));
21
- // Fill allocations dictionary with bank transactions dictionary keys and allocations related with each bank transaction collection
22
- bankTransactionsByBankAccount.keys.forEach((key) => {
23
- allocationsByBankAccount.add(key, this.getByBankTransactionsIds(bankTransactionsByBankAccount.get(key).getIds()));
24
- });
25
- return allocationsByBankAccount;
26
- }
27
- /**
28
- * check if collection includes allocation of passed transaction
29
- */
30
- hasTransaction(transaction) {
31
- return !!this.items.find((allocation) => allocation.transaction.id === transaction.id);
32
- }
33
- /**
34
- * Check if bank transaction is related with current allocations
35
- */
36
- hasBankTransaction(bankTransaction) {
37
- return !!this.items.find((allocation) => allocation.bankTransaction.id === bankTransaction.id);
38
- }
39
- }
40
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNhY3Rpb24tYWxsb2NhdGlvbi5jb2xsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvdHQtY29yZS9zcmMvbGliL2NvbGxlY3Rpb25zL3RyYW5zYWN0aW9uLWFsbG9jYXRpb24uY29sbGVjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBRzFDLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSy9ELE1BQU0sT0FBTywrQkFBZ0MsU0FBUSxVQUFpQztJQUNwRixJQUFJLE1BQU07UUFDUixPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDOUIsQ0FBQztJQUVELG9CQUFvQixDQUFDLEdBQWE7UUFDaEMsT0FBTyxJQUFJLCtCQUErQixDQUN4QyxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDLFVBQWlDLEVBQVcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUMzRyxDQUFDO0lBQ0osQ0FBQztJQUVELHdCQUF3QixDQUFDLEdBQWE7UUFDc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