Add update to dashboard for widget graph types

This commit is contained in:
Tom Bloor 2017-09-07 13:32:59 +01:00
parent dd735e517e
commit 555675c313
3 changed files with 16 additions and 2 deletions

View file

@ -23,7 +23,11 @@
</div>
<div class="row">
<div *ngFor="let widget of widgetList" class="col-sm-6 col-lg-3">
<widget-graph *ngIf="widget.type == 'graph'" [graphName]="widget.name" [graphTitle]="widget.title" [graphIcon]="widget.icon"></widget-graph>
<widget-graph *ngIf="widget.type == 'graph'"
[graphName]="widget.name"
[graphTitle]="widget.title"
[graphIcon]="widget.icon"
[dataType]="widget.dataType"></widget-graph>
</div>
<div *ngIf="showGraph.noofcustomerssector" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-primary">

View file

@ -3,6 +3,7 @@ import { Http, Response } from '@angular/http';
import { ApiService } from '../providers/api-service';
import { Router } from '@angular/router';
import { GraphWidget } from '../widgets/graph-widget.component';
import { DataType } from '../shared/data-types.enum';
@Component({
templateUrl: 'dashboard.component.html'
@ -44,22 +45,26 @@ export class DashboardComponent implements OnInit {
name: 'sales_last_7_days',
icon: 'icon-diamond',
title: 'Sales Last 7 Days',
dataType: DataType.currency,
},
{
type: 'graph',
name: 'sales_last_30_days',
icon: 'icon-diamond',
title: 'Sales Last 30 Days',
dataType: DataType.currency,
},
{
type: 'graph',
name: 'purchases_last_7_days',
title: 'Purchases Last 7 Days',
dataType: DataType.currency,
},
{
type: 'graph',
name: 'purchases_last_30_days',
title: 'Purchases Last 30 Days',
dataType: DataType.currency,
},
];

View file

@ -4,6 +4,8 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ChartsModule } from 'ng2-charts/ng2-charts';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { CurrencyPipe } from '@angular/common';
import { DashboardComponent } from './dashboard.component';
import { DashboardCustomerComponent } from './dashboard-customer.component';
import { AccountEditComponent } from './account-edit.component';
@ -35,6 +37,9 @@ import { OrgTableComponent } from '../shared/org-table.component';
OrgTableComponent,
FeedbackComponent,
GraphWidget,
]
],
providers: [
CurrencyPipe
],
})
export class DashboardModule { }