@@ -34,6 +34,10 @@ export class LoanActionButtonResolver implements Resolve<Object> {
|
||||
return this.loansService.getLoanActionTemplate(loanId, 'waiveinterest');
|
||||
} else if (loanActionButton === 'write-off') {
|
||||
return this.loansService.getLoanActionTemplate(loanId, 'writeoff');
|
||||
} else if (loanActionButton === 'close') {
|
||||
return this.loansService.getLoanActionTemplate(loanId, 'close');
|
||||
} else if (loanActionButton === 'close-as-rescheduled') {
|
||||
return this.loansService.getLoanActionTemplate(loanId, 'close-rescheduled');
|
||||
} else {
|
||||
return this.loansService.getLoanActionTemplate(loanId, 'prepayLoan');
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<div class="container">
|
||||
|
||||
<form [formGroup]="closeLoanForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Closed On</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="closedDatePicker" required formControlName="transactionDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="closedDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #closedDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="closeLoanForm.controls.transactionDate.hasError('required')">
|
||||
Closed Date <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Note</mat-label>
|
||||
<textarea matInput formControlName="note"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||
<button type="button" mat-raised-button [routerLink]="['../general']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!closeLoanForm.valid" *mifosxHasPermission="'CLOSEASRESCHEDULED_LOAN'">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CloseAsRescheduledComponent } from './close-as-rescheduled.component';
|
||||
|
||||
describe('CloseAsRescheduledComponent', () => {
|
||||
let component: CloseAsRescheduledComponent;
|
||||
let fixture: ComponentFixture<CloseAsRescheduledComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CloseAsRescheduledComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CloseAsRescheduledComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-close-as-rescheduled',
|
||||
templateUrl: './close-as-rescheduled.component.html',
|
||||
styleUrls: ['./close-as-rescheduled.component.scss']
|
||||
})
|
||||
export class CloseAsRescheduledComponent implements OnInit {
|
||||
|
||||
@Input() dataObject: any;
|
||||
|
||||
/** Close form. */
|
||||
closeLoanForm: FormGroup;
|
||||
/** Loan Id */
|
||||
loanId: any;
|
||||
/** Minimum Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Date allowed. */
|
||||
maxDate = new Date();
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {LoansService} systemService Loan Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private loanService: LoansService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the close form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createCloseForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the create close form.
|
||||
*/
|
||||
createCloseForm() {
|
||||
this.closeLoanForm = this.formBuilder.group({
|
||||
'transactionDate': [new Date(this.dataObject.date) || new Date(), Validators.required],
|
||||
'note': []
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the close form and creates a close,
|
||||
* if successful redirects to view created close.
|
||||
*/
|
||||
submit() {
|
||||
const transactionDate = this.closeLoanForm.value.transactionDate;
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
this.closeLoanForm.patchValue({
|
||||
transactionDate: this.datePipe.transform(transactionDate, dateFormat)
|
||||
});
|
||||
const closeForm = this.closeLoanForm.value;
|
||||
closeForm.locale = 'en';
|
||||
closeForm.dateFormat = dateFormat;
|
||||
this.loanService.submitLoanActionButton(this.loanId, closeForm, 'close-rescheduled')
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../general'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="container">
|
||||
<mat-card>
|
||||
<mifosx-loans-account-close *ngIf="actions.close"></mifosx-loans-account-close>
|
||||
<mifosx-loans-account-close [dataObject]="actionButtonData" *ngIf="actions.close"></mifosx-loans-account-close>
|
||||
<mifosx-undo-approval *ngIf="actions.undo_approval"></mifosx-undo-approval>
|
||||
<mifosx-assign-loan-officer *ngIf="actions.assign_loan_officer" [dataObject]="actionButtonData" ></mifosx-assign-loan-officer>
|
||||
<mifosx-foreclosure *ngIf="actions.foreclosure"></mifosx-foreclosure>
|
||||
@@ -8,5 +8,6 @@
|
||||
<mifosx-make-repayment [dataObject]="actionButtonData" *ngIf="actions.make_repayment"></mifosx-make-repayment>
|
||||
<mifosx-waive-interest [dataObject]="actionButtonData" *ngIf="actions.waive_interest"></mifosx-waive-interest>
|
||||
<mifosx-write-off-page [dataObject]="actionButtonData" *ngIf="actions.write_off"></mifosx-write-off-page>
|
||||
<mifosx-close-as-rescheduled [dataObject]="actionButtonData" *ngIf="actions.close_as_rescheduled"></mifosx-close-as-rescheduled>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,8 @@ export class LoanAccountActionsComponent {
|
||||
foreclosure: boolean,
|
||||
prepay_loan: boolean,
|
||||
make_repayment: boolean,
|
||||
waive_interest: boolean } = {
|
||||
waive_interest: boolean,
|
||||
close_as_rescheduled: boolean } = {
|
||||
close: false,
|
||||
undo_approval: false,
|
||||
write_off: false,
|
||||
@@ -28,7 +29,8 @@ export class LoanAccountActionsComponent {
|
||||
foreclosure: false,
|
||||
prepay_loan: false,
|
||||
make_repayment: false,
|
||||
waive_interest: false };
|
||||
waive_interest: false,
|
||||
close_as_rescheduled: false };
|
||||
actionButtonData: any;
|
||||
actionName: any;
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||
<button type="button" mat-raised-button [routerLink]="['../general']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!closeLoanForm.valid">Submit</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!closeLoanForm.valid" *mifosxHasPermission="'CLOSE_LOAN'">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
@@ -12,6 +12,8 @@ import { DatePipe } from '@angular/common';
|
||||
})
|
||||
export class LoansAccountCloseComponent implements OnInit {
|
||||
|
||||
@Input() dataObject: any;
|
||||
|
||||
/** Close form. */
|
||||
closeLoanForm: FormGroup;
|
||||
/** Loan Id */
|
||||
@@ -47,7 +49,7 @@ export class LoansAccountCloseComponent implements OnInit {
|
||||
*/
|
||||
createCloseForm() {
|
||||
this.closeLoanForm = this.formBuilder.group({
|
||||
'transactionDate': [new Date(), Validators.required],
|
||||
'transactionDate': [new Date(this.dataObject.date) || new Date(), Validators.required],
|
||||
'note': []
|
||||
});
|
||||
}
|
||||
|
||||
@@ -112,6 +112,8 @@ export class LoansViewComponent implements OnInit {
|
||||
|
||||
loanAction(button: string) {
|
||||
button = button.replace(/\s/g, '-').toLowerCase();
|
||||
button = button.replace(/\(/g, '');
|
||||
button = button.replace(/\)/g, '');
|
||||
this.router.navigate([button], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import { WaiveInterestComponent } from './loans-view/loan-account-actions/waive-
|
||||
import { FloatingInterestRatesComponent } from './loans-view/floating-interest-rates/floating-interest-rates.component';
|
||||
import { WriteOffPageComponent } from './loans-view/loan-account-actions/write-off-page/write-off-page.component';
|
||||
import { LoanTrancheDetailsComponent } from './loans-view/loan-tranche-details/loan-tranche-details.component';
|
||||
import { CloseAsRescheduledComponent } from './loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component';
|
||||
|
||||
/**
|
||||
* Loans Module
|
||||
@@ -66,6 +67,7 @@ import { LoanTrancheDetailsComponent } from './loans-view/loan-tranche-details/l
|
||||
FloatingInterestRatesComponent,
|
||||
WriteOffPageComponent,
|
||||
LoanTrancheDetailsComponent,
|
||||
CloseAsRescheduledComponent,
|
||||
],
|
||||
providers: [DatePipe],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user