+101
@@ -0,0 +1,101 @@
|
||||
<div class="tab-container mat-typography">
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="start">
|
||||
<div class="m-b-10">
|
||||
<h3>All Charges</h3>
|
||||
</div>
|
||||
<div class="action-button m-b-20" *ngIf="this.chargesData">
|
||||
<button mat-raised-button color="primary" (click)="toggleCharges()">
|
||||
{{showInactiveCharges?'View Active Charges':'View Inactive Charges'}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mat-elevation-z1 m-b-25">
|
||||
|
||||
<table mat-table #chargesTable [dataSource]="dataSource">
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef> Name </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{ charge.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="feeOrPenalty">
|
||||
<th mat-header-cell *matHeaderCellDef> Fee/Penalty </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{ charge.penalty === true ? 'Penalty' : 'Fee' }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="paymentDueAt">
|
||||
<th mat-header-cell *matHeaderCellDef> Payment Due At </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{ charge.chargeTimeType.value }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="dueAsOf">
|
||||
<th mat-header-cell *matHeaderCellDef> Due As Of </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{ charge.dueDate | date }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="repeatsOn">
|
||||
<th mat-header-cell *matHeaderCellDef> Repeats On (M/d) </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{ charge.feeOnMonthDay ? charge.feeOnMonthDay.join('/') : '' }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="calculationType">
|
||||
<th mat-header-cell *matHeaderCellDef> Calculation Type </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{charge.chargeCalculationType.value}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="due">
|
||||
<th mat-header-cell *matHeaderCellDef> Due </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}} {{charge.amount}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="paid">
|
||||
<th mat-header-cell *matHeaderCellDef> Paid </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}} {{charge.amountPaid}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="waived">
|
||||
<th mat-header-cell *matHeaderCellDef> Waived </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}} {{charge.amountWaived}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="outstanding">
|
||||
<th mat-header-cell *matHeaderCellDef> Outstanding </th>
|
||||
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}} {{charge.amountOutstanding}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||
<td mat-cell *matCellDef="let charge">
|
||||
<span *ngIf="recurringDepositsAccountData.status.value === 'Submitted and pending approval'">
|
||||
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Edit Charge">
|
||||
<i class="fa fa-pencil"></i>
|
||||
</button>
|
||||
<button class="account-action-button" mat-raised-button color="warn" matTooltip="Delete Charge">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</span>
|
||||
<span *ngIf="recurringDepositsAccountData.status.value === 'Active' && charge.amountOutstanding !== 0">
|
||||
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Pay Charge">
|
||||
<i class="fa fa-dollar"></i>
|
||||
</button>
|
||||
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Waive Charge">
|
||||
<i class="fa fa-flag"></i>
|
||||
</button>
|
||||
<ng-container *ngIf="isRecurringCharge(charge)">
|
||||
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Inactivate Charge">
|
||||
<i class="fa fa-ban"></i>
|
||||
</button>
|
||||
</ng-container>
|
||||
</span>
|
||||
</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 { ChargesTabComponent } from './charges-tab.component';
|
||||
|
||||
describe('ChargesTabComponent', () => {
|
||||
let component: ChargesTabComponent;
|
||||
let fixture: ComponentFixture<ChargesTabComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChargesTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ChargesTabComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatTable } from '@angular/material';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Charges Tab Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-charges-tab',
|
||||
templateUrl: './charges-tab.component.html',
|
||||
styleUrls: ['./charges-tab.component.scss']
|
||||
})
|
||||
export class ChargesTabComponent implements OnInit {
|
||||
|
||||
/** Fixed Deposits Account Data */
|
||||
recurringDepositsAccountData: any;
|
||||
/** Charges Data */
|
||||
chargesData: any[];
|
||||
/** Data source for charges table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Toggles Charges Table */
|
||||
showInactiveCharges = false;
|
||||
/** Columns to be displayed in charges table. */
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'feeOrPenalty',
|
||||
'paymentDueAt',
|
||||
'dueAsOf',
|
||||
'repeatsOn',
|
||||
'calculationType',
|
||||
'due',
|
||||
'paid',
|
||||
'waived',
|
||||
'outstanding',
|
||||
'actions'
|
||||
];
|
||||
|
||||
/** Charges Table Reference */
|
||||
@ViewChild('chargesTable') chargesTableRef: MatTable<Element>;
|
||||
|
||||
/**
|
||||
* Retrieves Fixed Deposits Account Data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
|
||||
this.recurringDepositsAccountData = data.recurringDepositsAccountData;
|
||||
this.chargesData = this.recurringDepositsAccountData.charges;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const activeCharges = this.chargesData ? this.chargesData.filter(charge => charge.isActive) : [];
|
||||
this.dataSource = new MatTableDataSource(activeCharges);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles datasource for active/inactive charges.
|
||||
*/
|
||||
toggleCharges() {
|
||||
this.showInactiveCharges = !this.showInactiveCharges;
|
||||
if (!this.showInactiveCharges) {
|
||||
const activeCharges = this.chargesData.filter(charge => charge.isActive);
|
||||
this.dataSource.data = activeCharges;
|
||||
} else {
|
||||
const inActiveCharges = this.chargesData.filter(charge => !charge.isActive);
|
||||
this.dataSource.data = inActiveCharges;
|
||||
}
|
||||
this.chargesTableRef.renderRows();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if charge is recurring.
|
||||
* @param {any} charge Charge
|
||||
*/
|
||||
isRecurringCharge(charge: any) {
|
||||
return charge.chargeTimeType.value === 'Monthly Fee' || charge.chargeTimeType.value === 'Annual Fee' || charge.chargeTimeType.value === 'Weekly Fee';
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -207,6 +207,9 @@
|
||||
Transactions
|
||||
</a>
|
||||
</ng-container>
|
||||
<a mat-tab-link [routerLink]="['./charges']" routerLinkActive #charges="routerLinkActive" [active]="charges.isActive">
|
||||
Charges
|
||||
</a>
|
||||
<ng-container *ngIf="recurringDepositsAccountData.clientId">
|
||||
<a mat-tab-link [routerLink]="['./standing-instructions']" routerLinkActive #standingInstructions="routerLinkActive"
|
||||
[active]="standingInstructions.isActive">
|
||||
|
||||
@@ -14,6 +14,7 @@ import { TransactionsTabComponent } from './recurring-deposits-account-view/tran
|
||||
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';
|
||||
import { ChargesTabComponent } from './recurring-deposits-account-view/charges-tab/charges-tab.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -31,7 +32,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: 'interest-rate-chart',
|
||||
component: InterestRateChartTabComponent,
|
||||
data: { title: extract('Interest Rate Chart'), breadcrumb: 'Interest Rate Chart', routeParamBreadcrumb: false },
|
||||
data: { title: extract('Recurring Deposit Account Interest Rate Chart'), breadcrumb: 'Interest Rate Chart', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
recurringDepositsAccountData: RecurringDepositsAccountDataResolver
|
||||
}
|
||||
@@ -39,11 +40,16 @@ const routes: Routes = [
|
||||
{
|
||||
path: 'transactions',
|
||||
component: TransactionsTabComponent,
|
||||
data: { title: extract('Transactions'), breadcrumb: 'Transactions', routeParamBreadcrumb: false },
|
||||
data: { title: extract('Recurring Deposit Account Transactions'), breadcrumb: 'Transactions', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
recurringDepositsAccountData: RecurringDepositsAccountDataResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'charges',
|
||||
component: ChargesTabComponent,
|
||||
data: { title: extract('Recurring Deposit Account Charges'), breadcrumb: 'Charges', routeParamBreadcrumb: false }
|
||||
},
|
||||
{
|
||||
path: 'standing-instructions',
|
||||
component: StandingInstructionsTabComponent,
|
||||
|
||||
@@ -13,6 +13,7 @@ import { RecurringDepositsAccountViewComponent } from './recurring-deposits-acco
|
||||
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';
|
||||
import { ChargesTabComponent } from './recurring-deposits-account-view/charges-tab/charges-tab.component';
|
||||
|
||||
/**
|
||||
* RecurringDeposits Module
|
||||
@@ -30,7 +31,8 @@ import { StandingInstructionsTabComponent } from './recurring-deposits-account-v
|
||||
RecurringDepositsAccountViewComponent,
|
||||
InterestRateChartTabComponent,
|
||||
TransactionsTabComponent,
|
||||
StandingInstructionsTabComponent
|
||||
StandingInstructionsTabComponent,
|
||||
ChargesTabComponent
|
||||
],
|
||||
providers: [DatePipe]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user