diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 07d74ad..8821973 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -21,7 +21,9 @@ import { CustomerGuard } from './_guards/customer.guard';
import { ApiService } from './providers/api-service';
import { OrgGraphsService } from './providers/org-graphs.service';
+import { CustGraphsService } from './providers/cust-graphs.service';
import { OrgSnippetsService } from './providers/org-snippets.service';
+import { CustSnippetsService } from './providers/cust-snippets.service';
// Layouts
import { FullLayoutComponent } from './layouts/full-layout.component';
@@ -65,6 +67,8 @@ import { DashboardModule } from './dashboard/dashboard.module';
ApiService,
OrgGraphsService,
OrgSnippetsService,
+ CustGraphsService,
+ CustSnippetsService,
{
provide: LocationStrategy,
useClass: HashLocationStrategy
diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html
index 6a7c209..494c09a 100644
--- a/src/app/dashboard/dashboard-customer.component.html
+++ b/src/app/dashboard/dashboard-customer.component.html
@@ -1,131 +1,13 @@
-
-
-
-
+
-
-
-
-
{{ basicStats.today_sum | currency:'GBP':'symbol':'1.2-2' }}
-
Total Today
-
-
-
-
-
-
-
-
{{ basicStats.today_sum / (basicStats.today_count ? basicStats.today_count : 1) | currency:'GBP':'symbol':'1.2-2' }}
-
Avg. Spend Today
-
-
-
-
-
-
-
-
{{ basicStats.week_sum | currency:'GBP':'symbol':'1.2-2' }}
-
Last Week Total
-
-
-
-
-
-
-
-
{{ basicStats.week_sum / (basicStats.week_count ? basicStats.week_count : 1) | currency:'GBP':'symbol':'1.2-2' }}
-
Last Week Avg. Spend
-
-
-
-
-
-
-
-
{{ basicStats.month_sum | currency:'GBP':'symbol':'1.2-2' }}
-
Last Month Total
-
-
-
-
-
-
-
-
{{ basicStats.month_sum / (basicStats.month_count ? basicStats.month_count : 1) | currency:'GBP':'symbol':'1.2-2' }}
-
Last Month Avg. Spend
-
-
-
-
-
-
-
-
{{ basicStats.user_sum | currency:'GBP':'symbol':'1.2-2' }}
-
User Total
-
-
-
-
-
-
-
-
{{ basicStats.user_sum / (basicStats.user_count ? basicStats.user_count : 1) | currency:'GBP':'symbol':'1.2-2' }}
-
User Avg. Spend
-
-
-
+
+
+
diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts
index 39230e3..e80fb9f 100644
--- a/src/app/dashboard/dashboard-customer.component.ts
+++ b/src/app/dashboard/dashboard-customer.component.ts
@@ -2,6 +2,8 @@ import { Directive, Component, OnInit } from '@angular/core';
import { ApiService } from '../providers/api-service';
import { Router } from '@angular/router';
import { GraphWidget } from '../widgets/graph-widget.component';
+import { CustBarSnippetComponent } from '../snippets/cust-snippet-bar.component';
+import { DataType } from '../shared/data-types.enum';
@Component({
templateUrl: 'dashboard-customer.component.html'
@@ -20,32 +22,62 @@ export class DashboardCustomerComponent implements OnInit {
myRank: any;
username: any;
- basicStats = {
- today_sum: 0,
- today_count: 0,
- week_sum: 0,
- week_count: 0,
- month_sum: 0,
- month_count: 0,
- user_sum: 0,
- user_count: 0,
- global_sum: 0,
- global_count: 0,
- user_position: 0,
- };
+ public widgetList = [
+ {
+ type: 'graph',
+ name: 'total_today',
+ title: 'Total Today',
+ dataType: DataType.currency,
+ },
+ {
+ type: 'graph',
+ name: 'avg_spend_today',
+ title: 'Avg. Spend Today',
+ dataType: DataType.currency,
+ },
+ {
+ type: 'graph',
+ name: 'total_last_week',
+ icon: 'icon-diamond',
+ title: 'Last Week Total',
+ dataType: DataType.currency,
+ },
+ {
+ type: 'graph',
+ name: 'avg_spend_last_week',
+ icon: 'icon-diamond',
+ title: 'Last Week Avg. Spend',
+ dataType: DataType.currency,
+ },
+ {
+ type: 'graph',
+ name: 'total_last_month',
+ title: 'Last Month Total',
+ dataType: DataType.currency,
+ },
+ {
+ type: 'graph',
+ name: 'avg_spend_last_month',
+ title: 'Last Month Avg. Spend',
+ dataType: DataType.currency,
+ },
+ {
+ type: 'graph',
+ name: 'total_user',
+ title: 'User Total',
+ dataType: DataType.currency,
+ },
+ {
+ type: 'graph',
+ name: 'avg_spend_user',
+ title: 'User Avg. Spend',
+ dataType: DataType.currency,
+ },
+ ];
constructor(
private api: ApiService,
) {
- this.api.basicStats().subscribe(
- result => {
- this.basicStats = result;
- },
- error => {
- console.log('Retrieval Error');
- console.log( error._body );
- }
- );
}
ngOnInit(): void {
diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html
index 4ee858b..ff6f092 100644
--- a/src/app/dashboard/dashboard.component.html
+++ b/src/app/dashboard/dashboard.component.html
@@ -6,7 +6,8 @@
[graphName]="widget.name"
[graphTitle]="widget.title"
[graphIcon]="widget.icon"
- [dataType]="widget.dataType">
+ [dataType]="widget.dataType">
+