taxtank-core 0.30.3 → 0.30.7
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/esm2020/lib/db-static/chart-accounts/chart-accounts-values.mjs +4 -1
- package/esm2020/lib/forms/abstract.form.mjs +6 -1
- package/esm2020/lib/forms/sole/sole-invoice.form.mjs +3 -3
- package/esm2020/lib/forms/transaction/work/work-expense.form.mjs +9 -2
- package/esm2020/lib/forms/transaction/work/work-transaction.form.mjs +1 -2
- package/esm2020/lib/models/chart-accounts/chart-accounts.mjs +5 -11
- package/esm2020/lib/models/depreciation/depreciation-forecast.mjs +2 -2
- package/esm2020/lib/models/endpoint/endpoints.const.mjs +2 -1
- package/esm2020/lib/models/property/property.mjs +6 -6
- package/esm2020/lib/services/http/income-source/income-source.service.mjs +2 -2
- package/esm2020/lib/services/http/rest/rest-old.service.mjs +14 -24
- package/esm2020/lib/services/http/rest/rest.service.mjs +16 -16
- package/esm2020/lib/services/http/transaction/transaction.service.mjs +11 -12
- package/esm2020/lib/services/pdf/js-pdf.mjs +3 -1
- package/esm2020/lib/services/pdf/pdf-from-dom-element/pdf-from-dom-element.service.mjs +2 -2
- package/esm2020/lib/services/pdf/pdf-from-table/pdf-from-table.service.mjs +1 -1
- package/fesm2015/taxtank-core.mjs +60 -61
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +60 -61
- package/fesm2020/taxtank-core.mjs.map +1 -1
- package/lib/db-static/chart-accounts/chart-accounts-values.d.ts +3 -0
- package/lib/forms/abstract.form.d.ts +5 -1
- package/lib/forms/transaction/work/work-expense.form.d.ts +5 -0
- package/lib/models/property/property.d.ts +6 -8
- package/lib/services/http/rest/rest-old.service.d.ts +6 -14
- package/lib/services/http/rest/rest.service.d.ts +3 -3
- package/lib/services/http/transaction/transaction.service.d.ts +1 -1
- package/lib/services/pdf/pdf-from-table/pdf-from-table.service.d.ts +4 -4
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import first from 'lodash/first';
|
|
|
16
16
|
import last from 'lodash/last';
|
|
17
17
|
import uniqBy from 'lodash/uniqBy';
|
|
18
18
|
import differenceBy from 'lodash/differenceBy';
|
|
19
|
-
import
|
|
19
|
+
import moment from 'moment';
|
|
20
20
|
import { DateRange } from 'moment-range';
|
|
21
21
|
import intersection from 'lodash/intersection';
|
|
22
22
|
import { Validators, UntypedFormGroup, UntypedFormControl, UntypedFormArray, FormArray, FormGroup, FormControl } from '@angular/forms';
|
|
@@ -33,7 +33,8 @@ import merge from 'lodash/merge';
|
|
|
33
33
|
import { loadStripe } from '@stripe/stripe-js';
|
|
34
34
|
import fromPairs from 'lodash/fromPairs';
|
|
35
35
|
import { jsPDF } from 'jspdf';
|
|
36
|
-
import
|
|
36
|
+
import { applyPlugin } from 'jspdf-autotable';
|
|
37
|
+
import html2pdf from 'html2pdf.js';
|
|
37
38
|
import isEqual from 'lodash/isEqual';
|
|
38
39
|
import * as xlsx from 'xlsx';
|
|
39
40
|
import * as FileSaver from 'file-saver';
|
|
@@ -2802,13 +2803,12 @@ var ChartAccountValues = [
|
|
|
2802
2803
|
}
|
|
2803
2804
|
];
|
|
2804
2805
|
|
|
2806
|
+
/**
|
|
2807
|
+
* @TODO vik performance problems, try https://angular.io/guide/dependency-injection-providers?
|
|
2808
|
+
*/
|
|
2805
2809
|
const CHART_ACCOUNTS_VALUES = new CollectionDictionary(new Collection(ChartAccountValues.map((value) => plainToClass(ChartAccountsValue$1, value))), 'chartAccounts.id');
|
|
2806
2810
|
|
|
2807
2811
|
class ChartAccounts extends ChartAccounts$1 {
|
|
2808
|
-
constructor() {
|
|
2809
|
-
super(...arguments);
|
|
2810
|
-
this.values = [];
|
|
2811
|
-
}
|
|
2812
2812
|
/**
|
|
2813
2813
|
* Return name as string
|
|
2814
2814
|
*/
|
|
@@ -2942,7 +2942,6 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
2942
2942
|
* Get chart accounts value for current financial year
|
|
2943
2943
|
*/
|
|
2944
2944
|
getCurrentYearValue() {
|
|
2945
|
-
console.log(this);
|
|
2946
2945
|
return this.getValueByYear(new FinancialYear().year);
|
|
2947
2946
|
}
|
|
2948
2947
|
/**
|
|
@@ -3012,10 +3011,9 @@ __decorate([
|
|
|
3012
3011
|
], ChartAccounts.prototype, "metadata", void 0);
|
|
3013
3012
|
__decorate([
|
|
3014
3013
|
Type(() => ChartAccountsValue),
|
|
3015
|
-
Transform(({ obj }) => {
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
}, { toClassOnly: true })
|
|
3014
|
+
Transform(({ obj }) => CHART_ACCOUNTS_VALUES.get(obj.id).toArray(), { toClassOnly: true }),
|
|
3015
|
+
Transform(() => null, { toPlainOnly: true }),
|
|
3016
|
+
Expose()
|
|
3019
3017
|
], ChartAccounts.prototype, "values", void 0);
|
|
3020
3018
|
|
|
3021
3019
|
class ChartAccountsDepreciation extends ChartAccountsDepreciation$1 {
|
|
@@ -8190,6 +8188,7 @@ const ENDPOINTS = {
|
|
|
8190
8188
|
CLIENT_MOVEMENTS_CLOSE: new Endpoint('PUT', '\\/client-movements\\/\\d+\\/close'),
|
|
8191
8189
|
CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
|
|
8192
8190
|
CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
|
|
8191
|
+
CLIENT_INCOME_TYPES_POST: new Endpoint('POST', '\\/client-income-types'),
|
|
8193
8192
|
COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
|
|
8194
8193
|
CORELOGIC_TOKEN_GET: new Endpoint('GET', '/access\\/oauth\\/token.*$'),
|
|
8195
8194
|
DEPRECIATIONS_OPENING_GET: new Endpoint('GET', '\\/depreciations\\/\\opening-balance\.\*'),
|
|
@@ -8505,9 +8504,9 @@ let RestService$1 = class RestService {
|
|
|
8505
8504
|
*/
|
|
8506
8505
|
post(model) {
|
|
8507
8506
|
this.handleAccessError('post');
|
|
8508
|
-
return this.http.post(this.apiUrl, model)
|
|
8507
|
+
return this.http.post(this.apiUrl, classToPlain(model))
|
|
8509
8508
|
.pipe(map((response) => {
|
|
8510
|
-
const result = this.createModelInstance(
|
|
8509
|
+
const result = this.createModelInstance(response);
|
|
8511
8510
|
this.handleResponse([result], 'post');
|
|
8512
8511
|
return result;
|
|
8513
8512
|
}));
|
|
@@ -8517,9 +8516,9 @@ let RestService$1 = class RestService {
|
|
|
8517
8516
|
*/
|
|
8518
8517
|
postBatch(models) {
|
|
8519
8518
|
this.handleAccessError('postBatch');
|
|
8520
|
-
return this.http.post(this.apiUrl, models)
|
|
8519
|
+
return this.http.post(this.apiUrl, classToPlain(models))
|
|
8521
8520
|
.pipe(map((response) => {
|
|
8522
|
-
const result = response.map((item) => this.createModelInstance(
|
|
8521
|
+
const result = response.map((item) => this.createModelInstance(item));
|
|
8523
8522
|
this.handleResponse(result, 'post');
|
|
8524
8523
|
return result;
|
|
8525
8524
|
}));
|
|
@@ -8529,9 +8528,9 @@ let RestService$1 = class RestService {
|
|
|
8529
8528
|
*/
|
|
8530
8529
|
put(model) {
|
|
8531
8530
|
this.handleAccessError('put');
|
|
8532
|
-
return this.http.put(`${this.apiUrl}/${model.id}`, model)
|
|
8531
|
+
return this.http.put(`${this.apiUrl}/${model.id}`, classToPlain(model))
|
|
8533
8532
|
.pipe(map((response) => {
|
|
8534
|
-
const result = this.createModelInstance(
|
|
8533
|
+
const result = this.createModelInstance(response);
|
|
8535
8534
|
this.handleResponse([result], 'put');
|
|
8536
8535
|
return result;
|
|
8537
8536
|
}));
|
|
@@ -8541,9 +8540,9 @@ let RestService$1 = class RestService {
|
|
|
8541
8540
|
*/
|
|
8542
8541
|
putBatch(models) {
|
|
8543
8542
|
this.handleAccessError('putBatch');
|
|
8544
|
-
return this.http.put(this.apiUrl, models)
|
|
8543
|
+
return this.http.put(this.apiUrl, classToPlain(models))
|
|
8545
8544
|
.pipe(map((response) => {
|
|
8546
|
-
const result = response.map((item) => this.createModelInstance(
|
|
8545
|
+
const result = response.map((item) => this.createModelInstance(item));
|
|
8547
8546
|
this.handleResponse(result, 'put');
|
|
8548
8547
|
return result;
|
|
8549
8548
|
}));
|
|
@@ -8563,7 +8562,7 @@ let RestService$1 = class RestService {
|
|
|
8563
8562
|
*/
|
|
8564
8563
|
deleteBatch(models) {
|
|
8565
8564
|
this.handleAccessError('deleteBatch');
|
|
8566
|
-
return this.http.post(`${this.apiUrl}/delete`, models)
|
|
8565
|
+
return this.http.post(`${this.apiUrl}/delete`, classToPlain(models))
|
|
8567
8566
|
.pipe(map(() => {
|
|
8568
8567
|
this.handleResponse(models, 'delete');
|
|
8569
8568
|
}));
|
|
@@ -8580,7 +8579,7 @@ let RestService$1 = class RestService {
|
|
|
8580
8579
|
fetch() {
|
|
8581
8580
|
return this.http.get(this.apiUrl)
|
|
8582
8581
|
.pipe(map((response) => this.isApiPlatform ? response['hydra:member'] : toArray(response)), map((response) => {
|
|
8583
|
-
const items = response.map((item) => this.createModelInstance(
|
|
8582
|
+
const items = response.map((item) => this.createModelInstance(item));
|
|
8584
8583
|
this.cache = this.createCollectionInstance(this.collectionClass, items);
|
|
8585
8584
|
this.cacheSubject.next(this.cache);
|
|
8586
8585
|
return this.cache;
|
|
@@ -8628,13 +8627,13 @@ let RestService$1 = class RestService {
|
|
|
8628
8627
|
this.eventDispatcherService.dispatch2(new AppEvent2(eventName, items));
|
|
8629
8628
|
}
|
|
8630
8629
|
/**
|
|
8630
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
8631
8631
|
* Create new instance of class
|
|
8632
|
-
* @param model
|
|
8633
|
-
* @param plain Single object or array from which will be created model instance(s)
|
|
8632
|
+
* @param model Single object or array from which will be created model instance(s)
|
|
8634
8633
|
*/
|
|
8635
|
-
createModelInstance(model
|
|
8634
|
+
createModelInstance(model) {
|
|
8636
8635
|
// excludePrefixes - class-transformer option is using to ignore hydra fields
|
|
8637
|
-
return plainToClass(
|
|
8636
|
+
return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
|
|
8638
8637
|
}
|
|
8639
8638
|
createCollectionInstance(collectionClass, items) {
|
|
8640
8639
|
return new collectionClass(items);
|
|
@@ -11910,12 +11909,12 @@ class RestService {
|
|
|
11910
11909
|
* add new instance and update cache
|
|
11911
11910
|
*/
|
|
11912
11911
|
create(data, shouldUpdateCache = true) {
|
|
11913
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, data)
|
|
11912
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(data))
|
|
11914
11913
|
.pipe(map((newItem) => {
|
|
11915
11914
|
if (!shouldUpdateCache) {
|
|
11916
11915
|
return null;
|
|
11917
11916
|
}
|
|
11918
|
-
const newInstance = this.createModelInstance(
|
|
11917
|
+
const newInstance = this.createModelInstance(newItem);
|
|
11919
11918
|
if (this.cache) {
|
|
11920
11919
|
this.cache.push(newInstance);
|
|
11921
11920
|
this.updateCache();
|
|
@@ -11952,7 +11951,7 @@ class RestService {
|
|
|
11952
11951
|
addBatch(models, queryParams = {}) {
|
|
11953
11952
|
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(models), queryParams)
|
|
11954
11953
|
.pipe(map((newItems) => {
|
|
11955
|
-
const newInstances = newItems.map((item) => this.createModelInstance(
|
|
11954
|
+
const newInstances = newItems.map((item) => this.createModelInstance(item));
|
|
11956
11955
|
if (this.cache) {
|
|
11957
11956
|
this.cache.push(...newInstances);
|
|
11958
11957
|
this.updateCache();
|
|
@@ -11972,7 +11971,7 @@ class RestService {
|
|
|
11972
11971
|
update(model, queryParams = {}) {
|
|
11973
11972
|
return this.http.put(`${this.environment.apiV2}/${this.url}/${model['id']}`, classToPlain(model), queryParams)
|
|
11974
11973
|
.pipe(map((updatedItem) => {
|
|
11975
|
-
const updatedInstance = this.createModelInstance(
|
|
11974
|
+
const updatedInstance = this.createModelInstance(updatedItem);
|
|
11976
11975
|
replace(this.cache, updatedInstance);
|
|
11977
11976
|
this.updateCache();
|
|
11978
11977
|
if (this.messageUpdated) {
|
|
@@ -11990,7 +11989,7 @@ class RestService {
|
|
|
11990
11989
|
updateBatch(models, queryParams = {}) {
|
|
11991
11990
|
return this.http.put(`${this.environment.apiV2}/${this.url}`, classToPlain(models), queryParams)
|
|
11992
11991
|
.pipe(map((updatedItems) => {
|
|
11993
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(
|
|
11992
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(item));
|
|
11994
11993
|
updatedInstances.forEach((instance) => {
|
|
11995
11994
|
replace(this.cache, instance);
|
|
11996
11995
|
});
|
|
@@ -12020,7 +12019,7 @@ class RestService {
|
|
|
12020
12019
|
* @param models Class instances array for deleting
|
|
12021
12020
|
*/
|
|
12022
12021
|
deleteBatch(models) {
|
|
12023
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}/delete`, models)
|
|
12022
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}/delete`, classToPlain(models))
|
|
12024
12023
|
.pipe(map(() => {
|
|
12025
12024
|
const ids = models.map((model) => model['id']);
|
|
12026
12025
|
this.cache = this.cache.filter((item) => !ids.includes(item['id']));
|
|
@@ -12044,7 +12043,7 @@ class RestService {
|
|
|
12044
12043
|
.pipe(map((response) => {
|
|
12045
12044
|
const items = (this.isHydra ? response['hydra:member'] : response)
|
|
12046
12045
|
.map((item) => {
|
|
12047
|
-
return this.createModelInstance(
|
|
12046
|
+
return this.createModelInstance(item);
|
|
12048
12047
|
});
|
|
12049
12048
|
this.cache = items;
|
|
12050
12049
|
this.updateCache();
|
|
@@ -12058,22 +12057,12 @@ class RestService {
|
|
|
12058
12057
|
this.cacheSubject.next(this.cache.slice());
|
|
12059
12058
|
}
|
|
12060
12059
|
/**
|
|
12060
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
12061
12061
|
* Create new instance of class
|
|
12062
|
-
* @param model
|
|
12063
|
-
* @param baseModel base model instance that we will use as constructor options
|
|
12064
|
-
* @param data additional data
|
|
12065
|
-
*/
|
|
12066
|
-
createModelInstance(model, baseModel, data = {}) {
|
|
12067
|
-
return plainToClass(model, Object.assign(data, baseModel), { excludePrefixes: ['@'] });
|
|
12068
|
-
}
|
|
12069
|
-
/**
|
|
12070
|
-
* @TODO Alex is there any point to pass model param instead of this.modelClass?
|
|
12071
|
-
* Create new instance of class
|
|
12072
|
-
* @param baseModel base model instance that we will use as constructor options
|
|
12073
|
-
* @param data additional data
|
|
12062
|
+
* @param model instance that we will use as constructor options
|
|
12074
12063
|
*/
|
|
12075
|
-
|
|
12076
|
-
return plainToClass(this.modelClass,
|
|
12064
|
+
createModelInstance(model) {
|
|
12065
|
+
return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
|
|
12077
12066
|
}
|
|
12078
12067
|
/**
|
|
12079
12068
|
* Method that call all listeners. Empty by default. Should be redefined by child services if required
|
|
@@ -12943,7 +12932,7 @@ class IncomeSourceService extends RestService {
|
|
|
12943
12932
|
updateBatch(incomeSources, queryParams = {}) {
|
|
12944
12933
|
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
12945
12934
|
.pipe(map((updatedItems) => {
|
|
12946
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(
|
|
12935
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(item));
|
|
12947
12936
|
updatedInstances.forEach((instance) => {
|
|
12948
12937
|
replace(this.cache, instance);
|
|
12949
12938
|
});
|
|
@@ -14426,9 +14415,9 @@ class TransactionService extends RestService {
|
|
|
14426
14415
|
*/
|
|
14427
14416
|
addBatch(transactions) {
|
|
14428
14417
|
transactions = _.cloneDeep(transactions);
|
|
14429
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, transactions)
|
|
14418
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(transactions))
|
|
14430
14419
|
.pipe(map((response) => {
|
|
14431
|
-
const addedTransactions = response.map((item) => this.
|
|
14420
|
+
const addedTransactions = response.map((item) => this.createModelInstance(item));
|
|
14432
14421
|
transactions.forEach((transaction, index) => {
|
|
14433
14422
|
// @TODO backend: need to upload file in the same backend endpoint with transaction add/update
|
|
14434
14423
|
// check if passed receipt and upload file
|
|
@@ -14441,7 +14430,7 @@ class TransactionService extends RestService {
|
|
|
14441
14430
|
// add child transactions if exist
|
|
14442
14431
|
if (transaction.transactions.length) {
|
|
14443
14432
|
transaction.transactions.forEach((childTransaction) => {
|
|
14444
|
-
childTransaction.parentTransaction = this.
|
|
14433
|
+
childTransaction.parentTransaction = this.createModelInstance({ id: addedTransactions[index].id });
|
|
14445
14434
|
});
|
|
14446
14435
|
this.addBatch(transaction.transactions).subscribe();
|
|
14447
14436
|
}
|
|
@@ -14463,9 +14452,9 @@ class TransactionService extends RestService {
|
|
|
14463
14452
|
* @param transaction Transaction instance for updating
|
|
14464
14453
|
*/
|
|
14465
14454
|
update(transaction) {
|
|
14466
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, transaction)
|
|
14455
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, classToPlain(transaction))
|
|
14467
14456
|
.pipe(map((response) => {
|
|
14468
|
-
const updatedTransaction = this.
|
|
14457
|
+
const updatedTransaction = this.createModelInstance(response);
|
|
14469
14458
|
// @TODO need to upload file in the same backend endpoint with transaction add/update
|
|
14470
14459
|
// check if passed new receipt and upload file
|
|
14471
14460
|
if (transaction.file) {
|
|
@@ -14480,7 +14469,7 @@ class TransactionService extends RestService {
|
|
|
14480
14469
|
if (transaction.transactions.length) {
|
|
14481
14470
|
// add parent transaction to child transactions
|
|
14482
14471
|
transaction.transactions.forEach((childTransaction) => {
|
|
14483
|
-
childTransaction.parentTransaction = this.
|
|
14472
|
+
childTransaction.parentTransaction = this.createModelInstance({ id: updatedTransaction.id });
|
|
14484
14473
|
});
|
|
14485
14474
|
// separate child transactions by id existing to define add or update action.
|
|
14486
14475
|
const childTransactionsToUpdate = transaction.transactions.filter((t) => t.id);
|
|
@@ -14503,9 +14492,9 @@ class TransactionService extends RestService {
|
|
|
14503
14492
|
* @param transactions list of transactions for updating
|
|
14504
14493
|
*/
|
|
14505
14494
|
updateBatch(transactions) {
|
|
14506
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}`, transactions)
|
|
14495
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}`, classToPlain(transactions))
|
|
14507
14496
|
.pipe(map((response) => {
|
|
14508
|
-
const updatedTransactions = response.map((item) => this.
|
|
14497
|
+
const updatedTransactions = response.map((item) => this.createModelInstance(item));
|
|
14509
14498
|
updatedTransactions.forEach((updatedTransaction) => {
|
|
14510
14499
|
replace(this.cache, updatedTransaction);
|
|
14511
14500
|
});
|
|
@@ -14543,6 +14532,7 @@ class TransactionService extends RestService {
|
|
|
14543
14532
|
}));
|
|
14544
14533
|
}
|
|
14545
14534
|
/**
|
|
14535
|
+
* @TODO Alex wrong place for this logic, move to model
|
|
14546
14536
|
* calculate gross income amount based on transaction amount and taxes (fees)
|
|
14547
14537
|
* @param transaction Transaction instance for calculation
|
|
14548
14538
|
*/
|
|
@@ -14620,9 +14610,6 @@ class TransactionService extends RestService {
|
|
|
14620
14610
|
this.resetCache();
|
|
14621
14611
|
});
|
|
14622
14612
|
}
|
|
14623
|
-
createModelInstance2(baseModel, data = {}) {
|
|
14624
|
-
return super.createModelInstance2(baseModel, { values: [] });
|
|
14625
|
-
}
|
|
14626
14613
|
}
|
|
14627
14614
|
TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: TransactionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: TransactionReceiptService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14628
14615
|
TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: TransactionService, providedIn: 'root' });
|
|
@@ -15431,6 +15418,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
|
|
|
15431
15418
|
args: ['environment']
|
|
15432
15419
|
}] }]; } });
|
|
15433
15420
|
|
|
15421
|
+
applyPlugin(jsPDF);
|
|
15434
15422
|
/**
|
|
15435
15423
|
* jspdf-autotable is a plugin, adding table functionality to jspdf object without new class,
|
|
15436
15424
|
* we need to let ts knows about that by defining an interface and extending jsPdf class (to avoid ts error)
|
|
@@ -16193,6 +16181,7 @@ class AbstractForm extends UntypedFormGroup {
|
|
|
16193
16181
|
this.unsaved = false;
|
|
16194
16182
|
this.onSubmit = new EventEmitter();
|
|
16195
16183
|
this.model = model || this.createModelInstance();
|
|
16184
|
+
// @TODO Alex no idea how it works, since modelClass used in createModelInstance
|
|
16196
16185
|
this.modelClass = this.model.constructor;
|
|
16197
16186
|
this.initialValue = this.value;
|
|
16198
16187
|
if (model && !model['id']) {
|
|
@@ -16233,6 +16222,10 @@ class AbstractForm extends UntypedFormGroup {
|
|
|
16233
16222
|
markAsSaved() {
|
|
16234
16223
|
this.unsaved = false;
|
|
16235
16224
|
}
|
|
16225
|
+
/**
|
|
16226
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
16227
|
+
* @param data
|
|
16228
|
+
*/
|
|
16236
16229
|
createModelInstance(data = {}) {
|
|
16237
16230
|
return plainToClass(this.modelClass, data);
|
|
16238
16231
|
}
|
|
@@ -17101,7 +17094,7 @@ class SoleInvoiceForm extends AbstractForm {
|
|
|
17101
17094
|
*/
|
|
17102
17095
|
get currentValue() {
|
|
17103
17096
|
const formRawValue = this.getRawValue();
|
|
17104
|
-
return
|
|
17097
|
+
return this.createModelInstance(Object.assign({}, this.model, { ...formRawValue.commonData, items: formRawValue.items }));
|
|
17105
17098
|
}
|
|
17106
17099
|
}
|
|
17107
17100
|
|
|
@@ -18492,7 +18485,6 @@ class TransactionForm extends TransactionBaseForm {
|
|
|
18492
18485
|
|
|
18493
18486
|
class WorkTransactionForm extends TransactionForm {
|
|
18494
18487
|
constructor(transaction, registeredForGst, allocations, controls = {}) {
|
|
18495
|
-
console.log(transaction);
|
|
18496
18488
|
super(transaction, registeredForGst, allocations, Object.assign(controls, {
|
|
18497
18489
|
// additional data related to work (like tax instalments)
|
|
18498
18490
|
metadata: new FormArray((transaction.metadata || []).map((transactionMetadata) => {
|
|
@@ -18610,6 +18602,13 @@ class WorkIncomeForm extends WorkTransactionForm {
|
|
|
18610
18602
|
}
|
|
18611
18603
|
|
|
18612
18604
|
class WorkExpenseForm extends WorkTransactionForm {
|
|
18605
|
+
constructor(transaction, registeredForGst, allocations, controls = {}) {
|
|
18606
|
+
super(transaction, registeredForGst, allocations, controls);
|
|
18607
|
+
// amount set automatically for chartAccounts with hours metadata
|
|
18608
|
+
if (transaction.getMetadataFieldValue(ChartAccountsMetadataListEnum.HOURS)) {
|
|
18609
|
+
this.get('amount').disable();
|
|
18610
|
+
}
|
|
18611
|
+
}
|
|
18613
18612
|
listenEvents() {
|
|
18614
18613
|
this.watchChartAccountsMetadata();
|
|
18615
18614
|
}
|
|
@@ -18622,7 +18621,7 @@ class WorkExpenseForm extends WorkTransactionForm {
|
|
|
18622
18621
|
// for home office hours expense amount is a fixed rate per hour
|
|
18623
18622
|
this.get('amount').reset();
|
|
18624
18623
|
this.get('amount').disable();
|
|
18625
|
-
this.get('amount').setValue(this.get('chartAccounts').value.getCurrentYearValue().value * +hoursMetadata.value);
|
|
18624
|
+
this.get('amount').setValue((this.get('chartAccounts').value.getCurrentYearValue().value * +hoursMetadata.value).toFixed(2));
|
|
18626
18625
|
});
|
|
18627
18626
|
}
|
|
18628
18627
|
}
|