feat: add recurring deposit account tab (interest rate chart) (#979)

Fixes: #978
This commit is contained in:
Muskan Khedia
2020-07-03 23:58:39 +05:30
committed by GitHub
parent 5110296648
commit b9d72f2d2c
22 changed files with 184 additions and 12 deletions
+1 -1
View File
@@ -183,7 +183,7 @@ const routes: Routes = [
},
{
path: 'recurringdeposits',
loadChildren: '../recurring-deposits/recurring-deposits.module#RecurringDepositsModule'
loadChildren: '../deposits/recurring-deposits/recurring-deposits.module#RecurringDepositsModule'
},
{
path: 'sharesaccounts',
@@ -469,7 +469,7 @@
<tr mat-header-row *matHeaderRowDef="openSavingsColumns"></tr>
<tr mat-row *matRowDef="let row; columns: openSavingsColumns;"
[routerLink]="['../', 'recurringdeposits', row.id]"></tr>
[routerLink]="['../', 'recurringdeposits', row.id, 'interest-rate-chart']" class="select-row"></tr>
</table>
<!-- Closed Recurring Deposit Accounts -->
@@ -495,7 +495,7 @@
<tr mat-header-row *matHeaderRowDef="closedSavingsColumns"></tr>
<tr mat-row *matRowDef="let row; columns: closedSavingsColumns;"
[routerLink]="['../', 'recurringdeposits', row.id]"></tr>
[routerLink]="['../', 'recurringdeposits', row.id, 'interest-rate-chart']" class="select-row"></tr>
</table>
<!-- Shares overview Table -->
@@ -0,0 +1,32 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
/** rxjs Imports */
import { Observable } from 'rxjs';
/** Custom Services */
import { RecurringDepositsService } from '../recurring-deposits.service';
/**
* RecurringDeposits Account data resolver.
*/
@Injectable()
export class RecurringDepositsAccountDataResolver implements Resolve<Object> {
/**
* @param {RecurringDepositsService} RecurringDepositsService RecurringDeposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) { }
/**
* Returns the RecurringDeposits Account data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const recurringDepositAccountId = route.parent.paramMap.get('recurringDepositAccountId');
return this.recurringDepositsService.getRecurringDepositsAccountData(recurringDepositAccountId);
}
}
@@ -0,0 +1,45 @@
<div class="tab-container mat-typography">
<div class="mat-elevation-z1 m-b-25">
<table mat-table [dataSource]="interestRateChartData">
<ng-container matColumnDef="period">
<th mat-header-cell *matHeaderCellDef> Period </th>
<td mat-cell *matCellDef="let rateChart">
{{rateChart.fromPeriod}}-{{rateChart.toPeriod}}&nbsp;{{rateChart.periodType.value}}</td>
</ng-container>
<ng-container matColumnDef="amountRange">
<th mat-header-cell *matHeaderCellDef> Amount Range </th>
<td mat-cell *matCellDef="let rateChart">{{rateChart.amountRangeFrom}}-{{rateChart.amountRangeTo}}</td>
</ng-container>
<ng-container matColumnDef="interest">
<th mat-header-cell *matHeaderCellDef> Interest </th>
<td mat-cell *matCellDef="let rateChart"> {{ rateChart.annualInterestRate }} </td>
</ng-container>
<ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef> Description </th>
<td mat-cell *matCellDef="let rateChart"> {{ rateChart.description }} </td>
</ng-container>
<ng-container matColumnDef="incentives">
<th mat-header-cell *matHeaderCellDef> Incentives </th>
<td mat-cell *matCellDef="let rateChart">
<button mat-button color="primary">
<fa-icon icon="eye"></fa-icon>&nbsp;&nbsp;
View Incentives
</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,10 @@
.tab-container {
padding: 1%;
margin: 1%;
h3 {
margin:1% auto;
}
table {
width: 100%;
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InterestRateChartTabComponent } from './interest-rate-chart-tab.component';
describe('InterestRateChartTabComponent', () => {
let component: InterestRateChartTabComponent;
let fixture: ComponentFixture<InterestRateChartTabComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InterestRateChartTabComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InterestRateChartTabComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,36 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
/**
* Interest Rate Chart Tab Component.
*/
@Component({
selector: 'mifosx-interest-rate-chart-tab',
templateUrl: './interest-rate-chart-tab.component.html',
styleUrls: ['./interest-rate-chart-tab.component.scss']
})
export class InterestRateChartTabComponent implements OnInit {
/** Interest Rate Chart Data */
interestRateChartData: any;
/** Columns to be displayed in interest rate chart table. */
displayedColumns: string[] = ['period', 'amountRange', 'interest', 'description', 'incentives'];
/** Data source for interest rate chart table. */
dataSource: MatTableDataSource<any>;
/**
* Retrieves recurring deposits account data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.interestRateChartData = data.recurringDepositsAccountData.accountChart.chartSlabs;
});
}
ngOnInit() {
}
}
@@ -158,6 +158,7 @@
</table>
</div>
</div>
<div class="recurringDeposits-account-tables" fxLayout="row" fxLayoutGap="2%">
<div fxFlex="49%"
*ngIf="!recurringDepositsAccountData.status.rejected && !recurringDepositsAccountData.status.submittedAndPendingApproval">
@@ -195,6 +196,13 @@
</div>
<nav mat-tab-nav-bar class="navigation-tabs">
<a mat-tab-link [routerLink]="['./interest-rate-chart']" routerLinkActive #IRC="routerLinkActive"
[active]="IRC.isActive">
Interest Rate Chart
</a>
</nav>
<router-outlet></router-outlet>
</mat-card-content>
@@ -3,13 +3,15 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
/** Translation Imports */
import { extract } from '../core/i18n/i18n.service';
import { extract } from '../../core/i18n/i18n.service';
/** Custom Components */
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';
/** Custom Resolvers */
import { RecurringDepositsAccountViewResolver } from './common-resolvers/recurring-deposits-account-view.resolver';
import { RecurringDepositsAccountDataResolver } from './common-resolvers/recurring-deposits-account-data.resolver';
const routes: Routes = [
{
@@ -19,10 +21,20 @@ const routes: Routes = [
{
path: ':recurringDepositAccountId',
data: { title: extract('RecurringDeposit Account View'), routeParamBreadcrumb: 'recurringDepositAccountId' },
component: RecurringDepositsAccountViewComponent,
resolve: {
recurringDepositsAccountData: RecurringDepositsAccountViewResolver
},
component: RecurringDepositsAccountViewComponent
children: [
{
path: 'interest-rate-chart',
component: InterestRateChartTabComponent,
data: { title: extract('Interest Rate Chart'), breadcrumb: 'Interest Rate Chart', routeParamBreadcrumb: false },
resolve: {
recurringDepositsAccountData: RecurringDepositsAccountDataResolver
}
}
]
}
]
}
@@ -33,6 +45,7 @@ const routes: Routes = [
declarations: [],
providers: [
RecurringDepositsAccountViewResolver,
RecurringDepositsAccountDataResolver
]
})
export class RecurringDepositsRoutingModule {}
@@ -5,11 +5,12 @@ import { DatePipe } from '@angular/common';
/** Custom Modules */
import { RecurringDepositsRoutingModule } from './recurring-deposits-routing.module';
import { SharedModule } from 'app/shared/shared.module';
import { PipesModule } from '../pipes/pipes.module';
import { DirectivesModule } from '../directives/directives.module';
import { PipesModule } from '../../pipes/pipes.module';
import { DirectivesModule } from '../../directives/directives.module';
/** Custom Components */
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';
/**
* RecurringDeposits Module
@@ -24,7 +25,8 @@ import { RecurringDepositsAccountViewComponent } from './recurring-deposits-acco
RecurringDepositsRoutingModule
],
declarations: [
RecurringDepositsAccountViewComponent
RecurringDepositsAccountViewComponent,
InterestRateChartTabComponent
],
providers: [DatePipe]
})
+3 -2
View File
@@ -146,16 +146,17 @@ import { ShareProductsDividendsComponent } from './share-products/dividends-shar
FixedDepositProductChargesStepComponent,
FixedDepositProductAccountingStepComponent,
FixedDepositProductPreviewStepComponent,
DepositProductIncentiveFormDialogComponent,
ManageTaxGroupsComponent,
ViewTaxComponentComponent,
CreateTaxComponentComponent,
EditTaxComponentComponent,
EditChargeComponent,
ViewTaxGroupComponent,
ShareProductsDividendsComponent
ShareProductsDividendsComponent,
DepositProductIncentiveFormDialogComponent
],
entryComponents: [
DepositProductIncentiveFormDialogComponent,
FloatingRatePeriodDialogComponent
],
providers: [DatePipe]
+1 -1
View File
@@ -8,7 +8,7 @@
@import '../../app/savings/savings-account-view/savings-account-view.component-theme.scss';
@import '../../app/shares/shares-account-view/shares-account-view.component-theme.scss';
@import '../../app/deposits/fixed-deposits/fixed-deposit-account-view/fixed-deposit-account-view.component-theme.scss';
@import '../../app/recurring-deposits/recurring-deposits-account-view/recurring-deposits-account-view.component-theme.scss';
@import '../../app/deposits/recurring-deposits/recurring-deposits-account-view/recurring-deposits-account-view.component-theme.scss';
// Custom material palette
$mat-denim: (
+1 -1
View File
@@ -8,7 +8,7 @@
@import '../../app/savings/savings-account-view/savings-account-view.component-theme.scss';
@import '../../app/shares/shares-account-view/shares-account-view.component-theme.scss';
@import '../../app/deposits/fixed-deposits/fixed-deposit-account-view/fixed-deposit-account-view.component-theme.scss';
@import '../../app/recurring-deposits/recurring-deposits-account-view/recurring-deposits-account-view.component-theme.scss';
@import '../../app/deposits/recurring-deposits/recurring-deposits-account-view/recurring-deposits-account-view.component-theme.scss';
// Custom material palette
$mat-picton-blue: (