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 @@ -101,6 +101,28 @@ <h3>{{ 'labels.heading.Loan Details' | translate }}</h3>
<span class="flex-50"> {{ loanDetails.capitalizedIncomeType?.value | translateKey: 'catalogs' }} </span>
</div>

<div class="flex-fill layout-row">
<span class="flex-50"> {{ 'labels.inputs.Enable Buy down fee' | translate }}</span>
<span class="flex-50"> {{ loanDetails.enableBuyDownFee | yesNo }} </span>
</div>

<div class="flex-fill layout-row" *ngIf="loanDetails.enableBuyDownFee">
<span class="flex-50"> {{ 'labels.inputs.Buy down fee calculation type' | translate }}</span>
<span class="flex-50">
{{ loanDetails.buyDownFeeCalculationType?.value | translateKey: 'catalogs' }}
</span>
</div>

<div class="flex-fill layout-row" *ngIf="loanDetails.enableBuyDownFee">
<span class="flex-50"> {{ 'labels.inputs.Buy down fee strategy' | translate }}</span>
<span class="flex-50"> {{ loanDetails.buyDownFeeStrategy?.value | translateKey: 'catalogs' }} </span>
</div>

<div class="flex-fill layout-row" *ngIf="loanDetails.enableBuyDownFee">
<span class="flex-50"> {{ 'labels.inputs.Buy down fee income type' | translate }}</span>
<span class="flex-50"> {{ loanDetails.buyDownFeeIncomeType?.value | translateKey: 'catalogs' }} </span>
</div>

<div class="flex-fill layout-row">
<span class="flex-50"> {{ 'labels.inputs.Grace: On Principal Payment' | translate }}</span>
<span class="flex-50"> {{ loanDetails.graceOnPrincipalPayment }} </span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,31 @@ <h3 class="mat-h3 flex-100">{{ 'labels.inputs.Income capitalization' | translate
<span class="flex-47">{{ 'labels.inputs.Income type' | translate }}:</span>
<span class="flex-53">{{ loanProduct.capitalizedIncomeType?.value | translateKey: 'catalogs' }}</span>
</div>
</div>

<div class="flex-100 layout-row-wrap responsive-column" *ngIf="isAdvancedPaymentAllocation">
<h3 class="mat-h3 flex-100">{{ 'labels.inputs.Buy down fees' | translate }}</h3>

<mat-divider [inset]="true"></mat-divider>

<div class="flex-100 layout-row">
<span class="flex-47">{{ 'labels.inputs.Enable Buy down fee' | translate }}:</span>
<span class="flex-53">{{ loanProduct.enableBuyDownFee | yesNo }}</span>
</div>

<div class="flex-100 layout-row" *ngIf="loanProduct.enableBuyDownFee">
<span class="flex-47">{{ 'labels.inputs.Buy down fee calculation type' | translate }}:</span>
<span class="flex-53">{{ loanProduct.buyDownFeeCalculationType?.value | translateKey: 'catalogs' }}</span>
</div>

<div class="flex-100 layout-row" *ngIf="loanProduct.enableBuyDownFee">
<span class="flex-47">{{ 'labels.inputs.Buy down fee strategy' | translate }}:</span>
<span class="flex-53">{{ loanProduct.buyDownFeeStrategy?.value | translateKey: 'catalogs' }}</span>
</div>

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,23 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
);
this.loanProduct.capitalizedIncomeType = optionValue;
}
if (this.isAdvancedPaymentAllocation && this.loanProduct.enableBuyDownFee) {
optionValue = this.optionDataLookUp(
this.loanProduct.buyDownFeeCalculationType,
this.loanProductsTemplate.buyDownFeeCalculationTypeOptions
);
this.loanProduct.buyDownFeeCalculationType = optionValue;
optionValue = this.optionDataLookUp(
this.loanProduct.buyDownFeeStrategy,
this.loanProductsTemplate.buyDownFeeStrategyOptions
);
this.loanProduct.buyDownFeeStrategy = optionValue;
optionValue = this.optionDataLookUp(
this.loanProduct.buyDownFeeIncomeType,
this.loanProductsTemplate.buyDownFeeIncomeTypeOptions
);
this.loanProduct.buyDownFeeIncomeType = optionValue;
}
optionValue = this.optionDataLookUp(
this.loanProduct.interestRateFrequencyType,
this.loanProductsTemplate.interestRateFrequencyTypeOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
(supportedInterestRefundTypes)="setSupportedInterestRefundTypes($event)"
>
</mifosx-loan-product-interest-refund-step>

<mifosx-stepper-buttons></mifosx-stepper-buttons>
</mat-step>

<mat-step *ngIf="isAdvancedPaymentStrategy">
Expand Down Expand Up @@ -91,15 +93,18 @@
</mifosx-loan-product-charges-step>
</mat-step>

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

<mifosx-loan-product-capitalized-income-step
[capitalizedIncome]="capitalizedIncome"
[deferredIncomeRecognition]="deferredIncomeRecognition"
[capitalizedIncomeCalculationTypeOptions]="loanProductsTemplate.capitalizedIncomeCalculationTypeOptions"
[capitalizedIncomeStrategyOptions]="loanProductsTemplate.capitalizedIncomeStrategyOptions"
[capitalizedIncomeTypeOptions]="loanProductsTemplate.capitalizedIncomeTypeOptions"
(setCapitalizedIncome)="setCapitalizedIncome($event)"
[buyDownFeeCalculationTypeOptions]="loanProductsTemplate.buyDownFeeCalculationTypeOptions"
[buyDownFeeStrategyOptions]="loanProductsTemplate.buyDownFeeStrategyOptions"
[buyDownFeeIncomeTypeOptions]="loanProductsTemplate.buyDownFeeIncomeTypeOptions"
(setDeferredIncomeRecognition)="setDeferredIncomeRecognition($event)"
(setViewChildForm)="setViewChildForm($event)"
>
</mifosx-loan-product-capitalized-income-step>
Expand All @@ -114,7 +119,7 @@
[loanProductsTemplate]="loanProductsTemplate"
[accountingRuleData]="accountingRuleData"
[loanProductFormValid]="loanProductFormValid"
[capitalizedIncome]="capitalizedIncome"
[deferredIncomeRecognition]="deferredIncomeRecognition"
>
</mifosx-loan-product-accounting-step>
</mat-step>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import { LoanProducts } from '../loan-products';
import {
AdvancedPaymentAllocation,
AdvancedPaymentStrategy,
CapitalizedIncome,
DeferredIncomeRecognition,
PaymentAllocation
} from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
import { Accounting } from 'app/core/utils/accounting';
import { StringEnumOptionData } from '../../../shared/models/option-data.model';
import { LoanProductCapitalizedIncomeStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-capitalized-income-step.component';
import { LoanProductDeferredIncomeRecognitionStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-deferred-income-recognition-step.component';
import { UntypedFormGroup } from '@angular/forms';
import { MatStepper, MatStepperIcon, MatStep, MatStepLabel } from '@angular/material/stepper';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
Expand Down Expand Up @@ -50,7 +50,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
StepperButtonsComponent,
LoanProductTermsStepComponent,
LoanProductChargesStepComponent,
LoanProductCapitalizedIncomeStepComponent,
LoanProductDeferredIncomeRecognitionStepComponent,
LoanProductAccountingStepComponent,
LoanProductPreviewStepComponent
]
Expand All @@ -61,8 +61,8 @@ export class CreateLoanProductComponent implements OnInit {
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
@ViewChild(LoanProductCapitalizedIncomeStepComponent, { static: true })
loanProductCapitalizedIncomeStep: LoanProductCapitalizedIncomeStepComponent;
@ViewChild(LoanProductDeferredIncomeRecognitionStepComponent, { static: true })
loanProductDeferredIncomeRecognitionStep: LoanProductDeferredIncomeRecognitionStepComponent;
@ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent;
@ViewChild(LoanProductSettingsStepComponent, { static: true })
loanProductSettingsStep: LoanProductSettingsStepComponent;
Expand All @@ -81,8 +81,8 @@ export class CreateLoanProductComponent implements OnInit {
advancedPaymentAllocations: AdvancedPaymentAllocation[] = [];
advancedCreditAllocations: AdvancedPaymentAllocation[] = [];

capitalizedIncome: CapitalizedIncome | null = null;
loanIncomeCapitalizationForm: UntypedFormGroup;
deferredIncomeRecognition: DeferredIncomeRecognition | null = null;
loanDeferredIncomeRecognitionForm: UntypedFormGroup;

/**
* @param {ActivatedRoute} route Activated Route.
Expand Down Expand Up @@ -139,18 +139,33 @@ export class CreateLoanProductComponent implements OnInit {
advancePaymentStrategy(value: string) {
this.isAdvancedPaymentStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(value);
if (this.isAdvancedPaymentStrategy) {
if (this.deferredIncomeRecognition == null) {
this.deferredIncomeRecognition = {};
}
if (this.loanProductsTemplate.enableIncomeCapitalization) {
this.capitalizedIncome = {
this.deferredIncomeRecognition.capitalizedIncome = {
enableIncomeCapitalization: true,
capitalizedIncomeCalculationType: this.loanProductsTemplate.capitalizedIncomeCalculationTypeOptions[0],
capitalizedIncomeStrategy: this.loanProductsTemplate.capitalizedIncomeStrategyOptions[0],
capitalizedIncomeType: this.loanProductsTemplate.capitalizedIncomeTypeOptions[0]
};
} else {
this.capitalizedIncome = {
this.deferredIncomeRecognition.capitalizedIncome = {
enableIncomeCapitalization: false
};
}
if (this.loanProductsTemplate.enableBuyDownFee) {
this.deferredIncomeRecognition.buyDownFee = {
enableBuyDownFee: true,
buyDownFeeCalculationType: this.loanProductsTemplate.buyDownFeeCalculationTypeOptions[0],
buyDownFeeStrategy: this.loanProductsTemplate.buyDownFeeStrategyOptions[0],
buyDownFeeIncomeType: this.loanProductsTemplate.buyDownFeeIncomeTypeOptions[0]
};
} else {
this.deferredIncomeRecognition.buyDownFee = {
enableBuyDownFee: false
};
}
}
}

Expand All @@ -172,14 +187,14 @@ export class CreateLoanProductComponent implements OnInit {
this.supportedInterestRefundTypes = supportedInterestRefundTypes;
}

setCapitalizedIncome(capitalizedIncome: CapitalizedIncome): void {
setDeferredIncomeRecognition(deferredIncomeRecognition: DeferredIncomeRecognition): void {
if (this.isAdvancedPaymentStrategy) {
this.capitalizedIncome = capitalizedIncome;
this.deferredIncomeRecognition = deferredIncomeRecognition;
}
}

setViewChildForm(viewChildForm: UntypedFormGroup): void {
this.loanIncomeCapitalizationForm = viewChildForm;
this.loanDeferredIncomeRecognitionForm = viewChildForm;
}

get loanProductSettingsForm() {
Expand All @@ -197,7 +212,7 @@ export class CreateLoanProductComponent implements OnInit {
this.loanProductCurrencyForm.valid &&
this.loanProductTermsForm.valid &&
this.loanProductSettingsForm.valid &&
this.loanIncomeCapitalizationForm.valid &&
this.loanDeferredIncomeRecognitionForm.valid &&
this.loanProductAccountingForm.valid
);
} else {
Expand All @@ -224,12 +239,24 @@ export class CreateLoanProductComponent implements OnInit {
loanProduct['paymentAllocation'] = this.paymentAllocation;
loanProduct['creditAllocation'] = this.creditAllocation;
loanProduct['supportedInterestRefundTypes'] = this.supportedInterestRefundTypes;
if (this.capitalizedIncome != null) {
loanProduct['enableIncomeCapitalization'] = this.capitalizedIncome.enableIncomeCapitalization;
if (this.capitalizedIncome.enableIncomeCapitalization) {
loanProduct['capitalizedIncomeCalculationType'] = this.capitalizedIncome.capitalizedIncomeCalculationType;
loanProduct['capitalizedIncomeStrategy'] = this.capitalizedIncome.capitalizedIncomeStrategy;
loanProduct['capitalizedIncomeType'] = this.capitalizedIncome.capitalizedIncomeType;
if (this.deferredIncomeRecognition.capitalizedIncome != null) {
loanProduct['enableIncomeCapitalization'] =
this.deferredIncomeRecognition.capitalizedIncome.enableIncomeCapitalization;
if (this.deferredIncomeRecognition.capitalizedIncome.enableIncomeCapitalization) {
loanProduct['capitalizedIncomeCalculationType'] =
this.deferredIncomeRecognition.capitalizedIncome.capitalizedIncomeCalculationType;
loanProduct['capitalizedIncomeStrategy'] =
this.deferredIncomeRecognition.capitalizedIncome.capitalizedIncomeStrategy;
loanProduct['capitalizedIncomeType'] = this.deferredIncomeRecognition.capitalizedIncome.capitalizedIncomeType;
}
}
if (this.deferredIncomeRecognition.buyDownFee != null) {
loanProduct['enableBuyDownFee'] = this.deferredIncomeRecognition.buyDownFee.enableBuyDownFee;
if (this.deferredIncomeRecognition.buyDownFee.enableBuyDownFee) {
loanProduct['buyDownFeeCalculationType'] =
this.deferredIncomeRecognition.buyDownFee.buyDownFeeCalculationType;
loanProduct['buyDownFeeStrategy'] = this.deferredIncomeRecognition.buyDownFee.buyDownFeeStrategy;
loanProduct['buyDownFeeIncomeType'] = this.deferredIncomeRecognition.buyDownFee.buyDownFeeIncomeType;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@
</mat-step>

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

<mifosx-loan-product-capitalized-income-step
[capitalizedIncome]="capitalizedIncome"
[deferredIncomeRecognition]="deferredIncomeRecognition"
[capitalizedIncomeCalculationTypeOptions]="loanProductAndTemplate.capitalizedIncomeCalculationTypeOptions"
[capitalizedIncomeStrategyOptions]="loanProductAndTemplate.capitalizedIncomeStrategyOptions"
[capitalizedIncomeTypeOptions]="loanProductAndTemplate.capitalizedIncomeTypeOptions"
(setCapitalizedIncome)="setCapitalizedIncome($event)"
[buyDownFeeCalculationTypeOptions]="loanProductAndTemplate.buyDownFeeCalculationTypeOptions"
[buyDownFeeStrategyOptions]="loanProductAndTemplate.buyDownFeeStrategyOptions"
[buyDownFeeIncomeTypeOptions]="loanProductAndTemplate.buyDownFeeIncomeTypeOptions"
(setDeferredIncomeRecognition)="setDeferredIncomeRecognition($event)"
(setViewChildForm)="setViewChildForm($event)"
>
</mifosx-loan-product-capitalized-income-step>
Expand All @@ -116,7 +119,7 @@
[loanProductsTemplate]="loanProductAndTemplate"
[accountingRuleData]="accountingRuleData"
[loanProductFormValid]="loanProductFormValidAndNotPristine"
[capitalizedIncome]="capitalizedIncome"
[deferredIncomeRecognition]="deferredIncomeRecognition"
>
</mifosx-loan-product-accounting-step>
</mat-step>
Expand Down
Loading