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';
|
|
@@ -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 {
|
|
@@ -8239,6 +8237,7 @@ const ENDPOINTS = {
|
|
|
8239
8237
|
CLIENT_MOVEMENTS_CLOSE: new Endpoint('PUT', '\\/client-movements\\/\\d+\\/close'),
|
|
8240
8238
|
CLIENT_MOVEMENTS_GET: new Endpoint('GET', '\\/client-movements'),
|
|
8241
8239
|
CLIENT_MOVEMENTS_POST: new Endpoint('POST', '\\/client-movements'),
|
|
8240
|
+
CLIENT_INCOME_TYPES_POST: new Endpoint('POST', '\\/client-income-types'),
|
|
8242
8241
|
COUNTRIES_GET: new Endpoint('GET', '\\/countries'),
|
|
8243
8242
|
CORELOGIC_TOKEN_GET: new Endpoint('GET', '/access\\/oauth\\/token.*$'),
|
|
8244
8243
|
DEPRECIATIONS_OPENING_GET: new Endpoint('GET', '\\/depreciations\\/\\opening-balance\.\*'),
|
|
@@ -8556,9 +8555,9 @@ let RestService$1 = class RestService {
|
|
|
8556
8555
|
*/
|
|
8557
8556
|
post(model) {
|
|
8558
8557
|
this.handleAccessError('post');
|
|
8559
|
-
return this.http.post(this.apiUrl, model)
|
|
8558
|
+
return this.http.post(this.apiUrl, classToPlain(model))
|
|
8560
8559
|
.pipe(map((response) => {
|
|
8561
|
-
const result = this.createModelInstance(
|
|
8560
|
+
const result = this.createModelInstance(response);
|
|
8562
8561
|
this.handleResponse([result], 'post');
|
|
8563
8562
|
return result;
|
|
8564
8563
|
}));
|
|
@@ -8568,9 +8567,9 @@ let RestService$1 = class RestService {
|
|
|
8568
8567
|
*/
|
|
8569
8568
|
postBatch(models) {
|
|
8570
8569
|
this.handleAccessError('postBatch');
|
|
8571
|
-
return this.http.post(this.apiUrl, models)
|
|
8570
|
+
return this.http.post(this.apiUrl, classToPlain(models))
|
|
8572
8571
|
.pipe(map((response) => {
|
|
8573
|
-
const result = response.map((item) => this.createModelInstance(
|
|
8572
|
+
const result = response.map((item) => this.createModelInstance(item));
|
|
8574
8573
|
this.handleResponse(result, 'post');
|
|
8575
8574
|
return result;
|
|
8576
8575
|
}));
|
|
@@ -8580,9 +8579,9 @@ let RestService$1 = class RestService {
|
|
|
8580
8579
|
*/
|
|
8581
8580
|
put(model) {
|
|
8582
8581
|
this.handleAccessError('put');
|
|
8583
|
-
return this.http.put(`${this.apiUrl}/${model.id}`, model)
|
|
8582
|
+
return this.http.put(`${this.apiUrl}/${model.id}`, classToPlain(model))
|
|
8584
8583
|
.pipe(map((response) => {
|
|
8585
|
-
const result = this.createModelInstance(
|
|
8584
|
+
const result = this.createModelInstance(response);
|
|
8586
8585
|
this.handleResponse([result], 'put');
|
|
8587
8586
|
return result;
|
|
8588
8587
|
}));
|
|
@@ -8592,9 +8591,9 @@ let RestService$1 = class RestService {
|
|
|
8592
8591
|
*/
|
|
8593
8592
|
putBatch(models) {
|
|
8594
8593
|
this.handleAccessError('putBatch');
|
|
8595
|
-
return this.http.put(this.apiUrl, models)
|
|
8594
|
+
return this.http.put(this.apiUrl, classToPlain(models))
|
|
8596
8595
|
.pipe(map((response) => {
|
|
8597
|
-
const result = response.map((item) => this.createModelInstance(
|
|
8596
|
+
const result = response.map((item) => this.createModelInstance(item));
|
|
8598
8597
|
this.handleResponse(result, 'put');
|
|
8599
8598
|
return result;
|
|
8600
8599
|
}));
|
|
@@ -8614,7 +8613,7 @@ let RestService$1 = class RestService {
|
|
|
8614
8613
|
*/
|
|
8615
8614
|
deleteBatch(models) {
|
|
8616
8615
|
this.handleAccessError('deleteBatch');
|
|
8617
|
-
return this.http.post(`${this.apiUrl}/delete`, models)
|
|
8616
|
+
return this.http.post(`${this.apiUrl}/delete`, classToPlain(models))
|
|
8618
8617
|
.pipe(map(() => {
|
|
8619
8618
|
this.handleResponse(models, 'delete');
|
|
8620
8619
|
}));
|
|
@@ -8631,7 +8630,7 @@ let RestService$1 = class RestService {
|
|
|
8631
8630
|
fetch() {
|
|
8632
8631
|
return this.http.get(this.apiUrl)
|
|
8633
8632
|
.pipe(map((response) => this.isApiPlatform ? response['hydra:member'] : toArray(response)), map((response) => {
|
|
8634
|
-
const items = response.map((item) => this.createModelInstance(
|
|
8633
|
+
const items = response.map((item) => this.createModelInstance(item));
|
|
8635
8634
|
this.cache = this.createCollectionInstance(this.collectionClass, items);
|
|
8636
8635
|
this.cacheSubject.next(this.cache);
|
|
8637
8636
|
return this.cache;
|
|
@@ -8679,13 +8678,13 @@ let RestService$1 = class RestService {
|
|
|
8679
8678
|
this.eventDispatcherService.dispatch2(new AppEvent2(eventName, items));
|
|
8680
8679
|
}
|
|
8681
8680
|
/**
|
|
8681
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
8682
8682
|
* Create new instance of class
|
|
8683
|
-
* @param model
|
|
8684
|
-
* @param plain Single object or array from which will be created model instance(s)
|
|
8683
|
+
* @param model Single object or array from which will be created model instance(s)
|
|
8685
8684
|
*/
|
|
8686
|
-
createModelInstance(model
|
|
8685
|
+
createModelInstance(model) {
|
|
8687
8686
|
// excludePrefixes - class-transformer option is using to ignore hydra fields
|
|
8688
|
-
return plainToClass(
|
|
8687
|
+
return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
|
|
8689
8688
|
}
|
|
8690
8689
|
createCollectionInstance(collectionClass, items) {
|
|
8691
8690
|
return new collectionClass(items);
|
|
@@ -11992,12 +11991,12 @@ class RestService {
|
|
|
11992
11991
|
* add new instance and update cache
|
|
11993
11992
|
*/
|
|
11994
11993
|
create(data, shouldUpdateCache = true) {
|
|
11995
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, data)
|
|
11994
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(data))
|
|
11996
11995
|
.pipe(map((newItem) => {
|
|
11997
11996
|
if (!shouldUpdateCache) {
|
|
11998
11997
|
return null;
|
|
11999
11998
|
}
|
|
12000
|
-
const newInstance = this.createModelInstance(
|
|
11999
|
+
const newInstance = this.createModelInstance(newItem);
|
|
12001
12000
|
if (this.cache) {
|
|
12002
12001
|
this.cache.push(newInstance);
|
|
12003
12002
|
this.updateCache();
|
|
@@ -12034,7 +12033,7 @@ class RestService {
|
|
|
12034
12033
|
addBatch(models, queryParams = {}) {
|
|
12035
12034
|
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(models), queryParams)
|
|
12036
12035
|
.pipe(map((newItems) => {
|
|
12037
|
-
const newInstances = newItems.map((item) => this.createModelInstance(
|
|
12036
|
+
const newInstances = newItems.map((item) => this.createModelInstance(item));
|
|
12038
12037
|
if (this.cache) {
|
|
12039
12038
|
this.cache.push(...newInstances);
|
|
12040
12039
|
this.updateCache();
|
|
@@ -12054,7 +12053,7 @@ class RestService {
|
|
|
12054
12053
|
update(model, queryParams = {}) {
|
|
12055
12054
|
return this.http.put(`${this.environment.apiV2}/${this.url}/${model['id']}`, classToPlain(model), queryParams)
|
|
12056
12055
|
.pipe(map((updatedItem) => {
|
|
12057
|
-
const updatedInstance = this.createModelInstance(
|
|
12056
|
+
const updatedInstance = this.createModelInstance(updatedItem);
|
|
12058
12057
|
replace(this.cache, updatedInstance);
|
|
12059
12058
|
this.updateCache();
|
|
12060
12059
|
if (this.messageUpdated) {
|
|
@@ -12072,7 +12071,7 @@ class RestService {
|
|
|
12072
12071
|
updateBatch(models, queryParams = {}) {
|
|
12073
12072
|
return this.http.put(`${this.environment.apiV2}/${this.url}`, classToPlain(models), queryParams)
|
|
12074
12073
|
.pipe(map((updatedItems) => {
|
|
12075
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(
|
|
12074
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(item));
|
|
12076
12075
|
updatedInstances.forEach((instance) => {
|
|
12077
12076
|
replace(this.cache, instance);
|
|
12078
12077
|
});
|
|
@@ -12102,7 +12101,7 @@ class RestService {
|
|
|
12102
12101
|
* @param models Class instances array for deleting
|
|
12103
12102
|
*/
|
|
12104
12103
|
deleteBatch(models) {
|
|
12105
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}/delete`, models)
|
|
12104
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}/delete`, classToPlain(models))
|
|
12106
12105
|
.pipe(map(() => {
|
|
12107
12106
|
const ids = models.map((model) => model['id']);
|
|
12108
12107
|
this.cache = this.cache.filter((item) => !ids.includes(item['id']));
|
|
@@ -12126,7 +12125,7 @@ class RestService {
|
|
|
12126
12125
|
.pipe(map((response) => {
|
|
12127
12126
|
const items = (this.isHydra ? response['hydra:member'] : response)
|
|
12128
12127
|
.map((item) => {
|
|
12129
|
-
return this.createModelInstance(
|
|
12128
|
+
return this.createModelInstance(item);
|
|
12130
12129
|
});
|
|
12131
12130
|
this.cache = items;
|
|
12132
12131
|
this.updateCache();
|
|
@@ -12140,22 +12139,12 @@ class RestService {
|
|
|
12140
12139
|
this.cacheSubject.next(this.cache.slice());
|
|
12141
12140
|
}
|
|
12142
12141
|
/**
|
|
12142
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
12143
12143
|
* 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
|
|
12144
|
+
* @param model instance that we will use as constructor options
|
|
12156
12145
|
*/
|
|
12157
|
-
|
|
12158
|
-
return plainToClass(this.modelClass,
|
|
12146
|
+
createModelInstance(model) {
|
|
12147
|
+
return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
|
|
12159
12148
|
}
|
|
12160
12149
|
/**
|
|
12161
12150
|
* Method that call all listeners. Empty by default. Should be redefined by child services if required
|
|
@@ -13035,7 +13024,7 @@ class IncomeSourceService extends RestService {
|
|
|
13035
13024
|
updateBatch(incomeSources, queryParams = {}) {
|
|
13036
13025
|
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
13037
13026
|
.pipe(map((updatedItems) => {
|
|
13038
|
-
const updatedInstances = updatedItems.map((item) => this.createModelInstance(
|
|
13027
|
+
const updatedInstances = updatedItems.map((item) => this.createModelInstance(item));
|
|
13039
13028
|
updatedInstances.forEach((instance) => {
|
|
13040
13029
|
replace(this.cache, instance);
|
|
13041
13030
|
});
|
|
@@ -14536,9 +14525,9 @@ class TransactionService extends RestService {
|
|
|
14536
14525
|
*/
|
|
14537
14526
|
addBatch(transactions) {
|
|
14538
14527
|
transactions = _.cloneDeep(transactions);
|
|
14539
|
-
return this.http.post(`${this.environment.apiV2}/${this.url}`, transactions)
|
|
14528
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, classToPlain(transactions))
|
|
14540
14529
|
.pipe(map((response) => {
|
|
14541
|
-
const addedTransactions = response.map((item) => this.
|
|
14530
|
+
const addedTransactions = response.map((item) => this.createModelInstance(item));
|
|
14542
14531
|
transactions.forEach((transaction, index) => {
|
|
14543
14532
|
// @TODO backend: need to upload file in the same backend endpoint with transaction add/update
|
|
14544
14533
|
// check if passed receipt and upload file
|
|
@@ -14551,7 +14540,7 @@ class TransactionService extends RestService {
|
|
|
14551
14540
|
// add child transactions if exist
|
|
14552
14541
|
if (transaction.transactions.length) {
|
|
14553
14542
|
transaction.transactions.forEach((childTransaction) => {
|
|
14554
|
-
childTransaction.parentTransaction = this.
|
|
14543
|
+
childTransaction.parentTransaction = this.createModelInstance({ id: addedTransactions[index].id });
|
|
14555
14544
|
});
|
|
14556
14545
|
this.addBatch(transaction.transactions).subscribe();
|
|
14557
14546
|
}
|
|
@@ -14573,9 +14562,9 @@ class TransactionService extends RestService {
|
|
|
14573
14562
|
* @param transaction Transaction instance for updating
|
|
14574
14563
|
*/
|
|
14575
14564
|
update(transaction) {
|
|
14576
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, transaction)
|
|
14565
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, classToPlain(transaction))
|
|
14577
14566
|
.pipe(map((response) => {
|
|
14578
|
-
const updatedTransaction = this.
|
|
14567
|
+
const updatedTransaction = this.createModelInstance(response);
|
|
14579
14568
|
// @TODO need to upload file in the same backend endpoint with transaction add/update
|
|
14580
14569
|
// check if passed new receipt and upload file
|
|
14581
14570
|
if (transaction.file) {
|
|
@@ -14590,7 +14579,7 @@ class TransactionService extends RestService {
|
|
|
14590
14579
|
if (transaction.transactions.length) {
|
|
14591
14580
|
// add parent transaction to child transactions
|
|
14592
14581
|
transaction.transactions.forEach((childTransaction) => {
|
|
14593
|
-
childTransaction.parentTransaction = this.
|
|
14582
|
+
childTransaction.parentTransaction = this.createModelInstance({ id: updatedTransaction.id });
|
|
14594
14583
|
});
|
|
14595
14584
|
// separate child transactions by id existing to define add or update action.
|
|
14596
14585
|
const childTransactionsToUpdate = transaction.transactions.filter((t) => t.id);
|
|
@@ -14613,9 +14602,9 @@ class TransactionService extends RestService {
|
|
|
14613
14602
|
* @param transactions list of transactions for updating
|
|
14614
14603
|
*/
|
|
14615
14604
|
updateBatch(transactions) {
|
|
14616
|
-
return this.http.put(`${this.environment.apiV2}/${this.url}`, transactions)
|
|
14605
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}`, classToPlain(transactions))
|
|
14617
14606
|
.pipe(map((response) => {
|
|
14618
|
-
const updatedTransactions = response.map((item) => this.
|
|
14607
|
+
const updatedTransactions = response.map((item) => this.createModelInstance(item));
|
|
14619
14608
|
updatedTransactions.forEach((updatedTransaction) => {
|
|
14620
14609
|
replace(this.cache, updatedTransaction);
|
|
14621
14610
|
});
|
|
@@ -14654,6 +14643,7 @@ class TransactionService extends RestService {
|
|
|
14654
14643
|
}));
|
|
14655
14644
|
}
|
|
14656
14645
|
/**
|
|
14646
|
+
* @TODO Alex wrong place for this logic, move to model
|
|
14657
14647
|
* calculate gross income amount based on transaction amount and taxes (fees)
|
|
14658
14648
|
* @param transaction Transaction instance for calculation
|
|
14659
14649
|
*/
|
|
@@ -14731,9 +14721,6 @@ class TransactionService extends RestService {
|
|
|
14731
14721
|
this.resetCache();
|
|
14732
14722
|
});
|
|
14733
14723
|
}
|
|
14734
|
-
createModelInstance2(baseModel, data = {}) {
|
|
14735
|
-
return super.createModelInstance2(baseModel, { values: [] });
|
|
14736
|
-
}
|
|
14737
14724
|
}
|
|
14738
14725
|
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
14726
|
TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: TransactionService, providedIn: 'root' });
|
|
@@ -15556,6 +15543,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
|
|
|
15556
15543
|
}] }];
|
|
15557
15544
|
} });
|
|
15558
15545
|
|
|
15546
|
+
applyPlugin(jsPDF);
|
|
15559
15547
|
/**
|
|
15560
15548
|
* jspdf-autotable is a plugin, adding table functionality to jspdf object without new class,
|
|
15561
15549
|
* we need to let ts knows about that by defining an interface and extending jsPdf class (to avoid ts error)
|
|
@@ -16309,6 +16297,7 @@ class AbstractForm extends UntypedFormGroup {
|
|
|
16309
16297
|
this.unsaved = false;
|
|
16310
16298
|
this.onSubmit = new EventEmitter();
|
|
16311
16299
|
this.model = model || this.createModelInstance();
|
|
16300
|
+
// @TODO Alex no idea how it works, since modelClass used in createModelInstance
|
|
16312
16301
|
this.modelClass = this.model.constructor;
|
|
16313
16302
|
this.initialValue = this.value;
|
|
16314
16303
|
if (model && !model['id']) {
|
|
@@ -16349,6 +16338,10 @@ class AbstractForm extends UntypedFormGroup {
|
|
|
16349
16338
|
markAsSaved() {
|
|
16350
16339
|
this.unsaved = false;
|
|
16351
16340
|
}
|
|
16341
|
+
/**
|
|
16342
|
+
* @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
|
|
16343
|
+
* @param data
|
|
16344
|
+
*/
|
|
16352
16345
|
createModelInstance(data = {}) {
|
|
16353
16346
|
return plainToClass(this.modelClass, data);
|
|
16354
16347
|
}
|
|
@@ -17220,7 +17213,7 @@ class SoleInvoiceForm extends AbstractForm {
|
|
|
17220
17213
|
*/
|
|
17221
17214
|
get currentValue() {
|
|
17222
17215
|
const formRawValue = this.getRawValue();
|
|
17223
|
-
return
|
|
17216
|
+
return this.createModelInstance(Object.assign({}, this.model, Object.assign(Object.assign({}, formRawValue.commonData), { items: formRawValue.items })));
|
|
17224
17217
|
}
|
|
17225
17218
|
}
|
|
17226
17219
|
|
|
@@ -18622,7 +18615,6 @@ class TransactionForm extends TransactionBaseForm {
|
|
|
18622
18615
|
|
|
18623
18616
|
class WorkTransactionForm extends TransactionForm {
|
|
18624
18617
|
constructor(transaction, registeredForGst, allocations, controls = {}) {
|
|
18625
|
-
console.log(transaction);
|
|
18626
18618
|
super(transaction, registeredForGst, allocations, Object.assign(controls, {
|
|
18627
18619
|
// additional data related to work (like tax instalments)
|
|
18628
18620
|
metadata: new FormArray((transaction.metadata || []).map((transactionMetadata) => {
|
|
@@ -18741,6 +18733,13 @@ class WorkIncomeForm extends WorkTransactionForm {
|
|
|
18741
18733
|
}
|
|
18742
18734
|
|
|
18743
18735
|
class WorkExpenseForm extends WorkTransactionForm {
|
|
18736
|
+
constructor(transaction, registeredForGst, allocations, controls = {}) {
|
|
18737
|
+
super(transaction, registeredForGst, allocations, controls);
|
|
18738
|
+
// amount set automatically for chartAccounts with hours metadata
|
|
18739
|
+
if (transaction.getMetadataFieldValue(ChartAccountsMetadataListEnum.HOURS)) {
|
|
18740
|
+
this.get('amount').disable();
|
|
18741
|
+
}
|
|
18742
|
+
}
|
|
18744
18743
|
listenEvents() {
|
|
18745
18744
|
this.watchChartAccountsMetadata();
|
|
18746
18745
|
}
|
|
@@ -18753,7 +18752,7 @@ class WorkExpenseForm extends WorkTransactionForm {
|
|
|
18753
18752
|
// for home office hours expense amount is a fixed rate per hour
|
|
18754
18753
|
this.get('amount').reset();
|
|
18755
18754
|
this.get('amount').disable();
|
|
18756
|
-
this.get('amount').setValue(this.get('chartAccounts').value.getCurrentYearValue().value * +hoursMetadata.value);
|
|
18755
|
+
this.get('amount').setValue((this.get('chartAccounts').value.getCurrentYearValue().value * +hoursMetadata.value).toFixed(2));
|
|
18757
18756
|
});
|
|
18758
18757
|
}
|
|
18759
18758
|
}
|