WEB-269: Loan product deferred income stepper (#2593)

merging as it was reviewed from Adam.
This commit is contained in:
Jose Alberto Hernandez
2025-08-19 17:38:25 +05:30
committed by GitHub
parent 54d218325a
commit fdf8047872
7 changed files with 19 additions and 33 deletions
@@ -99,7 +99,7 @@
</mifosx-loan-product-charges-step> </mifosx-loan-product-charges-step>
</mat-step> </mat-step>
<mat-step *ngIf="isAdvancedPaymentStrategy" [stepControl]="loanDeferredIncomeRecognitionForm" completed> <mat-step *ngIf="isAdvancedPaymentStrategy">
<ng-template matStepLabel>{{ 'labels.inputs.DEFERRED INCOME RECOGNITION' | translate }}</ng-template> <ng-template matStepLabel>{{ 'labels.inputs.DEFERRED INCOME RECOGNITION' | translate }}</ng-template>
<mifosx-loan-product-capitalized-income-step <mifosx-loan-product-capitalized-income-step
@@ -113,6 +113,7 @@
(setViewChildForm)="setViewChildForm($event)" (setViewChildForm)="setViewChildForm($event)"
> >
</mifosx-loan-product-capitalized-income-step> </mifosx-loan-product-capitalized-income-step>
<mifosx-stepper-buttons></mifosx-stepper-buttons>
</mat-step> </mat-step>
<mat-step [stepControl]="loanProductAccountingForm"> <mat-step [stepControl]="loanProductAccountingForm">
@@ -84,7 +84,6 @@ export class CreateLoanProductComponent implements OnInit {
advancedCreditAllocations: AdvancedPaymentAllocation[] = []; advancedCreditAllocations: AdvancedPaymentAllocation[] = [];
deferredIncomeRecognition: DeferredIncomeRecognition | null = null; deferredIncomeRecognition: DeferredIncomeRecognition | null = null;
loanDeferredIncomeRecognitionForm: UntypedFormGroup;
/** /**
* @param {ActivatedRoute} route Activated Route. * @param {ActivatedRoute} route Activated Route.
@@ -197,8 +196,7 @@ export class CreateLoanProductComponent implements OnInit {
} }
setViewChildForm(viewChildForm: UntypedFormGroup): void { setViewChildForm(viewChildForm: UntypedFormGroup): void {
this.loanDeferredIncomeRecognitionForm = viewChildForm; const formValues: any = viewChildForm.getRawValue();
const formValues: any = this.loanDeferredIncomeRecognitionForm.getRawValue();
const capitalizedIncome: CapitalizedIncome = formValues.enableIncomeCapitalization const capitalizedIncome: CapitalizedIncome = formValues.enableIncomeCapitalization
? { ? {
enableIncomeCapitalization: true, enableIncomeCapitalization: true,
@@ -230,6 +228,10 @@ export class CreateLoanProductComponent implements OnInit {
return this.loanProductAccountingStep.loanProductAccountingForm; return this.loanProductAccountingStep.loanProductAccountingForm;
} }
get loanDeferredIncomeRecognitionForm() {
return this.loanProductDeferredIncomeRecognitionStep.loanDeferredIncomeRecognitionForm;
}
get loanProductFormValid() { get loanProductFormValid() {
if (this.isAdvancedPaymentStrategy) { if (this.isAdvancedPaymentStrategy) {
return ( return (
@@ -113,6 +113,8 @@
(setViewChildForm)="setViewChildForm($event)" (setViewChildForm)="setViewChildForm($event)"
> >
</mifosx-loan-product-capitalized-income-step> </mifosx-loan-product-capitalized-income-step>
<mifosx-stepper-buttons></mifosx-stepper-buttons>
</mat-step> </mat-step>
<mat-step [stepControl]="loanProductAccountingForm" completed> <mat-step [stepControl]="loanProductAccountingForm" completed>
@@ -75,15 +75,4 @@
{{ 'labels.inputs.Merchant Buy down fee' | translate }} {{ 'labels.inputs.Merchant Buy down fee' | translate }}
</mat-checkbox> </mat-checkbox>
</div> </div>
<div class="layout-row responsive-column align-center gap-2px margin-t">
<button mat-raised-button matStepperPrevious>
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
{{ 'labels.buttons.Previous' | translate }}
</button>
<button mat-raised-button matStepperNext>
{{ 'labels.buttons.Next' | translate }}
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
</button>
</div>
</form> </form>
@@ -1,20 +1,9 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
UntypedFormBuilder, import { DeferredIncomeRecognition } from '../loan-product-payment-strategy-step/payment-allocation-model';
UntypedFormControl,
UntypedFormGroup,
Validators,
ReactiveFormsModule
} from '@angular/forms';
import {
DeferredIncomeRecognition,
CapitalizedIncome,
BuyDownFee
} from '../loan-product-payment-strategy-step/payment-allocation-model';
import { StringEnumOptionData } from 'app/shared/models/option-data.model'; import { StringEnumOptionData } from 'app/shared/models/option-data.model';
import { MatCheckbox } from '@angular/material/checkbox'; import { MatCheckbox } from '@angular/material/checkbox';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
@Component({ @Component({
selector: 'mifosx-loan-product-capitalized-income-step', selector: 'mifosx-loan-product-capitalized-income-step',
@@ -22,8 +11,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
styleUrls: ['./loan-product-deferred-income-recognition-step.component.scss'], styleUrls: ['./loan-product-deferred-income-recognition-step.component.scss'],
imports: [ imports: [
...STANDALONE_SHARED_IMPORTS, ...STANDALONE_SHARED_IMPORTS,
MatCheckbox, MatCheckbox
FaIconComponent
] ]
}) })
export class LoanProductDeferredIncomeRecognitionStepComponent implements OnInit { export class LoanProductDeferredIncomeRecognitionStepComponent implements OnInit {
@@ -1,8 +1,10 @@
<div class="flex-fill layout-row layout-align-center margin-t gap-2percent layout-xs-column"> <div class="flex-fill layout-row layout-align-center margin-t gap-2percent layout-xs-column">
<button matButton="elevated" matStepperPrevious [disabled]="disablePrevious"> <button mat-raised-button matStepperPrevious [disabled]="disablePrevious">
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
{{ 'labels.buttons.Previous' | translate }} {{ 'labels.buttons.Previous' | translate }}
</button> </button>
<button matButton="elevated" matStepperNext [disabled]="disableNext"> <button mat-raised-button matStepperNext [disabled]="disableNext">
{{ 'labels.buttons.Next' | translate }} {{ 'labels.buttons.Next' | translate }}
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
</button> </button>
</div> </div>
@@ -1,5 +1,6 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { MatStepperPrevious, MatStepperNext } from '@angular/material/stepper'; import { MatStepperPrevious, MatStepperNext } from '@angular/material/stepper';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
@Component({ @Component({
@@ -8,6 +9,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
styleUrls: ['./stepper-buttons.component.scss'], styleUrls: ['./stepper-buttons.component.scss'],
imports: [ imports: [
...STANDALONE_SHARED_IMPORTS, ...STANDALONE_SHARED_IMPORTS,
FaIconComponent,
MatStepperPrevious, MatStepperPrevious,
MatStepperNext MatStepperNext
] ]