Added initial working table for transaction types

This commit is contained in:
Finn 2019-09-09 16:13:34 +01:00
parent 5c85d5aae9
commit 52bce4dd0a
6 changed files with 58 additions and 5 deletions

View file

@ -43,7 +43,6 @@ import { AuthModule } from './auth/auth.module';
import { DashboardModule } from './dashboard/dashboard.module'; import { DashboardModule } from './dashboard/dashboard.module';
import { ChartsModule } from 'ng2-charts'; import { ChartsModule } from 'ng2-charts';
// import { StackedBarChartComponent } from './panels/stacked-bar.component'; // import { StackedBarChartComponent } from './panels/stacked-bar.component';
//import { MoreStuffComponent } from './dashboard/more-graphs-and-tables.component';
import { FilterPipeModule } from 'ngx-filter-pipe'; import { FilterPipeModule } from 'ngx-filter-pipe';
@ -72,10 +71,8 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
BreadcrumbsComponent, BreadcrumbsComponent,
SIDEBAR_TOGGLE_DIRECTIVES, SIDEBAR_TOGGLE_DIRECTIVES,
AsideToggleDirective, AsideToggleDirective,
//MoreStuffComponent,
P404Component, P404Component,
P500Component, P500Component,
], ],
providers: [ providers: [
AuthGuard, AuthGuard,

View file

@ -40,6 +40,7 @@ import { RecurTableComponent } from '../shared/recur-table.component';
import { TransactionResultComponent } from '../shared/transaction-result.component'; import { TransactionResultComponent } from '../shared/transaction-result.component';
import { SupplierResultComponent } from '../shared/supplier-result.component'; import { SupplierResultComponent } from '../shared/supplier-result.component';
import { WardResultComponent } from '../shared/ward-result.component'; import { WardResultComponent } from '../shared/ward-result.component';
import { MetaTypeResultComponent } from '../shared/meta-type-result.component';
import { PayrollResultComponent } from '../shared/payroll-result.component'; import { PayrollResultComponent } from '../shared/payroll-result.component';
import { LeaderboardResultComponent } from '../shared/leaderboard-result.component'; import { LeaderboardResultComponent } from '../shared/leaderboard-result.component';
@ -76,6 +77,7 @@ import { environment } from '../../environments/environment';
TransactionResultComponent, TransactionResultComponent,
SupplierResultComponent, SupplierResultComponent,
WardResultComponent, WardResultComponent,
MetaTypeResultComponent,
PayrollLogComponent, PayrollLogComponent,
PayrollResultComponent, PayrollResultComponent,
LeaderboardComponent, LeaderboardComponent,

View file

@ -1,3 +1,31 @@
<div class="animated fadeIn">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<strong>List of Transaction Types</strong>
</div>
<div *ngIf="metaTypeListAvailable" class="card-block">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Ward</th>
<th>Amount of Transactions</th>
<th>Sum of Transactions</th>
</tr>
</thead>
<tbody>
<tr meta-type-result *ngFor="let type of metaTypeList" [type]="type"></tr>
</tbody>
</table>
</div>
<div *ngIf="!metaTypeListAvailable" class="card-block">
No Data available.
</div>
</div>
</div>
</div>
</div>
<div class="animated fadeIn"> <div class="animated fadeIn">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">

View file

@ -22,6 +22,8 @@ export class MoreStuffComponent implements OnInit {
isSupplierChartLoaded:boolean = false; isSupplierChartLoaded:boolean = false;
wardList: any; wardList: any;
wardListAvailable = false; wardListAvailable = false;
metaTypeList: any;
metaTypeListAvailable = false;
constructor( constructor(
private api: ApiService, private api: ApiService,
@ -185,9 +187,13 @@ export class MoreStuffComponent implements OnInit {
this.api.loadMiscUrl('organisation/external/lcc_tables').subscribe( this.api.loadMiscUrl('organisation/external/lcc_tables').subscribe(
result => { result => {
this.wardList = result.wards; this.wardList = result.wards;
this.metaTypeList = Object.keys(result.types).map(key => result.types[key]);
if (this.wardList) { if (this.wardList) {
this.wardListAvailable = true; this.wardListAvailable = true;
} }
if (this.metaTypeList) {
this.metaTypeListAvailable = true;
}
}, },
error => { error => {
console.log('Retrieval Error'); console.log('Retrieval Error');
@ -196,14 +202,12 @@ export class MoreStuffComponent implements OnInit {
) )
} }
private loadYearSpend() { private loadYearSpend() {
this.api.loadMiscUrl('organisation/external/year_spend').subscribe( this.api.loadMiscUrl('organisation/external/year_spend').subscribe(
result => { result => {
let value_data = []; let value_data = [];
let count_data = []; let count_data = [];
console.log("The server is UP");
result.data.map(item => { result.data.map(item => {
value_data.push({ value_data.push({
t: item.date, t: item.date,

View file

@ -0,0 +1,3 @@
<td>{{type.type}}</td>
<td>{{type.count}}</td>
<td>{{type.sum | currency:'GBP':'symbol':'1.2-2' }}</td>

View file

@ -0,0 +1,19 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
interface MetaTypeData {
type: string;
sum: number;
count: number;
}
@Component({
// tslint:disable-next-line
selector: '[meta-type-result]',
templateUrl: 'meta-type-result.component.html',
})
export class MetaTypeResultComponent implements OnInit {
@Input() public type: MetaTypeData;
ngOnInit(): void {
}
}