Allow to set over amount setting for approval and disbursement

This commit is contained in:
Jose Alberto Hernandez
2022-07-26 15:44:58 +02:00
committed by Arnold Gálovics
parent eef6fa31d3
commit a2bd33f9b1
5 changed files with 65 additions and 1 deletions
@@ -116,5 +116,4 @@ export class EditLoanProductComponent implements OnInit {
}); });
} }
} }
@@ -71,6 +71,17 @@
<span fxFlex="60%">{{ loanProduct.principal + ' (Min: ' + (loanProduct.minPrincipal ? loanProduct.minPrincipal : loanProduct.principal) + ', Max: ' + (loanProduct.maxPrincipal ? loanProduct.maxPrincipal : loanProduct.principal) + ')' }}</span> <span fxFlex="60%">{{ loanProduct.principal + ' (Min: ' + (loanProduct.minPrincipal ? loanProduct.minPrincipal : loanProduct.principal) + ', Max: ' + (loanProduct.maxPrincipal ? loanProduct.maxPrincipal : loanProduct.principal) + ')' }}</span>
</div> </div>
<div fxFlexFill>
<span fxFlex="40%">Allow Approved / Disbursed Amounts Over Applied:</span>
<span fxFlex="60%">{{ loanProduct.allowApprovedDisbursedAmountsOverApplied ? 'Yes' : 'No' }}</span>
</div>
<div fxFlexFill *ngIf="loanProduct.allowApprovedDisbursedAmountsOverApplied">
<span fxFlex="40%">Over Applied:</span>
<span fxFlex="60%" *ngIf="loanProduct.overAppliedCalculationType === 'percentage'">{{ loanProduct.overAppliedNumber }} %</span>
<span fxFlex="60%" *ngIf="loanProduct.overAppliedCalculationType === 'flat'">{{ loanProduct.overAppliedNumber }} {{ loanProduct.currencyCode }}</span>
</div>
<div fxFlexFill> <div fxFlexFill>
<span fxFlex="40%">Number of Repayments:</span> <span fxFlex="40%">Number of Repayments:</span>
<span fxFlex="60%">{{ loanProduct.numberOfRepayments + ' (Min: ' + (loanProduct.minNumberOfRepayments ? loanProduct.minNumberOfRepayments : loanProduct.numberOfRepayments) + ', Max: ' + (loanProduct.maxNumberOfRepayments ? loanProduct.maxNumberOfRepayments : loanProduct.numberOfRepayments) + ')' }}</span> <span fxFlex="60%">{{ loanProduct.numberOfRepayments + ' (Min: ' + (loanProduct.minNumberOfRepayments ? loanProduct.minNumberOfRepayments : loanProduct.numberOfRepayments) + ', Max: ' + (loanProduct.maxNumberOfRepayments ? loanProduct.maxNumberOfRepayments : loanProduct.numberOfRepayments) + ')' }}</span>
@@ -22,6 +22,24 @@
<input type="number" matInput formControlName="maxPrincipal"> <input type="number" matInput formControlName="maxPrincipal">
</mat-form-field> </mat-form-field>
<mat-checkbox fxFlex="31%" labelPosition="before" formControlName="allowApprovedDisbursedAmountsOverApplied">
Allow approval / disbursal above loan applied amount?
</mat-checkbox>
<mat-form-field fxFlex="31%" *ngIf="loanProductTermsForm.value.allowApprovedDisbursedAmountsOverApplied">
<mat-label>Over Amount Calculation Type</mat-label>
<mat-select formControlName="overAppliedCalculationType" required>
<mat-option *ngFor="let overAppliedCalculationType of overAppliedCalculationTypeData" [value]="overAppliedCalculationType.id">
{{ overAppliedCalculationType.value }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="31%" *ngIf="loanProductTermsForm.value.allowApprovedDisbursedAmountsOverApplied">
<mat-label>Over Amount</mat-label>
<input type="number" matInput formControlName="overAppliedNumber" required>
</mat-form-field>
<h4 fxFlex="98%" class="mat-h4">Number of repayments</h4> <h4 fxFlex="98%" class="mat-h4">Number of repayments</h4>
<mat-form-field fxFlex="31%"> <mat-form-field fxFlex="31%">
@@ -23,6 +23,7 @@ export class LoanProductTermsStepComponent implements OnInit {
valueConditionTypeData: any; valueConditionTypeData: any;
floatingRateData: any; floatingRateData: any;
interestRateFrequencyTypeData: any; interestRateFrequencyTypeData: any;
overAppliedCalculationTypeData: any;
repaymentFrequencyTypeData: any; repaymentFrequencyTypeData: any;
displayedColumns: string[] = ['valueConditionType', 'borrowerCycleNumber', 'minValue', 'defaultValue', 'maxValue', 'actions']; displayedColumns: string[] = ['valueConditionType', 'borrowerCycleNumber', 'minValue', 'defaultValue', 'maxValue', 'actions'];
@@ -38,6 +39,7 @@ export class LoanProductTermsStepComponent implements OnInit {
this.floatingRateData = this.loanProductsTemplate.floatingRateOptions; this.floatingRateData = this.loanProductsTemplate.floatingRateOptions;
this.interestRateFrequencyTypeData = this.loanProductsTemplate.interestRateFrequencyTypeOptions; this.interestRateFrequencyTypeData = this.loanProductsTemplate.interestRateFrequencyTypeOptions;
this.repaymentFrequencyTypeData = this.loanProductsTemplate.repaymentFrequencyTypeOptions; this.repaymentFrequencyTypeData = this.loanProductsTemplate.repaymentFrequencyTypeOptions;
this.overAppliedCalculationTypeData = [{id: 'percentage', value: 'Percentage'}, {id: 'flat', value: 'Fixed Amount'}];
this.loanProductTermsForm.patchValue({ this.loanProductTermsForm.patchValue({
'minPrincipal': this.loanProductsTemplate.minPrincipal, 'minPrincipal': this.loanProductsTemplate.minPrincipal,
@@ -54,6 +56,7 @@ export class LoanProductTermsStepComponent implements OnInit {
'floatingRatesId': this.loanProductsTemplate.floatingRateId, 'floatingRatesId': this.loanProductsTemplate.floatingRateId,
'interestRateDifferential': this.loanProductsTemplate.interestRateDifferential, 'interestRateDifferential': this.loanProductsTemplate.interestRateDifferential,
'isFloatingInterestRateCalculationAllowed': this.loanProductsTemplate.isFloatingInterestRateCalculationAllowed, 'isFloatingInterestRateCalculationAllowed': this.loanProductsTemplate.isFloatingInterestRateCalculationAllowed,
'allowApprovedDisbursedAmountsOverApplied': this.loanProductsTemplate.allowApprovedDisbursedAmountsOverApplied,
'minDifferentialLendingRate': this.loanProductsTemplate.minDifferentialLendingRate, 'minDifferentialLendingRate': this.loanProductsTemplate.minDifferentialLendingRate,
'defaultDifferentialLendingRate': this.loanProductsTemplate.defaultDifferentialLendingRate, 'defaultDifferentialLendingRate': this.loanProductsTemplate.defaultDifferentialLendingRate,
'maxDifferentialLendingRate': this.loanProductsTemplate.maxDifferentialLendingRate, 'maxDifferentialLendingRate': this.loanProductsTemplate.maxDifferentialLendingRate,
@@ -63,6 +66,13 @@ export class LoanProductTermsStepComponent implements OnInit {
'minimumDaysBetweenDisbursalAndFirstRepayment': this.loanProductsTemplate.minimumDaysBetweenDisbursalAndFirstRepayment 'minimumDaysBetweenDisbursalAndFirstRepayment': this.loanProductsTemplate.minimumDaysBetweenDisbursalAndFirstRepayment
}); });
if (this.loanProductsTemplate.allowApprovedDisbursedAmountsOverApplied) {
this.loanProductTermsForm.patchValue({
'overAppliedCalculationType': this.loanProductsTemplate.overAppliedCalculationType,
'overAppliedNumber': this.loanProductsTemplate.overAppliedNumber,
});
}
this.loanProductTermsForm.setControl('principalVariationsForBorrowerCycle', this.loanProductTermsForm.setControl('principalVariationsForBorrowerCycle',
this.formBuilder.array(this.loanProductsTemplate.principalVariationsForBorrowerCycle.map((variation: any) => ({ ...variation, valueConditionType: variation.valueConditionType.id })))); this.formBuilder.array(this.loanProductsTemplate.principalVariationsForBorrowerCycle.map((variation: any) => ({ ...variation, valueConditionType: variation.valueConditionType.id }))));
this.loanProductTermsForm.setControl('numberOfRepaymentVariationsForBorrowerCycle', this.loanProductTermsForm.setControl('numberOfRepaymentVariationsForBorrowerCycle',
@@ -81,6 +91,7 @@ export class LoanProductTermsStepComponent implements OnInit {
'numberOfRepayments': ['', Validators.required], 'numberOfRepayments': ['', Validators.required],
'maxNumberOfRepayments': [''], 'maxNumberOfRepayments': [''],
'isLinkedToFloatingInterestRates': [false], 'isLinkedToFloatingInterestRates': [false],
'allowApprovedDisbursedAmountsOverApplied': [false],
'minInterestRatePerPeriod': [''], 'minInterestRatePerPeriod': [''],
'interestRatePerPeriod': ['', Validators.required], 'interestRatePerPeriod': ['', Validators.required],
'maxInterestRatePerPeriod': [''], 'maxInterestRatePerPeriod': [''],
@@ -92,6 +103,20 @@ export class LoanProductTermsStepComponent implements OnInit {
} }
setConditionalControls() { setConditionalControls() {
this.loanProductTermsForm.get('allowApprovedDisbursedAmountsOverApplied').valueChanges
.subscribe(allowApprovedDisbursedAmountsOverApplied => {
if (allowApprovedDisbursedAmountsOverApplied) {
this.loanProductTermsForm.addControl('overAppliedCalculationType', new FormControl(''));
this.loanProductTermsForm.addControl('overAppliedNumber', new FormControl(''));
this.loanProductTermsForm.addControl('disallowExpectedDisbursements', new FormControl('true'));
} else {
this.loanProductTermsForm.removeControl('overAppliedCalculationType');
this.loanProductTermsForm.removeControl('overAppliedNumber');
this.loanProductTermsForm.removeControl('disallowExpectedDisbursements');
}
}
);
this.loanProductTermsForm.get('isLinkedToFloatingInterestRates').valueChanges this.loanProductTermsForm.get('isLinkedToFloatingInterestRates').valueChanges
.subscribe(isLinkedToFloatingInterestRates => { .subscribe(isLinkedToFloatingInterestRates => {
if (isLinkedToFloatingInterestRates) { if (isLinkedToFloatingInterestRates) {
@@ -84,6 +84,17 @@
<span fxFlex="60%">{{ loanProduct.principal + ' (Min: ' + (loanProduct.minPrincipal ? loanProduct.minPrincipal : loanProduct.principal) + ', Max: ' + (loanProduct.maxPrincipal ? loanProduct.maxPrincipal : loanProduct.principal) + ')' }}</span> <span fxFlex="60%">{{ loanProduct.principal + ' (Min: ' + (loanProduct.minPrincipal ? loanProduct.minPrincipal : loanProduct.principal) + ', Max: ' + (loanProduct.maxPrincipal ? loanProduct.maxPrincipal : loanProduct.principal) + ')' }}</span>
</div> </div>
<div fxFlexFill>
<span fxFlex="40%">Allow Approved / Disbursed Amounts Over Applied:</span>
<span fxFlex="60%">{{ loanProduct.allowApprovedDisbursedAmountsOverApplied ? 'Yes' : 'No' }}</span>
</div>
<div fxFlexFill *ngIf="loanProduct.allowApprovedDisbursedAmountsOverApplied">
<span fxFlex="40%">Over Applied Amount:</span>
<span fxFlex="60%" *ngIf="loanProduct.overAppliedCalculationType === 'percentage'">{{ loanProduct.overAppliedNumber }} %</span>
<span fxFlex="60%" *ngIf="loanProduct.overAppliedCalculationType === 'flat'">{{ loanProduct.overAppliedNumber }} {{ loanProduct.currencyCode }}</span>
</div>
<div fxFlexFill> <div fxFlexFill>
<span fxFlex="40%">Number of Repayments:</span> <span fxFlex="40%">Number of Repayments:</span>
<span fxFlex="60%">{{ loanProduct.numberOfRepayments + ' (Min: ' + (loanProduct.minNumberOfRepayments ? loanProduct.minNumberOfRepayments : loanProduct.numberOfRepayments) + ', Max: ' + (loanProduct.maxNumberOfRepayments ? loanProduct.maxNumberOfRepayments : loanProduct.numberOfRepayments) + ')' }}</span> <span fxFlex="60%">{{ loanProduct.numberOfRepayments + ' (Min: ' + (loanProduct.minNumberOfRepayments ? loanProduct.minNumberOfRepayments : loanProduct.numberOfRepayments) + ', Max: ' + (loanProduct.maxNumberOfRepayments ? loanProduct.maxNumberOfRepayments : loanProduct.numberOfRepayments) + ')' }}</span>