taxtank-core 0.10.6 → 0.12.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 +1723 -1351
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/account-setup-item.collection.js +11 -0
- package/esm2015/lib/collections/bank-transaction.collection.js +2 -2
- package/esm2015/lib/collections/collection-dictionary.js +4 -4
- package/esm2015/lib/collections/collection.js +4 -1
- package/esm2015/lib/collections/depreciation.collection.js +24 -10
- package/esm2015/lib/collections/transaction-allocation.collection.js +2 -2
- package/esm2015/lib/collections/transaction.collection.js +28 -1
- package/esm2015/lib/collections/vehicle-logbook.collection.js +88 -0
- package/esm2015/lib/collections/vehicle.collection.js +9 -0
- package/esm2015/lib/db/Enums/chart-accounts-heading-vehicle-list.enum.js +3 -1
- package/esm2015/lib/db/Enums/chart-accounts-list.enum.js +4 -3
- package/esm2015/lib/db/Enums/property/property-category-list.enum.js +2 -1
- package/esm2015/lib/db/Enums/user-status.enum.js +1 -2
- package/esm2015/lib/db/Models/client-details.js +1 -1
- package/esm2015/lib/db/Models/client-income-types.js +3 -0
- package/esm2015/lib/db/Models/vehicle-claim.js +1 -1
- package/esm2015/lib/db/Models/vehicle.js +1 -1
- package/esm2015/lib/forms/client/client-income-types.form.js +22 -0
- package/esm2015/lib/forms/index.js +4 -1
- package/esm2015/lib/forms/vehicle/vehicle-claim.form.js +114 -0
- package/esm2015/lib/forms/vehicle/vehicle.form.js +20 -0
- package/esm2015/lib/interfaces/event-listener.interface.js +1 -1
- package/esm2015/lib/interfaces/expense.interface.js +2 -0
- package/esm2015/lib/interfaces/tank.interface.js +1 -1
- package/esm2015/lib/models/account-setup/account-setup-item.js +6 -0
- package/esm2015/lib/models/account-setup/account-setup-items.const.js +44 -0
- package/esm2015/lib/models/account-setup/account-setup-items.enum.js +14 -0
- package/esm2015/lib/models/chart-accounts/chart-accounts-value.js +4 -0
- package/esm2015/lib/models/chart-accounts/chart-accounts.js +34 -1
- package/esm2015/lib/models/client/client-income-types.js +10 -0
- package/esm2015/lib/models/depreciation/depreciation.js +5 -1
- package/esm2015/lib/models/event/app-event-type.enum.js +4 -1
- package/esm2015/lib/models/export/export-data-table.js +6 -0
- package/esm2015/lib/models/logbook/logbook-period.js +8 -1
- package/esm2015/lib/models/logbook/vehicle-claim.js +63 -4
- package/esm2015/lib/models/logbook/vehicle-logbook.js +9 -3
- package/esm2015/lib/models/logbook/vehicle.js +7 -29
- package/esm2015/lib/models/pdf/pdf-config.js +2 -2
- package/esm2015/lib/models/pdf/pdf-orientation.enum.js +6 -0
- package/esm2015/lib/models/transaction/transaction.js +1 -1
- package/esm2015/lib/services/account-setup/account-setup.service.js +109 -0
- package/esm2015/lib/services/http/bank/bank-account/bank-account.service.js +6 -15
- package/esm2015/lib/services/http/bank/bank-connection/bank-connection.service.js +6 -15
- package/esm2015/lib/services/http/bank/bank-transaction/bank-transaction.service.js +6 -15
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +6 -15
- package/esm2015/lib/services/http/chart-accounts/chart-accounts.service.js +1 -1
- package/esm2015/lib/services/http/chat/chat.service.js +8 -12
- package/esm2015/lib/services/http/chat/message/message.service.js +8 -12
- package/esm2015/lib/services/http/chat/message-document/message-document.service.js +1 -1
- package/esm2015/lib/services/http/depreciation/depreciation.service.js +6 -23
- package/esm2015/lib/services/http/document/document-folder/document-folder.service.js +6 -14
- package/esm2015/lib/services/http/firm/client-income/client-income-types.service.js +50 -0
- package/esm2015/lib/services/http/firm/client-movement/client-movement.service.js +6 -15
- package/esm2015/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.js +6 -15
- package/esm2015/lib/services/http/income-source/income-source.service.js +6 -14
- package/esm2015/lib/services/http/income-source/salary-forecast/salary-forecast.service.js +6 -15
- package/esm2015/lib/services/http/income-source/sole-forecast/sole-forecast.service.js +6 -15
- package/esm2015/lib/services/http/loan/loan.service.js +6 -15
- package/esm2015/lib/services/http/property/property-document/property-document.service.js +6 -15
- package/esm2015/lib/services/http/property/property-share/property-share.service.js +6 -15
- package/esm2015/lib/services/http/property/property.service.js +6 -15
- package/esm2015/lib/services/http/rest/rest.service.js +31 -4
- package/esm2015/lib/services/http/service-notification/service-notification.service.js +8 -12
- package/esm2015/lib/services/http/subscription/subscription.service.js +1 -4
- package/esm2015/lib/services/http/tax-review/tax-review-history/tax-review-history.service.js +15 -16
- package/esm2015/lib/services/http/tax-review/tax-review.service.js +6 -15
- package/esm2015/lib/services/http/tax-summary/tax-summary.service.js +1 -1
- package/esm2015/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.js +6 -15
- package/esm2015/lib/services/http/transaction/transaction.service.js +16 -25
- package/esm2015/lib/services/http/user/user-event-setting/user-event-setting.service.js +6 -14
- package/esm2015/lib/services/http/user/user-event-type/user-event-type.service.js +6 -14
- package/esm2015/lib/services/http/vehicle/messages.enum.js +13 -0
- package/esm2015/lib/services/http/vehicle/vehicle-claim.service.js +24 -0
- package/esm2015/lib/services/http/vehicle/vehicle-logbook.service.js +59 -0
- package/esm2015/lib/services/http/vehicle/vehicle.service.js +49 -213
- package/esm2015/lib/services/pdf/pdf.service.js +51 -26
- package/esm2015/lib/services/property/property-holding-costs/property-holding-costs.service.js +53 -0
- package/esm2015/lib/validators/at-least-one.validator.js +11 -0
- package/esm2015/lib/validators/index.js +2 -0
- package/esm2015/public-api.js +16 -2
- package/fesm2015/taxtank-core.js +1536 -1155
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/account-setup-item.collection.d.ts +6 -0
- package/lib/collections/collection.d.ts +1 -0
- package/lib/collections/depreciation.collection.d.ts +5 -4
- package/lib/collections/transaction.collection.d.ts +9 -0
- package/lib/collections/vehicle-logbook.collection.d.ts +30 -0
- package/lib/collections/vehicle.collection.d.ts +6 -0
- package/lib/db/Enums/chart-accounts-heading-vehicle-list.enum.d.ts +3 -1
- package/lib/db/Enums/chart-accounts-list.enum.d.ts +4 -3
- package/lib/db/Enums/property/property-category-list.enum.d.ts +2 -1
- package/lib/db/Enums/user-status.enum.d.ts +1 -2
- package/lib/db/Models/client-details.d.ts +5 -1
- package/lib/db/Models/client-income-types.d.ts +11 -0
- package/lib/db/Models/vehicle-claim.d.ts +2 -0
- package/lib/db/Models/vehicle.d.ts +2 -0
- package/lib/forms/client/client-income-types.form.d.ts +7 -0
- package/lib/forms/index.d.ts +3 -0
- package/lib/forms/vehicle/vehicle-claim.form.d.ts +43 -0
- package/lib/forms/vehicle/vehicle.form.d.ts +11 -0
- package/lib/interfaces/event-listener.interface.d.ts +1 -0
- package/lib/interfaces/expense.interface.d.ts +12 -0
- package/lib/interfaces/tank.interface.d.ts +2 -0
- package/lib/models/account-setup/account-setup-item.d.ts +9 -0
- package/lib/models/account-setup/account-setup-items.const.d.ts +7 -0
- package/lib/models/account-setup/account-setup-items.enum.d.ts +12 -0
- package/lib/models/chart-accounts/chart-accounts-value.d.ts +3 -0
- package/lib/models/chart-accounts/chart-accounts.d.ts +18 -0
- package/lib/models/client/client-income-types.d.ts +7 -0
- package/lib/models/depreciation/depreciation.d.ts +6 -2
- package/lib/models/event/app-event-type.enum.d.ts +4 -1
- package/lib/models/export/export-data-table.d.ts +9 -0
- package/lib/models/logbook/logbook-period.d.ts +4 -0
- package/lib/models/logbook/vehicle-claim.d.ts +20 -3
- package/lib/models/logbook/vehicle-logbook.d.ts +8 -2
- package/lib/models/logbook/vehicle.d.ts +5 -7
- package/lib/models/pdf/pdf-orientation.enum.d.ts +4 -0
- package/lib/models/transaction/transaction.d.ts +2 -2
- package/lib/services/account-setup/account-setup.service.d.ts +43 -0
- package/lib/services/http/bank/bank-account/bank-account.service.d.ts +2 -7
- package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +2 -7
- package/lib/services/http/bank/bank-transaction/bank-transaction.service.d.ts +3 -8
- package/lib/services/http/bank/basiq/basiq.service.d.ts +2 -7
- package/lib/services/http/chat/chat.service.d.ts +4 -7
- package/lib/services/http/chat/message/message.service.d.ts +4 -7
- package/lib/services/http/chat/message-document/message-document.service.d.ts +3 -3
- package/lib/services/http/depreciation/depreciation.service.d.ts +2 -11
- package/lib/services/http/document/document-folder/document-folder.service.d.ts +0 -6
- package/lib/services/http/firm/client-income/client-income-types.service.d.ts +18 -0
- package/lib/services/http/firm/client-movement/client-movement.service.d.ts +2 -7
- package/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.d.ts +2 -7
- package/lib/services/http/income-source/income-source.service.d.ts +0 -6
- package/lib/services/http/income-source/salary-forecast/salary-forecast.service.d.ts +1 -7
- package/lib/services/http/income-source/sole-forecast/sole-forecast.service.d.ts +2 -7
- package/lib/services/http/loan/loan.service.d.ts +2 -7
- package/lib/services/http/property/property-document/property-document.service.d.ts +3 -8
- package/lib/services/http/property/property-share/property-share.service.d.ts +2 -7
- package/lib/services/http/property/property.service.d.ts +2 -7
- package/lib/services/http/rest/rest.service.d.ts +17 -2
- package/lib/services/http/service-notification/service-notification.service.d.ts +4 -7
- package/lib/services/http/subscription/subscription.service.d.ts +0 -1
- package/lib/services/http/tax-review/tax-review-history/tax-review-history.service.d.ts +7 -7
- package/lib/services/http/tax-review/tax-review.service.d.ts +1 -7
- package/lib/services/http/tax-summary/tax-summary.service.d.ts +2 -1
- package/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.d.ts +3 -8
- package/lib/services/http/transaction/transaction.service.d.ts +4 -12
- package/lib/services/http/user/user-event-setting/user-event-setting.service.d.ts +0 -6
- package/lib/services/http/user/user-event-type/user-event-type.service.d.ts +0 -6
- package/lib/services/http/vehicle/messages.enum.d.ts +11 -0
- package/lib/services/http/vehicle/vehicle-claim.service.d.ts +13 -0
- package/lib/services/http/vehicle/vehicle-logbook.service.d.ts +22 -0
- package/lib/services/http/vehicle/vehicle.service.d.ts +17 -80
- package/lib/services/pdf/pdf.service.d.ts +16 -2
- package/lib/services/property/property-holding-costs/property-holding-costs.service.d.ts +24 -0
- package/lib/validators/at-least-one.validator.d.ts +6 -0
- package/lib/validators/index.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +15 -1
- package/esm2015/lib/collections/logbook.collection.js +0 -97
- package/lib/collections/logbook.collection.d.ts +0 -19
package/fesm2015/taxtank-core.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, Inject, NgModule, EventEmitter } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/common';
|
|
3
4
|
import { CommonModule } from '@angular/common';
|
|
4
5
|
import * as i1 from '@angular/common/http';
|
|
5
6
|
import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
6
|
-
import { ReplaySubject, BehaviorSubject, throwError, Subject,
|
|
7
|
+
import { ReplaySubject, BehaviorSubject, throwError, Subject, combineLatest, Observable, forkJoin } from 'rxjs';
|
|
7
8
|
import { map, catchError, filter, take, switchMap, finalize, mergeMap } from 'rxjs/operators';
|
|
8
9
|
import { plainToClass, Type, Exclude, Transform, Expose, classToPlain } from 'class-transformer';
|
|
9
10
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
10
|
-
import has from 'lodash/has';
|
|
11
11
|
import get from 'lodash/get';
|
|
12
12
|
import flatten from 'lodash/flatten';
|
|
13
|
+
import hasIn from 'lodash/hasIn';
|
|
13
14
|
import first from 'lodash/first';
|
|
14
15
|
import last from 'lodash/last';
|
|
15
16
|
import uniqBy from 'lodash/uniqBy';
|
|
@@ -757,8 +758,8 @@ class CollectionDictionary {
|
|
|
757
758
|
if (!collection.length) {
|
|
758
759
|
return;
|
|
759
760
|
}
|
|
760
|
-
//
|
|
761
|
-
if (!
|
|
761
|
+
// Do nothing if provided path was not found in the 1st collection's item
|
|
762
|
+
if (!hasIn(collection.items[0], path.split('.')[0])) {
|
|
762
763
|
return;
|
|
763
764
|
}
|
|
764
765
|
this.groupItems(collection, path);
|
|
@@ -945,6 +946,19 @@ class Collection {
|
|
|
945
946
|
get last() {
|
|
946
947
|
return last(this.items);
|
|
947
948
|
}
|
|
949
|
+
getByDateRange(from, to, dateField = 'date') {
|
|
950
|
+
return this.create(this.items.filter((item) => item[dateField] >= from && item[dateField] <= to));
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
class AccountSetupItemCollection extends Collection {
|
|
955
|
+
constructor(items) {
|
|
956
|
+
super(items);
|
|
957
|
+
this.sortBy('isCompleted', false);
|
|
958
|
+
}
|
|
959
|
+
isCompleted() {
|
|
960
|
+
return this.getBy('isCompleted', true).length === this.length;
|
|
961
|
+
}
|
|
948
962
|
}
|
|
949
963
|
|
|
950
964
|
var BankAccountTypeEnum;
|
|
@@ -1183,7 +1197,7 @@ class BankTransactionCollection extends Collection {
|
|
|
1183
1197
|
*/
|
|
1184
1198
|
groupByTransaction(allocations) {
|
|
1185
1199
|
// Group allocations by transaction id
|
|
1186
|
-
const allocationsByTransactions = new CollectionDictionary(allocations, 'transaction');
|
|
1200
|
+
const allocationsByTransactions = new CollectionDictionary(allocations, 'transaction.id');
|
|
1187
1201
|
// Init an empty dictionary we will fill below
|
|
1188
1202
|
const bankTransactionsByTransactions = new CollectionDictionary(new BankTransactionCollection([]));
|
|
1189
1203
|
// Fill dictionary with the same keys as at allocationsByTransactions
|
|
@@ -1425,6 +1439,32 @@ class TransactionCollection extends Collection {
|
|
|
1425
1439
|
getByAllocations(allocations) {
|
|
1426
1440
|
return new TransactionCollection(this.items.filter((transaction) => allocations.hasTransaction(transaction)));
|
|
1427
1441
|
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Get transactions related to Vehicle category
|
|
1444
|
+
*/
|
|
1445
|
+
getVehicleTransactions() {
|
|
1446
|
+
return this.create(this.items.filter((transaction) => {
|
|
1447
|
+
return transaction.isVehicleTransaction();
|
|
1448
|
+
}));
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Get new transaction collection filtered by tank type
|
|
1452
|
+
*/
|
|
1453
|
+
getByTankType(tankType) {
|
|
1454
|
+
return this.create(this.items.filter((transaction) => {
|
|
1455
|
+
switch (tankType) {
|
|
1456
|
+
case TankTypeEnum.PROPERTY:
|
|
1457
|
+
return transaction.isPropertyTank();
|
|
1458
|
+
case TankTypeEnum.WORK:
|
|
1459
|
+
return transaction.isWorkTank();
|
|
1460
|
+
case TankTypeEnum.SOLE:
|
|
1461
|
+
return transaction.isSoleTank();
|
|
1462
|
+
// Transaction may be not related to any tank type (personal)
|
|
1463
|
+
default:
|
|
1464
|
+
return false;
|
|
1465
|
+
}
|
|
1466
|
+
}));
|
|
1467
|
+
}
|
|
1428
1468
|
}
|
|
1429
1469
|
|
|
1430
1470
|
class DepreciationCollection extends Collection {
|
|
@@ -1457,15 +1497,6 @@ class DepreciationCollection extends Collection {
|
|
|
1457
1497
|
get closeBalance() {
|
|
1458
1498
|
return this.sumBy('currentYearForecast.closeBalance');
|
|
1459
1499
|
}
|
|
1460
|
-
/**
|
|
1461
|
-
* Get new depreciations collections filtered by tank type
|
|
1462
|
-
*/
|
|
1463
|
-
getByTankType(tankType) {
|
|
1464
|
-
if (tankType === TankTypeEnum.PROPERTY) {
|
|
1465
|
-
return new DepreciationCollection(this.items.filter((depreciation) => depreciation.isPropertyTank()));
|
|
1466
|
-
}
|
|
1467
|
-
return new DepreciationCollection(this.items.filter((depreciation) => depreciation.isWorkTank()));
|
|
1468
|
-
}
|
|
1469
1500
|
getByPropertiesIds(ids) {
|
|
1470
1501
|
return new DepreciationCollection(this.items.filter((depreciation) => { var _a; return ids.includes((_a = depreciation.property) === null || _a === void 0 ? void 0 : _a.id); }));
|
|
1471
1502
|
}
|
|
@@ -1501,6 +1532,29 @@ class DepreciationCollection extends Collection {
|
|
|
1501
1532
|
return depreciation.depreciationCapitalProject;
|
|
1502
1533
|
})), 'id');
|
|
1503
1534
|
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Get a new collection of depreciations related to vehicles
|
|
1537
|
+
*/
|
|
1538
|
+
getVehicleDepreciations() {
|
|
1539
|
+
return this.create(this.items.filter((depreciation) => {
|
|
1540
|
+
return depreciation.isVehicleDepreciation();
|
|
1541
|
+
}));
|
|
1542
|
+
}
|
|
1543
|
+
getByTankType(tankType) {
|
|
1544
|
+
return this.create(this.items.filter((depreciation) => {
|
|
1545
|
+
switch (tankType) {
|
|
1546
|
+
case TankTypeEnum.PROPERTY:
|
|
1547
|
+
return depreciation.isPropertyTank();
|
|
1548
|
+
case TankTypeEnum.WORK:
|
|
1549
|
+
return depreciation.isWorkTank();
|
|
1550
|
+
case TankTypeEnum.SOLE:
|
|
1551
|
+
return depreciation.isSoleTank();
|
|
1552
|
+
// case for other tank or some extra
|
|
1553
|
+
default:
|
|
1554
|
+
return false;
|
|
1555
|
+
}
|
|
1556
|
+
}));
|
|
1557
|
+
}
|
|
1504
1558
|
/**
|
|
1505
1559
|
* Create TransactionCollection from depreciation items
|
|
1506
1560
|
*/
|
|
@@ -1580,6 +1634,38 @@ class LoanCollection extends Collection {
|
|
|
1580
1634
|
}
|
|
1581
1635
|
}
|
|
1582
1636
|
|
|
1637
|
+
class MessageCollection extends Collection {
|
|
1638
|
+
getFirstUnreadMessage(user) {
|
|
1639
|
+
return this.items.find((message) => {
|
|
1640
|
+
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Get List of unread chats
|
|
1645
|
+
*/
|
|
1646
|
+
getUnread() {
|
|
1647
|
+
return this.items.filter((message) => !message.readAt);
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Check if chat has unread chats
|
|
1651
|
+
*/
|
|
1652
|
+
hasUnread() {
|
|
1653
|
+
return !!this.getUnread().length;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
/**
|
|
1658
|
+
* Collection of MessageDocument instances
|
|
1659
|
+
*/
|
|
1660
|
+
class MessageDocumentCollection extends Collection {
|
|
1661
|
+
/**
|
|
1662
|
+
* get list of documents which are not attached to any message
|
|
1663
|
+
*/
|
|
1664
|
+
getUnattached() {
|
|
1665
|
+
return new MessageDocumentCollection(this.items.filter((doc) => !doc.message));
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1583
1669
|
class FinancialYear {
|
|
1584
1670
|
constructor(date) {
|
|
1585
1671
|
this.yearStartDate = '-07-01';
|
|
@@ -1624,141 +1710,6 @@ class FinancialYear {
|
|
|
1624
1710
|
}
|
|
1625
1711
|
FinancialYear.startMonthIndex = 6;
|
|
1626
1712
|
|
|
1627
|
-
class LogbookPeriod {
|
|
1628
|
-
}
|
|
1629
|
-
__decorate([
|
|
1630
|
-
Type(() => Date)
|
|
1631
|
-
], LogbookPeriod.prototype, "from", void 0);
|
|
1632
|
-
__decorate([
|
|
1633
|
-
Type(() => Date)
|
|
1634
|
-
], LogbookPeriod.prototype, "to", void 0);
|
|
1635
|
-
|
|
1636
|
-
// Class contain array of vehicle logbooks and calculate the best period for logbook claim method
|
|
1637
|
-
class LogbookCollection {
|
|
1638
|
-
constructor(vehicles) {
|
|
1639
|
-
// 12 weeks in milliseconds to check logbooks range
|
|
1640
|
-
this.logbookClaimRange = 12 * 7 * 24 * 3600 * 1000;
|
|
1641
|
-
this.trips = vehicles.map((vehicle) => vehicle.logbook).flat();
|
|
1642
|
-
this.financialYear = new FinancialYear();
|
|
1643
|
-
this.setInitialBestPeriod();
|
|
1644
|
-
}
|
|
1645
|
-
// check if summary logbooks date range less than 84 days (12 weeks)
|
|
1646
|
-
get isAutomaticLogbookCalculationAllowed() {
|
|
1647
|
-
// forbid automatic logbook calculation if no logbook trips exist
|
|
1648
|
-
if (!this.trips.length) {
|
|
1649
|
-
return false;
|
|
1650
|
-
}
|
|
1651
|
-
// forbid automatic logbook calculation if logbook trips summary date range less than 12 weeks
|
|
1652
|
-
return this.trips.slice(-1)[0].date.getTime() - this.trips[0].date.getTime() >= this.logbookClaimRange;
|
|
1653
|
-
}
|
|
1654
|
-
get bestPeriod() {
|
|
1655
|
-
// don't calculate if not allowed
|
|
1656
|
-
if (!this.isAutomaticLogbookCalculationAllowed) {
|
|
1657
|
-
return null;
|
|
1658
|
-
}
|
|
1659
|
-
this.calculateBestPeriod();
|
|
1660
|
-
return this._bestPeriod;
|
|
1661
|
-
}
|
|
1662
|
-
get workTrips() {
|
|
1663
|
-
return this.trips.filter((logbook) => logbook.isWork);
|
|
1664
|
-
}
|
|
1665
|
-
// calculate best period for logbook claim method
|
|
1666
|
-
calculateBestPeriod() {
|
|
1667
|
-
// set default best period values for real values comparison
|
|
1668
|
-
this.setInitialBestPeriod();
|
|
1669
|
-
// get best period with each trip date as start date
|
|
1670
|
-
this.workTrips.forEach((logbook) => {
|
|
1671
|
-
const dateRange = this.getDateRange(logbook.date);
|
|
1672
|
-
// get all trips included in current 12 weeks period
|
|
1673
|
-
const tripsInRange = this.trips.filter((l) => {
|
|
1674
|
-
return l.date >= dateRange.from && l.date <= dateRange.to;
|
|
1675
|
-
});
|
|
1676
|
-
// get work trips included in current 12 weeks period
|
|
1677
|
-
const workTripsInRange = tripsInRange.filter((l) => l.isWork);
|
|
1678
|
-
// calculate sum of work kilometers in current 12 weeks range
|
|
1679
|
-
const currentRangeKilometers = this.getKilometersAmount(workTripsInRange);
|
|
1680
|
-
// overwrite best period with current 12 weeks range if amount of kilometers is bigger
|
|
1681
|
-
if (currentRangeKilometers > this._bestPeriod.kilometers) {
|
|
1682
|
-
this._bestPeriod = {
|
|
1683
|
-
from: dateRange.from,
|
|
1684
|
-
to: dateRange.to,
|
|
1685
|
-
kilometers: currentRangeKilometers,
|
|
1686
|
-
workUsage: this.getLogbooksWorkUsage(tripsInRange, workTripsInRange)
|
|
1687
|
-
};
|
|
1688
|
-
}
|
|
1689
|
-
});
|
|
1690
|
-
}
|
|
1691
|
-
getDateRange(from) {
|
|
1692
|
-
// set end date after 12 weeks after start date
|
|
1693
|
-
let to = new Date(from.getTime() + this.logbookClaimRange);
|
|
1694
|
-
// set as period last 12 weeks of current year if period end date after end of current year
|
|
1695
|
-
if (to > this.financialYear.endDate) {
|
|
1696
|
-
to = this.financialYear.endDate;
|
|
1697
|
-
from = new Date(to.getTime() - this.logbookClaimRange);
|
|
1698
|
-
}
|
|
1699
|
-
return { from, to };
|
|
1700
|
-
}
|
|
1701
|
-
// calculate kilometers amount for passed trips
|
|
1702
|
-
getKilometersAmount(logbooks) {
|
|
1703
|
-
if (!logbooks.length) {
|
|
1704
|
-
return 0;
|
|
1705
|
-
}
|
|
1706
|
-
return logbooks.map((logbook) => logbook.odometerEnd - logbook.odometerStart)
|
|
1707
|
-
.reduce((prev, next) => prev + Number(next));
|
|
1708
|
-
}
|
|
1709
|
-
// calculate work usage for passed trips
|
|
1710
|
-
getLogbooksWorkUsage(logbooks, workLogbooks) {
|
|
1711
|
-
const kilometers = this.getKilometersAmount(logbooks);
|
|
1712
|
-
const workKilometers = this.getKilometersAmount(workLogbooks);
|
|
1713
|
-
return Math.round(workKilometers / kilometers * 100);
|
|
1714
|
-
}
|
|
1715
|
-
// set default best period with zero values and fin year start date for comparison in calculation
|
|
1716
|
-
setInitialBestPeriod() {
|
|
1717
|
-
// set 1st of July of current year as default start date for best period
|
|
1718
|
-
const startDate = this.financialYear.startDate;
|
|
1719
|
-
// set end custom-date after 12 weeks from start date
|
|
1720
|
-
const endDate = new Date(startDate.getTime() + this.logbookClaimRange);
|
|
1721
|
-
this._bestPeriod = plainToClass(LogbookPeriod, {
|
|
1722
|
-
from: startDate,
|
|
1723
|
-
to: endDate,
|
|
1724
|
-
kilometers: 0,
|
|
1725
|
-
workUsage: 0
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
class MessageCollection extends Collection {
|
|
1731
|
-
getFirstUnreadMessage(user) {
|
|
1732
|
-
return this.items.find((message) => {
|
|
1733
|
-
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
1734
|
-
});
|
|
1735
|
-
}
|
|
1736
|
-
/**
|
|
1737
|
-
* Get List of unread chats
|
|
1738
|
-
*/
|
|
1739
|
-
getUnread() {
|
|
1740
|
-
return this.items.filter((message) => !message.readAt);
|
|
1741
|
-
}
|
|
1742
|
-
/**
|
|
1743
|
-
* Check if chat has unread chats
|
|
1744
|
-
*/
|
|
1745
|
-
hasUnread() {
|
|
1746
|
-
return !!this.getUnread().length;
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
|
|
1750
|
-
/**
|
|
1751
|
-
* Collection of MessageDocument instances
|
|
1752
|
-
*/
|
|
1753
|
-
class MessageDocumentCollection extends Collection {
|
|
1754
|
-
/**
|
|
1755
|
-
* get list of documents which are not attached to any message
|
|
1756
|
-
*/
|
|
1757
|
-
getUnattached() {
|
|
1758
|
-
return new MessageDocumentCollection(this.items.filter((doc) => !doc.message));
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
1713
|
class PropertyCollection extends Collection {
|
|
1763
1714
|
/**
|
|
1764
1715
|
* Get new property collection filtered by category id
|
|
@@ -2006,6 +1957,8 @@ var ChartAccountsHeadingVehicleListEnum;
|
|
|
2006
1957
|
(function (ChartAccountsHeadingVehicleListEnum) {
|
|
2007
1958
|
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["WORK_RELATED_CAR_EXPENSES"] = 8] = "WORK_RELATED_CAR_EXPENSES";
|
|
2008
1959
|
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["DEPRECIATION_VEHICLES"] = 9] = "DEPRECIATION_VEHICLES";
|
|
1960
|
+
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["KLMS"] = 60] = "KLMS";
|
|
1961
|
+
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["FUEL_OIL"] = 61] = "FUEL_OIL";
|
|
2009
1962
|
})(ChartAccountsHeadingVehicleListEnum || (ChartAccountsHeadingVehicleListEnum = {}));
|
|
2010
1963
|
|
|
2011
1964
|
var ChartAccountsListEnum;
|
|
@@ -2017,16 +1970,17 @@ var ChartAccountsListEnum;
|
|
|
2017
1970
|
ChartAccountsListEnum[ChartAccountsListEnum["BUILDING_AT_COST"] = 304] = "BUILDING_AT_COST";
|
|
2018
1971
|
ChartAccountsListEnum[ChartAccountsListEnum["MANAGEMENT_FEES_PLATFORM_FEES"] = 656] = "MANAGEMENT_FEES_PLATFORM_FEES";
|
|
2019
1972
|
ChartAccountsListEnum[ChartAccountsListEnum["KLMS_TRAVELLED_FOR_WORK"] = 24] = "KLMS_TRAVELLED_FOR_WORK";
|
|
1973
|
+
ChartAccountsListEnum[ChartAccountsListEnum["KLMS_TRAVELLED"] = 683] = "KLMS_TRAVELLED";
|
|
2020
1974
|
ChartAccountsListEnum[ChartAccountsListEnum["DIRECTOR_FEES"] = 6] = "DIRECTOR_FEES";
|
|
2021
1975
|
ChartAccountsListEnum[ChartAccountsListEnum["SALARY_OR_WAGES"] = 2] = "SALARY_OR_WAGES";
|
|
2022
1976
|
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLES"] = 25] = "VEHICLES";
|
|
2023
1977
|
ChartAccountsListEnum[ChartAccountsListEnum["COMMERCIAL_VEHICLES"] = 26] = "COMMERCIAL_VEHICLES";
|
|
1978
|
+
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_INTEREST"] = 37] = "VEHICLE_LOAN_INTEREST";
|
|
1979
|
+
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_PRINCIPAL"] = 38] = "VEHICLE_LOAN_PRINCIPAL";
|
|
2024
1980
|
ChartAccountsListEnum[ChartAccountsListEnum["TAX_INSTALMENTS"] = 662] = "TAX_INSTALMENTS";
|
|
2025
1981
|
ChartAccountsListEnum[ChartAccountsListEnum["INTEREST_EARNED"] = 22] = "INTEREST_EARNED";
|
|
2026
1982
|
ChartAccountsListEnum[ChartAccountsListEnum["TRUST_INCOME"] = 567] = "TRUST_INCOME";
|
|
2027
1983
|
ChartAccountsListEnum[ChartAccountsListEnum["TAX_OFFSETS_N_R_A_S"] = 571] = "TAX_OFFSETS_N_R_A_S";
|
|
2028
|
-
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_INTEREST"] = 37] = "VEHICLE_LOAN_INTEREST";
|
|
2029
|
-
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_PRINCIPAL"] = 38] = "VEHICLE_LOAN_PRINCIPAL";
|
|
2030
1984
|
})(ChartAccountsListEnum || (ChartAccountsListEnum = {}));
|
|
2031
1985
|
|
|
2032
1986
|
class DepreciationCapitalProject$1 {
|
|
@@ -2125,6 +2079,25 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
2125
2079
|
isKlmsForWork() {
|
|
2126
2080
|
return this.id === ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
2127
2081
|
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Check if chart accounts id is related for 'Klms travelled for sole' category
|
|
2084
|
+
*/
|
|
2085
|
+
isKlmsForSole() {
|
|
2086
|
+
return this.id === ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* Check if accounts id is related for KLMs category related to passed tank type
|
|
2090
|
+
*/
|
|
2091
|
+
isKLMsByTankType(tankType) {
|
|
2092
|
+
switch (tankType) {
|
|
2093
|
+
case TankTypeEnum.WORK:
|
|
2094
|
+
return this.isKlmsForWork();
|
|
2095
|
+
case TankTypeEnum.SOLE:
|
|
2096
|
+
return this.isKlmsForSole();
|
|
2097
|
+
default:
|
|
2098
|
+
return false;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2128
2101
|
/**
|
|
2129
2102
|
* Check if chart accounts id is related for 'NRAS Tax Offset' category
|
|
2130
2103
|
*/
|
|
@@ -2219,6 +2192,18 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
2219
2192
|
isVehicleLoanExpense() {
|
|
2220
2193
|
return this.id === ChartAccountsListEnum.VEHICLE_LOAN_INTEREST || this.id === ChartAccountsListEnum.VEHICLE_LOAN_PRINCIPAL;
|
|
2221
2194
|
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Get chart accounts value for current financial year
|
|
2197
|
+
*/
|
|
2198
|
+
getCurrentYearValue() {
|
|
2199
|
+
return this.getValueByYear(new FinancialYear().year);
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Get chart accounts value by financial year
|
|
2203
|
+
*/
|
|
2204
|
+
getValueByYear(year) {
|
|
2205
|
+
return this.values.find((value) => value.financialYear === year);
|
|
2206
|
+
}
|
|
2222
2207
|
}
|
|
2223
2208
|
__decorate([
|
|
2224
2209
|
Type(() => ChartAccountsHeading)
|
|
@@ -2265,7 +2250,6 @@ var UserStatusEnum;
|
|
|
2265
2250
|
UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
|
|
2266
2251
|
UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
|
|
2267
2252
|
UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
|
|
2268
|
-
UserStatusEnum[UserStatusEnum["TRIAL"] = 3] = "TRIAL";
|
|
2269
2253
|
})(UserStatusEnum || (UserStatusEnum = {}));
|
|
2270
2254
|
|
|
2271
2255
|
var UserRolesEnum;
|
|
@@ -2868,6 +2852,7 @@ var TaxExemptionEnum;
|
|
|
2868
2852
|
var PropertyCategoryListEnum;
|
|
2869
2853
|
(function (PropertyCategoryListEnum) {
|
|
2870
2854
|
PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
|
|
2855
|
+
PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 5] = "VACANT_LAND";
|
|
2871
2856
|
})(PropertyCategoryListEnum || (PropertyCategoryListEnum = {}));
|
|
2872
2857
|
|
|
2873
2858
|
var TaxExemptionMetadataEnum;
|
|
@@ -3669,6 +3654,10 @@ class Depreciation extends Depreciation$1 {
|
|
|
3669
3654
|
super(...arguments);
|
|
3670
3655
|
this.forecasts = [];
|
|
3671
3656
|
this.type = DepreciationTypeEnum.PLANT_EQUIPMENT;
|
|
3657
|
+
/**
|
|
3658
|
+
* @TODO remove after ? signs removed from db models
|
|
3659
|
+
*/
|
|
3660
|
+
this.amount = 0;
|
|
3672
3661
|
}
|
|
3673
3662
|
isCapital() {
|
|
3674
3663
|
return this.type === DepreciationTypeEnum.CAPITAL_WORKS;
|
|
@@ -4235,7 +4224,7 @@ class TransactionAllocationCollection extends Collection {
|
|
|
4235
4224
|
*/
|
|
4236
4225
|
groupByBankAccount(bankTransactions) {
|
|
4237
4226
|
// Group bank transactions by bank account id
|
|
4238
|
-
const bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount');
|
|
4227
|
+
const bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount.id');
|
|
4239
4228
|
// Create empty dictionary of transaction allocations
|
|
4240
4229
|
const allocationsByBankAccount = new CollectionDictionary(new TransactionAllocationCollection([]));
|
|
4241
4230
|
// Fill allocations dictionary with bank transactions dictionary keys and allocations related with each bank transaction collection
|
|
@@ -4267,6 +4256,111 @@ class UserEventSettingCollection extends Collection {
|
|
|
4267
4256
|
}
|
|
4268
4257
|
}
|
|
4269
4258
|
|
|
4259
|
+
/**
|
|
4260
|
+
* Class contains traveled kilometers and work usage percent in 12 weeks date range
|
|
4261
|
+
*/
|
|
4262
|
+
class LogbookPeriod {
|
|
4263
|
+
isEndOfYear() {
|
|
4264
|
+
return this.to === new FinancialYear().endDate;
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
__decorate([
|
|
4268
|
+
Type(() => Date)
|
|
4269
|
+
], LogbookPeriod.prototype, "from", void 0);
|
|
4270
|
+
__decorate([
|
|
4271
|
+
Type(() => Date)
|
|
4272
|
+
], LogbookPeriod.prototype, "to", void 0);
|
|
4273
|
+
|
|
4274
|
+
/**
|
|
4275
|
+
* 12 weeks in milliseconds
|
|
4276
|
+
* "To work out your business-use percentage, you need to keep a logbook and the odometer readings for the logbook period.
|
|
4277
|
+
* The logbook period is a minimum continuous period of 12 weeks." © Nicole Kelly
|
|
4278
|
+
*/
|
|
4279
|
+
const LOGBOOK_PERIOD_DURATION = 12 * 7 * 24 * 3600 * 1000;
|
|
4280
|
+
class VehicleLogbookCollection extends Collection {
|
|
4281
|
+
/**
|
|
4282
|
+
* Check if we can calculate the best period
|
|
4283
|
+
*/
|
|
4284
|
+
isBestPeriodExist() {
|
|
4285
|
+
if (this.items.length < 2) {
|
|
4286
|
+
return false;
|
|
4287
|
+
}
|
|
4288
|
+
return LOGBOOK_PERIOD_DURATION < (this.last.date.getTime() - this.first.date.getTime());
|
|
4289
|
+
}
|
|
4290
|
+
/**
|
|
4291
|
+
* Get collection of non-personal logbooks (work-related, sole-related).
|
|
4292
|
+
*/
|
|
4293
|
+
getBusinessLogbooks() {
|
|
4294
|
+
return this.create(this.items.filter((logbook) => logbook.isBusiness()));
|
|
4295
|
+
}
|
|
4296
|
+
/**
|
|
4297
|
+
* Logbook Period is the best when it has the biggest amount of work kilometers
|
|
4298
|
+
* Best period duration is defined as LOGBOOK_PERIOD_DURATION (12 weeks) by the ATO
|
|
4299
|
+
*/
|
|
4300
|
+
getBestPeriod() {
|
|
4301
|
+
if (!this.isBestPeriodExist()) {
|
|
4302
|
+
return null;
|
|
4303
|
+
}
|
|
4304
|
+
let bestPeriod;
|
|
4305
|
+
const businessLogbooks = this.getBusinessLogbooks().toArray();
|
|
4306
|
+
for (let i = 0; i < businessLogbooks.length; i++) {
|
|
4307
|
+
const logbook = businessLogbooks[i];
|
|
4308
|
+
// no sense to check next logbooks because we already get the end of the year
|
|
4309
|
+
if (bestPeriod && bestPeriod.isEndOfYear()) {
|
|
4310
|
+
break;
|
|
4311
|
+
}
|
|
4312
|
+
const dateRange = this.getPeriodRange(logbook.date);
|
|
4313
|
+
// get logbooks included in current logbook period
|
|
4314
|
+
const logbooksInRange = this.getByDateRange(logbook.date, new Date(logbook.date.getTime() + LOGBOOK_PERIOD_DURATION));
|
|
4315
|
+
const workUsage = logbooksInRange.getWorkUsage();
|
|
4316
|
+
// compare with previous best period and overwrite if needs
|
|
4317
|
+
if (!bestPeriod || workUsage > bestPeriod.workUsage) {
|
|
4318
|
+
bestPeriod = plainToClass(LogbookPeriod, {
|
|
4319
|
+
from: dateRange.from,
|
|
4320
|
+
to: dateRange.to,
|
|
4321
|
+
kilometers: logbooksInRange.getBusinessLogbooks().getKlms(),
|
|
4322
|
+
workUsage: workUsage
|
|
4323
|
+
});
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
return bestPeriod;
|
|
4327
|
+
}
|
|
4328
|
+
/**
|
|
4329
|
+
* Calculate total kilometers traveled
|
|
4330
|
+
*/
|
|
4331
|
+
getKlms() {
|
|
4332
|
+
return this.items.reduce((sum, logbook) => sum + logbook.getKlms(), 0);
|
|
4333
|
+
}
|
|
4334
|
+
/**
|
|
4335
|
+
* Calculate work usage (percent of business-related kilometers from total kilometers)
|
|
4336
|
+
*/
|
|
4337
|
+
getWorkUsage() {
|
|
4338
|
+
const totalKilometers = this.getKlms();
|
|
4339
|
+
const workKilometers = this.getBusinessLogbooks().getKlms();
|
|
4340
|
+
return Math.round(workKilometers / totalKilometers * 100);
|
|
4341
|
+
}
|
|
4342
|
+
/**
|
|
4343
|
+
* Get LOGBOOK_PERIOD_DURATION date range from passed start date
|
|
4344
|
+
*/
|
|
4345
|
+
getPeriodRange(from) {
|
|
4346
|
+
// set end date after LOGBOOK_PERIOD_DURATION after start date
|
|
4347
|
+
let to = new Date(from.getTime() + LOGBOOK_PERIOD_DURATION);
|
|
4348
|
+
const financialYear = new FinancialYear();
|
|
4349
|
+
// set as period last LOGBOOK_PERIOD_DURATION of current year if period end date after end of current year
|
|
4350
|
+
if (to > financialYear.endDate) {
|
|
4351
|
+
to = financialYear.endDate;
|
|
4352
|
+
from = new Date(to.getTime() - LOGBOOK_PERIOD_DURATION);
|
|
4353
|
+
}
|
|
4354
|
+
return { from, to };
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
class VehicleCollection extends Collection {
|
|
4359
|
+
getLogbooks() {
|
|
4360
|
+
return new VehicleLogbookCollection(flatten(this.items.map((vehicle) => vehicle.logbook)));
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
|
|
4270
4364
|
var BankAccountStatusEnum;
|
|
4271
4365
|
(function (BankAccountStatusEnum) {
|
|
4272
4366
|
BankAccountStatusEnum[BankAccountStatusEnum["INACTIVE"] = 0] = "INACTIVE";
|
|
@@ -4703,6 +4797,12 @@ var VehicleLogbookPurposeEnum;
|
|
|
4703
4797
|
VehicleLogbookPurposeEnum[VehicleLogbookPurposeEnum["PERSONAL"] = 2] = "PERSONAL";
|
|
4704
4798
|
})(VehicleLogbookPurposeEnum || (VehicleLogbookPurposeEnum = {}));
|
|
4705
4799
|
|
|
4800
|
+
/**
|
|
4801
|
+
* Account setup item instance is using for account setup checklist
|
|
4802
|
+
*/
|
|
4803
|
+
class AccountSetupItem {
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4706
4806
|
class Bank$1 {
|
|
4707
4807
|
}
|
|
4708
4808
|
|
|
@@ -5143,6 +5243,12 @@ var ChartAccountsTaxLabelsEnum;
|
|
|
5143
5243
|
ChartAccountsTaxLabelsEnum["TAX_DEDUCTED"] = "Tax Deducted";
|
|
5144
5244
|
})(ChartAccountsTaxLabelsEnum || (ChartAccountsTaxLabelsEnum = {}));
|
|
5145
5245
|
|
|
5246
|
+
class ChartAccountsValue$1 {
|
|
5247
|
+
}
|
|
5248
|
+
|
|
5249
|
+
class ChartAccountsValue extends ChartAccountsValue$1 {
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5146
5252
|
class Chat$1 {
|
|
5147
5253
|
}
|
|
5148
5254
|
|
|
@@ -5224,6 +5330,18 @@ __decorate([
|
|
|
5224
5330
|
Expose()
|
|
5225
5331
|
], Message.prototype, "documents", void 0);
|
|
5226
5332
|
|
|
5333
|
+
class ClientIncomeTypes$1 {
|
|
5334
|
+
}
|
|
5335
|
+
|
|
5336
|
+
class ClientIncomeTypes extends ClientIncomeTypes$1 {
|
|
5337
|
+
/**
|
|
5338
|
+
* Get count of selected income types
|
|
5339
|
+
*/
|
|
5340
|
+
get length() {
|
|
5341
|
+
return Object.values(this).filter((value) => typeof value === 'boolean' && value).length;
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5344
|
+
|
|
5227
5345
|
class ClientInvite$1 {
|
|
5228
5346
|
}
|
|
5229
5347
|
|
|
@@ -5615,8 +5733,17 @@ var AppEventTypeEnum;
|
|
|
5615
5733
|
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 35] = "USER_UPDATED";
|
|
5616
5734
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 36] = "VEHICLE_CLAIM_UPDATED";
|
|
5617
5735
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 37] = "VEHICLE_CLAIM_CREATED";
|
|
5736
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 38] = "VEHICLE_LOGBOOK_CREATED";
|
|
5737
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 39] = "VEHICLE_LOGBOOK_UPDATED";
|
|
5738
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 40] = "VEHICLE_LOGBOOK_DELETED";
|
|
5618
5739
|
})(AppEventTypeEnum || (AppEventTypeEnum = {}));
|
|
5619
5740
|
|
|
5741
|
+
/**
|
|
5742
|
+
* Data table structure suitable for export
|
|
5743
|
+
*/
|
|
5744
|
+
class ExportDataTable {
|
|
5745
|
+
}
|
|
5746
|
+
|
|
5620
5747
|
var ExportFormatEnum;
|
|
5621
5748
|
(function (ExportFormatEnum) {
|
|
5622
5749
|
ExportFormatEnum["PDF"] = "PDF";
|
|
@@ -5718,10 +5845,16 @@ class VehicleLogbook$1 {
|
|
|
5718
5845
|
}
|
|
5719
5846
|
|
|
5720
5847
|
class VehicleLogbook extends VehicleLogbook$1 {
|
|
5721
|
-
|
|
5848
|
+
/**
|
|
5849
|
+
* Get amount of kilometers in this logbook
|
|
5850
|
+
*/
|
|
5851
|
+
getKlms() {
|
|
5722
5852
|
return this.odometerEnd - this.odometerStart;
|
|
5723
5853
|
}
|
|
5724
|
-
|
|
5854
|
+
/**
|
|
5855
|
+
* Check if logbook is business-related
|
|
5856
|
+
*/
|
|
5857
|
+
isBusiness() {
|
|
5725
5858
|
return this.purpose === VehicleLogbookPurposeEnum.BUSINESS;
|
|
5726
5859
|
}
|
|
5727
5860
|
}
|
|
@@ -5730,33 +5863,11 @@ __decorate([
|
|
|
5730
5863
|
], VehicleLogbook.prototype, "date", void 0);
|
|
5731
5864
|
|
|
5732
5865
|
class Vehicle extends Vehicle$1 {
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
this.logbook.forEach((lb) => {
|
|
5739
|
-
kilometers += lb.kilometres;
|
|
5740
|
-
});
|
|
5741
|
-
return kilometers;
|
|
5742
|
-
}
|
|
5743
|
-
get workKilometres() {
|
|
5744
|
-
let kilometers = 0;
|
|
5745
|
-
this.logbook.forEach((lb) => {
|
|
5746
|
-
if (lb.purpose === VehicleLogbookPurposeEnum.BUSINESS) {
|
|
5747
|
-
kilometers += lb.kilometres;
|
|
5748
|
-
}
|
|
5749
|
-
});
|
|
5750
|
-
return kilometers;
|
|
5751
|
-
}
|
|
5752
|
-
get personalKilometres() {
|
|
5753
|
-
return this.totalKilometres - this.workKilometres;
|
|
5754
|
-
}
|
|
5755
|
-
get lastLogbook() {
|
|
5756
|
-
if (!this.logbook.length) {
|
|
5757
|
-
return { odometerEnd: 0 };
|
|
5758
|
-
}
|
|
5759
|
-
return this.logbook.slice(-1)[0];
|
|
5866
|
+
/**
|
|
5867
|
+
* Get vehicle's logbooks as collection
|
|
5868
|
+
*/
|
|
5869
|
+
getLogbooks() {
|
|
5870
|
+
return new VehicleLogbookCollection(this.logbook);
|
|
5760
5871
|
}
|
|
5761
5872
|
}
|
|
5762
5873
|
__decorate([
|
|
@@ -5784,15 +5895,68 @@ class VehicleClaim extends VehicleClaim$1 {
|
|
|
5784
5895
|
get averageWeeklyTraveledKms() {
|
|
5785
5896
|
return this.kilometers / WEEKS_IN_YEAR;
|
|
5786
5897
|
}
|
|
5787
|
-
|
|
5898
|
+
isLogbookMethod() {
|
|
5788
5899
|
return this.method === VehicleClaimMethodEnum.LOGBOOK;
|
|
5789
5900
|
}
|
|
5901
|
+
isKLMsMethod() {
|
|
5902
|
+
return this.method === VehicleClaimMethodEnum.KMS;
|
|
5903
|
+
}
|
|
5904
|
+
isWorkTank() {
|
|
5905
|
+
return this.tankType === TankTypeEnum.WORK;
|
|
5906
|
+
}
|
|
5907
|
+
isSoleTank() {
|
|
5908
|
+
return this.tankType === TankTypeEnum.SOLE;
|
|
5909
|
+
}
|
|
5790
5910
|
/**
|
|
5791
|
-
* Claim amount for
|
|
5911
|
+
* Claim amount for KLMs method. Exists only for KLMs method.
|
|
5792
5912
|
*/
|
|
5793
|
-
|
|
5913
|
+
getKLMsClaimAmount(vehicleClaimRate) {
|
|
5914
|
+
if (!this.isKLMsMethod()) {
|
|
5915
|
+
return 0;
|
|
5916
|
+
}
|
|
5794
5917
|
return +(this.kilometers * vehicleClaimRate).toFixed(2);
|
|
5795
5918
|
}
|
|
5919
|
+
/**
|
|
5920
|
+
* Get logbook claim amount. Exists only for logbook method.
|
|
5921
|
+
* ClaimAmount = WorkUsage * transaction/depreciation amount
|
|
5922
|
+
*/
|
|
5923
|
+
getLogbookClaimAmount(transactions) {
|
|
5924
|
+
if (!this.isLogbookMethod()) {
|
|
5925
|
+
return 0;
|
|
5926
|
+
}
|
|
5927
|
+
const transactionsAmount = transactions
|
|
5928
|
+
.getByTankType(this.tankType)
|
|
5929
|
+
.getVehicleTransactions()
|
|
5930
|
+
// except klms transactions because they needed only for klms method
|
|
5931
|
+
.filter((transaction) => !transaction.chartAccounts.isKLMsByTankType(this.tankType))
|
|
5932
|
+
.sumBy('amount');
|
|
5933
|
+
// Math.abs because amount will be negative (because we sum expenses), but we don't want negative percent value
|
|
5934
|
+
return Math.abs(transactionsAmount) * this.workUsage / 100;
|
|
5935
|
+
}
|
|
5936
|
+
/**
|
|
5937
|
+
* Create KLMs transaction based on vehicle claim and vehicle claim rate
|
|
5938
|
+
* @TODO handle on backend: Create klms transaction when vhicle claim created
|
|
5939
|
+
*/
|
|
5940
|
+
toTransaction(vehicleClaimRate) {
|
|
5941
|
+
return plainToClass(Transaction, {
|
|
5942
|
+
amount: this.kilometers * vehicleClaimRate,
|
|
5943
|
+
source: TransactionSourceEnum.CASH,
|
|
5944
|
+
type: TransactionTypeEnum.DEBIT,
|
|
5945
|
+
taxWithheld: 0,
|
|
5946
|
+
description: 'Klm’s method',
|
|
5947
|
+
date: new Date(`${new FinancialYear().year}-06-30`),
|
|
5948
|
+
claimPercent: 100,
|
|
5949
|
+
chartAccounts: {
|
|
5950
|
+
id: this.getKlmsChartAccountsIdByTankType(this.tankType)
|
|
5951
|
+
}
|
|
5952
|
+
});
|
|
5953
|
+
}
|
|
5954
|
+
getKlmsChartAccountsIdByTankType(tankType = this.tankType) {
|
|
5955
|
+
if (tankType === TankTypeEnum.WORK) {
|
|
5956
|
+
return ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
5957
|
+
}
|
|
5958
|
+
return ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
5959
|
+
}
|
|
5796
5960
|
}
|
|
5797
5961
|
|
|
5798
5962
|
class ServiceNotification {
|
|
@@ -5833,6 +5997,12 @@ __decorate([
|
|
|
5833
5997
|
})
|
|
5834
5998
|
], Notification.prototype, "redirectionLink", void 0);
|
|
5835
5999
|
|
|
6000
|
+
var PdfOrientationEnum;
|
|
6001
|
+
(function (PdfOrientationEnum) {
|
|
6002
|
+
PdfOrientationEnum["PORTRAIT"] = "portrait";
|
|
6003
|
+
PdfOrientationEnum["LANDSCAPE"] = "landscape";
|
|
6004
|
+
})(PdfOrientationEnum || (PdfOrientationEnum = {}));
|
|
6005
|
+
|
|
5836
6006
|
/**
|
|
5837
6007
|
* Calculation form control types
|
|
5838
6008
|
*/
|
|
@@ -6524,81 +6694,100 @@ var UserEventSettingFieldEnum;
|
|
|
6524
6694
|
UserEventSettingFieldEnum["FREQUENCY"] = "frequency";
|
|
6525
6695
|
})(UserEventSettingFieldEnum || (UserEventSettingFieldEnum = {}));
|
|
6526
6696
|
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
this._countries = countries;
|
|
6541
|
-
this.countriesSubject.next(countries);
|
|
6542
|
-
});
|
|
6543
|
-
}
|
|
6544
|
-
return this.countriesSubject.asObservable();
|
|
6545
|
-
}
|
|
6546
|
-
}
|
|
6547
|
-
AddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6548
|
-
AddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, providedIn: 'root' });
|
|
6549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, decorators: [{
|
|
6550
|
-
type: Injectable,
|
|
6551
|
-
args: [{
|
|
6552
|
-
providedIn: 'root'
|
|
6553
|
-
}]
|
|
6554
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
6555
|
-
type: Inject,
|
|
6556
|
-
args: ['environment']
|
|
6557
|
-
}] }]; } });
|
|
6697
|
+
/**
|
|
6698
|
+
* Enum list of all possible account setup items. Using with [ACCOUNT_SETUP_ITEMS]{@link ACCOUNT_SETUP_ITEMS}
|
|
6699
|
+
*/
|
|
6700
|
+
var AccountSetupItemsEnum;
|
|
6701
|
+
(function (AccountSetupItemsEnum) {
|
|
6702
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["SALARY"] = 0] = "SALARY";
|
|
6703
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["OTHER_INCOME"] = 1] = "OTHER_INCOME";
|
|
6704
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["PROPERTY"] = 2] = "PROPERTY";
|
|
6705
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_FEEDS"] = 3] = "BANK_FEEDS";
|
|
6706
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["WORK_LOGBOOK"] = 4] = "WORK_LOGBOOK";
|
|
6707
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_INCOME"] = 5] = "SOLE_INCOME";
|
|
6708
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["TRANSACTION"] = 6] = "TRANSACTION";
|
|
6709
|
+
})(AccountSetupItemsEnum || (AccountSetupItemsEnum = {}));
|
|
6558
6710
|
|
|
6559
6711
|
/**
|
|
6560
|
-
*
|
|
6712
|
+
* List of all possible account setup steps
|
|
6561
6713
|
*/
|
|
6562
|
-
|
|
6563
|
-
|
|
6714
|
+
const ACCOUNT_SETUP_ITEMS = {
|
|
6715
|
+
[AccountSetupItemsEnum.SALARY]: plainToClass(AccountSetupItem, {
|
|
6716
|
+
title: 'Add your work income forecast',
|
|
6717
|
+
description: 'One the most important steps is to add your salary or wage incomes so we can automatically calculate tax withheld and your forecasted tax position.',
|
|
6718
|
+
url: '/client/work-tank/forecasting'
|
|
6719
|
+
}),
|
|
6720
|
+
[AccountSetupItemsEnum.OTHER_INCOME]: plainToClass(AccountSetupItem, {
|
|
6721
|
+
title: 'Add any other expected incomes',
|
|
6722
|
+
description: 'To ensure an accurate tax position forecast, add estimates for any other income types, like dividends, interest, trusts, annuities, director payments etc.',
|
|
6723
|
+
url: '/client/work-tank/forecasting'
|
|
6724
|
+
}),
|
|
6725
|
+
[AccountSetupItemsEnum.PROPERTY]: plainToClass(AccountSetupItem, {
|
|
6726
|
+
title: 'Add your properties',
|
|
6727
|
+
description: 'Add your properties to seamlessly manage your rental incomes and expenses, whilst tracking your cash position, tax positions and equity forecasts in real time.',
|
|
6728
|
+
url: '/client/property-tank'
|
|
6729
|
+
}),
|
|
6730
|
+
[AccountSetupItemsEnum.BANK_FEEDS]: plainToClass(AccountSetupItem, {
|
|
6731
|
+
title: 'Link banks and select accounts',
|
|
6732
|
+
description: 'Link banks to automatically feed your account transactions to save you time and money. Allocating live transactions ensures nothing is missed, lost or forgotten!',
|
|
6733
|
+
url: '/client/bank-feeds'
|
|
6734
|
+
}),
|
|
6735
|
+
[AccountSetupItemsEnum.WORK_LOGBOOK]: plainToClass(AccountSetupItem, {
|
|
6736
|
+
title: 'Set up your logbook method',
|
|
6737
|
+
description: 'Do you use your vehicle for work? Select your method and the klms or logbook % to automate accurately all vehicle expenses throughout the year.',
|
|
6738
|
+
url: '/client/work-tank/logbook'
|
|
6739
|
+
}),
|
|
6740
|
+
[AccountSetupItemsEnum.SOLE_INCOME]: plainToClass(AccountSetupItem, {
|
|
6741
|
+
title: 'Add your business details',
|
|
6742
|
+
description: 'Add your business details, logo and payment terms to create invoice templates in minutes.',
|
|
6743
|
+
url: '/client/sole-tank/forecasting'
|
|
6744
|
+
}),
|
|
6745
|
+
[AccountSetupItemsEnum.TRANSACTION]: plainToClass(AccountSetupItem, {
|
|
6746
|
+
title: 'Allocation transactions',
|
|
6747
|
+
description: 'Select one or multiple transactions, the category from the dropdown and attach your receipt. It’s that simple to capture every possible deduction, and keep organised all throughout the year.',
|
|
6748
|
+
url: '/client/bank-feeds'
|
|
6749
|
+
}),
|
|
6750
|
+
};
|
|
6751
|
+
|
|
6752
|
+
/**
|
|
6753
|
+
* @TODO extend rest service when it could work with single objects, not only arrays
|
|
6754
|
+
*/
|
|
6755
|
+
class ClientIncomeTypesService {
|
|
6756
|
+
constructor(http, environment) {
|
|
6564
6757
|
this.http = http;
|
|
6565
|
-
this.userSwitcherService = userSwitcherService;
|
|
6566
6758
|
this.environment = environment;
|
|
6567
|
-
this.
|
|
6568
|
-
}
|
|
6569
|
-
/**
|
|
6570
|
-
* Get asset link
|
|
6571
|
-
* @param asset to get the link for
|
|
6572
|
-
*/
|
|
6573
|
-
getLink(asset) {
|
|
6574
|
-
return this.http.get(`${this.environment.apiV2}/assets/${asset.type}/${asset.id}`);
|
|
6759
|
+
this.cacheSubject = new ReplaySubject(1);
|
|
6575
6760
|
}
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6761
|
+
get() {
|
|
6762
|
+
if (!this.cache) {
|
|
6763
|
+
this.http.get(`${this.environment.apiV2}/client-income-types`)
|
|
6764
|
+
.pipe(map((response) => {
|
|
6765
|
+
return plainToClass(ClientIncomeTypes, response['hydra:member'][0], { excludePrefixes: ['@'] });
|
|
6766
|
+
}))
|
|
6767
|
+
.subscribe((incomeTypes) => {
|
|
6768
|
+
this.cache = incomeTypes;
|
|
6769
|
+
this.cacheSubject.next(this.cache);
|
|
6770
|
+
});
|
|
6771
|
+
}
|
|
6772
|
+
return this.cacheSubject.asObservable();
|
|
6583
6773
|
}
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
return this.http.delete(`${this.environment.apiV2}/${asset.entityType}/${entityId}/${asset.type}/${asset.id}`);
|
|
6774
|
+
update(incomeTypes) {
|
|
6775
|
+
return this.http.put(`${this.environment.apiV2}/client-income-types/${incomeTypes.id}`, incomeTypes)
|
|
6776
|
+
.pipe(map((incomeTypesBase) => {
|
|
6777
|
+
this.cache = plainToClass(ClientIncomeTypes, incomeTypesBase);
|
|
6778
|
+
this.cacheSubject.next(this.cache);
|
|
6779
|
+
return this.cache;
|
|
6780
|
+
}));
|
|
6592
6781
|
}
|
|
6593
6782
|
}
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
6783
|
+
ClientIncomeTypesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientIncomeTypesService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6784
|
+
ClientIncomeTypesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientIncomeTypesService, providedIn: 'root' });
|
|
6785
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientIncomeTypesService, decorators: [{
|
|
6597
6786
|
type: Injectable,
|
|
6598
6787
|
args: [{
|
|
6599
6788
|
providedIn: 'root'
|
|
6600
6789
|
}]
|
|
6601
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type:
|
|
6790
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
6602
6791
|
type: Inject,
|
|
6603
6792
|
args: ['environment']
|
|
6604
6793
|
}] }]; } });
|
|
@@ -6629,19 +6818,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
6629
6818
|
}]
|
|
6630
6819
|
}] });
|
|
6631
6820
|
|
|
6821
|
+
/**
|
|
6822
|
+
* popup notifications service (toast, snackbar).
|
|
6823
|
+
*/
|
|
6824
|
+
class ToastService {
|
|
6825
|
+
constructor() {
|
|
6826
|
+
this.toast$ = new ReplaySubject(1);
|
|
6827
|
+
}
|
|
6828
|
+
get() {
|
|
6829
|
+
return this.toast$.asObservable();
|
|
6830
|
+
}
|
|
6831
|
+
add(toast) {
|
|
6832
|
+
this.toast$.next(toast);
|
|
6833
|
+
}
|
|
6834
|
+
success(message) {
|
|
6835
|
+
this.add(plainToClass(Toast, {
|
|
6836
|
+
type: ToastTypeEnum.SUCCESS,
|
|
6837
|
+
title: 'Success!',
|
|
6838
|
+
message,
|
|
6839
|
+
}));
|
|
6840
|
+
}
|
|
6841
|
+
warning(message) {
|
|
6842
|
+
this.add(plainToClass(Toast, {
|
|
6843
|
+
type: ToastTypeEnum.WARNING,
|
|
6844
|
+
title: 'Warning!',
|
|
6845
|
+
message,
|
|
6846
|
+
}));
|
|
6847
|
+
}
|
|
6848
|
+
error(message) {
|
|
6849
|
+
this.add(plainToClass(Toast, {
|
|
6850
|
+
type: ToastTypeEnum.ERROR,
|
|
6851
|
+
title: 'Error!',
|
|
6852
|
+
message,
|
|
6853
|
+
}));
|
|
6854
|
+
}
|
|
6855
|
+
info(message) {
|
|
6856
|
+
this.add(plainToClass(Toast, {
|
|
6857
|
+
type: ToastTypeEnum.INFO,
|
|
6858
|
+
title: 'Information',
|
|
6859
|
+
message,
|
|
6860
|
+
}));
|
|
6861
|
+
}
|
|
6862
|
+
}
|
|
6863
|
+
ToastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6864
|
+
ToastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
6865
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, decorators: [{
|
|
6866
|
+
type: Injectable,
|
|
6867
|
+
args: [{
|
|
6868
|
+
providedIn: 'root'
|
|
6869
|
+
}]
|
|
6870
|
+
}] });
|
|
6871
|
+
|
|
6632
6872
|
/**
|
|
6633
6873
|
* Abstract base service that implements common services functionality
|
|
6634
6874
|
* and describe abstract methods/properties that have to be implemented in child services
|
|
6635
6875
|
* Model - entity service is working with
|
|
6636
6876
|
* BaseModel - base entity model that extends by Model
|
|
6877
|
+
* @TODO Alex: refactor all services for work with collections instead of arrays
|
|
6878
|
+
* @TODO Alex: implement smart system of default toast messages
|
|
6637
6879
|
*/
|
|
6638
6880
|
class RestService {
|
|
6639
|
-
constructor(http, eventDispatcherService, environment) {
|
|
6881
|
+
constructor(http, eventDispatcherService, environment, toastService) {
|
|
6640
6882
|
this.http = http;
|
|
6641
6883
|
this.eventDispatcherService = eventDispatcherService;
|
|
6642
6884
|
this.environment = environment;
|
|
6885
|
+
this.toastService = toastService;
|
|
6643
6886
|
// subject for service cache
|
|
6644
6887
|
this.cacheSubject = new ReplaySubject(1);
|
|
6888
|
+
this.listenEvents();
|
|
6645
6889
|
}
|
|
6646
6890
|
/**
|
|
6647
6891
|
* get cached list of all instances
|
|
@@ -6688,6 +6932,9 @@ class RestService {
|
|
|
6688
6932
|
this.cache.push(newInstance);
|
|
6689
6933
|
this.updateCache();
|
|
6690
6934
|
}
|
|
6935
|
+
if (this.messageCreated) {
|
|
6936
|
+
this.toastService.success(this.messageCreated);
|
|
6937
|
+
}
|
|
6691
6938
|
return newInstance;
|
|
6692
6939
|
}));
|
|
6693
6940
|
}
|
|
@@ -6705,6 +6952,9 @@ class RestService {
|
|
|
6705
6952
|
this.cache.push(...newInstances);
|
|
6706
6953
|
this.updateCache();
|
|
6707
6954
|
}
|
|
6955
|
+
if (this.messageCreatedBatch) {
|
|
6956
|
+
this.toastService.success(this.messageCreatedBatch);
|
|
6957
|
+
}
|
|
6708
6958
|
return newInstances;
|
|
6709
6959
|
}));
|
|
6710
6960
|
}
|
|
@@ -6720,6 +6970,9 @@ class RestService {
|
|
|
6720
6970
|
const updatedInstance = this.createModelInstance(this.modelClass, updatedItem);
|
|
6721
6971
|
replace(this.cache, updatedInstance);
|
|
6722
6972
|
this.updateCache();
|
|
6973
|
+
if (this.messageUpdated) {
|
|
6974
|
+
this.toastService.success(this.messageUpdated);
|
|
6975
|
+
}
|
|
6723
6976
|
return updatedInstance;
|
|
6724
6977
|
}));
|
|
6725
6978
|
}
|
|
@@ -6736,6 +6989,9 @@ class RestService {
|
|
|
6736
6989
|
updatedInstances.forEach((instance) => {
|
|
6737
6990
|
replace(this.cache, instance);
|
|
6738
6991
|
});
|
|
6992
|
+
if (this.messageUpdatedBatch) {
|
|
6993
|
+
this.toastService.success(this.messageUpdatedBatch);
|
|
6994
|
+
}
|
|
6739
6995
|
this.updateCache();
|
|
6740
6996
|
return updatedInstances;
|
|
6741
6997
|
}));
|
|
@@ -6749,6 +7005,9 @@ class RestService {
|
|
|
6749
7005
|
.pipe(map(() => {
|
|
6750
7006
|
this.cache = this.cache.filter((item) => item['id'] !== model['id']);
|
|
6751
7007
|
this.updateCache();
|
|
7008
|
+
if (this.messageDeleted) {
|
|
7009
|
+
this.toastService.success(this.messageDeleted);
|
|
7010
|
+
}
|
|
6752
7011
|
}));
|
|
6753
7012
|
}
|
|
6754
7013
|
/**
|
|
@@ -6761,6 +7020,9 @@ class RestService {
|
|
|
6761
7020
|
const ids = models.map((model) => model['id']);
|
|
6762
7021
|
this.cache = this.cache.filter((item) => !ids.includes(item['id']));
|
|
6763
7022
|
this.updateCache();
|
|
7023
|
+
if (this.messageDeletedBatch) {
|
|
7024
|
+
this.toastService.success(this.messageDeletedBatch);
|
|
7025
|
+
}
|
|
6764
7026
|
}));
|
|
6765
7027
|
}
|
|
6766
7028
|
/**
|
|
@@ -6795,36 +7057,417 @@ class RestService {
|
|
|
6795
7057
|
* @param model The class for which you want to create an instance
|
|
6796
7058
|
* @param baseModel base model instance that we will use as constructor options
|
|
6797
7059
|
*/
|
|
6798
|
-
createModelInstance(model, baseModel) {
|
|
6799
|
-
return plainToClass(model, baseModel, { excludePrefixes: ['@'] });
|
|
7060
|
+
createModelInstance(model, baseModel) {
|
|
7061
|
+
return plainToClass(model, baseModel, { excludePrefixes: ['@'] });
|
|
7062
|
+
}
|
|
7063
|
+
/**
|
|
7064
|
+
* Method that call all listeners. Empty by default. Should be redefined by child services if required
|
|
7065
|
+
*/
|
|
7066
|
+
listenEvents() { }
|
|
7067
|
+
}
|
|
7068
|
+
RestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RestService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7069
|
+
RestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RestService, providedIn: 'root' });
|
|
7070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RestService, decorators: [{
|
|
7071
|
+
type: Injectable,
|
|
7072
|
+
args: [{
|
|
7073
|
+
providedIn: 'root'
|
|
7074
|
+
}]
|
|
7075
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
7076
|
+
type: Inject,
|
|
7077
|
+
args: ['environment']
|
|
7078
|
+
}] }, { type: ToastService }]; } });
|
|
7079
|
+
|
|
7080
|
+
/**
|
|
7081
|
+
* Service for work with Property
|
|
7082
|
+
*/
|
|
7083
|
+
class PropertyService extends RestService {
|
|
7084
|
+
constructor() {
|
|
7085
|
+
super(...arguments);
|
|
7086
|
+
this.modelClass = Property;
|
|
7087
|
+
this.url = 'properties';
|
|
7088
|
+
}
|
|
7089
|
+
listenEvents() {
|
|
7090
|
+
this.listenShareInviteAccepted();
|
|
7091
|
+
this.listenServiceSubscriptionUpdated();
|
|
7092
|
+
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
7093
|
+
this.listenMovementsChanged();
|
|
7094
|
+
}
|
|
7095
|
+
/**
|
|
7096
|
+
* Update cache when share invitation accepted
|
|
7097
|
+
*/
|
|
7098
|
+
listenShareInviteAccepted() {
|
|
7099
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
|
|
7100
|
+
}
|
|
7101
|
+
/**
|
|
7102
|
+
* Update cache when user's service subscription is updated
|
|
7103
|
+
*/
|
|
7104
|
+
listenServiceSubscriptionUpdated() {
|
|
7105
|
+
this.eventDispatcherService.on(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(() => this.resetCache());
|
|
7106
|
+
}
|
|
7107
|
+
/**
|
|
7108
|
+
* Update cache when property category changed
|
|
7109
|
+
*/
|
|
7110
|
+
listenMovementsChanged() {
|
|
7111
|
+
// @TODO change dispatcher logic to work with multiple events
|
|
7112
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED).subscribe(() => this.resetCache());
|
|
7113
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_UPDATED).subscribe(() => this.resetCache());
|
|
7114
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_DELETED).subscribe(() => this.resetCache());
|
|
7115
|
+
}
|
|
7116
|
+
update(property) {
|
|
7117
|
+
return super.update(property).pipe(map((updatedProperty) => {
|
|
7118
|
+
if (property.documentFile) {
|
|
7119
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.PROPERTY_UPDATED_WITH_DOCUMENT, property));
|
|
7120
|
+
}
|
|
7121
|
+
return updatedProperty;
|
|
7122
|
+
}));
|
|
7123
|
+
}
|
|
7124
|
+
getByCategoryId(id) {
|
|
7125
|
+
return this.get().pipe(map((properties) => {
|
|
7126
|
+
return properties.filter((property) => property.category.id === id);
|
|
7127
|
+
}));
|
|
7128
|
+
}
|
|
7129
|
+
/**
|
|
7130
|
+
* Activate deactivated property
|
|
7131
|
+
*/
|
|
7132
|
+
activate(property) {
|
|
7133
|
+
return this.http.post(`${this.environment.apiV2}/property-subscriptions`, { user: property.user, property })
|
|
7134
|
+
.pipe(map((propertySubscriptionBase) => {
|
|
7135
|
+
const newPropertySubscription = plainToClass(PropertySubscription, propertySubscriptionBase);
|
|
7136
|
+
const activatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
|
|
7137
|
+
replace(this.cache, activatedProperty);
|
|
7138
|
+
this.updateCache();
|
|
7139
|
+
}));
|
|
7140
|
+
}
|
|
7141
|
+
/**
|
|
7142
|
+
* Deactivate activated property
|
|
7143
|
+
*/
|
|
7144
|
+
deactivate(property) {
|
|
7145
|
+
return this.http.delete(`${this.environment.apiV2}/property-subscriptions/${property.getCurrentSubscription().id}`)
|
|
7146
|
+
.pipe(map(() => {
|
|
7147
|
+
const deactivatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
|
|
7148
|
+
replace(this.cache, deactivatedProperty);
|
|
7149
|
+
this.updateCache();
|
|
7150
|
+
}));
|
|
7151
|
+
}
|
|
7152
|
+
/**
|
|
7153
|
+
* Update property photo
|
|
7154
|
+
* @param property Property instance for photo update
|
|
7155
|
+
* @param photoFormData FormData with property photo image
|
|
7156
|
+
*/
|
|
7157
|
+
updatePhoto(property, photoFormData) {
|
|
7158
|
+
return this.http.post(`${this.environment.apiV2}/properties/${property.id}/photo?_method=PUT`, photoFormData)
|
|
7159
|
+
.pipe(map((photoLink) => {
|
|
7160
|
+
property.photo = photoLink;
|
|
7161
|
+
// update properties cache
|
|
7162
|
+
replace(this.cache, property);
|
|
7163
|
+
this.updateCache();
|
|
7164
|
+
}));
|
|
7165
|
+
}
|
|
7166
|
+
getByShareId(id) {
|
|
7167
|
+
return this.get().pipe(map((properties) => {
|
|
7168
|
+
return properties.filter((property) => property.user.id === id);
|
|
7169
|
+
}));
|
|
7170
|
+
}
|
|
7171
|
+
/**
|
|
7172
|
+
* Get list of active user's properties
|
|
7173
|
+
*/
|
|
7174
|
+
getActive() {
|
|
7175
|
+
return this.get().pipe(map((properties) => properties.filter((property) => property.isActive)));
|
|
7176
|
+
}
|
|
7177
|
+
}
|
|
7178
|
+
PropertyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7179
|
+
PropertyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, providedIn: 'root' });
|
|
7180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, decorators: [{
|
|
7181
|
+
type: Injectable,
|
|
7182
|
+
args: [{
|
|
7183
|
+
providedIn: 'root'
|
|
7184
|
+
}]
|
|
7185
|
+
}] });
|
|
7186
|
+
|
|
7187
|
+
/**
|
|
7188
|
+
* Service to work with income sources
|
|
7189
|
+
*/
|
|
7190
|
+
class IncomeSourceService extends RestService {
|
|
7191
|
+
constructor() {
|
|
7192
|
+
super(...arguments);
|
|
7193
|
+
this.url = 'income-sources';
|
|
7194
|
+
this.modelClass = IncomeSource;
|
|
7195
|
+
this.incomeSourceTypeSubject = new ReplaySubject(1);
|
|
7196
|
+
}
|
|
7197
|
+
/**
|
|
7198
|
+
* Get income sources tax calculation
|
|
7199
|
+
* @param salaryForecast for which tax should be calculated
|
|
7200
|
+
*/
|
|
7201
|
+
getTaxCalculation(salaryForecast) {
|
|
7202
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}/tax-calculation`, salaryForecast)
|
|
7203
|
+
.pipe(map((response) => {
|
|
7204
|
+
return plainToClass(SalaryForecast, response);
|
|
7205
|
+
}));
|
|
7206
|
+
}
|
|
7207
|
+
/**
|
|
7208
|
+
* Add batch of income sources
|
|
7209
|
+
* @param incomeSources to add
|
|
7210
|
+
*/
|
|
7211
|
+
addBatch(incomeSources) {
|
|
7212
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, incomeSources)
|
|
7213
|
+
.pipe(map((addedIncomeSources) => {
|
|
7214
|
+
// assign respond income sources to provided income sources
|
|
7215
|
+
const assignedIncomeSources = addedIncomeSources
|
|
7216
|
+
.map((incomeSource, index) => Object.assign(plainToClass(IncomeSource, {}), incomeSource, incomeSources[index]));
|
|
7217
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_CREATED, assignedIncomeSources));
|
|
7218
|
+
this.cache.push(...assignedIncomeSources);
|
|
7219
|
+
this.updateCache();
|
|
7220
|
+
return assignedIncomeSources;
|
|
7221
|
+
}));
|
|
7222
|
+
}
|
|
7223
|
+
/**
|
|
7224
|
+
* Update batch of income sources
|
|
7225
|
+
*/
|
|
7226
|
+
updateBatch(incomeSources, queryParams = {}) {
|
|
7227
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
7228
|
+
.pipe(map((updatedItems) => {
|
|
7229
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(this.modelClass, item));
|
|
7230
|
+
updatedInstances.forEach((instance) => {
|
|
7231
|
+
replace(this.cache, instance);
|
|
7232
|
+
});
|
|
7233
|
+
if (incomeSources[0].forecasts.length) {
|
|
7234
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_UPDATED, incomeSources));
|
|
7235
|
+
}
|
|
7236
|
+
this.updateCache();
|
|
7237
|
+
return updatedInstances;
|
|
7238
|
+
}));
|
|
7239
|
+
}
|
|
7240
|
+
/**
|
|
7241
|
+
* Get income sources by provided types
|
|
7242
|
+
* @param types
|
|
7243
|
+
*/
|
|
7244
|
+
getByTypes(types) {
|
|
7245
|
+
return this.get()
|
|
7246
|
+
.pipe(map((incomeSources) => incomeSources
|
|
7247
|
+
.filter((incomeSource) => types.includes(incomeSource.type))));
|
|
7248
|
+
}
|
|
7249
|
+
/**
|
|
7250
|
+
* Get other incomes types
|
|
7251
|
+
*/
|
|
7252
|
+
getIncomeSourceTypes() {
|
|
7253
|
+
if (!this.incomeSourceTypes) {
|
|
7254
|
+
this.incomeSourceTypes = [];
|
|
7255
|
+
this.http.get(`${this.environment.apiV2}/income-source-types`)
|
|
7256
|
+
.pipe(map((response) => {
|
|
7257
|
+
return response.map((item) => plainToClass(IncomeSourceType, item));
|
|
7258
|
+
}))
|
|
7259
|
+
.subscribe((otherIncomesTypes) => {
|
|
7260
|
+
this.incomeSourceTypes = otherIncomesTypes;
|
|
7261
|
+
this.incomeSourceTypeSubject.next(this.incomeSourceTypes);
|
|
7262
|
+
});
|
|
7263
|
+
}
|
|
7264
|
+
return this.incomeSourceTypeSubject.asObservable();
|
|
7265
|
+
}
|
|
7266
|
+
}
|
|
7267
|
+
IncomeSourceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7268
|
+
IncomeSourceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, providedIn: 'root' });
|
|
7269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, decorators: [{
|
|
7270
|
+
type: Injectable,
|
|
7271
|
+
args: [{
|
|
7272
|
+
providedIn: 'root'
|
|
7273
|
+
}]
|
|
7274
|
+
}] });
|
|
7275
|
+
|
|
7276
|
+
/**
|
|
7277
|
+
* Service that handling user's bank accounts logic
|
|
7278
|
+
*/
|
|
7279
|
+
class BankAccountService extends RestService {
|
|
7280
|
+
constructor() {
|
|
7281
|
+
super(...arguments);
|
|
7282
|
+
// api url parameter for bank accounts
|
|
7283
|
+
this.url = 'bank-accounts';
|
|
7284
|
+
this.modelClass = BankAccount;
|
|
7285
|
+
}
|
|
7286
|
+
/**
|
|
7287
|
+
* Listen system notifications and update cache when got basiq notification received
|
|
7288
|
+
*/
|
|
7289
|
+
listenEvents() {
|
|
7290
|
+
this.listenToEventDispatcherChanges();
|
|
7291
|
+
}
|
|
7292
|
+
/**
|
|
7293
|
+
* Created manual bank account
|
|
7294
|
+
* @param bankAccounts
|
|
7295
|
+
* @param queryParams
|
|
7296
|
+
*/
|
|
7297
|
+
addBatch(bankAccounts, queryParams = {}) {
|
|
7298
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, bankAccounts)
|
|
7299
|
+
.pipe(map((newBankAccountsBase) => {
|
|
7300
|
+
const newBankAccounts = newBankAccountsBase.map((bankAccountBase) => plainToClass(BankAccount, bankAccountBase));
|
|
7301
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_CREATED, newBankAccounts));
|
|
7302
|
+
const tempCache = _.cloneDeep(this.cache);
|
|
7303
|
+
tempCache.push(...newBankAccounts);
|
|
7304
|
+
this.cache = tempCache;
|
|
7305
|
+
this.updateCache();
|
|
7306
|
+
return newBankAccounts;
|
|
7307
|
+
}));
|
|
7308
|
+
}
|
|
7309
|
+
/**
|
|
7310
|
+
* Update bank account and fire event
|
|
7311
|
+
*/
|
|
7312
|
+
update(bankAccount) {
|
|
7313
|
+
return super.update(bankAccount).pipe(map((updatedBankAccount) => {
|
|
7314
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_UPDATED, updatedBankAccount));
|
|
7315
|
+
return updatedBankAccount;
|
|
7316
|
+
}));
|
|
7317
|
+
}
|
|
7318
|
+
/**
|
|
7319
|
+
* Update bank account opening balance
|
|
7320
|
+
* @param bankAccount Bank account for balance updating
|
|
7321
|
+
*/
|
|
7322
|
+
updateOpeningBalance(bankAccount) {
|
|
7323
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${bankAccount.id}/opening-balances/${bankAccount.getCurrentYearBalance().id}`, bankAccount.getCurrentYearBalance())
|
|
7324
|
+
.pipe(map((response) => {
|
|
7325
|
+
const tempCache = _.cloneDeep(this.cache);
|
|
7326
|
+
replace(tempCache[tempCache.findIndex((ba) => ba.id === bankAccount.id)].balances, response);
|
|
7327
|
+
this.cache = tempCache;
|
|
7328
|
+
this.updateCache();
|
|
7329
|
+
}));
|
|
7330
|
+
}
|
|
7331
|
+
/**
|
|
7332
|
+
* Update bank account current balance
|
|
7333
|
+
*/
|
|
7334
|
+
updateCurrentBalance(bankAccount) {
|
|
7335
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${bankAccount.id}/balance`, bankAccount)
|
|
7336
|
+
.pipe(map((response) => {
|
|
7337
|
+
const updatedBankAccount = plainToClass(BankAccount, response);
|
|
7338
|
+
replace(this.cache, updatedBankAccount);
|
|
7339
|
+
this.updateCache();
|
|
7340
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_UPDATED, updatedBankAccount));
|
|
7341
|
+
return updatedBankAccount;
|
|
7342
|
+
}));
|
|
7343
|
+
}
|
|
7344
|
+
getOwn() {
|
|
7345
|
+
return this.get()
|
|
7346
|
+
.pipe(map((bankAccounts) => {
|
|
7347
|
+
return bankAccounts.filter((bankAccount) => bankAccount.isOwner(+localStorage.getItem('userId')));
|
|
7348
|
+
}));
|
|
7349
|
+
}
|
|
7350
|
+
/**
|
|
7351
|
+
* Listen to EventDispatcherService events
|
|
7352
|
+
*/
|
|
7353
|
+
listenToEventDispatcherChanges() {
|
|
7354
|
+
this.eventDispatcherService.on([
|
|
7355
|
+
AppEventTypeEnum.PROPERTY_SHARE_UPDATED,
|
|
7356
|
+
AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
|
|
7357
|
+
AppEventTypeEnum.BANK_CONNECTION_ADDED
|
|
7358
|
+
]).subscribe(() => {
|
|
7359
|
+
this.fetch().subscribe((bankAccounts) => {
|
|
7360
|
+
this.cache = bankAccounts;
|
|
7361
|
+
this.updateCache();
|
|
7362
|
+
});
|
|
7363
|
+
});
|
|
7364
|
+
}
|
|
7365
|
+
}
|
|
7366
|
+
BankAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankAccountService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7367
|
+
BankAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankAccountService, providedIn: 'root' });
|
|
7368
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankAccountService, decorators: [{
|
|
7369
|
+
type: Injectable,
|
|
7370
|
+
args: [{
|
|
7371
|
+
providedIn: 'root'
|
|
7372
|
+
}]
|
|
7373
|
+
}] });
|
|
7374
|
+
|
|
7375
|
+
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|
|
7376
|
+
/**
|
|
7377
|
+
* Service for transaction allocations business logic
|
|
7378
|
+
* @TODO alex refactor
|
|
7379
|
+
*/
|
|
7380
|
+
class TransactionAllocationService extends RestService {
|
|
7381
|
+
constructor() {
|
|
7382
|
+
super(...arguments);
|
|
7383
|
+
// API URL param for transaction allocations
|
|
7384
|
+
this.url = 'transactions-allocations';
|
|
7385
|
+
this.modelClass = TransactionAllocation;
|
|
7386
|
+
}
|
|
7387
|
+
/**
|
|
7388
|
+
* Add single transaction allocation
|
|
7389
|
+
*/
|
|
7390
|
+
add(allocation) {
|
|
7391
|
+
return this.addBatch([allocation]).pipe(map((newAllocations) => newAllocations[0]));
|
|
7392
|
+
}
|
|
7393
|
+
/**
|
|
7394
|
+
* get list of transactions allocations related with passed bank transactions list
|
|
7395
|
+
*/
|
|
7396
|
+
getByTransactions(transactions) {
|
|
7397
|
+
const ids = transactions.map((transaction) => transaction.id);
|
|
7398
|
+
return this.get()
|
|
7399
|
+
.pipe(map((transactionAllocations) => {
|
|
7400
|
+
return transactionAllocations.filter((allocation) => ids.includes(allocation.transaction.id));
|
|
7401
|
+
}));
|
|
7402
|
+
}
|
|
7403
|
+
listenEvents() {
|
|
7404
|
+
this.onTransactionsCreated();
|
|
7405
|
+
this.onDepreciationCreated();
|
|
7406
|
+
this.onTransactionDeleted();
|
|
7407
|
+
}
|
|
7408
|
+
/**
|
|
7409
|
+
* Reset cache on transactions created
|
|
7410
|
+
*/
|
|
7411
|
+
onTransactionsCreated() {
|
|
7412
|
+
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(() => {
|
|
7413
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
7414
|
+
this.resetCache();
|
|
7415
|
+
});
|
|
7416
|
+
}
|
|
7417
|
+
/**
|
|
7418
|
+
* Reset cache on depreciation created
|
|
7419
|
+
*/
|
|
7420
|
+
onDepreciationCreated() {
|
|
7421
|
+
this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATIONS_CREATED).subscribe(() => {
|
|
7422
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
7423
|
+
this.resetCache();
|
|
7424
|
+
});
|
|
7425
|
+
}
|
|
7426
|
+
/**
|
|
7427
|
+
* Reset cache on transaction deleted
|
|
7428
|
+
*/
|
|
7429
|
+
onTransactionDeleted() {
|
|
7430
|
+
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTION_DELETED).subscribe(() => {
|
|
7431
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
7432
|
+
this.resetCache();
|
|
7433
|
+
});
|
|
6800
7434
|
}
|
|
6801
7435
|
}
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
7436
|
+
TransactionAllocationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7437
|
+
TransactionAllocationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, providedIn: 'root' });
|
|
7438
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, decorators: [{
|
|
6805
7439
|
type: Injectable,
|
|
6806
7440
|
args: [{
|
|
6807
7441
|
providedIn: 'root'
|
|
6808
7442
|
}]
|
|
6809
|
-
}]
|
|
6810
|
-
type: Inject,
|
|
6811
|
-
args: ['environment']
|
|
6812
|
-
}] }]; } });
|
|
7443
|
+
}] });
|
|
6813
7444
|
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
7445
|
+
var MessagesEnum$1;
|
|
7446
|
+
(function (MessagesEnum) {
|
|
7447
|
+
MessagesEnum["VEHICLE_CREATED"] = "Vehicle created successfully";
|
|
7448
|
+
MessagesEnum["VEHICLE_UPDATED"] = "Vehicle updated successfully";
|
|
7449
|
+
MessagesEnum["VEHICLE_DELETED"] = "Vehicle deleted successfully";
|
|
7450
|
+
MessagesEnum["VEHICLE_CLAIM_CREATED"] = "Vehicle claim created successfully";
|
|
7451
|
+
MessagesEnum["VEHICLE_CLAIM_UPDATED"] = "Vehicle claim updated successfully";
|
|
7452
|
+
MessagesEnum["VEHICLE_CLAIM_DELETED"] = "Vehicle claim deleted successfully";
|
|
7453
|
+
MessagesEnum["VEHICLE_LOGBOOK_CREATED"] = "Vehicle logbook created successfully";
|
|
7454
|
+
MessagesEnum["VEHICLE_LOGBOOK_UPDATED"] = "Vehicle logbook updated successfully";
|
|
7455
|
+
MessagesEnum["VEHICLE_LOGBOOK_DELETED"] = "Vehicle logbook deleted successfully";
|
|
7456
|
+
})(MessagesEnum$1 || (MessagesEnum$1 = {}));
|
|
7457
|
+
|
|
7458
|
+
class VehicleClaimService extends RestService {
|
|
6818
7459
|
constructor() {
|
|
6819
7460
|
super(...arguments);
|
|
6820
|
-
this.modelClass =
|
|
6821
|
-
this.url = '
|
|
6822
|
-
this.
|
|
7461
|
+
this.modelClass = VehicleClaim;
|
|
7462
|
+
this.url = 'vehicle-claims';
|
|
7463
|
+
this.messageCreated = MessagesEnum$1.VEHICLE_CLAIM_CREATED;
|
|
7464
|
+
this.messageUpdated = MessagesEnum$1.VEHICLE_CLAIM_UPDATED;
|
|
7465
|
+
this.messageDeleted = MessagesEnum$1.VEHICLE_CLAIM_DELETED;
|
|
6823
7466
|
}
|
|
6824
7467
|
}
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
7468
|
+
VehicleClaimService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleClaimService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7469
|
+
VehicleClaimService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleClaimService, providedIn: 'root' });
|
|
7470
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleClaimService, decorators: [{
|
|
6828
7471
|
type: Injectable,
|
|
6829
7472
|
args: [{
|
|
6830
7473
|
providedIn: 'root'
|
|
@@ -6832,111 +7475,198 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
6832
7475
|
}] });
|
|
6833
7476
|
|
|
6834
7477
|
/**
|
|
6835
|
-
* Service
|
|
7478
|
+
* Service handling user's account setup process.
|
|
7479
|
+
* Checks required steps and their completion
|
|
6836
7480
|
*/
|
|
6837
|
-
class
|
|
6838
|
-
constructor(
|
|
6839
|
-
|
|
6840
|
-
this.
|
|
6841
|
-
this.
|
|
6842
|
-
this.
|
|
6843
|
-
|
|
6844
|
-
this.
|
|
6845
|
-
this.
|
|
6846
|
-
this.listenEvents();
|
|
7481
|
+
class AccountSetupService {
|
|
7482
|
+
constructor(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService) {
|
|
7483
|
+
this.clientIncomeTypesService = clientIncomeTypesService;
|
|
7484
|
+
this.propertyService = propertyService;
|
|
7485
|
+
this.incomeSourceService = incomeSourceService;
|
|
7486
|
+
this.bankAccountsService = bankAccountsService;
|
|
7487
|
+
this.transactionAllocationService = transactionAllocationService;
|
|
7488
|
+
this.vehicleClaimService = vehicleClaimService;
|
|
7489
|
+
this.cacheSubject = new ReplaySubject(1);
|
|
6847
7490
|
}
|
|
6848
7491
|
/**
|
|
6849
|
-
*
|
|
7492
|
+
* Get list of account setup items for current user
|
|
6850
7493
|
*/
|
|
6851
|
-
|
|
6852
|
-
this.
|
|
7494
|
+
get() {
|
|
7495
|
+
if (!this.cache) {
|
|
7496
|
+
this.clientIncomeTypesService.get().subscribe((incomeTypes) => {
|
|
7497
|
+
combineLatest(this.createBatch(incomeTypes)).subscribe((items) => {
|
|
7498
|
+
this.cache = new AccountSetupItemCollection(items);
|
|
7499
|
+
this.cacheSubject.next(this.cache);
|
|
7500
|
+
});
|
|
7501
|
+
});
|
|
7502
|
+
}
|
|
7503
|
+
return this.cacheSubject.asObservable();
|
|
6853
7504
|
}
|
|
6854
7505
|
/**
|
|
6855
|
-
*
|
|
6856
|
-
* @param bankAccounts
|
|
6857
|
-
* @param queryParams
|
|
7506
|
+
* Get a single AccountSetupItem and check it's completion
|
|
6858
7507
|
*/
|
|
6859
|
-
|
|
6860
|
-
return
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
this.cache = tempCache;
|
|
6867
|
-
this.updateCache();
|
|
6868
|
-
return newBankAccounts;
|
|
7508
|
+
create(itemType, request) {
|
|
7509
|
+
return request.pipe(map((result) => {
|
|
7510
|
+
const item = ACCOUNT_SETUP_ITEMS[itemType];
|
|
7511
|
+
if (result.length) {
|
|
7512
|
+
item.isCompleted = true;
|
|
7513
|
+
}
|
|
7514
|
+
return item;
|
|
6869
7515
|
}));
|
|
6870
7516
|
}
|
|
6871
7517
|
/**
|
|
6872
|
-
*
|
|
7518
|
+
* Get batch of requests to get list of required AccountSetupItem's.
|
|
7519
|
+
* Some items are optional and depends of user's client income types
|
|
6873
7520
|
*/
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
7521
|
+
createBatch(incomeTypes) {
|
|
7522
|
+
const batch = [];
|
|
7523
|
+
// Salary item is completed when user added salary income source
|
|
7524
|
+
if (incomeTypes.salary) {
|
|
7525
|
+
batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(IncomeSourceTypeEnum.SALARY)));
|
|
7526
|
+
}
|
|
7527
|
+
// Other income item is completed when user added at least one other income source
|
|
7528
|
+
if (incomeTypes.dividends || incomeTypes.other) {
|
|
7529
|
+
batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(IncomeSourceTypeEnum.OTHER)));
|
|
7530
|
+
}
|
|
7531
|
+
// Rental income item is completed when user added at least one property
|
|
7532
|
+
if (incomeTypes.rental) {
|
|
7533
|
+
batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
|
|
7534
|
+
}
|
|
7535
|
+
// Bank feeds item is completed when user added at least one bank account (basiq or manual)
|
|
7536
|
+
batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
|
|
7537
|
+
// Logbook item is completed when user has at least one vehicle claim with any method (klms or logbook)
|
|
7538
|
+
batch.push(this.create(AccountSetupItemsEnum.WORK_LOGBOOK, this.vehicleClaimService.get()));
|
|
7539
|
+
// @TODO waiting for sole tank forecast page
|
|
7540
|
+
// Sole item is completed when user added at least one sole income source
|
|
7541
|
+
// if (incomeTypes.soleTrader) {
|
|
7542
|
+
// batch.push(
|
|
7543
|
+
// this.prepareItem(
|
|
7544
|
+
// AccountSetupItemsEnum.SOLE_INCOME,
|
|
7545
|
+
// this.getIncomeSourcesByType(IncomeSourceTypeEnum.SOLE)
|
|
7546
|
+
// )
|
|
7547
|
+
// );
|
|
7548
|
+
// }
|
|
7549
|
+
// Allocation item is completed when user added at least one transaction allocation
|
|
7550
|
+
batch.push(this.create(AccountSetupItemsEnum.TRANSACTION, this.transactionAllocationService.get()));
|
|
7551
|
+
return batch;
|
|
7552
|
+
}
|
|
7553
|
+
/**
|
|
7554
|
+
* @TODO work with collection when services refactored
|
|
7555
|
+
*/
|
|
7556
|
+
getIncomeSourcesByType(type) {
|
|
7557
|
+
return this.incomeSourceService.get().pipe(map((incomeSources) => {
|
|
7558
|
+
return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
|
|
7559
|
+
}));
|
|
7560
|
+
}
|
|
7561
|
+
}
|
|
7562
|
+
AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, deps: [{ token: ClientIncomeTypesService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7563
|
+
AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
|
|
7564
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, decorators: [{
|
|
7565
|
+
type: Injectable,
|
|
7566
|
+
args: [{
|
|
7567
|
+
providedIn: 'root'
|
|
7568
|
+
}]
|
|
7569
|
+
}], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }]; } });
|
|
7570
|
+
|
|
7571
|
+
class AddressService {
|
|
7572
|
+
constructor(http, environment) {
|
|
7573
|
+
this.http = http;
|
|
7574
|
+
this.environment = environment;
|
|
7575
|
+
this.countriesSubject = new ReplaySubject(1);
|
|
7576
|
+
}
|
|
7577
|
+
getCountries() {
|
|
7578
|
+
if (!this._countries) {
|
|
7579
|
+
this.http.get(`${this.environment.apiV2}/countries`)
|
|
7580
|
+
.pipe(map((response) => {
|
|
7581
|
+
return response['hydra:member'].map((item) => plainToClass(Country, item));
|
|
7582
|
+
}))
|
|
7583
|
+
.subscribe((countries) => {
|
|
7584
|
+
this._countries = countries;
|
|
7585
|
+
this.countriesSubject.next(countries);
|
|
7586
|
+
});
|
|
7587
|
+
}
|
|
7588
|
+
return this.countriesSubject.asObservable();
|
|
7589
|
+
}
|
|
7590
|
+
}
|
|
7591
|
+
AddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7592
|
+
AddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, providedIn: 'root' });
|
|
7593
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, decorators: [{
|
|
7594
|
+
type: Injectable,
|
|
7595
|
+
args: [{
|
|
7596
|
+
providedIn: 'root'
|
|
7597
|
+
}]
|
|
7598
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
7599
|
+
type: Inject,
|
|
7600
|
+
args: ['environment']
|
|
7601
|
+
}] }]; } });
|
|
7602
|
+
|
|
7603
|
+
/**
|
|
7604
|
+
* Service to work with assets (documents, receipts, e.t.c.)
|
|
7605
|
+
*/
|
|
7606
|
+
class AssetsService {
|
|
7607
|
+
constructor(http, userSwitcherService, environment) {
|
|
7608
|
+
this.http = http;
|
|
7609
|
+
this.userSwitcherService = userSwitcherService;
|
|
7610
|
+
this.environment = environment;
|
|
7611
|
+
this.impersonatedClient = this.userSwitcherService.get();
|
|
6879
7612
|
}
|
|
6880
7613
|
/**
|
|
6881
|
-
*
|
|
6882
|
-
* @param
|
|
7614
|
+
* Get asset link
|
|
7615
|
+
* @param asset to get the link for
|
|
6883
7616
|
*/
|
|
6884
|
-
|
|
6885
|
-
return this.http.
|
|
6886
|
-
.pipe(map((response) => {
|
|
6887
|
-
const tempCache = _.cloneDeep(this.cache);
|
|
6888
|
-
replace(tempCache[tempCache.findIndex((ba) => ba.id === bankAccount.id)].balances, response);
|
|
6889
|
-
this.cache = tempCache;
|
|
6890
|
-
this.updateCache();
|
|
6891
|
-
}));
|
|
7617
|
+
getLink(asset) {
|
|
7618
|
+
return this.http.get(`${this.environment.apiV2}/assets/${asset.type}/${asset.id}`);
|
|
6892
7619
|
}
|
|
6893
7620
|
/**
|
|
6894
|
-
*
|
|
7621
|
+
* Download asset
|
|
7622
|
+
* @param asset which should be downloaded
|
|
7623
|
+
* @TODO refactor
|
|
6895
7624
|
*/
|
|
6896
|
-
|
|
6897
|
-
return
|
|
6898
|
-
.pipe(map((response) => {
|
|
6899
|
-
const updatedBankAccount = plainToClass(BankAccount, response);
|
|
6900
|
-
replace(this.cache, updatedBankAccount);
|
|
6901
|
-
this.updateCache();
|
|
6902
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_UPDATED, updatedBankAccount));
|
|
6903
|
-
return updatedBankAccount;
|
|
6904
|
-
}));
|
|
6905
|
-
}
|
|
6906
|
-
getOwn() {
|
|
6907
|
-
return this.get()
|
|
6908
|
-
.pipe(map((bankAccounts) => {
|
|
6909
|
-
return bankAccounts.filter((bankAccount) => bankAccount.isOwner(+localStorage.getItem('userId')));
|
|
6910
|
-
}));
|
|
7625
|
+
download(asset) {
|
|
7626
|
+
return `${this.environment.apiV2}/assets/${asset.type}/${asset.id}/download?bearer=${localStorage.getItem('token')}${this.impersonatedClient ? `&_switch_user=${this.impersonatedClient}` : ''}`;
|
|
6911
7627
|
}
|
|
7628
|
+
// @Todo refactor to event dispatcher
|
|
6912
7629
|
/**
|
|
6913
|
-
*
|
|
7630
|
+
* Delete asset
|
|
7631
|
+
* @param entityId: id of asset main entity (property, folder, transaction, e.t.c.)
|
|
7632
|
+
* @param asset which should be deleted
|
|
6914
7633
|
*/
|
|
6915
|
-
|
|
6916
|
-
this.
|
|
6917
|
-
AppEventTypeEnum.PROPERTY_SHARE_UPDATED,
|
|
6918
|
-
AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
|
|
6919
|
-
AppEventTypeEnum.BANK_CONNECTION_ADDED
|
|
6920
|
-
]).subscribe(() => {
|
|
6921
|
-
this.fetch().subscribe((bankAccounts) => {
|
|
6922
|
-
this.cache = bankAccounts;
|
|
6923
|
-
this.updateCache();
|
|
6924
|
-
});
|
|
6925
|
-
});
|
|
7634
|
+
delete(entityId, asset) {
|
|
7635
|
+
return this.http.delete(`${this.environment.apiV2}/${asset.entityType}/${entityId}/${asset.type}/${asset.id}`);
|
|
6926
7636
|
}
|
|
6927
7637
|
}
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
7638
|
+
AssetsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, deps: [{ token: i1.HttpClient }, { token: UserSwitcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7639
|
+
AssetsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, providedIn: 'root' });
|
|
7640
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, decorators: [{
|
|
6931
7641
|
type: Injectable,
|
|
6932
7642
|
args: [{
|
|
6933
7643
|
providedIn: 'root'
|
|
6934
7644
|
}]
|
|
6935
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type:
|
|
7645
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: UserSwitcherService }, { type: undefined, decorators: [{
|
|
6936
7646
|
type: Inject,
|
|
6937
7647
|
args: ['environment']
|
|
6938
7648
|
}] }]; } });
|
|
6939
7649
|
|
|
7650
|
+
/**
|
|
7651
|
+
* Service that handling banks logic
|
|
7652
|
+
*/
|
|
7653
|
+
class BankService extends RestService {
|
|
7654
|
+
constructor() {
|
|
7655
|
+
super(...arguments);
|
|
7656
|
+
this.modelClass = Bank;
|
|
7657
|
+
this.url = 'banks';
|
|
7658
|
+
this.isHydra = true;
|
|
7659
|
+
}
|
|
7660
|
+
}
|
|
7661
|
+
BankService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7662
|
+
BankService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, providedIn: 'root' });
|
|
7663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, decorators: [{
|
|
7664
|
+
type: Injectable,
|
|
7665
|
+
args: [{
|
|
7666
|
+
providedIn: 'root'
|
|
7667
|
+
}]
|
|
7668
|
+
}] });
|
|
7669
|
+
|
|
6940
7670
|
/**
|
|
6941
7671
|
* @TODO move to collection
|
|
6942
7672
|
*/
|
|
@@ -7031,14 +7761,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7031
7761
|
* service handles BankConnection management
|
|
7032
7762
|
*/
|
|
7033
7763
|
class BankConnectionService extends RestService {
|
|
7034
|
-
constructor(
|
|
7035
|
-
super(
|
|
7036
|
-
this.http = http;
|
|
7037
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7038
|
-
this.environment = environment;
|
|
7764
|
+
constructor() {
|
|
7765
|
+
super(...arguments);
|
|
7039
7766
|
this.modelClass = BankConnection;
|
|
7040
7767
|
this.url = 'bank-connections';
|
|
7041
|
-
this.listenEvents();
|
|
7042
7768
|
}
|
|
7043
7769
|
listenEvents() {
|
|
7044
7770
|
this.listenToAddedBankAccounts();
|
|
@@ -7056,31 +7782,24 @@ class BankConnectionService extends RestService {
|
|
|
7056
7782
|
});
|
|
7057
7783
|
}
|
|
7058
7784
|
}
|
|
7059
|
-
BankConnectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, deps:
|
|
7785
|
+
BankConnectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7060
7786
|
BankConnectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, providedIn: 'root' });
|
|
7061
7787
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, decorators: [{
|
|
7062
7788
|
type: Injectable,
|
|
7063
7789
|
args: [{
|
|
7064
7790
|
providedIn: 'root'
|
|
7065
7791
|
}]
|
|
7066
|
-
}]
|
|
7067
|
-
type: Inject,
|
|
7068
|
-
args: ['environment']
|
|
7069
|
-
}] }]; } });
|
|
7792
|
+
}] });
|
|
7070
7793
|
|
|
7071
7794
|
/**
|
|
7072
7795
|
* Service for bank transactions business logic
|
|
7073
7796
|
*/
|
|
7074
7797
|
class BankTransactionService extends RestService {
|
|
7075
|
-
constructor(
|
|
7076
|
-
super(
|
|
7077
|
-
this.http = http;
|
|
7078
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7079
|
-
this.environment = environment;
|
|
7798
|
+
constructor() {
|
|
7799
|
+
super(...arguments);
|
|
7080
7800
|
// url part for BankTransaction API
|
|
7081
7801
|
this.url = 'bank-transactions';
|
|
7082
7802
|
this.modelClass = BankTransaction;
|
|
7083
|
-
this.listenEvents();
|
|
7084
7803
|
}
|
|
7085
7804
|
listenEvents() {
|
|
7086
7805
|
this.listenBankTransactionsImport();
|
|
@@ -7134,32 +7853,25 @@ class BankTransactionService extends RestService {
|
|
|
7134
7853
|
});
|
|
7135
7854
|
}
|
|
7136
7855
|
}
|
|
7137
|
-
BankTransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, deps:
|
|
7856
|
+
BankTransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7138
7857
|
BankTransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, providedIn: 'root' });
|
|
7139
7858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, decorators: [{
|
|
7140
7859
|
type: Injectable,
|
|
7141
7860
|
args: [{
|
|
7142
7861
|
providedIn: 'root'
|
|
7143
7862
|
}]
|
|
7144
|
-
}]
|
|
7145
|
-
type: Inject,
|
|
7146
|
-
args: ['environment']
|
|
7147
|
-
}] }]; } });
|
|
7863
|
+
}] });
|
|
7148
7864
|
|
|
7149
7865
|
/**
|
|
7150
7866
|
* basiq is a middleman between bank and user
|
|
7151
7867
|
* service is responsible for fetching bank related information
|
|
7152
7868
|
*/
|
|
7153
7869
|
class BasiqService extends RestService {
|
|
7154
|
-
constructor(
|
|
7155
|
-
super(
|
|
7156
|
-
this.http = http;
|
|
7157
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7158
|
-
this.environment = environment;
|
|
7870
|
+
constructor() {
|
|
7871
|
+
super(...arguments);
|
|
7159
7872
|
this.tokenSubject = new ReplaySubject();
|
|
7160
7873
|
this.url = 'basiq/accounts';
|
|
7161
7874
|
this.modelClass = BankAccount;
|
|
7162
|
-
this.listenEvents();
|
|
7163
7875
|
}
|
|
7164
7876
|
/**
|
|
7165
7877
|
* Listen events from Event Dispatcher service
|
|
@@ -7217,17 +7929,14 @@ class BasiqService extends RestService {
|
|
|
7217
7929
|
});
|
|
7218
7930
|
}
|
|
7219
7931
|
}
|
|
7220
|
-
BasiqService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, deps:
|
|
7932
|
+
BasiqService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7221
7933
|
BasiqService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, providedIn: 'root' });
|
|
7222
7934
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, decorators: [{
|
|
7223
7935
|
type: Injectable,
|
|
7224
7936
|
args: [{
|
|
7225
7937
|
providedIn: 'root'
|
|
7226
7938
|
}]
|
|
7227
|
-
}]
|
|
7228
|
-
type: Inject,
|
|
7229
|
-
args: ['environment']
|
|
7230
|
-
}] }]; } });
|
|
7939
|
+
}] });
|
|
7231
7940
|
|
|
7232
7941
|
class BorrowingExpenseService {
|
|
7233
7942
|
constructor(http, environment) {
|
|
@@ -7450,21 +8159,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7450
8159
|
* Service for work with chats
|
|
7451
8160
|
*/
|
|
7452
8161
|
class ChatService extends RestService {
|
|
7453
|
-
constructor(http, eventDispatcherService, environment, sseService) {
|
|
7454
|
-
super(http, eventDispatcherService, environment);
|
|
8162
|
+
constructor(http, eventDispatcherService, environment, toastService, sseService) {
|
|
8163
|
+
super(http, eventDispatcherService, environment, toastService);
|
|
7455
8164
|
this.http = http;
|
|
7456
8165
|
this.eventDispatcherService = eventDispatcherService;
|
|
7457
8166
|
this.environment = environment;
|
|
8167
|
+
this.toastService = toastService;
|
|
7458
8168
|
this.sseService = sseService;
|
|
7459
8169
|
this.modelClass = Chat;
|
|
7460
8170
|
this.url = 'chats';
|
|
7461
8171
|
this.isHydra = true;
|
|
7462
|
-
this.listenEvents();
|
|
7463
|
-
}
|
|
7464
|
-
/**
|
|
7465
|
-
* SSE and Event Dispatcher Services listeners
|
|
7466
|
-
*/
|
|
7467
|
-
listenEvents() {
|
|
7468
8172
|
this.listenChats();
|
|
7469
8173
|
}
|
|
7470
8174
|
/**
|
|
@@ -7501,7 +8205,7 @@ class ChatService extends RestService {
|
|
|
7501
8205
|
});
|
|
7502
8206
|
}
|
|
7503
8207
|
}
|
|
7504
|
-
ChatService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChatService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8208
|
+
ChatService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChatService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7505
8209
|
ChatService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChatService, providedIn: 'root' });
|
|
7506
8210
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChatService, decorators: [{
|
|
7507
8211
|
type: Injectable,
|
|
@@ -7511,27 +8215,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7511
8215
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
7512
8216
|
type: Inject,
|
|
7513
8217
|
args: ['environment']
|
|
7514
|
-
}] }, { type: SseService }]; } });
|
|
8218
|
+
}] }, { type: ToastService }, { type: SseService }]; } });
|
|
7515
8219
|
|
|
7516
8220
|
/**
|
|
7517
8221
|
* Service for work with messages
|
|
7518
8222
|
*/
|
|
7519
8223
|
class MessageService extends RestService {
|
|
7520
|
-
constructor(http, eventDispatcherService, environment, sseService) {
|
|
7521
|
-
super(http, eventDispatcherService, environment);
|
|
8224
|
+
constructor(http, eventDispatcherService, environment, toastService, sseService) {
|
|
8225
|
+
super(http, eventDispatcherService, environment, toastService);
|
|
7522
8226
|
this.http = http;
|
|
7523
8227
|
this.eventDispatcherService = eventDispatcherService;
|
|
7524
8228
|
this.environment = environment;
|
|
8229
|
+
this.toastService = toastService;
|
|
7525
8230
|
this.sseService = sseService;
|
|
7526
8231
|
this.modelClass = Message;
|
|
7527
8232
|
this.url = 'messages';
|
|
7528
8233
|
this.isHydra = true;
|
|
7529
|
-
this.listenEvents();
|
|
7530
|
-
}
|
|
7531
|
-
/**
|
|
7532
|
-
* SSE and Event Dispatcher Services listeners
|
|
7533
|
-
*/
|
|
7534
|
-
listenEvents() {
|
|
7535
8234
|
this.listenMessages();
|
|
7536
8235
|
}
|
|
7537
8236
|
/**
|
|
@@ -7554,7 +8253,7 @@ class MessageService extends RestService {
|
|
|
7554
8253
|
});
|
|
7555
8254
|
}
|
|
7556
8255
|
}
|
|
7557
|
-
MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MessageService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8256
|
+
MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MessageService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7558
8257
|
MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MessageService, providedIn: 'root' });
|
|
7559
8258
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MessageService, decorators: [{
|
|
7560
8259
|
type: Injectable,
|
|
@@ -7564,7 +8263,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7564
8263
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
7565
8264
|
type: Inject,
|
|
7566
8265
|
args: ['environment']
|
|
7567
|
-
}] }, { type: SseService }]; } });
|
|
8266
|
+
}] }, { type: ToastService }, { type: SseService }]; } });
|
|
7568
8267
|
|
|
7569
8268
|
// @TODO improve base rest service and extend it
|
|
7570
8269
|
/**
|
|
@@ -7767,15 +8466,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7767
8466
|
}] });
|
|
7768
8467
|
|
|
7769
8468
|
class ClientMovementService extends RestService {
|
|
7770
|
-
constructor(
|
|
7771
|
-
super(
|
|
7772
|
-
this.http = http;
|
|
7773
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7774
|
-
this.environment = environment;
|
|
8469
|
+
constructor() {
|
|
8470
|
+
super(...arguments);
|
|
7775
8471
|
this.modelClass = ClientMovement;
|
|
7776
8472
|
this.url = 'client-movements';
|
|
7777
8473
|
this.isHydra = true;
|
|
7778
|
-
this.listenEvents();
|
|
7779
8474
|
}
|
|
7780
8475
|
/**
|
|
7781
8476
|
* @TODO BaseRestService should return collection
|
|
@@ -7840,17 +8535,14 @@ class ClientMovementService extends RestService {
|
|
|
7840
8535
|
});
|
|
7841
8536
|
}
|
|
7842
8537
|
}
|
|
7843
|
-
ClientMovementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, deps:
|
|
8538
|
+
ClientMovementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7844
8539
|
ClientMovementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, providedIn: 'root' });
|
|
7845
8540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, decorators: [{
|
|
7846
8541
|
type: Injectable,
|
|
7847
8542
|
args: [{
|
|
7848
8543
|
providedIn: 'root'
|
|
7849
8544
|
}]
|
|
7850
|
-
}]
|
|
7851
|
-
type: Inject,
|
|
7852
|
-
args: ['environment']
|
|
7853
|
-
}] }]; } });
|
|
8545
|
+
}] });
|
|
7854
8546
|
|
|
7855
8547
|
// @Todo refactor with BaseRest service
|
|
7856
8548
|
/**
|
|
@@ -7937,14 +8629,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7937
8629
|
}] }]; } });
|
|
7938
8630
|
|
|
7939
8631
|
class DepreciationService extends RestService {
|
|
7940
|
-
constructor(
|
|
7941
|
-
super(
|
|
7942
|
-
this.http = http;
|
|
7943
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7944
|
-
this.environment = environment;
|
|
8632
|
+
constructor() {
|
|
8633
|
+
super(...arguments);
|
|
7945
8634
|
this.modelClass = Depreciation;
|
|
7946
8635
|
this.url = 'depreciations';
|
|
7947
|
-
this.listenEvents();
|
|
7948
8636
|
}
|
|
7949
8637
|
/**
|
|
7950
8638
|
* Add a single depreciation
|
|
@@ -7975,14 +8663,6 @@ class DepreciationService extends RestService {
|
|
|
7975
8663
|
this.listenToVehicleClaim();
|
|
7976
8664
|
this.listenToUpdatedBankAccount();
|
|
7977
8665
|
}
|
|
7978
|
-
/**
|
|
7979
|
-
* Get depreciations related to Vehicle category
|
|
7980
|
-
*/
|
|
7981
|
-
getVehicleDepreciations() {
|
|
7982
|
-
return this.get().pipe(map((depreciations) => {
|
|
7983
|
-
return depreciations.filter((depreciation) => depreciation.isVehicleDepreciation());
|
|
7984
|
-
}));
|
|
7985
|
-
}
|
|
7986
8666
|
getOpenBalance(depreciation) {
|
|
7987
8667
|
return this.http.post(`${this.environment.apiV2}/${this.url}/opening-balance?financialYear=${new FinancialYear().year}`, depreciation)
|
|
7988
8668
|
.pipe(map((response) => {
|
|
@@ -8057,27 +8737,21 @@ class DepreciationService extends RestService {
|
|
|
8057
8737
|
});
|
|
8058
8738
|
}
|
|
8059
8739
|
}
|
|
8060
|
-
DepreciationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, deps:
|
|
8740
|
+
DepreciationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8061
8741
|
DepreciationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, providedIn: 'root' });
|
|
8062
8742
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, decorators: [{
|
|
8063
8743
|
type: Injectable,
|
|
8064
8744
|
args: [{
|
|
8065
8745
|
providedIn: 'root'
|
|
8066
8746
|
}]
|
|
8067
|
-
}]
|
|
8068
|
-
type: Inject,
|
|
8069
|
-
args: ['environment']
|
|
8070
|
-
}] }]; } });
|
|
8747
|
+
}] });
|
|
8071
8748
|
|
|
8072
8749
|
/**
|
|
8073
8750
|
* Service to handle document-folders and depending documents logic
|
|
8074
8751
|
*/
|
|
8075
8752
|
class DocumentFolderService extends RestService {
|
|
8076
|
-
constructor(
|
|
8077
|
-
super(
|
|
8078
|
-
this.http = http;
|
|
8079
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8080
|
-
this.environment = environment;
|
|
8753
|
+
constructor() {
|
|
8754
|
+
super(...arguments);
|
|
8081
8755
|
this.url = 'folders';
|
|
8082
8756
|
this.modelClass = DocumentFolder;
|
|
8083
8757
|
}
|
|
@@ -8131,17 +8805,14 @@ class DocumentFolderService extends RestService {
|
|
|
8131
8805
|
}));
|
|
8132
8806
|
}
|
|
8133
8807
|
}
|
|
8134
|
-
DocumentFolderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, deps:
|
|
8808
|
+
DocumentFolderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8135
8809
|
DocumentFolderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, providedIn: 'root' });
|
|
8136
8810
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, decorators: [{
|
|
8137
8811
|
type: Injectable,
|
|
8138
8812
|
args: [{
|
|
8139
8813
|
providedIn: 'root'
|
|
8140
8814
|
}]
|
|
8141
|
-
}]
|
|
8142
|
-
type: Inject,
|
|
8143
|
-
args: ['environment']
|
|
8144
|
-
}] }]; } });
|
|
8815
|
+
}] });
|
|
8145
8816
|
|
|
8146
8817
|
class EmployeeService extends RestService {
|
|
8147
8818
|
constructor() {
|
|
@@ -8314,113 +8985,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8314
8985
|
}]
|
|
8315
8986
|
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }]; } });
|
|
8316
8987
|
|
|
8317
|
-
/**
|
|
8318
|
-
* Service to work with income sources
|
|
8319
|
-
*/
|
|
8320
|
-
class IncomeSourceService extends RestService {
|
|
8321
|
-
constructor(http, eventDispatcherService, environment) {
|
|
8322
|
-
super(http, eventDispatcherService, environment);
|
|
8323
|
-
this.http = http;
|
|
8324
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8325
|
-
this.environment = environment;
|
|
8326
|
-
this.url = 'income-sources';
|
|
8327
|
-
this.modelClass = IncomeSource;
|
|
8328
|
-
this.incomeSourceTypeSubject = new ReplaySubject(1);
|
|
8329
|
-
}
|
|
8330
|
-
/**
|
|
8331
|
-
* Get income sources tax calculation
|
|
8332
|
-
* @param salaryForecast for which tax should be calculated
|
|
8333
|
-
*/
|
|
8334
|
-
getTaxCalculation(salaryForecast) {
|
|
8335
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}/tax-calculation`, salaryForecast)
|
|
8336
|
-
.pipe(map((response) => {
|
|
8337
|
-
return plainToClass(SalaryForecast, response);
|
|
8338
|
-
}));
|
|
8339
|
-
}
|
|
8340
|
-
/**
|
|
8341
|
-
* Add batch of income sources
|
|
8342
|
-
* @param incomeSources to add
|
|
8343
|
-
*/
|
|
8344
|
-
addBatch(incomeSources) {
|
|
8345
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, incomeSources)
|
|
8346
|
-
.pipe(map((addedIncomeSources) => {
|
|
8347
|
-
// assign respond income sources to provided income sources
|
|
8348
|
-
const assignedIncomeSources = addedIncomeSources
|
|
8349
|
-
.map((incomeSource, index) => Object.assign(plainToClass(IncomeSource, {}), incomeSource, incomeSources[index]));
|
|
8350
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_CREATED, assignedIncomeSources));
|
|
8351
|
-
this.cache.push(...assignedIncomeSources);
|
|
8352
|
-
this.updateCache();
|
|
8353
|
-
return assignedIncomeSources;
|
|
8354
|
-
}));
|
|
8355
|
-
}
|
|
8356
|
-
/**
|
|
8357
|
-
* Update batch of income sources
|
|
8358
|
-
*/
|
|
8359
|
-
updateBatch(incomeSources, queryParams = {}) {
|
|
8360
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
8361
|
-
.pipe(map((updatedItems) => {
|
|
8362
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(this.modelClass, item));
|
|
8363
|
-
updatedInstances.forEach((instance) => {
|
|
8364
|
-
replace(this.cache, instance);
|
|
8365
|
-
});
|
|
8366
|
-
if (incomeSources[0].forecasts.length) {
|
|
8367
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_UPDATED, incomeSources));
|
|
8368
|
-
}
|
|
8369
|
-
this.updateCache();
|
|
8370
|
-
return updatedInstances;
|
|
8371
|
-
}));
|
|
8372
|
-
}
|
|
8373
|
-
/**
|
|
8374
|
-
* Get income sources by provided types
|
|
8375
|
-
* @param types
|
|
8376
|
-
*/
|
|
8377
|
-
getByTypes(types) {
|
|
8378
|
-
return this.get()
|
|
8379
|
-
.pipe(map((incomeSources) => incomeSources
|
|
8380
|
-
.filter((incomeSource) => types.includes(incomeSource.type))));
|
|
8381
|
-
}
|
|
8382
|
-
/**
|
|
8383
|
-
* Get other incomes types
|
|
8384
|
-
*/
|
|
8385
|
-
getIncomeSourceTypes() {
|
|
8386
|
-
if (!this.incomeSourceTypes) {
|
|
8387
|
-
this.incomeSourceTypes = [];
|
|
8388
|
-
this.http.get(`${this.environment.apiV2}/income-source-types`)
|
|
8389
|
-
.pipe(map((response) => {
|
|
8390
|
-
return response.map((item) => plainToClass(IncomeSourceType, item));
|
|
8391
|
-
}))
|
|
8392
|
-
.subscribe((otherIncomesTypes) => {
|
|
8393
|
-
this.incomeSourceTypes = otherIncomesTypes;
|
|
8394
|
-
this.incomeSourceTypeSubject.next(this.incomeSourceTypes);
|
|
8395
|
-
});
|
|
8396
|
-
}
|
|
8397
|
-
return this.incomeSourceTypeSubject.asObservable();
|
|
8398
|
-
}
|
|
8399
|
-
}
|
|
8400
|
-
IncomeSourceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8401
|
-
IncomeSourceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, providedIn: 'root' });
|
|
8402
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, decorators: [{
|
|
8403
|
-
type: Injectable,
|
|
8404
|
-
args: [{
|
|
8405
|
-
providedIn: 'root'
|
|
8406
|
-
}]
|
|
8407
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
8408
|
-
type: Inject,
|
|
8409
|
-
args: ['environment']
|
|
8410
|
-
}] }]; } });
|
|
8411
|
-
|
|
8412
8988
|
/**
|
|
8413
8989
|
* Service to work with Other Income Forecasts
|
|
8414
8990
|
*/
|
|
8415
8991
|
class IncomeSourceForecastService extends RestService {
|
|
8416
|
-
constructor(
|
|
8417
|
-
super(
|
|
8418
|
-
this.http = http;
|
|
8419
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8420
|
-
this.environment = environment;
|
|
8992
|
+
constructor() {
|
|
8993
|
+
super(...arguments);
|
|
8421
8994
|
this.modelClass = IncomeSourceForecast;
|
|
8422
8995
|
this.url = 'income-source-forecasts';
|
|
8423
|
-
this.listenEvents();
|
|
8424
8996
|
}
|
|
8425
8997
|
/**
|
|
8426
8998
|
* Listen to Income Sources events
|
|
@@ -8476,30 +9048,23 @@ class IncomeSourceForecastService extends RestService {
|
|
|
8476
9048
|
}).flat();
|
|
8477
9049
|
}
|
|
8478
9050
|
}
|
|
8479
|
-
IncomeSourceForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, deps:
|
|
9051
|
+
IncomeSourceForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8480
9052
|
IncomeSourceForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, providedIn: 'root' });
|
|
8481
9053
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, decorators: [{
|
|
8482
9054
|
type: Injectable,
|
|
8483
9055
|
args: [{
|
|
8484
9056
|
providedIn: 'root'
|
|
8485
9057
|
}]
|
|
8486
|
-
}]
|
|
8487
|
-
type: Inject,
|
|
8488
|
-
args: ['environment']
|
|
8489
|
-
}] }]; } });
|
|
9058
|
+
}] });
|
|
8490
9059
|
|
|
8491
9060
|
/**
|
|
8492
9061
|
* Service to work with Salary Forecasts
|
|
8493
9062
|
*/
|
|
8494
9063
|
class SalaryForecastService extends RestService {
|
|
8495
|
-
constructor(
|
|
8496
|
-
super(
|
|
8497
|
-
this.http = http;
|
|
8498
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8499
|
-
this.environment = environment;
|
|
9064
|
+
constructor() {
|
|
9065
|
+
super(...arguments);
|
|
8500
9066
|
this.modelClass = SalaryForecast;
|
|
8501
9067
|
this.url = 'salary-forecasts';
|
|
8502
|
-
this.listenEvents();
|
|
8503
9068
|
}
|
|
8504
9069
|
/**
|
|
8505
9070
|
* Listen to Income Sources events
|
|
@@ -8555,27 +9120,20 @@ class SalaryForecastService extends RestService {
|
|
|
8555
9120
|
}).flat();
|
|
8556
9121
|
}
|
|
8557
9122
|
}
|
|
8558
|
-
SalaryForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, deps:
|
|
9123
|
+
SalaryForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8559
9124
|
SalaryForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, providedIn: 'root' });
|
|
8560
9125
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, decorators: [{
|
|
8561
9126
|
type: Injectable,
|
|
8562
9127
|
args: [{
|
|
8563
9128
|
providedIn: 'root'
|
|
8564
9129
|
}]
|
|
8565
|
-
}]
|
|
8566
|
-
type: Inject,
|
|
8567
|
-
args: ['environment']
|
|
8568
|
-
}] }]; } });
|
|
9130
|
+
}] });
|
|
8569
9131
|
|
|
8570
9132
|
class SoleForecastService extends RestService {
|
|
8571
|
-
constructor(
|
|
8572
|
-
super(
|
|
8573
|
-
this.http = http;
|
|
8574
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8575
|
-
this.environment = environment;
|
|
9133
|
+
constructor() {
|
|
9134
|
+
super(...arguments);
|
|
8576
9135
|
this.modelClass = SoleForecast;
|
|
8577
9136
|
this.url = 'sole-forecasts';
|
|
8578
|
-
this.listenEvents();
|
|
8579
9137
|
}
|
|
8580
9138
|
/**
|
|
8581
9139
|
* Listen to Income Sources events
|
|
@@ -8631,17 +9189,14 @@ class SoleForecastService extends RestService {
|
|
|
8631
9189
|
}).flat();
|
|
8632
9190
|
}
|
|
8633
9191
|
}
|
|
8634
|
-
SoleForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, deps:
|
|
9192
|
+
SoleForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8635
9193
|
SoleForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, providedIn: 'root' });
|
|
8636
9194
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, decorators: [{
|
|
8637
9195
|
type: Injectable,
|
|
8638
9196
|
args: [{
|
|
8639
9197
|
providedIn: 'root'
|
|
8640
9198
|
}]
|
|
8641
|
-
}]
|
|
8642
|
-
type: Inject,
|
|
8643
|
-
args: ['environment']
|
|
8644
|
-
}] }]; } });
|
|
9199
|
+
}] });
|
|
8645
9200
|
|
|
8646
9201
|
/**
|
|
8647
9202
|
* Service to work with intercom
|
|
@@ -8713,14 +9268,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8713
9268
|
* Service that handling loans logic
|
|
8714
9269
|
*/
|
|
8715
9270
|
class LoanService extends RestService {
|
|
8716
|
-
constructor(
|
|
8717
|
-
super(
|
|
8718
|
-
this.http = http;
|
|
8719
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8720
|
-
this.environment = environment;
|
|
9271
|
+
constructor() {
|
|
9272
|
+
super(...arguments);
|
|
8721
9273
|
this.url = 'bank-accounts/loans';
|
|
8722
9274
|
this.modelClass = Loan;
|
|
8723
|
-
this.listenEvents();
|
|
8724
9275
|
}
|
|
8725
9276
|
/**
|
|
8726
9277
|
* Listen to Loans events
|
|
@@ -8830,37 +9381,29 @@ class LoanService extends RestService {
|
|
|
8830
9381
|
}));
|
|
8831
9382
|
}
|
|
8832
9383
|
}
|
|
8833
|
-
LoanService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, deps:
|
|
9384
|
+
LoanService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8834
9385
|
LoanService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, providedIn: 'root' });
|
|
8835
9386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, decorators: [{
|
|
8836
9387
|
type: Injectable,
|
|
8837
9388
|
args: [{
|
|
8838
9389
|
providedIn: 'root'
|
|
8839
9390
|
}]
|
|
8840
|
-
}]
|
|
8841
|
-
type: Inject,
|
|
8842
|
-
args: ['environment']
|
|
8843
|
-
}] }]; } });
|
|
9391
|
+
}] });
|
|
8844
9392
|
|
|
8845
9393
|
/**
|
|
8846
9394
|
* Service to handle service notifications logic
|
|
8847
9395
|
*/
|
|
8848
9396
|
class ServiceNotificationService extends RestService {
|
|
8849
|
-
constructor(http, eventDispatcherService, environment, sseService) {
|
|
8850
|
-
super(http, eventDispatcherService, environment);
|
|
9397
|
+
constructor(http, eventDispatcherService, environment, toastService, sseService) {
|
|
9398
|
+
super(http, eventDispatcherService, environment, toastService);
|
|
8851
9399
|
this.http = http;
|
|
8852
9400
|
this.eventDispatcherService = eventDispatcherService;
|
|
8853
9401
|
this.environment = environment;
|
|
9402
|
+
this.toastService = toastService;
|
|
8854
9403
|
this.sseService = sseService;
|
|
8855
9404
|
this.modelClass = Notification;
|
|
8856
9405
|
this.url = 'service-notifications';
|
|
8857
9406
|
this.isHydra = true;
|
|
8858
|
-
this.listenEvents();
|
|
8859
|
-
}
|
|
8860
|
-
/**
|
|
8861
|
-
* SSE and Event Dispatcher Services listeners
|
|
8862
|
-
*/
|
|
8863
|
-
listenEvents() {
|
|
8864
9407
|
this.listenNotifications();
|
|
8865
9408
|
}
|
|
8866
9409
|
/**
|
|
@@ -8883,7 +9426,7 @@ class ServiceNotificationService extends RestService {
|
|
|
8883
9426
|
});
|
|
8884
9427
|
}
|
|
8885
9428
|
}
|
|
8886
|
-
ServiceNotificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9429
|
+
ServiceNotificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8887
9430
|
ServiceNotificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, providedIn: 'root' });
|
|
8888
9431
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, decorators: [{
|
|
8889
9432
|
type: Injectable,
|
|
@@ -8893,7 +9436,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8893
9436
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
8894
9437
|
type: Inject,
|
|
8895
9438
|
args: ['environment']
|
|
8896
|
-
}] }, { type: SseService }]; } });
|
|
9439
|
+
}] }, { type: ToastService }, { type: SseService }]; } });
|
|
8897
9440
|
|
|
8898
9441
|
/**
|
|
8899
9442
|
* Configuration file with the settings to generate PDF file
|
|
@@ -8914,7 +9457,7 @@ const PDF_CONFIG = {
|
|
|
8914
9457
|
src: '/assets/img/icons/logo.png',
|
|
8915
9458
|
width: 30,
|
|
8916
9459
|
height: 7,
|
|
8917
|
-
positionX:
|
|
9460
|
+
positionX: 42,
|
|
8918
9461
|
positionY: 6
|
|
8919
9462
|
},
|
|
8920
9463
|
// coords for file section title (group, table, e.t.c.)
|
|
@@ -8927,194 +9470,105 @@ const PDF_CONFIG = {
|
|
|
8927
9470
|
},
|
|
8928
9471
|
table: {
|
|
8929
9472
|
headStyles: {
|
|
8930
|
-
fillColor: '#00b7f0',
|
|
8931
|
-
lineWidth: .2,
|
|
8932
|
-
halign: 'center'
|
|
8933
|
-
},
|
|
8934
|
-
footStyles: {
|
|
8935
|
-
fillColor: '#ffffff',
|
|
8936
|
-
textColor: '#000000'
|
|
8937
|
-
},
|
|
8938
|
-
}
|
|
8939
|
-
};
|
|
8940
|
-
|
|
8941
|
-
/**
|
|
8942
|
-
* Service to work with PDF (generate, download, e.t.c.)
|
|
8943
|
-
*/
|
|
8944
|
-
class PdfService {
|
|
8945
|
-
/**
|
|
8946
|
-
* Export file form provided HTML tables
|
|
8947
|
-
*/
|
|
8948
|
-
exportTables(tables, title, fileName) {
|
|
8949
|
-
const document = this.generateFromTables(tables, title);
|
|
8950
|
-
document.save(`${fileName}.pdf`);
|
|
8951
|
-
}
|
|
8952
|
-
generateFromTables(tables, title) {
|
|
8953
|
-
const pdf = new jsPDF();
|
|
8954
|
-
this.setDocumentTitle(pdf, title);
|
|
8955
|
-
this.setDocumentLogo(pdf);
|
|
8956
|
-
tables.forEach((table) => {
|
|
8957
|
-
var _a;
|
|
8958
|
-
// Add table caption if not provided
|
|
8959
|
-
if (!table.caption) {
|
|
8960
|
-
table.createCaption();
|
|
8961
|
-
table.caption.innerText = '';
|
|
8962
|
-
}
|
|
8963
|
-
// coords of last table
|
|
8964
|
-
const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
|
|
8965
|
-
pdf.text(table.caption.innerText, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
|
|
8966
|
-
// get caption height based on caption content height
|
|
8967
|
-
const captionHeight = pdf.getTextDimensions(pdf.splitTextToSize((_a = table.caption) === null || _a === void 0 ? void 0 : _a.innerText, pdf.internal.pageSize.width)).h;
|
|
8968
|
-
// table options
|
|
8969
|
-
const options = {
|
|
8970
|
-
html: table,
|
|
8971
|
-
startY: lastTableCoords + captionHeight + PDF_CONFIG.contentTitleCoords.marginTop,
|
|
8972
|
-
headStyles: PDF_CONFIG.table.headStyles,
|
|
8973
|
-
footStyles: PDF_CONFIG.table.footStyles,
|
|
8974
|
-
didParseCell: (data) => {
|
|
8975
|
-
// Align last column content to right
|
|
8976
|
-
if (data.table.columns.length > 1 && (data.column.index === data.table.columns.length - 1)) {
|
|
8977
|
-
data.cell.styles.halign = 'right';
|
|
8978
|
-
}
|
|
8979
|
-
}
|
|
8980
|
-
};
|
|
8981
|
-
autoTable(pdf, options);
|
|
8982
|
-
});
|
|
8983
|
-
return pdf;
|
|
8984
|
-
}
|
|
8985
|
-
setDocumentTitle(doc, title) {
|
|
8986
|
-
doc.setFontSize(PDF_CONFIG.text.fontSize)
|
|
8987
|
-
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
8988
|
-
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
8989
|
-
}
|
|
8990
|
-
setDocumentLogo(doc) {
|
|
8991
|
-
const logo = new Image();
|
|
8992
|
-
logo.src = PDF_CONFIG.logo.src;
|
|
8993
|
-
doc.addImage(logo, 'PNG', PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
8994
|
-
}
|
|
8995
|
-
}
|
|
8996
|
-
PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8997
|
-
PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
|
|
8998
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, decorators: [{
|
|
8999
|
-
type: Injectable,
|
|
9000
|
-
args: [{
|
|
9001
|
-
providedIn: 'root'
|
|
9002
|
-
}]
|
|
9003
|
-
}] });
|
|
9004
|
-
|
|
9005
|
-
/**
|
|
9006
|
-
* Service for work with Property
|
|
9007
|
-
*/
|
|
9008
|
-
class PropertyService extends RestService {
|
|
9009
|
-
constructor(http, eventDispatcherService, environment) {
|
|
9010
|
-
super(http, eventDispatcherService, environment);
|
|
9011
|
-
this.http = http;
|
|
9012
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9013
|
-
this.environment = environment;
|
|
9014
|
-
this.modelClass = Property;
|
|
9015
|
-
this.url = 'properties';
|
|
9016
|
-
this.listenEvents();
|
|
9017
|
-
}
|
|
9018
|
-
listenEvents() {
|
|
9019
|
-
this.listenShareInviteAccepted();
|
|
9020
|
-
this.listenServiceSubscriptionUpdated();
|
|
9021
|
-
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
9022
|
-
this.listenMovementsChanged();
|
|
9473
|
+
fillColor: '#00b7f0',
|
|
9474
|
+
lineWidth: .2,
|
|
9475
|
+
halign: 'center'
|
|
9476
|
+
},
|
|
9477
|
+
footStyles: {
|
|
9478
|
+
fillColor: '#ffffff',
|
|
9479
|
+
textColor: '#000000'
|
|
9480
|
+
},
|
|
9023
9481
|
}
|
|
9482
|
+
};
|
|
9483
|
+
|
|
9484
|
+
/**
|
|
9485
|
+
* Service to work with PDF (generate, download, e.t.c.)
|
|
9486
|
+
*/
|
|
9487
|
+
class PdfService {
|
|
9024
9488
|
/**
|
|
9025
|
-
*
|
|
9489
|
+
* Export file from provided HTML tables
|
|
9026
9490
|
*/
|
|
9027
|
-
|
|
9028
|
-
this.
|
|
9491
|
+
exportTables(tables, title, fileName, orientation) {
|
|
9492
|
+
const document = this.generateFromTables(orientation, tables, title);
|
|
9493
|
+
document.save(`${fileName}.pdf`);
|
|
9029
9494
|
}
|
|
9030
9495
|
/**
|
|
9031
|
-
*
|
|
9496
|
+
* Export file from provided array-like table data
|
|
9032
9497
|
*/
|
|
9033
|
-
|
|
9034
|
-
|
|
9498
|
+
exportFromDataTables(dataTables, title, fileName) {
|
|
9499
|
+
const document = this.generateFromDataTables(title, dataTables);
|
|
9500
|
+
document.save(`${fileName}.pdf`);
|
|
9035
9501
|
}
|
|
9036
9502
|
/**
|
|
9037
|
-
*
|
|
9503
|
+
* Generate file from array-like table data
|
|
9038
9504
|
*/
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
this.
|
|
9042
|
-
this.
|
|
9043
|
-
|
|
9505
|
+
generateFromDataTables(title, dataTables) {
|
|
9506
|
+
const pdf = new jsPDF();
|
|
9507
|
+
this.setDocumentTitle(pdf, title);
|
|
9508
|
+
this.setDocumentLogo(pdf);
|
|
9509
|
+
dataTables.forEach((dataTable) => {
|
|
9510
|
+
autoTable(pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, this.setTableOptions(pdf, dataTable.caption)));
|
|
9511
|
+
});
|
|
9512
|
+
return pdf;
|
|
9044
9513
|
}
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9514
|
+
generateFromTables(orientation, tables, title) {
|
|
9515
|
+
const pdf = new jsPDF(orientation);
|
|
9516
|
+
this.setDocumentTitle(pdf, title);
|
|
9517
|
+
this.setDocumentLogo(pdf);
|
|
9518
|
+
tables.forEach((table) => {
|
|
9519
|
+
// Add table caption if not provided
|
|
9520
|
+
if (!table.caption) {
|
|
9521
|
+
table.createCaption();
|
|
9522
|
+
table.caption.innerText = '';
|
|
9049
9523
|
}
|
|
9050
|
-
|
|
9051
|
-
})
|
|
9052
|
-
|
|
9053
|
-
getByCategoryId(id) {
|
|
9054
|
-
return this.get().pipe(map((properties) => {
|
|
9055
|
-
return properties.filter((property) => property.category.id === id);
|
|
9056
|
-
}));
|
|
9057
|
-
}
|
|
9058
|
-
/**
|
|
9059
|
-
* Activate deactivated property
|
|
9060
|
-
*/
|
|
9061
|
-
activate(property) {
|
|
9062
|
-
return this.http.post(`${this.environment.apiV2}/property-subscriptions`, { user: property.user, property })
|
|
9063
|
-
.pipe(map((propertySubscriptionBase) => {
|
|
9064
|
-
const newPropertySubscription = plainToClass(PropertySubscription, propertySubscriptionBase);
|
|
9065
|
-
const activatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
|
|
9066
|
-
replace(this.cache, activatedProperty);
|
|
9067
|
-
this.updateCache();
|
|
9068
|
-
}));
|
|
9069
|
-
}
|
|
9070
|
-
/**
|
|
9071
|
-
* Deactivate activated property
|
|
9072
|
-
*/
|
|
9073
|
-
deactivate(property) {
|
|
9074
|
-
return this.http.delete(`${this.environment.apiV2}/property-subscriptions/${property.getCurrentSubscription().id}`)
|
|
9075
|
-
.pipe(map(() => {
|
|
9076
|
-
const deactivatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
|
|
9077
|
-
replace(this.cache, deactivatedProperty);
|
|
9078
|
-
this.updateCache();
|
|
9079
|
-
}));
|
|
9524
|
+
autoTable(pdf, Object.assign({ html: table }, this.setTableOptions(pdf, table.caption.innerText)));
|
|
9525
|
+
});
|
|
9526
|
+
return pdf;
|
|
9080
9527
|
}
|
|
9081
9528
|
/**
|
|
9082
|
-
*
|
|
9083
|
-
* @param property Property instance for photo update
|
|
9084
|
-
* @param photoFormData FormData with property photo image
|
|
9529
|
+
* Set basic options for PDF table
|
|
9085
9530
|
*/
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9531
|
+
setTableOptions(pdf, tableCaption = '') {
|
|
9532
|
+
const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
|
|
9533
|
+
// get caption height based on caption content height
|
|
9534
|
+
const captionHeight = pdf.getTextDimensions(pdf.splitTextToSize(tableCaption, pdf.internal.pageSize.width)).h;
|
|
9535
|
+
pdf.text(tableCaption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
|
|
9536
|
+
return {
|
|
9537
|
+
headStyles: {
|
|
9538
|
+
fillColor: PDF_CONFIG.text.colorPrimary,
|
|
9539
|
+
},
|
|
9540
|
+
footStyles: {
|
|
9541
|
+
fillColor: PDF_CONFIG.text.colorWhite,
|
|
9542
|
+
textColor: PDF_CONFIG.text.colorBlack
|
|
9543
|
+
},
|
|
9544
|
+
startY: lastTableCoords + captionHeight + PDF_CONFIG.contentTitleCoords.marginTop,
|
|
9545
|
+
didParseCell: (data) => {
|
|
9546
|
+
// Align last column content to right
|
|
9547
|
+
if (data.table.columns.length > 1 && (data.column.index === data.table.columns.length - 1)) {
|
|
9548
|
+
data.cell.styles.halign = 'right';
|
|
9549
|
+
}
|
|
9550
|
+
}
|
|
9551
|
+
};
|
|
9094
9552
|
}
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9553
|
+
setDocumentTitle(doc, title) {
|
|
9554
|
+
doc.setFontSize(PDF_CONFIG.text.fontSize)
|
|
9555
|
+
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
9556
|
+
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
9099
9557
|
}
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
return this.get().pipe(map((properties) => properties.filter((property) => property.isActive)));
|
|
9558
|
+
setDocumentLogo(doc) {
|
|
9559
|
+
const logo = new Image();
|
|
9560
|
+
logo.src = PDF_CONFIG.logo.src;
|
|
9561
|
+
doc.addImage(logo, 'PNG', doc.internal.pageSize.width - PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
9105
9562
|
}
|
|
9106
9563
|
}
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
9564
|
+
PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9565
|
+
PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
|
|
9566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, decorators: [{
|
|
9110
9567
|
type: Injectable,
|
|
9111
9568
|
args: [{
|
|
9112
9569
|
providedIn: 'root'
|
|
9113
9570
|
}]
|
|
9114
|
-
}]
|
|
9115
|
-
type: Inject,
|
|
9116
|
-
args: ['environment']
|
|
9117
|
-
}] }]; } });
|
|
9571
|
+
}] });
|
|
9118
9572
|
|
|
9119
9573
|
function enumToList(data) {
|
|
9120
9574
|
const list = [];
|
|
@@ -9136,72 +9590,16 @@ var MessagesEnum;
|
|
|
9136
9590
|
MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
|
|
9137
9591
|
})(MessagesEnum || (MessagesEnum = {}));
|
|
9138
9592
|
|
|
9139
|
-
/**
|
|
9140
|
-
* popup notifications service (toast, snackbar).
|
|
9141
|
-
*/
|
|
9142
|
-
class ToastService {
|
|
9143
|
-
constructor() {
|
|
9144
|
-
this.toast$ = new ReplaySubject(1);
|
|
9145
|
-
}
|
|
9146
|
-
get() {
|
|
9147
|
-
return this.toast$.asObservable();
|
|
9148
|
-
}
|
|
9149
|
-
add(toast) {
|
|
9150
|
-
this.toast$.next(toast);
|
|
9151
|
-
}
|
|
9152
|
-
success(message) {
|
|
9153
|
-
this.add(plainToClass(Toast, {
|
|
9154
|
-
type: ToastTypeEnum.SUCCESS,
|
|
9155
|
-
title: 'Success!',
|
|
9156
|
-
message,
|
|
9157
|
-
}));
|
|
9158
|
-
}
|
|
9159
|
-
warning(message) {
|
|
9160
|
-
this.add(plainToClass(Toast, {
|
|
9161
|
-
type: ToastTypeEnum.WARNING,
|
|
9162
|
-
title: 'Warning!',
|
|
9163
|
-
message,
|
|
9164
|
-
}));
|
|
9165
|
-
}
|
|
9166
|
-
error(message) {
|
|
9167
|
-
this.add(plainToClass(Toast, {
|
|
9168
|
-
type: ToastTypeEnum.ERROR,
|
|
9169
|
-
title: 'Error!',
|
|
9170
|
-
message,
|
|
9171
|
-
}));
|
|
9172
|
-
}
|
|
9173
|
-
info(message) {
|
|
9174
|
-
this.add(plainToClass(Toast, {
|
|
9175
|
-
type: ToastTypeEnum.INFO,
|
|
9176
|
-
title: 'Information',
|
|
9177
|
-
message,
|
|
9178
|
-
}));
|
|
9179
|
-
}
|
|
9180
|
-
}
|
|
9181
|
-
ToastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9182
|
-
ToastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
9183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, decorators: [{
|
|
9184
|
-
type: Injectable,
|
|
9185
|
-
args: [{
|
|
9186
|
-
providedIn: 'root'
|
|
9187
|
-
}]
|
|
9188
|
-
}] });
|
|
9189
|
-
|
|
9190
9593
|
/**
|
|
9191
9594
|
* Service for transactions business logic
|
|
9192
9595
|
*/
|
|
9193
9596
|
class TransactionService extends RestService {
|
|
9194
|
-
constructor(
|
|
9195
|
-
super(
|
|
9196
|
-
this.http = http;
|
|
9197
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9198
|
-
this.environment = environment;
|
|
9199
|
-
this.toastService = toastService;
|
|
9597
|
+
constructor() {
|
|
9598
|
+
super(...arguments);
|
|
9200
9599
|
// url part for Transaction API
|
|
9201
9600
|
this.url = 'transactions';
|
|
9202
9601
|
this.modelClass = Transaction;
|
|
9203
9602
|
this.transactionDeleted = new EventEmitter();
|
|
9204
|
-
this.listenEvents();
|
|
9205
9603
|
}
|
|
9206
9604
|
/**
|
|
9207
9605
|
* Listen events from Event Dispatcher services
|
|
@@ -9269,6 +9667,15 @@ class TransactionService extends RestService {
|
|
|
9269
9667
|
return transactions.filter((transaction) => transaction.isWorkTank());
|
|
9270
9668
|
}));
|
|
9271
9669
|
}
|
|
9670
|
+
/**
|
|
9671
|
+
* Get list of property holding costs (transactions related to vacant land property)
|
|
9672
|
+
*/
|
|
9673
|
+
getPropertyHoldingCosts(propertyId) {
|
|
9674
|
+
return this.http.get(`${this.environment.apiV2}/${this.url}?propertyId=${propertyId}&propertyCategoryId=${PropertyCategoryListEnum.VACANT_LAND}`)
|
|
9675
|
+
.pipe(map((transactionsBase) => {
|
|
9676
|
+
return transactionsBase.map((transactionBase) => plainToClass(Transaction, transactionBase));
|
|
9677
|
+
}));
|
|
9678
|
+
}
|
|
9272
9679
|
/**
|
|
9273
9680
|
* get list of taxable transactions with tank type 'Work'
|
|
9274
9681
|
*/
|
|
@@ -9459,14 +9866,6 @@ class TransactionService extends RestService {
|
|
|
9459
9866
|
return null;
|
|
9460
9867
|
}
|
|
9461
9868
|
}
|
|
9462
|
-
/**
|
|
9463
|
-
* Get transactions related to Vehicle category
|
|
9464
|
-
*/
|
|
9465
|
-
getVehicleTransactions() {
|
|
9466
|
-
return this.get().pipe(map((transactions) => {
|
|
9467
|
-
return transactions.filter((transaction) => transaction.isVehicleTransaction());
|
|
9468
|
-
}));
|
|
9469
|
-
}
|
|
9470
9869
|
/**
|
|
9471
9870
|
* Listen to EventDispatcherService event related to Depreciation changing
|
|
9472
9871
|
*/
|
|
@@ -9486,17 +9885,14 @@ class TransactionService extends RestService {
|
|
|
9486
9885
|
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
|
|
9487
9886
|
}
|
|
9488
9887
|
}
|
|
9489
|
-
TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps:
|
|
9888
|
+
TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
9490
9889
|
TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, providedIn: 'root' });
|
|
9491
9890
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, decorators: [{
|
|
9492
9891
|
type: Injectable,
|
|
9493
9892
|
args: [{
|
|
9494
9893
|
providedIn: 'root'
|
|
9495
9894
|
}]
|
|
9496
|
-
}]
|
|
9497
|
-
type: Inject,
|
|
9498
|
-
args: ['environment']
|
|
9499
|
-
}] }, { type: ToastService }]; } });
|
|
9895
|
+
}] });
|
|
9500
9896
|
|
|
9501
9897
|
/**
|
|
9502
9898
|
* Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
|
|
@@ -9674,6 +10070,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
9674
10070
|
}]
|
|
9675
10071
|
}] });
|
|
9676
10072
|
|
|
10073
|
+
/**
|
|
10074
|
+
* Service to work with holding costs (transactions related to vacant land property)
|
|
10075
|
+
*/
|
|
10076
|
+
class PropertyHoldingCostsService {
|
|
10077
|
+
constructor(pdfService, currencyPipe, datePipe) {
|
|
10078
|
+
this.pdfService = pdfService;
|
|
10079
|
+
this.currencyPipe = currencyPipe;
|
|
10080
|
+
this.datePipe = datePipe;
|
|
10081
|
+
this.url = 'transactions';
|
|
10082
|
+
this.modelClass = Transaction;
|
|
10083
|
+
}
|
|
10084
|
+
initDataTable(holdingCosts) {
|
|
10085
|
+
return plainToClass(ExportDataTable, {
|
|
10086
|
+
header: ['Date', 'Description', 'Debit', 'Credit'],
|
|
10087
|
+
rows: this.getDataTableRows(holdingCosts),
|
|
10088
|
+
footer: [
|
|
10089
|
+
'Total',
|
|
10090
|
+
'',
|
|
10091
|
+
this.currencyPipe.transform(holdingCosts.sumBy('debit')).toString(),
|
|
10092
|
+
this.currencyPipe.transform(holdingCosts.sumBy('credit')).toString(),
|
|
10093
|
+
]
|
|
10094
|
+
});
|
|
10095
|
+
}
|
|
10096
|
+
/**
|
|
10097
|
+
* Get data for the exporting table rows
|
|
10098
|
+
*/
|
|
10099
|
+
getDataTableRows(holdingCosts) {
|
|
10100
|
+
return holdingCosts.items.map((transaction) => {
|
|
10101
|
+
return [
|
|
10102
|
+
this.datePipe.transform(transaction.date, 'dd/MM/YYYY').toString(),
|
|
10103
|
+
transaction.description,
|
|
10104
|
+
this.currencyPipe.transform(transaction.debit).toString(),
|
|
10105
|
+
this.currencyPipe.transform(transaction.credit).toString()
|
|
10106
|
+
];
|
|
10107
|
+
});
|
|
10108
|
+
}
|
|
10109
|
+
}
|
|
10110
|
+
PropertyHoldingCostsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i2.CurrencyPipe }, { token: i2.DatePipe }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10111
|
+
PropertyHoldingCostsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, providedIn: 'root' });
|
|
10112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, decorators: [{
|
|
10113
|
+
type: Injectable,
|
|
10114
|
+
args: [{
|
|
10115
|
+
providedIn: 'root'
|
|
10116
|
+
}]
|
|
10117
|
+
}], ctorParameters: function () { return [{ type: PdfService }, { type: i2.CurrencyPipe }, { type: i2.DatePipe }]; } });
|
|
10118
|
+
|
|
9677
10119
|
/**
|
|
9678
10120
|
* Service for work with Property Categories
|
|
9679
10121
|
*/
|
|
@@ -9697,14 +10139,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
9697
10139
|
* Class for work with Property Documents
|
|
9698
10140
|
*/
|
|
9699
10141
|
class PropertyDocumentService extends RestService {
|
|
9700
|
-
constructor(
|
|
9701
|
-
super(
|
|
9702
|
-
this.http = http;
|
|
9703
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9704
|
-
this.environment = environment;
|
|
10142
|
+
constructor() {
|
|
10143
|
+
super(...arguments);
|
|
9705
10144
|
this.modelClass = PropertyDocument;
|
|
9706
10145
|
this.url = 'properties/documents';
|
|
9707
|
-
this.listenEvents();
|
|
9708
10146
|
}
|
|
9709
10147
|
/**
|
|
9710
10148
|
* Add new Property Document
|
|
@@ -9742,29 +10180,22 @@ class PropertyDocumentService extends RestService {
|
|
|
9742
10180
|
});
|
|
9743
10181
|
}
|
|
9744
10182
|
}
|
|
9745
|
-
PropertyDocumentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, deps:
|
|
10183
|
+
PropertyDocumentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
9746
10184
|
PropertyDocumentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, providedIn: 'root' });
|
|
9747
10185
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, decorators: [{
|
|
9748
10186
|
type: Injectable,
|
|
9749
10187
|
args: [{
|
|
9750
10188
|
providedIn: 'root'
|
|
9751
10189
|
}]
|
|
9752
|
-
}]
|
|
9753
|
-
type: Inject,
|
|
9754
|
-
args: ['environment']
|
|
9755
|
-
}] }]; } });
|
|
10190
|
+
}] });
|
|
9756
10191
|
|
|
9757
10192
|
// @TODO check and improve logic during refactoring
|
|
9758
10193
|
class PropertyShareService extends RestService {
|
|
9759
|
-
constructor(
|
|
9760
|
-
super(
|
|
9761
|
-
this.http = http;
|
|
9762
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9763
|
-
this.environment = environment;
|
|
10194
|
+
constructor() {
|
|
10195
|
+
super(...arguments);
|
|
9764
10196
|
// api url parameter for properties shares
|
|
9765
10197
|
this.url = 'properties/shares';
|
|
9766
10198
|
this.modelClass = PropertyShare;
|
|
9767
|
-
this.listenEvents();
|
|
9768
10199
|
}
|
|
9769
10200
|
/**
|
|
9770
10201
|
* Listen to Event Dispatcher events
|
|
@@ -9846,17 +10277,14 @@ class PropertyShareService extends RestService {
|
|
|
9846
10277
|
});
|
|
9847
10278
|
}
|
|
9848
10279
|
}
|
|
9849
|
-
PropertyShareService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, deps:
|
|
10280
|
+
PropertyShareService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
9850
10281
|
PropertyShareService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, providedIn: 'root' });
|
|
9851
10282
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, decorators: [{
|
|
9852
10283
|
type: Injectable,
|
|
9853
10284
|
args: [{
|
|
9854
10285
|
providedIn: 'root'
|
|
9855
10286
|
}]
|
|
9856
|
-
}]
|
|
9857
|
-
type: Inject,
|
|
9858
|
-
args: ['environment']
|
|
9859
|
-
}] }]; } });
|
|
10287
|
+
}] });
|
|
9860
10288
|
|
|
9861
10289
|
class PropertySaleService extends RestService {
|
|
9862
10290
|
constructor() {
|
|
@@ -9962,9 +10390,6 @@ class SubscriptionService {
|
|
|
9962
10390
|
this.serviceSubscriptionsSubject = new ReplaySubject(1);
|
|
9963
10391
|
this.servicePaymentsSubject = new ReplaySubject(1);
|
|
9964
10392
|
this.subscriptionChangeSubject = new BehaviorSubject(null);
|
|
9965
|
-
this.listenEvents();
|
|
9966
|
-
}
|
|
9967
|
-
listenEvents() {
|
|
9968
10393
|
this.listenSubscriptions();
|
|
9969
10394
|
}
|
|
9970
10395
|
getSubscription(force = false) {
|
|
@@ -10095,14 +10520,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10095
10520
|
* Service to work with tax review
|
|
10096
10521
|
*/
|
|
10097
10522
|
class TaxReviewService extends RestService {
|
|
10098
|
-
constructor(
|
|
10099
|
-
super(
|
|
10100
|
-
this.http = http;
|
|
10101
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10102
|
-
this.environment = environment;
|
|
10523
|
+
constructor() {
|
|
10524
|
+
super(...arguments);
|
|
10103
10525
|
this.url = 'tax-reviews';
|
|
10104
10526
|
this.modelClass = TaxReview;
|
|
10105
|
-
this.listenEvents();
|
|
10106
10527
|
}
|
|
10107
10528
|
/**
|
|
10108
10529
|
* Listen events from SSE and Event Dispatcher services
|
|
@@ -10170,31 +10591,32 @@ class TaxReviewService extends RestService {
|
|
|
10170
10591
|
});
|
|
10171
10592
|
}
|
|
10172
10593
|
}
|
|
10173
|
-
TaxReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, deps:
|
|
10594
|
+
TaxReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10174
10595
|
TaxReviewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, providedIn: 'root' });
|
|
10175
10596
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, decorators: [{
|
|
10176
10597
|
type: Injectable,
|
|
10177
10598
|
args: [{
|
|
10178
10599
|
providedIn: 'root'
|
|
10179
10600
|
}]
|
|
10180
|
-
}]
|
|
10181
|
-
type: Inject,
|
|
10182
|
-
args: ['environment']
|
|
10183
|
-
}] }]; } });
|
|
10601
|
+
}] });
|
|
10184
10602
|
|
|
10185
10603
|
/**
|
|
10186
10604
|
* Service to work with tax review history
|
|
10187
10605
|
*/
|
|
10188
10606
|
class TaxReviewHistoryService extends RestService {
|
|
10189
|
-
constructor(
|
|
10190
|
-
super(
|
|
10191
|
-
this.http = http;
|
|
10192
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10193
|
-
this.environment = environment;
|
|
10607
|
+
constructor() {
|
|
10608
|
+
super(...arguments);
|
|
10194
10609
|
this.url = 'tax-reviews/history';
|
|
10195
10610
|
this.modelClass = TaxReview;
|
|
10196
|
-
|
|
10197
|
-
|
|
10611
|
+
}
|
|
10612
|
+
listenEvents() {
|
|
10613
|
+
this.listenTaxReviewUpdate();
|
|
10614
|
+
}
|
|
10615
|
+
/**
|
|
10616
|
+
* Update tax review history cache when single tax review updated.
|
|
10617
|
+
*/
|
|
10618
|
+
listenTaxReviewUpdate() {
|
|
10619
|
+
this.eventDispatcherService.on(AppEventTypeEnum.TAX_REVIEW_UPDATED).subscribe((taxReview) => {
|
|
10198
10620
|
const tempCache = _.cloneDeep(this.cache);
|
|
10199
10621
|
// insert element at the beginning of the array
|
|
10200
10622
|
tempCache.unshift(taxReview);
|
|
@@ -10203,17 +10625,14 @@ class TaxReviewHistoryService extends RestService {
|
|
|
10203
10625
|
});
|
|
10204
10626
|
}
|
|
10205
10627
|
}
|
|
10206
|
-
TaxReviewHistoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, deps:
|
|
10628
|
+
TaxReviewHistoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10207
10629
|
TaxReviewHistoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, providedIn: 'root' });
|
|
10208
10630
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, decorators: [{
|
|
10209
10631
|
type: Injectable,
|
|
10210
10632
|
args: [{
|
|
10211
10633
|
providedIn: 'root'
|
|
10212
10634
|
}]
|
|
10213
|
-
}]
|
|
10214
|
-
type: Inject,
|
|
10215
|
-
args: ['environment']
|
|
10216
|
-
}] }]; } });
|
|
10635
|
+
}] });
|
|
10217
10636
|
|
|
10218
10637
|
/**
|
|
10219
10638
|
* Service to work with tax summary logic
|
|
@@ -10277,83 +10696,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10277
10696
|
args: ['environment']
|
|
10278
10697
|
}] }]; } });
|
|
10279
10698
|
|
|
10280
|
-
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|
|
10281
|
-
/**
|
|
10282
|
-
* Service for transaction allocations business logic
|
|
10283
|
-
* @TODO alex refactor
|
|
10284
|
-
*/
|
|
10285
|
-
class TransactionAllocationService extends RestService {
|
|
10286
|
-
constructor(http, eventDispatcherService, environment) {
|
|
10287
|
-
super(http, eventDispatcherService, environment);
|
|
10288
|
-
this.http = http;
|
|
10289
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10290
|
-
this.environment = environment;
|
|
10291
|
-
// API URL param for transaction allocations
|
|
10292
|
-
this.url = 'transactions-allocations';
|
|
10293
|
-
this.modelClass = TransactionAllocation;
|
|
10294
|
-
this.listenEvents();
|
|
10295
|
-
}
|
|
10296
|
-
/**
|
|
10297
|
-
* Add single transaction allocation
|
|
10298
|
-
*/
|
|
10299
|
-
add(allocation) {
|
|
10300
|
-
return this.addBatch([allocation]).pipe(map((newAllocations) => newAllocations[0]));
|
|
10301
|
-
}
|
|
10302
|
-
/**
|
|
10303
|
-
* get list of transactions allocations related with passed bank transactions list
|
|
10304
|
-
*/
|
|
10305
|
-
getByTransactions(transactions) {
|
|
10306
|
-
const ids = transactions.map((transaction) => transaction.id);
|
|
10307
|
-
return this.get()
|
|
10308
|
-
.pipe(map((transactionAllocations) => {
|
|
10309
|
-
return transactionAllocations.filter((allocation) => ids.includes(allocation.transaction.id));
|
|
10310
|
-
}));
|
|
10311
|
-
}
|
|
10312
|
-
listenEvents() {
|
|
10313
|
-
this.onTransactionsCreated();
|
|
10314
|
-
this.onDepreciationCreated();
|
|
10315
|
-
this.onTransactionDeleted();
|
|
10316
|
-
}
|
|
10317
|
-
/**
|
|
10318
|
-
* Reset cache on transactions created
|
|
10319
|
-
*/
|
|
10320
|
-
onTransactionsCreated() {
|
|
10321
|
-
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(() => {
|
|
10322
|
-
// Update allocations cache to synchronize data and fire subscriptions
|
|
10323
|
-
this.resetCache();
|
|
10324
|
-
});
|
|
10325
|
-
}
|
|
10326
|
-
/**
|
|
10327
|
-
* Reset cache on depreciation created
|
|
10328
|
-
*/
|
|
10329
|
-
onDepreciationCreated() {
|
|
10330
|
-
this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATIONS_CREATED).subscribe(() => {
|
|
10331
|
-
// Update allocations cache to synchronize data and fire subscriptions
|
|
10332
|
-
this.resetCache();
|
|
10333
|
-
});
|
|
10334
|
-
}
|
|
10335
|
-
/**
|
|
10336
|
-
* Reset cache on transaction deleted
|
|
10337
|
-
*/
|
|
10338
|
-
onTransactionDeleted() {
|
|
10339
|
-
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTION_DELETED).subscribe(() => {
|
|
10340
|
-
// Update allocations cache to synchronize data and fire subscriptions
|
|
10341
|
-
this.resetCache();
|
|
10342
|
-
});
|
|
10343
|
-
}
|
|
10344
|
-
}
|
|
10345
|
-
TransactionAllocationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10346
|
-
TransactionAllocationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, providedIn: 'root' });
|
|
10347
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, decorators: [{
|
|
10348
|
-
type: Injectable,
|
|
10349
|
-
args: [{
|
|
10350
|
-
providedIn: 'root'
|
|
10351
|
-
}]
|
|
10352
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10353
|
-
type: Inject,
|
|
10354
|
-
args: ['environment']
|
|
10355
|
-
}] }]; } });
|
|
10356
|
-
|
|
10357
10699
|
/**
|
|
10358
10700
|
* @TODO move to collection
|
|
10359
10701
|
*/
|
|
@@ -10550,11 +10892,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10550
10892
|
}] }]; } });
|
|
10551
10893
|
|
|
10552
10894
|
class UserEventSettingService extends RestService {
|
|
10553
|
-
constructor(
|
|
10554
|
-
super(
|
|
10555
|
-
this.http = http;
|
|
10556
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10557
|
-
this.environment = environment;
|
|
10895
|
+
constructor() {
|
|
10896
|
+
super(...arguments);
|
|
10558
10897
|
this.modelClass = UserEventSetting;
|
|
10559
10898
|
this.url = 'user-event-settings';
|
|
10560
10899
|
this.isHydra = true;
|
|
@@ -10586,257 +10925,144 @@ class UserEventSettingService extends RestService {
|
|
|
10586
10925
|
}));
|
|
10587
10926
|
}
|
|
10588
10927
|
}
|
|
10589
|
-
UserEventSettingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, deps:
|
|
10928
|
+
UserEventSettingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10590
10929
|
UserEventSettingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, providedIn: 'root' });
|
|
10591
10930
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, decorators: [{
|
|
10592
10931
|
type: Injectable,
|
|
10593
10932
|
args: [{
|
|
10594
10933
|
providedIn: 'root'
|
|
10595
10934
|
}]
|
|
10596
|
-
}]
|
|
10597
|
-
type: Inject,
|
|
10598
|
-
args: ['environment']
|
|
10599
|
-
}] }]; } });
|
|
10935
|
+
}] });
|
|
10600
10936
|
|
|
10601
10937
|
class UserEventTypeService extends RestService {
|
|
10602
|
-
constructor(
|
|
10603
|
-
super(
|
|
10604
|
-
this.http = http;
|
|
10605
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10606
|
-
this.environment = environment;
|
|
10938
|
+
constructor() {
|
|
10939
|
+
super(...arguments);
|
|
10607
10940
|
this.modelClass = UserEventType;
|
|
10608
10941
|
this.url = 'user-event-types';
|
|
10609
10942
|
this.isHydra = true;
|
|
10610
10943
|
}
|
|
10611
10944
|
}
|
|
10612
|
-
UserEventTypeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, deps:
|
|
10945
|
+
UserEventTypeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10613
10946
|
UserEventTypeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, providedIn: 'root' });
|
|
10614
10947
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, decorators: [{
|
|
10615
10948
|
type: Injectable,
|
|
10616
10949
|
args: [{
|
|
10617
10950
|
providedIn: 'root'
|
|
10618
10951
|
}]
|
|
10619
|
-
}]
|
|
10620
|
-
type: Inject,
|
|
10621
|
-
args: ['environment']
|
|
10622
|
-
}] }]; } });
|
|
10952
|
+
}] });
|
|
10623
10953
|
|
|
10624
10954
|
/**
|
|
10625
10955
|
* Service that allows to work with WorkTank operations
|
|
10626
|
-
* @TODO separate
|
|
10956
|
+
* @TODO separate vehicles and logbooks to different api
|
|
10627
10957
|
*/
|
|
10628
|
-
class VehicleService {
|
|
10629
|
-
constructor(
|
|
10630
|
-
|
|
10631
|
-
this.
|
|
10632
|
-
this.
|
|
10633
|
-
this.
|
|
10634
|
-
this.
|
|
10635
|
-
this.
|
|
10636
|
-
this.vehiclesSubject = new ReplaySubject(1);
|
|
10637
|
-
this.vehicleClaimSubject = new ReplaySubject(1);
|
|
10638
|
-
this.vehicleClaimRateSubject = new ReplaySubject(1);
|
|
10639
|
-
this.vehicleTaxReturnSubject = new ReplaySubject(1);
|
|
10640
|
-
this.incomePositionsSubject = new ReplaySubject(1);
|
|
10641
|
-
}
|
|
10642
|
-
getVehicles() {
|
|
10643
|
-
// @TODO create backend for get logbook
|
|
10644
|
-
if (!this._vehicles) {
|
|
10645
|
-
this.http.get(`${this.environment.apiV2}/vehicles`)
|
|
10646
|
-
.pipe(map((response) => {
|
|
10647
|
-
return response.map((item) => plainToClass(Vehicle, item));
|
|
10648
|
-
}))
|
|
10649
|
-
.subscribe((vehicles) => {
|
|
10650
|
-
this._vehicles = vehicles;
|
|
10651
|
-
this.vehiclesSubject.next(vehicles);
|
|
10652
|
-
});
|
|
10653
|
-
}
|
|
10654
|
-
return this.vehiclesSubject.asObservable();
|
|
10655
|
-
}
|
|
10656
|
-
/**
|
|
10657
|
-
* Get vehicles claim amount
|
|
10658
|
-
*/
|
|
10659
|
-
getVehiclesClaim() {
|
|
10660
|
-
if (!this._vehicleClaim) {
|
|
10661
|
-
this.http.get(`${this.environment.apiV2}/vehicle-claims`)
|
|
10662
|
-
.pipe(map((response) => {
|
|
10663
|
-
// return Vehicle claim from backend or create new if it not exist
|
|
10664
|
-
return response.length ? response.map((item) => plainToClass(VehicleClaim, item))[0] : plainToClass(VehicleClaim, {});
|
|
10665
|
-
}))
|
|
10666
|
-
.subscribe((vehicleClaim) => {
|
|
10667
|
-
this._vehicleClaim = vehicleClaim;
|
|
10668
|
-
this.vehicleClaimSubject.next(vehicleClaim);
|
|
10669
|
-
});
|
|
10670
|
-
}
|
|
10671
|
-
return this.vehicleClaimSubject.asObservable();
|
|
10672
|
-
}
|
|
10673
|
-
/**
|
|
10674
|
-
* Add new vehicle claim
|
|
10675
|
-
* @param claim object which should be added
|
|
10676
|
-
*/
|
|
10677
|
-
addVehicleClaim(claim) {
|
|
10678
|
-
return this.http.post(`${this.environment.apiV2}/vehicle-claims`, claim).pipe(map((response) => {
|
|
10679
|
-
this._vehicleClaim = plainToClass(VehicleClaim, response);
|
|
10680
|
-
this.vehicleClaimSubject.next(this._vehicleClaim);
|
|
10681
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_CLAIM_CREATED, null));
|
|
10682
|
-
}));
|
|
10958
|
+
class VehicleService extends RestService {
|
|
10959
|
+
constructor() {
|
|
10960
|
+
super(...arguments);
|
|
10961
|
+
this.url = 'vehicles';
|
|
10962
|
+
this.modelClass = Vehicle;
|
|
10963
|
+
this.messageCreated = MessagesEnum$1.VEHICLE_CREATED;
|
|
10964
|
+
this.messageUpdated = MessagesEnum$1.VEHICLE_UPDATED;
|
|
10965
|
+
this.messageDeleted = MessagesEnum$1.VEHICLE_DELETED;
|
|
10683
10966
|
}
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
if (!this._vehicleClaimRate) {
|
|
10689
|
-
this.chartAccountsService.getChartAccountsById(ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK)
|
|
10690
|
-
.pipe(map((response) => {
|
|
10691
|
-
return response.values.find((chartAccount) => chartAccount.financialYear === new FinancialYear().year).value;
|
|
10692
|
-
}))
|
|
10693
|
-
.subscribe((claimRate) => {
|
|
10694
|
-
this._vehicleClaimRate = claimRate;
|
|
10695
|
-
this.vehicleClaimRateSubject.next(this._vehicleClaimRate);
|
|
10696
|
-
});
|
|
10697
|
-
}
|
|
10698
|
-
return this.vehicleClaimRateSubject.asObservable();
|
|
10699
|
-
}
|
|
10700
|
-
/**
|
|
10701
|
-
* Get vehicles tax return for vehicle transactions & depreciations
|
|
10702
|
-
*/
|
|
10703
|
-
getVehiclesTaxReturn() {
|
|
10704
|
-
if (!this._vehicleTaxReturn) {
|
|
10705
|
-
combineLatest([
|
|
10706
|
-
// @Todo refactor to avoid injection of another services
|
|
10707
|
-
this.transactionService.get(),
|
|
10708
|
-
this.depreciationService.get(),
|
|
10709
|
-
this.getVehiclesClaim()
|
|
10710
|
-
]).pipe(map(([transactions, depreciations, vehicleClaim]) => {
|
|
10711
|
-
const chartAccountsHeadingsIds = enumToList(ChartAccountsHeadingVehicleListEnum)
|
|
10712
|
-
.map((item) => item.value);
|
|
10713
|
-
// get transactions & depreciations which chart accounts headings are belong to vehicle category
|
|
10714
|
-
// but except KLMS transaction
|
|
10715
|
-
const filteredItems = [...transactions, ...depreciations].filter((item) => {
|
|
10716
|
-
var _a;
|
|
10717
|
-
return chartAccountsHeadingsIds.includes((_a = item.chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id) && !item.chartAccounts.isKlmsForWork();
|
|
10718
|
-
});
|
|
10719
|
-
// get claim amount sum
|
|
10720
|
-
return filteredItems.reduce((sum, item) =>
|
|
10721
|
-
// @Todo remove item.amount negative sign when depreciations will be refactored and will have negative sign
|
|
10722
|
-
sum + ((item instanceof Depreciation ? item.currentYearForecast.amount : -item.amount) * (vehicleClaim.workUsage / 100)), 0);
|
|
10723
|
-
}))
|
|
10724
|
-
.subscribe((taxReturn) => {
|
|
10725
|
-
this._vehicleTaxReturn = taxReturn;
|
|
10726
|
-
this.vehicleTaxReturnSubject.next(this._vehicleTaxReturn);
|
|
10727
|
-
});
|
|
10728
|
-
}
|
|
10729
|
-
return this.vehicleTaxReturnSubject.asObservable();
|
|
10967
|
+
listenEvents() {
|
|
10968
|
+
this.listenLogbookAdded();
|
|
10969
|
+
this.listenLogbookUpdated();
|
|
10970
|
+
this.listenLogbookDeleted();
|
|
10730
10971
|
}
|
|
10731
10972
|
/**
|
|
10732
|
-
*
|
|
10733
|
-
* @param claim which should be updated
|
|
10734
|
-
*
|
|
10735
|
-
* @TODO alex refresh depreciation/transaction cache
|
|
10973
|
+
* Add a new logbook items to the vehicle when a new one created
|
|
10736
10974
|
*/
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
this.
|
|
10743
|
-
|
|
10744
|
-
})
|
|
10975
|
+
listenLogbookAdded() {
|
|
10976
|
+
this.eventDispatcherService.on(AppEventTypeEnum.VEHICLE_LOGBOOK_CREATED)
|
|
10977
|
+
.subscribe((result) => {
|
|
10978
|
+
const tempCache = cloneDeep$1(this.cache);
|
|
10979
|
+
tempCache.find((vehicle) => vehicle.id === result.vehicleId).logbook.push(result.logbook);
|
|
10980
|
+
this.cache = tempCache;
|
|
10981
|
+
this.updateCache();
|
|
10982
|
+
});
|
|
10745
10983
|
}
|
|
10746
10984
|
/**
|
|
10747
|
-
*
|
|
10748
|
-
* @param logbook which should be added
|
|
10749
|
-
* @param vehicle for which logbook object should be added
|
|
10985
|
+
* Replace vehicle's logbook with updated instance when logbook item updated
|
|
10750
10986
|
*/
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
.
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
this.
|
|
10758
|
-
})
|
|
10987
|
+
listenLogbookUpdated() {
|
|
10988
|
+
this.eventDispatcherService.on(AppEventTypeEnum.VEHICLE_LOGBOOK_UPDATED)
|
|
10989
|
+
.subscribe((result) => {
|
|
10990
|
+
const tempCache = cloneDeep$1(this.cache);
|
|
10991
|
+
replace(tempCache.find((vehicle) => vehicle.id === result.vehicleId).logbook, result.logbook);
|
|
10992
|
+
this.cache = tempCache;
|
|
10993
|
+
this.updateCache();
|
|
10994
|
+
});
|
|
10759
10995
|
}
|
|
10760
10996
|
/**
|
|
10761
|
-
*
|
|
10762
|
-
* @param logbook which should be updated
|
|
10763
|
-
* @param vehicle for which logbook object should be updated
|
|
10997
|
+
* Remove logbook item from vehicle when logbook deleted
|
|
10764
10998
|
*/
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
const
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
this.
|
|
10773
|
-
})
|
|
10999
|
+
listenLogbookDeleted() {
|
|
11000
|
+
this.eventDispatcherService.on(AppEventTypeEnum.VEHICLE_LOGBOOK_DELETED)
|
|
11001
|
+
.subscribe((result) => {
|
|
11002
|
+
const tempCache = cloneDeep$1(this.cache);
|
|
11003
|
+
const vehicle = tempCache.find((vehicle) => vehicle.id === result.vehicleId);
|
|
11004
|
+
vehicle.logbook = vehicle.logbook.filter((logbook) => logbook.id !== result.logbook.id);
|
|
11005
|
+
this.cache = tempCache;
|
|
11006
|
+
this.updateCache();
|
|
11007
|
+
});
|
|
10774
11008
|
}
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
11009
|
+
}
|
|
11010
|
+
VehicleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
11011
|
+
VehicleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleService, providedIn: 'root' });
|
|
11012
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleService, decorators: [{
|
|
11013
|
+
type: Injectable,
|
|
11014
|
+
args: [{
|
|
11015
|
+
providedIn: 'root'
|
|
11016
|
+
}]
|
|
11017
|
+
}] });
|
|
11018
|
+
|
|
11019
|
+
/**
|
|
11020
|
+
* Vehicle logbook service. Allows user to add, update or delete vehicle trips
|
|
11021
|
+
* @TODO extend rest service after it refactored
|
|
11022
|
+
*/
|
|
11023
|
+
class VehicleLogbookService {
|
|
11024
|
+
constructor(http, eventDispatcherService, environment, toastService) {
|
|
11025
|
+
this.http = http;
|
|
11026
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
11027
|
+
this.environment = environment;
|
|
11028
|
+
this.toastService = toastService;
|
|
10790
11029
|
}
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
this._vehicles.push(plainToClass(Vehicle, response));
|
|
10799
|
-
this.vehiclesSubject.next(this._vehicles);
|
|
11030
|
+
add(logbook, vehicleId) {
|
|
11031
|
+
return this.http.post(`${this.environment.apiV2}/vehicles/${vehicleId}/logbooks`, logbook)
|
|
11032
|
+
.pipe(map((vehicleLogbookBase) => {
|
|
11033
|
+
const newVehicleLogbook = plainToClass(VehicleLogbook, vehicleLogbookBase);
|
|
11034
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_LOGBOOK_CREATED, { logbook: newVehicleLogbook, vehicleId }));
|
|
11035
|
+
this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_CREATED);
|
|
11036
|
+
return newVehicleLogbook;
|
|
10800
11037
|
}));
|
|
10801
11038
|
}
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
.pipe(map((response) => {
|
|
10809
|
-
const editedVehicleIndex = this._vehicles.findIndex((v) => v.id === vehicle.id);
|
|
10810
|
-
this._vehicles.splice(editedVehicleIndex, 1, plainToClass(Vehicle, response));
|
|
10811
|
-
this.vehiclesSubject.next(this._vehicles);
|
|
11039
|
+
update(logbook, vehicleId) {
|
|
11040
|
+
return this.http.put(`${this.environment.apiV2}/vehicles/${vehicleId}/logbooks/${logbook.id}`, logbook).pipe(map((vehicleLogbookBase) => {
|
|
11041
|
+
const updatedVehicleLogbook = plainToClass(VehicleLogbook, vehicleLogbookBase);
|
|
11042
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_LOGBOOK_UPDATED, { logbook: updatedVehicleLogbook, vehicleId }));
|
|
11043
|
+
this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_UPDATED);
|
|
11044
|
+
return plainToClass(VehicleLogbook, updatedVehicleLogbook);
|
|
10812
11045
|
}));
|
|
10813
11046
|
}
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
* @param vehicle which should be deleted
|
|
10817
|
-
*/
|
|
10818
|
-
deleteVehicle(vehicle) {
|
|
10819
|
-
return this.http.delete(`${this.environment.apiV2}/vehicles/${vehicle.id}`)
|
|
11047
|
+
delete(logbook, vehicleId) {
|
|
11048
|
+
return this.http.delete(`${this.environment.apiV2}/vehicles/${vehicleId}/logbooks/${logbook.id}`)
|
|
10820
11049
|
.pipe(map(() => {
|
|
10821
|
-
|
|
10822
|
-
this.
|
|
10823
|
-
// we update nested logbook object inside vehicles list. So list is not changed and next not emit subscriptions updates.
|
|
10824
|
-
// that is why we recreate vehicles array
|
|
10825
|
-
this.vehiclesSubject.next(this._vehicles.map((item) => plainToClass(Vehicle, item)));
|
|
11050
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_LOGBOOK_DELETED, { logbook, vehicleId }));
|
|
11051
|
+
this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_DELETED);
|
|
10826
11052
|
}));
|
|
10827
11053
|
}
|
|
10828
11054
|
}
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
11055
|
+
VehicleLogbookService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleLogbookService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
11056
|
+
VehicleLogbookService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleLogbookService, providedIn: 'root' });
|
|
11057
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleLogbookService, decorators: [{
|
|
10832
11058
|
type: Injectable,
|
|
10833
11059
|
args: [{
|
|
10834
11060
|
providedIn: 'root'
|
|
10835
11061
|
}]
|
|
10836
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type:
|
|
11062
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10837
11063
|
type: Inject,
|
|
10838
11064
|
args: ['environment']
|
|
10839
|
-
}] }]; } });
|
|
11065
|
+
}] }, { type: ToastService }]; } });
|
|
10840
11066
|
|
|
10841
11067
|
/**
|
|
10842
11068
|
* Service to work with XLSX (generate, download, e.t.c.)
|
|
@@ -10978,6 +11204,36 @@ class AbstractForm extends FormGroup {
|
|
|
10978
11204
|
}
|
|
10979
11205
|
}
|
|
10980
11206
|
|
|
11207
|
+
/**
|
|
11208
|
+
* Check if at least one form field is true, otherwise form is invalid.
|
|
11209
|
+
* Use with groups of boolean form controls (checkbox, toggle, etc.)
|
|
11210
|
+
*/
|
|
11211
|
+
function atLeastOneCheckedValidator() {
|
|
11212
|
+
return (formGroup) => {
|
|
11213
|
+
return Object.values(formGroup.controls)
|
|
11214
|
+
.find((control) => control.value) ? null : { nothingChecked: true };
|
|
11215
|
+
};
|
|
11216
|
+
}
|
|
11217
|
+
|
|
11218
|
+
class ClientIncomeTypesForm extends AbstractForm {
|
|
11219
|
+
constructor(clientIncomeTypes) {
|
|
11220
|
+
super({
|
|
11221
|
+
salary: new FormControl(clientIncomeTypes.salary),
|
|
11222
|
+
rental: new FormControl(clientIncomeTypes.rental),
|
|
11223
|
+
soleTrader: new FormControl(clientIncomeTypes.soleTrader),
|
|
11224
|
+
dividends: new FormControl(clientIncomeTypes.dividends),
|
|
11225
|
+
other: new FormControl(clientIncomeTypes.other)
|
|
11226
|
+
}, atLeastOneCheckedValidator());
|
|
11227
|
+
this.clientIncomeTypes = clientIncomeTypes;
|
|
11228
|
+
}
|
|
11229
|
+
submit() {
|
|
11230
|
+
if (!this.valid) {
|
|
11231
|
+
return null;
|
|
11232
|
+
}
|
|
11233
|
+
return Object.assign({}, this.clientIncomeTypes, this.value);
|
|
11234
|
+
}
|
|
11235
|
+
}
|
|
11236
|
+
|
|
10981
11237
|
class LoginForm extends AbstractForm {
|
|
10982
11238
|
constructor() {
|
|
10983
11239
|
super({
|
|
@@ -11050,6 +11306,131 @@ class ResetPasswordForm extends AbstractForm {
|
|
|
11050
11306
|
}
|
|
11051
11307
|
}
|
|
11052
11308
|
|
|
11309
|
+
const MAX_NAME_LENGTH = 60;
|
|
11310
|
+
class VehicleForm extends AbstractForm {
|
|
11311
|
+
constructor(vehicle) {
|
|
11312
|
+
super({
|
|
11313
|
+
name: new FormControl(vehicle.name, [Validators.required, Validators.maxLength(MAX_NAME_LENGTH)])
|
|
11314
|
+
});
|
|
11315
|
+
this.vehicle = vehicle;
|
|
11316
|
+
}
|
|
11317
|
+
/**
|
|
11318
|
+
* @TODO save model, add generics and handle it in AbstractForm
|
|
11319
|
+
*/
|
|
11320
|
+
submit() {
|
|
11321
|
+
return plainToClass(VehicleClaim, Object.assign({}, this.vehicle, this.getRawValue()));
|
|
11322
|
+
}
|
|
11323
|
+
}
|
|
11324
|
+
|
|
11325
|
+
class VehicleClaimForm extends AbstractForm {
|
|
11326
|
+
constructor(vehicleClaim, logbooks) {
|
|
11327
|
+
super({
|
|
11328
|
+
method: new FormControl(vehicleClaim.method, Validators.required),
|
|
11329
|
+
isManual: new FormControl(vehicleClaim.isManual),
|
|
11330
|
+
kilometers: new FormControl({
|
|
11331
|
+
value: vehicleClaim.kilometers,
|
|
11332
|
+
disabled: !vehicleClaim.isManual
|
|
11333
|
+
}),
|
|
11334
|
+
workUsage: new FormControl({
|
|
11335
|
+
value: vehicleClaim.workUsage,
|
|
11336
|
+
disabled: !vehicleClaim.isManual
|
|
11337
|
+
})
|
|
11338
|
+
});
|
|
11339
|
+
this.vehicleClaim = vehicleClaim;
|
|
11340
|
+
this.logbooks = logbooks;
|
|
11341
|
+
this.setIsManualState();
|
|
11342
|
+
this.listenMethodChanges();
|
|
11343
|
+
this.listenIsManualChanges();
|
|
11344
|
+
}
|
|
11345
|
+
/**
|
|
11346
|
+
* Check if vehicle claim method changed
|
|
11347
|
+
*/
|
|
11348
|
+
isMethodChanged() {
|
|
11349
|
+
return this.vehicleClaim.method !== this.get('method').value;
|
|
11350
|
+
}
|
|
11351
|
+
/**
|
|
11352
|
+
* Check if KLMs method selected
|
|
11353
|
+
*/
|
|
11354
|
+
isKLMsMethod() {
|
|
11355
|
+
return this.get('method').value === VehicleClaimMethodEnum.KMS;
|
|
11356
|
+
}
|
|
11357
|
+
/**
|
|
11358
|
+
* Check if Logbook method selected
|
|
11359
|
+
*/
|
|
11360
|
+
isLogbookMethod() {
|
|
11361
|
+
return this.get('method').value === VehicleClaimMethodEnum.LOGBOOK;
|
|
11362
|
+
}
|
|
11363
|
+
/**
|
|
11364
|
+
* Check if user selected manual calculation
|
|
11365
|
+
*/
|
|
11366
|
+
isManual() {
|
|
11367
|
+
return this.get('isManual').value;
|
|
11368
|
+
}
|
|
11369
|
+
/**
|
|
11370
|
+
* @TODO save model, add generics and handle it in AbstractForm
|
|
11371
|
+
*/
|
|
11372
|
+
submit() {
|
|
11373
|
+
return plainToClass(VehicleClaim, Object.assign({}, this.vehicleClaim, this.getRawValue()));
|
|
11374
|
+
}
|
|
11375
|
+
setIsManualState() {
|
|
11376
|
+
if (this.logbooks.isBestPeriodExist()) {
|
|
11377
|
+
this.get('isManual').enable();
|
|
11378
|
+
}
|
|
11379
|
+
else {
|
|
11380
|
+
this.get('isManual').disable();
|
|
11381
|
+
this.get('isManual').setValue(true);
|
|
11382
|
+
}
|
|
11383
|
+
}
|
|
11384
|
+
/**
|
|
11385
|
+
* Handle method field value changes.
|
|
11386
|
+
* Set work usage value depended of selected method.
|
|
11387
|
+
*/
|
|
11388
|
+
listenMethodChanges() {
|
|
11389
|
+
this.get('method').valueChanges.subscribe((method) => {
|
|
11390
|
+
if (method === VehicleClaimMethodEnum.KMS) {
|
|
11391
|
+
this.get('workUsage').setValue(0);
|
|
11392
|
+
}
|
|
11393
|
+
else if (method === VehicleClaimMethodEnum.LOGBOOK && !this.isManual()) {
|
|
11394
|
+
this.get('workUsage').setValue(this.logbooks.getBestPeriod().workUsage);
|
|
11395
|
+
}
|
|
11396
|
+
this.setValues();
|
|
11397
|
+
});
|
|
11398
|
+
}
|
|
11399
|
+
/**
|
|
11400
|
+
* Handle isManual field value changes.
|
|
11401
|
+
* Enable/disable fields depended of isManual value
|
|
11402
|
+
*/
|
|
11403
|
+
listenIsManualChanges() {
|
|
11404
|
+
this.get('isManual').valueChanges.subscribe((isManual) => {
|
|
11405
|
+
if (isManual) {
|
|
11406
|
+
this.get('kilometers').enable();
|
|
11407
|
+
this.get('workUsage').enable();
|
|
11408
|
+
}
|
|
11409
|
+
else {
|
|
11410
|
+
this.get('kilometers').disable();
|
|
11411
|
+
this.get('workUsage').disable();
|
|
11412
|
+
}
|
|
11413
|
+
this.setValues();
|
|
11414
|
+
});
|
|
11415
|
+
}
|
|
11416
|
+
/**
|
|
11417
|
+
* Set automatic calculated values depended of current method for non-manual vehicle claim
|
|
11418
|
+
*/
|
|
11419
|
+
setValues() {
|
|
11420
|
+
if (this.isManual()) {
|
|
11421
|
+
return;
|
|
11422
|
+
}
|
|
11423
|
+
switch (this.get('method').value) {
|
|
11424
|
+
case VehicleClaimMethodEnum.LOGBOOK:
|
|
11425
|
+
this.get('workUsage').setValue(this.logbooks.getBestPeriod().workUsage);
|
|
11426
|
+
break;
|
|
11427
|
+
case VehicleClaimMethodEnum.KMS:
|
|
11428
|
+
const businessKms = this.logbooks.getBusinessLogbooks().getKlms();
|
|
11429
|
+
this.get('kilometers').setValue(businessKms < this.vehicleClaim.kmsLimit ? businessKms : this.vehicleClaim.kmsLimit);
|
|
11430
|
+
}
|
|
11431
|
+
}
|
|
11432
|
+
}
|
|
11433
|
+
|
|
11053
11434
|
/**
|
|
11054
11435
|
* Public API Surface of tt-core
|
|
11055
11436
|
*/
|
|
@@ -11058,5 +11439,5 @@ class ResetPasswordForm extends AbstractForm {
|
|
|
11058
11439
|
* Generated bundle index. Do not edit.
|
|
11059
11440
|
*/
|
|
11060
11441
|
|
|
11061
|
-
export { AbstractForm, 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, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, 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, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum,
|
|
11442
|
+
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, 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, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, 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, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyHoldingCostsService, 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, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, 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, 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, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
|
|
11062
11443
|
//# sourceMappingURL=taxtank-core.js.map
|