From 2dc9616075b85678de6074a49f031abafdb68356 Mon Sep 17 00:00:00 2001 From: Finn Date: Mon, 9 Sep 2019 16:13:34 +0100 Subject: [PATCH] Added initial working table for transaction types --- src/app/app.module.ts | 3 -- src/app/dashboard/dashboard.module.ts | 2 ++ .../more-graphs-and-tables.component.html | 28 +++++++++++++++++++ .../more-graphs-and-tables.component.ts | 8 ++++-- .../shared/meta-type-result.component.html | 3 ++ src/app/shared/meta-type-result.component.ts | 19 +++++++++++++ 6 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 src/app/shared/meta-type-result.component.html create mode 100644 src/app/shared/meta-type-result.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d975bb2..067c810 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -43,7 +43,6 @@ import { AuthModule } from './auth/auth.module'; import { DashboardModule } from './dashboard/dashboard.module'; import { ChartsModule } from 'ng2-charts'; // import { StackedBarChartComponent } from './panels/stacked-bar.component'; -//import { MoreStuffComponent } from './dashboard/more-graphs-and-tables.component'; import { FilterPipeModule } from 'ngx-filter-pipe'; @@ -72,10 +71,8 @@ import { FilterPipeModule } from 'ngx-filter-pipe'; BreadcrumbsComponent, SIDEBAR_TOGGLE_DIRECTIVES, AsideToggleDirective, - //MoreStuffComponent, P404Component, P500Component, - ], providers: [ AuthGuard, diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index 6e4c09a..094216c 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -40,6 +40,7 @@ import { RecurTableComponent } from '../shared/recur-table.component'; import { TransactionResultComponent } from '../shared/transaction-result.component'; import { SupplierResultComponent } from '../shared/supplier-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 { LeaderboardResultComponent } from '../shared/leaderboard-result.component'; @@ -76,6 +77,7 @@ import { environment } from '../../environments/environment'; TransactionResultComponent, SupplierResultComponent, WardResultComponent, + MetaTypeResultComponent, PayrollLogComponent, PayrollResultComponent, LeaderboardComponent, diff --git a/src/app/dashboard/more-graphs-and-tables.component.html b/src/app/dashboard/more-graphs-and-tables.component.html index 1af2da3..31c0ddd 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.html +++ b/src/app/dashboard/more-graphs-and-tables.component.html @@ -1,3 +1,31 @@ +
+
+
+
+
+ List of Transaction Types +
+
+ + + + + + + + + + + +
WardAmount of TransactionsSum of Transactions
+
+
+ No Data available. +
+
+
+
+
diff --git a/src/app/dashboard/more-graphs-and-tables.component.ts b/src/app/dashboard/more-graphs-and-tables.component.ts index 546a47f..78e3cdc 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.ts +++ b/src/app/dashboard/more-graphs-and-tables.component.ts @@ -22,6 +22,8 @@ export class MoreStuffComponent implements OnInit { isSupplierChartLoaded:boolean = false; wardList: any; wardListAvailable = false; + metaTypeList: any; + metaTypeListAvailable = false; constructor( private api: ApiService, @@ -185,9 +187,13 @@ export class MoreStuffComponent implements OnInit { this.api.loadMiscUrl('organisation/external/lcc_tables').subscribe( result => { this.wardList = result.wards; + this.metaTypeList = Object.keys(result.types).map(key => result.types[key]); if (this.wardList) { this.wardListAvailable = true; } + if (this.metaTypeList) { + this.metaTypeListAvailable = true; + } }, error => { console.log('Retrieval Error'); @@ -196,14 +202,12 @@ export class MoreStuffComponent implements OnInit { ) } - private loadYearSpend() { this.api.loadMiscUrl('organisation/external/year_spend').subscribe( result => { let value_data = []; let count_data = []; - console.log("The server is UP"); result.data.map(item => { value_data.push({ t: item.date, diff --git a/src/app/shared/meta-type-result.component.html b/src/app/shared/meta-type-result.component.html new file mode 100644 index 0000000..755ba49 --- /dev/null +++ b/src/app/shared/meta-type-result.component.html @@ -0,0 +1,3 @@ +{{type.type}} +{{type.count}} +{{type.sum | currency:'GBP':'symbol':'1.2-2' }} diff --git a/src/app/shared/meta-type-result.component.ts b/src/app/shared/meta-type-result.component.ts new file mode 100644 index 0000000..5a5a0c2 --- /dev/null +++ b/src/app/shared/meta-type-result.component.ts @@ -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 { + } +}