taxtank-core 0.10.7 → 0.12.1
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 +1631 -1346
- 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/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/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/pdf/pdf-settings.js +10 -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 +6 -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 +12 -12
- package/esm2015/lib/validators/at-least-one.validator.js +11 -0
- package/esm2015/lib/validators/index.js +2 -0
- package/esm2015/public-api.js +14 -2
- package/fesm2015/taxtank-core.js +1408 -1106
- 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/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/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/pdf/pdf-settings.d.ts +9 -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 +0 -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 +3 -2
- 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 +13 -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
|
@@ -4,13 +4,13 @@ import * as i2 from '@angular/common';
|
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
6
6
|
import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
7
|
-
import { ReplaySubject, BehaviorSubject, throwError, Subject,
|
|
7
|
+
import { ReplaySubject, BehaviorSubject, throwError, Subject, combineLatest, Observable, forkJoin } from 'rxjs';
|
|
8
8
|
import { map, catchError, filter, take, switchMap, finalize, mergeMap } from 'rxjs/operators';
|
|
9
9
|
import { plainToClass, Type, Exclude, Transform, Expose, classToPlain } from 'class-transformer';
|
|
10
10
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
11
|
-
import has from 'lodash/has';
|
|
12
11
|
import get from 'lodash/get';
|
|
13
12
|
import flatten from 'lodash/flatten';
|
|
13
|
+
import hasIn from 'lodash/hasIn';
|
|
14
14
|
import first from 'lodash/first';
|
|
15
15
|
import last from 'lodash/last';
|
|
16
16
|
import uniqBy from 'lodash/uniqBy';
|
|
@@ -758,8 +758,8 @@ class CollectionDictionary {
|
|
|
758
758
|
if (!collection.length) {
|
|
759
759
|
return;
|
|
760
760
|
}
|
|
761
|
-
//
|
|
762
|
-
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])) {
|
|
763
763
|
return;
|
|
764
764
|
}
|
|
765
765
|
this.groupItems(collection, path);
|
|
@@ -946,6 +946,19 @@ class Collection {
|
|
|
946
946
|
get last() {
|
|
947
947
|
return last(this.items);
|
|
948
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
|
+
}
|
|
949
962
|
}
|
|
950
963
|
|
|
951
964
|
var BankAccountTypeEnum;
|
|
@@ -1184,7 +1197,7 @@ class BankTransactionCollection extends Collection {
|
|
|
1184
1197
|
*/
|
|
1185
1198
|
groupByTransaction(allocations) {
|
|
1186
1199
|
// Group allocations by transaction id
|
|
1187
|
-
const allocationsByTransactions = new CollectionDictionary(allocations, 'transaction');
|
|
1200
|
+
const allocationsByTransactions = new CollectionDictionary(allocations, 'transaction.id');
|
|
1188
1201
|
// Init an empty dictionary we will fill below
|
|
1189
1202
|
const bankTransactionsByTransactions = new CollectionDictionary(new BankTransactionCollection([]));
|
|
1190
1203
|
// Fill dictionary with the same keys as at allocationsByTransactions
|
|
@@ -1426,6 +1439,32 @@ class TransactionCollection extends Collection {
|
|
|
1426
1439
|
getByAllocations(allocations) {
|
|
1427
1440
|
return new TransactionCollection(this.items.filter((transaction) => allocations.hasTransaction(transaction)));
|
|
1428
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
|
+
}
|
|
1429
1468
|
}
|
|
1430
1469
|
|
|
1431
1470
|
class DepreciationCollection extends Collection {
|
|
@@ -1458,15 +1497,6 @@ class DepreciationCollection extends Collection {
|
|
|
1458
1497
|
get closeBalance() {
|
|
1459
1498
|
return this.sumBy('currentYearForecast.closeBalance');
|
|
1460
1499
|
}
|
|
1461
|
-
/**
|
|
1462
|
-
* Get new depreciations collections filtered by tank type
|
|
1463
|
-
*/
|
|
1464
|
-
getByTankType(tankType) {
|
|
1465
|
-
if (tankType === TankTypeEnum.PROPERTY) {
|
|
1466
|
-
return new DepreciationCollection(this.items.filter((depreciation) => depreciation.isPropertyTank()));
|
|
1467
|
-
}
|
|
1468
|
-
return new DepreciationCollection(this.items.filter((depreciation) => depreciation.isWorkTank()));
|
|
1469
|
-
}
|
|
1470
1500
|
getByPropertiesIds(ids) {
|
|
1471
1501
|
return new DepreciationCollection(this.items.filter((depreciation) => { var _a; return ids.includes((_a = depreciation.property) === null || _a === void 0 ? void 0 : _a.id); }));
|
|
1472
1502
|
}
|
|
@@ -1502,6 +1532,29 @@ class DepreciationCollection extends Collection {
|
|
|
1502
1532
|
return depreciation.depreciationCapitalProject;
|
|
1503
1533
|
})), 'id');
|
|
1504
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
|
+
}
|
|
1505
1558
|
/**
|
|
1506
1559
|
* Create TransactionCollection from depreciation items
|
|
1507
1560
|
*/
|
|
@@ -1581,6 +1634,38 @@ class LoanCollection extends Collection {
|
|
|
1581
1634
|
}
|
|
1582
1635
|
}
|
|
1583
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
|
+
|
|
1584
1669
|
class FinancialYear {
|
|
1585
1670
|
constructor(date) {
|
|
1586
1671
|
this.yearStartDate = '-07-01';
|
|
@@ -1625,141 +1710,6 @@ class FinancialYear {
|
|
|
1625
1710
|
}
|
|
1626
1711
|
FinancialYear.startMonthIndex = 6;
|
|
1627
1712
|
|
|
1628
|
-
class LogbookPeriod {
|
|
1629
|
-
}
|
|
1630
|
-
__decorate([
|
|
1631
|
-
Type(() => Date)
|
|
1632
|
-
], LogbookPeriod.prototype, "from", void 0);
|
|
1633
|
-
__decorate([
|
|
1634
|
-
Type(() => Date)
|
|
1635
|
-
], LogbookPeriod.prototype, "to", void 0);
|
|
1636
|
-
|
|
1637
|
-
// Class contain array of vehicle logbooks and calculate the best period for logbook claim method
|
|
1638
|
-
class LogbookCollection {
|
|
1639
|
-
constructor(vehicles) {
|
|
1640
|
-
// 12 weeks in milliseconds to check logbooks range
|
|
1641
|
-
this.logbookClaimRange = 12 * 7 * 24 * 3600 * 1000;
|
|
1642
|
-
this.trips = vehicles.map((vehicle) => vehicle.logbook).flat();
|
|
1643
|
-
this.financialYear = new FinancialYear();
|
|
1644
|
-
this.setInitialBestPeriod();
|
|
1645
|
-
}
|
|
1646
|
-
// check if summary logbooks date range less than 84 days (12 weeks)
|
|
1647
|
-
get isAutomaticLogbookCalculationAllowed() {
|
|
1648
|
-
// forbid automatic logbook calculation if no logbook trips exist
|
|
1649
|
-
if (!this.trips.length) {
|
|
1650
|
-
return false;
|
|
1651
|
-
}
|
|
1652
|
-
// forbid automatic logbook calculation if logbook trips summary date range less than 12 weeks
|
|
1653
|
-
return this.trips.slice(-1)[0].date.getTime() - this.trips[0].date.getTime() >= this.logbookClaimRange;
|
|
1654
|
-
}
|
|
1655
|
-
get bestPeriod() {
|
|
1656
|
-
// don't calculate if not allowed
|
|
1657
|
-
if (!this.isAutomaticLogbookCalculationAllowed) {
|
|
1658
|
-
return null;
|
|
1659
|
-
}
|
|
1660
|
-
this.calculateBestPeriod();
|
|
1661
|
-
return this._bestPeriod;
|
|
1662
|
-
}
|
|
1663
|
-
get workTrips() {
|
|
1664
|
-
return this.trips.filter((logbook) => logbook.isWork);
|
|
1665
|
-
}
|
|
1666
|
-
// calculate best period for logbook claim method
|
|
1667
|
-
calculateBestPeriod() {
|
|
1668
|
-
// set default best period values for real values comparison
|
|
1669
|
-
this.setInitialBestPeriod();
|
|
1670
|
-
// get best period with each trip date as start date
|
|
1671
|
-
this.workTrips.forEach((logbook) => {
|
|
1672
|
-
const dateRange = this.getDateRange(logbook.date);
|
|
1673
|
-
// get all trips included in current 12 weeks period
|
|
1674
|
-
const tripsInRange = this.trips.filter((l) => {
|
|
1675
|
-
return l.date >= dateRange.from && l.date <= dateRange.to;
|
|
1676
|
-
});
|
|
1677
|
-
// get work trips included in current 12 weeks period
|
|
1678
|
-
const workTripsInRange = tripsInRange.filter((l) => l.isWork);
|
|
1679
|
-
// calculate sum of work kilometers in current 12 weeks range
|
|
1680
|
-
const currentRangeKilometers = this.getKilometersAmount(workTripsInRange);
|
|
1681
|
-
// overwrite best period with current 12 weeks range if amount of kilometers is bigger
|
|
1682
|
-
if (currentRangeKilometers > this._bestPeriod.kilometers) {
|
|
1683
|
-
this._bestPeriod = {
|
|
1684
|
-
from: dateRange.from,
|
|
1685
|
-
to: dateRange.to,
|
|
1686
|
-
kilometers: currentRangeKilometers,
|
|
1687
|
-
workUsage: this.getLogbooksWorkUsage(tripsInRange, workTripsInRange)
|
|
1688
|
-
};
|
|
1689
|
-
}
|
|
1690
|
-
});
|
|
1691
|
-
}
|
|
1692
|
-
getDateRange(from) {
|
|
1693
|
-
// set end date after 12 weeks after start date
|
|
1694
|
-
let to = new Date(from.getTime() + this.logbookClaimRange);
|
|
1695
|
-
// set as period last 12 weeks of current year if period end date after end of current year
|
|
1696
|
-
if (to > this.financialYear.endDate) {
|
|
1697
|
-
to = this.financialYear.endDate;
|
|
1698
|
-
from = new Date(to.getTime() - this.logbookClaimRange);
|
|
1699
|
-
}
|
|
1700
|
-
return { from, to };
|
|
1701
|
-
}
|
|
1702
|
-
// calculate kilometers amount for passed trips
|
|
1703
|
-
getKilometersAmount(logbooks) {
|
|
1704
|
-
if (!logbooks.length) {
|
|
1705
|
-
return 0;
|
|
1706
|
-
}
|
|
1707
|
-
return logbooks.map((logbook) => logbook.odometerEnd - logbook.odometerStart)
|
|
1708
|
-
.reduce((prev, next) => prev + Number(next));
|
|
1709
|
-
}
|
|
1710
|
-
// calculate work usage for passed trips
|
|
1711
|
-
getLogbooksWorkUsage(logbooks, workLogbooks) {
|
|
1712
|
-
const kilometers = this.getKilometersAmount(logbooks);
|
|
1713
|
-
const workKilometers = this.getKilometersAmount(workLogbooks);
|
|
1714
|
-
return Math.round(workKilometers / kilometers * 100);
|
|
1715
|
-
}
|
|
1716
|
-
// set default best period with zero values and fin year start date for comparison in calculation
|
|
1717
|
-
setInitialBestPeriod() {
|
|
1718
|
-
// set 1st of July of current year as default start date for best period
|
|
1719
|
-
const startDate = this.financialYear.startDate;
|
|
1720
|
-
// set end custom-date after 12 weeks from start date
|
|
1721
|
-
const endDate = new Date(startDate.getTime() + this.logbookClaimRange);
|
|
1722
|
-
this._bestPeriod = plainToClass(LogbookPeriod, {
|
|
1723
|
-
from: startDate,
|
|
1724
|
-
to: endDate,
|
|
1725
|
-
kilometers: 0,
|
|
1726
|
-
workUsage: 0
|
|
1727
|
-
});
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
class MessageCollection extends Collection {
|
|
1732
|
-
getFirstUnreadMessage(user) {
|
|
1733
|
-
return this.items.find((message) => {
|
|
1734
|
-
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
1735
|
-
});
|
|
1736
|
-
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Get List of unread chats
|
|
1739
|
-
*/
|
|
1740
|
-
getUnread() {
|
|
1741
|
-
return this.items.filter((message) => !message.readAt);
|
|
1742
|
-
}
|
|
1743
|
-
/**
|
|
1744
|
-
* Check if chat has unread chats
|
|
1745
|
-
*/
|
|
1746
|
-
hasUnread() {
|
|
1747
|
-
return !!this.getUnread().length;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
/**
|
|
1752
|
-
* Collection of MessageDocument instances
|
|
1753
|
-
*/
|
|
1754
|
-
class MessageDocumentCollection extends Collection {
|
|
1755
|
-
/**
|
|
1756
|
-
* get list of documents which are not attached to any message
|
|
1757
|
-
*/
|
|
1758
|
-
getUnattached() {
|
|
1759
|
-
return new MessageDocumentCollection(this.items.filter((doc) => !doc.message));
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
1713
|
class PropertyCollection extends Collection {
|
|
1764
1714
|
/**
|
|
1765
1715
|
* Get new property collection filtered by category id
|
|
@@ -2007,6 +1957,8 @@ var ChartAccountsHeadingVehicleListEnum;
|
|
|
2007
1957
|
(function (ChartAccountsHeadingVehicleListEnum) {
|
|
2008
1958
|
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["WORK_RELATED_CAR_EXPENSES"] = 8] = "WORK_RELATED_CAR_EXPENSES";
|
|
2009
1959
|
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["DEPRECIATION_VEHICLES"] = 9] = "DEPRECIATION_VEHICLES";
|
|
1960
|
+
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["KLMS"] = 60] = "KLMS";
|
|
1961
|
+
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["FUEL_OIL"] = 61] = "FUEL_OIL";
|
|
2010
1962
|
})(ChartAccountsHeadingVehicleListEnum || (ChartAccountsHeadingVehicleListEnum = {}));
|
|
2011
1963
|
|
|
2012
1964
|
var ChartAccountsListEnum;
|
|
@@ -2018,16 +1970,17 @@ var ChartAccountsListEnum;
|
|
|
2018
1970
|
ChartAccountsListEnum[ChartAccountsListEnum["BUILDING_AT_COST"] = 304] = "BUILDING_AT_COST";
|
|
2019
1971
|
ChartAccountsListEnum[ChartAccountsListEnum["MANAGEMENT_FEES_PLATFORM_FEES"] = 656] = "MANAGEMENT_FEES_PLATFORM_FEES";
|
|
2020
1972
|
ChartAccountsListEnum[ChartAccountsListEnum["KLMS_TRAVELLED_FOR_WORK"] = 24] = "KLMS_TRAVELLED_FOR_WORK";
|
|
1973
|
+
ChartAccountsListEnum[ChartAccountsListEnum["KLMS_TRAVELLED"] = 683] = "KLMS_TRAVELLED";
|
|
2021
1974
|
ChartAccountsListEnum[ChartAccountsListEnum["DIRECTOR_FEES"] = 6] = "DIRECTOR_FEES";
|
|
2022
1975
|
ChartAccountsListEnum[ChartAccountsListEnum["SALARY_OR_WAGES"] = 2] = "SALARY_OR_WAGES";
|
|
2023
1976
|
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLES"] = 25] = "VEHICLES";
|
|
2024
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";
|
|
2025
1980
|
ChartAccountsListEnum[ChartAccountsListEnum["TAX_INSTALMENTS"] = 662] = "TAX_INSTALMENTS";
|
|
2026
1981
|
ChartAccountsListEnum[ChartAccountsListEnum["INTEREST_EARNED"] = 22] = "INTEREST_EARNED";
|
|
2027
1982
|
ChartAccountsListEnum[ChartAccountsListEnum["TRUST_INCOME"] = 567] = "TRUST_INCOME";
|
|
2028
1983
|
ChartAccountsListEnum[ChartAccountsListEnum["TAX_OFFSETS_N_R_A_S"] = 571] = "TAX_OFFSETS_N_R_A_S";
|
|
2029
|
-
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_INTEREST"] = 37] = "VEHICLE_LOAN_INTEREST";
|
|
2030
|
-
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_PRINCIPAL"] = 38] = "VEHICLE_LOAN_PRINCIPAL";
|
|
2031
1984
|
})(ChartAccountsListEnum || (ChartAccountsListEnum = {}));
|
|
2032
1985
|
|
|
2033
1986
|
class DepreciationCapitalProject$1 {
|
|
@@ -2126,6 +2079,25 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
2126
2079
|
isKlmsForWork() {
|
|
2127
2080
|
return this.id === ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
2128
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
|
+
}
|
|
2129
2101
|
/**
|
|
2130
2102
|
* Check if chart accounts id is related for 'NRAS Tax Offset' category
|
|
2131
2103
|
*/
|
|
@@ -2220,6 +2192,18 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
2220
2192
|
isVehicleLoanExpense() {
|
|
2221
2193
|
return this.id === ChartAccountsListEnum.VEHICLE_LOAN_INTEREST || this.id === ChartAccountsListEnum.VEHICLE_LOAN_PRINCIPAL;
|
|
2222
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
|
+
}
|
|
2223
2207
|
}
|
|
2224
2208
|
__decorate([
|
|
2225
2209
|
Type(() => ChartAccountsHeading)
|
|
@@ -2266,7 +2250,6 @@ var UserStatusEnum;
|
|
|
2266
2250
|
UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
|
|
2267
2251
|
UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
|
|
2268
2252
|
UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
|
|
2269
|
-
UserStatusEnum[UserStatusEnum["TRIAL"] = 3] = "TRIAL";
|
|
2270
2253
|
})(UserStatusEnum || (UserStatusEnum = {}));
|
|
2271
2254
|
|
|
2272
2255
|
var UserRolesEnum;
|
|
@@ -3671,6 +3654,10 @@ class Depreciation extends Depreciation$1 {
|
|
|
3671
3654
|
super(...arguments);
|
|
3672
3655
|
this.forecasts = [];
|
|
3673
3656
|
this.type = DepreciationTypeEnum.PLANT_EQUIPMENT;
|
|
3657
|
+
/**
|
|
3658
|
+
* @TODO remove after ? signs removed from db models
|
|
3659
|
+
*/
|
|
3660
|
+
this.amount = 0;
|
|
3674
3661
|
}
|
|
3675
3662
|
isCapital() {
|
|
3676
3663
|
return this.type === DepreciationTypeEnum.CAPITAL_WORKS;
|
|
@@ -4237,7 +4224,7 @@ class TransactionAllocationCollection extends Collection {
|
|
|
4237
4224
|
*/
|
|
4238
4225
|
groupByBankAccount(bankTransactions) {
|
|
4239
4226
|
// Group bank transactions by bank account id
|
|
4240
|
-
const bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount');
|
|
4227
|
+
const bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount.id');
|
|
4241
4228
|
// Create empty dictionary of transaction allocations
|
|
4242
4229
|
const allocationsByBankAccount = new CollectionDictionary(new TransactionAllocationCollection([]));
|
|
4243
4230
|
// Fill allocations dictionary with bank transactions dictionary keys and allocations related with each bank transaction collection
|
|
@@ -4269,6 +4256,111 @@ class UserEventSettingCollection extends Collection {
|
|
|
4269
4256
|
}
|
|
4270
4257
|
}
|
|
4271
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
|
+
|
|
4272
4364
|
var BankAccountStatusEnum;
|
|
4273
4365
|
(function (BankAccountStatusEnum) {
|
|
4274
4366
|
BankAccountStatusEnum[BankAccountStatusEnum["INACTIVE"] = 0] = "INACTIVE";
|
|
@@ -4705,6 +4797,12 @@ var VehicleLogbookPurposeEnum;
|
|
|
4705
4797
|
VehicleLogbookPurposeEnum[VehicleLogbookPurposeEnum["PERSONAL"] = 2] = "PERSONAL";
|
|
4706
4798
|
})(VehicleLogbookPurposeEnum || (VehicleLogbookPurposeEnum = {}));
|
|
4707
4799
|
|
|
4800
|
+
/**
|
|
4801
|
+
* Account setup item instance is using for account setup checklist
|
|
4802
|
+
*/
|
|
4803
|
+
class AccountSetupItem {
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4708
4806
|
class Bank$1 {
|
|
4709
4807
|
}
|
|
4710
4808
|
|
|
@@ -5145,6 +5243,12 @@ var ChartAccountsTaxLabelsEnum;
|
|
|
5145
5243
|
ChartAccountsTaxLabelsEnum["TAX_DEDUCTED"] = "Tax Deducted";
|
|
5146
5244
|
})(ChartAccountsTaxLabelsEnum || (ChartAccountsTaxLabelsEnum = {}));
|
|
5147
5245
|
|
|
5246
|
+
class ChartAccountsValue$1 {
|
|
5247
|
+
}
|
|
5248
|
+
|
|
5249
|
+
class ChartAccountsValue extends ChartAccountsValue$1 {
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5148
5252
|
class Chat$1 {
|
|
5149
5253
|
}
|
|
5150
5254
|
|
|
@@ -5226,6 +5330,18 @@ __decorate([
|
|
|
5226
5330
|
Expose()
|
|
5227
5331
|
], Message.prototype, "documents", void 0);
|
|
5228
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
|
+
|
|
5229
5345
|
class ClientInvite$1 {
|
|
5230
5346
|
}
|
|
5231
5347
|
|
|
@@ -5617,6 +5733,9 @@ var AppEventTypeEnum;
|
|
|
5617
5733
|
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 35] = "USER_UPDATED";
|
|
5618
5734
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 36] = "VEHICLE_CLAIM_UPDATED";
|
|
5619
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";
|
|
5620
5739
|
})(AppEventTypeEnum || (AppEventTypeEnum = {}));
|
|
5621
5740
|
|
|
5622
5741
|
/**
|
|
@@ -5726,10 +5845,16 @@ class VehicleLogbook$1 {
|
|
|
5726
5845
|
}
|
|
5727
5846
|
|
|
5728
5847
|
class VehicleLogbook extends VehicleLogbook$1 {
|
|
5729
|
-
|
|
5848
|
+
/**
|
|
5849
|
+
* Get amount of kilometers in this logbook
|
|
5850
|
+
*/
|
|
5851
|
+
getKlms() {
|
|
5730
5852
|
return this.odometerEnd - this.odometerStart;
|
|
5731
5853
|
}
|
|
5732
|
-
|
|
5854
|
+
/**
|
|
5855
|
+
* Check if logbook is business-related
|
|
5856
|
+
*/
|
|
5857
|
+
isBusiness() {
|
|
5733
5858
|
return this.purpose === VehicleLogbookPurposeEnum.BUSINESS;
|
|
5734
5859
|
}
|
|
5735
5860
|
}
|
|
@@ -5738,33 +5863,11 @@ __decorate([
|
|
|
5738
5863
|
], VehicleLogbook.prototype, "date", void 0);
|
|
5739
5864
|
|
|
5740
5865
|
class Vehicle extends Vehicle$1 {
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
this.logbook.forEach((lb) => {
|
|
5747
|
-
kilometers += lb.kilometres;
|
|
5748
|
-
});
|
|
5749
|
-
return kilometers;
|
|
5750
|
-
}
|
|
5751
|
-
get workKilometres() {
|
|
5752
|
-
let kilometers = 0;
|
|
5753
|
-
this.logbook.forEach((lb) => {
|
|
5754
|
-
if (lb.purpose === VehicleLogbookPurposeEnum.BUSINESS) {
|
|
5755
|
-
kilometers += lb.kilometres;
|
|
5756
|
-
}
|
|
5757
|
-
});
|
|
5758
|
-
return kilometers;
|
|
5759
|
-
}
|
|
5760
|
-
get personalKilometres() {
|
|
5761
|
-
return this.totalKilometres - this.workKilometres;
|
|
5762
|
-
}
|
|
5763
|
-
get lastLogbook() {
|
|
5764
|
-
if (!this.logbook.length) {
|
|
5765
|
-
return { odometerEnd: 0 };
|
|
5766
|
-
}
|
|
5767
|
-
return this.logbook.slice(-1)[0];
|
|
5866
|
+
/**
|
|
5867
|
+
* Get vehicle's logbooks as collection
|
|
5868
|
+
*/
|
|
5869
|
+
getLogbooks() {
|
|
5870
|
+
return new VehicleLogbookCollection(this.logbook);
|
|
5768
5871
|
}
|
|
5769
5872
|
}
|
|
5770
5873
|
__decorate([
|
|
@@ -5792,15 +5895,68 @@ class VehicleClaim extends VehicleClaim$1 {
|
|
|
5792
5895
|
get averageWeeklyTraveledKms() {
|
|
5793
5896
|
return this.kilometers / WEEKS_IN_YEAR;
|
|
5794
5897
|
}
|
|
5795
|
-
|
|
5898
|
+
isLogbookMethod() {
|
|
5796
5899
|
return this.method === VehicleClaimMethodEnum.LOGBOOK;
|
|
5797
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
|
+
}
|
|
5798
5910
|
/**
|
|
5799
|
-
* Claim amount for
|
|
5911
|
+
* Claim amount for KLMs method. Exists only for KLMs method.
|
|
5800
5912
|
*/
|
|
5801
|
-
|
|
5913
|
+
getKLMsClaimAmount(vehicleClaimRate) {
|
|
5914
|
+
if (!this.isKLMsMethod()) {
|
|
5915
|
+
return 0;
|
|
5916
|
+
}
|
|
5802
5917
|
return +(this.kilometers * vehicleClaimRate).toFixed(2);
|
|
5803
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
|
+
}
|
|
5804
5960
|
}
|
|
5805
5961
|
|
|
5806
5962
|
class ServiceNotification {
|
|
@@ -5841,6 +5997,21 @@ __decorate([
|
|
|
5841
5997
|
})
|
|
5842
5998
|
], Notification.prototype, "redirectionLink", void 0);
|
|
5843
5999
|
|
|
6000
|
+
var PdfOrientationEnum;
|
|
6001
|
+
(function (PdfOrientationEnum) {
|
|
6002
|
+
PdfOrientationEnum["PORTRAIT"] = "portrait";
|
|
6003
|
+
PdfOrientationEnum["LANDSCAPE"] = "landscape";
|
|
6004
|
+
})(PdfOrientationEnum || (PdfOrientationEnum = {}));
|
|
6005
|
+
|
|
6006
|
+
/**
|
|
6007
|
+
* Class with entities for generated PDF file
|
|
6008
|
+
*/
|
|
6009
|
+
class PdfSettings {
|
|
6010
|
+
constructor() {
|
|
6011
|
+
this.orientation = PdfOrientationEnum.PORTRAIT;
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
|
|
5844
6015
|
/**
|
|
5845
6016
|
* Calculation form control types
|
|
5846
6017
|
*/
|
|
@@ -6532,81 +6703,100 @@ var UserEventSettingFieldEnum;
|
|
|
6532
6703
|
UserEventSettingFieldEnum["FREQUENCY"] = "frequency";
|
|
6533
6704
|
})(UserEventSettingFieldEnum || (UserEventSettingFieldEnum = {}));
|
|
6534
6705
|
|
|
6535
|
-
|
|
6706
|
+
/**
|
|
6707
|
+
* Enum list of all possible account setup items. Using with [ACCOUNT_SETUP_ITEMS]{@link ACCOUNT_SETUP_ITEMS}
|
|
6708
|
+
*/
|
|
6709
|
+
var AccountSetupItemsEnum;
|
|
6710
|
+
(function (AccountSetupItemsEnum) {
|
|
6711
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["SALARY"] = 0] = "SALARY";
|
|
6712
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["OTHER_INCOME"] = 1] = "OTHER_INCOME";
|
|
6713
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["PROPERTY"] = 2] = "PROPERTY";
|
|
6714
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_FEEDS"] = 3] = "BANK_FEEDS";
|
|
6715
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["WORK_LOGBOOK"] = 4] = "WORK_LOGBOOK";
|
|
6716
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_INCOME"] = 5] = "SOLE_INCOME";
|
|
6717
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["TRANSACTION"] = 6] = "TRANSACTION";
|
|
6718
|
+
})(AccountSetupItemsEnum || (AccountSetupItemsEnum = {}));
|
|
6719
|
+
|
|
6720
|
+
/**
|
|
6721
|
+
* List of all possible account setup steps
|
|
6722
|
+
*/
|
|
6723
|
+
const ACCOUNT_SETUP_ITEMS = {
|
|
6724
|
+
[AccountSetupItemsEnum.SALARY]: plainToClass(AccountSetupItem, {
|
|
6725
|
+
title: 'Add your work income forecast',
|
|
6726
|
+
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.',
|
|
6727
|
+
url: '/client/work-tank/forecasting'
|
|
6728
|
+
}),
|
|
6729
|
+
[AccountSetupItemsEnum.OTHER_INCOME]: plainToClass(AccountSetupItem, {
|
|
6730
|
+
title: 'Add any other expected incomes',
|
|
6731
|
+
description: 'To ensure an accurate tax position forecast, add estimates for any other income types, like dividends, interest, trusts, annuities, director payments etc.',
|
|
6732
|
+
url: '/client/work-tank/forecasting'
|
|
6733
|
+
}),
|
|
6734
|
+
[AccountSetupItemsEnum.PROPERTY]: plainToClass(AccountSetupItem, {
|
|
6735
|
+
title: 'Add your properties',
|
|
6736
|
+
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.',
|
|
6737
|
+
url: '/client/property-tank'
|
|
6738
|
+
}),
|
|
6739
|
+
[AccountSetupItemsEnum.BANK_FEEDS]: plainToClass(AccountSetupItem, {
|
|
6740
|
+
title: 'Link banks and select accounts',
|
|
6741
|
+
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!',
|
|
6742
|
+
url: '/client/bank-feeds'
|
|
6743
|
+
}),
|
|
6744
|
+
[AccountSetupItemsEnum.WORK_LOGBOOK]: plainToClass(AccountSetupItem, {
|
|
6745
|
+
title: 'Set up your logbook method',
|
|
6746
|
+
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.',
|
|
6747
|
+
url: '/client/work-tank/logbook'
|
|
6748
|
+
}),
|
|
6749
|
+
[AccountSetupItemsEnum.SOLE_INCOME]: plainToClass(AccountSetupItem, {
|
|
6750
|
+
title: 'Add your business details',
|
|
6751
|
+
description: 'Add your business details, logo and payment terms to create invoice templates in minutes.',
|
|
6752
|
+
url: '/client/sole-tank/forecasting'
|
|
6753
|
+
}),
|
|
6754
|
+
[AccountSetupItemsEnum.TRANSACTION]: plainToClass(AccountSetupItem, {
|
|
6755
|
+
title: 'Allocation transactions',
|
|
6756
|
+
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.',
|
|
6757
|
+
url: '/client/bank-feeds'
|
|
6758
|
+
}),
|
|
6759
|
+
};
|
|
6760
|
+
|
|
6761
|
+
/**
|
|
6762
|
+
* @TODO extend rest service when it could work with single objects, not only arrays
|
|
6763
|
+
*/
|
|
6764
|
+
class ClientIncomeTypesService {
|
|
6536
6765
|
constructor(http, environment) {
|
|
6537
6766
|
this.http = http;
|
|
6538
6767
|
this.environment = environment;
|
|
6539
|
-
this.
|
|
6768
|
+
this.cacheSubject = new ReplaySubject(1);
|
|
6540
6769
|
}
|
|
6541
|
-
|
|
6542
|
-
if (!this.
|
|
6543
|
-
this.http.get(`${this.environment.apiV2}/
|
|
6770
|
+
get() {
|
|
6771
|
+
if (!this.cache) {
|
|
6772
|
+
this.http.get(`${this.environment.apiV2}/client-income-types`)
|
|
6544
6773
|
.pipe(map((response) => {
|
|
6545
|
-
return response['hydra:member']
|
|
6774
|
+
return plainToClass(ClientIncomeTypes, response['hydra:member'][0], { excludePrefixes: ['@'] });
|
|
6546
6775
|
}))
|
|
6547
|
-
.subscribe((
|
|
6548
|
-
this.
|
|
6549
|
-
this.
|
|
6776
|
+
.subscribe((incomeTypes) => {
|
|
6777
|
+
this.cache = incomeTypes;
|
|
6778
|
+
this.cacheSubject.next(this.cache);
|
|
6550
6779
|
});
|
|
6551
6780
|
}
|
|
6552
|
-
return this.
|
|
6553
|
-
}
|
|
6554
|
-
}
|
|
6555
|
-
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 });
|
|
6556
|
-
AddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, providedIn: 'root' });
|
|
6557
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, decorators: [{
|
|
6558
|
-
type: Injectable,
|
|
6559
|
-
args: [{
|
|
6560
|
-
providedIn: 'root'
|
|
6561
|
-
}]
|
|
6562
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
6563
|
-
type: Inject,
|
|
6564
|
-
args: ['environment']
|
|
6565
|
-
}] }]; } });
|
|
6566
|
-
|
|
6567
|
-
/**
|
|
6568
|
-
* Service to work with assets (documents, receipts, e.t.c.)
|
|
6569
|
-
*/
|
|
6570
|
-
class AssetsService {
|
|
6571
|
-
constructor(http, userSwitcherService, environment) {
|
|
6572
|
-
this.http = http;
|
|
6573
|
-
this.userSwitcherService = userSwitcherService;
|
|
6574
|
-
this.environment = environment;
|
|
6575
|
-
this.impersonatedClient = this.userSwitcherService.get();
|
|
6576
|
-
}
|
|
6577
|
-
/**
|
|
6578
|
-
* Get asset link
|
|
6579
|
-
* @param asset to get the link for
|
|
6580
|
-
*/
|
|
6581
|
-
getLink(asset) {
|
|
6582
|
-
return this.http.get(`${this.environment.apiV2}/assets/${asset.type}/${asset.id}`);
|
|
6583
|
-
}
|
|
6584
|
-
/**
|
|
6585
|
-
* Download asset
|
|
6586
|
-
* @param asset which should be downloaded
|
|
6587
|
-
* @TODO refactor
|
|
6588
|
-
*/
|
|
6589
|
-
download(asset) {
|
|
6590
|
-
return `${this.environment.apiV2}/assets/${asset.type}/${asset.id}/download?bearer=${localStorage.getItem('token')}${this.impersonatedClient ? `&_switch_user=${this.impersonatedClient}` : ''}`;
|
|
6781
|
+
return this.cacheSubject.asObservable();
|
|
6591
6782
|
}
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
return this.http.delete(`${this.environment.apiV2}/${asset.entityType}/${entityId}/${asset.type}/${asset.id}`);
|
|
6783
|
+
update(incomeTypes) {
|
|
6784
|
+
return this.http.put(`${this.environment.apiV2}/client-income-types/${incomeTypes.id}`, incomeTypes)
|
|
6785
|
+
.pipe(map((incomeTypesBase) => {
|
|
6786
|
+
this.cache = plainToClass(ClientIncomeTypes, incomeTypesBase);
|
|
6787
|
+
this.cacheSubject.next(this.cache);
|
|
6788
|
+
return this.cache;
|
|
6789
|
+
}));
|
|
6600
6790
|
}
|
|
6601
6791
|
}
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
6792
|
+
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 });
|
|
6793
|
+
ClientIncomeTypesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientIncomeTypesService, providedIn: 'root' });
|
|
6794
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientIncomeTypesService, decorators: [{
|
|
6605
6795
|
type: Injectable,
|
|
6606
6796
|
args: [{
|
|
6607
6797
|
providedIn: 'root'
|
|
6608
6798
|
}]
|
|
6609
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type:
|
|
6799
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
6610
6800
|
type: Inject,
|
|
6611
6801
|
args: ['environment']
|
|
6612
6802
|
}] }]; } });
|
|
@@ -6637,19 +6827,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
6637
6827
|
}]
|
|
6638
6828
|
}] });
|
|
6639
6829
|
|
|
6830
|
+
/**
|
|
6831
|
+
* popup notifications service (toast, snackbar).
|
|
6832
|
+
*/
|
|
6833
|
+
class ToastService {
|
|
6834
|
+
constructor() {
|
|
6835
|
+
this.toast$ = new ReplaySubject(1);
|
|
6836
|
+
}
|
|
6837
|
+
get() {
|
|
6838
|
+
return this.toast$.asObservable();
|
|
6839
|
+
}
|
|
6840
|
+
add(toast) {
|
|
6841
|
+
this.toast$.next(toast);
|
|
6842
|
+
}
|
|
6843
|
+
success(message) {
|
|
6844
|
+
this.add(plainToClass(Toast, {
|
|
6845
|
+
type: ToastTypeEnum.SUCCESS,
|
|
6846
|
+
title: 'Success!',
|
|
6847
|
+
message,
|
|
6848
|
+
}));
|
|
6849
|
+
}
|
|
6850
|
+
warning(message) {
|
|
6851
|
+
this.add(plainToClass(Toast, {
|
|
6852
|
+
type: ToastTypeEnum.WARNING,
|
|
6853
|
+
title: 'Warning!',
|
|
6854
|
+
message,
|
|
6855
|
+
}));
|
|
6856
|
+
}
|
|
6857
|
+
error(message) {
|
|
6858
|
+
this.add(plainToClass(Toast, {
|
|
6859
|
+
type: ToastTypeEnum.ERROR,
|
|
6860
|
+
title: 'Error!',
|
|
6861
|
+
message,
|
|
6862
|
+
}));
|
|
6863
|
+
}
|
|
6864
|
+
info(message) {
|
|
6865
|
+
this.add(plainToClass(Toast, {
|
|
6866
|
+
type: ToastTypeEnum.INFO,
|
|
6867
|
+
title: 'Information',
|
|
6868
|
+
message,
|
|
6869
|
+
}));
|
|
6870
|
+
}
|
|
6871
|
+
}
|
|
6872
|
+
ToastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6873
|
+
ToastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
6874
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, decorators: [{
|
|
6875
|
+
type: Injectable,
|
|
6876
|
+
args: [{
|
|
6877
|
+
providedIn: 'root'
|
|
6878
|
+
}]
|
|
6879
|
+
}] });
|
|
6880
|
+
|
|
6640
6881
|
/**
|
|
6641
6882
|
* Abstract base service that implements common services functionality
|
|
6642
6883
|
* and describe abstract methods/properties that have to be implemented in child services
|
|
6643
6884
|
* Model - entity service is working with
|
|
6644
6885
|
* BaseModel - base entity model that extends by Model
|
|
6886
|
+
* @TODO Alex: refactor all services for work with collections instead of arrays
|
|
6887
|
+
* @TODO Alex: implement smart system of default toast messages
|
|
6645
6888
|
*/
|
|
6646
6889
|
class RestService {
|
|
6647
|
-
constructor(http, eventDispatcherService, environment) {
|
|
6890
|
+
constructor(http, eventDispatcherService, environment, toastService) {
|
|
6648
6891
|
this.http = http;
|
|
6649
6892
|
this.eventDispatcherService = eventDispatcherService;
|
|
6650
6893
|
this.environment = environment;
|
|
6894
|
+
this.toastService = toastService;
|
|
6651
6895
|
// subject for service cache
|
|
6652
6896
|
this.cacheSubject = new ReplaySubject(1);
|
|
6897
|
+
this.listenEvents();
|
|
6653
6898
|
}
|
|
6654
6899
|
/**
|
|
6655
6900
|
* get cached list of all instances
|
|
@@ -6696,6 +6941,9 @@ class RestService {
|
|
|
6696
6941
|
this.cache.push(newInstance);
|
|
6697
6942
|
this.updateCache();
|
|
6698
6943
|
}
|
|
6944
|
+
if (this.messageCreated) {
|
|
6945
|
+
this.toastService.success(this.messageCreated);
|
|
6946
|
+
}
|
|
6699
6947
|
return newInstance;
|
|
6700
6948
|
}));
|
|
6701
6949
|
}
|
|
@@ -6713,6 +6961,9 @@ class RestService {
|
|
|
6713
6961
|
this.cache.push(...newInstances);
|
|
6714
6962
|
this.updateCache();
|
|
6715
6963
|
}
|
|
6964
|
+
if (this.messageCreatedBatch) {
|
|
6965
|
+
this.toastService.success(this.messageCreatedBatch);
|
|
6966
|
+
}
|
|
6716
6967
|
return newInstances;
|
|
6717
6968
|
}));
|
|
6718
6969
|
}
|
|
@@ -6728,6 +6979,9 @@ class RestService {
|
|
|
6728
6979
|
const updatedInstance = this.createModelInstance(this.modelClass, updatedItem);
|
|
6729
6980
|
replace(this.cache, updatedInstance);
|
|
6730
6981
|
this.updateCache();
|
|
6982
|
+
if (this.messageUpdated) {
|
|
6983
|
+
this.toastService.success(this.messageUpdated);
|
|
6984
|
+
}
|
|
6731
6985
|
return updatedInstance;
|
|
6732
6986
|
}));
|
|
6733
6987
|
}
|
|
@@ -6744,6 +6998,9 @@ class RestService {
|
|
|
6744
6998
|
updatedInstances.forEach((instance) => {
|
|
6745
6999
|
replace(this.cache, instance);
|
|
6746
7000
|
});
|
|
7001
|
+
if (this.messageUpdatedBatch) {
|
|
7002
|
+
this.toastService.success(this.messageUpdatedBatch);
|
|
7003
|
+
}
|
|
6747
7004
|
this.updateCache();
|
|
6748
7005
|
return updatedInstances;
|
|
6749
7006
|
}));
|
|
@@ -6757,6 +7014,9 @@ class RestService {
|
|
|
6757
7014
|
.pipe(map(() => {
|
|
6758
7015
|
this.cache = this.cache.filter((item) => item['id'] !== model['id']);
|
|
6759
7016
|
this.updateCache();
|
|
7017
|
+
if (this.messageDeleted) {
|
|
7018
|
+
this.toastService.success(this.messageDeleted);
|
|
7019
|
+
}
|
|
6760
7020
|
}));
|
|
6761
7021
|
}
|
|
6762
7022
|
/**
|
|
@@ -6769,6 +7029,9 @@ class RestService {
|
|
|
6769
7029
|
const ids = models.map((model) => model['id']);
|
|
6770
7030
|
this.cache = this.cache.filter((item) => !ids.includes(item['id']));
|
|
6771
7031
|
this.updateCache();
|
|
7032
|
+
if (this.messageDeletedBatch) {
|
|
7033
|
+
this.toastService.success(this.messageDeletedBatch);
|
|
7034
|
+
}
|
|
6772
7035
|
}));
|
|
6773
7036
|
}
|
|
6774
7037
|
/**
|
|
@@ -6806,8 +7069,12 @@ class RestService {
|
|
|
6806
7069
|
createModelInstance(model, baseModel) {
|
|
6807
7070
|
return plainToClass(model, baseModel, { excludePrefixes: ['@'] });
|
|
6808
7071
|
}
|
|
7072
|
+
/**
|
|
7073
|
+
* Method that call all listeners. Empty by default. Should be redefined by child services if required
|
|
7074
|
+
*/
|
|
7075
|
+
listenEvents() { }
|
|
6809
7076
|
}
|
|
6810
|
-
RestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RestService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7077
|
+
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 });
|
|
6811
7078
|
RestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RestService, providedIn: 'root' });
|
|
6812
7079
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RestService, decorators: [{
|
|
6813
7080
|
type: Injectable,
|
|
@@ -6817,102 +7084,274 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
6817
7084
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
6818
7085
|
type: Inject,
|
|
6819
7086
|
args: ['environment']
|
|
6820
|
-
}] }]; } });
|
|
7087
|
+
}] }, { type: ToastService }]; } });
|
|
6821
7088
|
|
|
6822
7089
|
/**
|
|
6823
|
-
* Service
|
|
7090
|
+
* Service for work with Property
|
|
6824
7091
|
*/
|
|
6825
|
-
class
|
|
7092
|
+
class PropertyService extends RestService {
|
|
6826
7093
|
constructor() {
|
|
6827
7094
|
super(...arguments);
|
|
6828
|
-
this.modelClass =
|
|
6829
|
-
this.url = '
|
|
6830
|
-
this.isHydra = true;
|
|
7095
|
+
this.modelClass = Property;
|
|
7096
|
+
this.url = 'properties';
|
|
6831
7097
|
}
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
args: [{
|
|
6838
|
-
providedIn: 'root'
|
|
6839
|
-
}]
|
|
6840
|
-
}] });
|
|
6841
|
-
|
|
6842
|
-
/**
|
|
6843
|
-
* Service that handling user's bank accounts logic
|
|
6844
|
-
*/
|
|
6845
|
-
class BankAccountService extends RestService {
|
|
6846
|
-
constructor(http, eventDispatcherService, environment) {
|
|
6847
|
-
super(http, eventDispatcherService, environment);
|
|
6848
|
-
this.http = http;
|
|
6849
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
6850
|
-
this.environment = environment;
|
|
6851
|
-
// api url parameter for bank accounts
|
|
6852
|
-
this.url = 'bank-accounts';
|
|
6853
|
-
this.modelClass = BankAccount;
|
|
6854
|
-
this.listenEvents();
|
|
7098
|
+
listenEvents() {
|
|
7099
|
+
this.listenShareInviteAccepted();
|
|
7100
|
+
this.listenServiceSubscriptionUpdated();
|
|
7101
|
+
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
7102
|
+
this.listenMovementsChanged();
|
|
6855
7103
|
}
|
|
6856
7104
|
/**
|
|
6857
|
-
*
|
|
7105
|
+
* Update cache when share invitation accepted
|
|
6858
7106
|
*/
|
|
6859
|
-
|
|
6860
|
-
this.
|
|
7107
|
+
listenShareInviteAccepted() {
|
|
7108
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
|
|
6861
7109
|
}
|
|
6862
7110
|
/**
|
|
6863
|
-
*
|
|
6864
|
-
* @param bankAccounts
|
|
6865
|
-
* @param queryParams
|
|
7111
|
+
* Update cache when user's service subscription is updated
|
|
6866
7112
|
*/
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
.pipe(map((newBankAccountsBase) => {
|
|
6870
|
-
const newBankAccounts = newBankAccountsBase.map((bankAccountBase) => plainToClass(BankAccount, bankAccountBase));
|
|
6871
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_CREATED, newBankAccounts));
|
|
6872
|
-
const tempCache = _.cloneDeep(this.cache);
|
|
6873
|
-
tempCache.push(...newBankAccounts);
|
|
6874
|
-
this.cache = tempCache;
|
|
6875
|
-
this.updateCache();
|
|
6876
|
-
return newBankAccounts;
|
|
6877
|
-
}));
|
|
7113
|
+
listenServiceSubscriptionUpdated() {
|
|
7114
|
+
this.eventDispatcherService.on(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(() => this.resetCache());
|
|
6878
7115
|
}
|
|
6879
7116
|
/**
|
|
6880
|
-
* Update
|
|
7117
|
+
* Update cache when property category changed
|
|
6881
7118
|
*/
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
7119
|
+
listenMovementsChanged() {
|
|
7120
|
+
// @TODO change dispatcher logic to work with multiple events
|
|
7121
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED).subscribe(() => this.resetCache());
|
|
7122
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_UPDATED).subscribe(() => this.resetCache());
|
|
7123
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_DELETED).subscribe(() => this.resetCache());
|
|
7124
|
+
}
|
|
7125
|
+
update(property) {
|
|
7126
|
+
return super.update(property).pipe(map((updatedProperty) => {
|
|
7127
|
+
if (property.documentFile) {
|
|
7128
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.PROPERTY_UPDATED_WITH_DOCUMENT, property));
|
|
7129
|
+
}
|
|
7130
|
+
return updatedProperty;
|
|
6886
7131
|
}));
|
|
6887
7132
|
}
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
*/
|
|
6892
|
-
updateOpeningBalance(bankAccount) {
|
|
6893
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}/${bankAccount.id}/opening-balances/${bankAccount.getCurrentYearBalance().id}`, bankAccount.getCurrentYearBalance())
|
|
6894
|
-
.pipe(map((response) => {
|
|
6895
|
-
const tempCache = _.cloneDeep(this.cache);
|
|
6896
|
-
replace(tempCache[tempCache.findIndex((ba) => ba.id === bankAccount.id)].balances, response);
|
|
6897
|
-
this.cache = tempCache;
|
|
6898
|
-
this.updateCache();
|
|
7133
|
+
getByCategoryId(id) {
|
|
7134
|
+
return this.get().pipe(map((properties) => {
|
|
7135
|
+
return properties.filter((property) => property.category.id === id);
|
|
6899
7136
|
}));
|
|
6900
7137
|
}
|
|
6901
7138
|
/**
|
|
6902
|
-
*
|
|
7139
|
+
* Activate deactivated property
|
|
6903
7140
|
*/
|
|
6904
|
-
|
|
6905
|
-
return this.http.
|
|
6906
|
-
.pipe(map((
|
|
6907
|
-
const
|
|
6908
|
-
|
|
7141
|
+
activate(property) {
|
|
7142
|
+
return this.http.post(`${this.environment.apiV2}/property-subscriptions`, { user: property.user, property })
|
|
7143
|
+
.pipe(map((propertySubscriptionBase) => {
|
|
7144
|
+
const newPropertySubscription = plainToClass(PropertySubscription, propertySubscriptionBase);
|
|
7145
|
+
const activatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
|
|
7146
|
+
replace(this.cache, activatedProperty);
|
|
6909
7147
|
this.updateCache();
|
|
6910
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_UPDATED, updatedBankAccount));
|
|
6911
|
-
return updatedBankAccount;
|
|
6912
7148
|
}));
|
|
6913
7149
|
}
|
|
6914
|
-
|
|
6915
|
-
|
|
7150
|
+
/**
|
|
7151
|
+
* Deactivate activated property
|
|
7152
|
+
*/
|
|
7153
|
+
deactivate(property) {
|
|
7154
|
+
return this.http.delete(`${this.environment.apiV2}/property-subscriptions/${property.getCurrentSubscription().id}`)
|
|
7155
|
+
.pipe(map(() => {
|
|
7156
|
+
const deactivatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
|
|
7157
|
+
replace(this.cache, deactivatedProperty);
|
|
7158
|
+
this.updateCache();
|
|
7159
|
+
}));
|
|
7160
|
+
}
|
|
7161
|
+
/**
|
|
7162
|
+
* Update property photo
|
|
7163
|
+
* @param property Property instance for photo update
|
|
7164
|
+
* @param photoFormData FormData with property photo image
|
|
7165
|
+
*/
|
|
7166
|
+
updatePhoto(property, photoFormData) {
|
|
7167
|
+
return this.http.post(`${this.environment.apiV2}/properties/${property.id}/photo?_method=PUT`, photoFormData)
|
|
7168
|
+
.pipe(map((photoLink) => {
|
|
7169
|
+
property.photo = photoLink;
|
|
7170
|
+
// update properties cache
|
|
7171
|
+
replace(this.cache, property);
|
|
7172
|
+
this.updateCache();
|
|
7173
|
+
}));
|
|
7174
|
+
}
|
|
7175
|
+
getByShareId(id) {
|
|
7176
|
+
return this.get().pipe(map((properties) => {
|
|
7177
|
+
return properties.filter((property) => property.user.id === id);
|
|
7178
|
+
}));
|
|
7179
|
+
}
|
|
7180
|
+
/**
|
|
7181
|
+
* Get list of active user's properties
|
|
7182
|
+
*/
|
|
7183
|
+
getActive() {
|
|
7184
|
+
return this.get().pipe(map((properties) => properties.filter((property) => property.isActive)));
|
|
7185
|
+
}
|
|
7186
|
+
}
|
|
7187
|
+
PropertyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7188
|
+
PropertyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, providedIn: 'root' });
|
|
7189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, decorators: [{
|
|
7190
|
+
type: Injectable,
|
|
7191
|
+
args: [{
|
|
7192
|
+
providedIn: 'root'
|
|
7193
|
+
}]
|
|
7194
|
+
}] });
|
|
7195
|
+
|
|
7196
|
+
/**
|
|
7197
|
+
* Service to work with income sources
|
|
7198
|
+
*/
|
|
7199
|
+
class IncomeSourceService extends RestService {
|
|
7200
|
+
constructor() {
|
|
7201
|
+
super(...arguments);
|
|
7202
|
+
this.url = 'income-sources';
|
|
7203
|
+
this.modelClass = IncomeSource;
|
|
7204
|
+
this.incomeSourceTypeSubject = new ReplaySubject(1);
|
|
7205
|
+
}
|
|
7206
|
+
/**
|
|
7207
|
+
* Get income sources tax calculation
|
|
7208
|
+
* @param salaryForecast for which tax should be calculated
|
|
7209
|
+
*/
|
|
7210
|
+
getTaxCalculation(salaryForecast) {
|
|
7211
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}/tax-calculation`, salaryForecast)
|
|
7212
|
+
.pipe(map((response) => {
|
|
7213
|
+
return plainToClass(SalaryForecast, response);
|
|
7214
|
+
}));
|
|
7215
|
+
}
|
|
7216
|
+
/**
|
|
7217
|
+
* Add batch of income sources
|
|
7218
|
+
* @param incomeSources to add
|
|
7219
|
+
*/
|
|
7220
|
+
addBatch(incomeSources) {
|
|
7221
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, incomeSources)
|
|
7222
|
+
.pipe(map((addedIncomeSources) => {
|
|
7223
|
+
// assign respond income sources to provided income sources
|
|
7224
|
+
const assignedIncomeSources = addedIncomeSources
|
|
7225
|
+
.map((incomeSource, index) => Object.assign(plainToClass(IncomeSource, {}), incomeSource, incomeSources[index]));
|
|
7226
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_CREATED, assignedIncomeSources));
|
|
7227
|
+
this.cache.push(...assignedIncomeSources);
|
|
7228
|
+
this.updateCache();
|
|
7229
|
+
return assignedIncomeSources;
|
|
7230
|
+
}));
|
|
7231
|
+
}
|
|
7232
|
+
/**
|
|
7233
|
+
* Update batch of income sources
|
|
7234
|
+
*/
|
|
7235
|
+
updateBatch(incomeSources, queryParams = {}) {
|
|
7236
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
7237
|
+
.pipe(map((updatedItems) => {
|
|
7238
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(this.modelClass, item));
|
|
7239
|
+
updatedInstances.forEach((instance) => {
|
|
7240
|
+
replace(this.cache, instance);
|
|
7241
|
+
});
|
|
7242
|
+
if (incomeSources[0].forecasts.length) {
|
|
7243
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_UPDATED, incomeSources));
|
|
7244
|
+
}
|
|
7245
|
+
this.updateCache();
|
|
7246
|
+
return updatedInstances;
|
|
7247
|
+
}));
|
|
7248
|
+
}
|
|
7249
|
+
/**
|
|
7250
|
+
* Get income sources by provided types
|
|
7251
|
+
* @param types
|
|
7252
|
+
*/
|
|
7253
|
+
getByTypes(types) {
|
|
7254
|
+
return this.get()
|
|
7255
|
+
.pipe(map((incomeSources) => incomeSources
|
|
7256
|
+
.filter((incomeSource) => types.includes(incomeSource.type))));
|
|
7257
|
+
}
|
|
7258
|
+
/**
|
|
7259
|
+
* Get other incomes types
|
|
7260
|
+
*/
|
|
7261
|
+
getIncomeSourceTypes() {
|
|
7262
|
+
if (!this.incomeSourceTypes) {
|
|
7263
|
+
this.incomeSourceTypes = [];
|
|
7264
|
+
this.http.get(`${this.environment.apiV2}/income-source-types`)
|
|
7265
|
+
.pipe(map((response) => {
|
|
7266
|
+
return response.map((item) => plainToClass(IncomeSourceType, item));
|
|
7267
|
+
}))
|
|
7268
|
+
.subscribe((otherIncomesTypes) => {
|
|
7269
|
+
this.incomeSourceTypes = otherIncomesTypes;
|
|
7270
|
+
this.incomeSourceTypeSubject.next(this.incomeSourceTypes);
|
|
7271
|
+
});
|
|
7272
|
+
}
|
|
7273
|
+
return this.incomeSourceTypeSubject.asObservable();
|
|
7274
|
+
}
|
|
7275
|
+
}
|
|
7276
|
+
IncomeSourceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7277
|
+
IncomeSourceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, providedIn: 'root' });
|
|
7278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, decorators: [{
|
|
7279
|
+
type: Injectable,
|
|
7280
|
+
args: [{
|
|
7281
|
+
providedIn: 'root'
|
|
7282
|
+
}]
|
|
7283
|
+
}] });
|
|
7284
|
+
|
|
7285
|
+
/**
|
|
7286
|
+
* Service that handling user's bank accounts logic
|
|
7287
|
+
*/
|
|
7288
|
+
class BankAccountService extends RestService {
|
|
7289
|
+
constructor() {
|
|
7290
|
+
super(...arguments);
|
|
7291
|
+
// api url parameter for bank accounts
|
|
7292
|
+
this.url = 'bank-accounts';
|
|
7293
|
+
this.modelClass = BankAccount;
|
|
7294
|
+
}
|
|
7295
|
+
/**
|
|
7296
|
+
* Listen system notifications and update cache when got basiq notification received
|
|
7297
|
+
*/
|
|
7298
|
+
listenEvents() {
|
|
7299
|
+
this.listenToEventDispatcherChanges();
|
|
7300
|
+
}
|
|
7301
|
+
/**
|
|
7302
|
+
* Created manual bank account
|
|
7303
|
+
* @param bankAccounts
|
|
7304
|
+
* @param queryParams
|
|
7305
|
+
*/
|
|
7306
|
+
addBatch(bankAccounts, queryParams = {}) {
|
|
7307
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, bankAccounts)
|
|
7308
|
+
.pipe(map((newBankAccountsBase) => {
|
|
7309
|
+
const newBankAccounts = newBankAccountsBase.map((bankAccountBase) => plainToClass(BankAccount, bankAccountBase));
|
|
7310
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_CREATED, newBankAccounts));
|
|
7311
|
+
const tempCache = _.cloneDeep(this.cache);
|
|
7312
|
+
tempCache.push(...newBankAccounts);
|
|
7313
|
+
this.cache = tempCache;
|
|
7314
|
+
this.updateCache();
|
|
7315
|
+
return newBankAccounts;
|
|
7316
|
+
}));
|
|
7317
|
+
}
|
|
7318
|
+
/**
|
|
7319
|
+
* Update bank account and fire event
|
|
7320
|
+
*/
|
|
7321
|
+
update(bankAccount) {
|
|
7322
|
+
return super.update(bankAccount).pipe(map((updatedBankAccount) => {
|
|
7323
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_UPDATED, updatedBankAccount));
|
|
7324
|
+
return updatedBankAccount;
|
|
7325
|
+
}));
|
|
7326
|
+
}
|
|
7327
|
+
/**
|
|
7328
|
+
* Update bank account opening balance
|
|
7329
|
+
* @param bankAccount Bank account for balance updating
|
|
7330
|
+
*/
|
|
7331
|
+
updateOpeningBalance(bankAccount) {
|
|
7332
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${bankAccount.id}/opening-balances/${bankAccount.getCurrentYearBalance().id}`, bankAccount.getCurrentYearBalance())
|
|
7333
|
+
.pipe(map((response) => {
|
|
7334
|
+
const tempCache = _.cloneDeep(this.cache);
|
|
7335
|
+
replace(tempCache[tempCache.findIndex((ba) => ba.id === bankAccount.id)].balances, response);
|
|
7336
|
+
this.cache = tempCache;
|
|
7337
|
+
this.updateCache();
|
|
7338
|
+
}));
|
|
7339
|
+
}
|
|
7340
|
+
/**
|
|
7341
|
+
* Update bank account current balance
|
|
7342
|
+
*/
|
|
7343
|
+
updateCurrentBalance(bankAccount) {
|
|
7344
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${bankAccount.id}/balance`, bankAccount)
|
|
7345
|
+
.pipe(map((response) => {
|
|
7346
|
+
const updatedBankAccount = plainToClass(BankAccount, response);
|
|
7347
|
+
replace(this.cache, updatedBankAccount);
|
|
7348
|
+
this.updateCache();
|
|
7349
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BANK_ACCOUNT_UPDATED, updatedBankAccount));
|
|
7350
|
+
return updatedBankAccount;
|
|
7351
|
+
}));
|
|
7352
|
+
}
|
|
7353
|
+
getOwn() {
|
|
7354
|
+
return this.get()
|
|
6916
7355
|
.pipe(map((bankAccounts) => {
|
|
6917
7356
|
return bankAccounts.filter((bankAccount) => bankAccount.isOwner(+localStorage.getItem('userId')));
|
|
6918
7357
|
}));
|
|
@@ -6920,31 +7359,323 @@ class BankAccountService extends RestService {
|
|
|
6920
7359
|
/**
|
|
6921
7360
|
* Listen to EventDispatcherService events
|
|
6922
7361
|
*/
|
|
6923
|
-
listenToEventDispatcherChanges() {
|
|
6924
|
-
this.eventDispatcherService.on([
|
|
6925
|
-
AppEventTypeEnum.PROPERTY_SHARE_UPDATED,
|
|
6926
|
-
AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
|
|
6927
|
-
AppEventTypeEnum.BANK_CONNECTION_ADDED
|
|
6928
|
-
]).subscribe(() => {
|
|
6929
|
-
this.fetch().subscribe((bankAccounts) => {
|
|
6930
|
-
this.cache = bankAccounts;
|
|
6931
|
-
this.updateCache();
|
|
6932
|
-
});
|
|
6933
|
-
});
|
|
7362
|
+
listenToEventDispatcherChanges() {
|
|
7363
|
+
this.eventDispatcherService.on([
|
|
7364
|
+
AppEventTypeEnum.PROPERTY_SHARE_UPDATED,
|
|
7365
|
+
AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
|
|
7366
|
+
AppEventTypeEnum.BANK_CONNECTION_ADDED
|
|
7367
|
+
]).subscribe(() => {
|
|
7368
|
+
this.fetch().subscribe((bankAccounts) => {
|
|
7369
|
+
this.cache = bankAccounts;
|
|
7370
|
+
this.updateCache();
|
|
7371
|
+
});
|
|
7372
|
+
});
|
|
7373
|
+
}
|
|
7374
|
+
}
|
|
7375
|
+
BankAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankAccountService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7376
|
+
BankAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankAccountService, providedIn: 'root' });
|
|
7377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankAccountService, decorators: [{
|
|
7378
|
+
type: Injectable,
|
|
7379
|
+
args: [{
|
|
7380
|
+
providedIn: 'root'
|
|
7381
|
+
}]
|
|
7382
|
+
}] });
|
|
7383
|
+
|
|
7384
|
+
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|
|
7385
|
+
/**
|
|
7386
|
+
* Service for transaction allocations business logic
|
|
7387
|
+
* @TODO alex refactor
|
|
7388
|
+
*/
|
|
7389
|
+
class TransactionAllocationService extends RestService {
|
|
7390
|
+
constructor() {
|
|
7391
|
+
super(...arguments);
|
|
7392
|
+
// API URL param for transaction allocations
|
|
7393
|
+
this.url = 'transactions-allocations';
|
|
7394
|
+
this.modelClass = TransactionAllocation;
|
|
7395
|
+
}
|
|
7396
|
+
/**
|
|
7397
|
+
* Add single transaction allocation
|
|
7398
|
+
*/
|
|
7399
|
+
add(allocation) {
|
|
7400
|
+
return this.addBatch([allocation]).pipe(map((newAllocations) => newAllocations[0]));
|
|
7401
|
+
}
|
|
7402
|
+
/**
|
|
7403
|
+
* get list of transactions allocations related with passed bank transactions list
|
|
7404
|
+
*/
|
|
7405
|
+
getByTransactions(transactions) {
|
|
7406
|
+
const ids = transactions.map((transaction) => transaction.id);
|
|
7407
|
+
return this.get()
|
|
7408
|
+
.pipe(map((transactionAllocations) => {
|
|
7409
|
+
return transactionAllocations.filter((allocation) => ids.includes(allocation.transaction.id));
|
|
7410
|
+
}));
|
|
7411
|
+
}
|
|
7412
|
+
listenEvents() {
|
|
7413
|
+
this.onTransactionsCreated();
|
|
7414
|
+
this.onDepreciationCreated();
|
|
7415
|
+
this.onTransactionDeleted();
|
|
7416
|
+
}
|
|
7417
|
+
/**
|
|
7418
|
+
* Reset cache on transactions created
|
|
7419
|
+
*/
|
|
7420
|
+
onTransactionsCreated() {
|
|
7421
|
+
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(() => {
|
|
7422
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
7423
|
+
this.resetCache();
|
|
7424
|
+
});
|
|
7425
|
+
}
|
|
7426
|
+
/**
|
|
7427
|
+
* Reset cache on depreciation created
|
|
7428
|
+
*/
|
|
7429
|
+
onDepreciationCreated() {
|
|
7430
|
+
this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATIONS_CREATED).subscribe(() => {
|
|
7431
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
7432
|
+
this.resetCache();
|
|
7433
|
+
});
|
|
7434
|
+
}
|
|
7435
|
+
/**
|
|
7436
|
+
* Reset cache on transaction deleted
|
|
7437
|
+
*/
|
|
7438
|
+
onTransactionDeleted() {
|
|
7439
|
+
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTION_DELETED).subscribe(() => {
|
|
7440
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
7441
|
+
this.resetCache();
|
|
7442
|
+
});
|
|
7443
|
+
}
|
|
7444
|
+
}
|
|
7445
|
+
TransactionAllocationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7446
|
+
TransactionAllocationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, providedIn: 'root' });
|
|
7447
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, decorators: [{
|
|
7448
|
+
type: Injectable,
|
|
7449
|
+
args: [{
|
|
7450
|
+
providedIn: 'root'
|
|
7451
|
+
}]
|
|
7452
|
+
}] });
|
|
7453
|
+
|
|
7454
|
+
var MessagesEnum$1;
|
|
7455
|
+
(function (MessagesEnum) {
|
|
7456
|
+
MessagesEnum["VEHICLE_CREATED"] = "Vehicle created successfully";
|
|
7457
|
+
MessagesEnum["VEHICLE_UPDATED"] = "Vehicle updated successfully";
|
|
7458
|
+
MessagesEnum["VEHICLE_DELETED"] = "Vehicle deleted successfully";
|
|
7459
|
+
MessagesEnum["VEHICLE_CLAIM_CREATED"] = "Vehicle claim created successfully";
|
|
7460
|
+
MessagesEnum["VEHICLE_CLAIM_UPDATED"] = "Vehicle claim updated successfully";
|
|
7461
|
+
MessagesEnum["VEHICLE_CLAIM_DELETED"] = "Vehicle claim deleted successfully";
|
|
7462
|
+
MessagesEnum["VEHICLE_LOGBOOK_CREATED"] = "Vehicle logbook created successfully";
|
|
7463
|
+
MessagesEnum["VEHICLE_LOGBOOK_UPDATED"] = "Vehicle logbook updated successfully";
|
|
7464
|
+
MessagesEnum["VEHICLE_LOGBOOK_DELETED"] = "Vehicle logbook deleted successfully";
|
|
7465
|
+
})(MessagesEnum$1 || (MessagesEnum$1 = {}));
|
|
7466
|
+
|
|
7467
|
+
class VehicleClaimService extends RestService {
|
|
7468
|
+
constructor() {
|
|
7469
|
+
super(...arguments);
|
|
7470
|
+
this.modelClass = VehicleClaim;
|
|
7471
|
+
this.url = 'vehicle-claims';
|
|
7472
|
+
this.messageCreated = MessagesEnum$1.VEHICLE_CLAIM_CREATED;
|
|
7473
|
+
this.messageUpdated = MessagesEnum$1.VEHICLE_CLAIM_UPDATED;
|
|
7474
|
+
this.messageDeleted = MessagesEnum$1.VEHICLE_CLAIM_DELETED;
|
|
7475
|
+
}
|
|
7476
|
+
}
|
|
7477
|
+
VehicleClaimService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleClaimService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7478
|
+
VehicleClaimService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleClaimService, providedIn: 'root' });
|
|
7479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleClaimService, decorators: [{
|
|
7480
|
+
type: Injectable,
|
|
7481
|
+
args: [{
|
|
7482
|
+
providedIn: 'root'
|
|
7483
|
+
}]
|
|
7484
|
+
}] });
|
|
7485
|
+
|
|
7486
|
+
/**
|
|
7487
|
+
* Service handling user's account setup process.
|
|
7488
|
+
* Checks required steps and their completion
|
|
7489
|
+
*/
|
|
7490
|
+
class AccountSetupService {
|
|
7491
|
+
constructor(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService) {
|
|
7492
|
+
this.clientIncomeTypesService = clientIncomeTypesService;
|
|
7493
|
+
this.propertyService = propertyService;
|
|
7494
|
+
this.incomeSourceService = incomeSourceService;
|
|
7495
|
+
this.bankAccountsService = bankAccountsService;
|
|
7496
|
+
this.transactionAllocationService = transactionAllocationService;
|
|
7497
|
+
this.vehicleClaimService = vehicleClaimService;
|
|
7498
|
+
this.cacheSubject = new ReplaySubject(1);
|
|
7499
|
+
}
|
|
7500
|
+
/**
|
|
7501
|
+
* Get list of account setup items for current user
|
|
7502
|
+
*/
|
|
7503
|
+
get() {
|
|
7504
|
+
if (!this.cache) {
|
|
7505
|
+
this.clientIncomeTypesService.get().subscribe((incomeTypes) => {
|
|
7506
|
+
combineLatest(this.createBatch(incomeTypes)).subscribe((items) => {
|
|
7507
|
+
this.cache = new AccountSetupItemCollection(items);
|
|
7508
|
+
this.cacheSubject.next(this.cache);
|
|
7509
|
+
});
|
|
7510
|
+
});
|
|
7511
|
+
}
|
|
7512
|
+
return this.cacheSubject.asObservable();
|
|
7513
|
+
}
|
|
7514
|
+
/**
|
|
7515
|
+
* Get a single AccountSetupItem and check it's completion
|
|
7516
|
+
*/
|
|
7517
|
+
create(itemType, request) {
|
|
7518
|
+
return request.pipe(map((result) => {
|
|
7519
|
+
const item = ACCOUNT_SETUP_ITEMS[itemType];
|
|
7520
|
+
if (result.length) {
|
|
7521
|
+
item.isCompleted = true;
|
|
7522
|
+
}
|
|
7523
|
+
return item;
|
|
7524
|
+
}));
|
|
7525
|
+
}
|
|
7526
|
+
/**
|
|
7527
|
+
* Get batch of requests to get list of required AccountSetupItem's.
|
|
7528
|
+
* Some items are optional and depends of user's client income types
|
|
7529
|
+
*/
|
|
7530
|
+
createBatch(incomeTypes) {
|
|
7531
|
+
const batch = [];
|
|
7532
|
+
// Salary item is completed when user added salary income source
|
|
7533
|
+
if (incomeTypes.salary) {
|
|
7534
|
+
batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(IncomeSourceTypeEnum.SALARY)));
|
|
7535
|
+
}
|
|
7536
|
+
// Other income item is completed when user added at least one other income source
|
|
7537
|
+
if (incomeTypes.dividends || incomeTypes.other) {
|
|
7538
|
+
batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(IncomeSourceTypeEnum.OTHER)));
|
|
7539
|
+
}
|
|
7540
|
+
// Rental income item is completed when user added at least one property
|
|
7541
|
+
if (incomeTypes.rental) {
|
|
7542
|
+
batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
|
|
7543
|
+
}
|
|
7544
|
+
// Bank feeds item is completed when user added at least one bank account (basiq or manual)
|
|
7545
|
+
batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
|
|
7546
|
+
// Logbook item is completed when user has at least one vehicle claim with any method (klms or logbook)
|
|
7547
|
+
batch.push(this.create(AccountSetupItemsEnum.WORK_LOGBOOK, this.vehicleClaimService.get()));
|
|
7548
|
+
// @TODO waiting for sole tank forecast page
|
|
7549
|
+
// Sole item is completed when user added at least one sole income source
|
|
7550
|
+
// if (incomeTypes.soleTrader) {
|
|
7551
|
+
// batch.push(
|
|
7552
|
+
// this.prepareItem(
|
|
7553
|
+
// AccountSetupItemsEnum.SOLE_INCOME,
|
|
7554
|
+
// this.getIncomeSourcesByType(IncomeSourceTypeEnum.SOLE)
|
|
7555
|
+
// )
|
|
7556
|
+
// );
|
|
7557
|
+
// }
|
|
7558
|
+
// Allocation item is completed when user added at least one transaction allocation
|
|
7559
|
+
batch.push(this.create(AccountSetupItemsEnum.TRANSACTION, this.transactionAllocationService.get()));
|
|
7560
|
+
return batch;
|
|
7561
|
+
}
|
|
7562
|
+
/**
|
|
7563
|
+
* @TODO work with collection when services refactored
|
|
7564
|
+
*/
|
|
7565
|
+
getIncomeSourcesByType(type) {
|
|
7566
|
+
return this.incomeSourceService.get().pipe(map((incomeSources) => {
|
|
7567
|
+
return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
|
|
7568
|
+
}));
|
|
7569
|
+
}
|
|
7570
|
+
}
|
|
7571
|
+
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 });
|
|
7572
|
+
AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
|
|
7573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, decorators: [{
|
|
7574
|
+
type: Injectable,
|
|
7575
|
+
args: [{
|
|
7576
|
+
providedIn: 'root'
|
|
7577
|
+
}]
|
|
7578
|
+
}], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }]; } });
|
|
7579
|
+
|
|
7580
|
+
class AddressService {
|
|
7581
|
+
constructor(http, environment) {
|
|
7582
|
+
this.http = http;
|
|
7583
|
+
this.environment = environment;
|
|
7584
|
+
this.countriesSubject = new ReplaySubject(1);
|
|
7585
|
+
}
|
|
7586
|
+
getCountries() {
|
|
7587
|
+
if (!this._countries) {
|
|
7588
|
+
this.http.get(`${this.environment.apiV2}/countries`)
|
|
7589
|
+
.pipe(map((response) => {
|
|
7590
|
+
return response['hydra:member'].map((item) => plainToClass(Country, item));
|
|
7591
|
+
}))
|
|
7592
|
+
.subscribe((countries) => {
|
|
7593
|
+
this._countries = countries;
|
|
7594
|
+
this.countriesSubject.next(countries);
|
|
7595
|
+
});
|
|
7596
|
+
}
|
|
7597
|
+
return this.countriesSubject.asObservable();
|
|
7598
|
+
}
|
|
7599
|
+
}
|
|
7600
|
+
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 });
|
|
7601
|
+
AddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, providedIn: 'root' });
|
|
7602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, decorators: [{
|
|
7603
|
+
type: Injectable,
|
|
7604
|
+
args: [{
|
|
7605
|
+
providedIn: 'root'
|
|
7606
|
+
}]
|
|
7607
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
7608
|
+
type: Inject,
|
|
7609
|
+
args: ['environment']
|
|
7610
|
+
}] }]; } });
|
|
7611
|
+
|
|
7612
|
+
/**
|
|
7613
|
+
* Service to work with assets (documents, receipts, e.t.c.)
|
|
7614
|
+
*/
|
|
7615
|
+
class AssetsService {
|
|
7616
|
+
constructor(http, userSwitcherService, environment) {
|
|
7617
|
+
this.http = http;
|
|
7618
|
+
this.userSwitcherService = userSwitcherService;
|
|
7619
|
+
this.environment = environment;
|
|
7620
|
+
this.impersonatedClient = this.userSwitcherService.get();
|
|
7621
|
+
}
|
|
7622
|
+
/**
|
|
7623
|
+
* Get asset link
|
|
7624
|
+
* @param asset to get the link for
|
|
7625
|
+
*/
|
|
7626
|
+
getLink(asset) {
|
|
7627
|
+
return this.http.get(`${this.environment.apiV2}/assets/${asset.type}/${asset.id}`);
|
|
7628
|
+
}
|
|
7629
|
+
/**
|
|
7630
|
+
* Download asset
|
|
7631
|
+
* @param asset which should be downloaded
|
|
7632
|
+
* @TODO refactor
|
|
7633
|
+
*/
|
|
7634
|
+
download(asset) {
|
|
7635
|
+
return `${this.environment.apiV2}/assets/${asset.type}/${asset.id}/download?bearer=${localStorage.getItem('token')}${this.impersonatedClient ? `&_switch_user=${this.impersonatedClient}` : ''}`;
|
|
7636
|
+
}
|
|
7637
|
+
// @Todo refactor to event dispatcher
|
|
7638
|
+
/**
|
|
7639
|
+
* Delete asset
|
|
7640
|
+
* @param entityId: id of asset main entity (property, folder, transaction, e.t.c.)
|
|
7641
|
+
* @param asset which should be deleted
|
|
7642
|
+
*/
|
|
7643
|
+
delete(entityId, asset) {
|
|
7644
|
+
return this.http.delete(`${this.environment.apiV2}/${asset.entityType}/${entityId}/${asset.type}/${asset.id}`);
|
|
6934
7645
|
}
|
|
6935
7646
|
}
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
7647
|
+
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 });
|
|
7648
|
+
AssetsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, providedIn: 'root' });
|
|
7649
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, decorators: [{
|
|
6939
7650
|
type: Injectable,
|
|
6940
7651
|
args: [{
|
|
6941
7652
|
providedIn: 'root'
|
|
6942
7653
|
}]
|
|
6943
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type:
|
|
7654
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: UserSwitcherService }, { type: undefined, decorators: [{
|
|
6944
7655
|
type: Inject,
|
|
6945
7656
|
args: ['environment']
|
|
6946
7657
|
}] }]; } });
|
|
6947
7658
|
|
|
7659
|
+
/**
|
|
7660
|
+
* Service that handling banks logic
|
|
7661
|
+
*/
|
|
7662
|
+
class BankService extends RestService {
|
|
7663
|
+
constructor() {
|
|
7664
|
+
super(...arguments);
|
|
7665
|
+
this.modelClass = Bank;
|
|
7666
|
+
this.url = 'banks';
|
|
7667
|
+
this.isHydra = true;
|
|
7668
|
+
}
|
|
7669
|
+
}
|
|
7670
|
+
BankService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7671
|
+
BankService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, providedIn: 'root' });
|
|
7672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, decorators: [{
|
|
7673
|
+
type: Injectable,
|
|
7674
|
+
args: [{
|
|
7675
|
+
providedIn: 'root'
|
|
7676
|
+
}]
|
|
7677
|
+
}] });
|
|
7678
|
+
|
|
6948
7679
|
/**
|
|
6949
7680
|
* @TODO move to collection
|
|
6950
7681
|
*/
|
|
@@ -7039,14 +7770,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7039
7770
|
* service handles BankConnection management
|
|
7040
7771
|
*/
|
|
7041
7772
|
class BankConnectionService extends RestService {
|
|
7042
|
-
constructor(
|
|
7043
|
-
super(
|
|
7044
|
-
this.http = http;
|
|
7045
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7046
|
-
this.environment = environment;
|
|
7773
|
+
constructor() {
|
|
7774
|
+
super(...arguments);
|
|
7047
7775
|
this.modelClass = BankConnection;
|
|
7048
7776
|
this.url = 'bank-connections';
|
|
7049
|
-
this.listenEvents();
|
|
7050
7777
|
}
|
|
7051
7778
|
listenEvents() {
|
|
7052
7779
|
this.listenToAddedBankAccounts();
|
|
@@ -7064,31 +7791,24 @@ class BankConnectionService extends RestService {
|
|
|
7064
7791
|
});
|
|
7065
7792
|
}
|
|
7066
7793
|
}
|
|
7067
|
-
BankConnectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, deps:
|
|
7794
|
+
BankConnectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7068
7795
|
BankConnectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, providedIn: 'root' });
|
|
7069
7796
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, decorators: [{
|
|
7070
7797
|
type: Injectable,
|
|
7071
7798
|
args: [{
|
|
7072
7799
|
providedIn: 'root'
|
|
7073
7800
|
}]
|
|
7074
|
-
}]
|
|
7075
|
-
type: Inject,
|
|
7076
|
-
args: ['environment']
|
|
7077
|
-
}] }]; } });
|
|
7801
|
+
}] });
|
|
7078
7802
|
|
|
7079
7803
|
/**
|
|
7080
7804
|
* Service for bank transactions business logic
|
|
7081
7805
|
*/
|
|
7082
7806
|
class BankTransactionService extends RestService {
|
|
7083
|
-
constructor(
|
|
7084
|
-
super(
|
|
7085
|
-
this.http = http;
|
|
7086
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7087
|
-
this.environment = environment;
|
|
7807
|
+
constructor() {
|
|
7808
|
+
super(...arguments);
|
|
7088
7809
|
// url part for BankTransaction API
|
|
7089
7810
|
this.url = 'bank-transactions';
|
|
7090
7811
|
this.modelClass = BankTransaction;
|
|
7091
|
-
this.listenEvents();
|
|
7092
7812
|
}
|
|
7093
7813
|
listenEvents() {
|
|
7094
7814
|
this.listenBankTransactionsImport();
|
|
@@ -7142,32 +7862,25 @@ class BankTransactionService extends RestService {
|
|
|
7142
7862
|
});
|
|
7143
7863
|
}
|
|
7144
7864
|
}
|
|
7145
|
-
BankTransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, deps:
|
|
7865
|
+
BankTransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7146
7866
|
BankTransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, providedIn: 'root' });
|
|
7147
7867
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionService, decorators: [{
|
|
7148
7868
|
type: Injectable,
|
|
7149
7869
|
args: [{
|
|
7150
7870
|
providedIn: 'root'
|
|
7151
7871
|
}]
|
|
7152
|
-
}]
|
|
7153
|
-
type: Inject,
|
|
7154
|
-
args: ['environment']
|
|
7155
|
-
}] }]; } });
|
|
7872
|
+
}] });
|
|
7156
7873
|
|
|
7157
7874
|
/**
|
|
7158
7875
|
* basiq is a middleman between bank and user
|
|
7159
7876
|
* service is responsible for fetching bank related information
|
|
7160
7877
|
*/
|
|
7161
7878
|
class BasiqService extends RestService {
|
|
7162
|
-
constructor(
|
|
7163
|
-
super(
|
|
7164
|
-
this.http = http;
|
|
7165
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7166
|
-
this.environment = environment;
|
|
7879
|
+
constructor() {
|
|
7880
|
+
super(...arguments);
|
|
7167
7881
|
this.tokenSubject = new ReplaySubject();
|
|
7168
7882
|
this.url = 'basiq/accounts';
|
|
7169
7883
|
this.modelClass = BankAccount;
|
|
7170
|
-
this.listenEvents();
|
|
7171
7884
|
}
|
|
7172
7885
|
/**
|
|
7173
7886
|
* Listen events from Event Dispatcher service
|
|
@@ -7225,17 +7938,14 @@ class BasiqService extends RestService {
|
|
|
7225
7938
|
});
|
|
7226
7939
|
}
|
|
7227
7940
|
}
|
|
7228
|
-
BasiqService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, deps:
|
|
7941
|
+
BasiqService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7229
7942
|
BasiqService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, providedIn: 'root' });
|
|
7230
7943
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BasiqService, decorators: [{
|
|
7231
7944
|
type: Injectable,
|
|
7232
7945
|
args: [{
|
|
7233
7946
|
providedIn: 'root'
|
|
7234
7947
|
}]
|
|
7235
|
-
}]
|
|
7236
|
-
type: Inject,
|
|
7237
|
-
args: ['environment']
|
|
7238
|
-
}] }]; } });
|
|
7948
|
+
}] });
|
|
7239
7949
|
|
|
7240
7950
|
class BorrowingExpenseService {
|
|
7241
7951
|
constructor(http, environment) {
|
|
@@ -7458,21 +8168,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7458
8168
|
* Service for work with chats
|
|
7459
8169
|
*/
|
|
7460
8170
|
class ChatService extends RestService {
|
|
7461
|
-
constructor(http, eventDispatcherService, environment, sseService) {
|
|
7462
|
-
super(http, eventDispatcherService, environment);
|
|
8171
|
+
constructor(http, eventDispatcherService, environment, toastService, sseService) {
|
|
8172
|
+
super(http, eventDispatcherService, environment, toastService);
|
|
7463
8173
|
this.http = http;
|
|
7464
8174
|
this.eventDispatcherService = eventDispatcherService;
|
|
7465
8175
|
this.environment = environment;
|
|
8176
|
+
this.toastService = toastService;
|
|
7466
8177
|
this.sseService = sseService;
|
|
7467
8178
|
this.modelClass = Chat;
|
|
7468
8179
|
this.url = 'chats';
|
|
7469
8180
|
this.isHydra = true;
|
|
7470
|
-
this.listenEvents();
|
|
7471
|
-
}
|
|
7472
|
-
/**
|
|
7473
|
-
* SSE and Event Dispatcher Services listeners
|
|
7474
|
-
*/
|
|
7475
|
-
listenEvents() {
|
|
7476
8181
|
this.listenChats();
|
|
7477
8182
|
}
|
|
7478
8183
|
/**
|
|
@@ -7509,7 +8214,7 @@ class ChatService extends RestService {
|
|
|
7509
8214
|
});
|
|
7510
8215
|
}
|
|
7511
8216
|
}
|
|
7512
|
-
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 });
|
|
8217
|
+
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 });
|
|
7513
8218
|
ChatService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChatService, providedIn: 'root' });
|
|
7514
8219
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChatService, decorators: [{
|
|
7515
8220
|
type: Injectable,
|
|
@@ -7519,27 +8224,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7519
8224
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
7520
8225
|
type: Inject,
|
|
7521
8226
|
args: ['environment']
|
|
7522
|
-
}] }, { type: SseService }]; } });
|
|
8227
|
+
}] }, { type: ToastService }, { type: SseService }]; } });
|
|
7523
8228
|
|
|
7524
8229
|
/**
|
|
7525
8230
|
* Service for work with messages
|
|
7526
8231
|
*/
|
|
7527
8232
|
class MessageService extends RestService {
|
|
7528
|
-
constructor(http, eventDispatcherService, environment, sseService) {
|
|
7529
|
-
super(http, eventDispatcherService, environment);
|
|
8233
|
+
constructor(http, eventDispatcherService, environment, toastService, sseService) {
|
|
8234
|
+
super(http, eventDispatcherService, environment, toastService);
|
|
7530
8235
|
this.http = http;
|
|
7531
8236
|
this.eventDispatcherService = eventDispatcherService;
|
|
7532
8237
|
this.environment = environment;
|
|
8238
|
+
this.toastService = toastService;
|
|
7533
8239
|
this.sseService = sseService;
|
|
7534
8240
|
this.modelClass = Message;
|
|
7535
8241
|
this.url = 'messages';
|
|
7536
8242
|
this.isHydra = true;
|
|
7537
|
-
this.listenEvents();
|
|
7538
|
-
}
|
|
7539
|
-
/**
|
|
7540
|
-
* SSE and Event Dispatcher Services listeners
|
|
7541
|
-
*/
|
|
7542
|
-
listenEvents() {
|
|
7543
8243
|
this.listenMessages();
|
|
7544
8244
|
}
|
|
7545
8245
|
/**
|
|
@@ -7562,7 +8262,7 @@ class MessageService extends RestService {
|
|
|
7562
8262
|
});
|
|
7563
8263
|
}
|
|
7564
8264
|
}
|
|
7565
|
-
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 });
|
|
8265
|
+
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 });
|
|
7566
8266
|
MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MessageService, providedIn: 'root' });
|
|
7567
8267
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MessageService, decorators: [{
|
|
7568
8268
|
type: Injectable,
|
|
@@ -7572,7 +8272,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7572
8272
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
7573
8273
|
type: Inject,
|
|
7574
8274
|
args: ['environment']
|
|
7575
|
-
}] }, { type: SseService }]; } });
|
|
8275
|
+
}] }, { type: ToastService }, { type: SseService }]; } });
|
|
7576
8276
|
|
|
7577
8277
|
// @TODO improve base rest service and extend it
|
|
7578
8278
|
/**
|
|
@@ -7775,15 +8475,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7775
8475
|
}] });
|
|
7776
8476
|
|
|
7777
8477
|
class ClientMovementService extends RestService {
|
|
7778
|
-
constructor(
|
|
7779
|
-
super(
|
|
7780
|
-
this.http = http;
|
|
7781
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7782
|
-
this.environment = environment;
|
|
8478
|
+
constructor() {
|
|
8479
|
+
super(...arguments);
|
|
7783
8480
|
this.modelClass = ClientMovement;
|
|
7784
8481
|
this.url = 'client-movements';
|
|
7785
8482
|
this.isHydra = true;
|
|
7786
|
-
this.listenEvents();
|
|
7787
8483
|
}
|
|
7788
8484
|
/**
|
|
7789
8485
|
* @TODO BaseRestService should return collection
|
|
@@ -7848,17 +8544,14 @@ class ClientMovementService extends RestService {
|
|
|
7848
8544
|
});
|
|
7849
8545
|
}
|
|
7850
8546
|
}
|
|
7851
|
-
ClientMovementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, deps:
|
|
8547
|
+
ClientMovementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7852
8548
|
ClientMovementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, providedIn: 'root' });
|
|
7853
8549
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ClientMovementService, decorators: [{
|
|
7854
8550
|
type: Injectable,
|
|
7855
8551
|
args: [{
|
|
7856
8552
|
providedIn: 'root'
|
|
7857
8553
|
}]
|
|
7858
|
-
}]
|
|
7859
|
-
type: Inject,
|
|
7860
|
-
args: ['environment']
|
|
7861
|
-
}] }]; } });
|
|
8554
|
+
}] });
|
|
7862
8555
|
|
|
7863
8556
|
// @Todo refactor with BaseRest service
|
|
7864
8557
|
/**
|
|
@@ -7945,14 +8638,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7945
8638
|
}] }]; } });
|
|
7946
8639
|
|
|
7947
8640
|
class DepreciationService extends RestService {
|
|
7948
|
-
constructor(
|
|
7949
|
-
super(
|
|
7950
|
-
this.http = http;
|
|
7951
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
7952
|
-
this.environment = environment;
|
|
8641
|
+
constructor() {
|
|
8642
|
+
super(...arguments);
|
|
7953
8643
|
this.modelClass = Depreciation;
|
|
7954
8644
|
this.url = 'depreciations';
|
|
7955
|
-
this.listenEvents();
|
|
7956
8645
|
}
|
|
7957
8646
|
/**
|
|
7958
8647
|
* Add a single depreciation
|
|
@@ -7983,14 +8672,6 @@ class DepreciationService extends RestService {
|
|
|
7983
8672
|
this.listenToVehicleClaim();
|
|
7984
8673
|
this.listenToUpdatedBankAccount();
|
|
7985
8674
|
}
|
|
7986
|
-
/**
|
|
7987
|
-
* Get depreciations related to Vehicle category
|
|
7988
|
-
*/
|
|
7989
|
-
getVehicleDepreciations() {
|
|
7990
|
-
return this.get().pipe(map((depreciations) => {
|
|
7991
|
-
return depreciations.filter((depreciation) => depreciation.isVehicleDepreciation());
|
|
7992
|
-
}));
|
|
7993
|
-
}
|
|
7994
8675
|
getOpenBalance(depreciation) {
|
|
7995
8676
|
return this.http.post(`${this.environment.apiV2}/${this.url}/opening-balance?financialYear=${new FinancialYear().year}`, depreciation)
|
|
7996
8677
|
.pipe(map((response) => {
|
|
@@ -8065,27 +8746,21 @@ class DepreciationService extends RestService {
|
|
|
8065
8746
|
});
|
|
8066
8747
|
}
|
|
8067
8748
|
}
|
|
8068
|
-
DepreciationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, deps:
|
|
8749
|
+
DepreciationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8069
8750
|
DepreciationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, providedIn: 'root' });
|
|
8070
8751
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DepreciationService, decorators: [{
|
|
8071
8752
|
type: Injectable,
|
|
8072
8753
|
args: [{
|
|
8073
8754
|
providedIn: 'root'
|
|
8074
8755
|
}]
|
|
8075
|
-
}]
|
|
8076
|
-
type: Inject,
|
|
8077
|
-
args: ['environment']
|
|
8078
|
-
}] }]; } });
|
|
8756
|
+
}] });
|
|
8079
8757
|
|
|
8080
8758
|
/**
|
|
8081
8759
|
* Service to handle document-folders and depending documents logic
|
|
8082
8760
|
*/
|
|
8083
8761
|
class DocumentFolderService extends RestService {
|
|
8084
|
-
constructor(
|
|
8085
|
-
super(
|
|
8086
|
-
this.http = http;
|
|
8087
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8088
|
-
this.environment = environment;
|
|
8762
|
+
constructor() {
|
|
8763
|
+
super(...arguments);
|
|
8089
8764
|
this.url = 'folders';
|
|
8090
8765
|
this.modelClass = DocumentFolder;
|
|
8091
8766
|
}
|
|
@@ -8139,17 +8814,14 @@ class DocumentFolderService extends RestService {
|
|
|
8139
8814
|
}));
|
|
8140
8815
|
}
|
|
8141
8816
|
}
|
|
8142
|
-
DocumentFolderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, deps:
|
|
8817
|
+
DocumentFolderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8143
8818
|
DocumentFolderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, providedIn: 'root' });
|
|
8144
8819
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DocumentFolderService, decorators: [{
|
|
8145
8820
|
type: Injectable,
|
|
8146
8821
|
args: [{
|
|
8147
8822
|
providedIn: 'root'
|
|
8148
8823
|
}]
|
|
8149
|
-
}]
|
|
8150
|
-
type: Inject,
|
|
8151
|
-
args: ['environment']
|
|
8152
|
-
}] }]; } });
|
|
8824
|
+
}] });
|
|
8153
8825
|
|
|
8154
8826
|
class EmployeeService extends RestService {
|
|
8155
8827
|
constructor() {
|
|
@@ -8322,113 +8994,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8322
8994
|
}]
|
|
8323
8995
|
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }]; } });
|
|
8324
8996
|
|
|
8325
|
-
/**
|
|
8326
|
-
* Service to work with income sources
|
|
8327
|
-
*/
|
|
8328
|
-
class IncomeSourceService extends RestService {
|
|
8329
|
-
constructor(http, eventDispatcherService, environment) {
|
|
8330
|
-
super(http, eventDispatcherService, environment);
|
|
8331
|
-
this.http = http;
|
|
8332
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8333
|
-
this.environment = environment;
|
|
8334
|
-
this.url = 'income-sources';
|
|
8335
|
-
this.modelClass = IncomeSource;
|
|
8336
|
-
this.incomeSourceTypeSubject = new ReplaySubject(1);
|
|
8337
|
-
}
|
|
8338
|
-
/**
|
|
8339
|
-
* Get income sources tax calculation
|
|
8340
|
-
* @param salaryForecast for which tax should be calculated
|
|
8341
|
-
*/
|
|
8342
|
-
getTaxCalculation(salaryForecast) {
|
|
8343
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}/tax-calculation`, salaryForecast)
|
|
8344
|
-
.pipe(map((response) => {
|
|
8345
|
-
return plainToClass(SalaryForecast, response);
|
|
8346
|
-
}));
|
|
8347
|
-
}
|
|
8348
|
-
/**
|
|
8349
|
-
* Add batch of income sources
|
|
8350
|
-
* @param incomeSources to add
|
|
8351
|
-
*/
|
|
8352
|
-
addBatch(incomeSources) {
|
|
8353
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, incomeSources)
|
|
8354
|
-
.pipe(map((addedIncomeSources) => {
|
|
8355
|
-
// assign respond income sources to provided income sources
|
|
8356
|
-
const assignedIncomeSources = addedIncomeSources
|
|
8357
|
-
.map((incomeSource, index) => Object.assign(plainToClass(IncomeSource, {}), incomeSource, incomeSources[index]));
|
|
8358
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_CREATED, assignedIncomeSources));
|
|
8359
|
-
this.cache.push(...assignedIncomeSources);
|
|
8360
|
-
this.updateCache();
|
|
8361
|
-
return assignedIncomeSources;
|
|
8362
|
-
}));
|
|
8363
|
-
}
|
|
8364
|
-
/**
|
|
8365
|
-
* Update batch of income sources
|
|
8366
|
-
*/
|
|
8367
|
-
updateBatch(incomeSources, queryParams = {}) {
|
|
8368
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
8369
|
-
.pipe(map((updatedItems) => {
|
|
8370
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(this.modelClass, item));
|
|
8371
|
-
updatedInstances.forEach((instance) => {
|
|
8372
|
-
replace(this.cache, instance);
|
|
8373
|
-
});
|
|
8374
|
-
if (incomeSources[0].forecasts.length) {
|
|
8375
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_UPDATED, incomeSources));
|
|
8376
|
-
}
|
|
8377
|
-
this.updateCache();
|
|
8378
|
-
return updatedInstances;
|
|
8379
|
-
}));
|
|
8380
|
-
}
|
|
8381
|
-
/**
|
|
8382
|
-
* Get income sources by provided types
|
|
8383
|
-
* @param types
|
|
8384
|
-
*/
|
|
8385
|
-
getByTypes(types) {
|
|
8386
|
-
return this.get()
|
|
8387
|
-
.pipe(map((incomeSources) => incomeSources
|
|
8388
|
-
.filter((incomeSource) => types.includes(incomeSource.type))));
|
|
8389
|
-
}
|
|
8390
|
-
/**
|
|
8391
|
-
* Get other incomes types
|
|
8392
|
-
*/
|
|
8393
|
-
getIncomeSourceTypes() {
|
|
8394
|
-
if (!this.incomeSourceTypes) {
|
|
8395
|
-
this.incomeSourceTypes = [];
|
|
8396
|
-
this.http.get(`${this.environment.apiV2}/income-source-types`)
|
|
8397
|
-
.pipe(map((response) => {
|
|
8398
|
-
return response.map((item) => plainToClass(IncomeSourceType, item));
|
|
8399
|
-
}))
|
|
8400
|
-
.subscribe((otherIncomesTypes) => {
|
|
8401
|
-
this.incomeSourceTypes = otherIncomesTypes;
|
|
8402
|
-
this.incomeSourceTypeSubject.next(this.incomeSourceTypes);
|
|
8403
|
-
});
|
|
8404
|
-
}
|
|
8405
|
-
return this.incomeSourceTypeSubject.asObservable();
|
|
8406
|
-
}
|
|
8407
|
-
}
|
|
8408
|
-
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 });
|
|
8409
|
-
IncomeSourceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, providedIn: 'root' });
|
|
8410
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceService, decorators: [{
|
|
8411
|
-
type: Injectable,
|
|
8412
|
-
args: [{
|
|
8413
|
-
providedIn: 'root'
|
|
8414
|
-
}]
|
|
8415
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
8416
|
-
type: Inject,
|
|
8417
|
-
args: ['environment']
|
|
8418
|
-
}] }]; } });
|
|
8419
|
-
|
|
8420
8997
|
/**
|
|
8421
8998
|
* Service to work with Other Income Forecasts
|
|
8422
8999
|
*/
|
|
8423
9000
|
class IncomeSourceForecastService extends RestService {
|
|
8424
|
-
constructor(
|
|
8425
|
-
super(
|
|
8426
|
-
this.http = http;
|
|
8427
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8428
|
-
this.environment = environment;
|
|
9001
|
+
constructor() {
|
|
9002
|
+
super(...arguments);
|
|
8429
9003
|
this.modelClass = IncomeSourceForecast;
|
|
8430
9004
|
this.url = 'income-source-forecasts';
|
|
8431
|
-
this.listenEvents();
|
|
8432
9005
|
}
|
|
8433
9006
|
/**
|
|
8434
9007
|
* Listen to Income Sources events
|
|
@@ -8484,30 +9057,23 @@ class IncomeSourceForecastService extends RestService {
|
|
|
8484
9057
|
}).flat();
|
|
8485
9058
|
}
|
|
8486
9059
|
}
|
|
8487
|
-
IncomeSourceForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, deps:
|
|
9060
|
+
IncomeSourceForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8488
9061
|
IncomeSourceForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, providedIn: 'root' });
|
|
8489
9062
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IncomeSourceForecastService, decorators: [{
|
|
8490
9063
|
type: Injectable,
|
|
8491
9064
|
args: [{
|
|
8492
9065
|
providedIn: 'root'
|
|
8493
9066
|
}]
|
|
8494
|
-
}]
|
|
8495
|
-
type: Inject,
|
|
8496
|
-
args: ['environment']
|
|
8497
|
-
}] }]; } });
|
|
9067
|
+
}] });
|
|
8498
9068
|
|
|
8499
9069
|
/**
|
|
8500
9070
|
* Service to work with Salary Forecasts
|
|
8501
9071
|
*/
|
|
8502
9072
|
class SalaryForecastService extends RestService {
|
|
8503
|
-
constructor(
|
|
8504
|
-
super(
|
|
8505
|
-
this.http = http;
|
|
8506
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8507
|
-
this.environment = environment;
|
|
9073
|
+
constructor() {
|
|
9074
|
+
super(...arguments);
|
|
8508
9075
|
this.modelClass = SalaryForecast;
|
|
8509
9076
|
this.url = 'salary-forecasts';
|
|
8510
|
-
this.listenEvents();
|
|
8511
9077
|
}
|
|
8512
9078
|
/**
|
|
8513
9079
|
* Listen to Income Sources events
|
|
@@ -8563,27 +9129,20 @@ class SalaryForecastService extends RestService {
|
|
|
8563
9129
|
}).flat();
|
|
8564
9130
|
}
|
|
8565
9131
|
}
|
|
8566
|
-
SalaryForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, deps:
|
|
9132
|
+
SalaryForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8567
9133
|
SalaryForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, providedIn: 'root' });
|
|
8568
9134
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SalaryForecastService, decorators: [{
|
|
8569
9135
|
type: Injectable,
|
|
8570
9136
|
args: [{
|
|
8571
9137
|
providedIn: 'root'
|
|
8572
9138
|
}]
|
|
8573
|
-
}]
|
|
8574
|
-
type: Inject,
|
|
8575
|
-
args: ['environment']
|
|
8576
|
-
}] }]; } });
|
|
9139
|
+
}] });
|
|
8577
9140
|
|
|
8578
9141
|
class SoleForecastService extends RestService {
|
|
8579
|
-
constructor(
|
|
8580
|
-
super(
|
|
8581
|
-
this.http = http;
|
|
8582
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8583
|
-
this.environment = environment;
|
|
9142
|
+
constructor() {
|
|
9143
|
+
super(...arguments);
|
|
8584
9144
|
this.modelClass = SoleForecast;
|
|
8585
9145
|
this.url = 'sole-forecasts';
|
|
8586
|
-
this.listenEvents();
|
|
8587
9146
|
}
|
|
8588
9147
|
/**
|
|
8589
9148
|
* Listen to Income Sources events
|
|
@@ -8639,17 +9198,14 @@ class SoleForecastService extends RestService {
|
|
|
8639
9198
|
}).flat();
|
|
8640
9199
|
}
|
|
8641
9200
|
}
|
|
8642
|
-
SoleForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, deps:
|
|
9201
|
+
SoleForecastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8643
9202
|
SoleForecastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, providedIn: 'root' });
|
|
8644
9203
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SoleForecastService, decorators: [{
|
|
8645
9204
|
type: Injectable,
|
|
8646
9205
|
args: [{
|
|
8647
9206
|
providedIn: 'root'
|
|
8648
9207
|
}]
|
|
8649
|
-
}]
|
|
8650
|
-
type: Inject,
|
|
8651
|
-
args: ['environment']
|
|
8652
|
-
}] }]; } });
|
|
9208
|
+
}] });
|
|
8653
9209
|
|
|
8654
9210
|
/**
|
|
8655
9211
|
* Service to work with intercom
|
|
@@ -8721,14 +9277,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8721
9277
|
* Service that handling loans logic
|
|
8722
9278
|
*/
|
|
8723
9279
|
class LoanService extends RestService {
|
|
8724
|
-
constructor(
|
|
8725
|
-
super(
|
|
8726
|
-
this.http = http;
|
|
8727
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
8728
|
-
this.environment = environment;
|
|
9280
|
+
constructor() {
|
|
9281
|
+
super(...arguments);
|
|
8729
9282
|
this.url = 'bank-accounts/loans';
|
|
8730
9283
|
this.modelClass = Loan;
|
|
8731
|
-
this.listenEvents();
|
|
8732
9284
|
}
|
|
8733
9285
|
/**
|
|
8734
9286
|
* Listen to Loans events
|
|
@@ -8838,37 +9390,29 @@ class LoanService extends RestService {
|
|
|
8838
9390
|
}));
|
|
8839
9391
|
}
|
|
8840
9392
|
}
|
|
8841
|
-
LoanService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, deps:
|
|
9393
|
+
LoanService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
8842
9394
|
LoanService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, providedIn: 'root' });
|
|
8843
9395
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LoanService, decorators: [{
|
|
8844
9396
|
type: Injectable,
|
|
8845
9397
|
args: [{
|
|
8846
9398
|
providedIn: 'root'
|
|
8847
9399
|
}]
|
|
8848
|
-
}]
|
|
8849
|
-
type: Inject,
|
|
8850
|
-
args: ['environment']
|
|
8851
|
-
}] }]; } });
|
|
9400
|
+
}] });
|
|
8852
9401
|
|
|
8853
9402
|
/**
|
|
8854
9403
|
* Service to handle service notifications logic
|
|
8855
9404
|
*/
|
|
8856
9405
|
class ServiceNotificationService extends RestService {
|
|
8857
|
-
constructor(http, eventDispatcherService, environment, sseService) {
|
|
8858
|
-
super(http, eventDispatcherService, environment);
|
|
9406
|
+
constructor(http, eventDispatcherService, environment, toastService, sseService) {
|
|
9407
|
+
super(http, eventDispatcherService, environment, toastService);
|
|
8859
9408
|
this.http = http;
|
|
8860
9409
|
this.eventDispatcherService = eventDispatcherService;
|
|
8861
9410
|
this.environment = environment;
|
|
9411
|
+
this.toastService = toastService;
|
|
8862
9412
|
this.sseService = sseService;
|
|
8863
9413
|
this.modelClass = Notification;
|
|
8864
9414
|
this.url = 'service-notifications';
|
|
8865
9415
|
this.isHydra = true;
|
|
8866
|
-
this.listenEvents();
|
|
8867
|
-
}
|
|
8868
|
-
/**
|
|
8869
|
-
* SSE and Event Dispatcher Services listeners
|
|
8870
|
-
*/
|
|
8871
|
-
listenEvents() {
|
|
8872
9416
|
this.listenNotifications();
|
|
8873
9417
|
}
|
|
8874
9418
|
/**
|
|
@@ -8891,7 +9435,7 @@ class ServiceNotificationService extends RestService {
|
|
|
8891
9435
|
});
|
|
8892
9436
|
}
|
|
8893
9437
|
}
|
|
8894
|
-
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 });
|
|
9438
|
+
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 });
|
|
8895
9439
|
ServiceNotificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, providedIn: 'root' });
|
|
8896
9440
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ServiceNotificationService, decorators: [{
|
|
8897
9441
|
type: Injectable,
|
|
@@ -8901,7 +9445,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8901
9445
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
8902
9446
|
type: Inject,
|
|
8903
9447
|
args: ['environment']
|
|
8904
|
-
}] }, { type: SseService }]; } });
|
|
9448
|
+
}] }, { type: ToastService }, { type: SseService }]; } });
|
|
8905
9449
|
|
|
8906
9450
|
/**
|
|
8907
9451
|
* Configuration file with the settings to generate PDF file
|
|
@@ -8922,7 +9466,7 @@ const PDF_CONFIG = {
|
|
|
8922
9466
|
src: '/assets/img/icons/logo.png',
|
|
8923
9467
|
width: 30,
|
|
8924
9468
|
height: 7,
|
|
8925
|
-
positionX:
|
|
9469
|
+
positionX: 42,
|
|
8926
9470
|
positionY: 6
|
|
8927
9471
|
},
|
|
8928
9472
|
// coords for file section title (group, table, e.t.c.)
|
|
@@ -8953,21 +9497,21 @@ class PdfService {
|
|
|
8953
9497
|
/**
|
|
8954
9498
|
* Export file from provided HTML tables
|
|
8955
9499
|
*/
|
|
8956
|
-
exportTables(tables,
|
|
8957
|
-
const document = this.generateFromTables(tables,
|
|
8958
|
-
document.save(`${
|
|
9500
|
+
exportTables(tables, fileSettings) {
|
|
9501
|
+
const document = this.generateFromTables(tables, fileSettings);
|
|
9502
|
+
document.save(`${fileSettings.filename}.pdf`);
|
|
8959
9503
|
}
|
|
8960
9504
|
/**
|
|
8961
9505
|
* Export file from provided array-like table data
|
|
8962
9506
|
*/
|
|
8963
|
-
exportFromDataTables(dataTables,
|
|
8964
|
-
const document = this.generateFromDataTables(
|
|
8965
|
-
document.save(`${
|
|
9507
|
+
exportFromDataTables(dataTables, fileSettings) {
|
|
9508
|
+
const document = this.generateFromDataTables(dataTables, fileSettings.title);
|
|
9509
|
+
document.save(`${fileSettings.filename}.pdf`);
|
|
8966
9510
|
}
|
|
8967
9511
|
/**
|
|
8968
9512
|
* Generate file from array-like table data
|
|
8969
9513
|
*/
|
|
8970
|
-
generateFromDataTables(
|
|
9514
|
+
generateFromDataTables(dataTables, title) {
|
|
8971
9515
|
const pdf = new jsPDF();
|
|
8972
9516
|
this.setDocumentTitle(pdf, title);
|
|
8973
9517
|
this.setDocumentLogo(pdf);
|
|
@@ -8976,9 +9520,9 @@ class PdfService {
|
|
|
8976
9520
|
});
|
|
8977
9521
|
return pdf;
|
|
8978
9522
|
}
|
|
8979
|
-
generateFromTables(tables,
|
|
8980
|
-
const pdf = new jsPDF();
|
|
8981
|
-
this.setDocumentTitle(pdf, title);
|
|
9523
|
+
generateFromTables(tables, fileSettings) {
|
|
9524
|
+
const pdf = new jsPDF(fileSettings.orientation);
|
|
9525
|
+
this.setDocumentTitle(pdf, fileSettings.title);
|
|
8982
9526
|
this.setDocumentLogo(pdf);
|
|
8983
9527
|
tables.forEach((table) => {
|
|
8984
9528
|
// Add table caption if not provided
|
|
@@ -9023,7 +9567,7 @@ class PdfService {
|
|
|
9023
9567
|
setDocumentLogo(doc) {
|
|
9024
9568
|
const logo = new Image();
|
|
9025
9569
|
logo.src = PDF_CONFIG.logo.src;
|
|
9026
|
-
doc.addImage(logo, 'PNG', PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
9570
|
+
doc.addImage(logo, 'PNG', doc.internal.pageSize.width - PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
9027
9571
|
}
|
|
9028
9572
|
}
|
|
9029
9573
|
PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -9035,120 +9579,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
9035
9579
|
}]
|
|
9036
9580
|
}] });
|
|
9037
9581
|
|
|
9038
|
-
/**
|
|
9039
|
-
* Service for work with Property
|
|
9040
|
-
*/
|
|
9041
|
-
class PropertyService extends RestService {
|
|
9042
|
-
constructor(http, eventDispatcherService, environment) {
|
|
9043
|
-
super(http, eventDispatcherService, environment);
|
|
9044
|
-
this.http = http;
|
|
9045
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9046
|
-
this.environment = environment;
|
|
9047
|
-
this.modelClass = Property;
|
|
9048
|
-
this.url = 'properties';
|
|
9049
|
-
this.listenEvents();
|
|
9050
|
-
}
|
|
9051
|
-
listenEvents() {
|
|
9052
|
-
this.listenShareInviteAccepted();
|
|
9053
|
-
this.listenServiceSubscriptionUpdated();
|
|
9054
|
-
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
9055
|
-
this.listenMovementsChanged();
|
|
9056
|
-
}
|
|
9057
|
-
/**
|
|
9058
|
-
* Update cache when share invitation accepted
|
|
9059
|
-
*/
|
|
9060
|
-
listenShareInviteAccepted() {
|
|
9061
|
-
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
|
|
9062
|
-
}
|
|
9063
|
-
/**
|
|
9064
|
-
* Update cache when user's service subscription is updated
|
|
9065
|
-
*/
|
|
9066
|
-
listenServiceSubscriptionUpdated() {
|
|
9067
|
-
this.eventDispatcherService.on(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(() => this.resetCache());
|
|
9068
|
-
}
|
|
9069
|
-
/**
|
|
9070
|
-
* Update cache when property category changed
|
|
9071
|
-
*/
|
|
9072
|
-
listenMovementsChanged() {
|
|
9073
|
-
// @TODO change dispatcher logic to work with multiple events
|
|
9074
|
-
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED).subscribe(() => this.resetCache());
|
|
9075
|
-
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_UPDATED).subscribe(() => this.resetCache());
|
|
9076
|
-
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_MOVEMENT_DELETED).subscribe(() => this.resetCache());
|
|
9077
|
-
}
|
|
9078
|
-
update(property) {
|
|
9079
|
-
return super.update(property).pipe(map((updatedProperty) => {
|
|
9080
|
-
if (property.documentFile) {
|
|
9081
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.PROPERTY_UPDATED_WITH_DOCUMENT, property));
|
|
9082
|
-
}
|
|
9083
|
-
return updatedProperty;
|
|
9084
|
-
}));
|
|
9085
|
-
}
|
|
9086
|
-
getByCategoryId(id) {
|
|
9087
|
-
return this.get().pipe(map((properties) => {
|
|
9088
|
-
return properties.filter((property) => property.category.id === id);
|
|
9089
|
-
}));
|
|
9090
|
-
}
|
|
9091
|
-
/**
|
|
9092
|
-
* Activate deactivated property
|
|
9093
|
-
*/
|
|
9094
|
-
activate(property) {
|
|
9095
|
-
return this.http.post(`${this.environment.apiV2}/property-subscriptions`, { user: property.user, property })
|
|
9096
|
-
.pipe(map((propertySubscriptionBase) => {
|
|
9097
|
-
const newPropertySubscription = plainToClass(PropertySubscription, propertySubscriptionBase);
|
|
9098
|
-
const activatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
|
|
9099
|
-
replace(this.cache, activatedProperty);
|
|
9100
|
-
this.updateCache();
|
|
9101
|
-
}));
|
|
9102
|
-
}
|
|
9103
|
-
/**
|
|
9104
|
-
* Deactivate activated property
|
|
9105
|
-
*/
|
|
9106
|
-
deactivate(property) {
|
|
9107
|
-
return this.http.delete(`${this.environment.apiV2}/property-subscriptions/${property.getCurrentSubscription().id}`)
|
|
9108
|
-
.pipe(map(() => {
|
|
9109
|
-
const deactivatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
|
|
9110
|
-
replace(this.cache, deactivatedProperty);
|
|
9111
|
-
this.updateCache();
|
|
9112
|
-
}));
|
|
9113
|
-
}
|
|
9114
|
-
/**
|
|
9115
|
-
* Update property photo
|
|
9116
|
-
* @param property Property instance for photo update
|
|
9117
|
-
* @param photoFormData FormData with property photo image
|
|
9118
|
-
*/
|
|
9119
|
-
updatePhoto(property, photoFormData) {
|
|
9120
|
-
return this.http.post(`${this.environment.apiV2}/properties/${property.id}/photo?_method=PUT`, photoFormData)
|
|
9121
|
-
.pipe(map((photoLink) => {
|
|
9122
|
-
property.photo = photoLink;
|
|
9123
|
-
// update properties cache
|
|
9124
|
-
replace(this.cache, property);
|
|
9125
|
-
this.updateCache();
|
|
9126
|
-
}));
|
|
9127
|
-
}
|
|
9128
|
-
getByShareId(id) {
|
|
9129
|
-
return this.get().pipe(map((properties) => {
|
|
9130
|
-
return properties.filter((property) => property.user.id === id);
|
|
9131
|
-
}));
|
|
9132
|
-
}
|
|
9133
|
-
/**
|
|
9134
|
-
* Get list of active user's properties
|
|
9135
|
-
*/
|
|
9136
|
-
getActive() {
|
|
9137
|
-
return this.get().pipe(map((properties) => properties.filter((property) => property.isActive)));
|
|
9138
|
-
}
|
|
9139
|
-
}
|
|
9140
|
-
PropertyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9141
|
-
PropertyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, providedIn: 'root' });
|
|
9142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyService, decorators: [{
|
|
9143
|
-
type: Injectable,
|
|
9144
|
-
args: [{
|
|
9145
|
-
providedIn: 'root'
|
|
9146
|
-
}]
|
|
9147
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
9148
|
-
type: Inject,
|
|
9149
|
-
args: ['environment']
|
|
9150
|
-
}] }]; } });
|
|
9151
|
-
|
|
9152
9582
|
function enumToList(data) {
|
|
9153
9583
|
const list = [];
|
|
9154
9584
|
for (const key in data) {
|
|
@@ -9169,72 +9599,16 @@ var MessagesEnum;
|
|
|
9169
9599
|
MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
|
|
9170
9600
|
})(MessagesEnum || (MessagesEnum = {}));
|
|
9171
9601
|
|
|
9172
|
-
/**
|
|
9173
|
-
* popup notifications service (toast, snackbar).
|
|
9174
|
-
*/
|
|
9175
|
-
class ToastService {
|
|
9176
|
-
constructor() {
|
|
9177
|
-
this.toast$ = new ReplaySubject(1);
|
|
9178
|
-
}
|
|
9179
|
-
get() {
|
|
9180
|
-
return this.toast$.asObservable();
|
|
9181
|
-
}
|
|
9182
|
-
add(toast) {
|
|
9183
|
-
this.toast$.next(toast);
|
|
9184
|
-
}
|
|
9185
|
-
success(message) {
|
|
9186
|
-
this.add(plainToClass(Toast, {
|
|
9187
|
-
type: ToastTypeEnum.SUCCESS,
|
|
9188
|
-
title: 'Success!',
|
|
9189
|
-
message,
|
|
9190
|
-
}));
|
|
9191
|
-
}
|
|
9192
|
-
warning(message) {
|
|
9193
|
-
this.add(plainToClass(Toast, {
|
|
9194
|
-
type: ToastTypeEnum.WARNING,
|
|
9195
|
-
title: 'Warning!',
|
|
9196
|
-
message,
|
|
9197
|
-
}));
|
|
9198
|
-
}
|
|
9199
|
-
error(message) {
|
|
9200
|
-
this.add(plainToClass(Toast, {
|
|
9201
|
-
type: ToastTypeEnum.ERROR,
|
|
9202
|
-
title: 'Error!',
|
|
9203
|
-
message,
|
|
9204
|
-
}));
|
|
9205
|
-
}
|
|
9206
|
-
info(message) {
|
|
9207
|
-
this.add(plainToClass(Toast, {
|
|
9208
|
-
type: ToastTypeEnum.INFO,
|
|
9209
|
-
title: 'Information',
|
|
9210
|
-
message,
|
|
9211
|
-
}));
|
|
9212
|
-
}
|
|
9213
|
-
}
|
|
9214
|
-
ToastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9215
|
-
ToastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
9216
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, decorators: [{
|
|
9217
|
-
type: Injectable,
|
|
9218
|
-
args: [{
|
|
9219
|
-
providedIn: 'root'
|
|
9220
|
-
}]
|
|
9221
|
-
}] });
|
|
9222
|
-
|
|
9223
9602
|
/**
|
|
9224
9603
|
* Service for transactions business logic
|
|
9225
9604
|
*/
|
|
9226
9605
|
class TransactionService extends RestService {
|
|
9227
|
-
constructor(
|
|
9228
|
-
super(
|
|
9229
|
-
this.http = http;
|
|
9230
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9231
|
-
this.environment = environment;
|
|
9232
|
-
this.toastService = toastService;
|
|
9606
|
+
constructor() {
|
|
9607
|
+
super(...arguments);
|
|
9233
9608
|
// url part for Transaction API
|
|
9234
9609
|
this.url = 'transactions';
|
|
9235
9610
|
this.modelClass = Transaction;
|
|
9236
9611
|
this.transactionDeleted = new EventEmitter();
|
|
9237
|
-
this.listenEvents();
|
|
9238
9612
|
}
|
|
9239
9613
|
/**
|
|
9240
9614
|
* Listen events from Event Dispatcher services
|
|
@@ -9501,14 +9875,6 @@ class TransactionService extends RestService {
|
|
|
9501
9875
|
return null;
|
|
9502
9876
|
}
|
|
9503
9877
|
}
|
|
9504
|
-
/**
|
|
9505
|
-
* Get transactions related to Vehicle category
|
|
9506
|
-
*/
|
|
9507
|
-
getVehicleTransactions() {
|
|
9508
|
-
return this.get().pipe(map((transactions) => {
|
|
9509
|
-
return transactions.filter((transaction) => transaction.isVehicleTransaction());
|
|
9510
|
-
}));
|
|
9511
|
-
}
|
|
9512
9878
|
/**
|
|
9513
9879
|
* Listen to EventDispatcherService event related to Depreciation changing
|
|
9514
9880
|
*/
|
|
@@ -9528,17 +9894,14 @@ class TransactionService extends RestService {
|
|
|
9528
9894
|
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
|
|
9529
9895
|
}
|
|
9530
9896
|
}
|
|
9531
|
-
TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps:
|
|
9897
|
+
TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
9532
9898
|
TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, providedIn: 'root' });
|
|
9533
9899
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, decorators: [{
|
|
9534
9900
|
type: Injectable,
|
|
9535
9901
|
args: [{
|
|
9536
9902
|
providedIn: 'root'
|
|
9537
9903
|
}]
|
|
9538
|
-
}]
|
|
9539
|
-
type: Inject,
|
|
9540
|
-
args: ['environment']
|
|
9541
|
-
}] }, { type: ToastService }]; } });
|
|
9904
|
+
}] });
|
|
9542
9905
|
|
|
9543
9906
|
/**
|
|
9544
9907
|
* Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
|
|
@@ -9785,14 +10148,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
9785
10148
|
* Class for work with Property Documents
|
|
9786
10149
|
*/
|
|
9787
10150
|
class PropertyDocumentService extends RestService {
|
|
9788
|
-
constructor(
|
|
9789
|
-
super(
|
|
9790
|
-
this.http = http;
|
|
9791
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9792
|
-
this.environment = environment;
|
|
10151
|
+
constructor() {
|
|
10152
|
+
super(...arguments);
|
|
9793
10153
|
this.modelClass = PropertyDocument;
|
|
9794
10154
|
this.url = 'properties/documents';
|
|
9795
|
-
this.listenEvents();
|
|
9796
10155
|
}
|
|
9797
10156
|
/**
|
|
9798
10157
|
* Add new Property Document
|
|
@@ -9830,29 +10189,22 @@ class PropertyDocumentService extends RestService {
|
|
|
9830
10189
|
});
|
|
9831
10190
|
}
|
|
9832
10191
|
}
|
|
9833
|
-
PropertyDocumentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, deps:
|
|
10192
|
+
PropertyDocumentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
9834
10193
|
PropertyDocumentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, providedIn: 'root' });
|
|
9835
10194
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyDocumentService, decorators: [{
|
|
9836
10195
|
type: Injectable,
|
|
9837
10196
|
args: [{
|
|
9838
10197
|
providedIn: 'root'
|
|
9839
10198
|
}]
|
|
9840
|
-
}]
|
|
9841
|
-
type: Inject,
|
|
9842
|
-
args: ['environment']
|
|
9843
|
-
}] }]; } });
|
|
10199
|
+
}] });
|
|
9844
10200
|
|
|
9845
10201
|
// @TODO check and improve logic during refactoring
|
|
9846
10202
|
class PropertyShareService extends RestService {
|
|
9847
|
-
constructor(
|
|
9848
|
-
super(
|
|
9849
|
-
this.http = http;
|
|
9850
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
9851
|
-
this.environment = environment;
|
|
10203
|
+
constructor() {
|
|
10204
|
+
super(...arguments);
|
|
9852
10205
|
// api url parameter for properties shares
|
|
9853
10206
|
this.url = 'properties/shares';
|
|
9854
10207
|
this.modelClass = PropertyShare;
|
|
9855
|
-
this.listenEvents();
|
|
9856
10208
|
}
|
|
9857
10209
|
/**
|
|
9858
10210
|
* Listen to Event Dispatcher events
|
|
@@ -9934,17 +10286,14 @@ class PropertyShareService extends RestService {
|
|
|
9934
10286
|
});
|
|
9935
10287
|
}
|
|
9936
10288
|
}
|
|
9937
|
-
PropertyShareService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, deps:
|
|
10289
|
+
PropertyShareService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
9938
10290
|
PropertyShareService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, providedIn: 'root' });
|
|
9939
10291
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyShareService, decorators: [{
|
|
9940
10292
|
type: Injectable,
|
|
9941
10293
|
args: [{
|
|
9942
10294
|
providedIn: 'root'
|
|
9943
10295
|
}]
|
|
9944
|
-
}]
|
|
9945
|
-
type: Inject,
|
|
9946
|
-
args: ['environment']
|
|
9947
|
-
}] }]; } });
|
|
10296
|
+
}] });
|
|
9948
10297
|
|
|
9949
10298
|
class PropertySaleService extends RestService {
|
|
9950
10299
|
constructor() {
|
|
@@ -10050,9 +10399,6 @@ class SubscriptionService {
|
|
|
10050
10399
|
this.serviceSubscriptionsSubject = new ReplaySubject(1);
|
|
10051
10400
|
this.servicePaymentsSubject = new ReplaySubject(1);
|
|
10052
10401
|
this.subscriptionChangeSubject = new BehaviorSubject(null);
|
|
10053
|
-
this.listenEvents();
|
|
10054
|
-
}
|
|
10055
|
-
listenEvents() {
|
|
10056
10402
|
this.listenSubscriptions();
|
|
10057
10403
|
}
|
|
10058
10404
|
getSubscription(force = false) {
|
|
@@ -10183,14 +10529,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10183
10529
|
* Service to work with tax review
|
|
10184
10530
|
*/
|
|
10185
10531
|
class TaxReviewService extends RestService {
|
|
10186
|
-
constructor(
|
|
10187
|
-
super(
|
|
10188
|
-
this.http = http;
|
|
10189
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10190
|
-
this.environment = environment;
|
|
10532
|
+
constructor() {
|
|
10533
|
+
super(...arguments);
|
|
10191
10534
|
this.url = 'tax-reviews';
|
|
10192
10535
|
this.modelClass = TaxReview;
|
|
10193
|
-
this.listenEvents();
|
|
10194
10536
|
}
|
|
10195
10537
|
/**
|
|
10196
10538
|
* Listen events from SSE and Event Dispatcher services
|
|
@@ -10258,31 +10600,32 @@ class TaxReviewService extends RestService {
|
|
|
10258
10600
|
});
|
|
10259
10601
|
}
|
|
10260
10602
|
}
|
|
10261
|
-
TaxReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, deps:
|
|
10603
|
+
TaxReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10262
10604
|
TaxReviewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, providedIn: 'root' });
|
|
10263
10605
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewService, decorators: [{
|
|
10264
10606
|
type: Injectable,
|
|
10265
10607
|
args: [{
|
|
10266
10608
|
providedIn: 'root'
|
|
10267
10609
|
}]
|
|
10268
|
-
}]
|
|
10269
|
-
type: Inject,
|
|
10270
|
-
args: ['environment']
|
|
10271
|
-
}] }]; } });
|
|
10610
|
+
}] });
|
|
10272
10611
|
|
|
10273
10612
|
/**
|
|
10274
10613
|
* Service to work with tax review history
|
|
10275
10614
|
*/
|
|
10276
10615
|
class TaxReviewHistoryService extends RestService {
|
|
10277
|
-
constructor(
|
|
10278
|
-
super(
|
|
10279
|
-
this.http = http;
|
|
10280
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10281
|
-
this.environment = environment;
|
|
10616
|
+
constructor() {
|
|
10617
|
+
super(...arguments);
|
|
10282
10618
|
this.url = 'tax-reviews/history';
|
|
10283
10619
|
this.modelClass = TaxReview;
|
|
10284
|
-
|
|
10285
|
-
|
|
10620
|
+
}
|
|
10621
|
+
listenEvents() {
|
|
10622
|
+
this.listenTaxReviewUpdate();
|
|
10623
|
+
}
|
|
10624
|
+
/**
|
|
10625
|
+
* Update tax review history cache when single tax review updated.
|
|
10626
|
+
*/
|
|
10627
|
+
listenTaxReviewUpdate() {
|
|
10628
|
+
this.eventDispatcherService.on(AppEventTypeEnum.TAX_REVIEW_UPDATED).subscribe((taxReview) => {
|
|
10286
10629
|
const tempCache = _.cloneDeep(this.cache);
|
|
10287
10630
|
// insert element at the beginning of the array
|
|
10288
10631
|
tempCache.unshift(taxReview);
|
|
@@ -10291,17 +10634,14 @@ class TaxReviewHistoryService extends RestService {
|
|
|
10291
10634
|
});
|
|
10292
10635
|
}
|
|
10293
10636
|
}
|
|
10294
|
-
TaxReviewHistoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, deps:
|
|
10637
|
+
TaxReviewHistoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10295
10638
|
TaxReviewHistoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, providedIn: 'root' });
|
|
10296
10639
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TaxReviewHistoryService, decorators: [{
|
|
10297
10640
|
type: Injectable,
|
|
10298
10641
|
args: [{
|
|
10299
10642
|
providedIn: 'root'
|
|
10300
10643
|
}]
|
|
10301
|
-
}]
|
|
10302
|
-
type: Inject,
|
|
10303
|
-
args: ['environment']
|
|
10304
|
-
}] }]; } });
|
|
10644
|
+
}] });
|
|
10305
10645
|
|
|
10306
10646
|
/**
|
|
10307
10647
|
* Service to work with tax summary logic
|
|
@@ -10365,83 +10705,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10365
10705
|
args: ['environment']
|
|
10366
10706
|
}] }]; } });
|
|
10367
10707
|
|
|
10368
|
-
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|
|
10369
|
-
/**
|
|
10370
|
-
* Service for transaction allocations business logic
|
|
10371
|
-
* @TODO alex refactor
|
|
10372
|
-
*/
|
|
10373
|
-
class TransactionAllocationService extends RestService {
|
|
10374
|
-
constructor(http, eventDispatcherService, environment) {
|
|
10375
|
-
super(http, eventDispatcherService, environment);
|
|
10376
|
-
this.http = http;
|
|
10377
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10378
|
-
this.environment = environment;
|
|
10379
|
-
// API URL param for transaction allocations
|
|
10380
|
-
this.url = 'transactions-allocations';
|
|
10381
|
-
this.modelClass = TransactionAllocation;
|
|
10382
|
-
this.listenEvents();
|
|
10383
|
-
}
|
|
10384
|
-
/**
|
|
10385
|
-
* Add single transaction allocation
|
|
10386
|
-
*/
|
|
10387
|
-
add(allocation) {
|
|
10388
|
-
return this.addBatch([allocation]).pipe(map((newAllocations) => newAllocations[0]));
|
|
10389
|
-
}
|
|
10390
|
-
/**
|
|
10391
|
-
* get list of transactions allocations related with passed bank transactions list
|
|
10392
|
-
*/
|
|
10393
|
-
getByTransactions(transactions) {
|
|
10394
|
-
const ids = transactions.map((transaction) => transaction.id);
|
|
10395
|
-
return this.get()
|
|
10396
|
-
.pipe(map((transactionAllocations) => {
|
|
10397
|
-
return transactionAllocations.filter((allocation) => ids.includes(allocation.transaction.id));
|
|
10398
|
-
}));
|
|
10399
|
-
}
|
|
10400
|
-
listenEvents() {
|
|
10401
|
-
this.onTransactionsCreated();
|
|
10402
|
-
this.onDepreciationCreated();
|
|
10403
|
-
this.onTransactionDeleted();
|
|
10404
|
-
}
|
|
10405
|
-
/**
|
|
10406
|
-
* Reset cache on transactions created
|
|
10407
|
-
*/
|
|
10408
|
-
onTransactionsCreated() {
|
|
10409
|
-
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(() => {
|
|
10410
|
-
// Update allocations cache to synchronize data and fire subscriptions
|
|
10411
|
-
this.resetCache();
|
|
10412
|
-
});
|
|
10413
|
-
}
|
|
10414
|
-
/**
|
|
10415
|
-
* Reset cache on depreciation created
|
|
10416
|
-
*/
|
|
10417
|
-
onDepreciationCreated() {
|
|
10418
|
-
this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATIONS_CREATED).subscribe(() => {
|
|
10419
|
-
// Update allocations cache to synchronize data and fire subscriptions
|
|
10420
|
-
this.resetCache();
|
|
10421
|
-
});
|
|
10422
|
-
}
|
|
10423
|
-
/**
|
|
10424
|
-
* Reset cache on transaction deleted
|
|
10425
|
-
*/
|
|
10426
|
-
onTransactionDeleted() {
|
|
10427
|
-
this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTION_DELETED).subscribe(() => {
|
|
10428
|
-
// Update allocations cache to synchronize data and fire subscriptions
|
|
10429
|
-
this.resetCache();
|
|
10430
|
-
});
|
|
10431
|
-
}
|
|
10432
|
-
}
|
|
10433
|
-
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 });
|
|
10434
|
-
TransactionAllocationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, providedIn: 'root' });
|
|
10435
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionAllocationService, decorators: [{
|
|
10436
|
-
type: Injectable,
|
|
10437
|
-
args: [{
|
|
10438
|
-
providedIn: 'root'
|
|
10439
|
-
}]
|
|
10440
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10441
|
-
type: Inject,
|
|
10442
|
-
args: ['environment']
|
|
10443
|
-
}] }]; } });
|
|
10444
|
-
|
|
10445
10708
|
/**
|
|
10446
10709
|
* @TODO move to collection
|
|
10447
10710
|
*/
|
|
@@ -10638,11 +10901,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10638
10901
|
}] }]; } });
|
|
10639
10902
|
|
|
10640
10903
|
class UserEventSettingService extends RestService {
|
|
10641
|
-
constructor(
|
|
10642
|
-
super(
|
|
10643
|
-
this.http = http;
|
|
10644
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10645
|
-
this.environment = environment;
|
|
10904
|
+
constructor() {
|
|
10905
|
+
super(...arguments);
|
|
10646
10906
|
this.modelClass = UserEventSetting;
|
|
10647
10907
|
this.url = 'user-event-settings';
|
|
10648
10908
|
this.isHydra = true;
|
|
@@ -10674,257 +10934,144 @@ class UserEventSettingService extends RestService {
|
|
|
10674
10934
|
}));
|
|
10675
10935
|
}
|
|
10676
10936
|
}
|
|
10677
|
-
UserEventSettingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, deps:
|
|
10937
|
+
UserEventSettingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10678
10938
|
UserEventSettingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, providedIn: 'root' });
|
|
10679
10939
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventSettingService, decorators: [{
|
|
10680
10940
|
type: Injectable,
|
|
10681
10941
|
args: [{
|
|
10682
10942
|
providedIn: 'root'
|
|
10683
10943
|
}]
|
|
10684
|
-
}]
|
|
10685
|
-
type: Inject,
|
|
10686
|
-
args: ['environment']
|
|
10687
|
-
}] }]; } });
|
|
10944
|
+
}] });
|
|
10688
10945
|
|
|
10689
10946
|
class UserEventTypeService extends RestService {
|
|
10690
|
-
constructor(
|
|
10691
|
-
super(
|
|
10692
|
-
this.http = http;
|
|
10693
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
10694
|
-
this.environment = environment;
|
|
10947
|
+
constructor() {
|
|
10948
|
+
super(...arguments);
|
|
10695
10949
|
this.modelClass = UserEventType;
|
|
10696
10950
|
this.url = 'user-event-types';
|
|
10697
10951
|
this.isHydra = true;
|
|
10698
10952
|
}
|
|
10699
10953
|
}
|
|
10700
|
-
UserEventTypeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, deps:
|
|
10954
|
+
UserEventTypeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
10701
10955
|
UserEventTypeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, providedIn: 'root' });
|
|
10702
10956
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: UserEventTypeService, decorators: [{
|
|
10703
10957
|
type: Injectable,
|
|
10704
10958
|
args: [{
|
|
10705
10959
|
providedIn: 'root'
|
|
10706
10960
|
}]
|
|
10707
|
-
}]
|
|
10708
|
-
type: Inject,
|
|
10709
|
-
args: ['environment']
|
|
10710
|
-
}] }]; } });
|
|
10961
|
+
}] });
|
|
10711
10962
|
|
|
10712
10963
|
/**
|
|
10713
10964
|
* Service that allows to work with WorkTank operations
|
|
10714
|
-
* @TODO separate
|
|
10965
|
+
* @TODO separate vehicles and logbooks to different api
|
|
10715
10966
|
*/
|
|
10716
|
-
class VehicleService {
|
|
10717
|
-
constructor(
|
|
10718
|
-
|
|
10719
|
-
this.
|
|
10720
|
-
this.
|
|
10721
|
-
this.
|
|
10722
|
-
this.
|
|
10723
|
-
this.
|
|
10724
|
-
this.vehiclesSubject = new ReplaySubject(1);
|
|
10725
|
-
this.vehicleClaimSubject = new ReplaySubject(1);
|
|
10726
|
-
this.vehicleClaimRateSubject = new ReplaySubject(1);
|
|
10727
|
-
this.vehicleTaxReturnSubject = new ReplaySubject(1);
|
|
10728
|
-
this.incomePositionsSubject = new ReplaySubject(1);
|
|
10729
|
-
}
|
|
10730
|
-
getVehicles() {
|
|
10731
|
-
// @TODO create backend for get logbook
|
|
10732
|
-
if (!this._vehicles) {
|
|
10733
|
-
this.http.get(`${this.environment.apiV2}/vehicles`)
|
|
10734
|
-
.pipe(map((response) => {
|
|
10735
|
-
return response.map((item) => plainToClass(Vehicle, item));
|
|
10736
|
-
}))
|
|
10737
|
-
.subscribe((vehicles) => {
|
|
10738
|
-
this._vehicles = vehicles;
|
|
10739
|
-
this.vehiclesSubject.next(vehicles);
|
|
10740
|
-
});
|
|
10741
|
-
}
|
|
10742
|
-
return this.vehiclesSubject.asObservable();
|
|
10743
|
-
}
|
|
10744
|
-
/**
|
|
10745
|
-
* Get vehicles claim amount
|
|
10746
|
-
*/
|
|
10747
|
-
getVehiclesClaim() {
|
|
10748
|
-
if (!this._vehicleClaim) {
|
|
10749
|
-
this.http.get(`${this.environment.apiV2}/vehicle-claims`)
|
|
10750
|
-
.pipe(map((response) => {
|
|
10751
|
-
// return Vehicle claim from backend or create new if it not exist
|
|
10752
|
-
return response.length ? response.map((item) => plainToClass(VehicleClaim, item))[0] : plainToClass(VehicleClaim, {});
|
|
10753
|
-
}))
|
|
10754
|
-
.subscribe((vehicleClaim) => {
|
|
10755
|
-
this._vehicleClaim = vehicleClaim;
|
|
10756
|
-
this.vehicleClaimSubject.next(vehicleClaim);
|
|
10757
|
-
});
|
|
10758
|
-
}
|
|
10759
|
-
return this.vehicleClaimSubject.asObservable();
|
|
10760
|
-
}
|
|
10761
|
-
/**
|
|
10762
|
-
* Add new vehicle claim
|
|
10763
|
-
* @param claim object which should be added
|
|
10764
|
-
*/
|
|
10765
|
-
addVehicleClaim(claim) {
|
|
10766
|
-
return this.http.post(`${this.environment.apiV2}/vehicle-claims`, claim).pipe(map((response) => {
|
|
10767
|
-
this._vehicleClaim = plainToClass(VehicleClaim, response);
|
|
10768
|
-
this.vehicleClaimSubject.next(this._vehicleClaim);
|
|
10769
|
-
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_CLAIM_CREATED, null));
|
|
10770
|
-
}));
|
|
10967
|
+
class VehicleService extends RestService {
|
|
10968
|
+
constructor() {
|
|
10969
|
+
super(...arguments);
|
|
10970
|
+
this.url = 'vehicles';
|
|
10971
|
+
this.modelClass = Vehicle;
|
|
10972
|
+
this.messageCreated = MessagesEnum$1.VEHICLE_CREATED;
|
|
10973
|
+
this.messageUpdated = MessagesEnum$1.VEHICLE_UPDATED;
|
|
10974
|
+
this.messageDeleted = MessagesEnum$1.VEHICLE_DELETED;
|
|
10771
10975
|
}
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
if (!this._vehicleClaimRate) {
|
|
10777
|
-
this.chartAccountsService.getChartAccountsById(ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK)
|
|
10778
|
-
.pipe(map((response) => {
|
|
10779
|
-
return response.values.find((chartAccount) => chartAccount.financialYear === new FinancialYear().year).value;
|
|
10780
|
-
}))
|
|
10781
|
-
.subscribe((claimRate) => {
|
|
10782
|
-
this._vehicleClaimRate = claimRate;
|
|
10783
|
-
this.vehicleClaimRateSubject.next(this._vehicleClaimRate);
|
|
10784
|
-
});
|
|
10785
|
-
}
|
|
10786
|
-
return this.vehicleClaimRateSubject.asObservable();
|
|
10787
|
-
}
|
|
10788
|
-
/**
|
|
10789
|
-
* Get vehicles tax return for vehicle transactions & depreciations
|
|
10790
|
-
*/
|
|
10791
|
-
getVehiclesTaxReturn() {
|
|
10792
|
-
if (!this._vehicleTaxReturn) {
|
|
10793
|
-
combineLatest([
|
|
10794
|
-
// @Todo refactor to avoid injection of another services
|
|
10795
|
-
this.transactionService.get(),
|
|
10796
|
-
this.depreciationService.get(),
|
|
10797
|
-
this.getVehiclesClaim()
|
|
10798
|
-
]).pipe(map(([transactions, depreciations, vehicleClaim]) => {
|
|
10799
|
-
const chartAccountsHeadingsIds = enumToList(ChartAccountsHeadingVehicleListEnum)
|
|
10800
|
-
.map((item) => item.value);
|
|
10801
|
-
// get transactions & depreciations which chart accounts headings are belong to vehicle category
|
|
10802
|
-
// but except KLMS transaction
|
|
10803
|
-
const filteredItems = [...transactions, ...depreciations].filter((item) => {
|
|
10804
|
-
var _a;
|
|
10805
|
-
return chartAccountsHeadingsIds.includes((_a = item.chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id) && !item.chartAccounts.isKlmsForWork();
|
|
10806
|
-
});
|
|
10807
|
-
// get claim amount sum
|
|
10808
|
-
return filteredItems.reduce((sum, item) =>
|
|
10809
|
-
// @Todo remove item.amount negative sign when depreciations will be refactored and will have negative sign
|
|
10810
|
-
sum + ((item instanceof Depreciation ? item.currentYearForecast.amount : -item.amount) * (vehicleClaim.workUsage / 100)), 0);
|
|
10811
|
-
}))
|
|
10812
|
-
.subscribe((taxReturn) => {
|
|
10813
|
-
this._vehicleTaxReturn = taxReturn;
|
|
10814
|
-
this.vehicleTaxReturnSubject.next(this._vehicleTaxReturn);
|
|
10815
|
-
});
|
|
10816
|
-
}
|
|
10817
|
-
return this.vehicleTaxReturnSubject.asObservable();
|
|
10976
|
+
listenEvents() {
|
|
10977
|
+
this.listenLogbookAdded();
|
|
10978
|
+
this.listenLogbookUpdated();
|
|
10979
|
+
this.listenLogbookDeleted();
|
|
10818
10980
|
}
|
|
10819
10981
|
/**
|
|
10820
|
-
*
|
|
10821
|
-
* @param claim which should be updated
|
|
10822
|
-
*
|
|
10823
|
-
* @TODO alex refresh depreciation/transaction cache
|
|
10982
|
+
* Add a new logbook items to the vehicle when a new one created
|
|
10824
10983
|
*/
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
this.
|
|
10831
|
-
|
|
10832
|
-
})
|
|
10984
|
+
listenLogbookAdded() {
|
|
10985
|
+
this.eventDispatcherService.on(AppEventTypeEnum.VEHICLE_LOGBOOK_CREATED)
|
|
10986
|
+
.subscribe((result) => {
|
|
10987
|
+
const tempCache = cloneDeep$1(this.cache);
|
|
10988
|
+
tempCache.find((vehicle) => vehicle.id === result.vehicleId).logbook.push(result.logbook);
|
|
10989
|
+
this.cache = tempCache;
|
|
10990
|
+
this.updateCache();
|
|
10991
|
+
});
|
|
10833
10992
|
}
|
|
10834
10993
|
/**
|
|
10835
|
-
*
|
|
10836
|
-
* @param logbook which should be added
|
|
10837
|
-
* @param vehicle for which logbook object should be added
|
|
10994
|
+
* Replace vehicle's logbook with updated instance when logbook item updated
|
|
10838
10995
|
*/
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
.
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
this.
|
|
10846
|
-
})
|
|
10996
|
+
listenLogbookUpdated() {
|
|
10997
|
+
this.eventDispatcherService.on(AppEventTypeEnum.VEHICLE_LOGBOOK_UPDATED)
|
|
10998
|
+
.subscribe((result) => {
|
|
10999
|
+
const tempCache = cloneDeep$1(this.cache);
|
|
11000
|
+
replace(tempCache.find((vehicle) => vehicle.id === result.vehicleId).logbook, result.logbook);
|
|
11001
|
+
this.cache = tempCache;
|
|
11002
|
+
this.updateCache();
|
|
11003
|
+
});
|
|
10847
11004
|
}
|
|
10848
11005
|
/**
|
|
10849
|
-
*
|
|
10850
|
-
* @param logbook which should be updated
|
|
10851
|
-
* @param vehicle for which logbook object should be updated
|
|
11006
|
+
* Remove logbook item from vehicle when logbook deleted
|
|
10852
11007
|
*/
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
const
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
this.
|
|
10861
|
-
})
|
|
11008
|
+
listenLogbookDeleted() {
|
|
11009
|
+
this.eventDispatcherService.on(AppEventTypeEnum.VEHICLE_LOGBOOK_DELETED)
|
|
11010
|
+
.subscribe((result) => {
|
|
11011
|
+
const tempCache = cloneDeep$1(this.cache);
|
|
11012
|
+
const vehicle = tempCache.find((vehicle) => vehicle.id === result.vehicleId);
|
|
11013
|
+
vehicle.logbook = vehicle.logbook.filter((logbook) => logbook.id !== result.logbook.id);
|
|
11014
|
+
this.cache = tempCache;
|
|
11015
|
+
this.updateCache();
|
|
11016
|
+
});
|
|
10862
11017
|
}
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
11018
|
+
}
|
|
11019
|
+
VehicleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
11020
|
+
VehicleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleService, providedIn: 'root' });
|
|
11021
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleService, decorators: [{
|
|
11022
|
+
type: Injectable,
|
|
11023
|
+
args: [{
|
|
11024
|
+
providedIn: 'root'
|
|
11025
|
+
}]
|
|
11026
|
+
}] });
|
|
11027
|
+
|
|
11028
|
+
/**
|
|
11029
|
+
* Vehicle logbook service. Allows user to add, update or delete vehicle trips
|
|
11030
|
+
* @TODO extend rest service after it refactored
|
|
11031
|
+
*/
|
|
11032
|
+
class VehicleLogbookService {
|
|
11033
|
+
constructor(http, eventDispatcherService, environment, toastService) {
|
|
11034
|
+
this.http = http;
|
|
11035
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
11036
|
+
this.environment = environment;
|
|
11037
|
+
this.toastService = toastService;
|
|
10878
11038
|
}
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
this._vehicles.push(plainToClass(Vehicle, response));
|
|
10887
|
-
this.vehiclesSubject.next(this._vehicles);
|
|
11039
|
+
add(logbook, vehicleId) {
|
|
11040
|
+
return this.http.post(`${this.environment.apiV2}/vehicles/${vehicleId}/logbooks`, logbook)
|
|
11041
|
+
.pipe(map((vehicleLogbookBase) => {
|
|
11042
|
+
const newVehicleLogbook = plainToClass(VehicleLogbook, vehicleLogbookBase);
|
|
11043
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_LOGBOOK_CREATED, { logbook: newVehicleLogbook, vehicleId }));
|
|
11044
|
+
this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_CREATED);
|
|
11045
|
+
return newVehicleLogbook;
|
|
10888
11046
|
}));
|
|
10889
11047
|
}
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
.pipe(map((response) => {
|
|
10897
|
-
const editedVehicleIndex = this._vehicles.findIndex((v) => v.id === vehicle.id);
|
|
10898
|
-
this._vehicles.splice(editedVehicleIndex, 1, plainToClass(Vehicle, response));
|
|
10899
|
-
this.vehiclesSubject.next(this._vehicles);
|
|
11048
|
+
update(logbook, vehicleId) {
|
|
11049
|
+
return this.http.put(`${this.environment.apiV2}/vehicles/${vehicleId}/logbooks/${logbook.id}`, logbook).pipe(map((vehicleLogbookBase) => {
|
|
11050
|
+
const updatedVehicleLogbook = plainToClass(VehicleLogbook, vehicleLogbookBase);
|
|
11051
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_LOGBOOK_UPDATED, { logbook: updatedVehicleLogbook, vehicleId }));
|
|
11052
|
+
this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_UPDATED);
|
|
11053
|
+
return plainToClass(VehicleLogbook, updatedVehicleLogbook);
|
|
10900
11054
|
}));
|
|
10901
11055
|
}
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
* @param vehicle which should be deleted
|
|
10905
|
-
*/
|
|
10906
|
-
deleteVehicle(vehicle) {
|
|
10907
|
-
return this.http.delete(`${this.environment.apiV2}/vehicles/${vehicle.id}`)
|
|
11056
|
+
delete(logbook, vehicleId) {
|
|
11057
|
+
return this.http.delete(`${this.environment.apiV2}/vehicles/${vehicleId}/logbooks/${logbook.id}`)
|
|
10908
11058
|
.pipe(map(() => {
|
|
10909
|
-
|
|
10910
|
-
this.
|
|
10911
|
-
// we update nested logbook object inside vehicles list. So list is not changed and next not emit subscriptions updates.
|
|
10912
|
-
// that is why we recreate vehicles array
|
|
10913
|
-
this.vehiclesSubject.next(this._vehicles.map((item) => plainToClass(Vehicle, item)));
|
|
11059
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_LOGBOOK_DELETED, { logbook, vehicleId }));
|
|
11060
|
+
this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_DELETED);
|
|
10914
11061
|
}));
|
|
10915
11062
|
}
|
|
10916
11063
|
}
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type:
|
|
11064
|
+
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 });
|
|
11065
|
+
VehicleLogbookService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleLogbookService, providedIn: 'root' });
|
|
11066
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VehicleLogbookService, decorators: [{
|
|
10920
11067
|
type: Injectable,
|
|
10921
11068
|
args: [{
|
|
10922
11069
|
providedIn: 'root'
|
|
10923
11070
|
}]
|
|
10924
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type:
|
|
11071
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10925
11072
|
type: Inject,
|
|
10926
11073
|
args: ['environment']
|
|
10927
|
-
}] }]; } });
|
|
11074
|
+
}] }, { type: ToastService }]; } });
|
|
10928
11075
|
|
|
10929
11076
|
/**
|
|
10930
11077
|
* Service to work with XLSX (generate, download, e.t.c.)
|
|
@@ -11066,6 +11213,36 @@ class AbstractForm extends FormGroup {
|
|
|
11066
11213
|
}
|
|
11067
11214
|
}
|
|
11068
11215
|
|
|
11216
|
+
/**
|
|
11217
|
+
* Check if at least one form field is true, otherwise form is invalid.
|
|
11218
|
+
* Use with groups of boolean form controls (checkbox, toggle, etc.)
|
|
11219
|
+
*/
|
|
11220
|
+
function atLeastOneCheckedValidator() {
|
|
11221
|
+
return (formGroup) => {
|
|
11222
|
+
return Object.values(formGroup.controls)
|
|
11223
|
+
.find((control) => control.value) ? null : { nothingChecked: true };
|
|
11224
|
+
};
|
|
11225
|
+
}
|
|
11226
|
+
|
|
11227
|
+
class ClientIncomeTypesForm extends AbstractForm {
|
|
11228
|
+
constructor(clientIncomeTypes) {
|
|
11229
|
+
super({
|
|
11230
|
+
salary: new FormControl(clientIncomeTypes.salary),
|
|
11231
|
+
rental: new FormControl(clientIncomeTypes.rental),
|
|
11232
|
+
soleTrader: new FormControl(clientIncomeTypes.soleTrader),
|
|
11233
|
+
dividends: new FormControl(clientIncomeTypes.dividends),
|
|
11234
|
+
other: new FormControl(clientIncomeTypes.other)
|
|
11235
|
+
}, atLeastOneCheckedValidator());
|
|
11236
|
+
this.clientIncomeTypes = clientIncomeTypes;
|
|
11237
|
+
}
|
|
11238
|
+
submit() {
|
|
11239
|
+
if (!this.valid) {
|
|
11240
|
+
return null;
|
|
11241
|
+
}
|
|
11242
|
+
return Object.assign({}, this.clientIncomeTypes, this.value);
|
|
11243
|
+
}
|
|
11244
|
+
}
|
|
11245
|
+
|
|
11069
11246
|
class LoginForm extends AbstractForm {
|
|
11070
11247
|
constructor() {
|
|
11071
11248
|
super({
|
|
@@ -11138,6 +11315,131 @@ class ResetPasswordForm extends AbstractForm {
|
|
|
11138
11315
|
}
|
|
11139
11316
|
}
|
|
11140
11317
|
|
|
11318
|
+
const MAX_NAME_LENGTH = 60;
|
|
11319
|
+
class VehicleForm extends AbstractForm {
|
|
11320
|
+
constructor(vehicle) {
|
|
11321
|
+
super({
|
|
11322
|
+
name: new FormControl(vehicle.name, [Validators.required, Validators.maxLength(MAX_NAME_LENGTH)])
|
|
11323
|
+
});
|
|
11324
|
+
this.vehicle = vehicle;
|
|
11325
|
+
}
|
|
11326
|
+
/**
|
|
11327
|
+
* @TODO save model, add generics and handle it in AbstractForm
|
|
11328
|
+
*/
|
|
11329
|
+
submit() {
|
|
11330
|
+
return plainToClass(VehicleClaim, Object.assign({}, this.vehicle, this.getRawValue()));
|
|
11331
|
+
}
|
|
11332
|
+
}
|
|
11333
|
+
|
|
11334
|
+
class VehicleClaimForm extends AbstractForm {
|
|
11335
|
+
constructor(vehicleClaim, logbooks) {
|
|
11336
|
+
super({
|
|
11337
|
+
method: new FormControl(vehicleClaim.method, Validators.required),
|
|
11338
|
+
isManual: new FormControl(vehicleClaim.isManual),
|
|
11339
|
+
kilometers: new FormControl({
|
|
11340
|
+
value: vehicleClaim.kilometers,
|
|
11341
|
+
disabled: !vehicleClaim.isManual
|
|
11342
|
+
}),
|
|
11343
|
+
workUsage: new FormControl({
|
|
11344
|
+
value: vehicleClaim.workUsage,
|
|
11345
|
+
disabled: !vehicleClaim.isManual
|
|
11346
|
+
})
|
|
11347
|
+
});
|
|
11348
|
+
this.vehicleClaim = vehicleClaim;
|
|
11349
|
+
this.logbooks = logbooks;
|
|
11350
|
+
this.setIsManualState();
|
|
11351
|
+
this.listenMethodChanges();
|
|
11352
|
+
this.listenIsManualChanges();
|
|
11353
|
+
}
|
|
11354
|
+
/**
|
|
11355
|
+
* Check if vehicle claim method changed
|
|
11356
|
+
*/
|
|
11357
|
+
isMethodChanged() {
|
|
11358
|
+
return this.vehicleClaim.method !== this.get('method').value;
|
|
11359
|
+
}
|
|
11360
|
+
/**
|
|
11361
|
+
* Check if KLMs method selected
|
|
11362
|
+
*/
|
|
11363
|
+
isKLMsMethod() {
|
|
11364
|
+
return this.get('method').value === VehicleClaimMethodEnum.KMS;
|
|
11365
|
+
}
|
|
11366
|
+
/**
|
|
11367
|
+
* Check if Logbook method selected
|
|
11368
|
+
*/
|
|
11369
|
+
isLogbookMethod() {
|
|
11370
|
+
return this.get('method').value === VehicleClaimMethodEnum.LOGBOOK;
|
|
11371
|
+
}
|
|
11372
|
+
/**
|
|
11373
|
+
* Check if user selected manual calculation
|
|
11374
|
+
*/
|
|
11375
|
+
isManual() {
|
|
11376
|
+
return this.get('isManual').value;
|
|
11377
|
+
}
|
|
11378
|
+
/**
|
|
11379
|
+
* @TODO save model, add generics and handle it in AbstractForm
|
|
11380
|
+
*/
|
|
11381
|
+
submit() {
|
|
11382
|
+
return plainToClass(VehicleClaim, Object.assign({}, this.vehicleClaim, this.getRawValue()));
|
|
11383
|
+
}
|
|
11384
|
+
setIsManualState() {
|
|
11385
|
+
if (this.logbooks.isBestPeriodExist()) {
|
|
11386
|
+
this.get('isManual').enable();
|
|
11387
|
+
}
|
|
11388
|
+
else {
|
|
11389
|
+
this.get('isManual').disable();
|
|
11390
|
+
this.get('isManual').setValue(true);
|
|
11391
|
+
}
|
|
11392
|
+
}
|
|
11393
|
+
/**
|
|
11394
|
+
* Handle method field value changes.
|
|
11395
|
+
* Set work usage value depended of selected method.
|
|
11396
|
+
*/
|
|
11397
|
+
listenMethodChanges() {
|
|
11398
|
+
this.get('method').valueChanges.subscribe((method) => {
|
|
11399
|
+
if (method === VehicleClaimMethodEnum.KMS) {
|
|
11400
|
+
this.get('workUsage').setValue(0);
|
|
11401
|
+
}
|
|
11402
|
+
else if (method === VehicleClaimMethodEnum.LOGBOOK && !this.isManual()) {
|
|
11403
|
+
this.get('workUsage').setValue(this.logbooks.getBestPeriod().workUsage);
|
|
11404
|
+
}
|
|
11405
|
+
this.setValues();
|
|
11406
|
+
});
|
|
11407
|
+
}
|
|
11408
|
+
/**
|
|
11409
|
+
* Handle isManual field value changes.
|
|
11410
|
+
* Enable/disable fields depended of isManual value
|
|
11411
|
+
*/
|
|
11412
|
+
listenIsManualChanges() {
|
|
11413
|
+
this.get('isManual').valueChanges.subscribe((isManual) => {
|
|
11414
|
+
if (isManual) {
|
|
11415
|
+
this.get('kilometers').enable();
|
|
11416
|
+
this.get('workUsage').enable();
|
|
11417
|
+
}
|
|
11418
|
+
else {
|
|
11419
|
+
this.get('kilometers').disable();
|
|
11420
|
+
this.get('workUsage').disable();
|
|
11421
|
+
}
|
|
11422
|
+
this.setValues();
|
|
11423
|
+
});
|
|
11424
|
+
}
|
|
11425
|
+
/**
|
|
11426
|
+
* Set automatic calculated values depended of current method for non-manual vehicle claim
|
|
11427
|
+
*/
|
|
11428
|
+
setValues() {
|
|
11429
|
+
if (this.isManual()) {
|
|
11430
|
+
return;
|
|
11431
|
+
}
|
|
11432
|
+
switch (this.get('method').value) {
|
|
11433
|
+
case VehicleClaimMethodEnum.LOGBOOK:
|
|
11434
|
+
this.get('workUsage').setValue(this.logbooks.getBestPeriod().workUsage);
|
|
11435
|
+
break;
|
|
11436
|
+
case VehicleClaimMethodEnum.KMS:
|
|
11437
|
+
const businessKms = this.logbooks.getBusinessLogbooks().getKlms();
|
|
11438
|
+
this.get('kilometers').setValue(businessKms < this.vehicleClaim.kmsLimit ? businessKms : this.vehicleClaim.kmsLimit);
|
|
11439
|
+
}
|
|
11440
|
+
}
|
|
11441
|
+
}
|
|
11442
|
+
|
|
11141
11443
|
/**
|
|
11142
11444
|
* Public API Surface of tt-core
|
|
11143
11445
|
*/
|
|
@@ -11146,5 +11448,5 @@ class ResetPasswordForm extends AbstractForm {
|
|
|
11146
11448
|
* Generated bundle index. Do not edit.
|
|
11147
11449
|
*/
|
|
11148
11450
|
|
|
11149
|
-
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, 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,
|
|
11451
|
+
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, PdfSettings, 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 };
|
|
11150
11452
|
//# sourceMappingURL=taxtank-core.js.map
|