feat: add loan action (guarantors) (#1059)
- add view guarantor - add create guarantor - add view guarantor details - add delete guarantor - add recover from guarantor - add delete loan action Fixes: #832, #246
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
<h1 mat-dialog-title>Add Loan Collateral</h1>
|
||||
|
||||
<div mat-dialog-content [formGroup]="addCollateralForm" fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Collateral Type</mat-label>
|
||||
<mat-select formControlName="type" required>
|
||||
<mat-option *ngFor="let collateralType of collateralTypeData" [value]="collateralType.id">
|
||||
{{ collateralType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error>
|
||||
Collateral Type is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Value</mat-label>
|
||||
<input type="number" matInput formControlName="value" required>
|
||||
<mat-error>
|
||||
Value is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Description</mat-label>
|
||||
<input type="text" matInput formControlName="description" required>
|
||||
<mat-error>
|
||||
Description is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
<mat-dialog-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
|
||||
<button mat-raised-button mat-dialog-close> Cancel </button>
|
||||
<button mat-raised-button color="primary" [mat-dialog-close]="{ data: addCollateralForm }"
|
||||
[disabled]="!addCollateralForm.valid || addCollateralForm.pristine">{{ layout.addButtonText }}</button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoansAccountAddCollateralDialogComponent } from './loans-account-add-collateral-dialog.component';
|
||||
|
||||
describe('LoansAccountAddCollateralDialogComponent', () => {
|
||||
let component: LoansAccountAddCollateralDialogComponent;
|
||||
let fixture: ComponentFixture<LoansAccountAddCollateralDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoansAccountAddCollateralDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoansAccountAddCollateralDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loans-account-add-collateral-dialog',
|
||||
templateUrl: './loans-account-add-collateral-dialog.component.html',
|
||||
styleUrls: ['./loans-account-add-collateral-dialog.component.scss']
|
||||
})
|
||||
export class LoansAccountAddCollateralDialogComponent implements OnInit {
|
||||
|
||||
layout: {
|
||||
addButtonText?: string
|
||||
} = {
|
||||
addButtonText: 'Add'
|
||||
};
|
||||
|
||||
addCollateralForm: FormGroup;
|
||||
collateralTypeData: any;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<LoansAccountAddCollateralDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formBuilder: FormBuilder) {
|
||||
this.createAddCollateralForm();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.dialogRef.updateSize('400px');
|
||||
this.collateralTypeData = this.data.collateralTypeOptions;
|
||||
}
|
||||
|
||||
createAddCollateralForm() {
|
||||
this.addCollateralForm = this.formBuilder.group({
|
||||
'type': ['', Validators.required],
|
||||
'value': ['', Validators.required],
|
||||
'description': ['', Validators.required]
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<h1 mat-dialog-title>Guarantor Detail</h1>
|
||||
|
||||
<div mat-dialog-content fxLayout="column">
|
||||
|
||||
<div fxLayout="row wrap" fxLayout.lt-md="column">
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="50%">First Name:</span>
|
||||
<span fxFlex="50%">{{ data.guarantorData.firstname }}</span>
|
||||
</div>
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="50%">Last Name:</span>
|
||||
<span fxFlex="50%">{{ data.guarantorData.lastname }}</span>
|
||||
</div>
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="50%">Relationship:</span>
|
||||
<span fxFlex="50%">{{ data.guarantorData.clientRelationshipType.name }}</span>
|
||||
</div>
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="50%">Guarantor Type:</span>
|
||||
<span fxFlex="50%">{{ data.guarantorData.guarantorType.value }}</span>
|
||||
</div>
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="50%">Status:</span>
|
||||
<span fxFlex="50%">
|
||||
<span *ngIf="data.guarantorData.status">
|
||||
Active
|
||||
</span>
|
||||
<span *ngIf="!data.guarantorData.status">
|
||||
Deleted
|
||||
</span></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<mat-dialog-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
|
||||
<button mat-raised-button mat-dialog-close> Cancel </button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoansAccountViewGuarantorDetailsDialogComponent } from './loans-account-view-guarantor-details-dialog.component';
|
||||
|
||||
describe('LoansAccountViewGuarantorDetailsDialogComponent', () => {
|
||||
let component: LoansAccountViewGuarantorDetailsDialogComponent;
|
||||
let fixture: ComponentFixture<LoansAccountViewGuarantorDetailsDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoansAccountViewGuarantorDetailsDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoansAccountViewGuarantorDetailsDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loans-account-view-guarantor-details-dialog',
|
||||
templateUrl: './loans-account-view-guarantor-details-dialog.component.html',
|
||||
styleUrls: ['./loans-account-view-guarantor-details-dialog.component.scss']
|
||||
})
|
||||
export class LoansAccountViewGuarantorDetailsDialogComponent implements OnInit {
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<LoansAccountViewGuarantorDetailsDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.dialogRef.updateSize('400px');
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<h1 mat-dialog-title>{{data.heading}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>{{ data.dialogContext }}</p>
|
||||
</div>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
<button mat-raised-button color="warn" [mat-dialog-close]="{ confirm: true }">Confirm</button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoansConfirmationDialogBoxComponent } from './loans-confirmation-dialog-box.component';
|
||||
|
||||
describe('LoansConfirmationDialogBoxComponent', () => {
|
||||
let component: LoansConfirmationDialogBoxComponent;
|
||||
let fixture: ComponentFixture<LoansConfirmationDialogBoxComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoansConfirmationDialogBoxComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoansConfirmationDialogBoxComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loans-confirmation-dialog-box',
|
||||
templateUrl: './loans-confirmation-dialog-box.component.html',
|
||||
styleUrls: ['./loans-confirmation-dialog-box.component.scss']
|
||||
})
|
||||
export class LoansConfirmationDialogBoxComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides a confirmation for all the loans account actions.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<LoansConfirmationDialogBoxComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user