taxtank-core 0.31.34 → 0.31.35

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.
@@ -3578,6 +3578,7 @@ class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
3578
3578
  super(...arguments);
3579
3579
  this.claimPercent = 100;
3580
3580
  this.tax = 0;
3581
+ this.amount = null;
3581
3582
  }
3582
3583
  calculateClaimPercent() {
3583
3584
  if (!this.chartAccounts) {
@@ -3592,6 +3593,12 @@ class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
3592
3593
  }
3593
3594
  return claimPercent;
3594
3595
  }
3596
+ /**
3597
+ * If rule transaction has amount then split enabled. There is 0 when split disabled
3598
+ */
3599
+ isSplit() {
3600
+ return !!this.amount;
3601
+ }
3595
3602
  /**
3596
3603
  * Create Transaction instance based on passed bank transaction and rule transaction
3597
3604
  */
@@ -22773,7 +22780,7 @@ class AllocationRuleTransactionForm extends AbstractForm {
22773
22780
  // Flag to enable transaction GST field
22774
22781
  isGST) {
22775
22782
  super({
22776
- amount: new UntypedFormControl(transaction.amount || null, Validators.required),
22783
+ amount: new UntypedFormControl(transaction.amount, Validators.required),
22777
22784
  tax: new UntypedFormControl(transaction.tax, Validators.required),
22778
22785
  claimPercent: new UntypedFormControl(transaction.claimPercent, [Validators.required, Validators.min(0), Validators.max(100)]),
22779
22786
  chartAccounts: new UntypedFormControl(transaction.chartAccounts, Validators.required),
@@ -22801,6 +22808,9 @@ class AllocationRuleTransactionForm extends AbstractForm {
22801
22808
  get childTransactionsArray() {
22802
22809
  return this.get('childTransactions');
22803
22810
  }
22811
+ get isSplit() {
22812
+ return this.get('amount').enabled;
22813
+ }
22804
22814
  addChildTransactionForm() {
22805
22815
  this.childTransactionsArray.push(new UntypedFormGroup({
22806
22816
  chartAccounts: new UntypedFormControl(null, Validators.required),
@@ -22908,7 +22918,8 @@ class AllocationRuleForm extends AbstractForm {
22908
22918
  if (!this.transactionFormGroup.get('chartAccounts').value?.isClaimPercentEditable()) {
22909
22919
  this.transactionFormGroup.get('claimPercent').disable();
22910
22920
  }
22911
- if (!rule.transaction?.amount) {
22921
+ // Disable transaction amount field when transaction has no amount (non-split)
22922
+ if (!rule.transaction?.isSplit()) {
22912
22923
  this.transactionFormGroup.get(['amount']).disable();
22913
22924
  }
22914
22925
  }
@@ -22995,6 +23006,8 @@ class AllocationRuleForm extends AbstractForm {
22995
23006
  case AllocationRuleTypeEnum.INCOME:
22996
23007
  this.get('transaction').enable({ emitEvent: false });
22997
23008
  this.get('transferBankAccount').disable({ emitEvent: false });
23009
+ // disable transaction amount field when value is empty
23010
+ // disable manually because code above enables this field
22998
23011
  if (!this.transactionFormGroup.get(['amount']).value) {
22999
23012
  this.transactionFormGroup.get(['amount']).disable();
23000
23013
  }