Merge branch 'hidedashbox' into finn/CoreUI

This commit is contained in:
piratefinn 2017-07-05 10:07:06 +01:00
commit 2e1439f435
3 changed files with 22 additions and 6 deletions

View file

@ -22,7 +22,7 @@
</div>
</div>
<div class="row">
<div class="col-sm-6 col-lg-3">
<div *ngIf="showGraph.customersthisweekgraph" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-primary">
<div class="card-block pb-0">
<div class="btn-group float-right" dropdown>
@ -51,7 +51,7 @@
</div>
</div>
</div><!--/.col-->
<div class="col-sm-6 col-lg-3">
<div *ngIf="showGraph.customerslastweekgraph" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-info">
<div class="card-block pb-0">
<button type="button" class="btn btn-transparent p-0 float-right">
@ -73,7 +73,7 @@
</div>
</div>
</div><!--/.col-->
<div class="col-sm-6 col-lg-3">
<div *ngIf="showGraph.pointsthisweekgraph" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-warning">
<div class="card-block pb-0">
<div class="btn-group float-right">
@ -102,7 +102,7 @@
</div>
</div>
</div><!--/.col-->
<div class="col-sm-6 col-lg-3">
<div *ngIf="showGraph.pointslastweekgraph" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-danger">
<div class="card-block pb-0">
<div class="btn-group float-right" dropdown>

View file

@ -16,6 +16,7 @@ export class DashboardComponent implements OnInit {
pointsTotal: any;
averageTransactionToday: any;
shuffledArray: any;
showGraph;
constructor(
private http: Http,
@ -26,15 +27,21 @@ export class DashboardComponent implements OnInit {
.subscribe(
result => {
console.log(result);
// Return what graphs to show
this.showGraph = result.graphstoshow;
// Chart 1
this.customersThisWeek = result.customersthisweek;
this.lineChart1Data[0].data = this.customersThisWeek.customerno;
this.lineChart1Labels = this.customersThisWeek.day;
// Chart 2
this.customersLastWeek = result.customerslastweek;
this.lineChart2Data[0].data = this.customersLastWeek.customerno;
this.lineChart2Labels = this.customersLastWeek.day;
// Chart 3
this.pointsThisWeek = result.pointsthisweek;
this.lineChart3Data[0].data = this.pointsThisWeek.points;
this.lineChart3Labels = this.pointsThisWeek.day;
// Chart 4
this.pointsLastWeek = result.pointslastweek;
this.barChart1Data[0].data = this.pointsLastWeek.points;
this.barChart1Labels = this.pointsLastWeek.day;

View file

@ -93,15 +93,24 @@ export class ApiService {
"moneyspentthismonth" : 156.02,
"pointstotal" : 506,
"averagetransactiontoday" : 3.69
}
}
)
}
// Fake chart data to mimic
public graph_data(data) {
return Observable.of(
{
// graphstoshow is on server and changes every hour, listing what graphs to display
"graphstoshow" :
{
customersthisweekgraph : true,
customerslastweekgraph : false,
pointsthisweekgraph : true,
pointslastweekgraph : false,
},
"customersthisweek" :
{
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],