From 0644f366a8d34e3bee453a92dd535e9fba1fd1a3 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 4 Sep 2019 18:21:21 +0100 Subject: [PATCH] BROKEN: Added wards table --- src/app/dashboard/dashboard.module.ts | 2 + .../more-graphs-and-tables.component.html | 49 +++++++++++++++++++ .../more-graphs-and-tables.component.ts | 18 +++++++ src/app/shared/ward-result.component.html | 3 ++ src/app/shared/ward-result.component.ts | 19 +++++++ 5 files changed, 91 insertions(+) create mode 100644 src/app/shared/ward-result.component.html create mode 100644 src/app/shared/ward-result.component.ts diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index 7e006b3..c151da2 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -38,6 +38,7 @@ import { RecurResultComponent } from '../shared/recur-result.component'; 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 { PayrollResultComponent } from '../shared/payroll-result.component'; import { LeaderboardResultComponent } from '../shared/leaderboard-result.component'; @@ -73,6 +74,7 @@ import { environment } from '../../environments/environment'; CategoryMonthComponent, TransactionResultComponent, SupplierResultComponent, + WardResultComponent, 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 1115f20..1af2da3 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.html +++ b/src/app/dashboard/more-graphs-and-tables.component.html @@ -1,4 +1,53 @@
+
+
+
+
+ List of Ward Transactions +
+
+ + + + + + + + + + + +
WardAmount of TransactionsSum of Transactions
+
+
+ No Data available. +
+
+
+
+
+
+
+
+
+

Blah

+
+
+ + + + + + + + + + + +
WardAmount of TransactionsSum of Transactions
+
+
+
diff --git a/src/app/dashboard/more-graphs-and-tables.component.ts b/src/app/dashboard/more-graphs-and-tables.component.ts index 3b702da..546a47f 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.ts +++ b/src/app/dashboard/more-graphs-and-tables.component.ts @@ -20,11 +20,14 @@ export class MoreStuffComponent implements OnInit { isBubbleChartLoaded:boolean = false; isLineChartLoaded:boolean = false; isSupplierChartLoaded:boolean = false; + wardList: any; + wardListAvailable = false; constructor( private api: ApiService, private currencyPipe: CurrencyPipe, ) { + this.tableSummary(); this.bubbleChartBegin = moment().format('YYYY-MM-DD'); this.bubbleChartEnd = moment().format('YYYY-MM-DD'); this.lineChartBegin = moment().format('YYYY-MM-DD'); @@ -178,6 +181,21 @@ export class MoreStuffComponent implements OnInit { return `${value.supplier}: ${this.currencyPipe.transform(value.value, 'GBP', 'symbol', '1.2-2')} over ${value.count} purchases`; } + private tableSummary() { + this.api.loadMiscUrl('organisation/external/lcc_tables').subscribe( + result => { + this.wardList = result.wards; + if (this.wardList) { + this.wardListAvailable = true; + } + }, + error => { + console.log('Retrieval Error'); + console.log( error._body ); + } + ) + } + private loadYearSpend() { this.api.loadMiscUrl('organisation/external/year_spend').subscribe( diff --git a/src/app/shared/ward-result.component.html b/src/app/shared/ward-result.component.html new file mode 100644 index 0000000..1d5246f --- /dev/null +++ b/src/app/shared/ward-result.component.html @@ -0,0 +1,3 @@ +{{ward.ward}} +{{ward.count}} +{{ward.sum | currency:'GBP':'symbol':'1.2-2' }} diff --git a/src/app/shared/ward-result.component.ts b/src/app/shared/ward-result.component.ts new file mode 100644 index 0000000..d147f1a --- /dev/null +++ b/src/app/shared/ward-result.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; + +interface WardData { + ward: string; + sum: number; + count: number; +} + +@Component({ + // tslint:disable-next-line + selector: '[ward-result]', + templateUrl: 'ward-result.component.html', +}) +export class WardResultComponent implements OnInit { + @Input() public ward: WardData; + + ngOnInit(): void { + } +}