Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ <h4 class="mat-h4 flex-98">{{ 'labels.heading.Loan Tranche Details' | translate
<div class="flex-100 layout-row">
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Maximum allowed outstanding balance' | translate }}</mat-label>
<input matInput type="number" formControlName="maxOutstandingLoanBalance" />
<input matInput type="number" formControlName="maxOutstandingLoanBalance" min="0" />
@if (loansAccountTermsForm.controls.maxOutstandingLoanBalance.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Maximum allowed outstanding balance' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,15 @@ export class LoansAccountTermsStepComponent extends LoanProductBaseComponent imp
if (this.allowAddDisbursementDetails()) {
this.loansAccountTermsForm.addControl(
'maxOutstandingLoanBalance',
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null, Validators.required)
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null, [
Validators.required,
Validators.min(0)
])
);
} else {
this.loansAccountTermsForm.addControl(
'maxOutstandingLoanBalance',
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null)
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null, [Validators.min(0)])
);
}
}
Expand Down Expand Up @@ -409,12 +412,15 @@ export class LoansAccountTermsStepComponent extends LoanProductBaseComponent imp
this.loansAccountTermsForm.removeControl('maxOutstandingLoanBalance');
this.loansAccountTermsForm.addControl(
'maxOutstandingLoanBalance',
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null, Validators.required)
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null, [
Validators.required,
Validators.min(0)
])
);
} else {
this.loansAccountTermsForm.addControl(
'maxOutstandingLoanBalance',
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null)
new UntypedFormControl(this.loansAccountTermsData?.maxOutstandingLoanBalance ?? null, [Validators.min(0)])
);
}
} else if (this.loanProductService.isWorkingCapital) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ <h3 class="mat-h3 flex-96">{{ 'labels.inputs.Loan Tranche Details' | translate }
matTooltip="{{ 'tooltips.Maximum number of disbursements' | translate }}"
formControlName="maxTrancheCount"
required
min="0"
/>
@if (loanProductSettingsForm.controls.maxTrancheCount.hasError('required')) {
<mat-error>
Expand All @@ -202,6 +203,7 @@ <h3 class="mat-h3 flex-96">{{ 'labels.inputs.Loan Tranche Details' | translate }
matInput
matTooltip="{{ 'tooltips.Maximum outstanding loan account balance' | translate }}"
formControlName="outstandingLoanBalance"
min="0"
/>
</mat-form-field>
<mat-checkbox class="flex-48 margin-v" labelPosition="before" formControlName="disallowExpectedDisbursements">
Expand Down Expand Up @@ -470,15 +472,15 @@ <h4 class="flex-48">
<h4 class="mat-h4 flex-98">{{ 'labels.inputs.Variable Installments' | translate }}</h4>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Minimum gap between Installments' | translate }}</mat-label>
<input type="number" matInput formControlName="minimumGap" required />
<input type="number" matInput formControlName="minimumGap" required min="0" />
<mat-error>
{{ 'labels.inputs.Minimum gap between Installments' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Maximum gap between Installments' | translate }}</mat-label>
<input type="number" matInput formControlName="maximumGap" required />
<input type="number" matInput formControlName="maximumGap" required min="0" />
<mat-error>
{{ 'labels.inputs.Maximum gap between Installments' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
Expand Down Expand Up @@ -758,19 +760,19 @@ <h3 class="mat-h3 flex-23">{{ 'labels.heading.Guarantee Requirements' | translat
<div class="flex-fill layout-row-wrap gap-2percent responsive-column">
<mat-form-field class="flex-31">
<mat-label>{{ 'labels.inputs.Mandatory Guarantee(%)' | translate }}</mat-label>
<input type="number" matInput formControlName="mandatoryGuarantee" required />
<input type="number" matInput formControlName="mandatoryGuarantee" required min="0" />
<mat-error>
{{ 'labels.inputs.Mandatory Guarantee' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
<mat-form-field class="flex-31">
<mat-label>{{ 'labels.inputs.Minimum Guarantee from Own Funds(%)' | translate }}</mat-label>
<input type="number" matInput formControlName="minimumGuaranteeFromOwnFunds" />
<input type="number" matInput formControlName="minimumGuaranteeFromOwnFunds" min="0" />
</mat-form-field>
<mat-form-field class="flex-31">
<mat-label>{{ 'labels.inputs.Minimum Guarantee from Guarantor Funds(%)' | translate }}</mat-label>
<input type="number" matInput formControlName="minimumGuaranteeFromGuarantor" />
<input type="number" matInput formControlName="minimumGuaranteeFromGuarantor" min="0" />
</mat-form-field>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,20 @@ export class LoanProductSettingsStepComponent extends LoanProductBaseComponent i
.get('allowVariableInstallments')
.valueChanges.subscribe((allowVariableInstallments: any) => {
if (allowVariableInstallments) {
this.loanProductSettingsForm.addControl('minimumGap', new UntypedFormControl('', Validators.required));
this.loanProductSettingsForm.addControl('maximumGap', new UntypedFormControl('', Validators.required));
this.loanProductSettingsForm.addControl(
'minimumGap',
new UntypedFormControl('', [
Validators.required,
Validators.min(0)
])
);
this.loanProductSettingsForm.addControl(
'maximumGap',
new UntypedFormControl('', [
Validators.required,
Validators.min(0)
])
);
} else {
this.loanProductSettingsForm.removeControl('minimumGap');
this.loanProductSettingsForm.removeControl('maximumGap');
Expand Down Expand Up @@ -662,10 +674,19 @@ export class LoanProductSettingsStepComponent extends LoanProductBaseComponent i
if (holdGuaranteeFunds) {
this.loanProductSettingsForm.addControl(
'mandatoryGuarantee',
new UntypedFormControl('', Validators.required)
new UntypedFormControl('', [
Validators.required,
Validators.min(0)
])
);
this.loanProductSettingsForm.addControl(
'minimumGuaranteeFromOwnFunds',
new UntypedFormControl('', [Validators.min(0)])
);
this.loanProductSettingsForm.addControl(
'minimumGuaranteeFromGuarantor',
new UntypedFormControl('', [Validators.min(0)])
);
this.loanProductSettingsForm.addControl('minimumGuaranteeFromOwnFunds', new UntypedFormControl(''));
this.loanProductSettingsForm.addControl('minimumGuaranteeFromGuarantor', new UntypedFormControl(''));
} else {
this.loanProductSettingsForm.removeControl('mandatoryGuarantee');
this.loanProductSettingsForm.removeControl('minimumGuaranteeFromOwnFunds');
Expand All @@ -675,8 +696,17 @@ export class LoanProductSettingsStepComponent extends LoanProductBaseComponent i

this.loanProductSettingsForm.get('multiDisburseLoan').valueChanges.subscribe((multiDisburseLoan) => {
if (multiDisburseLoan) {
this.loanProductSettingsForm.addControl('maxTrancheCount', new UntypedFormControl('', Validators.required));
this.loanProductSettingsForm.addControl('outstandingLoanBalance', new UntypedFormControl(''));
this.loanProductSettingsForm.addControl(
'maxTrancheCount',
new UntypedFormControl('', [
Validators.required,
Validators.min(0)
])
);
this.loanProductSettingsForm.addControl(
'outstandingLoanBalance',
new UntypedFormControl('', [Validators.min(0)])
);
} else {
this.loanProductSettingsForm.removeControl('maxTrancheCount');
this.loanProductSettingsForm.removeControl('outstandingLoanBalance');
Expand Down
Loading