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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/
|
|
3
|
-
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.
|
|
5
|
-
})(this, (function (exports, i0, i2, i1, rxjs, operators, classTransformer, angularJwt,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('lodash/compact'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('@angular/forms'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', 'lodash/compact', 'moment', 'moment-range', 'lodash/cloneDeep', '@angular/forms', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.flatten, global.hasIn, global.first, global.last, global.uniqBy, global.concat, global.compact, global.moment, global.momentRange, global.cloneDeep$1, global.ng.forms, global._, global.eventsource_min_js, global.ng.router, global.clone, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
+
})(this, (function (exports, i0, i2, i1, rxjs, operators, classTransformer, angularJwt, get, flatten, hasIn, first, last, uniqBy, concat, compact, moment, momentRange, cloneDeep$1, forms, _, eventsource_min_js, i1$1, clone, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
28
|
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
29
29
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
30
|
-
var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
|
|
31
30
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
32
31
|
var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
|
|
32
|
+
var hasIn__default = /*#__PURE__*/_interopDefaultLegacy(hasIn);
|
|
33
33
|
var first__default = /*#__PURE__*/_interopDefaultLegacy(first);
|
|
34
34
|
var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
|
|
35
35
|
var uniqBy__default = /*#__PURE__*/_interopDefaultLegacy(uniqBy);
|
|
@@ -1141,8 +1141,8 @@
|
|
|
1141
1141
|
if (!collection.length) {
|
|
1142
1142
|
return;
|
|
1143
1143
|
}
|
|
1144
|
-
//
|
|
1145
|
-
if (!
|
|
1144
|
+
// Do nothing if provided path was not found in the 1st collection's item
|
|
1145
|
+
if (!hasIn__default["default"](collection.items[0], path.split('.')[0])) {
|
|
1146
1146
|
return;
|
|
1147
1147
|
}
|
|
1148
1148
|
this.groupItems(collection, path);
|
|
@@ -1359,9 +1359,26 @@
|
|
|
1359
1359
|
enumerable: false,
|
|
1360
1360
|
configurable: true
|
|
1361
1361
|
});
|
|
1362
|
+
Collection.prototype.getByDateRange = function (from, to, dateField) {
|
|
1363
|
+
if (dateField === void 0) { dateField = 'date'; }
|
|
1364
|
+
return this.create(this.items.filter(function (item) { return item[dateField] >= from && item[dateField] <= to; }));
|
|
1365
|
+
};
|
|
1362
1366
|
return Collection;
|
|
1363
1367
|
}());
|
|
1364
1368
|
|
|
1369
|
+
var AccountSetupItemCollection = /** @class */ (function (_super) {
|
|
1370
|
+
__extends(AccountSetupItemCollection, _super);
|
|
1371
|
+
function AccountSetupItemCollection(items) {
|
|
1372
|
+
var _this = _super.call(this, items) || this;
|
|
1373
|
+
_this.sortBy('isCompleted', false);
|
|
1374
|
+
return _this;
|
|
1375
|
+
}
|
|
1376
|
+
AccountSetupItemCollection.prototype.isCompleted = function () {
|
|
1377
|
+
return this.getBy('isCompleted', true).length === this.length;
|
|
1378
|
+
};
|
|
1379
|
+
return AccountSetupItemCollection;
|
|
1380
|
+
}(Collection));
|
|
1381
|
+
|
|
1365
1382
|
exports.BankAccountTypeEnum = void 0;
|
|
1366
1383
|
(function (BankAccountTypeEnum) {
|
|
1367
1384
|
BankAccountTypeEnum[BankAccountTypeEnum["TRANSACTION"] = 1] = "TRANSACTION";
|
|
@@ -1625,7 +1642,7 @@
|
|
|
1625
1642
|
BankTransactionCollection.prototype.groupByTransaction = function (allocations) {
|
|
1626
1643
|
var _this = this;
|
|
1627
1644
|
// Group allocations by transaction id
|
|
1628
|
-
var allocationsByTransactions = new CollectionDictionary(allocations, 'transaction');
|
|
1645
|
+
var allocationsByTransactions = new CollectionDictionary(allocations, 'transaction.id');
|
|
1629
1646
|
// Init an empty dictionary we will fill below
|
|
1630
1647
|
var bankTransactionsByTransactions = new CollectionDictionary(new BankTransactionCollection([]));
|
|
1631
1648
|
// Fill dictionary with the same keys as at allocationsByTransactions
|
|
@@ -1969,6 +1986,32 @@
|
|
|
1969
1986
|
TransactionCollection.prototype.getByAllocations = function (allocations) {
|
|
1970
1987
|
return new TransactionCollection(this.items.filter(function (transaction) { return allocations.hasTransaction(transaction); }));
|
|
1971
1988
|
};
|
|
1989
|
+
/**
|
|
1990
|
+
* Get transactions related to Vehicle category
|
|
1991
|
+
*/
|
|
1992
|
+
TransactionCollection.prototype.getVehicleTransactions = function () {
|
|
1993
|
+
return this.create(this.items.filter(function (transaction) {
|
|
1994
|
+
return transaction.isVehicleTransaction();
|
|
1995
|
+
}));
|
|
1996
|
+
};
|
|
1997
|
+
/**
|
|
1998
|
+
* Get new transaction collection filtered by tank type
|
|
1999
|
+
*/
|
|
2000
|
+
TransactionCollection.prototype.getByTankType = function (tankType) {
|
|
2001
|
+
return this.create(this.items.filter(function (transaction) {
|
|
2002
|
+
switch (tankType) {
|
|
2003
|
+
case exports.TankTypeEnum.PROPERTY:
|
|
2004
|
+
return transaction.isPropertyTank();
|
|
2005
|
+
case exports.TankTypeEnum.WORK:
|
|
2006
|
+
return transaction.isWorkTank();
|
|
2007
|
+
case exports.TankTypeEnum.SOLE:
|
|
2008
|
+
return transaction.isSoleTank();
|
|
2009
|
+
// Transaction may be not related to any tank type (personal)
|
|
2010
|
+
default:
|
|
2011
|
+
return false;
|
|
2012
|
+
}
|
|
2013
|
+
}));
|
|
2014
|
+
};
|
|
1972
2015
|
return TransactionCollection;
|
|
1973
2016
|
}(Collection));
|
|
1974
2017
|
|
|
@@ -2020,15 +2063,6 @@
|
|
|
2020
2063
|
enumerable: false,
|
|
2021
2064
|
configurable: true
|
|
2022
2065
|
});
|
|
2023
|
-
/**
|
|
2024
|
-
* Get new depreciations collections filtered by tank type
|
|
2025
|
-
*/
|
|
2026
|
-
DepreciationCollection.prototype.getByTankType = function (tankType) {
|
|
2027
|
-
if (tankType === exports.TankTypeEnum.PROPERTY) {
|
|
2028
|
-
return new DepreciationCollection(this.items.filter(function (depreciation) { return depreciation.isPropertyTank(); }));
|
|
2029
|
-
}
|
|
2030
|
-
return new DepreciationCollection(this.items.filter(function (depreciation) { return depreciation.isWorkTank(); }));
|
|
2031
|
-
};
|
|
2032
2066
|
DepreciationCollection.prototype.getByPropertiesIds = function (ids) {
|
|
2033
2067
|
return new DepreciationCollection(this.items.filter(function (depreciation) { var _a; return ids.includes((_a = depreciation.property) === null || _a === void 0 ? void 0 : _a.id); }));
|
|
2034
2068
|
};
|
|
@@ -2064,6 +2098,29 @@
|
|
|
2064
2098
|
return depreciation.depreciationCapitalProject;
|
|
2065
2099
|
})), 'id');
|
|
2066
2100
|
};
|
|
2101
|
+
/**
|
|
2102
|
+
* Get a new collection of depreciations related to vehicles
|
|
2103
|
+
*/
|
|
2104
|
+
DepreciationCollection.prototype.getVehicleDepreciations = function () {
|
|
2105
|
+
return this.create(this.items.filter(function (depreciation) {
|
|
2106
|
+
return depreciation.isVehicleDepreciation();
|
|
2107
|
+
}));
|
|
2108
|
+
};
|
|
2109
|
+
DepreciationCollection.prototype.getByTankType = function (tankType) {
|
|
2110
|
+
return this.create(this.items.filter(function (depreciation) {
|
|
2111
|
+
switch (tankType) {
|
|
2112
|
+
case exports.TankTypeEnum.PROPERTY:
|
|
2113
|
+
return depreciation.isPropertyTank();
|
|
2114
|
+
case exports.TankTypeEnum.WORK:
|
|
2115
|
+
return depreciation.isWorkTank();
|
|
2116
|
+
case exports.TankTypeEnum.SOLE:
|
|
2117
|
+
return depreciation.isSoleTank();
|
|
2118
|
+
// case for other tank or some extra
|
|
2119
|
+
default:
|
|
2120
|
+
return false;
|
|
2121
|
+
}
|
|
2122
|
+
}));
|
|
2123
|
+
};
|
|
2067
2124
|
/**
|
|
2068
2125
|
* Create TransactionCollection from depreciation items
|
|
2069
2126
|
*/
|
|
@@ -2171,6 +2228,48 @@
|
|
|
2171
2228
|
return LoanCollection;
|
|
2172
2229
|
}(Collection));
|
|
2173
2230
|
|
|
2231
|
+
var MessageCollection = /** @class */ (function (_super) {
|
|
2232
|
+
__extends(MessageCollection, _super);
|
|
2233
|
+
function MessageCollection() {
|
|
2234
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2235
|
+
}
|
|
2236
|
+
MessageCollection.prototype.getFirstUnreadMessage = function (user) {
|
|
2237
|
+
return this.items.find(function (message) {
|
|
2238
|
+
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
2239
|
+
});
|
|
2240
|
+
};
|
|
2241
|
+
/**
|
|
2242
|
+
* Get List of unread chats
|
|
2243
|
+
*/
|
|
2244
|
+
MessageCollection.prototype.getUnread = function () {
|
|
2245
|
+
return this.items.filter(function (message) { return !message.readAt; });
|
|
2246
|
+
};
|
|
2247
|
+
/**
|
|
2248
|
+
* Check if chat has unread chats
|
|
2249
|
+
*/
|
|
2250
|
+
MessageCollection.prototype.hasUnread = function () {
|
|
2251
|
+
return !!this.getUnread().length;
|
|
2252
|
+
};
|
|
2253
|
+
return MessageCollection;
|
|
2254
|
+
}(Collection));
|
|
2255
|
+
|
|
2256
|
+
/**
|
|
2257
|
+
* Collection of MessageDocument instances
|
|
2258
|
+
*/
|
|
2259
|
+
var MessageDocumentCollection = /** @class */ (function (_super) {
|
|
2260
|
+
__extends(MessageDocumentCollection, _super);
|
|
2261
|
+
function MessageDocumentCollection() {
|
|
2262
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2263
|
+
}
|
|
2264
|
+
/**
|
|
2265
|
+
* get list of documents which are not attached to any message
|
|
2266
|
+
*/
|
|
2267
|
+
MessageDocumentCollection.prototype.getUnattached = function () {
|
|
2268
|
+
return new MessageDocumentCollection(this.items.filter(function (doc) { return !doc.message; }));
|
|
2269
|
+
};
|
|
2270
|
+
return MessageDocumentCollection;
|
|
2271
|
+
}(Collection));
|
|
2272
|
+
|
|
2174
2273
|
var FinancialYear = /** @class */ (function () {
|
|
2175
2274
|
function FinancialYear(date) {
|
|
2176
2275
|
this.yearStartDate = '-07-01';
|
|
@@ -2220,168 +2319,6 @@
|
|
|
2220
2319
|
}());
|
|
2221
2320
|
FinancialYear.startMonthIndex = 6;
|
|
2222
2321
|
|
|
2223
|
-
var LogbookPeriod = /** @class */ (function () {
|
|
2224
|
-
function LogbookPeriod() {
|
|
2225
|
-
}
|
|
2226
|
-
return LogbookPeriod;
|
|
2227
|
-
}());
|
|
2228
|
-
__decorate([
|
|
2229
|
-
classTransformer.Type(function () { return Date; })
|
|
2230
|
-
], LogbookPeriod.prototype, "from", void 0);
|
|
2231
|
-
__decorate([
|
|
2232
|
-
classTransformer.Type(function () { return Date; })
|
|
2233
|
-
], LogbookPeriod.prototype, "to", void 0);
|
|
2234
|
-
|
|
2235
|
-
// Class contain array of vehicle logbooks and calculate the best period for logbook claim method
|
|
2236
|
-
var LogbookCollection = /** @class */ (function () {
|
|
2237
|
-
function LogbookCollection(vehicles) {
|
|
2238
|
-
// 12 weeks in milliseconds to check logbooks range
|
|
2239
|
-
this.logbookClaimRange = 12 * 7 * 24 * 3600 * 1000;
|
|
2240
|
-
this.trips = vehicles.map(function (vehicle) { return vehicle.logbook; }).flat();
|
|
2241
|
-
this.financialYear = new FinancialYear();
|
|
2242
|
-
this.setInitialBestPeriod();
|
|
2243
|
-
}
|
|
2244
|
-
Object.defineProperty(LogbookCollection.prototype, "isAutomaticLogbookCalculationAllowed", {
|
|
2245
|
-
// check if summary logbooks date range less than 84 days (12 weeks)
|
|
2246
|
-
get: function () {
|
|
2247
|
-
// forbid automatic logbook calculation if no logbook trips exist
|
|
2248
|
-
if (!this.trips.length) {
|
|
2249
|
-
return false;
|
|
2250
|
-
}
|
|
2251
|
-
// forbid automatic logbook calculation if logbook trips summary date range less than 12 weeks
|
|
2252
|
-
return this.trips.slice(-1)[0].date.getTime() - this.trips[0].date.getTime() >= this.logbookClaimRange;
|
|
2253
|
-
},
|
|
2254
|
-
enumerable: false,
|
|
2255
|
-
configurable: true
|
|
2256
|
-
});
|
|
2257
|
-
Object.defineProperty(LogbookCollection.prototype, "bestPeriod", {
|
|
2258
|
-
get: function () {
|
|
2259
|
-
// don't calculate if not allowed
|
|
2260
|
-
if (!this.isAutomaticLogbookCalculationAllowed) {
|
|
2261
|
-
return null;
|
|
2262
|
-
}
|
|
2263
|
-
this.calculateBestPeriod();
|
|
2264
|
-
return this._bestPeriod;
|
|
2265
|
-
},
|
|
2266
|
-
enumerable: false,
|
|
2267
|
-
configurable: true
|
|
2268
|
-
});
|
|
2269
|
-
Object.defineProperty(LogbookCollection.prototype, "workTrips", {
|
|
2270
|
-
get: function () {
|
|
2271
|
-
return this.trips.filter(function (logbook) { return logbook.isWork; });
|
|
2272
|
-
},
|
|
2273
|
-
enumerable: false,
|
|
2274
|
-
configurable: true
|
|
2275
|
-
});
|
|
2276
|
-
// calculate best period for logbook claim method
|
|
2277
|
-
LogbookCollection.prototype.calculateBestPeriod = function () {
|
|
2278
|
-
var _this = this;
|
|
2279
|
-
// set default best period values for real values comparison
|
|
2280
|
-
this.setInitialBestPeriod();
|
|
2281
|
-
// get best period with each trip date as start date
|
|
2282
|
-
this.workTrips.forEach(function (logbook) {
|
|
2283
|
-
var dateRange = _this.getDateRange(logbook.date);
|
|
2284
|
-
// get all trips included in current 12 weeks period
|
|
2285
|
-
var tripsInRange = _this.trips.filter(function (l) {
|
|
2286
|
-
return l.date >= dateRange.from && l.date <= dateRange.to;
|
|
2287
|
-
});
|
|
2288
|
-
// get work trips included in current 12 weeks period
|
|
2289
|
-
var workTripsInRange = tripsInRange.filter(function (l) { return l.isWork; });
|
|
2290
|
-
// calculate sum of work kilometers in current 12 weeks range
|
|
2291
|
-
var currentRangeKilometers = _this.getKilometersAmount(workTripsInRange);
|
|
2292
|
-
// overwrite best period with current 12 weeks range if amount of kilometers is bigger
|
|
2293
|
-
if (currentRangeKilometers > _this._bestPeriod.kilometers) {
|
|
2294
|
-
_this._bestPeriod = {
|
|
2295
|
-
from: dateRange.from,
|
|
2296
|
-
to: dateRange.to,
|
|
2297
|
-
kilometers: currentRangeKilometers,
|
|
2298
|
-
workUsage: _this.getLogbooksWorkUsage(tripsInRange, workTripsInRange)
|
|
2299
|
-
};
|
|
2300
|
-
}
|
|
2301
|
-
});
|
|
2302
|
-
};
|
|
2303
|
-
LogbookCollection.prototype.getDateRange = function (from) {
|
|
2304
|
-
// set end date after 12 weeks after start date
|
|
2305
|
-
var to = new Date(from.getTime() + this.logbookClaimRange);
|
|
2306
|
-
// set as period last 12 weeks of current year if period end date after end of current year
|
|
2307
|
-
if (to > this.financialYear.endDate) {
|
|
2308
|
-
to = this.financialYear.endDate;
|
|
2309
|
-
from = new Date(to.getTime() - this.logbookClaimRange);
|
|
2310
|
-
}
|
|
2311
|
-
return { from: from, to: to };
|
|
2312
|
-
};
|
|
2313
|
-
// calculate kilometers amount for passed trips
|
|
2314
|
-
LogbookCollection.prototype.getKilometersAmount = function (logbooks) {
|
|
2315
|
-
if (!logbooks.length) {
|
|
2316
|
-
return 0;
|
|
2317
|
-
}
|
|
2318
|
-
return logbooks.map(function (logbook) { return logbook.odometerEnd - logbook.odometerStart; })
|
|
2319
|
-
.reduce(function (prev, next) { return prev + Number(next); });
|
|
2320
|
-
};
|
|
2321
|
-
// calculate work usage for passed trips
|
|
2322
|
-
LogbookCollection.prototype.getLogbooksWorkUsage = function (logbooks, workLogbooks) {
|
|
2323
|
-
var kilometers = this.getKilometersAmount(logbooks);
|
|
2324
|
-
var workKilometers = this.getKilometersAmount(workLogbooks);
|
|
2325
|
-
return Math.round(workKilometers / kilometers * 100);
|
|
2326
|
-
};
|
|
2327
|
-
// set default best period with zero values and fin year start date for comparison in calculation
|
|
2328
|
-
LogbookCollection.prototype.setInitialBestPeriod = function () {
|
|
2329
|
-
// set 1st of July of current year as default start date for best period
|
|
2330
|
-
var startDate = this.financialYear.startDate;
|
|
2331
|
-
// set end custom-date after 12 weeks from start date
|
|
2332
|
-
var endDate = new Date(startDate.getTime() + this.logbookClaimRange);
|
|
2333
|
-
this._bestPeriod = classTransformer.plainToClass(LogbookPeriod, {
|
|
2334
|
-
from: startDate,
|
|
2335
|
-
to: endDate,
|
|
2336
|
-
kilometers: 0,
|
|
2337
|
-
workUsage: 0
|
|
2338
|
-
});
|
|
2339
|
-
};
|
|
2340
|
-
return LogbookCollection;
|
|
2341
|
-
}());
|
|
2342
|
-
|
|
2343
|
-
var MessageCollection = /** @class */ (function (_super) {
|
|
2344
|
-
__extends(MessageCollection, _super);
|
|
2345
|
-
function MessageCollection() {
|
|
2346
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2347
|
-
}
|
|
2348
|
-
MessageCollection.prototype.getFirstUnreadMessage = function (user) {
|
|
2349
|
-
return this.items.find(function (message) {
|
|
2350
|
-
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
2351
|
-
});
|
|
2352
|
-
};
|
|
2353
|
-
/**
|
|
2354
|
-
* Get List of unread chats
|
|
2355
|
-
*/
|
|
2356
|
-
MessageCollection.prototype.getUnread = function () {
|
|
2357
|
-
return this.items.filter(function (message) { return !message.readAt; });
|
|
2358
|
-
};
|
|
2359
|
-
/**
|
|
2360
|
-
* Check if chat has unread chats
|
|
2361
|
-
*/
|
|
2362
|
-
MessageCollection.prototype.hasUnread = function () {
|
|
2363
|
-
return !!this.getUnread().length;
|
|
2364
|
-
};
|
|
2365
|
-
return MessageCollection;
|
|
2366
|
-
}(Collection));
|
|
2367
|
-
|
|
2368
|
-
/**
|
|
2369
|
-
* Collection of MessageDocument instances
|
|
2370
|
-
*/
|
|
2371
|
-
var MessageDocumentCollection = /** @class */ (function (_super) {
|
|
2372
|
-
__extends(MessageDocumentCollection, _super);
|
|
2373
|
-
function MessageDocumentCollection() {
|
|
2374
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2375
|
-
}
|
|
2376
|
-
/**
|
|
2377
|
-
* get list of documents which are not attached to any message
|
|
2378
|
-
*/
|
|
2379
|
-
MessageDocumentCollection.prototype.getUnattached = function () {
|
|
2380
|
-
return new MessageDocumentCollection(this.items.filter(function (doc) { return !doc.message; }));
|
|
2381
|
-
};
|
|
2382
|
-
return MessageDocumentCollection;
|
|
2383
|
-
}(Collection));
|
|
2384
|
-
|
|
2385
2322
|
var PropertyCollection = /** @class */ (function (_super) {
|
|
2386
2323
|
__extends(PropertyCollection, _super);
|
|
2387
2324
|
function PropertyCollection() {
|
|
@@ -2674,6 +2611,8 @@
|
|
|
2674
2611
|
(function (ChartAccountsHeadingVehicleListEnum) {
|
|
2675
2612
|
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["WORK_RELATED_CAR_EXPENSES"] = 8] = "WORK_RELATED_CAR_EXPENSES";
|
|
2676
2613
|
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["DEPRECIATION_VEHICLES"] = 9] = "DEPRECIATION_VEHICLES";
|
|
2614
|
+
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["KLMS"] = 60] = "KLMS";
|
|
2615
|
+
ChartAccountsHeadingVehicleListEnum[ChartAccountsHeadingVehicleListEnum["FUEL_OIL"] = 61] = "FUEL_OIL";
|
|
2677
2616
|
})(exports.ChartAccountsHeadingVehicleListEnum || (exports.ChartAccountsHeadingVehicleListEnum = {}));
|
|
2678
2617
|
|
|
2679
2618
|
exports.ChartAccountsListEnum = void 0;
|
|
@@ -2685,16 +2624,17 @@
|
|
|
2685
2624
|
ChartAccountsListEnum[ChartAccountsListEnum["BUILDING_AT_COST"] = 304] = "BUILDING_AT_COST";
|
|
2686
2625
|
ChartAccountsListEnum[ChartAccountsListEnum["MANAGEMENT_FEES_PLATFORM_FEES"] = 656] = "MANAGEMENT_FEES_PLATFORM_FEES";
|
|
2687
2626
|
ChartAccountsListEnum[ChartAccountsListEnum["KLMS_TRAVELLED_FOR_WORK"] = 24] = "KLMS_TRAVELLED_FOR_WORK";
|
|
2627
|
+
ChartAccountsListEnum[ChartAccountsListEnum["KLMS_TRAVELLED"] = 683] = "KLMS_TRAVELLED";
|
|
2688
2628
|
ChartAccountsListEnum[ChartAccountsListEnum["DIRECTOR_FEES"] = 6] = "DIRECTOR_FEES";
|
|
2689
2629
|
ChartAccountsListEnum[ChartAccountsListEnum["SALARY_OR_WAGES"] = 2] = "SALARY_OR_WAGES";
|
|
2690
2630
|
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLES"] = 25] = "VEHICLES";
|
|
2691
2631
|
ChartAccountsListEnum[ChartAccountsListEnum["COMMERCIAL_VEHICLES"] = 26] = "COMMERCIAL_VEHICLES";
|
|
2632
|
+
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_INTEREST"] = 37] = "VEHICLE_LOAN_INTEREST";
|
|
2633
|
+
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_PRINCIPAL"] = 38] = "VEHICLE_LOAN_PRINCIPAL";
|
|
2692
2634
|
ChartAccountsListEnum[ChartAccountsListEnum["TAX_INSTALMENTS"] = 662] = "TAX_INSTALMENTS";
|
|
2693
2635
|
ChartAccountsListEnum[ChartAccountsListEnum["INTEREST_EARNED"] = 22] = "INTEREST_EARNED";
|
|
2694
2636
|
ChartAccountsListEnum[ChartAccountsListEnum["TRUST_INCOME"] = 567] = "TRUST_INCOME";
|
|
2695
2637
|
ChartAccountsListEnum[ChartAccountsListEnum["TAX_OFFSETS_N_R_A_S"] = 571] = "TAX_OFFSETS_N_R_A_S";
|
|
2696
|
-
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_INTEREST"] = 37] = "VEHICLE_LOAN_INTEREST";
|
|
2697
|
-
ChartAccountsListEnum[ChartAccountsListEnum["VEHICLE_LOAN_PRINCIPAL"] = 38] = "VEHICLE_LOAN_PRINCIPAL";
|
|
2698
2638
|
})(exports.ChartAccountsListEnum || (exports.ChartAccountsListEnum = {}));
|
|
2699
2639
|
|
|
2700
2640
|
var DepreciationCapitalProject$1 = /** @class */ (function () {
|
|
@@ -2856,6 +2796,25 @@
|
|
|
2856
2796
|
ChartAccounts.prototype.isKlmsForWork = function () {
|
|
2857
2797
|
return this.id === exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
2858
2798
|
};
|
|
2799
|
+
/**
|
|
2800
|
+
* Check if chart accounts id is related for 'Klms travelled for sole' category
|
|
2801
|
+
*/
|
|
2802
|
+
ChartAccounts.prototype.isKlmsForSole = function () {
|
|
2803
|
+
return this.id === exports.ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
2804
|
+
};
|
|
2805
|
+
/**
|
|
2806
|
+
* Check if accounts id is related for KLMs category related to passed tank type
|
|
2807
|
+
*/
|
|
2808
|
+
ChartAccounts.prototype.isKLMsByTankType = function (tankType) {
|
|
2809
|
+
switch (tankType) {
|
|
2810
|
+
case exports.TankTypeEnum.WORK:
|
|
2811
|
+
return this.isKlmsForWork();
|
|
2812
|
+
case exports.TankTypeEnum.SOLE:
|
|
2813
|
+
return this.isKlmsForSole();
|
|
2814
|
+
default:
|
|
2815
|
+
return false;
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2859
2818
|
/**
|
|
2860
2819
|
* Check if chart accounts id is related for 'NRAS Tax Offset' category
|
|
2861
2820
|
*/
|
|
@@ -2950,6 +2909,18 @@
|
|
|
2950
2909
|
ChartAccounts.prototype.isVehicleLoanExpense = function () {
|
|
2951
2910
|
return this.id === exports.ChartAccountsListEnum.VEHICLE_LOAN_INTEREST || this.id === exports.ChartAccountsListEnum.VEHICLE_LOAN_PRINCIPAL;
|
|
2952
2911
|
};
|
|
2912
|
+
/**
|
|
2913
|
+
* Get chart accounts value for current financial year
|
|
2914
|
+
*/
|
|
2915
|
+
ChartAccounts.prototype.getCurrentYearValue = function () {
|
|
2916
|
+
return this.getValueByYear(new FinancialYear().year);
|
|
2917
|
+
};
|
|
2918
|
+
/**
|
|
2919
|
+
* Get chart accounts value by financial year
|
|
2920
|
+
*/
|
|
2921
|
+
ChartAccounts.prototype.getValueByYear = function (year) {
|
|
2922
|
+
return this.values.find(function (value) { return value.financialYear === year; });
|
|
2923
|
+
};
|
|
2953
2924
|
return ChartAccounts;
|
|
2954
2925
|
}(ChartAccounts$1));
|
|
2955
2926
|
__decorate([
|
|
@@ -3014,7 +2985,6 @@
|
|
|
3014
2985
|
UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
|
|
3015
2986
|
UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
|
|
3016
2987
|
UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
|
|
3017
|
-
UserStatusEnum[UserStatusEnum["TRIAL"] = 3] = "TRIAL";
|
|
3018
2988
|
})(exports.UserStatusEnum || (exports.UserStatusEnum = {}));
|
|
3019
2989
|
|
|
3020
2990
|
exports.UserRolesEnum = void 0;
|
|
@@ -3104,12 +3074,12 @@
|
|
|
3104
3074
|
classTransformer.Type((function () { return Country; }))
|
|
3105
3075
|
], Address.prototype, "country", void 0);
|
|
3106
3076
|
|
|
3107
|
-
var _a$
|
|
3108
|
-
var USER_WORK_POSITION = (_a$
|
|
3109
|
-
_a$
|
|
3110
|
-
_a$
|
|
3111
|
-
_a$
|
|
3112
|
-
_a$
|
|
3077
|
+
var _a$4;
|
|
3078
|
+
var USER_WORK_POSITION = (_a$4 = {},
|
|
3079
|
+
_a$4[exports.UserRolesEnum.EMPLOYEE] = 'Employee',
|
|
3080
|
+
_a$4[exports.UserRolesEnum.FIRM_MANAGER] = 'Manager',
|
|
3081
|
+
_a$4[exports.UserRolesEnum.FIRM_OWNER] = 'Firm Owner',
|
|
3082
|
+
_a$4);
|
|
3113
3083
|
|
|
3114
3084
|
var ClientDetails$1 = /** @class */ (function () {
|
|
3115
3085
|
function ClientDetails() {
|
|
@@ -3277,22 +3247,22 @@
|
|
|
3277
3247
|
SubscriptionTypeEnum[SubscriptionTypeEnum["INVESTOR_PLUS"] = 3] = "INVESTOR_PLUS";
|
|
3278
3248
|
})(exports.SubscriptionTypeEnum || (exports.SubscriptionTypeEnum = {}));
|
|
3279
3249
|
|
|
3250
|
+
var _a$3;
|
|
3251
|
+
var SUBSCRIPTION_TITLE = (_a$3 = {},
|
|
3252
|
+
_a$3[exports.SubscriptionTypeEnum.WITHOUT_SUBSCRIPTION] = 'Without subscription',
|
|
3253
|
+
_a$3[exports.SubscriptionTypeEnum.INDIVIDUAL] = 'Individual',
|
|
3254
|
+
_a$3[exports.SubscriptionTypeEnum.INVESTOR] = 'Investor',
|
|
3255
|
+
_a$3[exports.SubscriptionTypeEnum.INVESTOR_PLUS] = 'Investor plus',
|
|
3256
|
+
_a$3);
|
|
3257
|
+
|
|
3280
3258
|
var _a$2;
|
|
3281
|
-
var
|
|
3259
|
+
var SUBSCRIPTION_DESCRIPTION = (_a$2 = {},
|
|
3282
3260
|
_a$2[exports.SubscriptionTypeEnum.WITHOUT_SUBSCRIPTION] = 'Without subscription',
|
|
3283
|
-
_a$2[exports.SubscriptionTypeEnum.INDIVIDUAL] = '
|
|
3284
|
-
_a$2[exports.SubscriptionTypeEnum.INVESTOR] = '
|
|
3285
|
-
_a$2[exports.SubscriptionTypeEnum.INVESTOR_PLUS] = '
|
|
3261
|
+
_a$2[exports.SubscriptionTypeEnum.INDIVIDUAL] = 'Manage income and expenses via live bank feeds. Keep receipts safe, maximise deductions & minimise tax.',
|
|
3262
|
+
_a$2[exports.SubscriptionTypeEnum.INVESTOR] = 'Property made easy with smart tax tools and real-time information to help control how much tax you pay.',
|
|
3263
|
+
_a$2[exports.SubscriptionTypeEnum.INVESTOR_PLUS] = 'Add your whole portfolio, including investment properties, home and properties in trusts. For 3+ properties an extra $6 will be charged per property.',
|
|
3286
3264
|
_a$2);
|
|
3287
3265
|
|
|
3288
|
-
var _a$1;
|
|
3289
|
-
var SUBSCRIPTION_DESCRIPTION = (_a$1 = {},
|
|
3290
|
-
_a$1[exports.SubscriptionTypeEnum.WITHOUT_SUBSCRIPTION] = 'Without subscription',
|
|
3291
|
-
_a$1[exports.SubscriptionTypeEnum.INDIVIDUAL] = 'Manage income and expenses via live bank feeds. Keep receipts safe, maximise deductions & minimise tax.',
|
|
3292
|
-
_a$1[exports.SubscriptionTypeEnum.INVESTOR] = 'Property made easy with smart tax tools and real-time information to help control how much tax you pay.',
|
|
3293
|
-
_a$1[exports.SubscriptionTypeEnum.INVESTOR_PLUS] = 'Add your whole portfolio, including investment properties, home and properties in trusts. For 3+ properties an extra $6 will be charged per property.',
|
|
3294
|
-
_a$1);
|
|
3295
|
-
|
|
3296
3266
|
var PROPERTY_INVESTOR_MAX_PROPERTIES = 2;
|
|
3297
3267
|
var ServiceSubscription = /** @class */ (function (_super) {
|
|
3298
3268
|
__extends(ServiceSubscription, _super);
|
|
@@ -4876,6 +4846,10 @@
|
|
|
4876
4846
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4877
4847
|
_this.forecasts = [];
|
|
4878
4848
|
_this.type = exports.DepreciationTypeEnum.PLANT_EQUIPMENT;
|
|
4849
|
+
/**
|
|
4850
|
+
* @TODO remove after ? signs removed from db models
|
|
4851
|
+
*/
|
|
4852
|
+
_this.amount = 0;
|
|
4879
4853
|
return _this;
|
|
4880
4854
|
}
|
|
4881
4855
|
Depreciation.prototype.isCapital = function () {
|
|
@@ -5645,7 +5619,7 @@
|
|
|
5645
5619
|
TransactionAllocationCollection.prototype.groupByBankAccount = function (bankTransactions) {
|
|
5646
5620
|
var _this = this;
|
|
5647
5621
|
// Group bank transactions by bank account id
|
|
5648
|
-
var bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount');
|
|
5622
|
+
var bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount.id');
|
|
5649
5623
|
// Create empty dictionary of transaction allocations
|
|
5650
5624
|
var allocationsByBankAccount = new CollectionDictionary(new TransactionAllocationCollection([]));
|
|
5651
5625
|
// Fill allocations dictionary with bank transactions dictionary keys and allocations related with each bank transaction collection
|
|
@@ -5683,6 +5657,124 @@
|
|
|
5683
5657
|
return UserEventSettingCollection;
|
|
5684
5658
|
}(Collection));
|
|
5685
5659
|
|
|
5660
|
+
/**
|
|
5661
|
+
* Class contains traveled kilometers and work usage percent in 12 weeks date range
|
|
5662
|
+
*/
|
|
5663
|
+
var LogbookPeriod = /** @class */ (function () {
|
|
5664
|
+
function LogbookPeriod() {
|
|
5665
|
+
}
|
|
5666
|
+
LogbookPeriod.prototype.isEndOfYear = function () {
|
|
5667
|
+
return this.to === new FinancialYear().endDate;
|
|
5668
|
+
};
|
|
5669
|
+
return LogbookPeriod;
|
|
5670
|
+
}());
|
|
5671
|
+
__decorate([
|
|
5672
|
+
classTransformer.Type(function () { return Date; })
|
|
5673
|
+
], LogbookPeriod.prototype, "from", void 0);
|
|
5674
|
+
__decorate([
|
|
5675
|
+
classTransformer.Type(function () { return Date; })
|
|
5676
|
+
], LogbookPeriod.prototype, "to", void 0);
|
|
5677
|
+
|
|
5678
|
+
/**
|
|
5679
|
+
* 12 weeks in milliseconds
|
|
5680
|
+
* "To work out your business-use percentage, you need to keep a logbook and the odometer readings for the logbook period.
|
|
5681
|
+
* The logbook period is a minimum continuous period of 12 weeks." © Nicole Kelly
|
|
5682
|
+
*/
|
|
5683
|
+
var LOGBOOK_PERIOD_DURATION = 12 * 7 * 24 * 3600 * 1000;
|
|
5684
|
+
var VehicleLogbookCollection = /** @class */ (function (_super) {
|
|
5685
|
+
__extends(VehicleLogbookCollection, _super);
|
|
5686
|
+
function VehicleLogbookCollection() {
|
|
5687
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
5688
|
+
}
|
|
5689
|
+
/**
|
|
5690
|
+
* Check if we can calculate the best period
|
|
5691
|
+
*/
|
|
5692
|
+
VehicleLogbookCollection.prototype.isBestPeriodExist = function () {
|
|
5693
|
+
if (this.items.length < 2) {
|
|
5694
|
+
return false;
|
|
5695
|
+
}
|
|
5696
|
+
return LOGBOOK_PERIOD_DURATION < (this.last.date.getTime() - this.first.date.getTime());
|
|
5697
|
+
};
|
|
5698
|
+
/**
|
|
5699
|
+
* Get collection of non-personal logbooks (work-related, sole-related).
|
|
5700
|
+
*/
|
|
5701
|
+
VehicleLogbookCollection.prototype.getBusinessLogbooks = function () {
|
|
5702
|
+
return this.create(this.items.filter(function (logbook) { return logbook.isBusiness(); }));
|
|
5703
|
+
};
|
|
5704
|
+
/**
|
|
5705
|
+
* Logbook Period is the best when it has the biggest amount of work kilometers
|
|
5706
|
+
* Best period duration is defined as LOGBOOK_PERIOD_DURATION (12 weeks) by the ATO
|
|
5707
|
+
*/
|
|
5708
|
+
VehicleLogbookCollection.prototype.getBestPeriod = function () {
|
|
5709
|
+
if (!this.isBestPeriodExist()) {
|
|
5710
|
+
return null;
|
|
5711
|
+
}
|
|
5712
|
+
var bestPeriod;
|
|
5713
|
+
var businessLogbooks = this.getBusinessLogbooks().toArray();
|
|
5714
|
+
for (var i = 0; i < businessLogbooks.length; i++) {
|
|
5715
|
+
var logbook = businessLogbooks[i];
|
|
5716
|
+
// no sense to check next logbooks because we already get the end of the year
|
|
5717
|
+
if (bestPeriod && bestPeriod.isEndOfYear()) {
|
|
5718
|
+
break;
|
|
5719
|
+
}
|
|
5720
|
+
var dateRange = this.getPeriodRange(logbook.date);
|
|
5721
|
+
// get logbooks included in current logbook period
|
|
5722
|
+
var logbooksInRange = this.getByDateRange(logbook.date, new Date(logbook.date.getTime() + LOGBOOK_PERIOD_DURATION));
|
|
5723
|
+
var workUsage = logbooksInRange.getWorkUsage();
|
|
5724
|
+
// compare with previous best period and overwrite if needs
|
|
5725
|
+
if (!bestPeriod || workUsage > bestPeriod.workUsage) {
|
|
5726
|
+
bestPeriod = classTransformer.plainToClass(LogbookPeriod, {
|
|
5727
|
+
from: dateRange.from,
|
|
5728
|
+
to: dateRange.to,
|
|
5729
|
+
kilometers: logbooksInRange.getBusinessLogbooks().getKlms(),
|
|
5730
|
+
workUsage: workUsage
|
|
5731
|
+
});
|
|
5732
|
+
}
|
|
5733
|
+
}
|
|
5734
|
+
return bestPeriod;
|
|
5735
|
+
};
|
|
5736
|
+
/**
|
|
5737
|
+
* Calculate total kilometers traveled
|
|
5738
|
+
*/
|
|
5739
|
+
VehicleLogbookCollection.prototype.getKlms = function () {
|
|
5740
|
+
return this.items.reduce(function (sum, logbook) { return sum + logbook.getKlms(); }, 0);
|
|
5741
|
+
};
|
|
5742
|
+
/**
|
|
5743
|
+
* Calculate work usage (percent of business-related kilometers from total kilometers)
|
|
5744
|
+
*/
|
|
5745
|
+
VehicleLogbookCollection.prototype.getWorkUsage = function () {
|
|
5746
|
+
var totalKilometers = this.getKlms();
|
|
5747
|
+
var workKilometers = this.getBusinessLogbooks().getKlms();
|
|
5748
|
+
return Math.round(workKilometers / totalKilometers * 100);
|
|
5749
|
+
};
|
|
5750
|
+
/**
|
|
5751
|
+
* Get LOGBOOK_PERIOD_DURATION date range from passed start date
|
|
5752
|
+
*/
|
|
5753
|
+
VehicleLogbookCollection.prototype.getPeriodRange = function (from) {
|
|
5754
|
+
// set end date after LOGBOOK_PERIOD_DURATION after start date
|
|
5755
|
+
var to = new Date(from.getTime() + LOGBOOK_PERIOD_DURATION);
|
|
5756
|
+
var financialYear = new FinancialYear();
|
|
5757
|
+
// set as period last LOGBOOK_PERIOD_DURATION of current year if period end date after end of current year
|
|
5758
|
+
if (to > financialYear.endDate) {
|
|
5759
|
+
to = financialYear.endDate;
|
|
5760
|
+
from = new Date(to.getTime() - LOGBOOK_PERIOD_DURATION);
|
|
5761
|
+
}
|
|
5762
|
+
return { from: from, to: to };
|
|
5763
|
+
};
|
|
5764
|
+
return VehicleLogbookCollection;
|
|
5765
|
+
}(Collection));
|
|
5766
|
+
|
|
5767
|
+
var VehicleCollection = /** @class */ (function (_super) {
|
|
5768
|
+
__extends(VehicleCollection, _super);
|
|
5769
|
+
function VehicleCollection() {
|
|
5770
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
5771
|
+
}
|
|
5772
|
+
VehicleCollection.prototype.getLogbooks = function () {
|
|
5773
|
+
return new VehicleLogbookCollection(flatten__default["default"](this.items.map(function (vehicle) { return vehicle.logbook; })));
|
|
5774
|
+
};
|
|
5775
|
+
return VehicleCollection;
|
|
5776
|
+
}(Collection));
|
|
5777
|
+
|
|
5686
5778
|
exports.BankAccountStatusEnum = void 0;
|
|
5687
5779
|
(function (BankAccountStatusEnum) {
|
|
5688
5780
|
BankAccountStatusEnum[BankAccountStatusEnum["INACTIVE"] = 0] = "INACTIVE";
|
|
@@ -6119,6 +6211,15 @@
|
|
|
6119
6211
|
VehicleLogbookPurposeEnum[VehicleLogbookPurposeEnum["PERSONAL"] = 2] = "PERSONAL";
|
|
6120
6212
|
})(exports.VehicleLogbookPurposeEnum || (exports.VehicleLogbookPurposeEnum = {}));
|
|
6121
6213
|
|
|
6214
|
+
/**
|
|
6215
|
+
* Account setup item instance is using for account setup checklist
|
|
6216
|
+
*/
|
|
6217
|
+
var AccountSetupItem = /** @class */ (function () {
|
|
6218
|
+
function AccountSetupItem() {
|
|
6219
|
+
}
|
|
6220
|
+
return AccountSetupItem;
|
|
6221
|
+
}());
|
|
6222
|
+
|
|
6122
6223
|
var Bank$1 = /** @class */ (function () {
|
|
6123
6224
|
function Bank() {
|
|
6124
6225
|
}
|
|
@@ -6650,10 +6751,24 @@
|
|
|
6650
6751
|
ChartAccountsTaxLabelsEnum["TAX_DEDUCTED"] = "Tax Deducted";
|
|
6651
6752
|
})(exports.ChartAccountsTaxLabelsEnum || (exports.ChartAccountsTaxLabelsEnum = {}));
|
|
6652
6753
|
|
|
6653
|
-
var
|
|
6654
|
-
function
|
|
6754
|
+
var ChartAccountsValue$1 = /** @class */ (function () {
|
|
6755
|
+
function ChartAccountsValue() {
|
|
6655
6756
|
}
|
|
6656
|
-
return
|
|
6757
|
+
return ChartAccountsValue;
|
|
6758
|
+
}());
|
|
6759
|
+
|
|
6760
|
+
var ChartAccountsValue = /** @class */ (function (_super) {
|
|
6761
|
+
__extends(ChartAccountsValue, _super);
|
|
6762
|
+
function ChartAccountsValue() {
|
|
6763
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6764
|
+
}
|
|
6765
|
+
return ChartAccountsValue;
|
|
6766
|
+
}(ChartAccountsValue$1));
|
|
6767
|
+
|
|
6768
|
+
var Chat$1 = /** @class */ (function () {
|
|
6769
|
+
function Chat() {
|
|
6770
|
+
}
|
|
6771
|
+
return Chat;
|
|
6657
6772
|
}());
|
|
6658
6773
|
|
|
6659
6774
|
var Chat = /** @class */ (function (_super) {
|
|
@@ -6753,6 +6868,30 @@
|
|
|
6753
6868
|
classTransformer.Expose()
|
|
6754
6869
|
], Message.prototype, "documents", void 0);
|
|
6755
6870
|
|
|
6871
|
+
var ClientIncomeTypes$1 = /** @class */ (function () {
|
|
6872
|
+
function ClientIncomeTypes() {
|
|
6873
|
+
}
|
|
6874
|
+
return ClientIncomeTypes;
|
|
6875
|
+
}());
|
|
6876
|
+
|
|
6877
|
+
var ClientIncomeTypes = /** @class */ (function (_super) {
|
|
6878
|
+
__extends(ClientIncomeTypes, _super);
|
|
6879
|
+
function ClientIncomeTypes() {
|
|
6880
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6881
|
+
}
|
|
6882
|
+
Object.defineProperty(ClientIncomeTypes.prototype, "length", {
|
|
6883
|
+
/**
|
|
6884
|
+
* Get count of selected income types
|
|
6885
|
+
*/
|
|
6886
|
+
get: function () {
|
|
6887
|
+
return Object.values(this).filter(function (value) { return typeof value === 'boolean' && value; }).length;
|
|
6888
|
+
},
|
|
6889
|
+
enumerable: false,
|
|
6890
|
+
configurable: true
|
|
6891
|
+
});
|
|
6892
|
+
return ClientIncomeTypes;
|
|
6893
|
+
}(ClientIncomeTypes$1));
|
|
6894
|
+
|
|
6756
6895
|
var ClientInvite$1 = /** @class */ (function () {
|
|
6757
6896
|
function ClientInvite() {
|
|
6758
6897
|
}
|
|
@@ -7019,34 +7158,34 @@
|
|
|
7019
7158
|
return DepreciationGroupItem;
|
|
7020
7159
|
}(DepreciationGroup));
|
|
7021
7160
|
|
|
7022
|
-
var _a;
|
|
7023
|
-
var DEPRECIATION_GROUPS = (_a = {},
|
|
7024
|
-
_a[exports.DepreciationGroupEnum.BORROWING_EXPENSES] = {
|
|
7161
|
+
var _a$1;
|
|
7162
|
+
var DEPRECIATION_GROUPS = (_a$1 = {},
|
|
7163
|
+
_a$1[exports.DepreciationGroupEnum.BORROWING_EXPENSES] = {
|
|
7025
7164
|
label: 'Borrowing Expenses',
|
|
7026
7165
|
description: 'Borrowing expenses on loans are deductible over 1826 days (5 years) starting from the date of a loan',
|
|
7027
7166
|
icon: 'loan'
|
|
7028
7167
|
},
|
|
7029
|
-
_a[exports.DepreciationGroupEnum.BUILDING_IMPROVEMENTS] = {
|
|
7168
|
+
_a$1[exports.DepreciationGroupEnum.BUILDING_IMPROVEMENTS] = {
|
|
7030
7169
|
label: 'Building & Improvements',
|
|
7031
7170
|
description: 'Construction costs, renovations and capital improvements which depreciate at 2.5%',
|
|
7032
7171
|
icon: 'building-improvements'
|
|
7033
7172
|
},
|
|
7034
|
-
_a[exports.DepreciationGroupEnum.PLANT_EQUIPMENT] = {
|
|
7173
|
+
_a$1[exports.DepreciationGroupEnum.PLANT_EQUIPMENT] = {
|
|
7035
7174
|
label: 'Plant & Equipment',
|
|
7036
7175
|
description: 'Assets which decline in value over their useful life (as prescribed by the ATO)',
|
|
7037
7176
|
icon: 'plant-equipment'
|
|
7038
7177
|
},
|
|
7039
|
-
_a[exports.DepreciationGroupEnum.LOW_VALUE_POOL] = {
|
|
7178
|
+
_a$1[exports.DepreciationGroupEnum.LOW_VALUE_POOL] = {
|
|
7040
7179
|
label: 'Low Value Pool',
|
|
7041
7180
|
description: 'Items under $1,000 are added to the pool to maximise depreciation',
|
|
7042
7181
|
icon: 'lvp'
|
|
7043
7182
|
},
|
|
7044
|
-
_a[exports.DepreciationGroupEnum.WRITTEN_OFF_ITEMS] = {
|
|
7183
|
+
_a$1[exports.DepreciationGroupEnum.WRITTEN_OFF_ITEMS] = {
|
|
7045
7184
|
label: 'Written Off Items',
|
|
7046
7185
|
description: 'Items below $300, replaced or obsolete are fully deductible',
|
|
7047
7186
|
icon: 'cart'
|
|
7048
7187
|
},
|
|
7049
|
-
_a);
|
|
7188
|
+
_a$1);
|
|
7050
7189
|
|
|
7051
7190
|
var DepreciationReceipt$1 = /** @class */ (function () {
|
|
7052
7191
|
function DepreciationReceipt() {
|
|
@@ -7214,6 +7353,9 @@
|
|
|
7214
7353
|
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 35] = "USER_UPDATED";
|
|
7215
7354
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 36] = "VEHICLE_CLAIM_UPDATED";
|
|
7216
7355
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 37] = "VEHICLE_CLAIM_CREATED";
|
|
7356
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 38] = "VEHICLE_LOGBOOK_CREATED";
|
|
7357
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 39] = "VEHICLE_LOGBOOK_UPDATED";
|
|
7358
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 40] = "VEHICLE_LOGBOOK_DELETED";
|
|
7217
7359
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
7218
7360
|
|
|
7219
7361
|
/**
|
|
@@ -7340,20 +7482,18 @@
|
|
|
7340
7482
|
function VehicleLogbook() {
|
|
7341
7483
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
7342
7484
|
}
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
configurable: true
|
|
7356
|
-
});
|
|
7485
|
+
/**
|
|
7486
|
+
* Get amount of kilometers in this logbook
|
|
7487
|
+
*/
|
|
7488
|
+
VehicleLogbook.prototype.getKlms = function () {
|
|
7489
|
+
return this.odometerEnd - this.odometerStart;
|
|
7490
|
+
};
|
|
7491
|
+
/**
|
|
7492
|
+
* Check if logbook is business-related
|
|
7493
|
+
*/
|
|
7494
|
+
VehicleLogbook.prototype.isBusiness = function () {
|
|
7495
|
+
return this.purpose === exports.VehicleLogbookPurposeEnum.BUSINESS;
|
|
7496
|
+
};
|
|
7357
7497
|
return VehicleLogbook;
|
|
7358
7498
|
}(VehicleLogbook$1));
|
|
7359
7499
|
__decorate([
|
|
@@ -7365,54 +7505,12 @@
|
|
|
7365
7505
|
function Vehicle() {
|
|
7366
7506
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
7367
7507
|
}
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
});
|
|
7375
|
-
Object.defineProperty(Vehicle.prototype, "totalKilometres", {
|
|
7376
|
-
get: function () {
|
|
7377
|
-
var kilometers = 0;
|
|
7378
|
-
this.logbook.forEach(function (lb) {
|
|
7379
|
-
kilometers += lb.kilometres;
|
|
7380
|
-
});
|
|
7381
|
-
return kilometers;
|
|
7382
|
-
},
|
|
7383
|
-
enumerable: false,
|
|
7384
|
-
configurable: true
|
|
7385
|
-
});
|
|
7386
|
-
Object.defineProperty(Vehicle.prototype, "workKilometres", {
|
|
7387
|
-
get: function () {
|
|
7388
|
-
var kilometers = 0;
|
|
7389
|
-
this.logbook.forEach(function (lb) {
|
|
7390
|
-
if (lb.purpose === exports.VehicleLogbookPurposeEnum.BUSINESS) {
|
|
7391
|
-
kilometers += lb.kilometres;
|
|
7392
|
-
}
|
|
7393
|
-
});
|
|
7394
|
-
return kilometers;
|
|
7395
|
-
},
|
|
7396
|
-
enumerable: false,
|
|
7397
|
-
configurable: true
|
|
7398
|
-
});
|
|
7399
|
-
Object.defineProperty(Vehicle.prototype, "personalKilometres", {
|
|
7400
|
-
get: function () {
|
|
7401
|
-
return this.totalKilometres - this.workKilometres;
|
|
7402
|
-
},
|
|
7403
|
-
enumerable: false,
|
|
7404
|
-
configurable: true
|
|
7405
|
-
});
|
|
7406
|
-
Object.defineProperty(Vehicle.prototype, "lastLogbook", {
|
|
7407
|
-
get: function () {
|
|
7408
|
-
if (!this.logbook.length) {
|
|
7409
|
-
return { odometerEnd: 0 };
|
|
7410
|
-
}
|
|
7411
|
-
return this.logbook.slice(-1)[0];
|
|
7412
|
-
},
|
|
7413
|
-
enumerable: false,
|
|
7414
|
-
configurable: true
|
|
7415
|
-
});
|
|
7508
|
+
/**
|
|
7509
|
+
* Get vehicle's logbooks as collection
|
|
7510
|
+
*/
|
|
7511
|
+
Vehicle.prototype.getLogbooks = function () {
|
|
7512
|
+
return new VehicleLogbookCollection(this.logbook);
|
|
7513
|
+
};
|
|
7416
7514
|
return Vehicle;
|
|
7417
7515
|
}(Vehicle$1));
|
|
7418
7516
|
__decorate([
|
|
@@ -7449,19 +7547,70 @@
|
|
|
7449
7547
|
enumerable: false,
|
|
7450
7548
|
configurable: true
|
|
7451
7549
|
});
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7550
|
+
VehicleClaim.prototype.isLogbookMethod = function () {
|
|
7551
|
+
return this.method === exports.VehicleClaimMethodEnum.LOGBOOK;
|
|
7552
|
+
};
|
|
7553
|
+
VehicleClaim.prototype.isKLMsMethod = function () {
|
|
7554
|
+
return this.method === exports.VehicleClaimMethodEnum.KMS;
|
|
7555
|
+
};
|
|
7556
|
+
VehicleClaim.prototype.isWorkTank = function () {
|
|
7557
|
+
return this.tankType === exports.TankTypeEnum.WORK;
|
|
7558
|
+
};
|
|
7559
|
+
VehicleClaim.prototype.isSoleTank = function () {
|
|
7560
|
+
return this.tankType === exports.TankTypeEnum.SOLE;
|
|
7561
|
+
};
|
|
7459
7562
|
/**
|
|
7460
|
-
* Claim amount for
|
|
7563
|
+
* Claim amount for KLMs method. Exists only for KLMs method.
|
|
7461
7564
|
*/
|
|
7462
|
-
VehicleClaim.prototype.
|
|
7565
|
+
VehicleClaim.prototype.getKLMsClaimAmount = function (vehicleClaimRate) {
|
|
7566
|
+
if (!this.isKLMsMethod()) {
|
|
7567
|
+
return 0;
|
|
7568
|
+
}
|
|
7463
7569
|
return +(this.kilometers * vehicleClaimRate).toFixed(2);
|
|
7464
7570
|
};
|
|
7571
|
+
/**
|
|
7572
|
+
* Get logbook claim amount. Exists only for logbook method.
|
|
7573
|
+
* ClaimAmount = WorkUsage * transaction/depreciation amount
|
|
7574
|
+
*/
|
|
7575
|
+
VehicleClaim.prototype.getLogbookClaimAmount = function (transactions) {
|
|
7576
|
+
var _this = this;
|
|
7577
|
+
if (!this.isLogbookMethod()) {
|
|
7578
|
+
return 0;
|
|
7579
|
+
}
|
|
7580
|
+
var transactionsAmount = transactions
|
|
7581
|
+
.getByTankType(this.tankType)
|
|
7582
|
+
.getVehicleTransactions()
|
|
7583
|
+
// except klms transactions because they needed only for klms method
|
|
7584
|
+
.filter(function (transaction) { return !transaction.chartAccounts.isKLMsByTankType(_this.tankType); })
|
|
7585
|
+
.sumBy('amount');
|
|
7586
|
+
// Math.abs because amount will be negative (because we sum expenses), but we don't want negative percent value
|
|
7587
|
+
return Math.abs(transactionsAmount) * this.workUsage / 100;
|
|
7588
|
+
};
|
|
7589
|
+
/**
|
|
7590
|
+
* Create KLMs transaction based on vehicle claim and vehicle claim rate
|
|
7591
|
+
* @TODO handle on backend: Create klms transaction when vhicle claim created
|
|
7592
|
+
*/
|
|
7593
|
+
VehicleClaim.prototype.toTransaction = function (vehicleClaimRate) {
|
|
7594
|
+
return classTransformer.plainToClass(Transaction, {
|
|
7595
|
+
amount: this.kilometers * vehicleClaimRate,
|
|
7596
|
+
source: exports.TransactionSourceEnum.CASH,
|
|
7597
|
+
type: exports.TransactionTypeEnum.DEBIT,
|
|
7598
|
+
taxWithheld: 0,
|
|
7599
|
+
description: 'Klm’s method',
|
|
7600
|
+
date: new Date(new FinancialYear().year + "-06-30"),
|
|
7601
|
+
claimPercent: 100,
|
|
7602
|
+
chartAccounts: {
|
|
7603
|
+
id: this.getKlmsChartAccountsIdByTankType(this.tankType)
|
|
7604
|
+
}
|
|
7605
|
+
});
|
|
7606
|
+
};
|
|
7607
|
+
VehicleClaim.prototype.getKlmsChartAccountsIdByTankType = function (tankType) {
|
|
7608
|
+
if (tankType === void 0) { tankType = this.tankType; }
|
|
7609
|
+
if (tankType === exports.TankTypeEnum.WORK) {
|
|
7610
|
+
return exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
7611
|
+
}
|
|
7612
|
+
return exports.ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
7613
|
+
};
|
|
7465
7614
|
return VehicleClaim;
|
|
7466
7615
|
}(VehicleClaim$1));
|
|
7467
7616
|
|
|
@@ -7516,6 +7665,22 @@
|
|
|
7516
7665
|
})
|
|
7517
7666
|
], Notification.prototype, "redirectionLink", void 0);
|
|
7518
7667
|
|
|
7668
|
+
exports.PdfOrientationEnum = void 0;
|
|
7669
|
+
(function (PdfOrientationEnum) {
|
|
7670
|
+
PdfOrientationEnum["PORTRAIT"] = "portrait";
|
|
7671
|
+
PdfOrientationEnum["LANDSCAPE"] = "landscape";
|
|
7672
|
+
})(exports.PdfOrientationEnum || (exports.PdfOrientationEnum = {}));
|
|
7673
|
+
|
|
7674
|
+
/**
|
|
7675
|
+
* Class with entities for generated PDF file
|
|
7676
|
+
*/
|
|
7677
|
+
var PdfSettings = /** @class */ (function () {
|
|
7678
|
+
function PdfSettings() {
|
|
7679
|
+
this.orientation = exports.PdfOrientationEnum.PORTRAIT;
|
|
7680
|
+
}
|
|
7681
|
+
return PdfSettings;
|
|
7682
|
+
}());
|
|
7683
|
+
|
|
7519
7684
|
/**
|
|
7520
7685
|
* Calculation form control types
|
|
7521
7686
|
*/
|
|
@@ -8376,87 +8541,105 @@
|
|
|
8376
8541
|
UserEventSettingFieldEnum["FREQUENCY"] = "frequency";
|
|
8377
8542
|
})(exports.UserEventSettingFieldEnum || (exports.UserEventSettingFieldEnum = {}));
|
|
8378
8543
|
|
|
8379
|
-
|
|
8380
|
-
|
|
8544
|
+
/**
|
|
8545
|
+
* Enum list of all possible account setup items. Using with [ACCOUNT_SETUP_ITEMS]{@link ACCOUNT_SETUP_ITEMS}
|
|
8546
|
+
*/
|
|
8547
|
+
var AccountSetupItemsEnum;
|
|
8548
|
+
(function (AccountSetupItemsEnum) {
|
|
8549
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["SALARY"] = 0] = "SALARY";
|
|
8550
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["OTHER_INCOME"] = 1] = "OTHER_INCOME";
|
|
8551
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["PROPERTY"] = 2] = "PROPERTY";
|
|
8552
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_FEEDS"] = 3] = "BANK_FEEDS";
|
|
8553
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["WORK_LOGBOOK"] = 4] = "WORK_LOGBOOK";
|
|
8554
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_INCOME"] = 5] = "SOLE_INCOME";
|
|
8555
|
+
AccountSetupItemsEnum[AccountSetupItemsEnum["TRANSACTION"] = 6] = "TRANSACTION";
|
|
8556
|
+
})(AccountSetupItemsEnum || (AccountSetupItemsEnum = {}));
|
|
8557
|
+
|
|
8558
|
+
var _a;
|
|
8559
|
+
/**
|
|
8560
|
+
* List of all possible account setup steps
|
|
8561
|
+
*/
|
|
8562
|
+
var ACCOUNT_SETUP_ITEMS = (_a = {},
|
|
8563
|
+
_a[AccountSetupItemsEnum.SALARY] = classTransformer.plainToClass(AccountSetupItem, {
|
|
8564
|
+
title: 'Add your work income forecast',
|
|
8565
|
+
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.',
|
|
8566
|
+
url: '/client/work-tank/forecasting'
|
|
8567
|
+
}),
|
|
8568
|
+
_a[AccountSetupItemsEnum.OTHER_INCOME] = classTransformer.plainToClass(AccountSetupItem, {
|
|
8569
|
+
title: 'Add any other expected incomes',
|
|
8570
|
+
description: 'To ensure an accurate tax position forecast, add estimates for any other income types, like dividends, interest, trusts, annuities, director payments etc.',
|
|
8571
|
+
url: '/client/work-tank/forecasting'
|
|
8572
|
+
}),
|
|
8573
|
+
_a[AccountSetupItemsEnum.PROPERTY] = classTransformer.plainToClass(AccountSetupItem, {
|
|
8574
|
+
title: 'Add your properties',
|
|
8575
|
+
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.',
|
|
8576
|
+
url: '/client/property-tank'
|
|
8577
|
+
}),
|
|
8578
|
+
_a[AccountSetupItemsEnum.BANK_FEEDS] = classTransformer.plainToClass(AccountSetupItem, {
|
|
8579
|
+
title: 'Link banks and select accounts',
|
|
8580
|
+
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!',
|
|
8581
|
+
url: '/client/bank-feeds'
|
|
8582
|
+
}),
|
|
8583
|
+
_a[AccountSetupItemsEnum.WORK_LOGBOOK] = classTransformer.plainToClass(AccountSetupItem, {
|
|
8584
|
+
title: 'Set up your logbook method',
|
|
8585
|
+
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.',
|
|
8586
|
+
url: '/client/work-tank/logbook'
|
|
8587
|
+
}),
|
|
8588
|
+
_a[AccountSetupItemsEnum.SOLE_INCOME] = classTransformer.plainToClass(AccountSetupItem, {
|
|
8589
|
+
title: 'Add your business details',
|
|
8590
|
+
description: 'Add your business details, logo and payment terms to create invoice templates in minutes.',
|
|
8591
|
+
url: '/client/sole-tank/forecasting'
|
|
8592
|
+
}),
|
|
8593
|
+
_a[AccountSetupItemsEnum.TRANSACTION] = classTransformer.plainToClass(AccountSetupItem, {
|
|
8594
|
+
title: 'Allocation transactions',
|
|
8595
|
+
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.',
|
|
8596
|
+
url: '/client/bank-feeds'
|
|
8597
|
+
}),
|
|
8598
|
+
_a);
|
|
8599
|
+
|
|
8600
|
+
/**
|
|
8601
|
+
* @TODO extend rest service when it could work with single objects, not only arrays
|
|
8602
|
+
*/
|
|
8603
|
+
var ClientIncomeTypesService = /** @class */ (function () {
|
|
8604
|
+
function ClientIncomeTypesService(http, environment) {
|
|
8381
8605
|
this.http = http;
|
|
8382
8606
|
this.environment = environment;
|
|
8383
|
-
this.
|
|
8607
|
+
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
8384
8608
|
}
|
|
8385
|
-
|
|
8609
|
+
ClientIncomeTypesService.prototype.get = function () {
|
|
8386
8610
|
var _this = this;
|
|
8387
|
-
if (!this.
|
|
8388
|
-
this.http.get(this.environment.apiV2 + "/
|
|
8611
|
+
if (!this.cache) {
|
|
8612
|
+
this.http.get(this.environment.apiV2 + "/client-income-types")
|
|
8389
8613
|
.pipe(operators.map(function (response) {
|
|
8390
|
-
return response['hydra:member']
|
|
8614
|
+
return classTransformer.plainToClass(ClientIncomeTypes, response['hydra:member'][0], { excludePrefixes: ['@'] });
|
|
8391
8615
|
}))
|
|
8392
|
-
.subscribe(function (
|
|
8393
|
-
_this.
|
|
8394
|
-
_this.
|
|
8616
|
+
.subscribe(function (incomeTypes) {
|
|
8617
|
+
_this.cache = incomeTypes;
|
|
8618
|
+
_this.cacheSubject.next(_this.cache);
|
|
8395
8619
|
});
|
|
8396
8620
|
}
|
|
8397
|
-
return this.
|
|
8398
|
-
};
|
|
8399
|
-
return AddressService;
|
|
8400
|
-
}());
|
|
8401
|
-
AddressService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AddressService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
8402
|
-
AddressService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AddressService, providedIn: 'root' });
|
|
8403
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AddressService, decorators: [{
|
|
8404
|
-
type: i0.Injectable,
|
|
8405
|
-
args: [{
|
|
8406
|
-
providedIn: 'root'
|
|
8407
|
-
}]
|
|
8408
|
-
}], ctorParameters: function () {
|
|
8409
|
-
return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
|
|
8410
|
-
type: i0.Inject,
|
|
8411
|
-
args: ['environment']
|
|
8412
|
-
}] }];
|
|
8413
|
-
} });
|
|
8414
|
-
|
|
8415
|
-
/**
|
|
8416
|
-
* Service to work with assets (documents, receipts, e.t.c.)
|
|
8417
|
-
*/
|
|
8418
|
-
var AssetsService = /** @class */ (function () {
|
|
8419
|
-
function AssetsService(http, userSwitcherService, environment) {
|
|
8420
|
-
this.http = http;
|
|
8421
|
-
this.userSwitcherService = userSwitcherService;
|
|
8422
|
-
this.environment = environment;
|
|
8423
|
-
this.impersonatedClient = this.userSwitcherService.get();
|
|
8424
|
-
}
|
|
8425
|
-
/**
|
|
8426
|
-
* Get asset link
|
|
8427
|
-
* @param asset to get the link for
|
|
8428
|
-
*/
|
|
8429
|
-
AssetsService.prototype.getLink = function (asset) {
|
|
8430
|
-
return this.http.get(this.environment.apiV2 + "/assets/" + asset.type + "/" + asset.id);
|
|
8431
|
-
};
|
|
8432
|
-
/**
|
|
8433
|
-
* Download asset
|
|
8434
|
-
* @param asset which should be downloaded
|
|
8435
|
-
* @TODO refactor
|
|
8436
|
-
*/
|
|
8437
|
-
AssetsService.prototype.download = function (asset) {
|
|
8438
|
-
return this.environment.apiV2 + "/assets/" + asset.type + "/" + asset.id + "/download?bearer=" + localStorage.getItem('token') + (this.impersonatedClient ? "&_switch_user=" + this.impersonatedClient : '');
|
|
8621
|
+
return this.cacheSubject.asObservable();
|
|
8439
8622
|
};
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8623
|
+
ClientIncomeTypesService.prototype.update = function (incomeTypes) {
|
|
8624
|
+
var _this = this;
|
|
8625
|
+
return this.http.put(this.environment.apiV2 + "/client-income-types/" + incomeTypes.id, incomeTypes)
|
|
8626
|
+
.pipe(operators.map(function (incomeTypesBase) {
|
|
8627
|
+
_this.cache = classTransformer.plainToClass(ClientIncomeTypes, incomeTypesBase);
|
|
8628
|
+
_this.cacheSubject.next(_this.cache);
|
|
8629
|
+
return _this.cache;
|
|
8630
|
+
}));
|
|
8448
8631
|
};
|
|
8449
|
-
return
|
|
8632
|
+
return ClientIncomeTypesService;
|
|
8450
8633
|
}());
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
8634
|
+
ClientIncomeTypesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ClientIncomeTypesService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
8635
|
+
ClientIncomeTypesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ClientIncomeTypesService, providedIn: 'root' });
|
|
8636
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ClientIncomeTypesService, decorators: [{
|
|
8454
8637
|
type: i0.Injectable,
|
|
8455
8638
|
args: [{
|
|
8456
8639
|
providedIn: 'root'
|
|
8457
8640
|
}]
|
|
8458
8641
|
}], ctorParameters: function () {
|
|
8459
|
-
return [{ type: i1__namespace.HttpClient }, { type:
|
|
8642
|
+
return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
|
|
8460
8643
|
type: i0.Inject,
|
|
8461
8644
|
args: ['environment']
|
|
8462
8645
|
}] }];
|
|
@@ -8489,19 +8672,75 @@
|
|
|
8489
8672
|
}]
|
|
8490
8673
|
}] });
|
|
8491
8674
|
|
|
8675
|
+
/**
|
|
8676
|
+
* popup notifications service (toast, snackbar).
|
|
8677
|
+
*/
|
|
8678
|
+
var ToastService = /** @class */ (function () {
|
|
8679
|
+
function ToastService() {
|
|
8680
|
+
this.toast$ = new rxjs.ReplaySubject(1);
|
|
8681
|
+
}
|
|
8682
|
+
ToastService.prototype.get = function () {
|
|
8683
|
+
return this.toast$.asObservable();
|
|
8684
|
+
};
|
|
8685
|
+
ToastService.prototype.add = function (toast) {
|
|
8686
|
+
this.toast$.next(toast);
|
|
8687
|
+
};
|
|
8688
|
+
ToastService.prototype.success = function (message) {
|
|
8689
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
8690
|
+
type: exports.ToastTypeEnum.SUCCESS,
|
|
8691
|
+
title: 'Success!',
|
|
8692
|
+
message: message,
|
|
8693
|
+
}));
|
|
8694
|
+
};
|
|
8695
|
+
ToastService.prototype.warning = function (message) {
|
|
8696
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
8697
|
+
type: exports.ToastTypeEnum.WARNING,
|
|
8698
|
+
title: 'Warning!',
|
|
8699
|
+
message: message,
|
|
8700
|
+
}));
|
|
8701
|
+
};
|
|
8702
|
+
ToastService.prototype.error = function (message) {
|
|
8703
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
8704
|
+
type: exports.ToastTypeEnum.ERROR,
|
|
8705
|
+
title: 'Error!',
|
|
8706
|
+
message: message,
|
|
8707
|
+
}));
|
|
8708
|
+
};
|
|
8709
|
+
ToastService.prototype.info = function (message) {
|
|
8710
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
8711
|
+
type: exports.ToastTypeEnum.INFO,
|
|
8712
|
+
title: 'Information',
|
|
8713
|
+
message: message,
|
|
8714
|
+
}));
|
|
8715
|
+
};
|
|
8716
|
+
return ToastService;
|
|
8717
|
+
}());
|
|
8718
|
+
ToastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ToastService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
8719
|
+
ToastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ToastService, providedIn: 'root' });
|
|
8720
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ToastService, decorators: [{
|
|
8721
|
+
type: i0.Injectable,
|
|
8722
|
+
args: [{
|
|
8723
|
+
providedIn: 'root'
|
|
8724
|
+
}]
|
|
8725
|
+
}] });
|
|
8726
|
+
|
|
8492
8727
|
/**
|
|
8493
8728
|
* Abstract base service that implements common services functionality
|
|
8494
8729
|
* and describe abstract methods/properties that have to be implemented in child services
|
|
8495
8730
|
* Model - entity service is working with
|
|
8496
8731
|
* BaseModel - base entity model that extends by Model
|
|
8732
|
+
* @TODO Alex: refactor all services for work with collections instead of arrays
|
|
8733
|
+
* @TODO Alex: implement smart system of default toast messages
|
|
8497
8734
|
*/
|
|
8498
8735
|
var RestService = /** @class */ (function () {
|
|
8499
|
-
function RestService(http, eventDispatcherService, environment) {
|
|
8736
|
+
function RestService(http, eventDispatcherService, environment, toastService) {
|
|
8500
8737
|
this.http = http;
|
|
8501
8738
|
this.eventDispatcherService = eventDispatcherService;
|
|
8502
8739
|
this.environment = environment;
|
|
8740
|
+
this.toastService = toastService;
|
|
8503
8741
|
// subject for service cache
|
|
8504
8742
|
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
8743
|
+
this.listenEvents();
|
|
8505
8744
|
}
|
|
8506
8745
|
/**
|
|
8507
8746
|
* get cached list of all instances
|
|
@@ -8550,6 +8789,9 @@
|
|
|
8550
8789
|
_this.cache.push(newInstance);
|
|
8551
8790
|
_this.updateCache();
|
|
8552
8791
|
}
|
|
8792
|
+
if (_this.messageCreated) {
|
|
8793
|
+
_this.toastService.success(_this.messageCreated);
|
|
8794
|
+
}
|
|
8553
8795
|
return newInstance;
|
|
8554
8796
|
}));
|
|
8555
8797
|
};
|
|
@@ -8570,6 +8812,9 @@
|
|
|
8570
8812
|
(_a = _this.cache).push.apply(_a, __spreadArray([], __read(newInstances)));
|
|
8571
8813
|
_this.updateCache();
|
|
8572
8814
|
}
|
|
8815
|
+
if (_this.messageCreatedBatch) {
|
|
8816
|
+
_this.toastService.success(_this.messageCreatedBatch);
|
|
8817
|
+
}
|
|
8573
8818
|
return newInstances;
|
|
8574
8819
|
}));
|
|
8575
8820
|
};
|
|
@@ -8587,6 +8832,9 @@
|
|
|
8587
8832
|
var updatedInstance = _this.createModelInstance(_this.modelClass, updatedItem);
|
|
8588
8833
|
replace(_this.cache, updatedInstance);
|
|
8589
8834
|
_this.updateCache();
|
|
8835
|
+
if (_this.messageUpdated) {
|
|
8836
|
+
_this.toastService.success(_this.messageUpdated);
|
|
8837
|
+
}
|
|
8590
8838
|
return updatedInstance;
|
|
8591
8839
|
}));
|
|
8592
8840
|
};
|
|
@@ -8605,6 +8853,9 @@
|
|
|
8605
8853
|
updatedInstances.forEach(function (instance) {
|
|
8606
8854
|
replace(_this.cache, instance);
|
|
8607
8855
|
});
|
|
8856
|
+
if (_this.messageUpdatedBatch) {
|
|
8857
|
+
_this.toastService.success(_this.messageUpdatedBatch);
|
|
8858
|
+
}
|
|
8608
8859
|
_this.updateCache();
|
|
8609
8860
|
return updatedInstances;
|
|
8610
8861
|
}));
|
|
@@ -8619,6 +8870,9 @@
|
|
|
8619
8870
|
.pipe(operators.map(function () {
|
|
8620
8871
|
_this.cache = _this.cache.filter(function (item) { return item['id'] !== model['id']; });
|
|
8621
8872
|
_this.updateCache();
|
|
8873
|
+
if (_this.messageDeleted) {
|
|
8874
|
+
_this.toastService.success(_this.messageDeleted);
|
|
8875
|
+
}
|
|
8622
8876
|
}));
|
|
8623
8877
|
};
|
|
8624
8878
|
/**
|
|
@@ -8632,6 +8886,9 @@
|
|
|
8632
8886
|
var ids = models.map(function (model) { return model['id']; });
|
|
8633
8887
|
_this.cache = _this.cache.filter(function (item) { return !ids.includes(item['id']); });
|
|
8634
8888
|
_this.updateCache();
|
|
8889
|
+
if (_this.messageDeletedBatch) {
|
|
8890
|
+
_this.toastService.success(_this.messageDeletedBatch);
|
|
8891
|
+
}
|
|
8635
8892
|
}));
|
|
8636
8893
|
};
|
|
8637
8894
|
/**
|
|
@@ -8670,9 +8927,13 @@
|
|
|
8670
8927
|
RestService.prototype.createModelInstance = function (model, baseModel) {
|
|
8671
8928
|
return classTransformer.plainToClass(model, baseModel, { excludePrefixes: ['@'] });
|
|
8672
8929
|
};
|
|
8673
|
-
|
|
8930
|
+
/**
|
|
8931
|
+
* Method that call all listeners. Empty by default. Should be redefined by child services if required
|
|
8932
|
+
*/
|
|
8933
|
+
RestService.prototype.listenEvents = function () { };
|
|
8934
|
+
return RestService;
|
|
8674
8935
|
}());
|
|
8675
|
-
RestService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RestService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
8936
|
+
RestService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RestService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
8676
8937
|
RestService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RestService, providedIn: 'root' });
|
|
8677
8938
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RestService, decorators: [{
|
|
8678
8939
|
type: i0.Injectable,
|
|
@@ -8683,26 +8944,217 @@
|
|
|
8683
8944
|
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
8684
8945
|
type: i0.Inject,
|
|
8685
8946
|
args: ['environment']
|
|
8686
|
-
}] }];
|
|
8947
|
+
}] }, { type: ToastService }];
|
|
8687
8948
|
} });
|
|
8688
8949
|
|
|
8689
8950
|
/**
|
|
8690
|
-
* Service
|
|
8951
|
+
* Service for work with Property
|
|
8691
8952
|
*/
|
|
8692
|
-
var
|
|
8693
|
-
__extends(
|
|
8694
|
-
function
|
|
8953
|
+
var PropertyService = /** @class */ (function (_super) {
|
|
8954
|
+
__extends(PropertyService, _super);
|
|
8955
|
+
function PropertyService() {
|
|
8695
8956
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
8696
|
-
_this.modelClass =
|
|
8697
|
-
_this.url = '
|
|
8698
|
-
_this.isHydra = true;
|
|
8957
|
+
_this.modelClass = Property;
|
|
8958
|
+
_this.url = 'properties';
|
|
8699
8959
|
return _this;
|
|
8700
8960
|
}
|
|
8701
|
-
|
|
8961
|
+
PropertyService.prototype.listenEvents = function () {
|
|
8962
|
+
this.listenShareInviteAccepted();
|
|
8963
|
+
this.listenServiceSubscriptionUpdated();
|
|
8964
|
+
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
8965
|
+
this.listenMovementsChanged();
|
|
8966
|
+
};
|
|
8967
|
+
/**
|
|
8968
|
+
* Update cache when share invitation accepted
|
|
8969
|
+
*/
|
|
8970
|
+
PropertyService.prototype.listenShareInviteAccepted = function () {
|
|
8971
|
+
var _this = this;
|
|
8972
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
8973
|
+
};
|
|
8974
|
+
/**
|
|
8975
|
+
* Update cache when user's service subscription is updated
|
|
8976
|
+
*/
|
|
8977
|
+
PropertyService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
8978
|
+
var _this = this;
|
|
8979
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
8980
|
+
};
|
|
8981
|
+
/**
|
|
8982
|
+
* Update cache when property category changed
|
|
8983
|
+
*/
|
|
8984
|
+
PropertyService.prototype.listenMovementsChanged = function () {
|
|
8985
|
+
var _this = this;
|
|
8986
|
+
// @TODO change dispatcher logic to work with multiple events
|
|
8987
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED).subscribe(function () { return _this.resetCache(); });
|
|
8988
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
8989
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_DELETED).subscribe(function () { return _this.resetCache(); });
|
|
8990
|
+
};
|
|
8991
|
+
PropertyService.prototype.update = function (property) {
|
|
8992
|
+
var _this = this;
|
|
8993
|
+
return _super.prototype.update.call(this, property).pipe(operators.map(function (updatedProperty) {
|
|
8994
|
+
if (property.documentFile) {
|
|
8995
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_UPDATED_WITH_DOCUMENT, property));
|
|
8996
|
+
}
|
|
8997
|
+
return updatedProperty;
|
|
8998
|
+
}));
|
|
8999
|
+
};
|
|
9000
|
+
PropertyService.prototype.getByCategoryId = function (id) {
|
|
9001
|
+
return this.get().pipe(operators.map(function (properties) {
|
|
9002
|
+
return properties.filter(function (property) { return property.category.id === id; });
|
|
9003
|
+
}));
|
|
9004
|
+
};
|
|
9005
|
+
/**
|
|
9006
|
+
* Activate deactivated property
|
|
9007
|
+
*/
|
|
9008
|
+
PropertyService.prototype.activate = function (property) {
|
|
9009
|
+
var _this = this;
|
|
9010
|
+
return this.http.post(this.environment.apiV2 + "/property-subscriptions", { user: property.user, property: property })
|
|
9011
|
+
.pipe(operators.map(function (propertySubscriptionBase) {
|
|
9012
|
+
var newPropertySubscription = classTransformer.plainToClass(PropertySubscription, propertySubscriptionBase);
|
|
9013
|
+
var activatedProperty = classTransformer.plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
|
|
9014
|
+
replace(_this.cache, activatedProperty);
|
|
9015
|
+
_this.updateCache();
|
|
9016
|
+
}));
|
|
9017
|
+
};
|
|
9018
|
+
/**
|
|
9019
|
+
* Deactivate activated property
|
|
9020
|
+
*/
|
|
9021
|
+
PropertyService.prototype.deactivate = function (property) {
|
|
9022
|
+
var _this = this;
|
|
9023
|
+
return this.http.delete(this.environment.apiV2 + "/property-subscriptions/" + property.getCurrentSubscription().id)
|
|
9024
|
+
.pipe(operators.map(function () {
|
|
9025
|
+
var deactivatedProperty = classTransformer.plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
|
|
9026
|
+
replace(_this.cache, deactivatedProperty);
|
|
9027
|
+
_this.updateCache();
|
|
9028
|
+
}));
|
|
9029
|
+
};
|
|
9030
|
+
/**
|
|
9031
|
+
* Update property photo
|
|
9032
|
+
* @param property Property instance for photo update
|
|
9033
|
+
* @param photoFormData FormData with property photo image
|
|
9034
|
+
*/
|
|
9035
|
+
PropertyService.prototype.updatePhoto = function (property, photoFormData) {
|
|
9036
|
+
var _this = this;
|
|
9037
|
+
return this.http.post(this.environment.apiV2 + "/properties/" + property.id + "/photo?_method=PUT", photoFormData)
|
|
9038
|
+
.pipe(operators.map(function (photoLink) {
|
|
9039
|
+
property.photo = photoLink;
|
|
9040
|
+
// update properties cache
|
|
9041
|
+
replace(_this.cache, property);
|
|
9042
|
+
_this.updateCache();
|
|
9043
|
+
}));
|
|
9044
|
+
};
|
|
9045
|
+
PropertyService.prototype.getByShareId = function (id) {
|
|
9046
|
+
return this.get().pipe(operators.map(function (properties) {
|
|
9047
|
+
return properties.filter(function (property) { return property.user.id === id; });
|
|
9048
|
+
}));
|
|
9049
|
+
};
|
|
9050
|
+
/**
|
|
9051
|
+
* Get list of active user's properties
|
|
9052
|
+
*/
|
|
9053
|
+
PropertyService.prototype.getActive = function () {
|
|
9054
|
+
return this.get().pipe(operators.map(function (properties) { return properties.filter(function (property) { return property.isActive; }); }));
|
|
9055
|
+
};
|
|
9056
|
+
return PropertyService;
|
|
8702
9057
|
}(RestService));
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
9058
|
+
PropertyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9059
|
+
PropertyService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyService, providedIn: 'root' });
|
|
9060
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyService, decorators: [{
|
|
9061
|
+
type: i0.Injectable,
|
|
9062
|
+
args: [{
|
|
9063
|
+
providedIn: 'root'
|
|
9064
|
+
}]
|
|
9065
|
+
}] });
|
|
9066
|
+
|
|
9067
|
+
/**
|
|
9068
|
+
* Service to work with income sources
|
|
9069
|
+
*/
|
|
9070
|
+
var IncomeSourceService = /** @class */ (function (_super) {
|
|
9071
|
+
__extends(IncomeSourceService, _super);
|
|
9072
|
+
function IncomeSourceService() {
|
|
9073
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9074
|
+
_this.url = 'income-sources';
|
|
9075
|
+
_this.modelClass = IncomeSource;
|
|
9076
|
+
_this.incomeSourceTypeSubject = new rxjs.ReplaySubject(1);
|
|
9077
|
+
return _this;
|
|
9078
|
+
}
|
|
9079
|
+
/**
|
|
9080
|
+
* Get income sources tax calculation
|
|
9081
|
+
* @param salaryForecast for which tax should be calculated
|
|
9082
|
+
*/
|
|
9083
|
+
IncomeSourceService.prototype.getTaxCalculation = function (salaryForecast) {
|
|
9084
|
+
return this.http.post(this.environment.apiV2 + "/" + this.url + "/tax-calculation", salaryForecast)
|
|
9085
|
+
.pipe(operators.map(function (response) {
|
|
9086
|
+
return classTransformer.plainToClass(SalaryForecast, response);
|
|
9087
|
+
}));
|
|
9088
|
+
};
|
|
9089
|
+
/**
|
|
9090
|
+
* Add batch of income sources
|
|
9091
|
+
* @param incomeSources to add
|
|
9092
|
+
*/
|
|
9093
|
+
IncomeSourceService.prototype.addBatch = function (incomeSources) {
|
|
9094
|
+
var _this = this;
|
|
9095
|
+
return this.http.post(this.environment.apiV2 + "/" + this.url, incomeSources)
|
|
9096
|
+
.pipe(operators.map(function (addedIncomeSources) {
|
|
9097
|
+
var _a;
|
|
9098
|
+
// assign respond income sources to provided income sources
|
|
9099
|
+
var assignedIncomeSources = addedIncomeSources
|
|
9100
|
+
.map(function (incomeSource, index) { return Object.assign(classTransformer.plainToClass(IncomeSource, {}), incomeSource, incomeSources[index]); });
|
|
9101
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.INCOME_SOURCES_CREATED, assignedIncomeSources));
|
|
9102
|
+
(_a = _this.cache).push.apply(_a, __spreadArray([], __read(assignedIncomeSources)));
|
|
9103
|
+
_this.updateCache();
|
|
9104
|
+
return assignedIncomeSources;
|
|
9105
|
+
}));
|
|
9106
|
+
};
|
|
9107
|
+
/**
|
|
9108
|
+
* Update batch of income sources
|
|
9109
|
+
*/
|
|
9110
|
+
IncomeSourceService.prototype.updateBatch = function (incomeSources, queryParams) {
|
|
9111
|
+
var _this = this;
|
|
9112
|
+
if (queryParams === void 0) { queryParams = {}; }
|
|
9113
|
+
return this.http.put(this.environment.apiV2 + "/" + this.url, incomeSources, queryParams)
|
|
9114
|
+
.pipe(operators.map(function (updatedItems) {
|
|
9115
|
+
var updatedInstances = updatedItems.map(function (item) { return _this.createModelInstance(_this.modelClass, item); });
|
|
9116
|
+
updatedInstances.forEach(function (instance) {
|
|
9117
|
+
replace(_this.cache, instance);
|
|
9118
|
+
});
|
|
9119
|
+
if (incomeSources[0].forecasts.length) {
|
|
9120
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.INCOME_SOURCES_UPDATED, incomeSources));
|
|
9121
|
+
}
|
|
9122
|
+
_this.updateCache();
|
|
9123
|
+
return updatedInstances;
|
|
9124
|
+
}));
|
|
9125
|
+
};
|
|
9126
|
+
/**
|
|
9127
|
+
* Get income sources by provided types
|
|
9128
|
+
* @param types
|
|
9129
|
+
*/
|
|
9130
|
+
IncomeSourceService.prototype.getByTypes = function (types) {
|
|
9131
|
+
return this.get()
|
|
9132
|
+
.pipe(operators.map(function (incomeSources) { return incomeSources
|
|
9133
|
+
.filter(function (incomeSource) { return types.includes(incomeSource.type); }); }));
|
|
9134
|
+
};
|
|
9135
|
+
/**
|
|
9136
|
+
* Get other incomes types
|
|
9137
|
+
*/
|
|
9138
|
+
IncomeSourceService.prototype.getIncomeSourceTypes = function () {
|
|
9139
|
+
var _this = this;
|
|
9140
|
+
if (!this.incomeSourceTypes) {
|
|
9141
|
+
this.incomeSourceTypes = [];
|
|
9142
|
+
this.http.get(this.environment.apiV2 + "/income-source-types")
|
|
9143
|
+
.pipe(operators.map(function (response) {
|
|
9144
|
+
return response.map(function (item) { return classTransformer.plainToClass(IncomeSourceType, item); });
|
|
9145
|
+
}))
|
|
9146
|
+
.subscribe(function (otherIncomesTypes) {
|
|
9147
|
+
_this.incomeSourceTypes = otherIncomesTypes;
|
|
9148
|
+
_this.incomeSourceTypeSubject.next(_this.incomeSourceTypes);
|
|
9149
|
+
});
|
|
9150
|
+
}
|
|
9151
|
+
return this.incomeSourceTypeSubject.asObservable();
|
|
9152
|
+
};
|
|
9153
|
+
return IncomeSourceService;
|
|
9154
|
+
}(RestService));
|
|
9155
|
+
IncomeSourceService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9156
|
+
IncomeSourceService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceService, providedIn: 'root' });
|
|
9157
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceService, decorators: [{
|
|
8706
9158
|
type: i0.Injectable,
|
|
8707
9159
|
args: [{
|
|
8708
9160
|
providedIn: 'root'
|
|
@@ -8714,15 +9166,11 @@
|
|
|
8714
9166
|
*/
|
|
8715
9167
|
var BankAccountService = /** @class */ (function (_super) {
|
|
8716
9168
|
__extends(BankAccountService, _super);
|
|
8717
|
-
function BankAccountService(
|
|
8718
|
-
var _this = _super.
|
|
8719
|
-
_this.http = http;
|
|
8720
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
8721
|
-
_this.environment = environment;
|
|
9169
|
+
function BankAccountService() {
|
|
9170
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
8722
9171
|
// api url parameter for bank accounts
|
|
8723
9172
|
_this.url = 'bank-accounts';
|
|
8724
9173
|
_this.modelClass = BankAccount;
|
|
8725
|
-
_this.listenEvents();
|
|
8726
9174
|
return _this;
|
|
8727
9175
|
}
|
|
8728
9176
|
/**
|
|
@@ -8810,22 +9258,333 @@
|
|
|
8810
9258
|
});
|
|
8811
9259
|
});
|
|
8812
9260
|
};
|
|
8813
|
-
return BankAccountService;
|
|
8814
|
-
}(RestService));
|
|
8815
|
-
BankAccountService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankAccountService, deps:
|
|
8816
|
-
BankAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankAccountService, providedIn: 'root' });
|
|
8817
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankAccountService, decorators: [{
|
|
9261
|
+
return BankAccountService;
|
|
9262
|
+
}(RestService));
|
|
9263
|
+
BankAccountService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankAccountService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9264
|
+
BankAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankAccountService, providedIn: 'root' });
|
|
9265
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankAccountService, decorators: [{
|
|
9266
|
+
type: i0.Injectable,
|
|
9267
|
+
args: [{
|
|
9268
|
+
providedIn: 'root'
|
|
9269
|
+
}]
|
|
9270
|
+
}] });
|
|
9271
|
+
|
|
9272
|
+
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|
|
9273
|
+
/**
|
|
9274
|
+
* Service for transaction allocations business logic
|
|
9275
|
+
* @TODO alex refactor
|
|
9276
|
+
*/
|
|
9277
|
+
var TransactionAllocationService = /** @class */ (function (_super) {
|
|
9278
|
+
__extends(TransactionAllocationService, _super);
|
|
9279
|
+
function TransactionAllocationService() {
|
|
9280
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9281
|
+
// API URL param for transaction allocations
|
|
9282
|
+
_this.url = 'transactions-allocations';
|
|
9283
|
+
_this.modelClass = TransactionAllocation;
|
|
9284
|
+
return _this;
|
|
9285
|
+
}
|
|
9286
|
+
/**
|
|
9287
|
+
* Add single transaction allocation
|
|
9288
|
+
*/
|
|
9289
|
+
TransactionAllocationService.prototype.add = function (allocation) {
|
|
9290
|
+
return this.addBatch([allocation]).pipe(operators.map(function (newAllocations) { return newAllocations[0]; }));
|
|
9291
|
+
};
|
|
9292
|
+
/**
|
|
9293
|
+
* get list of transactions allocations related with passed bank transactions list
|
|
9294
|
+
*/
|
|
9295
|
+
TransactionAllocationService.prototype.getByTransactions = function (transactions) {
|
|
9296
|
+
var ids = transactions.map(function (transaction) { return transaction.id; });
|
|
9297
|
+
return this.get()
|
|
9298
|
+
.pipe(operators.map(function (transactionAllocations) {
|
|
9299
|
+
return transactionAllocations.filter(function (allocation) { return ids.includes(allocation.transaction.id); });
|
|
9300
|
+
}));
|
|
9301
|
+
};
|
|
9302
|
+
TransactionAllocationService.prototype.listenEvents = function () {
|
|
9303
|
+
this.onTransactionsCreated();
|
|
9304
|
+
this.onDepreciationCreated();
|
|
9305
|
+
this.onTransactionDeleted();
|
|
9306
|
+
};
|
|
9307
|
+
/**
|
|
9308
|
+
* Reset cache on transactions created
|
|
9309
|
+
*/
|
|
9310
|
+
TransactionAllocationService.prototype.onTransactionsCreated = function () {
|
|
9311
|
+
var _this = this;
|
|
9312
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(function () {
|
|
9313
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
9314
|
+
_this.resetCache();
|
|
9315
|
+
});
|
|
9316
|
+
};
|
|
9317
|
+
/**
|
|
9318
|
+
* Reset cache on depreciation created
|
|
9319
|
+
*/
|
|
9320
|
+
TransactionAllocationService.prototype.onDepreciationCreated = function () {
|
|
9321
|
+
var _this = this;
|
|
9322
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.DEPRECIATIONS_CREATED).subscribe(function () {
|
|
9323
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
9324
|
+
_this.resetCache();
|
|
9325
|
+
});
|
|
9326
|
+
};
|
|
9327
|
+
/**
|
|
9328
|
+
* Reset cache on transaction deleted
|
|
9329
|
+
*/
|
|
9330
|
+
TransactionAllocationService.prototype.onTransactionDeleted = function () {
|
|
9331
|
+
var _this = this;
|
|
9332
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTION_DELETED).subscribe(function () {
|
|
9333
|
+
// Update allocations cache to synchronize data and fire subscriptions
|
|
9334
|
+
_this.resetCache();
|
|
9335
|
+
});
|
|
9336
|
+
};
|
|
9337
|
+
return TransactionAllocationService;
|
|
9338
|
+
}(RestService));
|
|
9339
|
+
TransactionAllocationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionAllocationService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9340
|
+
TransactionAllocationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionAllocationService, providedIn: 'root' });
|
|
9341
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionAllocationService, decorators: [{
|
|
9342
|
+
type: i0.Injectable,
|
|
9343
|
+
args: [{
|
|
9344
|
+
providedIn: 'root'
|
|
9345
|
+
}]
|
|
9346
|
+
}] });
|
|
9347
|
+
|
|
9348
|
+
var MessagesEnum$1;
|
|
9349
|
+
(function (MessagesEnum) {
|
|
9350
|
+
MessagesEnum["VEHICLE_CREATED"] = "Vehicle created successfully";
|
|
9351
|
+
MessagesEnum["VEHICLE_UPDATED"] = "Vehicle updated successfully";
|
|
9352
|
+
MessagesEnum["VEHICLE_DELETED"] = "Vehicle deleted successfully";
|
|
9353
|
+
MessagesEnum["VEHICLE_CLAIM_CREATED"] = "Vehicle claim created successfully";
|
|
9354
|
+
MessagesEnum["VEHICLE_CLAIM_UPDATED"] = "Vehicle claim updated successfully";
|
|
9355
|
+
MessagesEnum["VEHICLE_CLAIM_DELETED"] = "Vehicle claim deleted successfully";
|
|
9356
|
+
MessagesEnum["VEHICLE_LOGBOOK_CREATED"] = "Vehicle logbook created successfully";
|
|
9357
|
+
MessagesEnum["VEHICLE_LOGBOOK_UPDATED"] = "Vehicle logbook updated successfully";
|
|
9358
|
+
MessagesEnum["VEHICLE_LOGBOOK_DELETED"] = "Vehicle logbook deleted successfully";
|
|
9359
|
+
})(MessagesEnum$1 || (MessagesEnum$1 = {}));
|
|
9360
|
+
|
|
9361
|
+
var VehicleClaimService = /** @class */ (function (_super) {
|
|
9362
|
+
__extends(VehicleClaimService, _super);
|
|
9363
|
+
function VehicleClaimService() {
|
|
9364
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9365
|
+
_this.modelClass = VehicleClaim;
|
|
9366
|
+
_this.url = 'vehicle-claims';
|
|
9367
|
+
_this.messageCreated = MessagesEnum$1.VEHICLE_CLAIM_CREATED;
|
|
9368
|
+
_this.messageUpdated = MessagesEnum$1.VEHICLE_CLAIM_UPDATED;
|
|
9369
|
+
_this.messageDeleted = MessagesEnum$1.VEHICLE_CLAIM_DELETED;
|
|
9370
|
+
return _this;
|
|
9371
|
+
}
|
|
9372
|
+
return VehicleClaimService;
|
|
9373
|
+
}(RestService));
|
|
9374
|
+
VehicleClaimService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleClaimService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9375
|
+
VehicleClaimService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleClaimService, providedIn: 'root' });
|
|
9376
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleClaimService, decorators: [{
|
|
9377
|
+
type: i0.Injectable,
|
|
9378
|
+
args: [{
|
|
9379
|
+
providedIn: 'root'
|
|
9380
|
+
}]
|
|
9381
|
+
}] });
|
|
9382
|
+
|
|
9383
|
+
/**
|
|
9384
|
+
* Service handling user's account setup process.
|
|
9385
|
+
* Checks required steps and their completion
|
|
9386
|
+
*/
|
|
9387
|
+
var AccountSetupService = /** @class */ (function () {
|
|
9388
|
+
function AccountSetupService(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService) {
|
|
9389
|
+
this.clientIncomeTypesService = clientIncomeTypesService;
|
|
9390
|
+
this.propertyService = propertyService;
|
|
9391
|
+
this.incomeSourceService = incomeSourceService;
|
|
9392
|
+
this.bankAccountsService = bankAccountsService;
|
|
9393
|
+
this.transactionAllocationService = transactionAllocationService;
|
|
9394
|
+
this.vehicleClaimService = vehicleClaimService;
|
|
9395
|
+
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
9396
|
+
}
|
|
9397
|
+
/**
|
|
9398
|
+
* Get list of account setup items for current user
|
|
9399
|
+
*/
|
|
9400
|
+
AccountSetupService.prototype.get = function () {
|
|
9401
|
+
var _this = this;
|
|
9402
|
+
if (!this.cache) {
|
|
9403
|
+
this.clientIncomeTypesService.get().subscribe(function (incomeTypes) {
|
|
9404
|
+
rxjs.combineLatest(_this.createBatch(incomeTypes)).subscribe(function (items) {
|
|
9405
|
+
_this.cache = new AccountSetupItemCollection(items);
|
|
9406
|
+
_this.cacheSubject.next(_this.cache);
|
|
9407
|
+
});
|
|
9408
|
+
});
|
|
9409
|
+
}
|
|
9410
|
+
return this.cacheSubject.asObservable();
|
|
9411
|
+
};
|
|
9412
|
+
/**
|
|
9413
|
+
* Get a single AccountSetupItem and check it's completion
|
|
9414
|
+
*/
|
|
9415
|
+
AccountSetupService.prototype.create = function (itemType, request) {
|
|
9416
|
+
return request.pipe(operators.map(function (result) {
|
|
9417
|
+
var item = ACCOUNT_SETUP_ITEMS[itemType];
|
|
9418
|
+
if (result.length) {
|
|
9419
|
+
item.isCompleted = true;
|
|
9420
|
+
}
|
|
9421
|
+
return item;
|
|
9422
|
+
}));
|
|
9423
|
+
};
|
|
9424
|
+
/**
|
|
9425
|
+
* Get batch of requests to get list of required AccountSetupItem's.
|
|
9426
|
+
* Some items are optional and depends of user's client income types
|
|
9427
|
+
*/
|
|
9428
|
+
AccountSetupService.prototype.createBatch = function (incomeTypes) {
|
|
9429
|
+
var batch = [];
|
|
9430
|
+
// Salary item is completed when user added salary income source
|
|
9431
|
+
if (incomeTypes.salary) {
|
|
9432
|
+
batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(exports.IncomeSourceTypeEnum.SALARY)));
|
|
9433
|
+
}
|
|
9434
|
+
// Other income item is completed when user added at least one other income source
|
|
9435
|
+
if (incomeTypes.dividends || incomeTypes.other) {
|
|
9436
|
+
batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(exports.IncomeSourceTypeEnum.OTHER)));
|
|
9437
|
+
}
|
|
9438
|
+
// Rental income item is completed when user added at least one property
|
|
9439
|
+
if (incomeTypes.rental) {
|
|
9440
|
+
batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
|
|
9441
|
+
}
|
|
9442
|
+
// Bank feeds item is completed when user added at least one bank account (basiq or manual)
|
|
9443
|
+
batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
|
|
9444
|
+
// Logbook item is completed when user has at least one vehicle claim with any method (klms or logbook)
|
|
9445
|
+
batch.push(this.create(AccountSetupItemsEnum.WORK_LOGBOOK, this.vehicleClaimService.get()));
|
|
9446
|
+
// @TODO waiting for sole tank forecast page
|
|
9447
|
+
// Sole item is completed when user added at least one sole income source
|
|
9448
|
+
// if (incomeTypes.soleTrader) {
|
|
9449
|
+
// batch.push(
|
|
9450
|
+
// this.prepareItem(
|
|
9451
|
+
// AccountSetupItemsEnum.SOLE_INCOME,
|
|
9452
|
+
// this.getIncomeSourcesByType(IncomeSourceTypeEnum.SOLE)
|
|
9453
|
+
// )
|
|
9454
|
+
// );
|
|
9455
|
+
// }
|
|
9456
|
+
// Allocation item is completed when user added at least one transaction allocation
|
|
9457
|
+
batch.push(this.create(AccountSetupItemsEnum.TRANSACTION, this.transactionAllocationService.get()));
|
|
9458
|
+
return batch;
|
|
9459
|
+
};
|
|
9460
|
+
/**
|
|
9461
|
+
* @TODO work with collection when services refactored
|
|
9462
|
+
*/
|
|
9463
|
+
AccountSetupService.prototype.getIncomeSourcesByType = function (type) {
|
|
9464
|
+
return this.incomeSourceService.get().pipe(operators.map(function (incomeSources) {
|
|
9465
|
+
return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
|
|
9466
|
+
}));
|
|
9467
|
+
};
|
|
9468
|
+
return AccountSetupService;
|
|
9469
|
+
}());
|
|
9470
|
+
AccountSetupService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AccountSetupService, deps: [{ token: ClientIncomeTypesService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9471
|
+
AccountSetupService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AccountSetupService, providedIn: 'root' });
|
|
9472
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AccountSetupService, decorators: [{
|
|
9473
|
+
type: i0.Injectable,
|
|
9474
|
+
args: [{
|
|
9475
|
+
providedIn: 'root'
|
|
9476
|
+
}]
|
|
9477
|
+
}], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }]; } });
|
|
9478
|
+
|
|
9479
|
+
var AddressService = /** @class */ (function () {
|
|
9480
|
+
function AddressService(http, environment) {
|
|
9481
|
+
this.http = http;
|
|
9482
|
+
this.environment = environment;
|
|
9483
|
+
this.countriesSubject = new rxjs.ReplaySubject(1);
|
|
9484
|
+
}
|
|
9485
|
+
AddressService.prototype.getCountries = function () {
|
|
9486
|
+
var _this = this;
|
|
9487
|
+
if (!this._countries) {
|
|
9488
|
+
this.http.get(this.environment.apiV2 + "/countries")
|
|
9489
|
+
.pipe(operators.map(function (response) {
|
|
9490
|
+
return response['hydra:member'].map(function (item) { return classTransformer.plainToClass(Country, item); });
|
|
9491
|
+
}))
|
|
9492
|
+
.subscribe(function (countries) {
|
|
9493
|
+
_this._countries = countries;
|
|
9494
|
+
_this.countriesSubject.next(countries);
|
|
9495
|
+
});
|
|
9496
|
+
}
|
|
9497
|
+
return this.countriesSubject.asObservable();
|
|
9498
|
+
};
|
|
9499
|
+
return AddressService;
|
|
9500
|
+
}());
|
|
9501
|
+
AddressService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AddressService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9502
|
+
AddressService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AddressService, providedIn: 'root' });
|
|
9503
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AddressService, decorators: [{
|
|
9504
|
+
type: i0.Injectable,
|
|
9505
|
+
args: [{
|
|
9506
|
+
providedIn: 'root'
|
|
9507
|
+
}]
|
|
9508
|
+
}], ctorParameters: function () {
|
|
9509
|
+
return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
|
|
9510
|
+
type: i0.Inject,
|
|
9511
|
+
args: ['environment']
|
|
9512
|
+
}] }];
|
|
9513
|
+
} });
|
|
9514
|
+
|
|
9515
|
+
/**
|
|
9516
|
+
* Service to work with assets (documents, receipts, e.t.c.)
|
|
9517
|
+
*/
|
|
9518
|
+
var AssetsService = /** @class */ (function () {
|
|
9519
|
+
function AssetsService(http, userSwitcherService, environment) {
|
|
9520
|
+
this.http = http;
|
|
9521
|
+
this.userSwitcherService = userSwitcherService;
|
|
9522
|
+
this.environment = environment;
|
|
9523
|
+
this.impersonatedClient = this.userSwitcherService.get();
|
|
9524
|
+
}
|
|
9525
|
+
/**
|
|
9526
|
+
* Get asset link
|
|
9527
|
+
* @param asset to get the link for
|
|
9528
|
+
*/
|
|
9529
|
+
AssetsService.prototype.getLink = function (asset) {
|
|
9530
|
+
return this.http.get(this.environment.apiV2 + "/assets/" + asset.type + "/" + asset.id);
|
|
9531
|
+
};
|
|
9532
|
+
/**
|
|
9533
|
+
* Download asset
|
|
9534
|
+
* @param asset which should be downloaded
|
|
9535
|
+
* @TODO refactor
|
|
9536
|
+
*/
|
|
9537
|
+
AssetsService.prototype.download = function (asset) {
|
|
9538
|
+
return this.environment.apiV2 + "/assets/" + asset.type + "/" + asset.id + "/download?bearer=" + localStorage.getItem('token') + (this.impersonatedClient ? "&_switch_user=" + this.impersonatedClient : '');
|
|
9539
|
+
};
|
|
9540
|
+
// @Todo refactor to event dispatcher
|
|
9541
|
+
/**
|
|
9542
|
+
* Delete asset
|
|
9543
|
+
* @param entityId: id of asset main entity (property, folder, transaction, e.t.c.)
|
|
9544
|
+
* @param asset which should be deleted
|
|
9545
|
+
*/
|
|
9546
|
+
AssetsService.prototype.delete = function (entityId, asset) {
|
|
9547
|
+
return this.http.delete(this.environment.apiV2 + "/" + asset.entityType + "/" + entityId + "/" + asset.type + "/" + asset.id);
|
|
9548
|
+
};
|
|
9549
|
+
return AssetsService;
|
|
9550
|
+
}());
|
|
9551
|
+
AssetsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AssetsService, deps: [{ token: i1__namespace.HttpClient }, { token: UserSwitcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9552
|
+
AssetsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AssetsService, providedIn: 'root' });
|
|
9553
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: AssetsService, decorators: [{
|
|
8818
9554
|
type: i0.Injectable,
|
|
8819
9555
|
args: [{
|
|
8820
9556
|
providedIn: 'root'
|
|
8821
9557
|
}]
|
|
8822
9558
|
}], ctorParameters: function () {
|
|
8823
|
-
return [{ type: i1__namespace.HttpClient }, { type:
|
|
9559
|
+
return [{ type: i1__namespace.HttpClient }, { type: UserSwitcherService }, { type: undefined, decorators: [{
|
|
8824
9560
|
type: i0.Inject,
|
|
8825
9561
|
args: ['environment']
|
|
8826
9562
|
}] }];
|
|
8827
9563
|
} });
|
|
8828
9564
|
|
|
9565
|
+
/**
|
|
9566
|
+
* Service that handling banks logic
|
|
9567
|
+
*/
|
|
9568
|
+
var BankService = /** @class */ (function (_super) {
|
|
9569
|
+
__extends(BankService, _super);
|
|
9570
|
+
function BankService() {
|
|
9571
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9572
|
+
_this.modelClass = Bank;
|
|
9573
|
+
_this.url = 'banks';
|
|
9574
|
+
_this.isHydra = true;
|
|
9575
|
+
return _this;
|
|
9576
|
+
}
|
|
9577
|
+
return BankService;
|
|
9578
|
+
}(RestService));
|
|
9579
|
+
BankService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9580
|
+
BankService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankService, providedIn: 'root' });
|
|
9581
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankService, decorators: [{
|
|
9582
|
+
type: i0.Injectable,
|
|
9583
|
+
args: [{
|
|
9584
|
+
providedIn: 'root'
|
|
9585
|
+
}]
|
|
9586
|
+
}] });
|
|
9587
|
+
|
|
8829
9588
|
/**
|
|
8830
9589
|
* @TODO move to collection
|
|
8831
9590
|
*/
|
|
@@ -8927,14 +9686,10 @@
|
|
|
8927
9686
|
*/
|
|
8928
9687
|
var BankConnectionService = /** @class */ (function (_super) {
|
|
8929
9688
|
__extends(BankConnectionService, _super);
|
|
8930
|
-
function BankConnectionService(
|
|
8931
|
-
var _this = _super.
|
|
8932
|
-
_this.http = http;
|
|
8933
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
8934
|
-
_this.environment = environment;
|
|
9689
|
+
function BankConnectionService() {
|
|
9690
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
8935
9691
|
_this.modelClass = BankConnection;
|
|
8936
9692
|
_this.url = 'bank-connections';
|
|
8937
|
-
_this.listenEvents();
|
|
8938
9693
|
return _this;
|
|
8939
9694
|
}
|
|
8940
9695
|
BankConnectionService.prototype.listenEvents = function () {
|
|
@@ -8956,34 +9711,25 @@
|
|
|
8956
9711
|
};
|
|
8957
9712
|
return BankConnectionService;
|
|
8958
9713
|
}(RestService));
|
|
8959
|
-
BankConnectionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, deps:
|
|
9714
|
+
BankConnectionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
8960
9715
|
BankConnectionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, providedIn: 'root' });
|
|
8961
9716
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, decorators: [{
|
|
8962
9717
|
type: i0.Injectable,
|
|
8963
9718
|
args: [{
|
|
8964
9719
|
providedIn: 'root'
|
|
8965
9720
|
}]
|
|
8966
|
-
}]
|
|
8967
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
8968
|
-
type: i0.Inject,
|
|
8969
|
-
args: ['environment']
|
|
8970
|
-
}] }];
|
|
8971
|
-
} });
|
|
9721
|
+
}] });
|
|
8972
9722
|
|
|
8973
9723
|
/**
|
|
8974
9724
|
* Service for bank transactions business logic
|
|
8975
9725
|
*/
|
|
8976
9726
|
var BankTransactionService = /** @class */ (function (_super) {
|
|
8977
9727
|
__extends(BankTransactionService, _super);
|
|
8978
|
-
function BankTransactionService(
|
|
8979
|
-
var _this = _super.
|
|
8980
|
-
_this.http = http;
|
|
8981
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
8982
|
-
_this.environment = environment;
|
|
9728
|
+
function BankTransactionService() {
|
|
9729
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
8983
9730
|
// url part for BankTransaction API
|
|
8984
9731
|
_this.url = 'bank-transactions';
|
|
8985
9732
|
_this.modelClass = BankTransaction;
|
|
8986
|
-
_this.listenEvents();
|
|
8987
9733
|
return _this;
|
|
8988
9734
|
}
|
|
8989
9735
|
BankTransactionService.prototype.listenEvents = function () {
|
|
@@ -9042,19 +9788,14 @@
|
|
|
9042
9788
|
};
|
|
9043
9789
|
return BankTransactionService;
|
|
9044
9790
|
}(RestService));
|
|
9045
|
-
BankTransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankTransactionService, deps:
|
|
9791
|
+
BankTransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankTransactionService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9046
9792
|
BankTransactionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankTransactionService, providedIn: 'root' });
|
|
9047
9793
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankTransactionService, decorators: [{
|
|
9048
9794
|
type: i0.Injectable,
|
|
9049
9795
|
args: [{
|
|
9050
9796
|
providedIn: 'root'
|
|
9051
9797
|
}]
|
|
9052
|
-
}]
|
|
9053
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
9054
|
-
type: i0.Inject,
|
|
9055
|
-
args: ['environment']
|
|
9056
|
-
}] }];
|
|
9057
|
-
} });
|
|
9798
|
+
}] });
|
|
9058
9799
|
|
|
9059
9800
|
/**
|
|
9060
9801
|
* basiq is a middleman between bank and user
|
|
@@ -9062,15 +9803,11 @@
|
|
|
9062
9803
|
*/
|
|
9063
9804
|
var BasiqService = /** @class */ (function (_super) {
|
|
9064
9805
|
__extends(BasiqService, _super);
|
|
9065
|
-
function BasiqService(
|
|
9066
|
-
var _this = _super.
|
|
9067
|
-
_this.http = http;
|
|
9068
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
9069
|
-
_this.environment = environment;
|
|
9806
|
+
function BasiqService() {
|
|
9807
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9070
9808
|
_this.tokenSubject = new rxjs.ReplaySubject();
|
|
9071
9809
|
_this.url = 'basiq/accounts';
|
|
9072
9810
|
_this.modelClass = BankAccount;
|
|
9073
|
-
_this.listenEvents();
|
|
9074
9811
|
return _this;
|
|
9075
9812
|
}
|
|
9076
9813
|
/**
|
|
@@ -9133,19 +9870,14 @@
|
|
|
9133
9870
|
};
|
|
9134
9871
|
return BasiqService;
|
|
9135
9872
|
}(RestService));
|
|
9136
|
-
BasiqService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, deps:
|
|
9873
|
+
BasiqService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9137
9874
|
BasiqService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, providedIn: 'root' });
|
|
9138
9875
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, decorators: [{
|
|
9139
9876
|
type: i0.Injectable,
|
|
9140
9877
|
args: [{
|
|
9141
9878
|
providedIn: 'root'
|
|
9142
9879
|
}]
|
|
9143
|
-
}]
|
|
9144
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
9145
|
-
type: i0.Inject,
|
|
9146
|
-
args: ['environment']
|
|
9147
|
-
}] }];
|
|
9148
|
-
} });
|
|
9880
|
+
}] });
|
|
9149
9881
|
|
|
9150
9882
|
var BorrowingExpenseService = /** @class */ (function () {
|
|
9151
9883
|
function BorrowingExpenseService(http, environment) {
|
|
@@ -9385,24 +10117,19 @@
|
|
|
9385
10117
|
*/
|
|
9386
10118
|
var ChatService = /** @class */ (function (_super) {
|
|
9387
10119
|
__extends(ChatService, _super);
|
|
9388
|
-
function ChatService(http, eventDispatcherService, environment, sseService) {
|
|
9389
|
-
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
10120
|
+
function ChatService(http, eventDispatcherService, environment, toastService, sseService) {
|
|
10121
|
+
var _this = _super.call(this, http, eventDispatcherService, environment, toastService) || this;
|
|
9390
10122
|
_this.http = http;
|
|
9391
10123
|
_this.eventDispatcherService = eventDispatcherService;
|
|
9392
10124
|
_this.environment = environment;
|
|
10125
|
+
_this.toastService = toastService;
|
|
9393
10126
|
_this.sseService = sseService;
|
|
9394
10127
|
_this.modelClass = Chat;
|
|
9395
10128
|
_this.url = 'chats';
|
|
9396
10129
|
_this.isHydra = true;
|
|
9397
|
-
_this.
|
|
10130
|
+
_this.listenChats();
|
|
9398
10131
|
return _this;
|
|
9399
10132
|
}
|
|
9400
|
-
/**
|
|
9401
|
-
* SSE and Event Dispatcher Services listeners
|
|
9402
|
-
*/
|
|
9403
|
-
ChatService.prototype.listenEvents = function () {
|
|
9404
|
-
this.listenChats();
|
|
9405
|
-
};
|
|
9406
10133
|
/**
|
|
9407
10134
|
* Listen chats events
|
|
9408
10135
|
*/
|
|
@@ -9439,7 +10166,7 @@
|
|
|
9439
10166
|
};
|
|
9440
10167
|
return ChatService;
|
|
9441
10168
|
}(RestService));
|
|
9442
|
-
ChatService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ChatService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: SseService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10169
|
+
ChatService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ChatService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9443
10170
|
ChatService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ChatService, providedIn: 'root' });
|
|
9444
10171
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ChatService, decorators: [{
|
|
9445
10172
|
type: i0.Injectable,
|
|
@@ -9450,7 +10177,7 @@
|
|
|
9450
10177
|
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
9451
10178
|
type: i0.Inject,
|
|
9452
10179
|
args: ['environment']
|
|
9453
|
-
}] }, { type: SseService }];
|
|
10180
|
+
}] }, { type: ToastService }, { type: SseService }];
|
|
9454
10181
|
} });
|
|
9455
10182
|
|
|
9456
10183
|
/**
|
|
@@ -9458,24 +10185,19 @@
|
|
|
9458
10185
|
*/
|
|
9459
10186
|
var MessageService = /** @class */ (function (_super) {
|
|
9460
10187
|
__extends(MessageService, _super);
|
|
9461
|
-
function MessageService(http, eventDispatcherService, environment, sseService) {
|
|
9462
|
-
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
10188
|
+
function MessageService(http, eventDispatcherService, environment, toastService, sseService) {
|
|
10189
|
+
var _this = _super.call(this, http, eventDispatcherService, environment, toastService) || this;
|
|
9463
10190
|
_this.http = http;
|
|
9464
10191
|
_this.eventDispatcherService = eventDispatcherService;
|
|
9465
10192
|
_this.environment = environment;
|
|
10193
|
+
_this.toastService = toastService;
|
|
9466
10194
|
_this.sseService = sseService;
|
|
9467
10195
|
_this.modelClass = Message;
|
|
9468
10196
|
_this.url = 'messages';
|
|
9469
10197
|
_this.isHydra = true;
|
|
9470
|
-
_this.
|
|
10198
|
+
_this.listenMessages();
|
|
9471
10199
|
return _this;
|
|
9472
10200
|
}
|
|
9473
|
-
/**
|
|
9474
|
-
* SSE and Event Dispatcher Services listeners
|
|
9475
|
-
*/
|
|
9476
|
-
MessageService.prototype.listenEvents = function () {
|
|
9477
|
-
this.listenMessages();
|
|
9478
|
-
};
|
|
9479
10201
|
/**
|
|
9480
10202
|
* subscribe to new chat messages
|
|
9481
10203
|
*/
|
|
@@ -9498,7 +10220,7 @@
|
|
|
9498
10220
|
};
|
|
9499
10221
|
return MessageService;
|
|
9500
10222
|
}(RestService));
|
|
9501
|
-
MessageService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: MessageService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: SseService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10223
|
+
MessageService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: MessageService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9502
10224
|
MessageService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: MessageService, providedIn: 'root' });
|
|
9503
10225
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: MessageService, decorators: [{
|
|
9504
10226
|
type: i0.Injectable,
|
|
@@ -9509,7 +10231,7 @@
|
|
|
9509
10231
|
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
9510
10232
|
type: i0.Inject,
|
|
9511
10233
|
args: ['environment']
|
|
9512
|
-
}] }, { type: SseService }];
|
|
10234
|
+
}] }, { type: ToastService }, { type: SseService }];
|
|
9513
10235
|
} });
|
|
9514
10236
|
|
|
9515
10237
|
// @TODO improve base rest service and extend it
|
|
@@ -9729,15 +10451,11 @@
|
|
|
9729
10451
|
|
|
9730
10452
|
var ClientMovementService = /** @class */ (function (_super) {
|
|
9731
10453
|
__extends(ClientMovementService, _super);
|
|
9732
|
-
function ClientMovementService(
|
|
9733
|
-
var _this = _super.
|
|
9734
|
-
_this.http = http;
|
|
9735
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
9736
|
-
_this.environment = environment;
|
|
10454
|
+
function ClientMovementService() {
|
|
10455
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9737
10456
|
_this.modelClass = ClientMovement;
|
|
9738
10457
|
_this.url = 'client-movements';
|
|
9739
10458
|
_this.isHydra = true;
|
|
9740
|
-
_this.listenEvents();
|
|
9741
10459
|
return _this;
|
|
9742
10460
|
}
|
|
9743
10461
|
/**
|
|
@@ -9808,19 +10526,14 @@
|
|
|
9808
10526
|
};
|
|
9809
10527
|
return ClientMovementService;
|
|
9810
10528
|
}(RestService));
|
|
9811
|
-
ClientMovementService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ClientMovementService, deps:
|
|
10529
|
+
ClientMovementService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ClientMovementService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
9812
10530
|
ClientMovementService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ClientMovementService, providedIn: 'root' });
|
|
9813
10531
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ClientMovementService, decorators: [{
|
|
9814
10532
|
type: i0.Injectable,
|
|
9815
10533
|
args: [{
|
|
9816
10534
|
providedIn: 'root'
|
|
9817
10535
|
}]
|
|
9818
|
-
}]
|
|
9819
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
9820
|
-
type: i0.Inject,
|
|
9821
|
-
args: ['environment']
|
|
9822
|
-
}] }];
|
|
9823
|
-
} });
|
|
10536
|
+
}] });
|
|
9824
10537
|
|
|
9825
10538
|
// @Todo refactor with BaseRest service
|
|
9826
10539
|
/**
|
|
@@ -9918,14 +10631,10 @@
|
|
|
9918
10631
|
|
|
9919
10632
|
var DepreciationService = /** @class */ (function (_super) {
|
|
9920
10633
|
__extends(DepreciationService, _super);
|
|
9921
|
-
function DepreciationService(
|
|
9922
|
-
var _this = _super.
|
|
9923
|
-
_this.http = http;
|
|
9924
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
9925
|
-
_this.environment = environment;
|
|
10634
|
+
function DepreciationService() {
|
|
10635
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9926
10636
|
_this.modelClass = Depreciation;
|
|
9927
10637
|
_this.url = 'depreciations';
|
|
9928
|
-
_this.listenEvents();
|
|
9929
10638
|
return _this;
|
|
9930
10639
|
}
|
|
9931
10640
|
/**
|
|
@@ -9959,14 +10668,6 @@
|
|
|
9959
10668
|
this.listenToVehicleClaim();
|
|
9960
10669
|
this.listenToUpdatedBankAccount();
|
|
9961
10670
|
};
|
|
9962
|
-
/**
|
|
9963
|
-
* Get depreciations related to Vehicle category
|
|
9964
|
-
*/
|
|
9965
|
-
DepreciationService.prototype.getVehicleDepreciations = function () {
|
|
9966
|
-
return this.get().pipe(operators.map(function (depreciations) {
|
|
9967
|
-
return depreciations.filter(function (depreciation) { return depreciation.isVehicleDepreciation(); });
|
|
9968
|
-
}));
|
|
9969
|
-
};
|
|
9970
10671
|
DepreciationService.prototype.getOpenBalance = function (depreciation) {
|
|
9971
10672
|
return this.http.post(this.environment.apiV2 + "/" + this.url + "/opening-balance?financialYear=" + new FinancialYear().year, depreciation)
|
|
9972
10673
|
.pipe(operators.map(function (response) {
|
|
@@ -10048,30 +10749,22 @@
|
|
|
10048
10749
|
};
|
|
10049
10750
|
return DepreciationService;
|
|
10050
10751
|
}(RestService));
|
|
10051
|
-
DepreciationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DepreciationService, deps:
|
|
10752
|
+
DepreciationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DepreciationService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10052
10753
|
DepreciationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DepreciationService, providedIn: 'root' });
|
|
10053
10754
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DepreciationService, decorators: [{
|
|
10054
10755
|
type: i0.Injectable,
|
|
10055
10756
|
args: [{
|
|
10056
10757
|
providedIn: 'root'
|
|
10057
10758
|
}]
|
|
10058
|
-
}]
|
|
10059
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10060
|
-
type: i0.Inject,
|
|
10061
|
-
args: ['environment']
|
|
10062
|
-
}] }];
|
|
10063
|
-
} });
|
|
10759
|
+
}] });
|
|
10064
10760
|
|
|
10065
10761
|
/**
|
|
10066
10762
|
* Service to handle document-folders and depending documents logic
|
|
10067
10763
|
*/
|
|
10068
10764
|
var DocumentFolderService = /** @class */ (function (_super) {
|
|
10069
10765
|
__extends(DocumentFolderService, _super);
|
|
10070
|
-
function DocumentFolderService(
|
|
10071
|
-
var _this = _super.
|
|
10072
|
-
_this.http = http;
|
|
10073
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
10074
|
-
_this.environment = environment;
|
|
10766
|
+
function DocumentFolderService() {
|
|
10767
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
10075
10768
|
_this.url = 'folders';
|
|
10076
10769
|
_this.modelClass = DocumentFolder;
|
|
10077
10770
|
return _this;
|
|
@@ -10130,19 +10823,14 @@
|
|
|
10130
10823
|
};
|
|
10131
10824
|
return DocumentFolderService;
|
|
10132
10825
|
}(RestService));
|
|
10133
|
-
DocumentFolderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, deps:
|
|
10826
|
+
DocumentFolderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10134
10827
|
DocumentFolderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, providedIn: 'root' });
|
|
10135
10828
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, decorators: [{
|
|
10136
10829
|
type: i0.Injectable,
|
|
10137
10830
|
args: [{
|
|
10138
10831
|
providedIn: 'root'
|
|
10139
10832
|
}]
|
|
10140
|
-
}]
|
|
10141
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10142
|
-
type: i0.Inject,
|
|
10143
|
-
args: ['environment']
|
|
10144
|
-
}] }];
|
|
10145
|
-
} });
|
|
10833
|
+
}] });
|
|
10146
10834
|
|
|
10147
10835
|
var EmployeeService = /** @class */ (function (_super) {
|
|
10148
10836
|
__extends(EmployeeService, _super);
|
|
@@ -10256,199 +10944,90 @@
|
|
|
10256
10944
|
_this.firm = firm;
|
|
10257
10945
|
_this.firmSubject.next(_this.firm);
|
|
10258
10946
|
});
|
|
10259
|
-
}
|
|
10260
|
-
return this.firmSubject.asObservable();
|
|
10261
|
-
};
|
|
10262
|
-
FirmService.prototype.update = function (firm) {
|
|
10263
|
-
var _this = this;
|
|
10264
|
-
return this.http.put(this.environment.apiV2 + "/firms/current", firm)
|
|
10265
|
-
.pipe(operators.map(function (updatedItem) {
|
|
10266
|
-
var updatedInstance = classTransformer.plainToClass(Firm, updatedItem);
|
|
10267
|
-
_this.firmSubject.next(updatedInstance);
|
|
10268
|
-
}));
|
|
10269
|
-
};
|
|
10270
|
-
/**
|
|
10271
|
-
* get list of all registered firms
|
|
10272
|
-
*/
|
|
10273
|
-
FirmService.prototype.getAll = function () {
|
|
10274
|
-
return this.http.get(this.environment.apiV2 + "/firms")
|
|
10275
|
-
.pipe(operators.map(function (response) {
|
|
10276
|
-
return response['hydra:member'].map(function (firmBase) { return classTransformer.plainToClass(Firm, firmBase); });
|
|
10277
|
-
}));
|
|
10278
|
-
};
|
|
10279
|
-
FirmService.prototype.getByType = function (type) {
|
|
10280
|
-
return this.getAll().pipe(operators.map(function (firms) {
|
|
10281
|
-
return firms.filter(function (firm) { return firm.type === type; });
|
|
10282
|
-
}));
|
|
10283
|
-
};
|
|
10284
|
-
FirmService.prototype.updatePhoto = function (firm, photo) {
|
|
10285
|
-
var _this = this;
|
|
10286
|
-
return this.http.post(this.environment.apiV2 + "/firms/photo?_method=PUT", photo)
|
|
10287
|
-
.pipe(operators.map(function (firmPhoto) {
|
|
10288
|
-
_this.firm = classTransformer.plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
|
|
10289
|
-
_this.firmSubject.next(_this.firm);
|
|
10290
|
-
return firm;
|
|
10291
|
-
}));
|
|
10292
|
-
};
|
|
10293
|
-
return FirmService;
|
|
10294
|
-
}());
|
|
10295
|
-
FirmService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FirmService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10296
|
-
FirmService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FirmService, providedIn: 'root' });
|
|
10297
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FirmService, decorators: [{
|
|
10298
|
-
type: i0.Injectable,
|
|
10299
|
-
args: [{
|
|
10300
|
-
providedIn: 'root'
|
|
10301
|
-
}]
|
|
10302
|
-
}], ctorParameters: function () {
|
|
10303
|
-
return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
|
|
10304
|
-
type: i0.Inject,
|
|
10305
|
-
args: ['environment']
|
|
10306
|
-
}] }];
|
|
10307
|
-
} });
|
|
10308
|
-
|
|
10309
|
-
var HeaderTitleService = /** @class */ (function () {
|
|
10310
|
-
function HeaderTitleService(router, activatedRoute) {
|
|
10311
|
-
this.router = router;
|
|
10312
|
-
this.activatedRoute = activatedRoute;
|
|
10313
|
-
}
|
|
10314
|
-
HeaderTitleService.prototype.handleTitle = function () {
|
|
10315
|
-
var _this = this;
|
|
10316
|
-
return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }), operators.map(function () { return _this.activatedRoute; }), operators.map(function (route) {
|
|
10317
|
-
while (route.firstChild) {
|
|
10318
|
-
route = route.firstChild;
|
|
10319
|
-
}
|
|
10320
|
-
return route;
|
|
10321
|
-
}), operators.filter(function (route) { return route.outlet === 'primary'; }), operators.mergeMap(function (route) { return route.data; }));
|
|
10322
|
-
};
|
|
10323
|
-
return HeaderTitleService;
|
|
10324
|
-
}());
|
|
10325
|
-
HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$1.Router }, { token: i1__namespace$1.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10326
|
-
HeaderTitleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, providedIn: 'root' });
|
|
10327
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, decorators: [{
|
|
10328
|
-
type: i0.Injectable,
|
|
10329
|
-
args: [{
|
|
10330
|
-
providedIn: 'root'
|
|
10331
|
-
}]
|
|
10332
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }]; } });
|
|
10333
|
-
|
|
10334
|
-
/**
|
|
10335
|
-
* Service to work with income sources
|
|
10336
|
-
*/
|
|
10337
|
-
var IncomeSourceService = /** @class */ (function (_super) {
|
|
10338
|
-
__extends(IncomeSourceService, _super);
|
|
10339
|
-
function IncomeSourceService(http, eventDispatcherService, environment) {
|
|
10340
|
-
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
10341
|
-
_this.http = http;
|
|
10342
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
10343
|
-
_this.environment = environment;
|
|
10344
|
-
_this.url = 'income-sources';
|
|
10345
|
-
_this.modelClass = IncomeSource;
|
|
10346
|
-
_this.incomeSourceTypeSubject = new rxjs.ReplaySubject(1);
|
|
10347
|
-
return _this;
|
|
10348
|
-
}
|
|
10349
|
-
/**
|
|
10350
|
-
* Get income sources tax calculation
|
|
10351
|
-
* @param salaryForecast for which tax should be calculated
|
|
10352
|
-
*/
|
|
10353
|
-
IncomeSourceService.prototype.getTaxCalculation = function (salaryForecast) {
|
|
10354
|
-
return this.http.post(this.environment.apiV2 + "/" + this.url + "/tax-calculation", salaryForecast)
|
|
10355
|
-
.pipe(operators.map(function (response) {
|
|
10356
|
-
return classTransformer.plainToClass(SalaryForecast, response);
|
|
10357
|
-
}));
|
|
10358
|
-
};
|
|
10359
|
-
/**
|
|
10360
|
-
* Add batch of income sources
|
|
10361
|
-
* @param incomeSources to add
|
|
10362
|
-
*/
|
|
10363
|
-
IncomeSourceService.prototype.addBatch = function (incomeSources) {
|
|
10364
|
-
var _this = this;
|
|
10365
|
-
return this.http.post(this.environment.apiV2 + "/" + this.url, incomeSources)
|
|
10366
|
-
.pipe(operators.map(function (addedIncomeSources) {
|
|
10367
|
-
var _a;
|
|
10368
|
-
// assign respond income sources to provided income sources
|
|
10369
|
-
var assignedIncomeSources = addedIncomeSources
|
|
10370
|
-
.map(function (incomeSource, index) { return Object.assign(classTransformer.plainToClass(IncomeSource, {}), incomeSource, incomeSources[index]); });
|
|
10371
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.INCOME_SOURCES_CREATED, assignedIncomeSources));
|
|
10372
|
-
(_a = _this.cache).push.apply(_a, __spreadArray([], __read(assignedIncomeSources)));
|
|
10373
|
-
_this.updateCache();
|
|
10374
|
-
return assignedIncomeSources;
|
|
10375
|
-
}));
|
|
10376
|
-
};
|
|
10377
|
-
/**
|
|
10378
|
-
* Update batch of income sources
|
|
10379
|
-
*/
|
|
10380
|
-
IncomeSourceService.prototype.updateBatch = function (incomeSources, queryParams) {
|
|
10381
|
-
var _this = this;
|
|
10382
|
-
if (queryParams === void 0) { queryParams = {}; }
|
|
10383
|
-
return this.http.put(this.environment.apiV2 + "/" + this.url, incomeSources, queryParams)
|
|
10384
|
-
.pipe(operators.map(function (updatedItems) {
|
|
10385
|
-
var updatedInstances = updatedItems.map(function (item) { return _this.createModelInstance(_this.modelClass, item); });
|
|
10386
|
-
updatedInstances.forEach(function (instance) {
|
|
10387
|
-
replace(_this.cache, instance);
|
|
10388
|
-
});
|
|
10389
|
-
if (incomeSources[0].forecasts.length) {
|
|
10390
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.INCOME_SOURCES_UPDATED, incomeSources));
|
|
10391
|
-
}
|
|
10392
|
-
_this.updateCache();
|
|
10393
|
-
return updatedInstances;
|
|
10947
|
+
}
|
|
10948
|
+
return this.firmSubject.asObservable();
|
|
10949
|
+
};
|
|
10950
|
+
FirmService.prototype.update = function (firm) {
|
|
10951
|
+
var _this = this;
|
|
10952
|
+
return this.http.put(this.environment.apiV2 + "/firms/current", firm)
|
|
10953
|
+
.pipe(operators.map(function (updatedItem) {
|
|
10954
|
+
var updatedInstance = classTransformer.plainToClass(Firm, updatedItem);
|
|
10955
|
+
_this.firmSubject.next(updatedInstance);
|
|
10394
10956
|
}));
|
|
10395
10957
|
};
|
|
10396
10958
|
/**
|
|
10397
|
-
*
|
|
10398
|
-
* @param types
|
|
10959
|
+
* get list of all registered firms
|
|
10399
10960
|
*/
|
|
10400
|
-
|
|
10401
|
-
return this.get()
|
|
10402
|
-
.pipe(operators.map(function (
|
|
10403
|
-
.
|
|
10961
|
+
FirmService.prototype.getAll = function () {
|
|
10962
|
+
return this.http.get(this.environment.apiV2 + "/firms")
|
|
10963
|
+
.pipe(operators.map(function (response) {
|
|
10964
|
+
return response['hydra:member'].map(function (firmBase) { return classTransformer.plainToClass(Firm, firmBase); });
|
|
10965
|
+
}));
|
|
10404
10966
|
};
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10967
|
+
FirmService.prototype.getByType = function (type) {
|
|
10968
|
+
return this.getAll().pipe(operators.map(function (firms) {
|
|
10969
|
+
return firms.filter(function (firm) { return firm.type === type; });
|
|
10970
|
+
}));
|
|
10971
|
+
};
|
|
10972
|
+
FirmService.prototype.updatePhoto = function (firm, photo) {
|
|
10409
10973
|
var _this = this;
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
.subscribe(function (otherIncomesTypes) {
|
|
10417
|
-
_this.incomeSourceTypes = otherIncomesTypes;
|
|
10418
|
-
_this.incomeSourceTypeSubject.next(_this.incomeSourceTypes);
|
|
10419
|
-
});
|
|
10420
|
-
}
|
|
10421
|
-
return this.incomeSourceTypeSubject.asObservable();
|
|
10974
|
+
return this.http.post(this.environment.apiV2 + "/firms/photo?_method=PUT", photo)
|
|
10975
|
+
.pipe(operators.map(function (firmPhoto) {
|
|
10976
|
+
_this.firm = classTransformer.plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
|
|
10977
|
+
_this.firmSubject.next(_this.firm);
|
|
10978
|
+
return firm;
|
|
10979
|
+
}));
|
|
10422
10980
|
};
|
|
10423
|
-
return
|
|
10424
|
-
}(
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
10981
|
+
return FirmService;
|
|
10982
|
+
}());
|
|
10983
|
+
FirmService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FirmService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10984
|
+
FirmService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FirmService, providedIn: 'root' });
|
|
10985
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FirmService, decorators: [{
|
|
10428
10986
|
type: i0.Injectable,
|
|
10429
10987
|
args: [{
|
|
10430
10988
|
providedIn: 'root'
|
|
10431
10989
|
}]
|
|
10432
10990
|
}], ctorParameters: function () {
|
|
10433
|
-
return [{ type: i1__namespace.HttpClient }, { type:
|
|
10991
|
+
return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
|
|
10434
10992
|
type: i0.Inject,
|
|
10435
10993
|
args: ['environment']
|
|
10436
10994
|
}] }];
|
|
10437
10995
|
} });
|
|
10438
10996
|
|
|
10997
|
+
var HeaderTitleService = /** @class */ (function () {
|
|
10998
|
+
function HeaderTitleService(router, activatedRoute) {
|
|
10999
|
+
this.router = router;
|
|
11000
|
+
this.activatedRoute = activatedRoute;
|
|
11001
|
+
}
|
|
11002
|
+
HeaderTitleService.prototype.handleTitle = function () {
|
|
11003
|
+
var _this = this;
|
|
11004
|
+
return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }), operators.map(function () { return _this.activatedRoute; }), operators.map(function (route) {
|
|
11005
|
+
while (route.firstChild) {
|
|
11006
|
+
route = route.firstChild;
|
|
11007
|
+
}
|
|
11008
|
+
return route;
|
|
11009
|
+
}), operators.filter(function (route) { return route.outlet === 'primary'; }), operators.mergeMap(function (route) { return route.data; }));
|
|
11010
|
+
};
|
|
11011
|
+
return HeaderTitleService;
|
|
11012
|
+
}());
|
|
11013
|
+
HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$1.Router }, { token: i1__namespace$1.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11014
|
+
HeaderTitleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, providedIn: 'root' });
|
|
11015
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, decorators: [{
|
|
11016
|
+
type: i0.Injectable,
|
|
11017
|
+
args: [{
|
|
11018
|
+
providedIn: 'root'
|
|
11019
|
+
}]
|
|
11020
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }]; } });
|
|
11021
|
+
|
|
10439
11022
|
/**
|
|
10440
11023
|
* Service to work with Other Income Forecasts
|
|
10441
11024
|
*/
|
|
10442
11025
|
var IncomeSourceForecastService = /** @class */ (function (_super) {
|
|
10443
11026
|
__extends(IncomeSourceForecastService, _super);
|
|
10444
|
-
function IncomeSourceForecastService(
|
|
10445
|
-
var _this = _super.
|
|
10446
|
-
_this.http = http;
|
|
10447
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
10448
|
-
_this.environment = environment;
|
|
11027
|
+
function IncomeSourceForecastService() {
|
|
11028
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
10449
11029
|
_this.modelClass = IncomeSourceForecast;
|
|
10450
11030
|
_this.url = 'income-source-forecasts';
|
|
10451
|
-
_this.listenEvents();
|
|
10452
11031
|
return _this;
|
|
10453
11032
|
}
|
|
10454
11033
|
/**
|
|
@@ -10508,33 +11087,24 @@
|
|
|
10508
11087
|
};
|
|
10509
11088
|
return IncomeSourceForecastService;
|
|
10510
11089
|
}(RestService));
|
|
10511
|
-
IncomeSourceForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceForecastService, deps:
|
|
11090
|
+
IncomeSourceForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceForecastService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10512
11091
|
IncomeSourceForecastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceForecastService, providedIn: 'root' });
|
|
10513
11092
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceForecastService, decorators: [{
|
|
10514
11093
|
type: i0.Injectable,
|
|
10515
11094
|
args: [{
|
|
10516
11095
|
providedIn: 'root'
|
|
10517
11096
|
}]
|
|
10518
|
-
}]
|
|
10519
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10520
|
-
type: i0.Inject,
|
|
10521
|
-
args: ['environment']
|
|
10522
|
-
}] }];
|
|
10523
|
-
} });
|
|
11097
|
+
}] });
|
|
10524
11098
|
|
|
10525
11099
|
/**
|
|
10526
11100
|
* Service to work with Salary Forecasts
|
|
10527
11101
|
*/
|
|
10528
11102
|
var SalaryForecastService = /** @class */ (function (_super) {
|
|
10529
11103
|
__extends(SalaryForecastService, _super);
|
|
10530
|
-
function SalaryForecastService(
|
|
10531
|
-
var _this = _super.
|
|
10532
|
-
_this.http = http;
|
|
10533
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
10534
|
-
_this.environment = environment;
|
|
11104
|
+
function SalaryForecastService() {
|
|
11105
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
10535
11106
|
_this.modelClass = SalaryForecast;
|
|
10536
11107
|
_this.url = 'salary-forecasts';
|
|
10537
|
-
_this.listenEvents();
|
|
10538
11108
|
return _this;
|
|
10539
11109
|
}
|
|
10540
11110
|
/**
|
|
@@ -10594,30 +11164,21 @@
|
|
|
10594
11164
|
};
|
|
10595
11165
|
return SalaryForecastService;
|
|
10596
11166
|
}(RestService));
|
|
10597
|
-
SalaryForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SalaryForecastService, deps:
|
|
11167
|
+
SalaryForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SalaryForecastService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10598
11168
|
SalaryForecastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SalaryForecastService, providedIn: 'root' });
|
|
10599
11169
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SalaryForecastService, decorators: [{
|
|
10600
11170
|
type: i0.Injectable,
|
|
10601
11171
|
args: [{
|
|
10602
11172
|
providedIn: 'root'
|
|
10603
11173
|
}]
|
|
10604
|
-
}]
|
|
10605
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10606
|
-
type: i0.Inject,
|
|
10607
|
-
args: ['environment']
|
|
10608
|
-
}] }];
|
|
10609
|
-
} });
|
|
11174
|
+
}] });
|
|
10610
11175
|
|
|
10611
11176
|
var SoleForecastService = /** @class */ (function (_super) {
|
|
10612
11177
|
__extends(SoleForecastService, _super);
|
|
10613
|
-
function SoleForecastService(
|
|
10614
|
-
var _this = _super.
|
|
10615
|
-
_this.http = http;
|
|
10616
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
10617
|
-
_this.environment = environment;
|
|
11178
|
+
function SoleForecastService() {
|
|
11179
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
10618
11180
|
_this.modelClass = SoleForecast;
|
|
10619
11181
|
_this.url = 'sole-forecasts';
|
|
10620
|
-
_this.listenEvents();
|
|
10621
11182
|
return _this;
|
|
10622
11183
|
}
|
|
10623
11184
|
/**
|
|
@@ -10677,19 +11238,14 @@
|
|
|
10677
11238
|
};
|
|
10678
11239
|
return SoleForecastService;
|
|
10679
11240
|
}(RestService));
|
|
10680
|
-
SoleForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, deps:
|
|
11241
|
+
SoleForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10681
11242
|
SoleForecastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, providedIn: 'root' });
|
|
10682
11243
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, decorators: [{
|
|
10683
11244
|
type: i0.Injectable,
|
|
10684
11245
|
args: [{
|
|
10685
11246
|
providedIn: 'root'
|
|
10686
11247
|
}]
|
|
10687
|
-
}]
|
|
10688
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10689
|
-
type: i0.Inject,
|
|
10690
|
-
args: ['environment']
|
|
10691
|
-
}] }];
|
|
10692
|
-
} });
|
|
11248
|
+
}] });
|
|
10693
11249
|
|
|
10694
11250
|
/**
|
|
10695
11251
|
* Service to work with intercom
|
|
@@ -10766,14 +11322,10 @@
|
|
|
10766
11322
|
*/
|
|
10767
11323
|
var LoanService = /** @class */ (function (_super) {
|
|
10768
11324
|
__extends(LoanService, _super);
|
|
10769
|
-
function LoanService(
|
|
10770
|
-
var _this = _super.
|
|
10771
|
-
_this.http = http;
|
|
10772
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
10773
|
-
_this.environment = environment;
|
|
11325
|
+
function LoanService() {
|
|
11326
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
10774
11327
|
_this.url = 'bank-accounts/loans';
|
|
10775
11328
|
_this.modelClass = Loan;
|
|
10776
|
-
_this.listenEvents();
|
|
10777
11329
|
return _this;
|
|
10778
11330
|
}
|
|
10779
11331
|
/**
|
|
@@ -10891,43 +11443,33 @@
|
|
|
10891
11443
|
};
|
|
10892
11444
|
return LoanService;
|
|
10893
11445
|
}(RestService));
|
|
10894
|
-
LoanService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LoanService, deps:
|
|
11446
|
+
LoanService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LoanService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10895
11447
|
LoanService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LoanService, providedIn: 'root' });
|
|
10896
11448
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LoanService, decorators: [{
|
|
10897
11449
|
type: i0.Injectable,
|
|
10898
11450
|
args: [{
|
|
10899
11451
|
providedIn: 'root'
|
|
10900
11452
|
}]
|
|
10901
|
-
}]
|
|
10902
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10903
|
-
type: i0.Inject,
|
|
10904
|
-
args: ['environment']
|
|
10905
|
-
}] }];
|
|
10906
|
-
} });
|
|
11453
|
+
}] });
|
|
10907
11454
|
|
|
10908
11455
|
/**
|
|
10909
11456
|
* Service to handle service notifications logic
|
|
10910
11457
|
*/
|
|
10911
11458
|
var ServiceNotificationService = /** @class */ (function (_super) {
|
|
10912
11459
|
__extends(ServiceNotificationService, _super);
|
|
10913
|
-
function ServiceNotificationService(http, eventDispatcherService, environment, sseService) {
|
|
10914
|
-
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
11460
|
+
function ServiceNotificationService(http, eventDispatcherService, environment, toastService, sseService) {
|
|
11461
|
+
var _this = _super.call(this, http, eventDispatcherService, environment, toastService) || this;
|
|
10915
11462
|
_this.http = http;
|
|
10916
11463
|
_this.eventDispatcherService = eventDispatcherService;
|
|
10917
11464
|
_this.environment = environment;
|
|
11465
|
+
_this.toastService = toastService;
|
|
10918
11466
|
_this.sseService = sseService;
|
|
10919
11467
|
_this.modelClass = Notification;
|
|
10920
11468
|
_this.url = 'service-notifications';
|
|
10921
11469
|
_this.isHydra = true;
|
|
10922
|
-
_this.
|
|
11470
|
+
_this.listenNotifications();
|
|
10923
11471
|
return _this;
|
|
10924
11472
|
}
|
|
10925
|
-
/**
|
|
10926
|
-
* SSE and Event Dispatcher Services listeners
|
|
10927
|
-
*/
|
|
10928
|
-
ServiceNotificationService.prototype.listenEvents = function () {
|
|
10929
|
-
this.listenNotifications();
|
|
10930
|
-
};
|
|
10931
11473
|
/**
|
|
10932
11474
|
* subscribe to new chat messages
|
|
10933
11475
|
*/
|
|
@@ -10950,7 +11492,7 @@
|
|
|
10950
11492
|
};
|
|
10951
11493
|
return ServiceNotificationService;
|
|
10952
11494
|
}(RestService));
|
|
10953
|
-
ServiceNotificationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServiceNotificationService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: SseService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11495
|
+
ServiceNotificationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServiceNotificationService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10954
11496
|
ServiceNotificationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServiceNotificationService, providedIn: 'root' });
|
|
10955
11497
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ServiceNotificationService, decorators: [{
|
|
10956
11498
|
type: i0.Injectable,
|
|
@@ -10961,7 +11503,7 @@
|
|
|
10961
11503
|
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10962
11504
|
type: i0.Inject,
|
|
10963
11505
|
args: ['environment']
|
|
10964
|
-
}] }, { type: SseService }];
|
|
11506
|
+
}] }, { type: ToastService }, { type: SseService }];
|
|
10965
11507
|
} });
|
|
10966
11508
|
|
|
10967
11509
|
/**
|
|
@@ -10983,7 +11525,7 @@
|
|
|
10983
11525
|
src: '/assets/img/icons/logo.png',
|
|
10984
11526
|
width: 30,
|
|
10985
11527
|
height: 7,
|
|
10986
|
-
positionX:
|
|
11528
|
+
positionX: 42,
|
|
10987
11529
|
positionY: 6
|
|
10988
11530
|
},
|
|
10989
11531
|
// coords for file section title (group, table, e.t.c.)
|
|
@@ -11016,21 +11558,21 @@
|
|
|
11016
11558
|
/**
|
|
11017
11559
|
* Export file from provided HTML tables
|
|
11018
11560
|
*/
|
|
11019
|
-
PdfService.prototype.exportTables = function (tables,
|
|
11020
|
-
var document = this.generateFromTables(tables,
|
|
11021
|
-
document.save(
|
|
11561
|
+
PdfService.prototype.exportTables = function (tables, fileSettings) {
|
|
11562
|
+
var document = this.generateFromTables(tables, fileSettings);
|
|
11563
|
+
document.save(fileSettings.filename + ".pdf");
|
|
11022
11564
|
};
|
|
11023
11565
|
/**
|
|
11024
11566
|
* Export file from provided array-like table data
|
|
11025
11567
|
*/
|
|
11026
|
-
PdfService.prototype.exportFromDataTables = function (dataTables,
|
|
11027
|
-
var document = this.generateFromDataTables(
|
|
11028
|
-
document.save(
|
|
11568
|
+
PdfService.prototype.exportFromDataTables = function (dataTables, fileSettings) {
|
|
11569
|
+
var document = this.generateFromDataTables(dataTables, fileSettings.title);
|
|
11570
|
+
document.save(fileSettings.filename + ".pdf");
|
|
11029
11571
|
};
|
|
11030
11572
|
/**
|
|
11031
11573
|
* Generate file from array-like table data
|
|
11032
11574
|
*/
|
|
11033
|
-
PdfService.prototype.generateFromDataTables = function (
|
|
11575
|
+
PdfService.prototype.generateFromDataTables = function (dataTables, title) {
|
|
11034
11576
|
var _this = this;
|
|
11035
11577
|
var pdf = new jsPDF__default["default"]();
|
|
11036
11578
|
this.setDocumentTitle(pdf, title);
|
|
@@ -11040,10 +11582,10 @@
|
|
|
11040
11582
|
});
|
|
11041
11583
|
return pdf;
|
|
11042
11584
|
};
|
|
11043
|
-
PdfService.prototype.generateFromTables = function (tables,
|
|
11585
|
+
PdfService.prototype.generateFromTables = function (tables, fileSettings) {
|
|
11044
11586
|
var _this = this;
|
|
11045
|
-
var pdf = new jsPDF__default["default"]();
|
|
11046
|
-
this.setDocumentTitle(pdf, title);
|
|
11587
|
+
var pdf = new jsPDF__default["default"](fileSettings.orientation);
|
|
11588
|
+
this.setDocumentTitle(pdf, fileSettings.title);
|
|
11047
11589
|
this.setDocumentLogo(pdf);
|
|
11048
11590
|
tables.forEach(function (table) {
|
|
11049
11591
|
// Add table caption if not provided
|
|
@@ -11082,151 +11624,25 @@
|
|
|
11082
11624
|
};
|
|
11083
11625
|
};
|
|
11084
11626
|
PdfService.prototype.setDocumentTitle = function (doc, title) {
|
|
11085
|
-
doc.setFontSize(PDF_CONFIG.text.fontSize)
|
|
11086
|
-
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
11087
|
-
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
11088
|
-
};
|
|
11089
|
-
PdfService.prototype.setDocumentLogo = function (doc) {
|
|
11090
|
-
var logo = new Image();
|
|
11091
|
-
logo.src = PDF_CONFIG.logo.src;
|
|
11092
|
-
doc.addImage(logo, 'PNG', PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
11093
|
-
};
|
|
11094
|
-
return PdfService;
|
|
11095
|
-
}());
|
|
11096
|
-
PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11097
|
-
PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
|
|
11098
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
|
|
11099
|
-
type: i0.Injectable,
|
|
11100
|
-
args: [{
|
|
11101
|
-
providedIn: 'root'
|
|
11102
|
-
}]
|
|
11103
|
-
}] });
|
|
11104
|
-
|
|
11105
|
-
/**
|
|
11106
|
-
* Service for work with Property
|
|
11107
|
-
*/
|
|
11108
|
-
var PropertyService = /** @class */ (function (_super) {
|
|
11109
|
-
__extends(PropertyService, _super);
|
|
11110
|
-
function PropertyService(http, eventDispatcherService, environment) {
|
|
11111
|
-
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
11112
|
-
_this.http = http;
|
|
11113
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
11114
|
-
_this.environment = environment;
|
|
11115
|
-
_this.modelClass = Property;
|
|
11116
|
-
_this.url = 'properties';
|
|
11117
|
-
_this.listenEvents();
|
|
11118
|
-
return _this;
|
|
11119
|
-
}
|
|
11120
|
-
PropertyService.prototype.listenEvents = function () {
|
|
11121
|
-
this.listenShareInviteAccepted();
|
|
11122
|
-
this.listenServiceSubscriptionUpdated();
|
|
11123
|
-
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
11124
|
-
this.listenMovementsChanged();
|
|
11125
|
-
};
|
|
11126
|
-
/**
|
|
11127
|
-
* Update cache when share invitation accepted
|
|
11128
|
-
*/
|
|
11129
|
-
PropertyService.prototype.listenShareInviteAccepted = function () {
|
|
11130
|
-
var _this = this;
|
|
11131
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
11132
|
-
};
|
|
11133
|
-
/**
|
|
11134
|
-
* Update cache when user's service subscription is updated
|
|
11135
|
-
*/
|
|
11136
|
-
PropertyService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
11137
|
-
var _this = this;
|
|
11138
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
11139
|
-
};
|
|
11140
|
-
/**
|
|
11141
|
-
* Update cache when property category changed
|
|
11142
|
-
*/
|
|
11143
|
-
PropertyService.prototype.listenMovementsChanged = function () {
|
|
11144
|
-
var _this = this;
|
|
11145
|
-
// @TODO change dispatcher logic to work with multiple events
|
|
11146
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED).subscribe(function () { return _this.resetCache(); });
|
|
11147
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
11148
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_DELETED).subscribe(function () { return _this.resetCache(); });
|
|
11149
|
-
};
|
|
11150
|
-
PropertyService.prototype.update = function (property) {
|
|
11151
|
-
var _this = this;
|
|
11152
|
-
return _super.prototype.update.call(this, property).pipe(operators.map(function (updatedProperty) {
|
|
11153
|
-
if (property.documentFile) {
|
|
11154
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_UPDATED_WITH_DOCUMENT, property));
|
|
11155
|
-
}
|
|
11156
|
-
return updatedProperty;
|
|
11157
|
-
}));
|
|
11158
|
-
};
|
|
11159
|
-
PropertyService.prototype.getByCategoryId = function (id) {
|
|
11160
|
-
return this.get().pipe(operators.map(function (properties) {
|
|
11161
|
-
return properties.filter(function (property) { return property.category.id === id; });
|
|
11162
|
-
}));
|
|
11163
|
-
};
|
|
11164
|
-
/**
|
|
11165
|
-
* Activate deactivated property
|
|
11166
|
-
*/
|
|
11167
|
-
PropertyService.prototype.activate = function (property) {
|
|
11168
|
-
var _this = this;
|
|
11169
|
-
return this.http.post(this.environment.apiV2 + "/property-subscriptions", { user: property.user, property: property })
|
|
11170
|
-
.pipe(operators.map(function (propertySubscriptionBase) {
|
|
11171
|
-
var newPropertySubscription = classTransformer.plainToClass(PropertySubscription, propertySubscriptionBase);
|
|
11172
|
-
var activatedProperty = classTransformer.plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
|
|
11173
|
-
replace(_this.cache, activatedProperty);
|
|
11174
|
-
_this.updateCache();
|
|
11175
|
-
}));
|
|
11176
|
-
};
|
|
11177
|
-
/**
|
|
11178
|
-
* Deactivate activated property
|
|
11179
|
-
*/
|
|
11180
|
-
PropertyService.prototype.deactivate = function (property) {
|
|
11181
|
-
var _this = this;
|
|
11182
|
-
return this.http.delete(this.environment.apiV2 + "/property-subscriptions/" + property.getCurrentSubscription().id)
|
|
11183
|
-
.pipe(operators.map(function () {
|
|
11184
|
-
var deactivatedProperty = classTransformer.plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
|
|
11185
|
-
replace(_this.cache, deactivatedProperty);
|
|
11186
|
-
_this.updateCache();
|
|
11187
|
-
}));
|
|
11188
|
-
};
|
|
11189
|
-
/**
|
|
11190
|
-
* Update property photo
|
|
11191
|
-
* @param property Property instance for photo update
|
|
11192
|
-
* @param photoFormData FormData with property photo image
|
|
11193
|
-
*/
|
|
11194
|
-
PropertyService.prototype.updatePhoto = function (property, photoFormData) {
|
|
11195
|
-
var _this = this;
|
|
11196
|
-
return this.http.post(this.environment.apiV2 + "/properties/" + property.id + "/photo?_method=PUT", photoFormData)
|
|
11197
|
-
.pipe(operators.map(function (photoLink) {
|
|
11198
|
-
property.photo = photoLink;
|
|
11199
|
-
// update properties cache
|
|
11200
|
-
replace(_this.cache, property);
|
|
11201
|
-
_this.updateCache();
|
|
11202
|
-
}));
|
|
11203
|
-
};
|
|
11204
|
-
PropertyService.prototype.getByShareId = function (id) {
|
|
11205
|
-
return this.get().pipe(operators.map(function (properties) {
|
|
11206
|
-
return properties.filter(function (property) { return property.user.id === id; });
|
|
11207
|
-
}));
|
|
11627
|
+
doc.setFontSize(PDF_CONFIG.text.fontSize)
|
|
11628
|
+
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
11629
|
+
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
11208
11630
|
};
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
return this.get().pipe(operators.map(function (properties) { return properties.filter(function (property) { return property.isActive; }); }));
|
|
11631
|
+
PdfService.prototype.setDocumentLogo = function (doc) {
|
|
11632
|
+
var logo = new Image();
|
|
11633
|
+
logo.src = PDF_CONFIG.logo.src;
|
|
11634
|
+
doc.addImage(logo, 'PNG', doc.internal.pageSize.width - PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
11214
11635
|
};
|
|
11215
|
-
return
|
|
11216
|
-
}(
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
11636
|
+
return PdfService;
|
|
11637
|
+
}());
|
|
11638
|
+
PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11639
|
+
PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
|
|
11640
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
|
|
11220
11641
|
type: i0.Injectable,
|
|
11221
11642
|
args: [{
|
|
11222
11643
|
providedIn: 'root'
|
|
11223
11644
|
}]
|
|
11224
|
-
}]
|
|
11225
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
11226
|
-
type: i0.Inject,
|
|
11227
|
-
args: ['environment']
|
|
11228
|
-
}] }];
|
|
11229
|
-
} });
|
|
11645
|
+
}] });
|
|
11230
11646
|
|
|
11231
11647
|
function enumToList(data) {
|
|
11232
11648
|
var list = [];
|
|
@@ -11248,74 +11664,17 @@
|
|
|
11248
11664
|
MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
|
|
11249
11665
|
})(MessagesEnum || (MessagesEnum = {}));
|
|
11250
11666
|
|
|
11251
|
-
/**
|
|
11252
|
-
* popup notifications service (toast, snackbar).
|
|
11253
|
-
*/
|
|
11254
|
-
var ToastService = /** @class */ (function () {
|
|
11255
|
-
function ToastService() {
|
|
11256
|
-
this.toast$ = new rxjs.ReplaySubject(1);
|
|
11257
|
-
}
|
|
11258
|
-
ToastService.prototype.get = function () {
|
|
11259
|
-
return this.toast$.asObservable();
|
|
11260
|
-
};
|
|
11261
|
-
ToastService.prototype.add = function (toast) {
|
|
11262
|
-
this.toast$.next(toast);
|
|
11263
|
-
};
|
|
11264
|
-
ToastService.prototype.success = function (message) {
|
|
11265
|
-
this.add(classTransformer.plainToClass(Toast, {
|
|
11266
|
-
type: exports.ToastTypeEnum.SUCCESS,
|
|
11267
|
-
title: 'Success!',
|
|
11268
|
-
message: message,
|
|
11269
|
-
}));
|
|
11270
|
-
};
|
|
11271
|
-
ToastService.prototype.warning = function (message) {
|
|
11272
|
-
this.add(classTransformer.plainToClass(Toast, {
|
|
11273
|
-
type: exports.ToastTypeEnum.WARNING,
|
|
11274
|
-
title: 'Warning!',
|
|
11275
|
-
message: message,
|
|
11276
|
-
}));
|
|
11277
|
-
};
|
|
11278
|
-
ToastService.prototype.error = function (message) {
|
|
11279
|
-
this.add(classTransformer.plainToClass(Toast, {
|
|
11280
|
-
type: exports.ToastTypeEnum.ERROR,
|
|
11281
|
-
title: 'Error!',
|
|
11282
|
-
message: message,
|
|
11283
|
-
}));
|
|
11284
|
-
};
|
|
11285
|
-
ToastService.prototype.info = function (message) {
|
|
11286
|
-
this.add(classTransformer.plainToClass(Toast, {
|
|
11287
|
-
type: exports.ToastTypeEnum.INFO,
|
|
11288
|
-
title: 'Information',
|
|
11289
|
-
message: message,
|
|
11290
|
-
}));
|
|
11291
|
-
};
|
|
11292
|
-
return ToastService;
|
|
11293
|
-
}());
|
|
11294
|
-
ToastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ToastService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11295
|
-
ToastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ToastService, providedIn: 'root' });
|
|
11296
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ToastService, decorators: [{
|
|
11297
|
-
type: i0.Injectable,
|
|
11298
|
-
args: [{
|
|
11299
|
-
providedIn: 'root'
|
|
11300
|
-
}]
|
|
11301
|
-
}] });
|
|
11302
|
-
|
|
11303
11667
|
/**
|
|
11304
11668
|
* Service for transactions business logic
|
|
11305
11669
|
*/
|
|
11306
11670
|
var TransactionService = /** @class */ (function (_super) {
|
|
11307
11671
|
__extends(TransactionService, _super);
|
|
11308
|
-
function TransactionService(
|
|
11309
|
-
var _this = _super.
|
|
11310
|
-
_this.http = http;
|
|
11311
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
11312
|
-
_this.environment = environment;
|
|
11313
|
-
_this.toastService = toastService;
|
|
11672
|
+
function TransactionService() {
|
|
11673
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
11314
11674
|
// url part for Transaction API
|
|
11315
11675
|
_this.url = 'transactions';
|
|
11316
11676
|
_this.modelClass = Transaction;
|
|
11317
11677
|
_this.transactionDeleted = new i0.EventEmitter();
|
|
11318
|
-
_this.listenEvents();
|
|
11319
11678
|
return _this;
|
|
11320
11679
|
}
|
|
11321
11680
|
/**
|
|
@@ -11591,14 +11950,6 @@
|
|
|
11591
11950
|
return null;
|
|
11592
11951
|
}
|
|
11593
11952
|
};
|
|
11594
|
-
/**
|
|
11595
|
-
* Get transactions related to Vehicle category
|
|
11596
|
-
*/
|
|
11597
|
-
TransactionService.prototype.getVehicleTransactions = function () {
|
|
11598
|
-
return this.get().pipe(operators.map(function (transactions) {
|
|
11599
|
-
return transactions.filter(function (transaction) { return transaction.isVehicleTransaction(); });
|
|
11600
|
-
}));
|
|
11601
|
-
};
|
|
11602
11953
|
/**
|
|
11603
11954
|
* Listen to EventDispatcherService event related to Depreciation changing
|
|
11604
11955
|
*/
|
|
@@ -11621,19 +11972,14 @@
|
|
|
11621
11972
|
};
|
|
11622
11973
|
return TransactionService;
|
|
11623
11974
|
}(RestService));
|
|
11624
|
-
TransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, deps:
|
|
11975
|
+
TransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11625
11976
|
TransactionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, providedIn: 'root' });
|
|
11626
11977
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, decorators: [{
|
|
11627
11978
|
type: i0.Injectable,
|
|
11628
11979
|
args: [{
|
|
11629
11980
|
providedIn: 'root'
|
|
11630
11981
|
}]
|
|
11631
|
-
}]
|
|
11632
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
11633
|
-
type: i0.Inject,
|
|
11634
|
-
args: ['environment']
|
|
11635
|
-
}] }, { type: ToastService }];
|
|
11636
|
-
} });
|
|
11982
|
+
}] });
|
|
11637
11983
|
|
|
11638
11984
|
/**
|
|
11639
11985
|
* Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
|
|
@@ -11899,14 +12245,10 @@
|
|
|
11899
12245
|
*/
|
|
11900
12246
|
var PropertyDocumentService = /** @class */ (function (_super) {
|
|
11901
12247
|
__extends(PropertyDocumentService, _super);
|
|
11902
|
-
function PropertyDocumentService(
|
|
11903
|
-
var _this = _super.
|
|
11904
|
-
_this.http = http;
|
|
11905
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
11906
|
-
_this.environment = environment;
|
|
12248
|
+
function PropertyDocumentService() {
|
|
12249
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
11907
12250
|
_this.modelClass = PropertyDocument;
|
|
11908
12251
|
_this.url = 'properties/documents';
|
|
11909
|
-
_this.listenEvents();
|
|
11910
12252
|
return _this;
|
|
11911
12253
|
}
|
|
11912
12254
|
/**
|
|
@@ -11948,32 +12290,23 @@
|
|
|
11948
12290
|
};
|
|
11949
12291
|
return PropertyDocumentService;
|
|
11950
12292
|
}(RestService));
|
|
11951
|
-
PropertyDocumentService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyDocumentService, deps:
|
|
12293
|
+
PropertyDocumentService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyDocumentService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11952
12294
|
PropertyDocumentService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyDocumentService, providedIn: 'root' });
|
|
11953
12295
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyDocumentService, decorators: [{
|
|
11954
12296
|
type: i0.Injectable,
|
|
11955
12297
|
args: [{
|
|
11956
12298
|
providedIn: 'root'
|
|
11957
12299
|
}]
|
|
11958
|
-
}]
|
|
11959
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
11960
|
-
type: i0.Inject,
|
|
11961
|
-
args: ['environment']
|
|
11962
|
-
}] }];
|
|
11963
|
-
} });
|
|
12300
|
+
}] });
|
|
11964
12301
|
|
|
11965
12302
|
// @TODO check and improve logic during refactoring
|
|
11966
12303
|
var PropertyShareService = /** @class */ (function (_super) {
|
|
11967
12304
|
__extends(PropertyShareService, _super);
|
|
11968
|
-
function PropertyShareService(
|
|
11969
|
-
var _this = _super.
|
|
11970
|
-
_this.http = http;
|
|
11971
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
11972
|
-
_this.environment = environment;
|
|
12305
|
+
function PropertyShareService() {
|
|
12306
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
11973
12307
|
// api url parameter for properties shares
|
|
11974
12308
|
_this.url = 'properties/shares';
|
|
11975
12309
|
_this.modelClass = PropertyShare;
|
|
11976
|
-
_this.listenEvents();
|
|
11977
12310
|
return _this;
|
|
11978
12311
|
}
|
|
11979
12312
|
/**
|
|
@@ -12060,19 +12393,14 @@
|
|
|
12060
12393
|
};
|
|
12061
12394
|
return PropertyShareService;
|
|
12062
12395
|
}(RestService));
|
|
12063
|
-
PropertyShareService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, deps:
|
|
12396
|
+
PropertyShareService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12064
12397
|
PropertyShareService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, providedIn: 'root' });
|
|
12065
12398
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, decorators: [{
|
|
12066
12399
|
type: i0.Injectable,
|
|
12067
12400
|
args: [{
|
|
12068
12401
|
providedIn: 'root'
|
|
12069
12402
|
}]
|
|
12070
|
-
}]
|
|
12071
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12072
|
-
type: i0.Inject,
|
|
12073
|
-
args: ['environment']
|
|
12074
|
-
}] }];
|
|
12075
|
-
} });
|
|
12403
|
+
}] });
|
|
12076
12404
|
|
|
12077
12405
|
var PropertySaleService = /** @class */ (function (_super) {
|
|
12078
12406
|
__extends(PropertySaleService, _super);
|
|
@@ -12190,11 +12518,8 @@
|
|
|
12190
12518
|
this.serviceSubscriptionsSubject = new rxjs.ReplaySubject(1);
|
|
12191
12519
|
this.servicePaymentsSubject = new rxjs.ReplaySubject(1);
|
|
12192
12520
|
this.subscriptionChangeSubject = new rxjs.BehaviorSubject(null);
|
|
12193
|
-
this.listenEvents();
|
|
12194
|
-
}
|
|
12195
|
-
SubscriptionService.prototype.listenEvents = function () {
|
|
12196
12521
|
this.listenSubscriptions();
|
|
12197
|
-
}
|
|
12522
|
+
}
|
|
12198
12523
|
SubscriptionService.prototype.getSubscription = function (force) {
|
|
12199
12524
|
var _this = this;
|
|
12200
12525
|
if (force === void 0) { force = false; }
|
|
@@ -12339,14 +12664,10 @@
|
|
|
12339
12664
|
*/
|
|
12340
12665
|
var TaxReviewService = /** @class */ (function (_super) {
|
|
12341
12666
|
__extends(TaxReviewService, _super);
|
|
12342
|
-
function TaxReviewService(
|
|
12343
|
-
var _this = _super.
|
|
12344
|
-
_this.http = http;
|
|
12345
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
12346
|
-
_this.environment = environment;
|
|
12667
|
+
function TaxReviewService() {
|
|
12668
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12347
12669
|
_this.url = 'tax-reviews';
|
|
12348
12670
|
_this.modelClass = TaxReview;
|
|
12349
|
-
_this.listenEvents();
|
|
12350
12671
|
return _this;
|
|
12351
12672
|
}
|
|
12352
12673
|
/**
|
|
@@ -12420,200 +12741,110 @@
|
|
|
12420
12741
|
};
|
|
12421
12742
|
return TaxReviewService;
|
|
12422
12743
|
}(RestService));
|
|
12423
|
-
TaxReviewService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewService, deps:
|
|
12744
|
+
TaxReviewService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12424
12745
|
TaxReviewService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewService, providedIn: 'root' });
|
|
12425
12746
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewService, decorators: [{
|
|
12426
12747
|
type: i0.Injectable,
|
|
12427
12748
|
args: [{
|
|
12428
12749
|
providedIn: 'root'
|
|
12429
12750
|
}]
|
|
12430
|
-
}]
|
|
12431
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12432
|
-
type: i0.Inject,
|
|
12433
|
-
args: ['environment']
|
|
12434
|
-
}] }];
|
|
12435
|
-
} });
|
|
12751
|
+
}] });
|
|
12436
12752
|
|
|
12437
12753
|
/**
|
|
12438
12754
|
* Service to work with tax review history
|
|
12439
12755
|
*/
|
|
12440
12756
|
var TaxReviewHistoryService = /** @class */ (function (_super) {
|
|
12441
12757
|
__extends(TaxReviewHistoryService, _super);
|
|
12442
|
-
function TaxReviewHistoryService(
|
|
12443
|
-
var _this = _super.
|
|
12444
|
-
_this.http = http;
|
|
12445
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
12446
|
-
_this.environment = environment;
|
|
12758
|
+
function TaxReviewHistoryService() {
|
|
12759
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12447
12760
|
_this.url = 'tax-reviews/history';
|
|
12448
12761
|
_this.modelClass = TaxReview;
|
|
12449
|
-
// subscribe on tax review updating
|
|
12450
|
-
eventDispatcherService.on(exports.AppEventTypeEnum.TAX_REVIEW_UPDATED).subscribe(function (taxReview) {
|
|
12451
|
-
var tempCache = ___default["default"].cloneDeep(_this.cache);
|
|
12452
|
-
// insert element at the beginning of the array
|
|
12453
|
-
tempCache.unshift(taxReview);
|
|
12454
|
-
_this.cache = tempCache;
|
|
12455
|
-
_this.updateCache();
|
|
12456
|
-
});
|
|
12457
12762
|
return _this;
|
|
12458
12763
|
}
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
TaxReviewHistoryService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewHistoryService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12462
|
-
TaxReviewHistoryService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewHistoryService, providedIn: 'root' });
|
|
12463
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewHistoryService, decorators: [{
|
|
12464
|
-
type: i0.Injectable,
|
|
12465
|
-
args: [{
|
|
12466
|
-
providedIn: 'root'
|
|
12467
|
-
}]
|
|
12468
|
-
}], ctorParameters: function () {
|
|
12469
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12470
|
-
type: i0.Inject,
|
|
12471
|
-
args: ['environment']
|
|
12472
|
-
}] }];
|
|
12473
|
-
} });
|
|
12474
|
-
|
|
12475
|
-
/**
|
|
12476
|
-
* Service to work with tax summary logic
|
|
12477
|
-
*/
|
|
12478
|
-
var TaxSummaryService = /** @class */ (function () {
|
|
12479
|
-
function TaxSummaryService(http, eventDispatcherService, environment) {
|
|
12480
|
-
this.http = http;
|
|
12481
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
12482
|
-
this.environment = environment;
|
|
12483
|
-
this.taxSummaryActualsSubject = new rxjs.ReplaySubject(1);
|
|
12484
|
-
this.taxSummaryForecastsSubject = new rxjs.ReplaySubject(1);
|
|
12485
|
-
this.listenEvents();
|
|
12486
|
-
}
|
|
12487
|
-
TaxSummaryService.prototype.listenEvents = function () {
|
|
12488
|
-
this.listenToIncomeSourceForecastsEvents();
|
|
12489
|
-
};
|
|
12490
|
-
/**
|
|
12491
|
-
* Get actual tax summary items
|
|
12492
|
-
*/
|
|
12493
|
-
TaxSummaryService.prototype.getActuals = function () {
|
|
12494
|
-
var _this = this;
|
|
12495
|
-
this.http.get(this.environment.apiV2 + "/tax-summary/" + exports.TaxSummaryTypeEnum.ACTUALS, {})
|
|
12496
|
-
.subscribe(function (response) {
|
|
12497
|
-
var taxSummary = classTransformer.plainToClass(TaxSummary, response);
|
|
12498
|
-
_this.taxSummaryActualsSubject.next(taxSummary);
|
|
12499
|
-
return taxSummary;
|
|
12500
|
-
});
|
|
12501
|
-
return this.taxSummaryActualsSubject.asObservable();
|
|
12502
|
-
};
|
|
12503
|
-
/**
|
|
12504
|
-
* Get forecast tax summary items
|
|
12505
|
-
*/
|
|
12506
|
-
TaxSummaryService.prototype.getForecast = function () {
|
|
12507
|
-
var _this = this;
|
|
12508
|
-
this.http.get(this.environment.apiV2 + "/tax-summary/" + exports.TaxSummaryTypeEnum.FORECASTS, {})
|
|
12509
|
-
.subscribe(function (response) {
|
|
12510
|
-
var taxSummary = classTransformer.plainToClass(TaxSummary, response);
|
|
12511
|
-
_this.taxSummaryForecastsSubject.next(taxSummary);
|
|
12512
|
-
return taxSummary;
|
|
12513
|
-
});
|
|
12514
|
-
return this.taxSummaryForecastsSubject.asObservable();
|
|
12764
|
+
TaxReviewHistoryService.prototype.listenEvents = function () {
|
|
12765
|
+
this.listenTaxReviewUpdate();
|
|
12515
12766
|
};
|
|
12516
12767
|
/**
|
|
12517
|
-
*
|
|
12768
|
+
* Update tax review history cache when single tax review updated.
|
|
12518
12769
|
*/
|
|
12519
|
-
|
|
12770
|
+
TaxReviewHistoryService.prototype.listenTaxReviewUpdate = function () {
|
|
12520
12771
|
var _this = this;
|
|
12521
|
-
this.eventDispatcherService
|
|
12522
|
-
.
|
|
12523
|
-
|
|
12524
|
-
|
|
12772
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.TAX_REVIEW_UPDATED).subscribe(function (taxReview) {
|
|
12773
|
+
var tempCache = ___default["default"].cloneDeep(_this.cache);
|
|
12774
|
+
// insert element at the beginning of the array
|
|
12775
|
+
tempCache.unshift(taxReview);
|
|
12776
|
+
_this.cache = tempCache;
|
|
12777
|
+
_this.updateCache();
|
|
12525
12778
|
});
|
|
12526
12779
|
};
|
|
12527
|
-
return
|
|
12528
|
-
}());
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
12532
|
-
type: i0.Injectable,
|
|
12533
|
-
args: [{
|
|
12534
|
-
providedIn: 'root'
|
|
12535
|
-
}]
|
|
12536
|
-
}]
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
function
|
|
12551
|
-
|
|
12552
|
-
_this.http = http;
|
|
12553
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
12554
|
-
_this.environment = environment;
|
|
12555
|
-
// API URL param for transaction allocations
|
|
12556
|
-
_this.url = 'transactions-allocations';
|
|
12557
|
-
_this.modelClass = TransactionAllocation;
|
|
12558
|
-
_this.listenEvents();
|
|
12559
|
-
return _this;
|
|
12560
|
-
}
|
|
12561
|
-
/**
|
|
12562
|
-
* Add single transaction allocation
|
|
12563
|
-
*/
|
|
12564
|
-
TransactionAllocationService.prototype.add = function (allocation) {
|
|
12565
|
-
return this.addBatch([allocation]).pipe(operators.map(function (newAllocations) { return newAllocations[0]; }));
|
|
12566
|
-
};
|
|
12567
|
-
/**
|
|
12568
|
-
* get list of transactions allocations related with passed bank transactions list
|
|
12569
|
-
*/
|
|
12570
|
-
TransactionAllocationService.prototype.getByTransactions = function (transactions) {
|
|
12571
|
-
var ids = transactions.map(function (transaction) { return transaction.id; });
|
|
12572
|
-
return this.get()
|
|
12573
|
-
.pipe(operators.map(function (transactionAllocations) {
|
|
12574
|
-
return transactionAllocations.filter(function (allocation) { return ids.includes(allocation.transaction.id); });
|
|
12575
|
-
}));
|
|
12576
|
-
};
|
|
12577
|
-
TransactionAllocationService.prototype.listenEvents = function () {
|
|
12578
|
-
this.onTransactionsCreated();
|
|
12579
|
-
this.onDepreciationCreated();
|
|
12580
|
-
this.onTransactionDeleted();
|
|
12780
|
+
return TaxReviewHistoryService;
|
|
12781
|
+
}(RestService));
|
|
12782
|
+
TaxReviewHistoryService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewHistoryService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12783
|
+
TaxReviewHistoryService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewHistoryService, providedIn: 'root' });
|
|
12784
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxReviewHistoryService, decorators: [{
|
|
12785
|
+
type: i0.Injectable,
|
|
12786
|
+
args: [{
|
|
12787
|
+
providedIn: 'root'
|
|
12788
|
+
}]
|
|
12789
|
+
}] });
|
|
12790
|
+
|
|
12791
|
+
/**
|
|
12792
|
+
* Service to work with tax summary logic
|
|
12793
|
+
*/
|
|
12794
|
+
var TaxSummaryService = /** @class */ (function () {
|
|
12795
|
+
function TaxSummaryService(http, eventDispatcherService, environment) {
|
|
12796
|
+
this.http = http;
|
|
12797
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
12798
|
+
this.environment = environment;
|
|
12799
|
+
this.taxSummaryActualsSubject = new rxjs.ReplaySubject(1);
|
|
12800
|
+
this.taxSummaryForecastsSubject = new rxjs.ReplaySubject(1);
|
|
12801
|
+
this.listenEvents();
|
|
12802
|
+
}
|
|
12803
|
+
TaxSummaryService.prototype.listenEvents = function () {
|
|
12804
|
+
this.listenToIncomeSourceForecastsEvents();
|
|
12581
12805
|
};
|
|
12582
12806
|
/**
|
|
12583
|
-
*
|
|
12807
|
+
* Get actual tax summary items
|
|
12584
12808
|
*/
|
|
12585
|
-
|
|
12809
|
+
TaxSummaryService.prototype.getActuals = function () {
|
|
12586
12810
|
var _this = this;
|
|
12587
|
-
this.
|
|
12588
|
-
|
|
12589
|
-
|
|
12811
|
+
this.http.get(this.environment.apiV2 + "/tax-summary/" + exports.TaxSummaryTypeEnum.ACTUALS, {})
|
|
12812
|
+
.subscribe(function (response) {
|
|
12813
|
+
var taxSummary = classTransformer.plainToClass(TaxSummary, response);
|
|
12814
|
+
_this.taxSummaryActualsSubject.next(taxSummary);
|
|
12815
|
+
return taxSummary;
|
|
12590
12816
|
});
|
|
12817
|
+
return this.taxSummaryActualsSubject.asObservable();
|
|
12591
12818
|
};
|
|
12592
12819
|
/**
|
|
12593
|
-
*
|
|
12820
|
+
* Get forecast tax summary items
|
|
12594
12821
|
*/
|
|
12595
|
-
|
|
12822
|
+
TaxSummaryService.prototype.getForecast = function () {
|
|
12596
12823
|
var _this = this;
|
|
12597
|
-
this.
|
|
12598
|
-
|
|
12599
|
-
|
|
12824
|
+
this.http.get(this.environment.apiV2 + "/tax-summary/" + exports.TaxSummaryTypeEnum.FORECASTS, {})
|
|
12825
|
+
.subscribe(function (response) {
|
|
12826
|
+
var taxSummary = classTransformer.plainToClass(TaxSummary, response);
|
|
12827
|
+
_this.taxSummaryForecastsSubject.next(taxSummary);
|
|
12828
|
+
return taxSummary;
|
|
12600
12829
|
});
|
|
12830
|
+
return this.taxSummaryForecastsSubject.asObservable();
|
|
12601
12831
|
};
|
|
12602
12832
|
/**
|
|
12603
|
-
*
|
|
12833
|
+
* Listen to EventDispatcherService events related to Income source forecasts
|
|
12604
12834
|
*/
|
|
12605
|
-
|
|
12835
|
+
TaxSummaryService.prototype.listenToIncomeSourceForecastsEvents = function () {
|
|
12606
12836
|
var _this = this;
|
|
12607
|
-
this.eventDispatcherService
|
|
12608
|
-
|
|
12609
|
-
|
|
12837
|
+
this.eventDispatcherService
|
|
12838
|
+
.on([exports.AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, exports.AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED])
|
|
12839
|
+
.subscribe(function () {
|
|
12840
|
+
_this.getForecast().subscribe();
|
|
12610
12841
|
});
|
|
12611
12842
|
};
|
|
12612
|
-
return
|
|
12613
|
-
}(
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
12843
|
+
return TaxSummaryService;
|
|
12844
|
+
}());
|
|
12845
|
+
TaxSummaryService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxSummaryService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12846
|
+
TaxSummaryService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxSummaryService, providedIn: 'root' });
|
|
12847
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxSummaryService, decorators: [{
|
|
12617
12848
|
type: i0.Injectable,
|
|
12618
12849
|
args: [{
|
|
12619
12850
|
providedIn: 'root'
|
|
@@ -12838,11 +13069,8 @@
|
|
|
12838
13069
|
|
|
12839
13070
|
var UserEventSettingService = /** @class */ (function (_super) {
|
|
12840
13071
|
__extends(UserEventSettingService, _super);
|
|
12841
|
-
function UserEventSettingService(
|
|
12842
|
-
var _this = _super.
|
|
12843
|
-
_this.http = http;
|
|
12844
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
12845
|
-
_this.environment = environment;
|
|
13072
|
+
function UserEventSettingService() {
|
|
13073
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12846
13074
|
_this.modelClass = UserEventSetting;
|
|
12847
13075
|
_this.url = 'user-event-settings';
|
|
12848
13076
|
_this.isHydra = true;
|
|
@@ -12877,27 +13105,19 @@
|
|
|
12877
13105
|
};
|
|
12878
13106
|
return UserEventSettingService;
|
|
12879
13107
|
}(RestService));
|
|
12880
|
-
UserEventSettingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventSettingService, deps:
|
|
13108
|
+
UserEventSettingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventSettingService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12881
13109
|
UserEventSettingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventSettingService, providedIn: 'root' });
|
|
12882
13110
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventSettingService, decorators: [{
|
|
12883
13111
|
type: i0.Injectable,
|
|
12884
13112
|
args: [{
|
|
12885
13113
|
providedIn: 'root'
|
|
12886
13114
|
}]
|
|
12887
|
-
}]
|
|
12888
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12889
|
-
type: i0.Inject,
|
|
12890
|
-
args: ['environment']
|
|
12891
|
-
}] }];
|
|
12892
|
-
} });
|
|
13115
|
+
}] });
|
|
12893
13116
|
|
|
12894
13117
|
var UserEventTypeService = /** @class */ (function (_super) {
|
|
12895
13118
|
__extends(UserEventTypeService, _super);
|
|
12896
|
-
function UserEventTypeService(
|
|
12897
|
-
var _this = _super.
|
|
12898
|
-
_this.http = http;
|
|
12899
|
-
_this.eventDispatcherService = eventDispatcherService;
|
|
12900
|
-
_this.environment = environment;
|
|
13119
|
+
function UserEventTypeService() {
|
|
13120
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12901
13121
|
_this.modelClass = UserEventType;
|
|
12902
13122
|
_this.url = 'user-event-types';
|
|
12903
13123
|
_this.isHydra = true;
|
|
@@ -12905,252 +13125,138 @@
|
|
|
12905
13125
|
}
|
|
12906
13126
|
return UserEventTypeService;
|
|
12907
13127
|
}(RestService));
|
|
12908
|
-
UserEventTypeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventTypeService, deps:
|
|
13128
|
+
UserEventTypeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventTypeService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12909
13129
|
UserEventTypeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventTypeService, providedIn: 'root' });
|
|
12910
13130
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserEventTypeService, decorators: [{
|
|
12911
13131
|
type: i0.Injectable,
|
|
12912
13132
|
args: [{
|
|
12913
13133
|
providedIn: 'root'
|
|
12914
13134
|
}]
|
|
12915
|
-
}]
|
|
12916
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12917
|
-
type: i0.Inject,
|
|
12918
|
-
args: ['environment']
|
|
12919
|
-
}] }];
|
|
12920
|
-
} });
|
|
13135
|
+
}] });
|
|
12921
13136
|
|
|
12922
13137
|
/**
|
|
12923
13138
|
* Service that allows to work with WorkTank operations
|
|
12924
|
-
* @TODO separate
|
|
13139
|
+
* @TODO separate vehicles and logbooks to different api
|
|
12925
13140
|
*/
|
|
12926
|
-
var VehicleService = /** @class */ (function () {
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
this.vehicleClaimRateSubject = new rxjs.ReplaySubject(1);
|
|
12937
|
-
this.vehicleTaxReturnSubject = new rxjs.ReplaySubject(1);
|
|
12938
|
-
this.incomePositionsSubject = new rxjs.ReplaySubject(1);
|
|
13141
|
+
var VehicleService = /** @class */ (function (_super) {
|
|
13142
|
+
__extends(VehicleService, _super);
|
|
13143
|
+
function VehicleService() {
|
|
13144
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
13145
|
+
_this.url = 'vehicles';
|
|
13146
|
+
_this.modelClass = Vehicle;
|
|
13147
|
+
_this.messageCreated = MessagesEnum$1.VEHICLE_CREATED;
|
|
13148
|
+
_this.messageUpdated = MessagesEnum$1.VEHICLE_UPDATED;
|
|
13149
|
+
_this.messageDeleted = MessagesEnum$1.VEHICLE_DELETED;
|
|
13150
|
+
return _this;
|
|
12939
13151
|
}
|
|
12940
|
-
VehicleService.prototype.
|
|
12941
|
-
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
this.http.get(this.environment.apiV2 + "/vehicles")
|
|
12945
|
-
.pipe(operators.map(function (response) {
|
|
12946
|
-
return response.map(function (item) { return classTransformer.plainToClass(Vehicle, item); });
|
|
12947
|
-
}))
|
|
12948
|
-
.subscribe(function (vehicles) {
|
|
12949
|
-
_this._vehicles = vehicles;
|
|
12950
|
-
_this.vehiclesSubject.next(vehicles);
|
|
12951
|
-
});
|
|
12952
|
-
}
|
|
12953
|
-
return this.vehiclesSubject.asObservable();
|
|
12954
|
-
};
|
|
12955
|
-
/**
|
|
12956
|
-
* Get vehicles claim amount
|
|
12957
|
-
*/
|
|
12958
|
-
VehicleService.prototype.getVehiclesClaim = function () {
|
|
12959
|
-
var _this = this;
|
|
12960
|
-
if (!this._vehicleClaim) {
|
|
12961
|
-
this.http.get(this.environment.apiV2 + "/vehicle-claims")
|
|
12962
|
-
.pipe(operators.map(function (response) {
|
|
12963
|
-
// return Vehicle claim from backend or create new if it not exist
|
|
12964
|
-
return response.length ? response.map(function (item) { return classTransformer.plainToClass(VehicleClaim, item); })[0] : classTransformer.plainToClass(VehicleClaim, {});
|
|
12965
|
-
}))
|
|
12966
|
-
.subscribe(function (vehicleClaim) {
|
|
12967
|
-
_this._vehicleClaim = vehicleClaim;
|
|
12968
|
-
_this.vehicleClaimSubject.next(vehicleClaim);
|
|
12969
|
-
});
|
|
12970
|
-
}
|
|
12971
|
-
return this.vehicleClaimSubject.asObservable();
|
|
12972
|
-
};
|
|
12973
|
-
/**
|
|
12974
|
-
* Add new vehicle claim
|
|
12975
|
-
* @param claim object which should be added
|
|
12976
|
-
*/
|
|
12977
|
-
VehicleService.prototype.addVehicleClaim = function (claim) {
|
|
12978
|
-
var _this = this;
|
|
12979
|
-
return this.http.post(this.environment.apiV2 + "/vehicle-claims", claim).pipe(operators.map(function (response) {
|
|
12980
|
-
_this._vehicleClaim = classTransformer.plainToClass(VehicleClaim, response);
|
|
12981
|
-
_this.vehicleClaimSubject.next(_this._vehicleClaim);
|
|
12982
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.VEHICLE_CLAIM_CREATED, null));
|
|
12983
|
-
}));
|
|
12984
|
-
};
|
|
12985
|
-
/**
|
|
12986
|
-
* Get vehicles claim rate for current financial year
|
|
12987
|
-
*/
|
|
12988
|
-
VehicleService.prototype.getVehiclesClaimRate = function () {
|
|
12989
|
-
var _this = this;
|
|
12990
|
-
if (!this._vehicleClaimRate) {
|
|
12991
|
-
this.chartAccountsService.getChartAccountsById(exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK)
|
|
12992
|
-
.pipe(operators.map(function (response) {
|
|
12993
|
-
return response.values.find(function (chartAccount) { return chartAccount.financialYear === new FinancialYear().year; }).value;
|
|
12994
|
-
}))
|
|
12995
|
-
.subscribe(function (claimRate) {
|
|
12996
|
-
_this._vehicleClaimRate = claimRate;
|
|
12997
|
-
_this.vehicleClaimRateSubject.next(_this._vehicleClaimRate);
|
|
12998
|
-
});
|
|
12999
|
-
}
|
|
13000
|
-
return this.vehicleClaimRateSubject.asObservable();
|
|
13001
|
-
};
|
|
13002
|
-
/**
|
|
13003
|
-
* Get vehicles tax return for vehicle transactions & depreciations
|
|
13004
|
-
*/
|
|
13005
|
-
VehicleService.prototype.getVehiclesTaxReturn = function () {
|
|
13006
|
-
var _this = this;
|
|
13007
|
-
if (!this._vehicleTaxReturn) {
|
|
13008
|
-
rxjs.combineLatest([
|
|
13009
|
-
// @Todo refactor to avoid injection of another services
|
|
13010
|
-
this.transactionService.get(),
|
|
13011
|
-
this.depreciationService.get(),
|
|
13012
|
-
this.getVehiclesClaim()
|
|
13013
|
-
]).pipe(operators.map(function (_b) {
|
|
13014
|
-
var _c = __read(_b, 3), transactions = _c[0], depreciations = _c[1], vehicleClaim = _c[2];
|
|
13015
|
-
var chartAccountsHeadingsIds = enumToList(exports.ChartAccountsHeadingVehicleListEnum)
|
|
13016
|
-
.map(function (item) { return item.value; });
|
|
13017
|
-
// get transactions & depreciations which chart accounts headings are belong to vehicle category
|
|
13018
|
-
// but except KLMS transaction
|
|
13019
|
-
var filteredItems = __spreadArray(__spreadArray([], __read(transactions)), __read(depreciations)).filter(function (item) {
|
|
13020
|
-
var _a;
|
|
13021
|
-
return chartAccountsHeadingsIds.includes((_a = item.chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id) && !item.chartAccounts.isKlmsForWork();
|
|
13022
|
-
});
|
|
13023
|
-
// get claim amount sum
|
|
13024
|
-
return filteredItems.reduce(function (sum, item) {
|
|
13025
|
-
// @Todo remove item.amount negative sign when depreciations will be refactored and will have negative sign
|
|
13026
|
-
return sum + ((item instanceof Depreciation ? item.currentYearForecast.amount : -item.amount) * (vehicleClaim.workUsage / 100));
|
|
13027
|
-
}, 0);
|
|
13028
|
-
}))
|
|
13029
|
-
.subscribe(function (taxReturn) {
|
|
13030
|
-
_this._vehicleTaxReturn = taxReturn;
|
|
13031
|
-
_this.vehicleTaxReturnSubject.next(_this._vehicleTaxReturn);
|
|
13032
|
-
});
|
|
13033
|
-
}
|
|
13034
|
-
return this.vehicleTaxReturnSubject.asObservable();
|
|
13035
|
-
};
|
|
13036
|
-
/**
|
|
13037
|
-
* Update vehicle claim
|
|
13038
|
-
* @param claim which should be updated
|
|
13039
|
-
*
|
|
13040
|
-
* @TODO alex refresh depreciation/transaction cache
|
|
13041
|
-
*/
|
|
13042
|
-
VehicleService.prototype.updateVehicleClaim = function (claim) {
|
|
13043
|
-
var _this = this;
|
|
13044
|
-
return this.http.put(this.environment.apiV2 + "/vehicle-claims/" + claim.id, claim).pipe(operators.map(function (response) {
|
|
13045
|
-
var updatedVehicleClaim = classTransformer.plainToClass(VehicleClaim, response);
|
|
13046
|
-
_this._vehicleClaim = updatedVehicleClaim;
|
|
13047
|
-
_this.vehicleClaimSubject.next(_this._vehicleClaim);
|
|
13048
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.VEHICLE_CLAIM_UPDATED, null));
|
|
13049
|
-
return updatedVehicleClaim;
|
|
13050
|
-
}));
|
|
13152
|
+
VehicleService.prototype.listenEvents = function () {
|
|
13153
|
+
this.listenLogbookAdded();
|
|
13154
|
+
this.listenLogbookUpdated();
|
|
13155
|
+
this.listenLogbookDeleted();
|
|
13051
13156
|
};
|
|
13052
13157
|
/**
|
|
13053
|
-
* Add new logbook
|
|
13054
|
-
* @param logbook which should be added
|
|
13055
|
-
* @param vehicle for which logbook object should be added
|
|
13158
|
+
* Add a new logbook items to the vehicle when a new one created
|
|
13056
13159
|
*/
|
|
13057
|
-
VehicleService.prototype.
|
|
13160
|
+
VehicleService.prototype.listenLogbookAdded = function () {
|
|
13058
13161
|
var _this = this;
|
|
13059
|
-
|
|
13060
|
-
.
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
_this.
|
|
13065
|
-
})
|
|
13162
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.VEHICLE_LOGBOOK_CREATED)
|
|
13163
|
+
.subscribe(function (result) {
|
|
13164
|
+
var tempCache = cloneDeep__default["default"](_this.cache);
|
|
13165
|
+
tempCache.find(function (vehicle) { return vehicle.id === result.vehicleId; }).logbook.push(result.logbook);
|
|
13166
|
+
_this.cache = tempCache;
|
|
13167
|
+
_this.updateCache();
|
|
13168
|
+
});
|
|
13066
13169
|
};
|
|
13067
13170
|
/**
|
|
13068
|
-
*
|
|
13069
|
-
* @param logbook which should be updated
|
|
13070
|
-
* @param vehicle for which logbook object should be updated
|
|
13171
|
+
* Replace vehicle's logbook with updated instance when logbook item updated
|
|
13071
13172
|
*/
|
|
13072
|
-
VehicleService.prototype.
|
|
13173
|
+
VehicleService.prototype.listenLogbookUpdated = function () {
|
|
13073
13174
|
var _this = this;
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
var
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
}));
|
|
13175
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.VEHICLE_LOGBOOK_UPDATED)
|
|
13176
|
+
.subscribe(function (result) {
|
|
13177
|
+
var tempCache = cloneDeep__default["default"](_this.cache);
|
|
13178
|
+
replace(tempCache.find(function (vehicle) { return vehicle.id === result.vehicleId; }).logbook, result.logbook);
|
|
13179
|
+
_this.cache = tempCache;
|
|
13180
|
+
_this.updateCache();
|
|
13181
|
+
});
|
|
13082
13182
|
};
|
|
13083
13183
|
/**
|
|
13084
|
-
*
|
|
13085
|
-
* @param logbook for which trip should be deleted
|
|
13086
|
-
* @param vehicle for which trip should be deleted
|
|
13184
|
+
* Remove logbook item from vehicle when logbook deleted
|
|
13087
13185
|
*/
|
|
13088
|
-
VehicleService.prototype.
|
|
13186
|
+
VehicleService.prototype.listenLogbookDeleted = function () {
|
|
13089
13187
|
var _this = this;
|
|
13090
|
-
|
|
13091
|
-
.
|
|
13092
|
-
var
|
|
13093
|
-
var
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
}));
|
|
13188
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.VEHICLE_LOGBOOK_DELETED)
|
|
13189
|
+
.subscribe(function (result) {
|
|
13190
|
+
var tempCache = cloneDeep__default["default"](_this.cache);
|
|
13191
|
+
var vehicle = tempCache.find(function (vehicle) { return vehicle.id === result.vehicleId; });
|
|
13192
|
+
vehicle.logbook = vehicle.logbook.filter(function (logbook) { return logbook.id !== result.logbook.id; });
|
|
13193
|
+
_this.cache = tempCache;
|
|
13194
|
+
_this.updateCache();
|
|
13195
|
+
});
|
|
13099
13196
|
};
|
|
13100
|
-
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13197
|
+
return VehicleService;
|
|
13198
|
+
}(RestService));
|
|
13199
|
+
VehicleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
13200
|
+
VehicleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleService, providedIn: 'root' });
|
|
13201
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleService, decorators: [{
|
|
13202
|
+
type: i0.Injectable,
|
|
13203
|
+
args: [{
|
|
13204
|
+
providedIn: 'root'
|
|
13205
|
+
}]
|
|
13206
|
+
}] });
|
|
13207
|
+
|
|
13208
|
+
/**
|
|
13209
|
+
* Vehicle logbook service. Allows user to add, update or delete vehicle trips
|
|
13210
|
+
* @TODO extend rest service after it refactored
|
|
13211
|
+
*/
|
|
13212
|
+
var VehicleLogbookService = /** @class */ (function () {
|
|
13213
|
+
function VehicleLogbookService(http, eventDispatcherService, environment, toastService) {
|
|
13214
|
+
this.http = http;
|
|
13215
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
13216
|
+
this.environment = environment;
|
|
13217
|
+
this.toastService = toastService;
|
|
13218
|
+
}
|
|
13219
|
+
VehicleLogbookService.prototype.add = function (logbook, vehicleId) {
|
|
13105
13220
|
var _this = this;
|
|
13106
|
-
return this.http.post(this.environment.apiV2 + "/vehicles"
|
|
13107
|
-
.pipe(operators.map(function (
|
|
13108
|
-
|
|
13109
|
-
_this.
|
|
13221
|
+
return this.http.post(this.environment.apiV2 + "/vehicles/" + vehicleId + "/logbooks", logbook)
|
|
13222
|
+
.pipe(operators.map(function (vehicleLogbookBase) {
|
|
13223
|
+
var newVehicleLogbook = classTransformer.plainToClass(VehicleLogbook, vehicleLogbookBase);
|
|
13224
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.VEHICLE_LOGBOOK_CREATED, { logbook: newVehicleLogbook, vehicleId: vehicleId }));
|
|
13225
|
+
_this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_CREATED);
|
|
13226
|
+
return newVehicleLogbook;
|
|
13110
13227
|
}));
|
|
13111
13228
|
};
|
|
13112
|
-
|
|
13113
|
-
* Update vehicle
|
|
13114
|
-
* @param vehicle which should be updated
|
|
13115
|
-
*/
|
|
13116
|
-
VehicleService.prototype.updateVehicle = function (vehicle) {
|
|
13229
|
+
VehicleLogbookService.prototype.update = function (logbook, vehicleId) {
|
|
13117
13230
|
var _this = this;
|
|
13118
|
-
return this.http.put(this.environment.apiV2 + "/vehicles/" +
|
|
13119
|
-
.
|
|
13120
|
-
|
|
13121
|
-
_this.
|
|
13122
|
-
|
|
13231
|
+
return this.http.put(this.environment.apiV2 + "/vehicles/" + vehicleId + "/logbooks/" + logbook.id, logbook).pipe(operators.map(function (vehicleLogbookBase) {
|
|
13232
|
+
var updatedVehicleLogbook = classTransformer.plainToClass(VehicleLogbook, vehicleLogbookBase);
|
|
13233
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.VEHICLE_LOGBOOK_UPDATED, { logbook: updatedVehicleLogbook, vehicleId: vehicleId }));
|
|
13234
|
+
_this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_UPDATED);
|
|
13235
|
+
return classTransformer.plainToClass(VehicleLogbook, updatedVehicleLogbook);
|
|
13123
13236
|
}));
|
|
13124
13237
|
};
|
|
13125
|
-
|
|
13126
|
-
* Delete vehicle
|
|
13127
|
-
* @param vehicle which should be deleted
|
|
13128
|
-
*/
|
|
13129
|
-
VehicleService.prototype.deleteVehicle = function (vehicle) {
|
|
13238
|
+
VehicleLogbookService.prototype.delete = function (logbook, vehicleId) {
|
|
13130
13239
|
var _this = this;
|
|
13131
|
-
return this.http.delete(this.environment.apiV2 + "/vehicles/" +
|
|
13240
|
+
return this.http.delete(this.environment.apiV2 + "/vehicles/" + vehicleId + "/logbooks/" + logbook.id)
|
|
13132
13241
|
.pipe(operators.map(function () {
|
|
13133
|
-
|
|
13134
|
-
_this.
|
|
13135
|
-
// we update nested logbook object inside vehicles list. So list is not changed and next not emit subscriptions updates.
|
|
13136
|
-
// that is why we recreate vehicles array
|
|
13137
|
-
_this.vehiclesSubject.next(_this._vehicles.map(function (item) { return classTransformer.plainToClass(Vehicle, item); }));
|
|
13242
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.VEHICLE_LOGBOOK_DELETED, { logbook: logbook, vehicleId: vehicleId }));
|
|
13243
|
+
_this.toastService.success(MessagesEnum$1.VEHICLE_LOGBOOK_DELETED);
|
|
13138
13244
|
}));
|
|
13139
13245
|
};
|
|
13140
|
-
return
|
|
13246
|
+
return VehicleLogbookService;
|
|
13141
13247
|
}());
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
13248
|
+
VehicleLogbookService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleLogbookService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
13249
|
+
VehicleLogbookService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleLogbookService, providedIn: 'root' });
|
|
13250
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: VehicleLogbookService, decorators: [{
|
|
13145
13251
|
type: i0.Injectable,
|
|
13146
13252
|
args: [{
|
|
13147
13253
|
providedIn: 'root'
|
|
13148
13254
|
}]
|
|
13149
13255
|
}], ctorParameters: function () {
|
|
13150
|
-
return [{ type: i1__namespace.HttpClient }, { type:
|
|
13256
|
+
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
13151
13257
|
type: i0.Inject,
|
|
13152
13258
|
args: ['environment']
|
|
13153
|
-
}] }];
|
|
13259
|
+
}] }, { type: ToastService }];
|
|
13154
13260
|
} });
|
|
13155
13261
|
|
|
13156
13262
|
/**
|
|
@@ -13305,6 +13411,39 @@
|
|
|
13305
13411
|
return AbstractForm;
|
|
13306
13412
|
}(forms.FormGroup));
|
|
13307
13413
|
|
|
13414
|
+
/**
|
|
13415
|
+
* Check if at least one form field is true, otherwise form is invalid.
|
|
13416
|
+
* Use with groups of boolean form controls (checkbox, toggle, etc.)
|
|
13417
|
+
*/
|
|
13418
|
+
function atLeastOneCheckedValidator() {
|
|
13419
|
+
return function (formGroup) {
|
|
13420
|
+
return Object.values(formGroup.controls)
|
|
13421
|
+
.find(function (control) { return control.value; }) ? null : { nothingChecked: true };
|
|
13422
|
+
};
|
|
13423
|
+
}
|
|
13424
|
+
|
|
13425
|
+
var ClientIncomeTypesForm = /** @class */ (function (_super) {
|
|
13426
|
+
__extends(ClientIncomeTypesForm, _super);
|
|
13427
|
+
function ClientIncomeTypesForm(clientIncomeTypes) {
|
|
13428
|
+
var _this = _super.call(this, {
|
|
13429
|
+
salary: new forms.FormControl(clientIncomeTypes.salary),
|
|
13430
|
+
rental: new forms.FormControl(clientIncomeTypes.rental),
|
|
13431
|
+
soleTrader: new forms.FormControl(clientIncomeTypes.soleTrader),
|
|
13432
|
+
dividends: new forms.FormControl(clientIncomeTypes.dividends),
|
|
13433
|
+
other: new forms.FormControl(clientIncomeTypes.other)
|
|
13434
|
+
}, atLeastOneCheckedValidator()) || this;
|
|
13435
|
+
_this.clientIncomeTypes = clientIncomeTypes;
|
|
13436
|
+
return _this;
|
|
13437
|
+
}
|
|
13438
|
+
ClientIncomeTypesForm.prototype.submit = function () {
|
|
13439
|
+
if (!this.valid) {
|
|
13440
|
+
return null;
|
|
13441
|
+
}
|
|
13442
|
+
return Object.assign({}, this.clientIncomeTypes, this.value);
|
|
13443
|
+
};
|
|
13444
|
+
return ClientIncomeTypesForm;
|
|
13445
|
+
}(AbstractForm));
|
|
13446
|
+
|
|
13308
13447
|
var LoginForm = /** @class */ (function (_super) {
|
|
13309
13448
|
__extends(LoginForm, _super);
|
|
13310
13449
|
function LoginForm() {
|
|
@@ -13388,6 +13527,139 @@
|
|
|
13388
13527
|
return ResetPasswordForm;
|
|
13389
13528
|
}(AbstractForm));
|
|
13390
13529
|
|
|
13530
|
+
var MAX_NAME_LENGTH = 60;
|
|
13531
|
+
var VehicleForm = /** @class */ (function (_super) {
|
|
13532
|
+
__extends(VehicleForm, _super);
|
|
13533
|
+
function VehicleForm(vehicle) {
|
|
13534
|
+
var _this = _super.call(this, {
|
|
13535
|
+
name: new forms.FormControl(vehicle.name, [forms.Validators.required, forms.Validators.maxLength(MAX_NAME_LENGTH)])
|
|
13536
|
+
}) || this;
|
|
13537
|
+
_this.vehicle = vehicle;
|
|
13538
|
+
return _this;
|
|
13539
|
+
}
|
|
13540
|
+
/**
|
|
13541
|
+
* @TODO save model, add generics and handle it in AbstractForm
|
|
13542
|
+
*/
|
|
13543
|
+
VehicleForm.prototype.submit = function () {
|
|
13544
|
+
return classTransformer.plainToClass(VehicleClaim, Object.assign({}, this.vehicle, this.getRawValue()));
|
|
13545
|
+
};
|
|
13546
|
+
return VehicleForm;
|
|
13547
|
+
}(AbstractForm));
|
|
13548
|
+
|
|
13549
|
+
var VehicleClaimForm = /** @class */ (function (_super) {
|
|
13550
|
+
__extends(VehicleClaimForm, _super);
|
|
13551
|
+
function VehicleClaimForm(vehicleClaim, logbooks) {
|
|
13552
|
+
var _this = _super.call(this, {
|
|
13553
|
+
method: new forms.FormControl(vehicleClaim.method, forms.Validators.required),
|
|
13554
|
+
isManual: new forms.FormControl(vehicleClaim.isManual),
|
|
13555
|
+
kilometers: new forms.FormControl({
|
|
13556
|
+
value: vehicleClaim.kilometers,
|
|
13557
|
+
disabled: !vehicleClaim.isManual
|
|
13558
|
+
}),
|
|
13559
|
+
workUsage: new forms.FormControl({
|
|
13560
|
+
value: vehicleClaim.workUsage,
|
|
13561
|
+
disabled: !vehicleClaim.isManual
|
|
13562
|
+
})
|
|
13563
|
+
}) || this;
|
|
13564
|
+
_this.vehicleClaim = vehicleClaim;
|
|
13565
|
+
_this.logbooks = logbooks;
|
|
13566
|
+
_this.setIsManualState();
|
|
13567
|
+
_this.listenMethodChanges();
|
|
13568
|
+
_this.listenIsManualChanges();
|
|
13569
|
+
return _this;
|
|
13570
|
+
}
|
|
13571
|
+
/**
|
|
13572
|
+
* Check if vehicle claim method changed
|
|
13573
|
+
*/
|
|
13574
|
+
VehicleClaimForm.prototype.isMethodChanged = function () {
|
|
13575
|
+
return this.vehicleClaim.method !== this.get('method').value;
|
|
13576
|
+
};
|
|
13577
|
+
/**
|
|
13578
|
+
* Check if KLMs method selected
|
|
13579
|
+
*/
|
|
13580
|
+
VehicleClaimForm.prototype.isKLMsMethod = function () {
|
|
13581
|
+
return this.get('method').value === exports.VehicleClaimMethodEnum.KMS;
|
|
13582
|
+
};
|
|
13583
|
+
/**
|
|
13584
|
+
* Check if Logbook method selected
|
|
13585
|
+
*/
|
|
13586
|
+
VehicleClaimForm.prototype.isLogbookMethod = function () {
|
|
13587
|
+
return this.get('method').value === exports.VehicleClaimMethodEnum.LOGBOOK;
|
|
13588
|
+
};
|
|
13589
|
+
/**
|
|
13590
|
+
* Check if user selected manual calculation
|
|
13591
|
+
*/
|
|
13592
|
+
VehicleClaimForm.prototype.isManual = function () {
|
|
13593
|
+
return this.get('isManual').value;
|
|
13594
|
+
};
|
|
13595
|
+
/**
|
|
13596
|
+
* @TODO save model, add generics and handle it in AbstractForm
|
|
13597
|
+
*/
|
|
13598
|
+
VehicleClaimForm.prototype.submit = function () {
|
|
13599
|
+
return classTransformer.plainToClass(VehicleClaim, Object.assign({}, this.vehicleClaim, this.getRawValue()));
|
|
13600
|
+
};
|
|
13601
|
+
VehicleClaimForm.prototype.setIsManualState = function () {
|
|
13602
|
+
if (this.logbooks.isBestPeriodExist()) {
|
|
13603
|
+
this.get('isManual').enable();
|
|
13604
|
+
}
|
|
13605
|
+
else {
|
|
13606
|
+
this.get('isManual').disable();
|
|
13607
|
+
this.get('isManual').setValue(true);
|
|
13608
|
+
}
|
|
13609
|
+
};
|
|
13610
|
+
/**
|
|
13611
|
+
* Handle method field value changes.
|
|
13612
|
+
* Set work usage value depended of selected method.
|
|
13613
|
+
*/
|
|
13614
|
+
VehicleClaimForm.prototype.listenMethodChanges = function () {
|
|
13615
|
+
var _this = this;
|
|
13616
|
+
this.get('method').valueChanges.subscribe(function (method) {
|
|
13617
|
+
if (method === exports.VehicleClaimMethodEnum.KMS) {
|
|
13618
|
+
_this.get('workUsage').setValue(0);
|
|
13619
|
+
}
|
|
13620
|
+
else if (method === exports.VehicleClaimMethodEnum.LOGBOOK && !_this.isManual()) {
|
|
13621
|
+
_this.get('workUsage').setValue(_this.logbooks.getBestPeriod().workUsage);
|
|
13622
|
+
}
|
|
13623
|
+
_this.setValues();
|
|
13624
|
+
});
|
|
13625
|
+
};
|
|
13626
|
+
/**
|
|
13627
|
+
* Handle isManual field value changes.
|
|
13628
|
+
* Enable/disable fields depended of isManual value
|
|
13629
|
+
*/
|
|
13630
|
+
VehicleClaimForm.prototype.listenIsManualChanges = function () {
|
|
13631
|
+
var _this = this;
|
|
13632
|
+
this.get('isManual').valueChanges.subscribe(function (isManual) {
|
|
13633
|
+
if (isManual) {
|
|
13634
|
+
_this.get('kilometers').enable();
|
|
13635
|
+
_this.get('workUsage').enable();
|
|
13636
|
+
}
|
|
13637
|
+
else {
|
|
13638
|
+
_this.get('kilometers').disable();
|
|
13639
|
+
_this.get('workUsage').disable();
|
|
13640
|
+
}
|
|
13641
|
+
_this.setValues();
|
|
13642
|
+
});
|
|
13643
|
+
};
|
|
13644
|
+
/**
|
|
13645
|
+
* Set automatic calculated values depended of current method for non-manual vehicle claim
|
|
13646
|
+
*/
|
|
13647
|
+
VehicleClaimForm.prototype.setValues = function () {
|
|
13648
|
+
if (this.isManual()) {
|
|
13649
|
+
return;
|
|
13650
|
+
}
|
|
13651
|
+
switch (this.get('method').value) {
|
|
13652
|
+
case exports.VehicleClaimMethodEnum.LOGBOOK:
|
|
13653
|
+
this.get('workUsage').setValue(this.logbooks.getBestPeriod().workUsage);
|
|
13654
|
+
break;
|
|
13655
|
+
case exports.VehicleClaimMethodEnum.KMS:
|
|
13656
|
+
var businessKms = this.logbooks.getBusinessLogbooks().getKlms();
|
|
13657
|
+
this.get('kilometers').setValue(businessKms < this.vehicleClaim.kmsLimit ? businessKms : this.vehicleClaim.kmsLimit);
|
|
13658
|
+
}
|
|
13659
|
+
};
|
|
13660
|
+
return VehicleClaimForm;
|
|
13661
|
+
}(AbstractForm));
|
|
13662
|
+
|
|
13391
13663
|
/**
|
|
13392
13664
|
* Public API Surface of tt-core
|
|
13393
13665
|
*/
|
|
@@ -13397,6 +13669,9 @@
|
|
|
13397
13669
|
*/
|
|
13398
13670
|
|
|
13399
13671
|
exports.AbstractForm = AbstractForm;
|
|
13672
|
+
exports.AccountSetupItem = AccountSetupItem;
|
|
13673
|
+
exports.AccountSetupItemCollection = AccountSetupItemCollection;
|
|
13674
|
+
exports.AccountSetupService = AccountSetupService;
|
|
13400
13675
|
exports.Address = Address;
|
|
13401
13676
|
exports.AddressService = AddressService;
|
|
13402
13677
|
exports.AppEvent = AppEvent;
|
|
@@ -13434,12 +13709,16 @@
|
|
|
13434
13709
|
exports.ChartAccountsHeading = ChartAccountsHeading;
|
|
13435
13710
|
exports.ChartAccountsMetadata = ChartAccountsMetadata;
|
|
13436
13711
|
exports.ChartAccountsService = ChartAccountsService;
|
|
13712
|
+
exports.ChartAccountsValue = ChartAccountsValue;
|
|
13437
13713
|
exports.ChartData = ChartData;
|
|
13438
13714
|
exports.ChartSerie = ChartSerie;
|
|
13439
13715
|
exports.Chat = Chat;
|
|
13440
13716
|
exports.ChatService = ChatService;
|
|
13441
13717
|
exports.ClientCollection = ClientCollection;
|
|
13442
13718
|
exports.ClientDetails = ClientDetails;
|
|
13719
|
+
exports.ClientIncomeTypes = ClientIncomeTypes;
|
|
13720
|
+
exports.ClientIncomeTypesForm = ClientIncomeTypesForm;
|
|
13721
|
+
exports.ClientIncomeTypesService = ClientIncomeTypesService;
|
|
13443
13722
|
exports.ClientInvite = ClientInvite;
|
|
13444
13723
|
exports.ClientInviteService = ClientInviteService;
|
|
13445
13724
|
exports.ClientMovement = ClientMovement;
|
|
@@ -13505,7 +13784,6 @@
|
|
|
13505
13784
|
exports.LoanPayment = LoanPayment;
|
|
13506
13785
|
exports.LoanPayout = LoanPayout;
|
|
13507
13786
|
exports.LoanService = LoanService;
|
|
13508
|
-
exports.LogbookCollection = LogbookCollection;
|
|
13509
13787
|
exports.LogbookPeriod = LogbookPeriod;
|
|
13510
13788
|
exports.LoginForm = LoginForm;
|
|
13511
13789
|
exports.MODULE_URL_LIST = MODULE_URL_LIST;
|
|
@@ -13522,6 +13800,7 @@
|
|
|
13522
13800
|
exports.OccupationService = OccupationService;
|
|
13523
13801
|
exports.PasswordForm = PasswordForm;
|
|
13524
13802
|
exports.PdfService = PdfService;
|
|
13803
|
+
exports.PdfSettings = PdfSettings;
|
|
13525
13804
|
exports.Phone = Phone;
|
|
13526
13805
|
exports.PreloaderService = PreloaderService;
|
|
13527
13806
|
exports.Property = Property;
|
|
@@ -13612,7 +13891,13 @@
|
|
|
13612
13891
|
exports.UserToRegister = UserToRegister;
|
|
13613
13892
|
exports.Vehicle = Vehicle;
|
|
13614
13893
|
exports.VehicleClaim = VehicleClaim;
|
|
13894
|
+
exports.VehicleClaimForm = VehicleClaimForm;
|
|
13895
|
+
exports.VehicleClaimService = VehicleClaimService;
|
|
13896
|
+
exports.VehicleCollection = VehicleCollection;
|
|
13897
|
+
exports.VehicleForm = VehicleForm;
|
|
13615
13898
|
exports.VehicleLogbook = VehicleLogbook;
|
|
13899
|
+
exports.VehicleLogbookCollection = VehicleLogbookCollection;
|
|
13900
|
+
exports.VehicleLogbookService = VehicleLogbookService;
|
|
13616
13901
|
exports.VehicleService = VehicleService;
|
|
13617
13902
|
exports.WORK_TANK_LOGBOOK_PURPOSE_OPTIONS = WORK_TANK_LOGBOOK_PURPOSE_OPTIONS;
|
|
13618
13903
|
exports.XlsxService = XlsxService;
|