+17
@@ -0,0 +1,17 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<mat-form-field fxLayoutAlign="center">
|
||||
<mat-label>Note</mat-label>
|
||||
<textarea matInput [formControl]="note"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
<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" (click)="submit()" *mifosxHasPermission="'DISBURSALUNDO_LOAN'">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</div>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UndoDisbursalComponent } from './undo-disbursal.component';
|
||||
|
||||
describe('UndoDisbursalComponent', () => {
|
||||
let component: UndoDisbursalComponent;
|
||||
let fixture: ComponentFixture<UndoDisbursalComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UndoDisbursalComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UndoDisbursalComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormBuilder } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { LoansService } from '../../../loans.service';
|
||||
|
||||
/**
|
||||
* Undo Disbursal component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-undo-disbursal',
|
||||
templateUrl: './undo-disbursal.component.html',
|
||||
styleUrls: ['./undo-disbursal.component.scss']
|
||||
})
|
||||
export class UndoDisbursalComponent implements OnInit {
|
||||
|
||||
/** Loan ID. */
|
||||
loanId: any;
|
||||
/** Undo disbursal form. */
|
||||
note: FormControl;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {LoansService} loansService Loans Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private loansService: LoansService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the undo disbursal form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.note = this.formBuilder.control('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the undo disbursal form.
|
||||
*/
|
||||
submit() {
|
||||
this.loansService.loanActionButtons(this.loanId, 'undoDisbursal', {'note': this.note.value}).subscribe((response: any) => {
|
||||
this.router.navigate(['../general'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user