taxtank-core 2.0.2 → 2.0.4
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/fesm2022/taxtank-core.mjs +46 -41
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/forms/abstract.form.d.ts +2 -2
- package/src/lib/forms/aussie/aussie-appointment.form.d.ts +0 -1
- package/src/lib/forms/bank/bank-account/bank-account-allocation.form.d.ts +1 -1
- package/src/lib/forms/collection.form.d.ts +2 -1
- package/src/lib/forms/depreciation/depreciation.form.d.ts +1 -1
- package/src/lib/forms/holding/holding-trade/holding-trade.form.d.ts +0 -1
- package/src/lib/forms/property/borrowing-report.form.d.ts +1 -1
- package/src/lib/forms/sole/bas-report.form.d.ts +1 -1
- package/src/lib/forms/transaction/allocation-rule-transaction.form.d.ts +1 -0
- package/src/lib/forms/transaction/transaction.form.d.ts +1 -0
- package/src/lib/forms/user/client-details.form.d.ts +1 -1
- package/src/lib/forms/vehicle/vehicle-logbook.form.d.ts +1 -0
@@ -1679,6 +1679,7 @@ class FinancialYear {
|
|
1679
1679
|
return +localStorage.getItem('financialYear');
|
1680
1680
|
}
|
1681
1681
|
constructor(date) {
|
1682
|
+
// @TODO UTC?
|
1682
1683
|
this.yearStartDate = '-07-01T00:00:00';
|
1683
1684
|
this.yearEndDate = '-06-30T23:59:59';
|
1684
1685
|
if (date) {
|
@@ -5193,6 +5194,15 @@ __decorate([
|
|
5193
5194
|
Type(() => BankAccount)
|
5194
5195
|
], SoleInvoiceTemplate.prototype, "bankAccount", void 0);
|
5195
5196
|
|
5197
|
+
function TransformDate(format = 'YYYY-MM-DD', params = { toPlainOnly: true }) {
|
5198
|
+
return Transform(({ value }) => {
|
5199
|
+
if (!(value instanceof Date)) {
|
5200
|
+
return value;
|
5201
|
+
}
|
5202
|
+
return moment(value).format(format);
|
5203
|
+
}, params);
|
5204
|
+
}
|
5205
|
+
|
5196
5206
|
class VehicleLogbook extends VehicleLogbook$1 {
|
5197
5207
|
get kilometers() {
|
5198
5208
|
return this.odometerEnd - this.odometerStart;
|
@@ -5209,7 +5219,8 @@ class VehicleLogbook extends VehicleLogbook$1 {
|
|
5209
5219
|
}
|
5210
5220
|
}
|
5211
5221
|
__decorate([
|
5212
|
-
Type(() => Date)
|
5222
|
+
Type(() => Date),
|
5223
|
+
TransformDate()
|
5213
5224
|
], VehicleLogbook.prototype, "date", void 0);
|
5214
5225
|
__decorate([
|
5215
5226
|
Type(() => SoleBusiness)
|
@@ -6873,15 +6884,6 @@ var TransactionCategoryEnum;
|
|
6873
6884
|
TransactionCategoryEnum[TransactionCategoryEnum["PERSONAL"] = 3] = "PERSONAL";
|
6874
6885
|
})(TransactionCategoryEnum || (TransactionCategoryEnum = {}));
|
6875
6886
|
|
6876
|
-
function TransformDate(format = 'YYYY-MM-DD', params = { toPlainOnly: true }) {
|
6877
|
-
return Transform(({ value }) => {
|
6878
|
-
if (!(value instanceof Date)) {
|
6879
|
-
return value;
|
6880
|
-
}
|
6881
|
-
return moment(value).format(format);
|
6882
|
-
}, params);
|
6883
|
-
}
|
6884
|
-
|
6885
6887
|
/**
|
6886
6888
|
* @TODO Alex: clarify grouping rules and refactor
|
6887
6889
|
*/
|
@@ -7002,16 +7004,16 @@ __decorate([
|
|
7002
7004
|
TransformDate()
|
7003
7005
|
], Depreciation.prototype, "date", void 0);
|
7004
7006
|
__decorate([
|
7005
|
-
|
7007
|
+
TransformDate()
|
7006
7008
|
], Depreciation.prototype, "claimStartDate", void 0);
|
7007
7009
|
__decorate([
|
7008
|
-
|
7010
|
+
TransformDate()
|
7009
7011
|
], Depreciation.prototype, "lowValuePoolDate", void 0);
|
7010
7012
|
__decorate([
|
7011
|
-
|
7013
|
+
TransformDate()
|
7012
7014
|
], Depreciation.prototype, "writeOffManualDate", void 0);
|
7013
7015
|
__decorate([
|
7014
|
-
|
7016
|
+
TransformDate()
|
7015
7017
|
], Depreciation.prototype, "writeOffDate", void 0);
|
7016
7018
|
__decorate([
|
7017
7019
|
Type(() => DepreciationCapitalProject)
|
@@ -21684,6 +21686,7 @@ class AbstractForm extends FormGroup {
|
|
21684
21686
|
model, validatorOrOpts, asyncValidator) {
|
21685
21687
|
super(controls, validatorOrOpts, asyncValidator);
|
21686
21688
|
this.excludeExtraneousValues = false;
|
21689
|
+
this.includeDisabledFields = false;
|
21687
21690
|
/**
|
21688
21691
|
* @TODO Alex bad name, it's also about unchanged
|
21689
21692
|
* Flag display if some form values changed
|
@@ -21720,15 +21723,14 @@ class AbstractForm extends FormGroup {
|
|
21720
21723
|
* Check validation and return a new instance of generic model.
|
21721
21724
|
* Merge form value to initial object
|
21722
21725
|
* @param data Additional data object which be merged to form value
|
21723
|
-
* @param includeDisabledFields ignore disabled fields
|
21724
21726
|
*/
|
21725
|
-
submit(data = {}
|
21727
|
+
submit(data = {}) {
|
21726
21728
|
this.submitted = true;
|
21727
21729
|
this.markAllAsTouched();
|
21728
21730
|
if (!this.disabled && !this.valid) {
|
21729
21731
|
return null;
|
21730
21732
|
}
|
21731
|
-
const value = includeDisabledFields ? this.getRawValue() : this.value;
|
21733
|
+
const value = this.includeDisabledFields ? this.getRawValue() : this.value;
|
21732
21734
|
const model = this.createModelInstance(Object.assign({}, this.model, value, data));
|
21733
21735
|
this.onSubmit.emit(model);
|
21734
21736
|
return model;
|
@@ -21837,6 +21839,7 @@ class CollectionForm extends FormArray {
|
|
21837
21839
|
constructor(formConstructor, models = [], ...args) {
|
21838
21840
|
super(models.map(model => new formConstructor(model, ...args)));
|
21839
21841
|
this.formConstructor = formConstructor;
|
21842
|
+
this.includeDisabledFields = false;
|
21840
21843
|
this.args = args;
|
21841
21844
|
if (!models.length) {
|
21842
21845
|
this.add();
|
@@ -21851,13 +21854,13 @@ class CollectionForm extends FormArray {
|
|
21851
21854
|
/**
|
21852
21855
|
* Submit form and return array of properties from form value
|
21853
21856
|
*/
|
21854
|
-
submit(data = {}
|
21857
|
+
submit(data = {}) {
|
21855
21858
|
this.markAllAsTouched();
|
21856
|
-
const controls = includeDisabledFields ? this.controls : this.controls.filter((form) => form.enabled);
|
21859
|
+
const controls = this.includeDisabledFields ? this.controls : this.controls.filter((form) => form.enabled);
|
21857
21860
|
if (!this.valid || !controls.length) {
|
21858
21861
|
return null;
|
21859
21862
|
}
|
21860
|
-
return controls.map((form) => form.submit(data
|
21863
|
+
return controls.map((form) => form.submit(data));
|
21861
21864
|
}
|
21862
21865
|
}
|
21863
21866
|
|
@@ -23006,6 +23009,7 @@ class BasReportForm extends AbstractForm {
|
|
23006
23009
|
fuelTaxCredit: new UntypedFormControl(report.fuelTaxCredit, Validators.required),
|
23007
23010
|
gst: new UntypedFormControl({ value: report.gst, disabled: true }),
|
23008
23011
|
}, report);
|
23012
|
+
this.includeDisabledFields = true;
|
23009
23013
|
// prefill income/expense data based on transactions/depreciations filtered by specified date
|
23010
23014
|
combineLatest([this.get('dateFrom').valueChanges, this.get('dateTo').valueChanges])
|
23011
23015
|
.subscribe(([dateFrom, dateTo]) => {
|
@@ -23039,9 +23043,6 @@ class BasReportForm extends AbstractForm {
|
|
23039
23043
|
this.emitValues();
|
23040
23044
|
}
|
23041
23045
|
}
|
23042
|
-
submit(data = {}) {
|
23043
|
-
return super.submit(data, true);
|
23044
|
-
}
|
23045
23046
|
}
|
23046
23047
|
|
23047
23048
|
/**
|
@@ -23107,7 +23108,7 @@ class BankAccountAllocationForm extends AbstractForm {
|
|
23107
23108
|
}
|
23108
23109
|
});
|
23109
23110
|
}
|
23110
|
-
submit(data = {}
|
23111
|
+
submit(data = {}) {
|
23111
23112
|
// remove property/business allocations if empty
|
23112
23113
|
return super.submit(Object.assign(data, { bankAccountProperties: [], businessAllocations: [] }, this.value));
|
23113
23114
|
}
|
@@ -23357,7 +23358,8 @@ class ClientDetailsForm extends AbstractForm {
|
|
23357
23358
|
medicareExemption: new UntypedFormControl({ value: clientDetails.medicareExemption, disabled: !clientDetails.medicareExemption }, Validators.required),
|
23358
23359
|
pensionersTax: new UntypedFormControl(clientDetails.pensionersTax),
|
23359
23360
|
workingHolidayMaker: new UntypedFormControl(clientDetails.workingHolidayMaker)
|
23360
|
-
}
|
23361
|
+
}, clientDetails);
|
23362
|
+
this.includeDisabledFields = true;
|
23361
23363
|
}
|
23362
23364
|
toggleMedicareExemption(enabled) {
|
23363
23365
|
const control = this.get('medicareExemption');
|
@@ -23373,9 +23375,6 @@ class ClientDetailsForm extends AbstractForm {
|
|
23373
23375
|
control.setValue(UserMedicareExemptionEnum.NO);
|
23374
23376
|
control.disable();
|
23375
23377
|
}
|
23376
|
-
submit() {
|
23377
|
-
return super.submit({}, true);
|
23378
|
-
}
|
23379
23378
|
}
|
23380
23379
|
|
23381
23380
|
class MfaDetailsForm extends AbstractForm {
|
@@ -23441,11 +23440,11 @@ class BorrowingReportForm extends AbstractForm {
|
|
23441
23440
|
/**
|
23442
23441
|
* some fields are auto-calculated, shouldn't be updated until changed by user
|
23443
23442
|
*/
|
23444
|
-
submit(data = {}
|
23443
|
+
submit(data = {}) {
|
23445
23444
|
return super.submit({
|
23446
23445
|
netSalary: (this.model.netSalary || this.fieldChanged('netSalary')) ? this.get('netSalary').value : null,
|
23447
23446
|
spouseNetSalary: (this.model.netSalary || this.fieldChanged('spouseNetSalary')) ? this.get('spouseNetSalary').value : null,
|
23448
|
-
}
|
23447
|
+
});
|
23449
23448
|
}
|
23450
23449
|
}
|
23451
23450
|
|
@@ -24494,7 +24493,19 @@ class VehicleLogbookForm extends AbstractForm {
|
|
24494
24493
|
}, logbook);
|
24495
24494
|
this.logbook = logbook;
|
24496
24495
|
this.logbooks = logbooks;
|
24496
|
+
this.includeDisabledFields = true;
|
24497
|
+
this.get('isPersonal').valueChanges.subscribe(isPersonal => {
|
24498
|
+
const businessControl = this.get('business');
|
24499
|
+
if (isPersonal) {
|
24500
|
+
businessControl.setValue(null);
|
24501
|
+
businessControl.disable();
|
24502
|
+
}
|
24503
|
+
else {
|
24504
|
+
businessControl.enable();
|
24505
|
+
}
|
24506
|
+
});
|
24497
24507
|
this.updateStateAndValidators();
|
24508
|
+
this.emitValues();
|
24498
24509
|
}
|
24499
24510
|
/**
|
24500
24511
|
* Set logbook validators and disable state depends of initial logbook and its place in the whole list
|
@@ -24584,6 +24595,7 @@ class AllocationRuleTransactionForm extends AbstractForm {
|
|
24584
24595
|
})))
|
24585
24596
|
}, transaction);
|
24586
24597
|
this.isGST = isGST;
|
24598
|
+
this.includeDisabledFields = true;
|
24587
24599
|
this.listenEvents();
|
24588
24600
|
}
|
24589
24601
|
/**
|
@@ -24615,7 +24627,7 @@ class AllocationRuleTransactionForm extends AbstractForm {
|
|
24615
24627
|
metaFields: this.metaFieldsArray.controls.map((metaFieldForm) => metaFieldForm.submit()),
|
24616
24628
|
childTransactions: this.buildTransactions(this.currentValue)
|
24617
24629
|
};
|
24618
|
-
return super.submit(data
|
24630
|
+
return super.submit(data);
|
24619
24631
|
}
|
24620
24632
|
listenEvents() {
|
24621
24633
|
this.listenChartAccountsChanges();
|
@@ -24980,6 +24992,7 @@ class TransactionForm extends TransactionBaseForm {
|
|
24980
24992
|
transactions: new UntypedFormArray([]),
|
24981
24993
|
source: new UntypedFormControl(transaction.source || TransactionSourceEnum.BANK_TRANSACTION, Validators.required)
|
24982
24994
|
}));
|
24995
|
+
this.includeDisabledFields = true;
|
24983
24996
|
this.get('date').addValidators([currentFinYearValidator()]);
|
24984
24997
|
// convert child transactions to controls
|
24985
24998
|
transaction.transactions.map((transaction) => {
|
@@ -25025,7 +25038,7 @@ class TransactionForm extends TransactionBaseForm {
|
|
25025
25038
|
}, this.model.transactions.find((transaction) => transaction.id === childTransaction['id']) || {}, childTransaction));
|
25026
25039
|
}
|
25027
25040
|
submit(data = {}) {
|
25028
|
-
return super.submit(Object.assign(data, { transactions: this.buildTransactions(this.currentValue) })
|
25041
|
+
return super.submit(Object.assign(data, { transactions: this.buildTransactions(this.currentValue) }));
|
25029
25042
|
}
|
25030
25043
|
}
|
25031
25044
|
|
@@ -25330,6 +25343,7 @@ class DepreciationForm extends TransactionBaseForm {
|
|
25330
25343
|
financialYear: new FormControl(depreciation.financialYear || new FinancialYear().year),
|
25331
25344
|
claimStartDate: new FormControl({ value: depreciation.claimStartDate, disabled: !depreciation.chartAccounts?.isBuildingAtCost() }),
|
25332
25345
|
});
|
25346
|
+
this.includeDisabledFields = true;
|
25333
25347
|
if (depreciation.id) {
|
25334
25348
|
// this.get('claimPercent').setValue(depreciation.currentYearForecast.claimPercent);
|
25335
25349
|
}
|
@@ -25362,9 +25376,6 @@ class DepreciationForm extends TransactionBaseForm {
|
|
25362
25376
|
this.setEnabledState(this.get('claimStartDate'), chartAccounts.isBuildingAtCost());
|
25363
25377
|
});
|
25364
25378
|
}
|
25365
|
-
submit(data = {}) {
|
25366
|
-
return super.submit(data, true);
|
25367
|
-
}
|
25368
25379
|
}
|
25369
25380
|
|
25370
25381
|
class HoldingTradeForm extends AbstractForm {
|
@@ -25392,9 +25403,6 @@ class HoldingTradeForm extends AbstractForm {
|
|
25392
25403
|
this.get('holdingType').reset();
|
25393
25404
|
});
|
25394
25405
|
}
|
25395
|
-
submit(data = {}, includeDisabledFields = false) {
|
25396
|
-
return super.submit(data, includeDisabledFields);
|
25397
|
-
}
|
25398
25406
|
}
|
25399
25407
|
|
25400
25408
|
class HoldingTradeFilterForm extends AbstractForm {
|
@@ -25763,9 +25771,6 @@ class AussieAppointmentForm extends AbstractForm {
|
|
25763
25771
|
this.appointment = appointment;
|
25764
25772
|
this.aussieService = aussieService;
|
25765
25773
|
}
|
25766
|
-
submit(data = {}, includeDisabledFields = false) {
|
25767
|
-
return super.submit(data, includeDisabledFields);
|
25768
|
-
}
|
25769
25774
|
}
|
25770
25775
|
|
25771
25776
|
class AussieConfirmationForm extends AbstractForm {
|