-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FINERACT-2107: Interest refund configuration for Progressive loan
- Loading branch information
1 parent
95c9161
commit 7800d67
Showing
27 changed files
with
241 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...tepper/loan-product-interest-refund-step/loan-product-interest-refund-step.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<form [formGroup]="loanProductInterestRefundForm"> | ||
|
||
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column"> | ||
|
||
<mat-form-field fxFlex="48%"> | ||
<mat-label>{{'labels.inputs.SUPPORTED INTEREST REFUND TYPES' | translate}}</mat-label> | ||
<mat-select multiple formControlName="supportedInterestRefundTypes" matTooltip="{{ 'tooltips.Refund transactions where interest refund will automatically be calculated' | translate}}"> | ||
<mat-option *ngFor="let supportedTransaction of supportedInterestRefundTypesOptions" [value]="supportedTransaction.id"> | ||
{{ supportedTransaction.value }} | ||
</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
</div> | ||
</form> |
3 changes: 3 additions & 0 deletions
3
...tepper/loan-product-interest-refund-step/loan-product-interest-refund-step.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.margin-t { | ||
margin-top: 1em; | ||
} |
25 changes: 25 additions & 0 deletions
25
...per/loan-product-interest-refund-step/loan-product-interest-refund-step.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { LoanProductInterestRefundStepComponent } from './loan-product-interest-refund-step.component'; | ||
|
||
describe('LoanProductInterestRefundStepComponent', () => { | ||
let component: LoanProductInterestRefundStepComponent; | ||
let fixture: ComponentFixture<LoanProductInterestRefundStepComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ LoanProductInterestRefundStepComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LoanProductInterestRefundStepComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
54 changes: 54 additions & 0 deletions
54
...-stepper/loan-product-interest-refund-step/loan-product-interest-refund-step.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import { UntypedFormBuilder, UntypedFormGroup} from '@angular/forms'; | ||
import { StringEnumOptionData } from '../../../../shared/models/option-data.model'; | ||
|
||
@Component({ | ||
selector: 'mifosx-loan-product-interest-refund-step', | ||
templateUrl: './loan-product-interest-refund-step.component.html', | ||
styleUrls: ['./loan-product-interest-refund-step.component.scss'] | ||
}) | ||
export class LoanProductInterestRefundStepComponent implements OnInit { | ||
|
||
@Input() loanProductsTemplate: any; | ||
@Output() supportedInterestRefundTypes = new EventEmitter<StringEnumOptionData[]>(); | ||
|
||
loanProductInterestRefundForm: UntypedFormGroup; | ||
|
||
supportedInterestRefundTypesOptions: StringEnumOptionData[]; | ||
|
||
constructor(private formBuilder: UntypedFormBuilder) { | ||
this.createLoanProductInterestRefundForm(); | ||
this.setConditionalControls(); | ||
} | ||
|
||
ngOnInit() { | ||
this.supportedInterestRefundTypesOptions = this.loanProductsTemplate.supportedInterestRefundTypesOptions; | ||
const values: StringEnumOptionData[] = this.loanProductsTemplate.supportedInterestRefundTypes; | ||
const supportedInterestRefundTypes: string[] = this.mapStringEnumOptionToIdList(values); | ||
this.loanProductInterestRefundForm.patchValue({ | ||
'supportedInterestRefundTypes': supportedInterestRefundTypes | ||
}); | ||
this.supportedInterestRefundTypes.emit(values); | ||
} | ||
|
||
createLoanProductInterestRefundForm() { | ||
this.loanProductInterestRefundForm = this.formBuilder.group({ | ||
'supportedInterestRefundTypes': '' | ||
}); | ||
} | ||
|
||
setConditionalControls() { | ||
this.loanProductInterestRefundForm.get('supportedInterestRefundTypes').valueChanges | ||
.subscribe(value => { | ||
this.supportedInterestRefundTypes.emit(this.mapIdToStringEnumOptionList(value, this.loanProductsTemplate.supportedInterestRefundTypesOptions)); | ||
}); | ||
} | ||
|
||
mapStringEnumOptionToIdList(incomingValues: StringEnumOptionData[]): string[] { | ||
return incomingValues.map(v => v.id); | ||
} | ||
|
||
mapIdToStringEnumOptionList(incomingValues: string[], options: StringEnumOptionData[]): StringEnumOptionData[] { | ||
return options.filter(v => incomingValues.includes(v.id)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.