Add Repayment Info as part of the Loan Account request
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
<div fxLayout="row wrap" fxLayout.lt-md="column">
|
||||
|
||||
<a mat-button (click)="showRepaymentInfo()">
|
||||
Repayment Info
|
||||
</a>
|
||||
|
||||
<mifosx-repayment-schedule-tab fxFlex="100%" [repaymentScheduleDetails]="repaymentScheduleDetails"></mifosx-repayment-schedule-tab>
|
||||
|
||||
</div>
|
||||
|
||||
<div fxLayout="row" class="margin-t" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
|
||||
<button mat-raised-button matStepperPrevious>
|
||||
<fa-icon icon="arrow-left"></fa-icon>
|
||||
Previous
|
||||
</button>
|
||||
<button mat-raised-button matStepperNext>
|
||||
Next
|
||||
<fa-icon icon="arrow-right"></fa-icon>
|
||||
</button>
|
||||
<button mat-raised-button *ngIf="loanId" [routerLink]="['../', 'general']">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoansAccountScheduleStepComponent } from './loans-account-schedule-step.component';
|
||||
|
||||
describe('LoansAccountScheduleStepComponent', () => {
|
||||
let component: LoansAccountScheduleStepComponent;
|
||||
let fixture: ComponentFixture<LoansAccountScheduleStepComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ LoansAccountScheduleStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoansAccountScheduleStepComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loans-account-schedule-step',
|
||||
templateUrl: './loans-account-schedule-step.component.html',
|
||||
styleUrls: ['./loans-account-schedule-step.component.scss']
|
||||
})
|
||||
export class LoansAccountScheduleStepComponent implements OnInit {
|
||||
|
||||
/** Loans Account Template */
|
||||
@Input() loansAccountTemplate: any;
|
||||
/** Loans Account Product Template */
|
||||
@Input() loansAccountProductTemplate: any;
|
||||
/** Loans Account Data */
|
||||
@Input() loansAccount: any;
|
||||
|
||||
showRepayment = false;
|
||||
repaymentScheduleDetails: any = {periods: []};
|
||||
|
||||
loanId: any = null;
|
||||
|
||||
constructor(private loansService: LoansService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute) {
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit(): void { }
|
||||
|
||||
showRepaymentInfo(): void {
|
||||
this.repaymentScheduleDetails = {periods: []};
|
||||
this.showRepayment = !this.showRepayment;
|
||||
if (this.showRepayment) {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const payload = this.loansService.buildLoanRequestPayload(this.loansAccount, this.loansAccountTemplate,
|
||||
this.loansAccountProductTemplate.calendarOptions, locale, dateFormat);
|
||||
|
||||
this.loansService.calculateLoanSchedule(payload).subscribe((response: any) => {
|
||||
this.repaymentScheduleDetails = response;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user