feat: add recurring deposit account tab (standing instruction) (#984)
Fixes: #982
This commit is contained in:
+6
@@ -207,6 +207,12 @@
|
||||
Transactions
|
||||
</a>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="recurringDepositsAccountData.clientId">
|
||||
<a mat-tab-link [routerLink]="['./standing-instructions']" routerLinkActive #standingInstructions="routerLinkActive"
|
||||
[active]="standingInstructions.isActive">
|
||||
Standing Instructions
|
||||
</a>
|
||||
</ng-container>
|
||||
</nav>
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<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>
|
||||
+19
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -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();
|
||||
});
|
||||
});
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatTable } from '@angular/material';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { RecurringDepositsService } from 'app/deposits/recurring-deposits/recurring-deposits.service';
|
||||
|
||||
/**
|
||||
* Recurring 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 {
|
||||
|
||||
/** Recurring Deposits Data */
|
||||
recurringDepositsData: 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 Recurring Deposits Account Data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private recurringDepositsService: RecurringDepositsService) {
|
||||
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
|
||||
this.recurringDepositsData = data.recurringDepositsAccountData;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getStandingInstructions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves standing instructions and initializes instructions table.
|
||||
*/
|
||||
getStandingInstructions() {
|
||||
const clientId = this.recurringDepositsData.clientId;
|
||||
const clientName = this.recurringDepositsData.clientName;
|
||||
const accountId = this.recurringDepositsData.id;
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
this.recurringDepositsService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => {
|
||||
this.instructionsData = response.pageItems;
|
||||
this.dataSource.data = this.instructionsData;
|
||||
this.instructionTableRef.renderRows();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { TransactionsTabComponent } from './recurring-deposits-account-view/tran
|
||||
/** Custom Resolvers */
|
||||
import { RecurringDepositsAccountViewResolver } from './common-resolvers/recurring-deposits-account-view.resolver';
|
||||
import { RecurringDepositsAccountDataResolver } from './common-resolvers/recurring-deposits-account-data.resolver';
|
||||
import { StandingInstructionsTabComponent } from './recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -42,7 +43,15 @@ const routes: Routes = [
|
||||
resolve: {
|
||||
recurringDepositsAccountData: RecurringDepositsAccountDataResolver
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'standing-instructions',
|
||||
component: StandingInstructionsTabComponent,
|
||||
data: { title: extract('Recurring Deposit Account Standing Instructions'), breadcrumb: 'Standing Instructions', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
recurringDepositsAccountData: RecurringDepositsAccountDataResolver
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -12,6 +12,7 @@ import { DirectivesModule } from '../../directives/directives.module';
|
||||
import { RecurringDepositsAccountViewComponent } from './recurring-deposits-account-view/recurring-deposits-account-view.component';
|
||||
import { InterestRateChartTabComponent } from './recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component';
|
||||
import { TransactionsTabComponent } from './recurring-deposits-account-view/transactions-tab/transactions-tab.component';
|
||||
import { StandingInstructionsTabComponent } from './recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component';
|
||||
|
||||
/**
|
||||
* RecurringDeposits Module
|
||||
@@ -28,7 +29,8 @@ import { TransactionsTabComponent } from './recurring-deposits-account-view/tran
|
||||
declarations: [
|
||||
RecurringDepositsAccountViewComponent,
|
||||
InterestRateChartTabComponent,
|
||||
TransactionsTabComponent
|
||||
TransactionsTabComponent,
|
||||
StandingInstructionsTabComponent
|
||||
],
|
||||
providers: [DatePipe]
|
||||
})
|
||||
|
||||
@@ -15,18 +15,31 @@ export class RecurringDepositsService {
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
/**
|
||||
* @param {string} recurringDepositAccountId is recurringDeposit account's Id.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
// getRecurringDepositsTransactionTemplateResource(recurringDepositAccountId: string): Observable<any> {
|
||||
// return this.http.get(`/recurringDepositsaccounts/${recurringDepositAccountId}/transactions/template`);
|
||||
// }
|
||||
|
||||
getRecurringDepositsAccountData(recurringDepositAccountId: any) {
|
||||
const httpParams = new HttpParams()
|
||||
.set('associations', 'all');
|
||||
return this.http.get(`/recurringdepositaccounts/${recurringDepositAccountId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientId Client Id
|
||||
* @param clientName Client Name
|
||||
* @param fromAccountId Account Id
|
||||
* @param locale Locale
|
||||
* @param dateFormat Date Format
|
||||
* @returns {Observable<any>} Standing Instructions
|
||||
*/
|
||||
getStandingInstructions(
|
||||
clientId: string, clientName: string, fromAccountId: string,
|
||||
locale: string, dateFormat: string): Observable<any> {
|
||||
const httpParams = new HttpParams()
|
||||
.set('clientId', clientId)
|
||||
.set('clientName', clientName)
|
||||
.set('fromAccountId', fromAccountId)
|
||||
.set('fromAccountType', '2')
|
||||
.set('locale', locale)
|
||||
.set('dateFormat', dateFormat);
|
||||
return this.http.get(`/standinginstructions`, { params: httpParams });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user