feat: add view transactions history (#1157)

Fixes: #1156
This commit is contained in:
Muskan Khedia
2020-07-26 15:25:04 +05:30
committed by GitHub
parent 67a836e3d6
commit 6ad1335d93
14 changed files with 245 additions and 14 deletions
@@ -0,0 +1,73 @@
<div class="container m-b-20">
<mat-card class="mat-elevation-z8">
<mat-card-content>
<div fxLayout="row wrap" class="content">
<div fxFlex="25%" fxFlex.lt-md="50%" class="header">
From Account
</div>
<div fxFlex="25%" fxFlex.lt-md="50%">
{{ listTransactionData.fromAccount.accountNo }}({{ listTransactionData.fromAccountType.value }})
</div>
<div fxFlex="25%" fxFlex.lt-md="50%" class="header">
To Account
</div>
<div fxFlex="25%" fxFlex.lt-md="50%">
{{ listTransactionData.toAccount.accountNo }}({{ listTransactionData.toAccountType.value }})
</div>
<div fxFlex="25%" fxFlex.lt-md="50%" class="header">
Destination
</div>
<div fxFlex="25%" fxFlex.lt-md="50%">
{{ listTransactionData.toClient.displayName }}
</div>
</div>
</mat-card-content>
</mat-card>
</div>
<div class="mat-elevation-z8 container">
<table mat-table [dataSource]="dataSource">
<ng-container matColumnDef="transactionDate">
<th mat-header-cell *matHeaderCellDef> Transaction Date </th>
<td mat-cell *matCellDef="let transaction"> {{ transaction.transferDate | date }} </td>
</ng-container>
<ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef> Amount </th>
<td mat-cell *matCellDef="let transaction"> {{ transaction.transferAmount }} </td>
</ng-container>
<ng-container matColumnDef="notes">
<th mat-header-cell *matHeaderCellDef> Notes </th>
<td mat-cell *matCellDef="let transaction"> {{ transaction.transferDescription }} </td>
</ng-container>
<ng-container matColumnDef="reversed">
<th mat-header-cell *matHeaderCellDef> Reversed </th>
<td mat-cell *matCellDef="let transaction"> {{ transaction.reversed ? 'Yes' : 'No' }} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;">
</tr>
</table>
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
</div>
@@ -0,0 +1,17 @@
.content {
div {
line-height: 3rem;
&.header {
font-weight: 500;
}
}
}
table {
width: 100%;
.select-row:hover {
cursor: pointer;
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ListTransactionsComponent } from './list-transactions.component';
describe('ListTransactionsComponent', () => {
let component: ListTransactionsComponent;
let fixture: ComponentFixture<ListTransactionsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListTransactionsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListTransactionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,46 @@
/** Angular Imports */
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatTableDataSource, MatTable, MatPaginator, MatDialog } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
import { FormControl } from '@angular/forms';
/** Custom Services */
import { AccountTransfersService } from '../account-transfers.service';
/** Dialog Components */
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
/**
* Recurring Deposits Standing Instructions Tab
*/
@Component({
selector: 'mifosx-list-transactions',
templateUrl: './list-transactions.component.html',
styleUrls: ['./list-transactions.component.scss']
})
export class ListTransactionsComponent {
/** List Transactions Data */
listTransactionData: any;
/** Data source for instructions table. */
dataSource = new MatTableDataSource();
/** Columns to be displayed in instructions table. */
displayedColumns: string[] = ['transactionDate', 'amount', 'notes', 'reversed'];
/** Paginator for centers table. */
@ViewChild(MatPaginator) paginator: MatPaginator;
/**
* Retrieves Recurring Deposits Account Data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.data.subscribe((data: { listTransactionData: any }) => {
this.listTransactionData = data.listTransactionData;
this.dataSource = new MatTableDataSource(this.listTransactionData.transactions.pageItems);
this.dataSource.paginator = this.paginator;
});
}
}