Skip to content

Commit

Permalink
Loan Product repayment due event values set by default from global co…
Browse files Browse the repository at this point in the history
…nfigurations
  • Loading branch information
Jose Alberto Hernandez authored and adamsaghy committed Oct 30, 2023
1 parent 3c625d8 commit cee57c5
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,16 @@ <h3 class="mat-h3" fxFlexFill>Down Payments</h3>
<h3 class="mat-h3" fxFlexFill>Event Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Use the Global Configurations values to the Repayment Event (notifications):</span>
<span fxFlex="60%">{{ loanProduct.useDueForRepaymentsConfigurations | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="!loanProduct.useDueForRepaymentsConfigurations">
<span fxFlex="40%">Due days for repayment event:</span>
<span fxFlex="60%">{{ loanProduct.dueDaysForRepaymentEvent | number }}</span>
</div>

<div fxFlexFill>
<div fxFlexFill *ngIf="!loanProduct.useDueForRepaymentsConfigurations">
<span fxFlex="40%">OverDue days for repayment event:</span>
<span fxFlex="60%">{{ loanProduct.overDueDaysForRepaymentEvent | number }}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,24 +458,21 @@ <h3 fxFlex="23%" class="mat-h3">Down Payment</h3>

<h3 fxFlex="23%" class="mat-h3">Event Settings <i class="fas fa-question"
matTooltip="Setting for event notifications to be sent before or after repayments. Blue color means default value from global configurations."></i></h3>
<div fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">

<mat-checkbox fxFlex="48%" labelPosition="before" formControlName="useDueForRepaymentsConfigurations" matTooltip="Use or not the Global Configurations values to the Repayment Event (notifications)" class="margin-b">
Use the Global Configurations values to the Repayment Event (notifications)
</mat-checkbox>

<div fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" *ngIf="!loanProductSettingsForm.value.useDueForRepaymentsConfigurations">

<mat-form-field fxFlex="48%">
<mat-label>Due days for repayment event</mat-label>
<mat-select formControlName="dueDaysForRepaymentEvent" matTooltip="The Amortization value is input to calculating the repayment amounts for repayment of the loan." required>
<mat-option *ngFor="let item of getDaysForRepayments(DAYS_BEFORE_REPAYMENT_IS_DUE)" [value]="item.days">
<span [ngClass]="item.style">{{item.label}}</span>
</mat-option>
</mat-select>
<input type="number" matInput matTooltip="The maximum outstanding loan account balance allowed at a point in time." formControlName="dueDaysForRepaymentEvent">
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>OverDue days for repayment event</mat-label>
<mat-select formControlName="overDueDaysForRepaymentEvent" matTooltip="The Amortization value is input to calculating the repayment amounts for repayment of the loan." required>
<mat-option *ngFor="let item of getDaysForRepayments(DAYS_AFTER_REPAYMENT_IS_OVERDUE)" [value]="item.days">
<span [ngClass]="item.style">{{item.label}}</span>
</mat-option>
</mat-select>
<input type="number" matInput matTooltip="The maximum outstanding loan account balance allowed at a point in time." formControlName="overDueDaysForRepaymentEvent">
</mat-form-field>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ export class LoanProductSettingsStepComponent implements OnInit {
'multiDisburseLoan': this.loanProductsTemplate.multiDisburseLoan,
'maxTrancheCount': this.loanProductsTemplate.maxTrancheCount,
'outstandingLoanBalance': this.loanProductsTemplate.outstandingLoanBalance,
'dueDaysForRepaymentEvent': this.loanProductsTemplate.dueDaysForRepaymentEvent,
'overDueDaysForRepaymentEvent': this.loanProductsTemplate.overDueDaysForRepaymentEvent,
'enableDownPayment': this.loanProductsTemplate.enableDownPayment,
'enableInstallmentLevelDelinquency': this.loanProductsTemplate.enableInstallmentLevelDelinquency
'enableInstallmentLevelDelinquency': this.loanProductsTemplate.enableInstallmentLevelDelinquency,
'useDueForRepaymentsConfigurations': this.loanProductsTemplate.useDueForRepaymentsConfigurations
});

if (this.loanProductsTemplate.delinquencyBucket) {
Expand Down Expand Up @@ -239,10 +238,9 @@ export class LoanProductSettingsStepComponent implements OnInit {
'graceOnArrearsAgeing': [true]
}),
'delinquencyBucketId': ['', Validators.required],
'dueDaysForRepaymentEvent': [''],
'overDueDaysForRepaymentEvent': [''],
'enableDownPayment': [false],
'enableInstallmentLevelDelinquency': [false]
'enableInstallmentLevelDelinquency': [false],
'useDueForRepaymentsConfigurations': [false]
});
}

Expand Down Expand Up @@ -432,14 +430,17 @@ export class LoanProductSettingsStepComponent implements OnInit {
}
});

this.loanProductSettingsForm.get('dueDaysForRepaymentEvent').valueChanges
.subscribe((dueDaysForRepaymentEvent: number) => {
this.setStyleDaysForRepayment(this.DAYS_BEFORE_REPAYMENT_IS_DUE, dueDaysForRepaymentEvent);
});

this.loanProductSettingsForm.get('overDueDaysForRepaymentEvent').valueChanges
.subscribe((overDueDaysForRepaymentEvent: number) => {
this.setStyleDaysForRepayment(this.DAYS_AFTER_REPAYMENT_IS_OVERDUE, overDueDaysForRepaymentEvent);
this.loanProductSettingsForm.get('useDueForRepaymentsConfigurations').valueChanges
.subscribe((useDueForRepaymentsConfigurations: boolean) => {
if (useDueForRepaymentsConfigurations) {
this.loanProductSettingsForm.removeControl('dueDaysForRepaymentEvent');
this.loanProductSettingsForm.removeControl('overDueDaysForRepaymentEvent');
} else {
this.loanProductSettingsForm.addControl('dueDaysForRepaymentEvent',
new UntypedFormControl(this.loanProductsTemplate.dueDaysForRepaymentEvent, [Validators.required, rangeValidator(1, 100) ]));
this.loanProductSettingsForm.addControl('overDueDaysForRepaymentEvent',
new UntypedFormControl(this.loanProductsTemplate.overDueDaysForRepaymentEvent, [Validators.required, rangeValidator(1, 100) ]));
}
});
}

Expand Down Expand Up @@ -482,6 +483,10 @@ export class LoanProductSettingsStepComponent implements OnInit {
if (!this.loanProductSettingsForm.value.multiDisburseLoan) {
delete productSettings['disableScheduleExtensionForDownPayment'];
}
if (this.loanProductSettingsForm.value.useDueForRepaymentsConfigurations) {
delete productSettings['dueDaysForRepaymentEvent'];
delete productSettings['overDueDaysForRepaymentEvent'];
}
return productSettings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,11 +562,16 @@ <h3 class="mat-h3" fxFlexFill>Down Payments</h3>
<h3 class="mat-h3" fxFlexFill>Event Settings</h3>

<div fxFlexFill>
<span fxFlex="40%">Use the Global Configurations values to the Repayment Event (notifications):</span>
<span fxFlex="60%">{{ loanProduct.useDueForRepaymentsConfigurations | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="!loanProduct.useDueForRepaymentsConfigurations">
<span fxFlex="40%">Due days for repayment event:</span>
<span fxFlex="60%">{{ loanProduct.dueDaysForRepaymentEvent | number }}</span>
</div>

<div fxFlexFill>
<div fxFlexFill *ngIf="!loanProduct.useDueForRepaymentsConfigurations">
<span fxFlex="40%">OverDue days for repayment event:</span>
<span fxFlex="60%">{{ loanProduct.overDueDaysForRepaymentEvent | number }}</span>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/assets/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
window["env"] = window["env"] || {};

// BackEnd Environment variables
window["env"]["fineractApiUrls"] = 'https://ps-test.dev.alluvial.cloud';
window["env"]["fineractApiUrl"] = 'https://ps-test.dev.alluvial.cloud';
window["env"]["fineractApiUrls"] = '';
window["env"]["fineractApiUrl"] = '';

window["env"]["apiProvider"] = '';
window["env"]["apiVersion"] = '';

window["env"]["fineractPlatformTenantId"] = 'pstest';
window["env"]["fineractPlatformTenantIds"] = 'pstest';
window["env"]["fineractPlatformTenantId"] = '';
window["env"]["fineractPlatformTenantIds"] = '';

// Language Environment variables
window["env"]["defaultLanguage"] = '';
Expand Down

0 comments on commit cee57c5

Please sign in to comment.