feat: view fixed-deposit account page (#959)

Fixes: #225
This commit is contained in:
Karan Takalkar
2020-07-02 20:49:49 +05:30
committed by GitHub
parent 50dbb7b6e6
commit 87604b4e3e
32 changed files with 1333 additions and 2 deletions
@@ -0,0 +1,70 @@
<div class="tab-container mat-typography">
<div class="m-b-10">
<h3>All Standing Instructions</h3>
</div>
<div class="mat-elevation-z1 m-b-25">
<table mat-table #instructionsTable [dataSource]="dataSource">
<ng-container matColumnDef="client">
<th mat-header-cell *matHeaderCellDef> Client </th>
<td mat-cell *matCellDef="let instruction">{{instruction.fromClient.displayName}}-{{instruction.fromClient.id}}</td>
</ng-container>
<ng-container matColumnDef="fromAccount">
<th mat-header-cell *matHeaderCellDef> From Account </th>
<td mat-cell *matCellDef="let instruction">{{instruction.fromAccount.accountNo}} ({{instruction.fromAccountType.value}})</td>
</ng-container>
<ng-container matColumnDef="beneficiary">
<th mat-header-cell *matHeaderCellDef> Beneficiary </th>
<td mat-cell *matCellDef="let instruction">{{instruction.toClient.displayName}}</td>
</ng-container>
<ng-container matColumnDef="toAccount">
<th mat-header-cell *matHeaderCellDef> To Account </th>
<td mat-cell *matCellDef="let instruction">{{instruction.toAccount.accountNo}} ({{instruction.toAccountType.value}})</td>
</ng-container>
<ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef> Amount </th>
<td mat-cell *matCellDef="let instruction">{{instruction.instructionType.value}}/{{instruction.amount}}</td>
</ng-container>
<ng-container matColumnDef="validity">
<th mat-header-cell *matHeaderCellDef> Validity </th>
<td mat-cell *matCellDef="let instruction">{{instruction.validFrom | date}} to {{instruction.validTill | date}}</td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef> Actions </th>
<td mat-cell *matCellDef="let instruction">
<span *ngIf="instruction.status.value!=='Deleted'">
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Edit Standing Instruction"
*mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'">
<i class="fa fa-edit"></i>
</button>
</span>
<span *ngIf="instruction.status.value!=='Deleted'">
<button class="account-action-button" mat-raised-button color="warn" matTooltip="Delete Standing Instruction"
*mifosxHasPermission="'DELETE_STANDINGINSTRUCTION'">
<i class="fa fa-times"></i>
</button>
</span>
<button class="account-action-button" mat-raised-button color="primary" matTooltip="View Standing Instruction"
*mifosxHasPermission="'READ_STANDINGINSTRUCTION'">
<i class="fa fa-eye"></i>
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
</div>
@@ -0,0 +1,19 @@
.tab-container {
padding: 1%;
margin: 1%;
h3 {
margin:1% auto;
}
.action-button {
margin-left: auto;
}
table {
width: 100%;
.account-action-button{
min-width: 26px;
padding: 0 6px;
margin: 4px;
line-height: 25px;
}
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StandingInstructionsTabComponent } from './standing-instructions-tab.component';
describe('StandingInstructionsTabComponent', () => {
let component: StandingInstructionsTabComponent;
let fixture: ComponentFixture<StandingInstructionsTabComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ StandingInstructionsTabComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(StandingInstructionsTabComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,70 @@
/** Angular Imports */
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatTableDataSource, MatTable } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
/** Custom Services */
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
/**
* Fixed Deposits Standing Instructions Tab
*/
@Component({
selector: 'mifosx-standing-instructions-tab',
templateUrl: './standing-instructions-tab.component.html',
styleUrls: ['./standing-instructions-tab.component.scss']
})
export class StandingInstructionsTabComponent implements OnInit {
/** Fixed Deposits Data */
fixedDepositsData: any;
/** Instructions Data */
instructionsData: any[];
/** Data source for instructions table. */
dataSource = new MatTableDataSource();
/** Columns to be displayed in instructions table. */
displayedColumns: string[] = [
'client',
'fromAccount',
'beneficiary',
'toAccount',
'amount',
'validity',
'actions'
];
/** Instruction Table Reference */
@ViewChild('instructionsTable') instructionTableRef: MatTable<Element>;
/**
* Retrieves Fixed Deposits Account Data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
private fixedDepositsService: FixedDepositsService) {
this.route.parent.data.subscribe((data: { fixedDepositsAccountData: any }) => {
this.fixedDepositsData = data.fixedDepositsAccountData;
});
}
ngOnInit() {
this.getStandingInstructions();
}
/**
* Retrieves standing instructions and initializes instructions table.
*/
getStandingInstructions() {
const clientId = this.fixedDepositsData.clientId;
const clientName = this.fixedDepositsData.clientName;
const accountId = this.fixedDepositsData.id;
const locale = 'en';
const dateFormat = 'dd MMMM yyyy';
this.fixedDepositsService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => {
this.instructionsData = response.pageItems;
this.dataSource.data = this.instructionsData;
this.instructionTableRef.renderRows();
});
}
}