taxtank-core 0.16.3 → 0.16.4

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.
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('lodash/last'), require('lodash/compact'), require('lodash/uniqBy'), require('lodash/concat'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('@angular/forms'), require('lodash/fromPairs'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
3
3
  typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'lodash/last', 'lodash/compact', 'lodash/uniqBy', 'lodash/concat', 'moment', 'moment-range', 'lodash/cloneDeep', '@angular/forms', 'lodash/fromPairs', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.flatten, global.hasIn, global.first, global.last, global.compact, global.uniqBy, global.concat, global.moment, global.momentRange, global.cloneDeep$1, global.ng.forms, global.fromPairs, global._, global.eventsource_min_js, global.ng.router, global.clone, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
5
- })(this, (function (exports, i0, i2, i1, rxjs, operators, classTransformer, angularJwt, get, flatten, hasIn, first, last, compact, uniqBy, concat, moment, momentRange, cloneDeep$1, forms, fromPairs, _, eventsource_min_js, i1$1, clone, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
5
+ })(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, flatten, hasIn, first, last, compact, uniqBy, concat, moment, momentRange, cloneDeep$1, forms, fromPairs, _, eventsource_min_js, i1$2, clone, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -25,7 +25,7 @@
25
25
  }
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
28
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
29
29
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
30
30
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
31
31
  var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
@@ -39,7 +39,7 @@
39
39
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
40
40
  var fromPairs__default = /*#__PURE__*/_interopDefaultLegacy(fromPairs);
41
41
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
42
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
42
+ var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
43
43
  var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
44
44
  var jsPDF__default = /*#__PURE__*/_interopDefaultLegacy(jsPDF);
45
45
  var autoTable__default = /*#__PURE__*/_interopDefaultLegacy(autoTable);
@@ -1105,10 +1105,10 @@
1105
1105
  return TtCoreModule;
1106
1106
  }());
1107
1107
  TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1108
- TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [i2.CommonModule,
1108
+ TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [i1$1.CommonModule,
1109
1109
  InterceptorsModule] });
1110
1110
  TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
1111
- i2.CommonModule,
1111
+ i1$1.CommonModule,
1112
1112
  InterceptorsModule
1113
1113
  ]] });
1114
1114
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
@@ -1116,7 +1116,7 @@
1116
1116
  args: [{
1117
1117
  declarations: [],
1118
1118
  imports: [
1119
- i2.CommonModule,
1119
+ i1$1.CommonModule,
1120
1120
  InterceptorsModule
1121
1121
  ]
1122
1122
  }]
@@ -4569,6 +4569,34 @@
4569
4569
  LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
4570
4570
  })(exports.LoanVehicleTypeEnum || (exports.LoanVehicleTypeEnum = {}));
4571
4571
 
4572
+ /**
4573
+ * Class with structure of the data-table rows
4574
+ */
4575
+ var ExportRow = /** @class */ (function () {
4576
+ function ExportRow() {
4577
+ }
4578
+ return ExportRow;
4579
+ }());
4580
+
4581
+ /**
4582
+ * Enum which shows what type (in terms of business logic) of the data-table row item
4583
+ */
4584
+ var ExportRowDataTypeEnum;
4585
+ (function (ExportRowDataTypeEnum) {
4586
+ ExportRowDataTypeEnum[ExportRowDataTypeEnum["STRING"] = 0] = "STRING";
4587
+ ExportRowDataTypeEnum[ExportRowDataTypeEnum["CURRENCY"] = 1] = "CURRENCY";
4588
+ ExportRowDataTypeEnum[ExportRowDataTypeEnum["DATE"] = 2] = "DATE";
4589
+ })(ExportRowDataTypeEnum || (ExportRowDataTypeEnum = {}));
4590
+
4591
+ var EXPORT_DATA_TABLE_COLUMNS = [
4592
+ 'Pmt No.',
4593
+ 'Date',
4594
+ 'Payment Due',
4595
+ 'Interest Accrued',
4596
+ 'Principal Paid',
4597
+ 'Principal Balance',
4598
+ 'Payout'
4599
+ ];
4572
4600
  // @Todo no base model from backend list
4573
4601
  /**
4574
4602
  * Loan payment class
@@ -4576,6 +4604,17 @@
4576
4604
  var LoanPayment = /** @class */ (function () {
4577
4605
  function LoanPayment() {
4578
4606
  }
4607
+ LoanPayment.prototype.toDataTableRows = function () {
4608
+ return [
4609
+ classTransformer.plainToClass(ExportRow, { data: this.number, type: ExportRowDataTypeEnum.STRING }),
4610
+ classTransformer.plainToClass(ExportRow, { data: this.date, type: ExportRowDataTypeEnum.DATE }),
4611
+ classTransformer.plainToClass(ExportRow, { data: this.paymentDue, type: ExportRowDataTypeEnum.CURRENCY }),
4612
+ classTransformer.plainToClass(ExportRow, { data: this.interestAccrued, type: ExportRowDataTypeEnum.CURRENCY }),
4613
+ classTransformer.plainToClass(ExportRow, { data: this.principalPaid, type: ExportRowDataTypeEnum.CURRENCY }),
4614
+ classTransformer.plainToClass(ExportRow, { data: this.principalBalance, type: ExportRowDataTypeEnum.CURRENCY }),
4615
+ classTransformer.plainToClass(ExportRow, { data: this.payout, type: ExportRowDataTypeEnum.CURRENCY }),
4616
+ ];
4617
+ };
4579
4618
  return LoanPayment;
4580
4619
  }());
4581
4620
  __decorate([
@@ -7579,6 +7618,7 @@
7579
7618
  */
7580
7619
  var ExportDataTable = /** @class */ (function () {
7581
7620
  function ExportDataTable() {
7621
+ this.footer = [];
7582
7622
  }
7583
7623
  return ExportDataTable;
7584
7624
  }());
@@ -11634,6 +11674,49 @@
11634
11674
  }] }];
11635
11675
  } });
11636
11676
 
11677
+ /**
11678
+ * Service to handle array-like data table logic
11679
+ */
11680
+ var DataTableService = /** @class */ (function () {
11681
+ function DataTableService(currencyPipe, datePipe) {
11682
+ this.currencyPipe = currencyPipe;
11683
+ this.datePipe = datePipe;
11684
+ }
11685
+ DataTableService.prototype.initDataTable = function (exportableModels, headerColumns) {
11686
+ return classTransformer.plainToClass(ExportDataTable, {
11687
+ header: headerColumns,
11688
+ rows: this.getDataTableRows(exportableModels),
11689
+ });
11690
+ };
11691
+ /**
11692
+ * Get data for the exporting table rows
11693
+ */
11694
+ DataTableService.prototype.getDataTableRows = function (exportableModels) {
11695
+ var _this = this;
11696
+ return exportableModels.map(function (model) {
11697
+ return model.toDataTableRows().map(function (row) {
11698
+ switch (row.type) {
11699
+ case ExportRowDataTypeEnum.DATE:
11700
+ return _this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
11701
+ case ExportRowDataTypeEnum.CURRENCY:
11702
+ return _this.currencyPipe.transform(row.data).toString();
11703
+ default:
11704
+ return row.data.toString();
11705
+ }
11706
+ });
11707
+ });
11708
+ };
11709
+ return DataTableService;
11710
+ }());
11711
+ 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 });
11712
+ DataTableService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, providedIn: 'root' });
11713
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, decorators: [{
11714
+ type: i0.Injectable,
11715
+ args: [{
11716
+ providedIn: 'root'
11717
+ }]
11718
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
11719
+
11637
11720
  var HeaderTitleService = /** @class */ (function () {
11638
11721
  function HeaderTitleService(router, activatedRoute) {
11639
11722
  this.router = router;
@@ -11641,7 +11724,7 @@
11641
11724
  }
11642
11725
  HeaderTitleService.prototype.handleTitle = function () {
11643
11726
  var _this = this;
11644
- return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }), operators.map(function () { return _this.activatedRoute; }), operators.map(function (route) {
11727
+ return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$2.NavigationEnd; }), operators.map(function () { return _this.activatedRoute; }), operators.map(function (route) {
11645
11728
  while (route.firstChild) {
11646
11729
  route = route.firstChild;
11647
11730
  }
@@ -11650,14 +11733,14 @@
11650
11733
  };
11651
11734
  return HeaderTitleService;
11652
11735
  }());
11653
- HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$1.Router }, { token: i1__namespace$1.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11736
+ HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$2.Router }, { token: i1__namespace$2.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11654
11737
  HeaderTitleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, providedIn: 'root' });
11655
11738
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, decorators: [{
11656
11739
  type: i0.Injectable,
11657
11740
  args: [{
11658
11741
  providedIn: 'root'
11659
11742
  }]
11660
- }], ctorParameters: function () { return [{ type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }]; } });
11743
+ }], ctorParameters: function () { return [{ type: i1__namespace$2.Router }, { type: i1__namespace$2.ActivatedRoute }]; } });
11661
11744
 
11662
11745
  /**
11663
11746
  * Service to work with Other Income Forecasts
@@ -11948,14 +12031,14 @@
11948
12031
  };
11949
12032
  return KompassifyService;
11950
12033
  }());
11951
- KompassifyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, deps: [{ token: i1__namespace$1.Router }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12034
+ KompassifyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, deps: [{ token: i1__namespace$2.Router }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11952
12035
  KompassifyService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, providedIn: 'root' });
11953
12036
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, decorators: [{
11954
12037
  type: i0.Injectable,
11955
12038
  args: [{
11956
12039
  providedIn: 'root'
11957
12040
  }]
11958
- }], ctorParameters: function () { return [{ type: i1__namespace$1.Router }]; } });
12041
+ }], ctorParameters: function () { return [{ type: i1__namespace$2.Router }]; } });
11959
12042
 
11960
12043
  /**
11961
12044
  * Service that handling loans logic
@@ -12218,7 +12301,7 @@
12218
12301
  this.setDocumentTitle(pdf, title);
12219
12302
  this.setDocumentLogo(pdf);
12220
12303
  dataTables.forEach(function (dataTable) {
12221
- autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, _this.setTableOptions(pdf, dataTable.caption)));
12304
+ autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer || []] }, _this.setTableOptions(pdf, dataTable.caption)));
12222
12305
  });
12223
12306
  return pdf;
12224
12307
  };
@@ -12512,14 +12595,14 @@
12512
12595
  };
12513
12596
  return PropertyHoldingCostsService;
12514
12597
  }());
12515
- PropertyHoldingCostsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i2__namespace.CurrencyPipe }, { token: i2__namespace.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12598
+ 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 });
12516
12599
  PropertyHoldingCostsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, providedIn: 'root' });
12517
12600
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, decorators: [{
12518
12601
  type: i0.Injectable,
12519
12602
  args: [{
12520
12603
  providedIn: 'root'
12521
12604
  }]
12522
- }], ctorParameters: function () { return [{ type: PdfService }, { type: i2__namespace.CurrencyPipe }, { type: i2__namespace.DatePipe }]; } });
12605
+ }], ctorParameters: function () { return [{ type: PdfService }, { type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
12523
12606
 
12524
12607
  /**
12525
12608
  * Service for work with Property Categories
@@ -14081,6 +14164,7 @@
14081
14164
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
14082
14165
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
14083
14166
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
14167
+ exports.DataTableService = DataTableService;
14084
14168
  exports.Depreciation = Depreciation;
14085
14169
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
14086
14170
  exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
@@ -14099,6 +14183,7 @@
14099
14183
  exports.DocumentFolder = DocumentFolder;
14100
14184
  exports.DocumentFolderService = DocumentFolderService;
14101
14185
  exports.ENDPOINTS = ENDPOINTS;
14186
+ exports.EXPORT_DATA_TABLE_COLUMNS = EXPORT_DATA_TABLE_COLUMNS;
14102
14187
  exports.EmployeeCollection = EmployeeCollection;
14103
14188
  exports.EmployeeDetails = EmployeeDetails;
14104
14189
  exports.EmployeeInvite = EmployeeInvite;