diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html
index f11d074..ef36d58 100644
--- a/src/app/dashboard/dashboard-customer.component.html
+++ b/src/app/dashboard/dashboard-customer.component.html
@@ -150,7 +150,7 @@
+
+
+
+
+
+
Monthly Spending by Category
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Weekly Purchase No.
+
+
+
+
+ -
+ This Week
+ {{ (weekPurchaseList.first || 0 ) }}
+ ({{ (weekPurchaseList.first || 0 ) / weekPurchaseList.max | percent:'1.0-0' }})
+
+
+ -
+ Last Week
+ {{ weekPurchaseList.second || 0 }}
+ ({{ (weekPurchaseList.second || 0 ) / weekPurchaseList.max | percent:'1.0-0' }})
+
+
+ -
+ Week Maximum
+ {{ weekPurchaseList.max || 0 }}
+ (100%)
+
+
+ -
+ Weekly Average
+ {{ (weekPurchaseList.sum / weekPurchaseList.count) || 0 | number:'1.0-0'}}
+ ({{ ((weekPurchaseList.sum / weekPurchaseList.count) || 0) / weekPurchaseList.max | percent:'1.0-0' }})
+
+
+
+
+
+
+
+
+
+
+
+
+
All Purchases by Category
+
+
+
+
+
+
+
+
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index cf7032e..c65263c 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/src/app/dashboard/dashboard.component.ts
@@ -1,8 +1,6 @@
import { Component } from '@angular/core';
import { Router, NavigationEnd } from "@angular/router";
import { CurrencyPipe } from '@angular/common';
-import { ChartOptions, ChartType, ChartDataSets } from 'chart.js';
-import { Color, Label } from 'ng2-charts';
import { GraphWidget } from '../widgets/graph-widget.component';
import { OrgBarSnippetComponent } from '../snippets/org-snippet-bar.component';
import { GraphPanel } from '../panels/graph-panel.component';
@@ -68,6 +66,7 @@ export class DashboardComponent {
public doughnutChartDataCategory: any[] = [];
public doughnutChartLabelsCategory: string[] = [];
+
public doughnutChartOptionsCategory:any = {
tooltips: {
callbacks: {
@@ -130,6 +129,12 @@ export class DashboardComponent {
public barChartDataCategory:any[]=[];
public barChartLabelsCategory:string[] = [];
+ public barChartDataCategoryAll:string = 'bar'
+ public barChartLegendCategoryAll:boolean = false;
+ public barChartDataCategoryAll:any[]=[];
+ public barChartLabelsCategoryAll:string[] = [];
+
+
public lineChartDataSector: ChartDataSets[] = [
{ data: [], label: '' },
];
@@ -238,6 +243,23 @@ export class DashboardComponent {
);
}
+ private setChartDataCat(dataCat: any) {
+ this.barChartLabelsCategoryAll = Object.keys(dataCat);
+ let barChartDataCategoryInitial = Object.keys(dataCat).map(key => dataCat[key]);
+ this.barChartDataCategoryAll = [
+ {data: barChartDataCategoryInitial, label: 'Series A'},
+ ];
+ this.showCategoryBarChart = true;
+ if (this.weekList1) {
+ let n = this.weekList1.map(function(a) {return a.value;});
+ this.doughnutChartDataCategory = [
+ {data: doughnutChartDataCategoryInitial, label: 'Series A'},
+ ];
+ // setTimeout is currently a workaround for ng2-charts labels
+ setTimeout(() => this.doughnutChartLabelsCategory = this.weekList1.map(function(a) {return a.category;}), 0);
+ this.showCategoryDoughnutChart = true;
+ }
+ }
private setChartDataCat(dataCat: any) {
this.barChartLabelsCategory = Object.keys(dataCat);
let barChartDataCategoryInitial = Object.keys(dataCat).map(key => dataCat[key]);
@@ -246,7 +268,7 @@ export class DashboardComponent {
];
this.showCategoryBarChart = true;
if (this.weekList1) {
- let doughnutChartDataCategoryInitial = this.weekList1.map(function(a) {return a.value;});
+ let n = this.weekList1.map(function(a) {return a.value;});
this.doughnutChartDataCategory = [
{data: doughnutChartDataCategoryInitial, label: 'Series A'},
];
@@ -260,7 +282,7 @@ export class DashboardComponent {
this.barChartLabelsCategory = Object.keys(dataSec);
let lineChartDataSectorInitial = Object.keys(dataSec).map(key => dataSec[key]);
this.lineChartDataSector = [
- {data: lineChartDataSectorInitial, label: 'Series A'},
+ {data: barChartDataCategoryInitial, label: 'Series A'},
];
this.showCategoryBarChart = true;
if (this.weekList1) {
diff --git a/src/app/dashboard/suppliers.component.html b/src/app/dashboard/suppliers.component.html
index fcf79dd..6dcdd54 100644
--- a/src/app/dashboard/suppliers.component.html
+++ b/src/app/dashboard/suppliers.component.html
@@ -1,33 +1,39 @@
+
diff --git a/src/scss/bootstrap/utilities/_spacing.scss b/src/scss/bootstrap/utilities/_spacing.scss
index c89816b..f428be0 100644
--- a/src/scss/bootstrap/utilities/_spacing.scss
+++ b/src/scss/bootstrap/utilities/_spacing.scss
@@ -26,7 +26,7 @@
// Some special margin utils
.m#{$infix}-auto { margin: auto !important; }
.mt#{$infix}-auto { margin-top: auto !important; }
- .mr#{$infix}-auto { margin-right: auto !important; }
+ .mr#{$infix}-auto { margin-right: 20px !important; }
.mb#{$infix}-auto { margin-bottom: auto !important; }
.ml#{$infix}-auto { margin-left: auto !important; }
.mx#{$infix}-auto {