@@ -42,6 +42,8 @@ export class LoanActionButtonResolver implements Resolve<Object> {
|
|||||||
return this.loansService.rescheduleLoanTemplate();
|
return this.loansService.rescheduleLoanTemplate();
|
||||||
} else if (loanActionButton === 'prepay-loan') {
|
} else if (loanActionButton === 'prepay-loan') {
|
||||||
return this.loansService.getLoanActionTemplate(loanId, 'prepayLoan');
|
return this.loansService.getLoanActionTemplate(loanId, 'prepayLoan');
|
||||||
|
} else if (loanActionButton === 'disburse-to-savings') {
|
||||||
|
return this.loansService.getLoanActionTemplate(loanId, 'disburseToSavings');
|
||||||
} else if (loanActionButton === 'recovery-payment') {
|
} else if (loanActionButton === 'recovery-payment') {
|
||||||
return this.loansService.getLoanActionTemplate(loanId, 'recoverypayment');
|
return this.loansService.getLoanActionTemplate(loanId, 'recoverypayment');
|
||||||
} else if (loanActionButton === 'view-guarantors') {
|
} else if (loanActionButton === 'view-guarantors') {
|
||||||
|
|||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<form [formGroup]="disbursementForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Disbursement On</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="disbursementDatePicker" required formControlName="actualDisbursementDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="disbursementDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #disbursementDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="disbursementForm.controls.actualDisbursementDate.hasError('required')">
|
||||||
|
Disbursement Date is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Transaction amount</mat-label>
|
||||||
|
<input matInput required formControlName="transactionAmount">
|
||||||
|
<mat-error *ngIf="disbursementForm.controls.transactionAmount.hasError('required')">
|
||||||
|
Transaction Amount is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field *ngIf="dataObject.fixedEmiAmount !== null || dataObject.fixedEmiAmount !== undefined">
|
||||||
|
<mat-label>Fixed EMI amount</mat-label>
|
||||||
|
<input matInput required formControlName="fixedEmiAmount">
|
||||||
|
<mat-error *ngIf="disbursementForm.controls.fixedEmiAmount.hasError('required')">
|
||||||
|
Fixed EMI Amount is <strong>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]="['../']">Cancel</button>
|
||||||
|
<button mat-raised-button color="primary" [disabled]="!disbursementForm.valid" *mifosxHasPermission="'DISBURSETOSAVINGS_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 { DisburseLoanAccountComponent } from './disburse-loan-account.component';
|
||||||
|
|
||||||
|
describe('DisburseLoanAccountComponent', () => {
|
||||||
|
let component: DisburseLoanAccountComponent;
|
||||||
|
let fixture: ComponentFixture<DisburseLoanAccountComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ DisburseLoanAccountComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DisburseLoanAccountComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
/** Angular Imports. */
|
||||||
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
|
/** Custom Service. */
|
||||||
|
import { LoansService } from 'app/loans/loans.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disburse To Savings component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-disburse-loan-account',
|
||||||
|
templateUrl: './disburse-loan-account.component.html',
|
||||||
|
styleUrls: ['./disburse-loan-account.component.scss']
|
||||||
|
})
|
||||||
|
export class DisburseLoanAccountComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() dataObject: any;
|
||||||
|
|
||||||
|
/** Minimum Date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum Date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Disbursement Loan form. */
|
||||||
|
disbursementForm: FormGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data from `Resolver`.
|
||||||
|
* @param {FormBuilder} formBuilder FormBuilder.
|
||||||
|
* @param {ActivatedRoute} route ActivatedRoute.
|
||||||
|
* @param {Router} router Router.
|
||||||
|
* @param {DatePipe} datePipe DatePipe.
|
||||||
|
* @param {LoansService} loanService Loan Service.
|
||||||
|
*/
|
||||||
|
constructor(private formBuilder: FormBuilder,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private datePipe: DatePipe,
|
||||||
|
private loanService: LoansService) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.setDisbursementToSavingsForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Disbursement Loan form.
|
||||||
|
*/
|
||||||
|
setDisbursementToSavingsForm() {
|
||||||
|
this.disbursementForm = this.formBuilder.group({
|
||||||
|
'actualDisbursementDate': [new Date(), Validators.required],
|
||||||
|
'transactionAmount': [this.dataObject.amount, Validators.required],
|
||||||
|
'note': ['', Validators.required]
|
||||||
|
});
|
||||||
|
if (this.dataObject.fixedEmiAmount !== null || this.dataObject.fixedEmiAmount !== undefined) {
|
||||||
|
this.disbursementForm.addControl('fixedEmiAmount', new FormControl(this.dataObject.fixedEmiAmount, [Validators.required]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit Disburse Form.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
const actualDisbursementDate = this.disbursementForm.value.actualDisbursementDate;
|
||||||
|
const dateFormat = 'dd MMMM yyyy';
|
||||||
|
this.disbursementForm.patchValue({
|
||||||
|
actualDisbursementDate: this.datePipe.transform(actualDisbursementDate, dateFormat)
|
||||||
|
});
|
||||||
|
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||||
|
const disbursementForm = this.disbursementForm.value;
|
||||||
|
disbursementForm.locale = 'en';
|
||||||
|
disbursementForm.dateFormat = dateFormat;
|
||||||
|
this.loanService.loanActionButtons(loanId, 'disbursetosavings', disbursementForm).subscribe((response: any) => {
|
||||||
|
this.router.navigate(['../general'], {relativeTo: this.route});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,5 +13,6 @@
|
|||||||
<mifosx-recovery-repayment [dataObject]="actionButtonData" *ngIf="actions.recovery_payment"></mifosx-recovery-repayment>
|
<mifosx-recovery-repayment [dataObject]="actionButtonData" *ngIf="actions.recovery_payment"></mifosx-recovery-repayment>
|
||||||
<mifosx-view-guarantors [dataObject]="actionButtonData" *ngIf="actions.view_guarantors"></mifosx-view-guarantors>
|
<mifosx-view-guarantors [dataObject]="actionButtonData" *ngIf="actions.view_guarantors"></mifosx-view-guarantors>
|
||||||
<mifosx-create-guarantor [dataObject]="actionButtonData" *ngIf="actions.create_guarantor"></mifosx-create-guarantor>
|
<mifosx-create-guarantor [dataObject]="actionButtonData" *ngIf="actions.create_guarantor"></mifosx-create-guarantor>
|
||||||
|
<mifosx-disburse-loan-account [dataObject]="actionButtonData" *ngIf="actions.disburse_to_savings"></mifosx-disburse-loan-account>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export class LoanAccountActionsComponent {
|
|||||||
assign_loan_officer: boolean,
|
assign_loan_officer: boolean,
|
||||||
foreclosure: boolean,
|
foreclosure: boolean,
|
||||||
prepay_loan: boolean,
|
prepay_loan: boolean,
|
||||||
|
disburse_to_savings: boolean,
|
||||||
make_repayment: boolean,
|
make_repayment: boolean,
|
||||||
waive_interest: boolean,
|
waive_interest: boolean,
|
||||||
close_as_rescheduled: boolean,
|
close_as_rescheduled: boolean,
|
||||||
@@ -32,6 +33,7 @@ export class LoanAccountActionsComponent {
|
|||||||
assign_loan_officer: false,
|
assign_loan_officer: false,
|
||||||
foreclosure: false,
|
foreclosure: false,
|
||||||
prepay_loan: false,
|
prepay_loan: false,
|
||||||
|
disburse_to_savings: false,
|
||||||
make_repayment: false,
|
make_repayment: false,
|
||||||
waive_interest: false,
|
waive_interest: false,
|
||||||
close_as_rescheduled: false,
|
close_as_rescheduled: false,
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import { CreateGuarantorComponent } from './loans-view/loan-account-actions/crea
|
|||||||
import { LoansAccountViewGuarantorDetailsDialogComponent } from './custom-dialog/loans-account-view-guarantor-details-dialog/loans-account-view-guarantor-details-dialog.component';
|
import { LoansAccountViewGuarantorDetailsDialogComponent } from './custom-dialog/loans-account-view-guarantor-details-dialog/loans-account-view-guarantor-details-dialog.component';
|
||||||
import { LoansAccountAddCollateralDialogComponent } from './custom-dialog/loans-account-add-collateral-dialog/loans-account-add-collateral-dialog.component';
|
import { LoansAccountAddCollateralDialogComponent } from './custom-dialog/loans-account-add-collateral-dialog/loans-account-add-collateral-dialog.component';
|
||||||
import { LoansConfirmationDialogBoxComponent } from './custom-dialog/loans-confirmation-dialog-box/loans-confirmation-dialog-box.component';
|
import { LoansConfirmationDialogBoxComponent } from './custom-dialog/loans-confirmation-dialog-box/loans-confirmation-dialog-box.component';
|
||||||
|
import { DisburseLoanAccountComponent } from './loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loans Module
|
* Loans Module
|
||||||
@@ -96,6 +97,7 @@ import { LoansConfirmationDialogBoxComponent } from './custom-dialog/loans-confi
|
|||||||
CreateGuarantorComponent,
|
CreateGuarantorComponent,
|
||||||
LoansAccountViewGuarantorDetailsDialogComponent,
|
LoansAccountViewGuarantorDetailsDialogComponent,
|
||||||
LoansConfirmationDialogBoxComponent,
|
LoansConfirmationDialogBoxComponent,
|
||||||
|
DisburseLoanAccountComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
LoansAccountAddCollateralDialogComponent,
|
LoansAccountAddCollateralDialogComponent,
|
||||||
|
|||||||
Reference in New Issue
Block a user