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.
- package/bundles/taxtank-core.umd.js +140 -218
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/bank-transaction.collection.js +1 -1
- package/esm2015/lib/collections/collection-dictionary.js +16 -1
- package/esm2015/lib/collections/depreciation.collection.js +2 -2
- package/esm2015/lib/collections/exportable.collection.js +17 -0
- package/esm2015/lib/collections/loan/loan-payment.collection.js +31 -0
- package/esm2015/lib/collections/loan/loan.collection.js +18 -0
- package/esm2015/lib/collections/report/property/property-report-item-transaction.collection.js +1 -1
- package/esm2015/lib/collections/report/vehicle-expense/vehicle-expense.collection.js +1 -1
- package/esm2015/lib/collections/transaction/transaction-allocation.collection.js +40 -0
- package/esm2015/lib/collections/transaction/transaction.collection.js +167 -0
- package/esm2015/lib/models/bank/bank-transaction.js +1 -1
- package/esm2015/lib/models/export/export-cell-type.enum.js +10 -0
- package/esm2015/lib/models/export/export-cell.js +6 -0
- package/esm2015/lib/models/export/export-data-table.js +1 -7
- package/esm2015/lib/models/income-source/income-source-chart-data.js +1 -1
- package/esm2015/lib/models/loan/loan-payment.js +2 -24
- package/esm2015/lib/models/logbook/vehicle-claim.js +1 -1
- package/esm2015/lib/models/property/property-equity-chart-data.js +1 -1
- package/esm2015/lib/models/report/property/property-report-item-transaction.js +1 -1
- package/esm2015/lib/models/transaction/transaction.js +1 -1
- package/esm2015/lib/services/account-setup/account-setup.service.js +2 -2
- package/esm2015/lib/services/bank/bank-account-calculation.service.js +1 -1
- package/esm2015/lib/services/bank/bank-transaction-calculation.service.js +1 -1
- package/esm2015/lib/services/export/export-formatter.service.js +31 -0
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +5 -79
- package/esm2015/lib/services/pdf/pdf.service.js +9 -4
- package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +1 -1
- package/esm2015/lib/services/report/property/property-transaction-report.service.js +2 -2
- package/esm2015/lib/services/transaction/transaction-calculation.service.js +2 -2
- package/esm2015/public-api.js +7 -10
- package/fesm2015/taxtank-core.js +121 -203
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/bank-transaction.collection.d.ts +1 -1
- package/lib/collections/collection-dictionary.d.ts +5 -0
- package/lib/collections/depreciation.collection.d.ts +1 -1
- package/lib/collections/exportable.collection.d.ts +9 -0
- package/lib/collections/loan/loan-payment.collection.d.ts +7 -0
- package/lib/collections/{loan.collection.d.ts → loan/loan.collection.d.ts} +2 -2
- package/lib/collections/report/property/property-report-item-transaction.collection.d.ts +1 -1
- package/lib/collections/report/vehicle-expense/vehicle-expense.collection.d.ts +1 -1
- package/lib/collections/{transaction-allocation.collection.d.ts → transaction/transaction-allocation.collection.d.ts} +6 -6
- package/lib/collections/{transaction.collection.d.ts → transaction/transaction.collection.d.ts} +9 -5
- package/lib/models/bank/bank-transaction.d.ts +1 -1
- package/lib/models/export/export-cell-type.enum.d.ts +8 -0
- package/lib/models/export/export-cell.d.ts +8 -0
- package/lib/models/export/export-data-table.d.ts +3 -2
- package/lib/models/income-source/income-source-chart-data.d.ts +1 -1
- package/lib/models/loan/loan-payment.d.ts +1 -5
- package/lib/models/logbook/vehicle-claim.d.ts +1 -1
- package/lib/models/property/property-equity-chart-data.d.ts +1 -1
- package/lib/models/report/property/property-report-item-transaction.d.ts +1 -1
- package/lib/models/transaction/transaction.d.ts +1 -1
- package/lib/services/bank/bank-account-calculation.service.d.ts +1 -1
- package/lib/services/bank/bank-transaction-calculation.service.d.ts +1 -1
- package/lib/services/export/export-formatter.service.d.ts +11 -0
- package/lib/services/http/bank/basiq/basiq.service.d.ts +2 -29
- package/lib/services/pdf/pdf.service.d.ts +3 -0
- package/lib/services/property/property-calculation/property-calculation.service.d.ts +2 -2
- package/lib/services/report/property/property-transaction-report.service.d.ts +1 -1
- package/lib/services/transaction/transaction-calculation.service.d.ts +2 -2
- package/package.json +1 -1
- package/public-api.d.ts +6 -9
- package/esm2015/lib/collections/loan.collection.js +0 -18
- package/esm2015/lib/collections/transaction-allocation.collection.js +0 -40
- package/esm2015/lib/collections/transaction.collection.js +0 -143
- package/esm2015/lib/interfaces/exportable.interface.js +0 -2
- package/esm2015/lib/services/data-table/data-table.service.js +0 -47
- package/esm2015/lib/services/property/property-holding-costs/property-holding-costs.service.js +0 -53
- package/lib/interfaces/exportable.interface.d.ts +0 -9
- package/lib/services/data-table/data-table.service.d.ts +0 -19
- package/lib/services/property/property-holding-costs/property-holding-costs.service.d.ts +0 -24
package/fesm2015/taxtank-core.js
CHANGED
|
@@ -799,6 +799,21 @@ class CollectionDictionary {
|
|
|
799
799
|
length() {
|
|
800
800
|
return this.keys.length;
|
|
801
801
|
}
|
|
802
|
+
/**
|
|
803
|
+
* @Todo find a better solution to get list of the sorted keys
|
|
804
|
+
* Get array of the "keys" by provided order
|
|
805
|
+
*/
|
|
806
|
+
getSortedKeys(isDesc = false) {
|
|
807
|
+
return this.keys.sort((a, b) => {
|
|
808
|
+
if (a > b) {
|
|
809
|
+
return !isDesc ? 1 : -1;
|
|
810
|
+
}
|
|
811
|
+
if (a < b) {
|
|
812
|
+
return !isDesc ? -1 : 1;
|
|
813
|
+
}
|
|
814
|
+
return 0;
|
|
815
|
+
});
|
|
816
|
+
}
|
|
802
817
|
/**
|
|
803
818
|
* Group collection items by passed path into items object
|
|
804
819
|
*/
|
|
@@ -1345,10 +1360,43 @@ var TankTypeEnum;
|
|
|
1345
1360
|
TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
|
|
1346
1361
|
})(TankTypeEnum || (TankTypeEnum = {}));
|
|
1347
1362
|
|
|
1363
|
+
/**
|
|
1364
|
+
* export table column
|
|
1365
|
+
*/
|
|
1366
|
+
class ExportCell {
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* type of export table column value
|
|
1371
|
+
*/
|
|
1372
|
+
var ExportCellTypeEnum;
|
|
1373
|
+
(function (ExportCellTypeEnum) {
|
|
1374
|
+
ExportCellTypeEnum[ExportCellTypeEnum["STRING"] = 0] = "STRING";
|
|
1375
|
+
ExportCellTypeEnum[ExportCellTypeEnum["CURRENCY"] = 1] = "CURRENCY";
|
|
1376
|
+
ExportCellTypeEnum[ExportCellTypeEnum["DATE"] = 2] = "DATE";
|
|
1377
|
+
})(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
|
|
1378
|
+
|
|
1379
|
+
class ExportDataTable {
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
class ExportableCollection extends Collection {
|
|
1383
|
+
getExportFooter(type) {
|
|
1384
|
+
return [];
|
|
1385
|
+
}
|
|
1386
|
+
;
|
|
1387
|
+
export(type) {
|
|
1388
|
+
return plainToClass(ExportDataTable, {
|
|
1389
|
+
header: this.getExportHeader(type),
|
|
1390
|
+
body: this.getExportBody(type),
|
|
1391
|
+
footer: [this.getExportFooter(type)]
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1348
1396
|
/**
|
|
1349
1397
|
* Collection of transactions
|
|
1350
1398
|
*/
|
|
1351
|
-
class TransactionCollection extends
|
|
1399
|
+
class TransactionCollection extends ExportableCollection {
|
|
1352
1400
|
/**
|
|
1353
1401
|
* Get total amount of all transactions in the collection
|
|
1354
1402
|
*/
|
|
@@ -1484,6 +1532,27 @@ class TransactionCollection extends Collection {
|
|
|
1484
1532
|
}
|
|
1485
1533
|
}));
|
|
1486
1534
|
}
|
|
1535
|
+
getExportHeader() {
|
|
1536
|
+
return ['Date', 'Description', 'Debit', 'Credit'];
|
|
1537
|
+
}
|
|
1538
|
+
getExportFooter() {
|
|
1539
|
+
return [
|
|
1540
|
+
plainToClass(ExportCell, { value: 'Total', type: ExportCellTypeEnum.STRING }),
|
|
1541
|
+
plainToClass(ExportCell, { value: '', type: ExportCellTypeEnum.STRING }),
|
|
1542
|
+
plainToClass(ExportCell, { value: this.sumBy('debit'), type: ExportCellTypeEnum.CURRENCY }),
|
|
1543
|
+
plainToClass(ExportCell, { value: this.sumBy('credit'), type: ExportCellTypeEnum.CURRENCY })
|
|
1544
|
+
];
|
|
1545
|
+
}
|
|
1546
|
+
getExportBody() {
|
|
1547
|
+
return this.items.map((transaction) => {
|
|
1548
|
+
return [
|
|
1549
|
+
plainToClass(ExportCell, { value: transaction.date, type: ExportCellTypeEnum.DATE }),
|
|
1550
|
+
plainToClass(ExportCell, { value: transaction.description, type: ExportCellTypeEnum.STRING }),
|
|
1551
|
+
plainToClass(ExportCell, { value: transaction.debit, type: ExportCellTypeEnum.CURRENCY }),
|
|
1552
|
+
plainToClass(ExportCell, { value: transaction.credit, type: ExportCellTypeEnum.CURRENCY })
|
|
1553
|
+
];
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1487
1556
|
}
|
|
1488
1557
|
|
|
1489
1558
|
class DepreciationCollection extends Collection {
|
|
@@ -1649,6 +1718,33 @@ class LoanCollection extends Collection {
|
|
|
1649
1718
|
}
|
|
1650
1719
|
}
|
|
1651
1720
|
|
|
1721
|
+
class LoanPaymentCollection extends ExportableCollection {
|
|
1722
|
+
getExportHeader() {
|
|
1723
|
+
return [
|
|
1724
|
+
'Pmt No.',
|
|
1725
|
+
'Date',
|
|
1726
|
+
'Payment Due',
|
|
1727
|
+
'Interest Accrued',
|
|
1728
|
+
'Principal Paid',
|
|
1729
|
+
'Principal Balance',
|
|
1730
|
+
'Payout'
|
|
1731
|
+
];
|
|
1732
|
+
}
|
|
1733
|
+
getExportBody() {
|
|
1734
|
+
return this.items.map((payment) => {
|
|
1735
|
+
return [
|
|
1736
|
+
plainToClass(ExportCell, { value: payment.number, type: ExportCellTypeEnum.STRING }),
|
|
1737
|
+
plainToClass(ExportCell, { value: payment.date, type: ExportCellTypeEnum.DATE }),
|
|
1738
|
+
plainToClass(ExportCell, { value: payment.paymentDue, type: ExportCellTypeEnum.CURRENCY }),
|
|
1739
|
+
plainToClass(ExportCell, { value: payment.interestAccrued, type: ExportCellTypeEnum.CURRENCY }),
|
|
1740
|
+
plainToClass(ExportCell, { value: payment.principalPaid, type: ExportCellTypeEnum.CURRENCY }),
|
|
1741
|
+
plainToClass(ExportCell, { value: payment.principalBalance, type: ExportCellTypeEnum.CURRENCY }),
|
|
1742
|
+
plainToClass(ExportCell, { value: payment.payout, type: ExportCellTypeEnum.CURRENCY }),
|
|
1743
|
+
];
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1652
1748
|
class MessageCollection extends Collection {
|
|
1653
1749
|
getFirstUnreadMessage(user) {
|
|
1654
1750
|
return this.items.find((message) => {
|
|
@@ -3371,47 +3467,11 @@ var LoanVehicleTypeEnum;
|
|
|
3371
3467
|
LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
|
|
3372
3468
|
})(LoanVehicleTypeEnum || (LoanVehicleTypeEnum = {}));
|
|
3373
3469
|
|
|
3374
|
-
/**
|
|
3375
|
-
* Class with structure of the data-table rows
|
|
3376
|
-
*/
|
|
3377
|
-
class ExportRow {
|
|
3378
|
-
}
|
|
3379
|
-
|
|
3380
|
-
/**
|
|
3381
|
-
* Enum which shows what type (in terms of business logic) of the data-table row item
|
|
3382
|
-
*/
|
|
3383
|
-
var ExportRowDataTypeEnum;
|
|
3384
|
-
(function (ExportRowDataTypeEnum) {
|
|
3385
|
-
ExportRowDataTypeEnum[ExportRowDataTypeEnum["STRING"] = 0] = "STRING";
|
|
3386
|
-
ExportRowDataTypeEnum[ExportRowDataTypeEnum["CURRENCY"] = 1] = "CURRENCY";
|
|
3387
|
-
ExportRowDataTypeEnum[ExportRowDataTypeEnum["DATE"] = 2] = "DATE";
|
|
3388
|
-
})(ExportRowDataTypeEnum || (ExportRowDataTypeEnum = {}));
|
|
3389
|
-
|
|
3390
|
-
const EXPORT_DATA_TABLE_COLUMNS = [
|
|
3391
|
-
'Pmt No.',
|
|
3392
|
-
'Date',
|
|
3393
|
-
'Payment Due',
|
|
3394
|
-
'Interest Accrued',
|
|
3395
|
-
'Principal Paid',
|
|
3396
|
-
'Principal Balance',
|
|
3397
|
-
'Payout'
|
|
3398
|
-
];
|
|
3399
3470
|
// @Todo no base model from backend list
|
|
3400
3471
|
/**
|
|
3401
3472
|
* Loan payment class
|
|
3402
3473
|
*/
|
|
3403
3474
|
class LoanPayment {
|
|
3404
|
-
toDataTableRows() {
|
|
3405
|
-
return [
|
|
3406
|
-
plainToClass(ExportRow, { data: this.number, type: ExportRowDataTypeEnum.STRING }),
|
|
3407
|
-
plainToClass(ExportRow, { data: this.date, type: ExportRowDataTypeEnum.DATE }),
|
|
3408
|
-
plainToClass(ExportRow, { data: this.paymentDue, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
3409
|
-
plainToClass(ExportRow, { data: this.interestAccrued, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
3410
|
-
plainToClass(ExportRow, { data: this.principalPaid, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
3411
|
-
plainToClass(ExportRow, { data: this.principalBalance, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
3412
|
-
plainToClass(ExportRow, { data: this.payout, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
3413
|
-
];
|
|
3414
|
-
}
|
|
3415
3475
|
}
|
|
3416
3476
|
__decorate([
|
|
3417
3477
|
Type(() => Date)
|
|
@@ -5885,15 +5945,6 @@ var AppEventTypeEnum;
|
|
|
5885
5945
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 42] = "VEHICLE_LOGBOOK_DELETED";
|
|
5886
5946
|
})(AppEventTypeEnum || (AppEventTypeEnum = {}));
|
|
5887
5947
|
|
|
5888
|
-
/**
|
|
5889
|
-
* Data table structure suitable for export
|
|
5890
|
-
*/
|
|
5891
|
-
class ExportDataTable {
|
|
5892
|
-
constructor() {
|
|
5893
|
-
this.footer = [];
|
|
5894
|
-
}
|
|
5895
|
-
}
|
|
5896
|
-
|
|
5897
5948
|
var ExportFormatEnum;
|
|
5898
5949
|
(function (ExportFormatEnum) {
|
|
5899
5950
|
ExportFormatEnum["PDF"] = "PDF";
|
|
@@ -8408,14 +8459,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8408
8459
|
}]
|
|
8409
8460
|
}] });
|
|
8410
8461
|
|
|
8411
|
-
|
|
8412
|
-
* Basiq consent UI initial URL. Replace USER_ID and TOKEN by user data + handle action parameter
|
|
8413
|
-
*/
|
|
8414
|
-
const BASIQ_CONSENT_URL = 'https://consent.basiq.io/home?userId=USER_ID&token=TOKEN&action=connect';
|
|
8415
|
-
/**
|
|
8416
|
-
* Event message name we listen to handle basiq UI result
|
|
8417
|
-
*/
|
|
8418
|
-
const FINISH_BASIQ_EVENT = 'finish-basiq';
|
|
8462
|
+
// @TODO Basiq 1.0 remove if we will use basiq 2.0 or refactor if we stay with basiq 1.0
|
|
8419
8463
|
/**
|
|
8420
8464
|
* basiq is a middleman between bank and user
|
|
8421
8465
|
* service is responsible for fetching bank related information
|
|
@@ -8433,23 +8477,6 @@ class BasiqService extends RestService {
|
|
|
8433
8477
|
listenEvents() {
|
|
8434
8478
|
this.listenToBankConnectionAdded();
|
|
8435
8479
|
this.listenNotifications();
|
|
8436
|
-
this.listenBasiqConcentUpdated();
|
|
8437
|
-
}
|
|
8438
|
-
/**
|
|
8439
|
-
* Update user's basiq consents data on backend
|
|
8440
|
-
*/
|
|
8441
|
-
confirmConsents() {
|
|
8442
|
-
return this.http.put(`${this.environment.apiV2}/basiq/consents`, {}).pipe(map((isConfirmed) => {
|
|
8443
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
|
|
8444
|
-
}));
|
|
8445
|
-
}
|
|
8446
|
-
/**
|
|
8447
|
-
* Notify backend to update connections
|
|
8448
|
-
*/
|
|
8449
|
-
updateConnections() {
|
|
8450
|
-
return this.http.post(`${this.environment.apiV2}/basiq/connections`, {}).pipe(map((connections) => {
|
|
8451
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_CONNECTION_UPDATED, !!connections));
|
|
8452
|
-
}));
|
|
8453
8480
|
}
|
|
8454
8481
|
/**
|
|
8455
8482
|
* access token to use basiq connect ui iframe
|
|
@@ -8462,15 +8489,11 @@ class BasiqService extends RestService {
|
|
|
8462
8489
|
return new BasiqToken(response['access_token'], new Date(now + response['expires_in'] * 1000));
|
|
8463
8490
|
}))
|
|
8464
8491
|
.subscribe((token) => {
|
|
8465
|
-
this.token = token;
|
|
8466
8492
|
this.tokenSubject.next(token);
|
|
8467
8493
|
});
|
|
8468
8494
|
}
|
|
8469
8495
|
return this.tokenSubject.asObservable();
|
|
8470
8496
|
}
|
|
8471
|
-
/**
|
|
8472
|
-
* Get list of user's bank conections
|
|
8473
|
-
*/
|
|
8474
8497
|
getConnections() {
|
|
8475
8498
|
return this.get().pipe(map((bankAccounts) => {
|
|
8476
8499
|
// get all connections
|
|
@@ -8481,40 +8504,6 @@ class BasiqService extends RestService {
|
|
|
8481
8504
|
return [...new Map(connections.map((connection) => [connection.id, connection])).values()];
|
|
8482
8505
|
}));
|
|
8483
8506
|
}
|
|
8484
|
-
/**
|
|
8485
|
-
* Listen response from basiq UI to handle result.
|
|
8486
|
-
* @param isBasiqConsentExist flag from User.ClientDetails - true if user confirmed basiq consent
|
|
8487
|
-
* @param callback function we run after basiq UI work is finished
|
|
8488
|
-
*/
|
|
8489
|
-
listenBasiqResponse(isBasiqConsentExist, callback) {
|
|
8490
|
-
window.addEventListener('message', (message) => {
|
|
8491
|
-
if (message.data !== FINISH_BASIQ_EVENT) {
|
|
8492
|
-
return;
|
|
8493
|
-
}
|
|
8494
|
-
// update user's basiq consent confirmation status for the first basiq ui run
|
|
8495
|
-
if (isBasiqConsentExist) {
|
|
8496
|
-
this.updateConnections().pipe(take(1)).subscribe();
|
|
8497
|
-
}
|
|
8498
|
-
else {
|
|
8499
|
-
this.confirmConsents().pipe(take(1)).subscribe();
|
|
8500
|
-
}
|
|
8501
|
-
callback();
|
|
8502
|
-
}, { once: true });
|
|
8503
|
-
}
|
|
8504
|
-
/**
|
|
8505
|
-
* Get URL with filled params to run basiq UI iframe
|
|
8506
|
-
*/
|
|
8507
|
-
generateBasiqConsentUrl(user) {
|
|
8508
|
-
return this.getToken().pipe(map((token) => {
|
|
8509
|
-
let url = BASIQ_CONSENT_URL;
|
|
8510
|
-
url = url.replace('USER_ID', user.basiqId);
|
|
8511
|
-
url = url.replace('TOKEN', token.value);
|
|
8512
|
-
if (!user.clientDetails.basiqConsentExist) {
|
|
8513
|
-
url = url.split('&action')[0];
|
|
8514
|
-
}
|
|
8515
|
-
return url;
|
|
8516
|
-
}));
|
|
8517
|
-
}
|
|
8518
8507
|
/**
|
|
8519
8508
|
* Listen to EventDispatcherService event related to added Bank connection
|
|
8520
8509
|
*/
|
|
@@ -8537,17 +8526,6 @@ class BasiqService extends RestService {
|
|
|
8537
8526
|
}
|
|
8538
8527
|
});
|
|
8539
8528
|
}
|
|
8540
|
-
/**
|
|
8541
|
-
* Update user's basiq connections when user confirmed basiq consent
|
|
8542
|
-
*/
|
|
8543
|
-
listenBasiqConcentUpdated() {
|
|
8544
|
-
this.eventDispatcherService.on(AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe((isConfirmed) => {
|
|
8545
|
-
if (!isConfirmed) {
|
|
8546
|
-
return;
|
|
8547
|
-
}
|
|
8548
|
-
this.updateConnections().pipe(take(1)).subscribe();
|
|
8549
|
-
});
|
|
8550
|
-
}
|
|
8551
8529
|
}
|
|
8552
8530
|
BasiqService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8553
8531
|
BasiqService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, providedIn: 'root' });
|
|
@@ -9582,41 +9560,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
9582
9560
|
args: ['environment']
|
|
9583
9561
|
}] }]; } });
|
|
9584
9562
|
|
|
9585
|
-
|
|
9586
|
-
* Service to handle array-like data table logic
|
|
9587
|
-
*/
|
|
9588
|
-
class DataTableService {
|
|
9563
|
+
class ExportFormatterService {
|
|
9589
9564
|
constructor(currencyPipe, datePipe) {
|
|
9590
9565
|
this.currencyPipe = currencyPipe;
|
|
9591
9566
|
this.datePipe = datePipe;
|
|
9592
9567
|
}
|
|
9593
|
-
|
|
9594
|
-
return
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
return model.toDataTableRows().map((row) => {
|
|
9605
|
-
switch (row.type) {
|
|
9606
|
-
case ExportRowDataTypeEnum.DATE:
|
|
9607
|
-
return this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
|
|
9608
|
-
case ExportRowDataTypeEnum.CURRENCY:
|
|
9609
|
-
return this.currencyPipe.transform(row.data).toString();
|
|
9610
|
-
default:
|
|
9611
|
-
return row.data.toString();
|
|
9612
|
-
}
|
|
9613
|
-
});
|
|
9614
|
-
});
|
|
9568
|
+
format(rows) {
|
|
9569
|
+
return rows.map((row) => row.map((column) => {
|
|
9570
|
+
switch (column.type) {
|
|
9571
|
+
case ExportCellTypeEnum.DATE:
|
|
9572
|
+
return this.datePipe.transform(column.value, 'dd/MM/YYYY').toString();
|
|
9573
|
+
case ExportCellTypeEnum.CURRENCY:
|
|
9574
|
+
return this.currencyPipe.transform(column.value).toString();
|
|
9575
|
+
default:
|
|
9576
|
+
return column.value.toString();
|
|
9577
|
+
}
|
|
9578
|
+
}));
|
|
9615
9579
|
}
|
|
9616
9580
|
}
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
9581
|
+
ExportFormatterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ExportFormatterService, deps: [{ token: i1$1.CurrencyPipe }, { token: i1$1.DatePipe }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9582
|
+
ExportFormatterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ExportFormatterService, providedIn: 'root' });
|
|
9583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ExportFormatterService, decorators: [{
|
|
9620
9584
|
type: Injectable,
|
|
9621
9585
|
args: [{
|
|
9622
9586
|
providedIn: 'root'
|
|
@@ -10143,9 +10107,13 @@ const PDF_CONFIG = {
|
|
|
10143
10107
|
};
|
|
10144
10108
|
|
|
10145
10109
|
/**
|
|
10110
|
+
* @TODO vik refactor
|
|
10146
10111
|
* Service to work with PDF (generate, download, e.t.c.)
|
|
10147
10112
|
*/
|
|
10148
10113
|
class PdfService {
|
|
10114
|
+
constructor(formatter) {
|
|
10115
|
+
this.formatter = formatter;
|
|
10116
|
+
}
|
|
10149
10117
|
/**
|
|
10150
10118
|
* Export file from provided HTML tables
|
|
10151
10119
|
*/
|
|
@@ -10168,7 +10136,7 @@ class PdfService {
|
|
|
10168
10136
|
this.setDocumentTitle(pdf, title);
|
|
10169
10137
|
this.setDocumentLogo(pdf);
|
|
10170
10138
|
dataTables.forEach((dataTable) => {
|
|
10171
|
-
autoTable(pdf, Object.assign({ head: [dataTable.header], body: dataTable.
|
|
10139
|
+
autoTable(pdf, Object.assign({ head: [dataTable.header], body: this.formatter.format(dataTable.body), foot: this.formatter.format(dataTable.footer) }, this.setTableOptions(pdf, dataTable.caption)));
|
|
10172
10140
|
});
|
|
10173
10141
|
return pdf;
|
|
10174
10142
|
}
|
|
@@ -10222,14 +10190,14 @@ class PdfService {
|
|
|
10222
10190
|
doc.addImage(logo, 'PNG', doc.internal.pageSize.width - PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
10223
10191
|
}
|
|
10224
10192
|
}
|
|
10225
|
-
PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10193
|
+
PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [{ token: ExportFormatterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10226
10194
|
PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
|
|
10227
10195
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, decorators: [{
|
|
10228
10196
|
type: Injectable,
|
|
10229
10197
|
args: [{
|
|
10230
10198
|
providedIn: 'root'
|
|
10231
10199
|
}]
|
|
10232
|
-
}] });
|
|
10200
|
+
}], ctorParameters: function () { return [{ type: ExportFormatterService }]; } });
|
|
10233
10201
|
|
|
10234
10202
|
/**
|
|
10235
10203
|
* Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
|
|
@@ -10407,52 +10375,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10407
10375
|
}]
|
|
10408
10376
|
}] });
|
|
10409
10377
|
|
|
10410
|
-
/**
|
|
10411
|
-
* Service to work with holding costs (transactions related to vacant land property)
|
|
10412
|
-
*/
|
|
10413
|
-
class PropertyHoldingCostsService {
|
|
10414
|
-
constructor(pdfService, currencyPipe, datePipe) {
|
|
10415
|
-
this.pdfService = pdfService;
|
|
10416
|
-
this.currencyPipe = currencyPipe;
|
|
10417
|
-
this.datePipe = datePipe;
|
|
10418
|
-
this.url = 'transactions';
|
|
10419
|
-
this.modelClass = Transaction;
|
|
10420
|
-
}
|
|
10421
|
-
initDataTable(holdingCosts) {
|
|
10422
|
-
return plainToClass(ExportDataTable, {
|
|
10423
|
-
header: ['Date', 'Description', 'Debit', 'Credit'],
|
|
10424
|
-
rows: this.getDataTableRows(holdingCosts),
|
|
10425
|
-
footer: [
|
|
10426
|
-
'Total',
|
|
10427
|
-
'',
|
|
10428
|
-
this.currencyPipe.transform(holdingCosts.sumBy('debit')).toString(),
|
|
10429
|
-
this.currencyPipe.transform(holdingCosts.sumBy('credit')).toString(),
|
|
10430
|
-
]
|
|
10431
|
-
});
|
|
10432
|
-
}
|
|
10433
|
-
/**
|
|
10434
|
-
* Get data for the exporting table rows
|
|
10435
|
-
*/
|
|
10436
|
-
getDataTableRows(holdingCosts) {
|
|
10437
|
-
return holdingCosts.items.map((transaction) => {
|
|
10438
|
-
return [
|
|
10439
|
-
this.datePipe.transform(transaction.date, 'dd/MM/YYYY').toString(),
|
|
10440
|
-
transaction.description,
|
|
10441
|
-
this.currencyPipe.transform(transaction.debit).toString(),
|
|
10442
|
-
this.currencyPipe.transform(transaction.credit).toString()
|
|
10443
|
-
];
|
|
10444
|
-
});
|
|
10445
|
-
}
|
|
10446
|
-
}
|
|
10447
|
-
PropertyHoldingCostsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i1$1.CurrencyPipe }, { token: i1$1.DatePipe }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10448
|
-
PropertyHoldingCostsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, providedIn: 'root' });
|
|
10449
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, decorators: [{
|
|
10450
|
-
type: Injectable,
|
|
10451
|
-
args: [{
|
|
10452
|
-
providedIn: 'root'
|
|
10453
|
-
}]
|
|
10454
|
-
}], ctorParameters: function () { return [{ type: PdfService }, { type: i1$1.CurrencyPipe }, { type: i1$1.DatePipe }]; } });
|
|
10455
|
-
|
|
10456
10378
|
/**
|
|
10457
10379
|
* Service for work with Property Categories
|
|
10458
10380
|
*/
|
|
@@ -11804,13 +11726,9 @@ class VehicleClaimForm extends AbstractForm {
|
|
|
11804
11726
|
}
|
|
11805
11727
|
}
|
|
11806
11728
|
|
|
11807
|
-
/**
|
|
11808
|
-
* Public API Surface of tt-core
|
|
11809
|
-
*/
|
|
11810
|
-
|
|
11811
11729
|
/**
|
|
11812
11730
|
* Generated bundle index. Do not edit.
|
|
11813
11731
|
*/
|
|
11814
11732
|
|
|
11815
|
-
export { AbstractForm, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES,
|
|
11733
|
+
export { AbstractForm, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, ExportFormatterService, ExportableCollection, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSoleEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPaymentCollection, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfOrientationEnum, PdfService, PdfSettings, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductIdEnum, ServiceProductStatusEnum, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCategoryEnum, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimForm, VehicleClaimMethodEnum, VehicleClaimService, VehicleCollection, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
|
|
11816
11734
|
//# sourceMappingURL=taxtank-core.js.map
|