Remark Loan product attributes that uses default values from global configurations (#1783)
Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
9f2c644877
commit
e1e3429b66
@@ -48,12 +48,16 @@ export class CreateLoanProductComponent implements OnInit {
|
||||
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||
const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
|
||||
const itemsByDefault: string[] = [];
|
||||
data.configurations.globalConfiguration.forEach((config: GlobalConfiguration) => {
|
||||
if (config.name === 'days-before-repayment-is-due') {
|
||||
this.loanProductsTemplate['dueDaysForRepaymentEvent'] = config.value;
|
||||
itemsByDefault.push('dueDaysForRepaymentEvent');
|
||||
} else if (config.name === 'days-after-repayment-is-overdue') {
|
||||
this.loanProductsTemplate['overDueDaysForRepaymentEvent'] = config.value;
|
||||
itemsByDefault.push('overDueDaysForRepaymentEvent');
|
||||
}
|
||||
this.loanProductsTemplate['itemsByDefault'] = itemsByDefault;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,16 +48,20 @@ export class EditLoanProductComponent implements OnInit {
|
||||
const assetAccountData = this.loanProductAndTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||
const liabilityAccountData = this.loanProductAndTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
this.loanProductAndTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
|
||||
const itemsByDefault: string[] = [];
|
||||
data.configurations.globalConfiguration.forEach((config: GlobalConfiguration) => {
|
||||
if (config.name === 'days-before-repayment-is-due') {
|
||||
if (this.loanProductAndTemplate['dueDaysForRepaymentEvent'] == null) {
|
||||
this.loanProductAndTemplate['dueDaysForRepaymentEvent'] = config.value;
|
||||
itemsByDefault.push('dueDaysForRepaymentEvent');
|
||||
}
|
||||
} else if (config.name === 'days-after-repayment-is-overdue') {
|
||||
if (this.loanProductAndTemplate['overDueDaysForRepaymentEvent'] == null) {
|
||||
this.loanProductAndTemplate['overDueDaysForRepaymentEvent'] = config.value;
|
||||
itemsByDefault.push('overDueDaysForRepaymentEvent');
|
||||
}
|
||||
}
|
||||
this.loanProductAndTemplate['itemsByDefault'] = itemsByDefault;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
+4
-3
@@ -416,16 +416,17 @@
|
||||
|
||||
<mat-divider fxFlex="98%"></mat-divider>
|
||||
|
||||
<h3 fxFlex="23%" class="mat-h3">Event Settings</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-form-field fxFlex="48%">
|
||||
<mat-label>Due days for repayment event</mat-label>
|
||||
<mat-label [ngClass]="styleByDefault('dueDaysForRepaymentEvent')">Due days for repayment event</mat-label>
|
||||
<input type="number" matInput matTooltip="Specific days before when repayment due notification should be sent." formControlName="dueDaysForRepaymentEvent" [min]="0">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="48%">
|
||||
<mat-label>OverDue days for repayment event</mat-label>
|
||||
<mat-label [ngClass]="styleByDefault('dueDaysForRepaymentEvent')">OverDue days for repayment event</mat-label>
|
||||
<input type="number" matInput matTooltip="Specific days when after the repayment Overdue notification should be sent." formControlName="overDueDaysForRepaymentEvent" [min]="0">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
+6
@@ -1,3 +1,5 @@
|
||||
@import "assets/styles/colours";
|
||||
|
||||
h3, h4 {
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -21,3 +23,7 @@ mat-divider {
|
||||
.margin-t {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.by-default {
|
||||
color: $status-approved;
|
||||
}
|
||||
|
||||
+12
-2
@@ -28,6 +28,8 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
interestRecalculationOnDayTypeData: any;
|
||||
delinquencyBucketData: any;
|
||||
|
||||
itemsByDefault: string[] = [];
|
||||
|
||||
constructor(private formBuilder: FormBuilder) {
|
||||
this.createLoanProductSettingsForm();
|
||||
this.setConditionalControls();
|
||||
@@ -58,6 +60,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
this.interestRecalculationOnDayTypeData = Array.from({ length: 28 }, (_, index) => index + 1);
|
||||
this.delinquencyBucketData = this.loanProductsTemplate.delinquencyBucketOptions;
|
||||
|
||||
this.itemsByDefault = this.loanProductsTemplate.itemsByDefault || [];
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'amortizationType': this.loanProductsTemplate.amortizationType.id,
|
||||
'interestType': this.loanProductsTemplate.interestType.id,
|
||||
@@ -88,7 +91,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
'outstandingLoanBalance': this.loanProductsTemplate.outstandingLoanBalance,
|
||||
'dueDaysForRepaymentEvent': this.loanProductsTemplate.dueDaysForRepaymentEvent,
|
||||
'overDueDaysForRepaymentEvent': this.loanProductsTemplate.overDueDaysForRepaymentEvent
|
||||
});
|
||||
});
|
||||
|
||||
if (this.loanProductsTemplate.delinquencyBucket) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
@@ -195,7 +198,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
this.loanProductSettingsForm.get('interestCalculationPeriodType').valueChanges
|
||||
.subscribe((interestCalculationPeriodType: any) => {
|
||||
if (interestCalculationPeriodType === 0) {
|
||||
this.loanProductSettingsForm.patchValue({'allowPartialPeriodInterestCalcualtion': false});
|
||||
this.loanProductSettingsForm.patchValue({ 'allowPartialPeriodInterestCalcualtion': false });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -358,6 +361,13 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
styleByDefault(input: string): string {
|
||||
if (this.itemsByDefault.includes(input)) {
|
||||
return 'by-default';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
get loanProductSettings() {
|
||||
return this.loanProductSettingsForm.value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user