Skip to content

Commit 486ad2a

Browse files
committed
WEB-204: Loan product config - buy down fees
1 parent 263ddf0 commit 486ad2a

28 files changed

+570
-231
lines changed

src/app/loans/loans-view/account-details/account-details.component.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,28 @@ <h3>{{ 'labels.heading.Loan Details' | translate }}</h3>
101101
<span class="flex-50"> {{ loanDetails.capitalizedIncomeType?.value | translateKey: 'catalogs' }} </span>
102102
</div>
103103

104+
<div class="flex-fill layout-row">
105+
<span class="flex-50"> {{ 'labels.inputs.Enable Buy down fee' | translate }}</span>
106+
<span class="flex-50"> {{ loanDetails.enableBuyDownFee | yesNo }} </span>
107+
</div>
108+
109+
<div class="flex-fill layout-row" *ngIf="loanDetails.enableBuyDownFee">
110+
<span class="flex-50"> {{ 'labels.inputs.Buy down fee calculation type' | translate }}</span>
111+
<span class="flex-50">
112+
{{ loanDetails.buyDownFeeCalculationType?.value | translateKey: 'catalogs' }}
113+
</span>
114+
</div>
115+
116+
<div class="flex-fill layout-row" *ngIf="loanDetails.enableBuyDownFee">
117+
<span class="flex-50"> {{ 'labels.inputs.Buy down fee strategy' | translate }}</span>
118+
<span class="flex-50"> {{ loanDetails.buyDownFeeStrategy?.value | translateKey: 'catalogs' }} </span>
119+
</div>
120+
121+
<div class="flex-fill layout-row" *ngIf="loanDetails.enableBuyDownFee">
122+
<span class="flex-50"> {{ 'labels.inputs.Buy down fee income type' | translate }}</span>
123+
<span class="flex-50"> {{ loanDetails.buyDownFeeIncomeType?.value | translateKey: 'catalogs' }} </span>
124+
</div>
125+
104126
<div class="flex-fill layout-row">
105127
<span class="flex-50"> {{ 'labels.inputs.Grace: On Principal Payment' | translate }}</span>
106128
<span class="flex-50"> {{ loanDetails.graceOnPrincipalPayment }} </span>

src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,10 +879,31 @@ <h3 class="mat-h3 flex-100">{{ 'labels.inputs.Income capitalization' | translate
879879
<span class="flex-47">{{ 'labels.inputs.Income type' | translate }}:</span>
880880
<span class="flex-53">{{ loanProduct.capitalizedIncomeType?.value | translateKey: 'catalogs' }}</span>
881881
</div>
882+
</div>
883+
884+
<div class="flex-100 layout-row-wrap responsive-column" *ngIf="isAdvancedPaymentAllocation">
885+
<h3 class="mat-h3 flex-100">{{ 'labels.inputs.Buy down fees' | translate }}</h3>
886+
887+
<mat-divider [inset]="true"></mat-divider>
888+
889+
<div class="flex-100 layout-row">
890+
<span class="flex-47">{{ 'labels.inputs.Enable Buy down fee' | translate }}:</span>
891+
<span class="flex-53">{{ loanProduct.enableBuyDownFee | yesNo }}</span>
892+
</div>
893+
894+
<div class="flex-100 layout-row" *ngIf="loanProduct.enableBuyDownFee">
895+
<span class="flex-47">{{ 'labels.inputs.Buy down fee calculation type' | translate }}:</span>
896+
<span class="flex-53">{{ loanProduct.buyDownFeeCalculationType?.value | translateKey: 'catalogs' }}</span>
897+
</div>
898+
899+
<div class="flex-100 layout-row" *ngIf="loanProduct.enableBuyDownFee">
900+
<span class="flex-47">{{ 'labels.inputs.Buy down fee strategy' | translate }}:</span>
901+
<span class="flex-53">{{ loanProduct.buyDownFeeStrategy?.value | translateKey: 'catalogs' }}</span>
902+
</div>
882903

883-
<div fxFlexFill *ngIf="loanProduct.enableIncomeCapitalization">
884-
<span fxFlex="47%">{{ 'labels.inputs.Income type' | translate }}:</span>
885-
<span fxFlex="53%">{{ loanProduct.capitalizedIncomeType?.value | translateKey: 'catalogs' }}</span>
904+
<div class="flex-100 layout-row" *ngIf="loanProduct.enableBuyDownFee">
905+
<span class="flex-47">{{ 'labels.inputs.Buy down fee income type' | translate }}:</span>
906+
<span class="flex-53">{{ loanProduct.buyDownFeeIncomeType?.value | translateKey: 'catalogs' }}</span>
886907
</div>
887908
</div>
888909

src/app/products/loan-products/create-loan-product/create-loan-product.component.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
(supportedInterestRefundTypes)="setSupportedInterestRefundTypes($event)"
5555
>
5656
</mifosx-loan-product-interest-refund-step>
57+
58+
<mifosx-stepper-buttons></mifosx-stepper-buttons>
5759
</mat-step>
5860

5961
<mat-step *ngIf="isAdvancedPaymentStrategy">
@@ -91,15 +93,18 @@
9193
</mifosx-loan-product-charges-step>
9294
</mat-step>
9395

94-
<mat-step *ngIf="isAdvancedPaymentStrategy" [stepControl]="loanIncomeCapitalizationForm" completed>
95-
<ng-template matStepLabel>{{ 'labels.inputs.INCOME CAPITALIZATION' | translate }}</ng-template>
96+
<mat-step *ngIf="isAdvancedPaymentStrategy" [stepControl]="loanDeferredIncomeRecognitionForm" completed>
97+
<ng-template matStepLabel>{{ 'labels.inputs.DEFERRED INCOME RECOGNITION' | translate }}</ng-template>
9698

9799
<mifosx-loan-product-capitalized-income-step
98-
[capitalizedIncome]="capitalizedIncome"
100+
[deferredIncomeRecognition]="deferredIncomeRecognition"
99101
[capitalizedIncomeCalculationTypeOptions]="loanProductsTemplate.capitalizedIncomeCalculationTypeOptions"
100102
[capitalizedIncomeStrategyOptions]="loanProductsTemplate.capitalizedIncomeStrategyOptions"
101103
[capitalizedIncomeTypeOptions]="loanProductsTemplate.capitalizedIncomeTypeOptions"
102-
(setCapitalizedIncome)="setCapitalizedIncome($event)"
104+
[buyDownFeeCalculationTypeOptions]="loanProductsTemplate.buyDownFeeCalculationTypeOptions"
105+
[buyDownFeeStrategyOptions]="loanProductsTemplate.buyDownFeeStrategyOptions"
106+
[buyDownFeeIncomeTypeOptions]="loanProductsTemplate.buyDownFeeIncomeTypeOptions"
107+
(setDeferredIncomeRecognition)="setDeferredIncomeRecognition($event)"
103108
(setViewChildForm)="setViewChildForm($event)"
104109
>
105110
</mifosx-loan-product-capitalized-income-step>
@@ -114,7 +119,7 @@
114119
[loanProductsTemplate]="loanProductsTemplate"
115120
[accountingRuleData]="accountingRuleData"
116121
[loanProductFormValid]="loanProductFormValid"
117-
[capitalizedIncome]="capitalizedIncome"
122+
[deferredIncomeRecognition]="deferredIncomeRecognition"
118123
>
119124
</mifosx-loan-product-accounting-step>
120125
</mat-step>

src/app/products/loan-products/create-loan-product/create-loan-product.component.ts

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import { LoanProducts } from '../loan-products';
1717
import {
1818
AdvancedPaymentAllocation,
1919
AdvancedPaymentStrategy,
20-
CapitalizedIncome,
20+
DeferredIncomeRecognition,
2121
PaymentAllocation
2222
} from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
2323
import { Accounting } from 'app/core/utils/accounting';
2424
import { StringEnumOptionData } from '../../../shared/models/option-data.model';
25-
import { LoanProductCapitalizedIncomeStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-capitalized-income-step.component';
25+
import { LoanProductDeferredIncomeRecognitionStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-deferred-income-recognition-step.component';
2626
import { UntypedFormGroup } from '@angular/forms';
2727

2828
@Component({
@@ -36,8 +36,8 @@ export class CreateLoanProductComponent implements OnInit {
3636
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
3737
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
3838
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
39-
@ViewChild(LoanProductCapitalizedIncomeStepComponent, { static: true })
40-
loanProductCapitalizedIncomeStep: LoanProductCapitalizedIncomeStepComponent;
39+
@ViewChild(LoanProductDeferredIncomeRecognitionStepComponent, { static: true })
40+
loanProductDeferredIncomeRecognitionStep: LoanProductDeferredIncomeRecognitionStepComponent;
4141
@ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent;
4242
@ViewChild(LoanProductSettingsStepComponent, { static: true })
4343
loanProductSettingsStep: LoanProductSettingsStepComponent;
@@ -56,8 +56,8 @@ export class CreateLoanProductComponent implements OnInit {
5656
advancedPaymentAllocations: AdvancedPaymentAllocation[] = [];
5757
advancedCreditAllocations: AdvancedPaymentAllocation[] = [];
5858

59-
capitalizedIncome: CapitalizedIncome | null = null;
60-
loanIncomeCapitalizationForm: UntypedFormGroup;
59+
deferredIncomeRecognition: DeferredIncomeRecognition | null = null;
60+
loanDeferredIncomeRecognitionForm: UntypedFormGroup;
6161

6262
/**
6363
* @param {ActivatedRoute} route Activated Route.
@@ -114,18 +114,33 @@ export class CreateLoanProductComponent implements OnInit {
114114
advancePaymentStrategy(value: string) {
115115
this.isAdvancedPaymentStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(value);
116116
if (this.isAdvancedPaymentStrategy) {
117+
if (this.deferredIncomeRecognition == null) {
118+
this.deferredIncomeRecognition = {};
119+
}
117120
if (this.loanProductsTemplate.enableIncomeCapitalization) {
118-
this.capitalizedIncome = {
121+
this.deferredIncomeRecognition.capitalizedIncome = {
119122
enableIncomeCapitalization: true,
120123
capitalizedIncomeCalculationType: this.loanProductsTemplate.capitalizedIncomeCalculationTypeOptions[0],
121124
capitalizedIncomeStrategy: this.loanProductsTemplate.capitalizedIncomeStrategyOptions[0],
122125
capitalizedIncomeType: this.loanProductsTemplate.capitalizedIncomeTypeOptions[0]
123126
};
124127
} else {
125-
this.capitalizedIncome = {
128+
this.deferredIncomeRecognition.capitalizedIncome = {
126129
enableIncomeCapitalization: false
127130
};
128131
}
132+
if (this.loanProductsTemplate.enableBuyDownFee) {
133+
this.deferredIncomeRecognition.buyDownFee = {
134+
enableBuyDownFee: true,
135+
buyDownFeeCalculationType: this.loanProductsTemplate.buyDownFeeCalculationTypeOptions[0],
136+
buyDownFeeStrategy: this.loanProductsTemplate.buyDownFeeStrategyOptions[0],
137+
buyDownFeeIncomeType: this.loanProductsTemplate.buyDownFeeIncomeTypeOptions[0]
138+
};
139+
} else {
140+
this.deferredIncomeRecognition.buyDownFee = {
141+
enableBuyDownFee: false
142+
};
143+
}
129144
}
130145
}
131146

@@ -147,14 +162,14 @@ export class CreateLoanProductComponent implements OnInit {
147162
this.supportedInterestRefundTypes = supportedInterestRefundTypes;
148163
}
149164

150-
setCapitalizedIncome(capitalizedIncome: CapitalizedIncome): void {
165+
setDeferredIncomeRecognition(deferredIncomeRecognition: DeferredIncomeRecognition): void {
151166
if (this.isAdvancedPaymentStrategy) {
152-
this.capitalizedIncome = capitalizedIncome;
167+
this.deferredIncomeRecognition = deferredIncomeRecognition;
153168
}
154169
}
155170

156171
setViewChildForm(viewChildForm: UntypedFormGroup): void {
157-
this.loanIncomeCapitalizationForm = viewChildForm;
172+
this.loanDeferredIncomeRecognitionForm = viewChildForm;
158173
}
159174

160175
get loanProductSettingsForm() {
@@ -172,7 +187,7 @@ export class CreateLoanProductComponent implements OnInit {
172187
this.loanProductCurrencyForm.valid &&
173188
this.loanProductTermsForm.valid &&
174189
this.loanProductSettingsForm.valid &&
175-
this.loanIncomeCapitalizationForm.valid &&
190+
this.loanDeferredIncomeRecognitionForm.valid &&
176191
this.loanProductAccountingForm.valid
177192
);
178193
} else {
@@ -199,12 +214,24 @@ export class CreateLoanProductComponent implements OnInit {
199214
loanProduct['paymentAllocation'] = this.paymentAllocation;
200215
loanProduct['creditAllocation'] = this.creditAllocation;
201216
loanProduct['supportedInterestRefundTypes'] = this.supportedInterestRefundTypes;
202-
if (this.capitalizedIncome != null) {
203-
loanProduct['enableIncomeCapitalization'] = this.capitalizedIncome.enableIncomeCapitalization;
204-
if (this.capitalizedIncome.enableIncomeCapitalization) {
205-
loanProduct['capitalizedIncomeCalculationType'] = this.capitalizedIncome.capitalizedIncomeCalculationType;
206-
loanProduct['capitalizedIncomeStrategy'] = this.capitalizedIncome.capitalizedIncomeStrategy;
207-
loanProduct['capitalizedIncomeType'] = this.capitalizedIncome.capitalizedIncomeType;
217+
if (this.deferredIncomeRecognition.capitalizedIncome != null) {
218+
loanProduct['enableIncomeCapitalization'] =
219+
this.deferredIncomeRecognition.capitalizedIncome.enableIncomeCapitalization;
220+
if (this.deferredIncomeRecognition.capitalizedIncome.enableIncomeCapitalization) {
221+
loanProduct['capitalizedIncomeCalculationType'] =
222+
this.deferredIncomeRecognition.capitalizedIncome.capitalizedIncomeCalculationType;
223+
loanProduct['capitalizedIncomeStrategy'] =
224+
this.deferredIncomeRecognition.capitalizedIncome.capitalizedIncomeStrategy;
225+
loanProduct['capitalizedIncomeType'] = this.deferredIncomeRecognition.capitalizedIncome.capitalizedIncomeType;
226+
}
227+
}
228+
if (this.deferredIncomeRecognition.buyDownFee != null) {
229+
loanProduct['enableBuyDownFee'] = this.deferredIncomeRecognition.buyDownFee.enableBuyDownFee;
230+
if (this.deferredIncomeRecognition.buyDownFee.enableBuyDownFee) {
231+
loanProduct['buyDownFeeCalculationType'] =
232+
this.deferredIncomeRecognition.buyDownFee.buyDownFeeCalculationType;
233+
loanProduct['buyDownFeeStrategy'] = this.deferredIncomeRecognition.buyDownFee.buyDownFeeStrategy;
234+
loanProduct['buyDownFeeIncomeType'] = this.deferredIncomeRecognition.buyDownFee.buyDownFeeIncomeType;
208235
}
209236
}
210237
}

src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,17 @@
9494
</mat-step>
9595

9696
<mat-step *ngIf="isAdvancedPaymentStrategy" [stepControl]="loanIncomeCapitalizationForm" completed>
97-
<ng-template matStepLabel>{{ 'labels.inputs.INCOME CAPITALIZATION' | translate }}</ng-template>
97+
<ng-template matStepLabel>{{ 'labels.inputs.DEFERRED INCOME RECOGNITION' | translate }}</ng-template>
9898

9999
<mifosx-loan-product-capitalized-income-step
100-
[capitalizedIncome]="capitalizedIncome"
100+
[deferredIncomeRecognition]="deferredIncomeRecognition"
101101
[capitalizedIncomeCalculationTypeOptions]="loanProductAndTemplate.capitalizedIncomeCalculationTypeOptions"
102102
[capitalizedIncomeStrategyOptions]="loanProductAndTemplate.capitalizedIncomeStrategyOptions"
103103
[capitalizedIncomeTypeOptions]="loanProductAndTemplate.capitalizedIncomeTypeOptions"
104-
(setCapitalizedIncome)="setCapitalizedIncome($event)"
104+
[buyDownFeeCalculationTypeOptions]="loanProductAndTemplate.buyDownFeeCalculationTypeOptions"
105+
[buyDownFeeStrategyOptions]="loanProductAndTemplate.buyDownFeeStrategyOptions"
106+
[buyDownFeeIncomeTypeOptions]="loanProductAndTemplate.buyDownFeeIncomeTypeOptions"
107+
(setDeferredIncomeRecognition)="setDeferredIncomeRecognition($event)"
105108
(setViewChildForm)="setViewChildForm($event)"
106109
>
107110
</mifosx-loan-product-capitalized-income-step>
@@ -116,7 +119,7 @@
116119
[loanProductsTemplate]="loanProductAndTemplate"
117120
[accountingRuleData]="accountingRuleData"
118121
[loanProductFormValid]="loanProductFormValidAndNotPristine"
119-
[capitalizedIncome]="capitalizedIncome"
122+
[deferredIncomeRecognition]="deferredIncomeRecognition"
120123
>
121124
</mifosx-loan-product-accounting-step>
122125
</mat-step>

0 commit comments

Comments
 (0)