taxtank-core 0.30.3 → 0.30.5
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/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 +58 -60
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +58 -60
- 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/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
|
@@ -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';
|
|
@@ -2815,13 +2816,12 @@ var ChartAccountValues = [
|
|
|
2815
2816
|
}
|
|
2816
2817
|
];
|
|
2817
2818
|
|
|
2819
|
+
/**
|
|
2820
|
+
* @TODO vik performance problems, try https://angular.io/guide/dependency-injection-providers?
|
|
2821
|
+
*/
|
|
2818
2822
|
const CHART_ACCOUNTS_VALUES = new CollectionDictionary(new Collection(ChartAccountValues.map((value) => plainToClass(ChartAccountsValue$1, value))), 'chartAccounts.id');
|
|
2819
2823
|
|
|
2820
2824
|
class ChartAccounts extends ChartAccounts$1 {
|
|
2821
|
-
constructor() {
|
|
2822
|
-
super(...arguments);
|
|
2823
|
-
this.values = [];
|
|
2824
|
-
}
|
|
2825
2825
|
/**
|
|
2826
2826
|
* Return name as string
|
|
2827
2827
|
*/
|
|
@@ -2956,7 +2956,6 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
2956
2956
|
* Get chart accounts value for current financial year
|
|
2957
2957
|
*/
|
|
2958
2958
|
getCurrentYearValue() {
|
|
2959
|
-
console.log(this);
|
|
2960
2959
|
return this.getValueByYear(new FinancialYear().year);
|
|
2961
2960
|
}
|
|
2962
2961
|
/**
|
|
@@ -3027,10 +3026,9 @@ __decorate([
|
|
|
3027
3026
|
], ChartAccounts.prototype, "metadata", void 0);
|
|
3028
3027
|
__decorate([
|
|
3029
3028
|
Type(() => ChartAccountsValue),
|
|
3030
|
-
Transform(({ obj }) => {
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
}, { toClassOnly: true })
|
|
3029
|
+
Transform(({ obj }) => CHART_ACCOUNTS_VALUES.get(obj.id).toArray(), { toClassOnly: true }),
|
|
3030
|
+
Transform(() => null, { toPlainOnly: true }),
|
|
3031
|
+
Expose()
|
|
3034
3032
|
], ChartAccounts.prototype, "values", void 0);
|
|
3035
3033
|
|
|
3036
3034
|
class ChartAccountsDepreciation extends ChartAccountsDepreciation$1 {
|
|
@@ -8556,9 +8554,9 @@ let RestService$1 = class RestService {
|
|
|
8556
8554
|
*/
|
|
8557
8555
|
post(model) {
|
|
8558
8556
|
this.handleAccessError('post');
|
|
8559
|
-
return this.http.post(this.apiUrl, model)
|
|
8557
|
+
return this.http.post(this.apiUrl, classToPlain(model))
|
|
8560
8558
|
.pipe(map((response) => {
|
|
8561
|
-
const result = this.createModelInstance(
|
|
8559
|
+
const result = this.createModelInstance(response);
|
|
8562
8560
|
this.handleResponse([result], 'post');
|
|
8563
8561
|
return result;
|
|
8564
8562
|
}));
|
|
@@ -8568,9 +8566,9 @@ let RestService$1 = class RestService {
|
|
|
8568
8566
|
*/
|
|
8569
8567
|
postBatch(models) {
|
|
8570
8568
|
this.handleAccessError('postBatch');
|
|
8571
|
-
return this.http.post(this.apiUrl, models)
|
|
8569
|
+
return this.http.post(this.apiUrl, classToPlain(models))
|
|
8572
8570
|
.pipe(map((response) => {
|
|
8573
|
-
const result = response.map((item) => this.createModelInstance(
|
|
8571
|
+
const result = response.map((item) => this.createModelInstance(item));
|
|
8574
8572
|
this.handleResponse(result, 'post');
|
|
8575
8573
|
return result;
|
|
8576
8574
|
}));
|
|
@@ -8580,9 +8578,9 @@ let RestService$1 = class RestService {
|
|
|
8580
8578
|
*/
|
|
8581
8579
|
put(model) {
|
|
8582
8580
|
this.handleAccessError('put');
|
|
8583
|
-
return this.http.put(`${this.apiUrl}/${model.id}`, model)
|
|
8581
|
+
return this.http.put(`${this.apiUrl}/${model.id}`, classToPlain(model))
|
|
8584
8582
|
.pipe(map((response) => {
|
|
8585
|
-
const result = this.createModelInstance(
|
|
8583
|
+
const result = this.createModelInstance(response);
|
|
8586
8584
|
this.handleResponse([result], 'put');
|
|
8587
8585
|
return result;
|
|
8588
8586
|
}));
|
|
@@ -8592,9 +8590,9 @@ let RestService$1 = class RestService {
|
|
|
8592
8590
|
*/
|
|
8593
8591
|
putBatch(models) {
|
|
8594
8592
|
this.handleAccessError('putBatch');
|
|
8595
|
-
return this.http.put(this.apiUrl, models)
|
|
8593
|
+
return this.http.put(this.apiUrl, classToPlain(models))
|
|
8596
8594
|
.pipe(map((response) => {
|
|
8597
|
-
const result = response.map((item) => this.createModelInstance(
|
|
8595
|
+
const result = response.map((item) => this.createModelInstance(item));
|
|
8598
8596
|
this.handleResponse(result, 'put');
|
|
8599
8597
|
return result;
|
|
8600
8598
|
}));
|
|
@@ -8614,7 +8612,7 @@ let RestService$1 = class RestService {
|
|
|
8614
8612
|
*/
|
|
8615
8613
|
deleteBatch(models) {
|
|
8616
8614
|
this.handleAccessError('deleteBatch');
|
|
8617
|
-
return this.http.post(`${this.apiUrl}/delete`, models)
|
|
8615
|
+
return this.http.post(`${this.apiUrl}/delete`, classToPlain(models))
|
|
8618
8616
|
.pipe(map(() => {
|
|
8619
8617
|
this.handleResponse(models, 'delete');
|
|
8620
8618
|
}));
|
|
@@ -8631,7 +8629,7 @@ let RestService$1 = class RestService {
|
|
|
8631
8629
|
fetch() {
|
|
8632
8630
|
return this.http.get(this.apiUrl)
|
|
8633
8631
|
.pipe(map((response) => this.isApiPlatform ? response['hydra:member'] : toArray(response)), map((response) => {
|
|
8634
|
-
const items = response.map((item) => this.createModelInstance(
|
|
8632
|
+
const items = response.map((item) => this.createModelInstance(item));
|
|
8635
8633
|
this.cache = this.createCollectionInstance(this.collectionClass, items);
|
|
8636
8634
|
this.cacheSubject.next(this.cache);
|
|
8637
8635
|
return this.cache;
|
|
@@ -8679,13 +8677,13 @@ let RestService$1 = class RestService {
|
|
|
8679
8677
|
this.eventDispatcherService.dispatch2(new AppEvent2(eventName, items));
|
|
8680
8678
|
}
|
|
8681
8679
|
/**
|
|
8680
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
8682
8681
|
* Create new instance of class
|
|
8683
|
-
* @param model
|
|
8684
|
-
* @param plain Single object or array from which will be created model instance(s)
|
|
8682
|
+
* @param model Single object or array from which will be created model instance(s)
|
|
8685
8683
|
*/
|
|
8686
|
-
createModelInstance(model
|
|
8684
|
+
createModelInstance(model) {
|
|
8687
8685
|
// excludePrefixes - class-transformer option is using to ignore hydra fields
|
|
8688
|
-
return plainToClass(
|
|
8686
|
+
return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
|
|
8689
8687
|
}
|
|
8690
8688
|
createCollectionInstance(collectionClass, items) {
|
|
8691
8689
|
return new collectionClass(items);
|
|
@@ -11992,12 +11990,12 @@ class RestService {
|
|
|
11992
11990
|
* add new instance and update cache
|
|
11993
11991
|
*/
|
|
11994
11992
|
create(data, shouldUpdateCache = true) {
|
|
11995
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, data)
|
|
11993
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(data))
|
|
11996
11994
|
.pipe(map((newItem) => {
|
|
11997
11995
|
if (!shouldUpdateCache) {
|
|
11998
11996
|
return null;
|
|
11999
11997
|
}
|
|
12000
|
-
const newInstance = this.createModelInstance(
|
|
11998
|
+
const newInstance = this.createModelInstance(newItem);
|
|
12001
11999
|
if (this.cache) {
|
|
12002
12000
|
this.cache.push(newInstance);
|
|
12003
12001
|
this.updateCache();
|
|
@@ -12034,7 +12032,7 @@ class RestService {
|
|
|
12034
12032
|
addBatch(models, queryParams = {}) {
|
|
12035
12033
|
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(models), queryParams)
|
|
12036
12034
|
.pipe(map((newItems) => {
|
|
12037
|
-
const newInstances = newItems.map((item) => this.createModelInstance(
|
|
12035
|
+
const newInstances = newItems.map((item) => this.createModelInstance(item));
|
|
12038
12036
|
if (this.cache) {
|
|
12039
12037
|
this.cache.push(...newInstances);
|
|
12040
12038
|
this.updateCache();
|
|
@@ -12054,7 +12052,7 @@ class RestService {
|
|
|
12054
12052
|
update(model, queryParams = {}) {
|
|
12055
12053
|
return this.http.put(`${this.environment.apiV2}/${this.url}/${model['id']}`, classToPlain(model), queryParams)
|
|
12056
12054
|
.pipe(map((updatedItem) => {
|
|
12057
|
-
const updatedInstance = this.createModelInstance(
|
|
12055
|
+
const updatedInstance = this.createModelInstance(updatedItem);
|
|
12058
12056
|
replace(this.cache, updatedInstance);
|
|
12059
12057
|
this.updateCache();
|
|
12060
12058
|
if (this.messageUpdated) {
|
|
@@ -12072,7 +12070,7 @@ class RestService {
|
|
|
12072
12070
|
updateBatch(models, queryParams = {}) {
|
|
12073
12071
|
return this.http.put(`${this.environment.apiV2}/${this.url}`, classToPlain(models), queryParams)
|
|
12074
12072
|
.pipe(map((updatedItems) => {
|
|
12075
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(
|
|
12073
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(item));
|
|
12076
12074
|
updatedInstances.forEach((instance) => {
|
|
12077
12075
|
replace(this.cache, instance);
|
|
12078
12076
|
});
|
|
@@ -12102,7 +12100,7 @@ class RestService {
|
|
|
12102
12100
|
* @param models Class instances array for deleting
|
|
12103
12101
|
*/
|
|
12104
12102
|
deleteBatch(models) {
|
|
12105
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}/delete`, models)
|
|
12103
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}/delete`, classToPlain(models))
|
|
12106
12104
|
.pipe(map(() => {
|
|
12107
12105
|
const ids = models.map((model) => model['id']);
|
|
12108
12106
|
this.cache = this.cache.filter((item) => !ids.includes(item['id']));
|
|
@@ -12126,7 +12124,7 @@ class RestService {
|
|
|
12126
12124
|
.pipe(map((response) => {
|
|
12127
12125
|
const items = (this.isHydra ? response['hydra:member'] : response)
|
|
12128
12126
|
.map((item) => {
|
|
12129
|
-
return this.createModelInstance(
|
|
12127
|
+
return this.createModelInstance(item);
|
|
12130
12128
|
});
|
|
12131
12129
|
this.cache = items;
|
|
12132
12130
|
this.updateCache();
|
|
@@ -12140,22 +12138,12 @@ class RestService {
|
|
|
12140
12138
|
this.cacheSubject.next(this.cache.slice());
|
|
12141
12139
|
}
|
|
12142
12140
|
/**
|
|
12141
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
12143
12142
|
* Create new instance of class
|
|
12144
|
-
* @param model
|
|
12145
|
-
* @param baseModel base model instance that we will use as constructor options
|
|
12146
|
-
* @param data additional data
|
|
12147
|
-
*/
|
|
12148
|
-
createModelInstance(model, baseModel, data = {}) {
|
|
12149
|
-
return plainToClass(model, Object.assign(data, baseModel), { excludePrefixes: ['@'] });
|
|
12150
|
-
}
|
|
12151
|
-
/**
|
|
12152
|
-
* @TODO Alex is there any point to pass model param instead of this.modelClass?
|
|
12153
|
-
* Create new instance of class
|
|
12154
|
-
* @param baseModel base model instance that we will use as constructor options
|
|
12155
|
-
* @param data additional data
|
|
12143
|
+
* @param model instance that we will use as constructor options
|
|
12156
12144
|
*/
|
|
12157
|
-
|
|
12158
|
-
return plainToClass(this.modelClass,
|
|
12145
|
+
createModelInstance(model) {
|
|
12146
|
+
return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
|
|
12159
12147
|
}
|
|
12160
12148
|
/**
|
|
12161
12149
|
* Method that call all listeners. Empty by default. Should be redefined by child services if required
|
|
@@ -13035,7 +13023,7 @@ class IncomeSourceService extends RestService {
|
|
|
13035
13023
|
updateBatch(incomeSources, queryParams = {}) {
|
|
13036
13024
|
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
13037
13025
|
.pipe(map((updatedItems) => {
|
|
13038
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(
|
|
13026
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(item));
|
|
13039
13027
|
updatedInstances.forEach((instance) => {
|
|
13040
13028
|
replace(this.cache, instance);
|
|
13041
13029
|
});
|
|
@@ -14536,9 +14524,9 @@ class TransactionService extends RestService {
|
|
|
14536
14524
|
*/
|
|
14537
14525
|
addBatch(transactions) {
|
|
14538
14526
|
transactions = _.cloneDeep(transactions);
|
|
14539
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, transactions)
|
|
14527
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(transactions))
|
|
14540
14528
|
.pipe(map((response) => {
|
|
14541
|
-
const addedTransactions = response.map((item) => this.
|
|
14529
|
+
const addedTransactions = response.map((item) => this.createModelInstance(item));
|
|
14542
14530
|
transactions.forEach((transaction, index) => {
|
|
14543
14531
|
// @TODO backend: need to upload file in the same backend endpoint with transaction add/update
|
|
14544
14532
|
// check if passed receipt and upload file
|
|
@@ -14551,7 +14539,7 @@ class TransactionService extends RestService {
|
|
|
14551
14539
|
// add child transactions if exist
|
|
14552
14540
|
if (transaction.transactions.length) {
|
|
14553
14541
|
transaction.transactions.forEach((childTransaction) => {
|
|
14554
|
-
childTransaction.parentTransaction = this.
|
|
14542
|
+
childTransaction.parentTransaction = this.createModelInstance({ id: addedTransactions[index].id });
|
|
14555
14543
|
});
|
|
14556
14544
|
this.addBatch(transaction.transactions).subscribe();
|
|
14557
14545
|
}
|
|
@@ -14573,9 +14561,9 @@ class TransactionService extends RestService {
|
|
|
14573
14561
|
* @param transaction Transaction instance for updating
|
|
14574
14562
|
*/
|
|
14575
14563
|
update(transaction) {
|
|
14576
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, transaction)
|
|
14564
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, classToPlain(transaction))
|
|
14577
14565
|
.pipe(map((response) => {
|
|
14578
|
-
const updatedTransaction = this.
|
|
14566
|
+
const updatedTransaction = this.createModelInstance(response);
|
|
14579
14567
|
// @TODO need to upload file in the same backend endpoint with transaction add/update
|
|
14580
14568
|
// check if passed new receipt and upload file
|
|
14581
14569
|
if (transaction.file) {
|
|
@@ -14590,7 +14578,7 @@ class TransactionService extends RestService {
|
|
|
14590
14578
|
if (transaction.transactions.length) {
|
|
14591
14579
|
// add parent transaction to child transactions
|
|
14592
14580
|
transaction.transactions.forEach((childTransaction) => {
|
|
14593
|
-
childTransaction.parentTransaction = this.
|
|
14581
|
+
childTransaction.parentTransaction = this.createModelInstance({ id: updatedTransaction.id });
|
|
14594
14582
|
});
|
|
14595
14583
|
// separate child transactions by id existing to define add or update action.
|
|
14596
14584
|
const childTransactionsToUpdate = transaction.transactions.filter((t) => t.id);
|
|
@@ -14613,9 +14601,9 @@ class TransactionService extends RestService {
|
|
|
14613
14601
|
* @param transactions list of transactions for updating
|
|
14614
14602
|
*/
|
|
14615
14603
|
updateBatch(transactions) {
|
|
14616
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}`, transactions)
|
|
14604
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}`, classToPlain(transactions))
|
|
14617
14605
|
.pipe(map((response) => {
|
|
14618
|
-
const updatedTransactions = response.map((item) => this.
|
|
14606
|
+
const updatedTransactions = response.map((item) => this.createModelInstance(item));
|
|
14619
14607
|
updatedTransactions.forEach((updatedTransaction) => {
|
|
14620
14608
|
replace(this.cache, updatedTransaction);
|
|
14621
14609
|
});
|
|
@@ -14654,6 +14642,7 @@ class TransactionService extends RestService {
|
|
|
14654
14642
|
}));
|
|
14655
14643
|
}
|
|
14656
14644
|
/**
|
|
14645
|
+
* @TODO Alex wrong place for this logic, move to model
|
|
14657
14646
|
* calculate gross income amount based on transaction amount and taxes (fees)
|
|
14658
14647
|
* @param transaction Transaction instance for calculation
|
|
14659
14648
|
*/
|
|
@@ -14731,9 +14720,6 @@ class TransactionService extends RestService {
|
|
|
14731
14720
|
this.resetCache();
|
|
14732
14721
|
});
|
|
14733
14722
|
}
|
|
14734
|
-
createModelInstance2(baseModel, data = {}) {
|
|
14735
|
-
return super.createModelInstance2(baseModel, { values: [] });
|
|
14736
|
-
}
|
|
14737
14723
|
}
|
|
14738
14724
|
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 });
|
|
14739
14725
|
TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: TransactionService, providedIn: 'root' });
|
|
@@ -15556,6 +15542,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
|
|
|
15556
15542
|
}] }];
|
|
15557
15543
|
} });
|
|
15558
15544
|
|
|
15545
|
+
applyPlugin(jsPDF);
|
|
15559
15546
|
/**
|
|
15560
15547
|
* jspdf-autotable is a plugin, adding table functionality to jspdf object without new class,
|
|
15561
15548
|
* we need to let ts knows about that by defining an interface and extending jsPdf class (to avoid ts error)
|
|
@@ -16309,6 +16296,7 @@ class AbstractForm extends UntypedFormGroup {
|
|
|
16309
16296
|
this.unsaved = false;
|
|
16310
16297
|
this.onSubmit = new EventEmitter();
|
|
16311
16298
|
this.model = model || this.createModelInstance();
|
|
16299
|
+
// @TODO Alex no idea how it works, since modelClass used in createModelInstance
|
|
16312
16300
|
this.modelClass = this.model.constructor;
|
|
16313
16301
|
this.initialValue = this.value;
|
|
16314
16302
|
if (model && !model['id']) {
|
|
@@ -16349,6 +16337,10 @@ class AbstractForm extends UntypedFormGroup {
|
|
|
16349
16337
|
markAsSaved() {
|
|
16350
16338
|
this.unsaved = false;
|
|
16351
16339
|
}
|
|
16340
|
+
/**
|
|
16341
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
16342
|
+
* @param data
|
|
16343
|
+
*/
|
|
16352
16344
|
createModelInstance(data = {}) {
|
|
16353
16345
|
return plainToClass(this.modelClass, data);
|
|
16354
16346
|
}
|
|
@@ -17220,7 +17212,7 @@ class SoleInvoiceForm extends AbstractForm {
|
|
|
17220
17212
|
*/
|
|
17221
17213
|
get currentValue() {
|
|
17222
17214
|
const formRawValue = this.getRawValue();
|
|
17223
|
-
return
|
|
17215
|
+
return this.createModelInstance(Object.assign({}, this.model, Object.assign(Object.assign({}, formRawValue.commonData), { items: formRawValue.items })));
|
|
17224
17216
|
}
|
|
17225
17217
|
}
|
|
17226
17218
|
|
|
@@ -18622,7 +18614,6 @@ class TransactionForm extends TransactionBaseForm {
|
|
|
18622
18614
|
|
|
18623
18615
|
class WorkTransactionForm extends TransactionForm {
|
|
18624
18616
|
constructor(transaction, registeredForGst, allocations, controls = {}) {
|
|
18625
|
-
console.log(transaction);
|
|
18626
18617
|
super(transaction, registeredForGst, allocations, Object.assign(controls, {
|
|
18627
18618
|
// additional data related to work (like tax instalments)
|
|
18628
18619
|
metadata: new FormArray((transaction.metadata || []).map((transactionMetadata) => {
|
|
@@ -18741,6 +18732,13 @@ class WorkIncomeForm extends WorkTransactionForm {
|
|
|
18741
18732
|
}
|
|
18742
18733
|
|
|
18743
18734
|
class WorkExpenseForm extends WorkTransactionForm {
|
|
18735
|
+
constructor(transaction, registeredForGst, allocations, controls = {}) {
|
|
18736
|
+
super(transaction, registeredForGst, allocations, controls);
|
|
18737
|
+
// amount set automatically for chartAccounts with hours metadata
|
|
18738
|
+
if (transaction.getMetadataFieldValue(ChartAccountsMetadataListEnum.HOURS)) {
|
|
18739
|
+
this.get('amount').disable();
|
|
18740
|
+
}
|
|
18741
|
+
}
|
|
18744
18742
|
listenEvents() {
|
|
18745
18743
|
this.watchChartAccountsMetadata();
|
|
18746
18744
|
}
|
|
@@ -18753,7 +18751,7 @@ class WorkExpenseForm extends WorkTransactionForm {
|
|
|
18753
18751
|
// for home office hours expense amount is a fixed rate per hour
|
|
18754
18752
|
this.get('amount').reset();
|
|
18755
18753
|
this.get('amount').disable();
|
|
18756
|
-
this.get('amount').setValue(this.get('chartAccounts').value.getCurrentYearValue().value * +hoursMetadata.value);
|
|
18754
|
+
this.get('amount').setValue((this.get('chartAccounts').value.getCurrentYearValue().value * +hoursMetadata.value).toFixed(2));
|
|
18757
18755
|
});
|
|
18758
18756
|
}
|
|
18759
18757
|
}
|