Allow Loan re-amortize transaction

This commit is contained in:
Jose Alberto Hernandez
2024-03-06 12:46:04 +01:00
committed by Adam Saghy
parent a4fbde1edc
commit f52efaef44
23 changed files with 180 additions and 19 deletions
@@ -28,4 +28,5 @@
<mifosx-charge-off [dataObject]="actionButtonData" *ngIf="actions['Charge-Off']"></mifosx-charge-off>
<mifosx-undo-command [actionName]="actionName" *ngIf="actions['Undo Charge-Off']"></mifosx-undo-command>
<mifosx-asset-transfer-loan *ngIf="actions['Sell Loan'] || actions['Buy Back Loan']"></mifosx-asset-transfer-loan>
<mifosx-loan-reaging [dataObject]="actionButtonData" *ngIf="actions['Re-Age']"></mifosx-loan-reaging>
<mifosx-loan-reaging [dataObject]="actionButtonData" *ngIf="actions['Re-Age']"></mifosx-loan-reaging>
<mifosx-loan-reamortize [dataObject]="actionButtonData" *ngIf="actions['Re-Amortize']"></mifosx-loan-reamortize>
@@ -0,0 +1,26 @@
<div class="container mat-elevation-z8">
<mat-card>
<form [formGroup]="reamortizeLoanForm" (ngSubmit)="submit()">
<mat-card-content>
<div fxLayout="column">
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
<input matInput formControlName="externalId">
</mat-form-field>
</div>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">{{"labels.buttons.Cancel" |
translate}}</button>
<button mat-raised-button color="primary" [disabled]="!reamortizeLoanForm.valid"
*mifosxHasPermission="'REAMORTIZE_LOAN'">{{"labels.buttons.Submit" | translate}}</button>
</mat-card-actions>
</mat-card-content>
</form>
</mat-card>
</div>
@@ -0,0 +1,3 @@
.container {
max-width: 37rem;
}
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoanReamortizeComponent } from './loan-reamortize.component';
describe('LoanReamortizeComponent', () => {
let component: LoanReamortizeComponent;
let fixture: ComponentFixture<LoanReamortizeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoanReamortizeComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(LoanReamortizeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,45 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
@Component({
selector: 'mifosx-loan-reamortize',
templateUrl: './loan-reamortize.component.html',
styleUrls: ['./loan-reamortize.component.scss']
})
export class LoanReamortizeComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
/** ReAmortize Loan Form */
reamortizeLoanForm: UntypedFormGroup;
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private loanService: LoansService) {
this.loanId = this.route.snapshot.params['loanId'];
}
ngOnInit(): void {
this.createReAmortizeLoanForm();
}
createReAmortizeLoanForm() {
this.reamortizeLoanForm = this.formBuilder.group({
'externalId': ''
});
}
submit(): void {
const data = this.reamortizeLoanForm.value;
this.loanService.submitLoanActionButton(this.loanId, data, 'reAmortize')
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}