taxtank-core 2.0.3 → 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.
@@ -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) {
@@ -7003,16 +7004,16 @@ __decorate([
7003
7004
  TransformDate()
7004
7005
  ], Depreciation.prototype, "date", void 0);
7005
7006
  __decorate([
7006
- Type(() => Date)
7007
+ TransformDate()
7007
7008
  ], Depreciation.prototype, "claimStartDate", void 0);
7008
7009
  __decorate([
7009
- Type(() => Date)
7010
+ TransformDate()
7010
7011
  ], Depreciation.prototype, "lowValuePoolDate", void 0);
7011
7012
  __decorate([
7012
- Type(() => Date)
7013
+ TransformDate()
7013
7014
  ], Depreciation.prototype, "writeOffManualDate", void 0);
7014
7015
  __decorate([
7015
- Type(() => Date)
7016
+ TransformDate()
7016
7017
  ], Depreciation.prototype, "writeOffDate", void 0);
7017
7018
  __decorate([
7018
7019
  Type(() => DepreciationCapitalProject)
@@ -21685,6 +21686,7 @@ class AbstractForm extends FormGroup {
21685
21686
  model, validatorOrOpts, asyncValidator) {
21686
21687
  super(controls, validatorOrOpts, asyncValidator);
21687
21688
  this.excludeExtraneousValues = false;
21689
+ this.includeDisabledFields = false;
21688
21690
  /**
21689
21691
  * @TODO Alex bad name, it's also about unchanged
21690
21692
  * Flag display if some form values changed
@@ -21721,15 +21723,14 @@ class AbstractForm extends FormGroup {
21721
21723
  * Check validation and return a new instance of generic model.
21722
21724
  * Merge form value to initial object
21723
21725
  * @param data Additional data object which be merged to form value
21724
- * @param includeDisabledFields ignore disabled fields
21725
21726
  */
21726
- submit(data = {}, includeDisabledFields = false) {
21727
+ submit(data = {}) {
21727
21728
  this.submitted = true;
21728
21729
  this.markAllAsTouched();
21729
21730
  if (!this.disabled && !this.valid) {
21730
21731
  return null;
21731
21732
  }
21732
- const value = includeDisabledFields ? this.getRawValue() : this.value;
21733
+ const value = this.includeDisabledFields ? this.getRawValue() : this.value;
21733
21734
  const model = this.createModelInstance(Object.assign({}, this.model, value, data));
21734
21735
  this.onSubmit.emit(model);
21735
21736
  return model;
@@ -21838,6 +21839,7 @@ class CollectionForm extends FormArray {
21838
21839
  constructor(formConstructor, models = [], ...args) {
21839
21840
  super(models.map(model => new formConstructor(model, ...args)));
21840
21841
  this.formConstructor = formConstructor;
21842
+ this.includeDisabledFields = false;
21841
21843
  this.args = args;
21842
21844
  if (!models.length) {
21843
21845
  this.add();
@@ -21852,13 +21854,13 @@ class CollectionForm extends FormArray {
21852
21854
  /**
21853
21855
  * Submit form and return array of properties from form value
21854
21856
  */
21855
- submit(data = {}, includeDisabledFields = false) {
21857
+ submit(data = {}) {
21856
21858
  this.markAllAsTouched();
21857
- const controls = includeDisabledFields ? this.controls : this.controls.filter((form) => form.enabled);
21859
+ const controls = this.includeDisabledFields ? this.controls : this.controls.filter((form) => form.enabled);
21858
21860
  if (!this.valid || !controls.length) {
21859
21861
  return null;
21860
21862
  }
21861
- return controls.map((form) => form.submit(data, includeDisabledFields));
21863
+ return controls.map((form) => form.submit(data));
21862
21864
  }
21863
21865
  }
21864
21866
 
@@ -23007,6 +23009,7 @@ class BasReportForm extends AbstractForm {
23007
23009
  fuelTaxCredit: new UntypedFormControl(report.fuelTaxCredit, Validators.required),
23008
23010
  gst: new UntypedFormControl({ value: report.gst, disabled: true }),
23009
23011
  }, report);
23012
+ this.includeDisabledFields = true;
23010
23013
  // prefill income/expense data based on transactions/depreciations filtered by specified date
23011
23014
  combineLatest([this.get('dateFrom').valueChanges, this.get('dateTo').valueChanges])
23012
23015
  .subscribe(([dateFrom, dateTo]) => {
@@ -23040,9 +23043,6 @@ class BasReportForm extends AbstractForm {
23040
23043
  this.emitValues();
23041
23044
  }
23042
23045
  }
23043
- submit(data = {}) {
23044
- return super.submit(data, true);
23045
- }
23046
23046
  }
23047
23047
 
23048
23048
  /**
@@ -23108,7 +23108,7 @@ class BankAccountAllocationForm extends AbstractForm {
23108
23108
  }
23109
23109
  });
23110
23110
  }
23111
- submit(data = {}, includeDisabledFields = false) {
23111
+ submit(data = {}) {
23112
23112
  // remove property/business allocations if empty
23113
23113
  return super.submit(Object.assign(data, { bankAccountProperties: [], businessAllocations: [] }, this.value));
23114
23114
  }
@@ -23358,7 +23358,8 @@ class ClientDetailsForm extends AbstractForm {
23358
23358
  medicareExemption: new UntypedFormControl({ value: clientDetails.medicareExemption, disabled: !clientDetails.medicareExemption }, Validators.required),
23359
23359
  pensionersTax: new UntypedFormControl(clientDetails.pensionersTax),
23360
23360
  workingHolidayMaker: new UntypedFormControl(clientDetails.workingHolidayMaker)
23361
- }), clientDetails;
23361
+ }, clientDetails);
23362
+ this.includeDisabledFields = true;
23362
23363
  }
23363
23364
  toggleMedicareExemption(enabled) {
23364
23365
  const control = this.get('medicareExemption');
@@ -23374,9 +23375,6 @@ class ClientDetailsForm extends AbstractForm {
23374
23375
  control.setValue(UserMedicareExemptionEnum.NO);
23375
23376
  control.disable();
23376
23377
  }
23377
- submit() {
23378
- return super.submit({}, true);
23379
- }
23380
23378
  }
23381
23379
 
23382
23380
  class MfaDetailsForm extends AbstractForm {
@@ -23442,11 +23440,11 @@ class BorrowingReportForm extends AbstractForm {
23442
23440
  /**
23443
23441
  * some fields are auto-calculated, shouldn't be updated until changed by user
23444
23442
  */
23445
- submit(data = {}, includeDisabledFields = false) {
23443
+ submit(data = {}) {
23446
23444
  return super.submit({
23447
23445
  netSalary: (this.model.netSalary || this.fieldChanged('netSalary')) ? this.get('netSalary').value : null,
23448
23446
  spouseNetSalary: (this.model.netSalary || this.fieldChanged('spouseNetSalary')) ? this.get('spouseNetSalary').value : null,
23449
- }, includeDisabledFields);
23447
+ });
23450
23448
  }
23451
23449
  }
23452
23450
 
@@ -24495,7 +24493,19 @@ class VehicleLogbookForm extends AbstractForm {
24495
24493
  }, logbook);
24496
24494
  this.logbook = logbook;
24497
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
+ });
24498
24507
  this.updateStateAndValidators();
24508
+ this.emitValues();
24499
24509
  }
24500
24510
  /**
24501
24511
  * Set logbook validators and disable state depends of initial logbook and its place in the whole list
@@ -24585,6 +24595,7 @@ class AllocationRuleTransactionForm extends AbstractForm {
24585
24595
  })))
24586
24596
  }, transaction);
24587
24597
  this.isGST = isGST;
24598
+ this.includeDisabledFields = true;
24588
24599
  this.listenEvents();
24589
24600
  }
24590
24601
  /**
@@ -24616,7 +24627,7 @@ class AllocationRuleTransactionForm extends AbstractForm {
24616
24627
  metaFields: this.metaFieldsArray.controls.map((metaFieldForm) => metaFieldForm.submit()),
24617
24628
  childTransactions: this.buildTransactions(this.currentValue)
24618
24629
  };
24619
- return super.submit(data, true);
24630
+ return super.submit(data);
24620
24631
  }
24621
24632
  listenEvents() {
24622
24633
  this.listenChartAccountsChanges();
@@ -24981,6 +24992,7 @@ class TransactionForm extends TransactionBaseForm {
24981
24992
  transactions: new UntypedFormArray([]),
24982
24993
  source: new UntypedFormControl(transaction.source || TransactionSourceEnum.BANK_TRANSACTION, Validators.required)
24983
24994
  }));
24995
+ this.includeDisabledFields = true;
24984
24996
  this.get('date').addValidators([currentFinYearValidator()]);
24985
24997
  // convert child transactions to controls
24986
24998
  transaction.transactions.map((transaction) => {
@@ -25026,7 +25038,7 @@ class TransactionForm extends TransactionBaseForm {
25026
25038
  }, this.model.transactions.find((transaction) => transaction.id === childTransaction['id']) || {}, childTransaction));
25027
25039
  }
25028
25040
  submit(data = {}) {
25029
- return super.submit(Object.assign(data, { transactions: this.buildTransactions(this.currentValue) }), true);
25041
+ return super.submit(Object.assign(data, { transactions: this.buildTransactions(this.currentValue) }));
25030
25042
  }
25031
25043
  }
25032
25044
 
@@ -25331,6 +25343,7 @@ class DepreciationForm extends TransactionBaseForm {
25331
25343
  financialYear: new FormControl(depreciation.financialYear || new FinancialYear().year),
25332
25344
  claimStartDate: new FormControl({ value: depreciation.claimStartDate, disabled: !depreciation.chartAccounts?.isBuildingAtCost() }),
25333
25345
  });
25346
+ this.includeDisabledFields = true;
25334
25347
  if (depreciation.id) {
25335
25348
  // this.get('claimPercent').setValue(depreciation.currentYearForecast.claimPercent);
25336
25349
  }
@@ -25363,9 +25376,6 @@ class DepreciationForm extends TransactionBaseForm {
25363
25376
  this.setEnabledState(this.get('claimStartDate'), chartAccounts.isBuildingAtCost());
25364
25377
  });
25365
25378
  }
25366
- submit(data = {}) {
25367
- return super.submit(data, true);
25368
- }
25369
25379
  }
25370
25380
 
25371
25381
  class HoldingTradeForm extends AbstractForm {
@@ -25393,9 +25403,6 @@ class HoldingTradeForm extends AbstractForm {
25393
25403
  this.get('holdingType').reset();
25394
25404
  });
25395
25405
  }
25396
- submit(data = {}, includeDisabledFields = false) {
25397
- return super.submit(data, includeDisabledFields);
25398
- }
25399
25406
  }
25400
25407
 
25401
25408
  class HoldingTradeFilterForm extends AbstractForm {
@@ -25764,9 +25771,6 @@ class AussieAppointmentForm extends AbstractForm {
25764
25771
  this.appointment = appointment;
25765
25772
  this.aussieService = aussieService;
25766
25773
  }
25767
- submit(data = {}, includeDisabledFields = false) {
25768
- return super.submit(data, includeDisabledFields);
25769
- }
25770
25774
  }
25771
25775
 
25772
25776
  class AussieConfirmationForm extends AbstractForm {