Fix Collaterals on Loan: It is optional

This commit is contained in:
Adam Saghy
2022-08-10 15:18:52 +02:00
parent 66128482a0
commit a6dc9d1d7c
3 changed files with 5 additions and 7 deletions
@@ -95,8 +95,7 @@ export class CreateLoansAccountComponent implements OnInit {
get loansAccountFormValid() {
return (
this.loansAccountDetailsForm.valid &&
this.loansAccountTermsForm.valid &&
this.loansAccountChargesStep.loansAccountCharges.isValid
this.loansAccountTermsForm.valid
);
}
@@ -174,7 +174,7 @@
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;
Previous
</button>
<button mat-raised-button matStepperNext [disabled]="!isCollateralSufficient">
<button mat-raised-button matStepperNext [disabled]="!loansAccountFormValid">
Next&nbsp;&nbsp;
<fa-icon icon="arrow-right"></fa-icon>
</button>
@@ -69,7 +69,7 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
}
ngOnInit() {
if ( this.loansAccountTemplate.charges) {
if (this.loansAccountTemplate.charges) {
this.chargesDataSource = this.loansAccountTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
}
}
@@ -231,7 +231,7 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
this.totalCollateralValue += collateralData.type.pctToBase * collateralData.type.basePrice * collateralData.value / 100;
this.collateralDataSource = this.collateralDataSource.concat(collateralData);
this.collateralOptions = this.collateralOptions.filter( (user: any) => user.collateralId !== response.data.value.collateral.collateralId);
this.collateralOptions = this.collateralOptions.filter((user: any) => user.collateralId !== response.data.value.collateral.collateralId);
if (this.loanPrincipal < this.totalCollateralValue) {
this.isCollateralSufficient = true;
} else {
@@ -270,8 +270,7 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
get loansAccountCharges() {
return {
charges: this.chargesDataSource,
collateral: this.collateralDataSource,
isValid: this.isCollateralSufficient
collateral: this.collateralDataSource
};
}