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
@@ -1188,6 +1188,22 @@
1188
1188
  CollectionDictionary.prototype.length = function () {
1189
1189
  return this.keys.length;
1190
1190
  };
1191
+ /**
1192
+ * @Todo find a better solution to get list of the sorted keys
1193
+ * Get array of the "keys" by provided order
1194
+ */
1195
+ CollectionDictionary.prototype.getSortedKeys = function (isDesc) {
1196
+ if (isDesc === void 0) { isDesc = false; }
1197
+ return this.keys.sort(function (a, b) {
1198
+ if (a > b) {
1199
+ return !isDesc ? 1 : -1;
1200
+ }
1201
+ if (a < b) {
1202
+ return !isDesc ? -1 : 1;
1203
+ }
1204
+ return 0;
1205
+ });
1206
+ };
1191
1207
  /**
1192
1208
  * Group collection items by passed path into items object
1193
1209
  */
@@ -1860,6 +1876,50 @@
1860
1876
  TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
1861
1877
  })(exports.TankTypeEnum || (exports.TankTypeEnum = {}));
1862
1878
 
1879
+ /**
1880
+ * export table column
1881
+ */
1882
+ var ExportCell = /** @class */ (function () {
1883
+ function ExportCell() {
1884
+ }
1885
+ return ExportCell;
1886
+ }());
1887
+
1888
+ /**
1889
+ * type of export table column value
1890
+ */
1891
+ var ExportCellTypeEnum;
1892
+ (function (ExportCellTypeEnum) {
1893
+ ExportCellTypeEnum[ExportCellTypeEnum["STRING"] = 0] = "STRING";
1894
+ ExportCellTypeEnum[ExportCellTypeEnum["CURRENCY"] = 1] = "CURRENCY";
1895
+ ExportCellTypeEnum[ExportCellTypeEnum["DATE"] = 2] = "DATE";
1896
+ })(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
1897
+
1898
+ var ExportDataTable = /** @class */ (function () {
1899
+ function ExportDataTable() {
1900
+ }
1901
+ return ExportDataTable;
1902
+ }());
1903
+
1904
+ var ExportableCollection = /** @class */ (function (_super) {
1905
+ __extends(ExportableCollection, _super);
1906
+ function ExportableCollection() {
1907
+ return _super !== null && _super.apply(this, arguments) || this;
1908
+ }
1909
+ ExportableCollection.prototype.getExportFooter = function (type) {
1910
+ return [];
1911
+ };
1912
+ ;
1913
+ ExportableCollection.prototype.export = function (type) {
1914
+ return classTransformer.plainToClass(ExportDataTable, {
1915
+ header: this.getExportHeader(type),
1916
+ body: this.getExportBody(type),
1917
+ footer: [this.getExportFooter(type)]
1918
+ });
1919
+ };
1920
+ return ExportableCollection;
1921
+ }(Collection));
1922
+
1863
1923
  /**
1864
1924
  * Collection of transactions
1865
1925
  */
@@ -2031,8 +2091,29 @@
2031
2091
  }
2032
2092
  }));
2033
2093
  };
2094
+ TransactionCollection.prototype.getExportHeader = function () {
2095
+ return ['Date', 'Description', 'Debit', 'Credit'];
2096
+ };
2097
+ TransactionCollection.prototype.getExportFooter = function () {
2098
+ return [
2099
+ classTransformer.plainToClass(ExportCell, { value: 'Total', type: ExportCellTypeEnum.STRING }),
2100
+ classTransformer.plainToClass(ExportCell, { value: '', type: ExportCellTypeEnum.STRING }),
2101
+ classTransformer.plainToClass(ExportCell, { value: this.sumBy('debit'), type: ExportCellTypeEnum.CURRENCY }),
2102
+ classTransformer.plainToClass(ExportCell, { value: this.sumBy('credit'), type: ExportCellTypeEnum.CURRENCY })
2103
+ ];
2104
+ };
2105
+ TransactionCollection.prototype.getExportBody = function () {
2106
+ return this.items.map(function (transaction) {
2107
+ return [
2108
+ classTransformer.plainToClass(ExportCell, { value: transaction.date, type: ExportCellTypeEnum.DATE }),
2109
+ classTransformer.plainToClass(ExportCell, { value: transaction.description, type: ExportCellTypeEnum.STRING }),
2110
+ classTransformer.plainToClass(ExportCell, { value: transaction.debit, type: ExportCellTypeEnum.CURRENCY }),
2111
+ classTransformer.plainToClass(ExportCell, { value: transaction.credit, type: ExportCellTypeEnum.CURRENCY })
2112
+ ];
2113
+ });
2114
+ };
2034
2115
  return TransactionCollection;
2035
- }(Collection));
2116
+ }(ExportableCollection));
2036
2117
 
2037
2118
  var DepreciationCollection = /** @class */ (function (_super) {
2038
2119
  __extends(DepreciationCollection, _super);
@@ -2243,6 +2324,38 @@
2243
2324
  return LoanCollection;
2244
2325
  }(Collection));
2245
2326
 
2327
+ var LoanPaymentCollection = /** @class */ (function (_super) {
2328
+ __extends(LoanPaymentCollection, _super);
2329
+ function LoanPaymentCollection() {
2330
+ return _super !== null && _super.apply(this, arguments) || this;
2331
+ }
2332
+ LoanPaymentCollection.prototype.getExportHeader = function () {
2333
+ return [
2334
+ 'Pmt No.',
2335
+ 'Date',
2336
+ 'Payment Due',
2337
+ 'Interest Accrued',
2338
+ 'Principal Paid',
2339
+ 'Principal Balance',
2340
+ 'Payout'
2341
+ ];
2342
+ };
2343
+ LoanPaymentCollection.prototype.getExportBody = function () {
2344
+ return this.items.map(function (payment) {
2345
+ return [
2346
+ classTransformer.plainToClass(ExportCell, { value: payment.number, type: ExportCellTypeEnum.STRING }),
2347
+ classTransformer.plainToClass(ExportCell, { value: payment.date, type: ExportCellTypeEnum.DATE }),
2348
+ classTransformer.plainToClass(ExportCell, { value: payment.paymentDue, type: ExportCellTypeEnum.CURRENCY }),
2349
+ classTransformer.plainToClass(ExportCell, { value: payment.interestAccrued, type: ExportCellTypeEnum.CURRENCY }),
2350
+ classTransformer.plainToClass(ExportCell, { value: payment.principalPaid, type: ExportCellTypeEnum.CURRENCY }),
2351
+ classTransformer.plainToClass(ExportCell, { value: payment.principalBalance, type: ExportCellTypeEnum.CURRENCY }),
2352
+ classTransformer.plainToClass(ExportCell, { value: payment.payout, type: ExportCellTypeEnum.CURRENCY }),
2353
+ ];
2354
+ });
2355
+ };
2356
+ return LoanPaymentCollection;
2357
+ }(ExportableCollection));
2358
+
2246
2359
  var MessageCollection = /** @class */ (function (_super) {
2247
2360
  __extends(MessageCollection, _super);
2248
2361
  function MessageCollection() {
@@ -4568,34 +4681,6 @@
4568
4681
  LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
4569
4682
  })(exports.LoanVehicleTypeEnum || (exports.LoanVehicleTypeEnum = {}));
4570
4683
 
4571
- /**
4572
- * Class with structure of the data-table rows
4573
- */
4574
- var ExportRow = /** @class */ (function () {
4575
- function ExportRow() {
4576
- }
4577
- return ExportRow;
4578
- }());
4579
-
4580
- /**
4581
- * Enum which shows what type (in terms of business logic) of the data-table row item
4582
- */
4583
- var ExportRowDataTypeEnum;
4584
- (function (ExportRowDataTypeEnum) {
4585
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["STRING"] = 0] = "STRING";
4586
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["CURRENCY"] = 1] = "CURRENCY";
4587
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["DATE"] = 2] = "DATE";
4588
- })(ExportRowDataTypeEnum || (ExportRowDataTypeEnum = {}));
4589
-
4590
- var EXPORT_DATA_TABLE_COLUMNS = [
4591
- 'Pmt No.',
4592
- 'Date',
4593
- 'Payment Due',
4594
- 'Interest Accrued',
4595
- 'Principal Paid',
4596
- 'Principal Balance',
4597
- 'Payout'
4598
- ];
4599
4684
  // @Todo no base model from backend list
4600
4685
  /**
4601
4686
  * Loan payment class
@@ -4603,17 +4688,6 @@
4603
4688
  var LoanPayment = /** @class */ (function () {
4604
4689
  function LoanPayment() {
4605
4690
  }
4606
- LoanPayment.prototype.toDataTableRows = function () {
4607
- return [
4608
- classTransformer.plainToClass(ExportRow, { data: this.number, type: ExportRowDataTypeEnum.STRING }),
4609
- classTransformer.plainToClass(ExportRow, { data: this.date, type: ExportRowDataTypeEnum.DATE }),
4610
- classTransformer.plainToClass(ExportRow, { data: this.paymentDue, type: ExportRowDataTypeEnum.CURRENCY }),
4611
- classTransformer.plainToClass(ExportRow, { data: this.interestAccrued, type: ExportRowDataTypeEnum.CURRENCY }),
4612
- classTransformer.plainToClass(ExportRow, { data: this.principalPaid, type: ExportRowDataTypeEnum.CURRENCY }),
4613
- classTransformer.plainToClass(ExportRow, { data: this.principalBalance, type: ExportRowDataTypeEnum.CURRENCY }),
4614
- classTransformer.plainToClass(ExportRow, { data: this.payout, type: ExportRowDataTypeEnum.CURRENCY }),
4615
- ];
4616
- };
4617
4691
  return LoanPayment;
4618
4692
  }());
4619
4693
  __decorate([
@@ -7618,16 +7692,6 @@
7618
7692
  AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 42] = "VEHICLE_LOGBOOK_DELETED";
7619
7693
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
7620
7694
 
7621
- /**
7622
- * Data table structure suitable for export
7623
- */
7624
- var ExportDataTable = /** @class */ (function () {
7625
- function ExportDataTable() {
7626
- this.footer = [];
7627
- }
7628
- return ExportDataTable;
7629
- }());
7630
-
7631
7695
  exports.ExportFormatEnum = void 0;
7632
7696
  (function (ExportFormatEnum) {
7633
7697
  ExportFormatEnum["PDF"] = "PDF";
@@ -10489,14 +10553,6 @@
10489
10553
  }]
10490
10554
  }] });
10491
10555
 
10492
- /**
10493
- * Basiq consent UI initial URL. Replace USER_ID and TOKEN by user data + handle action parameter
10494
- */
10495
- var BASIQ_CONSENT_URL = 'https://consent.basiq.io/home?userId=USER_ID&token=TOKEN&action=connect';
10496
- /**
10497
- * Event message name we listen to handle basiq UI result
10498
- */
10499
- var FINISH_BASIQ_EVENT = 'finish-basiq';
10500
10556
  /**
10501
10557
  * basiq is a middleman between bank and user
10502
10558
  * service is responsible for fetching bank related information
@@ -10516,25 +10572,6 @@
10516
10572
  BasiqService.prototype.listenEvents = function () {
10517
10573
  this.listenToBankConnectionAdded();
10518
10574
  this.listenNotifications();
10519
- this.listenBasiqConcentUpdated();
10520
- };
10521
- /**
10522
- * Update user's basiq consents data on backend
10523
- */
10524
- BasiqService.prototype.confirmConsents = function () {
10525
- var _this = this;
10526
- return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (isConfirmed) {
10527
- _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
10528
- }));
10529
- };
10530
- /**
10531
- * Notify backend to update connections
10532
- */
10533
- BasiqService.prototype.updateConnections = function () {
10534
- var _this = this;
10535
- return this.http.post(this.environment.apiV2 + "/basiq/connections", {}).pipe(operators.map(function (connections) {
10536
- _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONNECTION_UPDATED, !!connections));
10537
- }));
10538
10575
  };
10539
10576
  /**
10540
10577
  * access token to use basiq connect ui iframe
@@ -10548,15 +10585,11 @@
10548
10585
  return new BasiqToken(response['access_token'], new Date(now + response['expires_in'] * 1000));
10549
10586
  }))
10550
10587
  .subscribe(function (token) {
10551
- _this.token = token;
10552
10588
  _this.tokenSubject.next(token);
10553
10589
  });
10554
10590
  }
10555
10591
  return this.tokenSubject.asObservable();
10556
10592
  };
10557
- /**
10558
- * Get list of user's bank conections
10559
- */
10560
10593
  BasiqService.prototype.getConnections = function () {
10561
10594
  return this.get().pipe(operators.map(function (bankAccounts) {
10562
10595
  // get all connections
@@ -10567,41 +10600,6 @@
10567
10600
  return __spreadArray([], __read(new Map(connections.map(function (connection) { return [connection.id, connection]; })).values()));
10568
10601
  }));
10569
10602
  };
10570
- /**
10571
- * Listen response from basiq UI to handle result.
10572
- * @param isBasiqConsentExist flag from User.ClientDetails - true if user confirmed basiq consent
10573
- * @param callback function we run after basiq UI work is finished
10574
- */
10575
- BasiqService.prototype.listenBasiqResponse = function (isBasiqConsentExist, callback) {
10576
- var _this = this;
10577
- window.addEventListener('message', function (message) {
10578
- if (message.data !== FINISH_BASIQ_EVENT) {
10579
- return;
10580
- }
10581
- // update user's basiq consent confirmation status for the first basiq ui run
10582
- if (isBasiqConsentExist) {
10583
- _this.updateConnections().pipe(operators.take(1)).subscribe();
10584
- }
10585
- else {
10586
- _this.confirmConsents().pipe(operators.take(1)).subscribe();
10587
- }
10588
- callback();
10589
- }, { once: true });
10590
- };
10591
- /**
10592
- * Get URL with filled params to run basiq UI iframe
10593
- */
10594
- BasiqService.prototype.generateBasiqConsentUrl = function (user) {
10595
- return this.getToken().pipe(operators.map(function (token) {
10596
- var url = BASIQ_CONSENT_URL;
10597
- url = url.replace('USER_ID', user.basiqId);
10598
- url = url.replace('TOKEN', token.value);
10599
- if (!user.clientDetails.basiqConsentExist) {
10600
- url = url.split('&action')[0];
10601
- }
10602
- return url;
10603
- }));
10604
- };
10605
10603
  /**
10606
10604
  * Listen to EventDispatcherService event related to added Bank connection
10607
10605
  */
@@ -10626,18 +10624,6 @@
10626
10624
  }
10627
10625
  });
10628
10626
  };
10629
- /**
10630
- * Update user's basiq connections when user confirmed basiq consent
10631
- */
10632
- BasiqService.prototype.listenBasiqConcentUpdated = function () {
10633
- var _this = this;
10634
- this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe(function (isConfirmed) {
10635
- if (!isConfirmed) {
10636
- return;
10637
- }
10638
- _this.updateConnections().pipe(operators.take(1)).subscribe();
10639
- });
10640
- };
10641
10627
  return BasiqService;
10642
10628
  }(RestService));
10643
10629
  BasiqService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -11764,43 +11750,29 @@
11764
11750
  }] }];
11765
11751
  } });
11766
11752
 
11767
- /**
11768
- * Service to handle array-like data table logic
11769
- */
11770
- var DataTableService = /** @class */ (function () {
11771
- function DataTableService(currencyPipe, datePipe) {
11753
+ var ExportFormatterService = /** @class */ (function () {
11754
+ function ExportFormatterService(currencyPipe, datePipe) {
11772
11755
  this.currencyPipe = currencyPipe;
11773
11756
  this.datePipe = datePipe;
11774
11757
  }
11775
- DataTableService.prototype.initDataTable = function (exportableModels, headerColumns) {
11776
- return classTransformer.plainToClass(ExportDataTable, {
11777
- header: headerColumns,
11778
- rows: this.getDataTableRows(exportableModels),
11779
- });
11780
- };
11781
- /**
11782
- * Get data for the exporting table rows
11783
- */
11784
- DataTableService.prototype.getDataTableRows = function (exportableModels) {
11758
+ ExportFormatterService.prototype.format = function (rows) {
11785
11759
  var _this = this;
11786
- return exportableModels.map(function (model) {
11787
- return model.toDataTableRows().map(function (row) {
11788
- switch (row.type) {
11789
- case ExportRowDataTypeEnum.DATE:
11790
- return _this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
11791
- case ExportRowDataTypeEnum.CURRENCY:
11792
- return _this.currencyPipe.transform(row.data).toString();
11793
- default:
11794
- return row.data.toString();
11795
- }
11796
- });
11797
- });
11760
+ return rows.map(function (row) { return row.map(function (column) {
11761
+ switch (column.type) {
11762
+ case ExportCellTypeEnum.DATE:
11763
+ return _this.datePipe.transform(column.value, 'dd/MM/YYYY').toString();
11764
+ case ExportCellTypeEnum.CURRENCY:
11765
+ return _this.currencyPipe.transform(column.value).toString();
11766
+ default:
11767
+ return column.value.toString();
11768
+ }
11769
+ }); });
11798
11770
  };
11799
- return DataTableService;
11771
+ return ExportFormatterService;
11800
11772
  }());
11801
- DataTableService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, deps: [{ token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11802
- DataTableService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, providedIn: 'root' });
11803
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, decorators: [{
11773
+ ExportFormatterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, deps: [{ token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11774
+ ExportFormatterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, providedIn: 'root' });
11775
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, decorators: [{
11804
11776
  type: i0.Injectable,
11805
11777
  args: [{
11806
11778
  providedIn: 'root'
@@ -12363,10 +12335,12 @@
12363
12335
  };
12364
12336
 
12365
12337
  /**
12338
+ * @TODO vik refactor
12366
12339
  * Service to work with PDF (generate, download, e.t.c.)
12367
12340
  */
12368
12341
  var PdfService = /** @class */ (function () {
12369
- function PdfService() {
12342
+ function PdfService(formatter) {
12343
+ this.formatter = formatter;
12370
12344
  }
12371
12345
  /**
12372
12346
  * Export file from provided HTML tables
@@ -12391,7 +12365,7 @@
12391
12365
  this.setDocumentTitle(pdf, title);
12392
12366
  this.setDocumentLogo(pdf);
12393
12367
  dataTables.forEach(function (dataTable) {
12394
- autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer || []] }, _this.setTableOptions(pdf, dataTable.caption)));
12368
+ autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: _this.formatter.format(dataTable.body), foot: _this.formatter.format(dataTable.footer) }, _this.setTableOptions(pdf, dataTable.caption)));
12395
12369
  });
12396
12370
  return pdf;
12397
12371
  };
@@ -12448,14 +12422,14 @@
12448
12422
  };
12449
12423
  return PdfService;
12450
12424
  }());
12451
- PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12425
+ PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [{ token: ExportFormatterService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12452
12426
  PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
12453
12427
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
12454
12428
  type: i0.Injectable,
12455
12429
  args: [{
12456
12430
  providedIn: 'root'
12457
12431
  }]
12458
- }] });
12432
+ }], ctorParameters: function () { return [{ type: ExportFormatterService }]; } });
12459
12433
 
12460
12434
  /**
12461
12435
  * Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
@@ -12646,54 +12620,6 @@
12646
12620
  }]
12647
12621
  }] });
12648
12622
 
12649
- /**
12650
- * Service to work with holding costs (transactions related to vacant land property)
12651
- */
12652
- var PropertyHoldingCostsService = /** @class */ (function () {
12653
- function PropertyHoldingCostsService(pdfService, currencyPipe, datePipe) {
12654
- this.pdfService = pdfService;
12655
- this.currencyPipe = currencyPipe;
12656
- this.datePipe = datePipe;
12657
- this.url = 'transactions';
12658
- this.modelClass = Transaction;
12659
- }
12660
- PropertyHoldingCostsService.prototype.initDataTable = function (holdingCosts) {
12661
- return classTransformer.plainToClass(ExportDataTable, {
12662
- header: ['Date', 'Description', 'Debit', 'Credit'],
12663
- rows: this.getDataTableRows(holdingCosts),
12664
- footer: [
12665
- 'Total',
12666
- '',
12667
- this.currencyPipe.transform(holdingCosts.sumBy('debit')).toString(),
12668
- this.currencyPipe.transform(holdingCosts.sumBy('credit')).toString(),
12669
- ]
12670
- });
12671
- };
12672
- /**
12673
- * Get data for the exporting table rows
12674
- */
12675
- PropertyHoldingCostsService.prototype.getDataTableRows = function (holdingCosts) {
12676
- var _this = this;
12677
- return holdingCosts.items.map(function (transaction) {
12678
- return [
12679
- _this.datePipe.transform(transaction.date, 'dd/MM/YYYY').toString(),
12680
- transaction.description,
12681
- _this.currencyPipe.transform(transaction.debit).toString(),
12682
- _this.currencyPipe.transform(transaction.credit).toString()
12683
- ];
12684
- });
12685
- };
12686
- return PropertyHoldingCostsService;
12687
- }());
12688
- PropertyHoldingCostsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12689
- PropertyHoldingCostsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, providedIn: 'root' });
12690
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, decorators: [{
12691
- type: i0.Injectable,
12692
- args: [{
12693
- providedIn: 'root'
12694
- }]
12695
- }], ctorParameters: function () { return [{ type: PdfService }, { type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
12696
-
12697
12623
  /**
12698
12624
  * Service for work with Property Categories
12699
12625
  */
@@ -14178,10 +14104,6 @@
14178
14104
  return VehicleClaimForm;
14179
14105
  }(AbstractForm));
14180
14106
 
14181
- /**
14182
- * Public API Surface of tt-core
14183
- */
14184
-
14185
14107
  /**
14186
14108
  * Generated bundle index. Do not edit.
14187
14109
  */
@@ -14254,7 +14176,6 @@
14254
14176
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
14255
14177
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
14256
14178
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
14257
- exports.DataTableService = DataTableService;
14258
14179
  exports.Depreciation = Depreciation;
14259
14180
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
14260
14181
  exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
@@ -14273,7 +14194,6 @@
14273
14194
  exports.DocumentFolder = DocumentFolder;
14274
14195
  exports.DocumentFolderService = DocumentFolderService;
14275
14196
  exports.ENDPOINTS = ENDPOINTS;
14276
- exports.EXPORT_DATA_TABLE_COLUMNS = EXPORT_DATA_TABLE_COLUMNS;
14277
14197
  exports.EmployeeCollection = EmployeeCollection;
14278
14198
  exports.EmployeeDetails = EmployeeDetails;
14279
14199
  exports.EmployeeInvite = EmployeeInvite;
@@ -14283,6 +14203,8 @@
14283
14203
  exports.EquityPositionChartService = EquityPositionChartService;
14284
14204
  exports.EventDispatcherService = EventDispatcherService;
14285
14205
  exports.ExportDataTable = ExportDataTable;
14206
+ exports.ExportFormatterService = ExportFormatterService;
14207
+ exports.ExportableCollection = ExportableCollection;
14286
14208
  exports.FinancialYear = FinancialYear;
14287
14209
  exports.Firm = Firm;
14288
14210
  exports.FirmService = FirmService;
@@ -14302,6 +14224,7 @@
14302
14224
  exports.Loan = Loan;
14303
14225
  exports.LoanCollection = LoanCollection;
14304
14226
  exports.LoanPayment = LoanPayment;
14227
+ exports.LoanPaymentCollection = LoanPaymentCollection;
14305
14228
  exports.LoanPayout = LoanPayout;
14306
14229
  exports.LoanService = LoanService;
14307
14230
  exports.LogbookPeriod = LogbookPeriod;
@@ -14335,7 +14258,6 @@
14335
14258
  exports.PropertyEquityChartData = PropertyEquityChartData;
14336
14259
  exports.PropertyEquityChartItem = PropertyEquityChartItem;
14337
14260
  exports.PropertyForecast = PropertyForecast;
14338
- exports.PropertyHoldingCostsService = PropertyHoldingCostsService;
14339
14261
  exports.PropertyReportItem = PropertyReportItem;
14340
14262
  exports.PropertyReportItemCollection = PropertyReportItemCollection;
14341
14263
  exports.PropertyReportItemDepreciationCollection = PropertyReportItemDepreciationCollection;