taxtank-core 0.16.1 → 0.16.2

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
  }());
@@ -11643,6 +11683,49 @@
11643
11683
  }] }];
11644
11684
  } });
11645
11685
 
11686
+ /**
11687
+ * Service to handle array-like data table logic
11688
+ */
11689
+ var DataTableService = /** @class */ (function () {
11690
+ function DataTableService(currencyPipe, datePipe) {
11691
+ this.currencyPipe = currencyPipe;
11692
+ this.datePipe = datePipe;
11693
+ }
11694
+ DataTableService.prototype.initDataTable = function (exportableModels, headerColumns) {
11695
+ return classTransformer.plainToClass(ExportDataTable, {
11696
+ header: headerColumns,
11697
+ rows: this.getDataTableRows(exportableModels),
11698
+ });
11699
+ };
11700
+ /**
11701
+ * Get data for the exporting table rows
11702
+ */
11703
+ DataTableService.prototype.getDataTableRows = function (exportableModels) {
11704
+ var _this = this;
11705
+ return exportableModels.map(function (model) {
11706
+ return model.toDataTableRows().map(function (row) {
11707
+ switch (row.type) {
11708
+ case ExportRowDataTypeEnum.DATE:
11709
+ return _this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
11710
+ case ExportRowDataTypeEnum.CURRENCY:
11711
+ return _this.currencyPipe.transform(row.data).toString();
11712
+ default:
11713
+ return row.data.toString();
11714
+ }
11715
+ });
11716
+ });
11717
+ };
11718
+ return DataTableService;
11719
+ }());
11720
+ 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 });
11721
+ DataTableService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, providedIn: 'root' });
11722
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, decorators: [{
11723
+ type: i0.Injectable,
11724
+ args: [{
11725
+ providedIn: 'root'
11726
+ }]
11727
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
11728
+
11646
11729
  var HeaderTitleService = /** @class */ (function () {
11647
11730
  function HeaderTitleService(router, activatedRoute) {
11648
11731
  this.router = router;
@@ -11650,7 +11733,7 @@
11650
11733
  }
11651
11734
  HeaderTitleService.prototype.handleTitle = function () {
11652
11735
  var _this = this;
11653
- 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) {
11736
+ 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) {
11654
11737
  while (route.firstChild) {
11655
11738
  route = route.firstChild;
11656
11739
  }
@@ -11659,14 +11742,14 @@
11659
11742
  };
11660
11743
  return HeaderTitleService;
11661
11744
  }());
11662
- 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 });
11745
+ 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 });
11663
11746
  HeaderTitleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, providedIn: 'root' });
11664
11747
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, decorators: [{
11665
11748
  type: i0.Injectable,
11666
11749
  args: [{
11667
11750
  providedIn: 'root'
11668
11751
  }]
11669
- }], ctorParameters: function () { return [{ type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }]; } });
11752
+ }], ctorParameters: function () { return [{ type: i1__namespace$2.Router }, { type: i1__namespace$2.ActivatedRoute }]; } });
11670
11753
 
11671
11754
  /**
11672
11755
  * Service to work with Other Income Forecasts
@@ -11957,14 +12040,14 @@
11957
12040
  };
11958
12041
  return KompassifyService;
11959
12042
  }());
11960
- 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 });
12043
+ 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 });
11961
12044
  KompassifyService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, providedIn: 'root' });
11962
12045
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, decorators: [{
11963
12046
  type: i0.Injectable,
11964
12047
  args: [{
11965
12048
  providedIn: 'root'
11966
12049
  }]
11967
- }], ctorParameters: function () { return [{ type: i1__namespace$1.Router }]; } });
12050
+ }], ctorParameters: function () { return [{ type: i1__namespace$2.Router }]; } });
11968
12051
 
11969
12052
  /**
11970
12053
  * Service that handling loans logic
@@ -12227,7 +12310,7 @@
12227
12310
  this.setDocumentTitle(pdf, title);
12228
12311
  this.setDocumentLogo(pdf);
12229
12312
  dataTables.forEach(function (dataTable) {
12230
- autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, _this.setTableOptions(pdf, dataTable.caption)));
12313
+ autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer || []] }, _this.setTableOptions(pdf, dataTable.caption)));
12231
12314
  });
12232
12315
  return pdf;
12233
12316
  };
@@ -12521,14 +12604,14 @@
12521
12604
  };
12522
12605
  return PropertyHoldingCostsService;
12523
12606
  }());
12524
- 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 });
12607
+ 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 });
12525
12608
  PropertyHoldingCostsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, providedIn: 'root' });
12526
12609
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, decorators: [{
12527
12610
  type: i0.Injectable,
12528
12611
  args: [{
12529
12612
  providedIn: 'root'
12530
12613
  }]
12531
- }], ctorParameters: function () { return [{ type: PdfService }, { type: i2__namespace.CurrencyPipe }, { type: i2__namespace.DatePipe }]; } });
12614
+ }], ctorParameters: function () { return [{ type: PdfService }, { type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
12532
12615
 
12533
12616
  /**
12534
12617
  * Service for work with Property Categories
@@ -14070,6 +14153,7 @@
14070
14153
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
14071
14154
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
14072
14155
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
14156
+ exports.DataTableService = DataTableService;
14073
14157
  exports.Depreciation = Depreciation;
14074
14158
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
14075
14159
  exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
@@ -14088,6 +14172,7 @@
14088
14172
  exports.DocumentFolder = DocumentFolder;
14089
14173
  exports.DocumentFolderService = DocumentFolderService;
14090
14174
  exports.ENDPOINTS = ENDPOINTS;
14175
+ exports.EXPORT_DATA_TABLE_COLUMNS = EXPORT_DATA_TABLE_COLUMNS;
14091
14176
  exports.EmployeeCollection = EmployeeCollection;
14092
14177
  exports.EmployeeDetails = EmployeeDetails;
14093
14178
  exports.EmployeeInvite = EmployeeInvite;