feat: collateral module
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
|
||||
<button mat-raised-button color="primary" [routerLink]="['edit']" *mifosxHasPermission="'UPDATE_CHARGE'">
|
||||
<fa-icon icon="edit"></fa-icon>
|
||||
Edit
|
||||
</button>
|
||||
<button mat-raised-button color="warn" (click)="deleteCollateral()" *mifosxHasPermission="'DELETE_CHARGE'">
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<mat-card class="client-collateral-card">
|
||||
|
||||
<mat-card-content class="content">\
|
||||
|
||||
<div class="tab-container mat-typography">
|
||||
|
||||
<h3>Client Collateral Details</h3>
|
||||
|
||||
<div fxLayout="row" fxLayoutGap="32px" class="group-details-container m-b-30">
|
||||
<p>
|
||||
Name: {{ clientCollateralData.name }}<br/>
|
||||
Quantity: {{ clientCollateralData.quantity }}<br/>
|
||||
Total Value: {{ clientCollateralData.total }}<br/>
|
||||
Total Collateral Value: {{ clientCollateralData.totalCollateral }}<br/>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h3>Transaction Details</h3>
|
||||
|
||||
<table mat-table [dataSource]="clientCollateralData.loanTransactionData"
|
||||
class="mat-elevation-z1 m-b-30">
|
||||
|
||||
<ng-container matColumnDef="ID">
|
||||
<th mat-header-cell *matHeaderCellDef> ID </th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
{{element.loanId}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Last Repayment">
|
||||
<th mat-header-cell *matHeaderCellDef>Last Repayment</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.lastRepayment}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Remaining Amount">
|
||||
<th mat-header-cell *matHeaderCellDef> Remaining Amount </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.remainingAmount}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Last Repayment Date">
|
||||
<th mat-header-cell *matHeaderCellDef> Last Repayment Date </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.lastRepaymentDate | dateFormat}} </td>
|
||||
|
||||
</ng-container>
|
||||
|
||||
<!-- <tr mat-header-row *matHeaderRowDef="clientMemberColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: clientMemberColumns;" [routerLink]="['/clients', row.id, 'loans-accounts', 'create']" class="select-row"></tr> -->
|
||||
<tr mat-header-row *matHeaderRowDef="collateralColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: collateralColumns;"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
@@ -0,0 +1,36 @@
|
||||
.client-collateral-card {
|
||||
margin: 0 auto;
|
||||
max-width: 80rem;
|
||||
width: 90%;
|
||||
padding: 0;
|
||||
}
|
||||
.tab-container {
|
||||
padding: 1%;
|
||||
margin: 1%;
|
||||
h3 {
|
||||
margin:1% auto;
|
||||
}
|
||||
.group-details-container {
|
||||
border: 1px solid;
|
||||
padding: 1%;
|
||||
}
|
||||
.action-button{
|
||||
margin-left: auto;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
.account-action-button{
|
||||
min-width: 26px;
|
||||
padding: 0 6px;
|
||||
margin: 4px;
|
||||
line-height: 25px;
|
||||
}
|
||||
tr.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
i:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewCollateralComponent } from './view-collateral.component';
|
||||
|
||||
describe('ViewCollateralComponent', () => {
|
||||
let component: ViewCollateralComponent;
|
||||
let fixture: ComponentFixture<ViewCollateralComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ViewCollateralComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewCollateralComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CollateralsService } from '../collaterals.service';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Custom Components */
|
||||
import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-view-collateral',
|
||||
templateUrl: './view-collateral.component.html',
|
||||
styleUrls: ['./view-collateral.component.scss']
|
||||
})
|
||||
export class ViewCollateralComponent implements OnInit {
|
||||
|
||||
clientCollateralData: any;
|
||||
|
||||
collateralColumns: string[] = ['ID', 'Last Repayment', 'Remaining Amount', 'Last Repayment Date'];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private collateralsService: CollateralsService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: {clientCollateralData: any}) => {
|
||||
this.clientCollateralData = data.clientCollateralData;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the Collateral and redirects to CLients Page.
|
||||
*/
|
||||
deleteCollateral() {
|
||||
const deleteCollateralDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: `collateral ${this.clientCollateralData.id}` }
|
||||
});
|
||||
deleteCollateralDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.collateralsService.deleteCollateral(this.clientCollateralData.clientId, this.clientCollateralData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user