Skip to content

Commit

Permalink
Loan product extend schedule setting (openMF#1866)
Browse files Browse the repository at this point in the history
Co-authored-by: Jose Alberto Hernandez <[email protected]>
  • Loading branch information
josehernandezfintecheandomx and Jose Alberto Hernandez committed Oct 5, 2023
1 parent 9be3dac commit 59dc5b6
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 57 deletions.
7 changes: 4 additions & 3 deletions src/app/pipes/pipes.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import { DateFormatPipe } from './date-format.pipe';
import { DatetimeFormatPipe } from './datetime-format.pipe';
import { ExternalIdentifierPipe } from './external-identifier.pipe';
import { FormatNumberPipe } from './format-number.pipe';
import { YesnoPipe } from './yesno.pipe';

@NgModule({
imports: [
CommonModule
],
declarations: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe ],
providers: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe ],
exports: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe ]
declarations: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe ],
providers: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe ],
exports: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe ]
})
export class PipesModule { }
8 changes: 8 additions & 0 deletions src/app/pipes/yesno.pipe.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { YesnoPipe } from './yesno.pipe';

describe('YesnoPipe', () => {
it('create an instance', () => {
const pipe = new YesnoPipe();
expect(pipe).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/pipes/yesno.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'yesNo'
})
export class YesnoPipe implements PipeTransform {

transform(value: boolean, ...args: unknown[]): string {
if (value == null) {
return null;
}
return value ? 'Yes' : 'No';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h3 class="mat-h3" fxFlexFill>Details</h3>

<div fxFlexFill>
<span fxFlex="40%">Include in Customer Loan Counter:</span>
<span fxFlex="60%">{{ loanProduct.includeInBorrowerCycle ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.includeInBorrowerCycle | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.startDate">
Expand Down Expand Up @@ -75,7 +75,7 @@ <h3 class="mat-h3" fxFlexFill>Terms</h3>

<div fxFlexFill>
<span fxFlex="40%">Allow Approved / Disbursed Amounts Over Applied:</span>
<span fxFlex="60%">{{ loanProduct.allowApprovedDisbursedAmountsOverApplied ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowApprovedDisbursedAmountsOverApplied | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.allowApprovedDisbursedAmountsOverApplied">
Expand All @@ -101,7 +101,7 @@ <h3 class="mat-h3" fxFlexFill>Terms</h3>

<div fxFlexFill>
<span fxFlex="40%">Linked to floating interest rates:</span>
<span fxFlex="60%">{{ loanProduct.isLinkedToFloatingInterestRates ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.isLinkedToFloatingInterestRates | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="!loanProduct.isLinkedToFloatingInterestRates">
Expand All @@ -120,7 +120,7 @@ <h3 class="mat-h3" fxFlexFill>Terms</h3>
<span fxFlex="40%">Interest Rate Differential:</span>
<span fxFlex="60%">{{ loanProduct.interestRateDifferential }}</span>
<span fxFlex="40%">Floating Interest Rate Calculation Allowed:</span>
<span fxFlex="60%">{{ loanProduct.isFloatingInterestRateCalculationAllowed ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.isFloatingInterestRateCalculationAllowed | yesNo }}</span>
<span fxFlex="40%">Floating Interest Rate:</span>
<span fxFlex="60%">{{ loanProduct.defaultDifferentialLendingRate + ' (Min: ' +
(loanProduct.minDifferentialLendingRate ? loanProduct.minDifferentialLendingRate :
Expand All @@ -130,7 +130,7 @@ <h3 class="mat-h3" fxFlexFill>Terms</h3>

<div fxFlexFill>
<span fxFlex="40%">Terms vary based on loan cycle:</span>
<span fxFlex="60%">{{ loanProduct.useBorrowerCycle ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.useBorrowerCycle | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.principalVariationsForBorrowerCycle?.length">
Expand Down Expand Up @@ -302,7 +302,7 @@ <h3 class="mat-h3" fxFlexFill>Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Is Equal Amortization:</span>
<span fxFlex="60%">{{ loanProduct.isEqualAmortization ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.isEqualAmortization | yesNo }}</span>
</div>

<div fxFlexFill>
Expand All @@ -319,7 +319,7 @@ <h3 class="mat-h3" fxFlexFill>Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Allow Partial Interest Calculation with same as repayment:</span>
<span fxFlex="60%">{{ loanProduct.allowPartialPeriodInterestCalcualtion ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowPartialPeriodInterestCalcualtion | yesNo }}</span>
</div>

<div fxFlexFill>
Expand Down Expand Up @@ -396,7 +396,7 @@ <h3 class="mat-h3" fxFlexFill>Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Allow fixing of the installment amount:</span>
<span fxFlex="60%">{{ loanProduct.canDefineInstallmentAmount ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.canDefineInstallmentAmount | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.graceOnArrearsAgeing">
Expand All @@ -411,12 +411,12 @@ <h3 class="mat-h3" fxFlexFill>Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Delinquency Bucket:</span>
<span fxFlex="60%">{{ loanProduct.delinquencyBucketId ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.delinquencyBucketId | yesNo }}</span>
</div>

<div fxFlexFill>
<span fxFlex="40%">Account moves out of NPA only after all arrears have been cleared:</span>
<span fxFlex="60%">{{ loanProduct.accountMovesOutOfNPAOnlyOnArrearsCompletion ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.accountMovesOutOfNPAOnlyOnArrearsCompletion | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.principalThresholdForLastInstallment">
Expand All @@ -426,7 +426,7 @@ <h3 class="mat-h3" fxFlexFill>Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Variable Installments allowed:</span>
<span fxFlex="60%">{{ loanProduct.allowVariableInstallments ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowVariableInstallments | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.allowVariableInstallments">
Expand All @@ -437,7 +437,7 @@ <h3 class="mat-h3" fxFlexFill>Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Allowed to be used for providing Topup Loans:</span>
<span fxFlex="60%">{{ loanProduct.canUseForTopup ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.canUseForTopup | yesNo }}</span>
</div>

<h3 class="mat-h3" fxFlexFill>Interest Recalculation</h3>
Expand All @@ -446,7 +446,7 @@ <h3 class="mat-h3" fxFlexFill>Interest Recalculation</h3>

<div fxFlexFill>
<span fxFlex="40%">Recalculate Interest:</span>
<span fxFlex="60%">{{ loanProduct.isInterestRecalculationEnabled ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.isInterestRecalculationEnabled | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.isInterestRecalculationEnabled" fxLayout="row wrap" fxLayout.lt-md="column">
Expand Down Expand Up @@ -510,7 +510,7 @@ <h3 class="mat-h3" fxFlexFill>Interest Recalculation</h3>
</div>
<div fxFlexFill>
<span fxFlex="40%">Is Arrears recognization based on original schedule:</span>
<span fxFlex="60%">{{ loanProduct.isArrearsBasedOnOriginalSchedule ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.isArrearsBasedOnOriginalSchedule | yesNo }}</span>
</div>
</div>

Expand All @@ -520,7 +520,7 @@ <h3 class="mat-h3" fxFlexFill>Guarantee Requirements</h3>

<div fxFlexFill>
<span fxFlex="40%">Place Guarantee Funds On-Hold:</span>
<span fxFlex="60%">{{ loanProduct.holdGuaranteeFunds ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.holdGuaranteeFunds | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.holdGuaranteeFunds" fxLayout="row wrap" fxLayout.lt-md="column">
Expand All @@ -542,7 +542,7 @@ <h3 class="mat-h3" fxFlexFill>Loan Tranche Details</h3>

<div fxFlexFill>
<span fxFlex="40%">Enable Multiple Disbursals:</span>
<span fxFlex="60%">{{ loanProduct.multiDisburseLoan ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.multiDisburseLoan | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.multiDisburseLoan" fxLayout="row wrap" fxLayout.lt-md="column">
Expand All @@ -556,7 +556,7 @@ <h3 class="mat-h3" fxFlexFill>Loan Tranche Details</h3>

<div fxFlexFill>
<span fxFlex="40%">Disallow Expected Disbursements:</span>
<span fxFlex="60%">{{ loanProduct.disallowExpectedDisbursements ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.disallowExpectedDisbursements | yesNo }}</span>
</div>

<h3 class="mat-h3" fxFlexFill>Down Payments</h3>
Expand All @@ -565,14 +565,24 @@ <h3 class="mat-h3" fxFlexFill>Down Payments</h3>

<div fxFlexFill>
<span fxFlex="40%">Enable Down Payments:</span>
<span fxFlex="60%">{{ loanProduct.enableDownPayment ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.enableDownPayment | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.enableDownPayment" fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Disbursed Amount Percentage Down Payment (%):</span>
<span fxFlex="60%">{{ loanProduct.disbursedAmountPercentageForDownPayment }} %</span>
</div>

<div fxFlexFill *ngIf="loanProduct.enableDownPayment" fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Enable Auto Repayment for Down Payment:</span>
<span fxFlex="60%">{{ loanProduct.enableAutoRepaymentForDownPayment | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.enableDownPayment" fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Do not extend loan schedule for multi disbursal:</span>
<span fxFlex="60%">{{ loanProduct.disableScheduleExtensionForDownPayment | yesNo }}</span>
</div>

<h3 class="mat-h3" fxFlexFill>Event Settings</h3>

<div fxFlexFill>
Expand All @@ -591,27 +601,27 @@ <h3 class="mat-h3" fxFlexFill>Configurable Terms and Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Allow overriding select terms and settings in loan accounts:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeConfiguration ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeConfiguration | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.allowAttributeConfiguration" fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Amortization:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.amortizationType ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.amortizationType | yesNo }}</span>
<span fxFlex="40%">Interest method:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.interestType ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.interestType | yesNo }}</span>
<span fxFlex="40%">Repayment strategy:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.transactionProcessingStrategyCode ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.transactionProcessingStrategyCode | yesNo }}</span>
<span fxFlex="40%">Interest calculation period:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.interestCalculationPeriodType ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.interestCalculationPeriodType | yesNo }}</span>
<span fxFlex="40%">Arrears tolerance:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.inArrearsTolerance ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.inArrearsTolerance | yesNo }}</span>
<span fxFlex="40%">Repaid every:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.repaymentEvery ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.repaymentEvery | yesNo }}</span>
<span fxFlex="40%">Moratorium:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.graceOnPrincipalAndInterestPayment ? 'Yes' : 'No'
}}</span>
<span fxFlex="40%">Number of days a loan may be overdue before moving into arrears:</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.graceOnArrearsAgeing ? 'Yes' : 'No' }}</span>
<span fxFlex="60%">{{ loanProduct.allowAttributeOverrides.graceOnArrearsAgeing | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.charges.length" fxLayout="row wrap" fxLayout.lt-md="column">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,19 @@ <h3 fxFlex="23%" class="mat-h3">Down Payment</h3>
</mat-error>
</mat-form-field>

<mat-checkbox fxFlex="48%" labelPosition="before" formControlName="enableAutoRepaymentForDownPayment" matTooltip="nable or disable the auto repayment of down-payment.
<mat-checkbox fxFlex="48%" labelPosition="before" formControlName="enableAutoRepaymentForDownPayment" matTooltip="Enable or disable the auto repayment of down-payment.
When “auto repayment for the down-payments“ is enabled, the disbursements will trigger an auto down payment transaction for the down payment amount" class="margin-b">
Enable Auto Repayment for Down Payment
</mat-checkbox>
</div>

<div *ngIf="loanProductSettingsForm.value.multiDisburseLoan && loanProductSettingsForm.value.enableDownPayment" fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
<mat-checkbox fxFlex="48%" labelPosition="before" formControlName="disableScheduleExtensionForDownPayment" matTooltip="Enable or disable If Fineract extends the
repayment schedule to the exact number of repayments configured for that loan account" class="margin-b">
Do not extend loan schedule for multi disbursal
</mat-checkbox>
</div>

<mat-divider fxFlex="98%"></mat-divider>

<h3 fxFlex="23%" class="mat-h3">Event Settings <i class="fas fa-question"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,11 @@ export class LoanProductSettingsStepComponent implements OnInit {
if (enableDownPayment) {
this.loanProductSettingsForm.addControl('disbursedAmountPercentageForDownPayment', new UntypedFormControl(0, [Validators.required, rangeValidator(0, 100) ]));
this.loanProductSettingsForm.addControl('enableAutoRepaymentForDownPayment', new UntypedFormControl(false, []));
this.loanProductSettingsForm.addControl('disableScheduleExtensionForDownPayment', new UntypedFormControl(false, []));
} else {
this.loanProductSettingsForm.removeControl('disbursedAmountPercentageForDownPayment');
this.loanProductSettingsForm.removeControl('enableAutoRepaymentForDownPayment');
this.loanProductSettingsForm.removeControl('disableScheduleExtensionForDownPayment');
}
});

Expand Down Expand Up @@ -396,7 +398,11 @@ export class LoanProductSettingsStepComponent implements OnInit {
}

get loanProductSettings() {
return this.loanProductSettingsForm.value;
const productSettings = this.loanProductSettingsForm.value;
if (!this.loanProductSettingsForm.value.multiDisburseLoan) {
delete productSettings['disableScheduleExtensionForDownPayment'];
}
return productSettings;
}

}
Loading

0 comments on commit 59dc5b6

Please sign in to comment.