diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cb6a52..4fb614e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ # Next Release +# v0.1.0 + +* Changed Story Trail choosing to modals +* Revamped snippets and graph widgets on customer dashboard +* Added local purchase pie chart for customer dashboard +* Added week by week purchase list for customer dashboard +* Added sector purchase amount list for customer dashboard +* Added sector U to available ones +* Fixed snippet layout + # v0.0.7 * Added ESTA to Story Trail diff --git a/package-lock.json b/package-lock.json index d9f03df..4438a01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "localloop-web", - "version": "0.0.7", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bb4c050..b2811a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "localloop-web", - "version": "0.0.7", + "version": "0.1.0", "description": "LocalLoop Web - Web interface for LocalLoop app", "author": "", "url": "http://www.peartrade.org", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 07d74ad..0f257e7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -21,7 +21,10 @@ 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'; +import { CustPiesService } from './providers/cust-pies.service'; // Layouts import { FullLayoutComponent } from './layouts/full-layout.component'; @@ -65,6 +68,9 @@ import { DashboardModule } from './dashboard/dashboard.module'; ApiService, OrgGraphsService, OrgSnippetsService, + CustGraphsService, + CustSnippetsService, + CustPiesService, { provide: LocationStrategy, useClass: HashLocationStrategy diff --git a/src/app/auth/register.component.html b/src/app/auth/register.component.html index 34c50ca..0983b97 100644 --- a/src/app/auth/register.component.html +++ b/src/app/auth/register.component.html @@ -106,6 +106,7 @@ + diff --git a/src/app/dashboard/account-edit.component.html b/src/app/dashboard/account-edit.component.html index 5d4e7b4..9c6ed5c 100644 --- a/src/app/dashboard/account-edit.component.html +++ b/src/app/dashboard/account-edit.component.html @@ -99,6 +99,7 @@ + Alter this if your business sector has changed. diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 6a7c209..ab19c9b 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -1,129 +1,104 @@
-
- - -
+
-
-
+
+ + +
+
+
+
+ +
+
+
-
{{ basicStats.today_sum | currency:'GBP':'symbol':'1.2-2' }}
-
Total Today
- +
+
+
    +
  • + 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' }}) +
    +
    +
    +
    +
    +
  • +
- Lorem ipsum dolor sit amet enim. -->
-
-
+
+
-
{{ basicStats.today_sum / (basicStats.today_count ? basicStats.today_count : 1) | currency:'GBP':'symbol':'1.2-2' }}
-
Avg. Spend Today
- +
+
+
    + +
  • + +
    +
    {{ sectorNames [sector] || 'N/A' }}
    +
    +
    +
    Bought
    + {{ sectorPurchases[i] || 'N/A' }} +
    +
  • +
  • + +
  • +
- Lorem ipsum dolor sit amet enim. --> -
-
-
-
-
-
-
{{ 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..54867f2 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -2,15 +2,14 @@ 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 { PiePanel } from '../panels/pie-panel.component'; +import { DataType } from '../shared/data-types.enum'; @Component({ templateUrl: 'dashboard-customer.component.html' }) export class DashboardCustomerComponent implements OnInit { - customersThisMonth: any; - moneySpentThisMonth: any; - pointsTotal: any; - averageTransactionToday: any; /* Setting up dashboard's main variables*/ name: any; @@ -19,27 +18,133 @@ export class DashboardCustomerComponent implements OnInit { trends: any; myRank: any; username: any; + maxPurchase: number = 0; - 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, + disableSectorButton: boolean = false; + + weekPurchaseList = { + first: 0, + second: 0, + max: 0, + sum: 0, + count: 0, }; + sectorNames = { + A: 'Agriculture, Forestry & Fishing', + B: 'Mining & Quarrying', + C: 'Manufacturing', + D: 'Electricity, Gas, Steam & Air Conditioning', + E: 'Water & Waste Management', + F: 'Construction', + G: 'Wholesale & Retail Trade', + H: 'Transportation & Storage', + I: 'Accomodation & Food Services', + J: 'Information & Communication', + K: 'Financial & Insurance Activities', + L: 'Real Estate', + M: 'Professional, Scientfic & Technical', + N: 'Administrative & Support Services', + O: 'Public Administration, Defence & Social Security', + P: 'Education', + Q: 'Human Health & Social Work', + R: 'Arts, Entertainment & Recreation', + S: 'Other Service Activities', + T: 'Household Domestic Business', + U: 'Extraterritorial Organisations and Bodies' + } + + sectorIcons = { + A: 'icon-drop', + B: 'icon-diamond', + C: 'icon-settings', + D: 'icon-energy', + E: 'icon-trash', + F: 'icon-wrench', + G: 'icon-tag', + H: 'icon-speedometer', + I: 'icon-cup', + J: 'icon-feed', + K: 'icon-credit-card', + L: 'icon-graph', + M: 'icon-chemistry', + N: 'icon-drawer', + O: 'icon-pie-chart', + P: 'icon-graduation', + Q: 'icon-support', + R: 'icon-film', + S: 'icon-calendar', + T: 'icon-home', + U: 'icon-globe', + } + + sectorClasses = { + A: 'bg-primary', + B: 'bg-success', + C: 'bg-danger', + D: 'bg-warning', + E: 'bg-info', + F: 'bg-primary', + G: 'bg-success', + H: 'bg-danger', + I: 'bg-warning', + J: 'bg-info', + K: 'bg-primary', + L: 'bg-success', + M: 'bg-danger', + N: 'bg-warning', + O: 'bg-info', + P: 'bg-primary', + Q: 'bg-success', + R: 'bg-danger', + S: 'bg-warning', + T: 'bg-info', + U: 'bg-primary', + } + + sectorLetters: string[] = []; + sectorPurchases: number[] = []; + sectorLimit: number = 10; + + sectorList: any; + + // Graph widgets + public widgetList = [ + { + 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, + }, + ]; + constructor( private api: ApiService, ) { - this.api.basicStats().subscribe( + this.api.customerStats().subscribe( result => { - this.basicStats = result; + this.setWeekPurchaseList(result.weeks); + this.setSectorList(result.sectors); }, error => { console.log('Retrieval Error'); @@ -48,6 +153,26 @@ export class DashboardCustomerComponent implements OnInit { ); } + public setWeekPurchaseList (data: any) { + this.weekPurchaseList = { + first: data.first, + second: data.second, + max: data.max, + sum: data.sum, + count: data.count, + }; + } + + public setSectorList (data: any) { + this.sectorLetters = Object.keys(data.sectors).map(key => data.sectors[key]); + this.sectorPurchases = Object.keys(data.purchases).map(key => data.purchases[key]); + } + + public loadMore () { + this.disableSectorButton = true; + this.sectorLimit = 22; + } + 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"> +
diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index 0e5302b..d6fcfca 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -23,7 +23,9 @@ import { TrailMapComponent } from './trail-map.component'; import { GraphWidget } from '../widgets/graph-widget.component'; import { OrgBarSnippetComponent } from '../snippets/org-snippet-bar.component'; +import { CustBarSnippetComponent } from '../snippets/cust-snippet-bar.component'; import { GraphPanel } from '../panels/graph-panel.component'; +import { PiePanel } from '../panels/pie-panel.component'; import { DashboardRoutingModule } from './dashboard.routing'; import { OrgResultComponent } from '../shared/org-result.component'; @@ -69,7 +71,9 @@ import { environment } from '../../environments/environment'; FeedbackComponent, GraphWidget, OrgBarSnippetComponent, + CustBarSnippetComponent, GraphPanel, + PiePanel, ], providers: [ CurrencyPipe, diff --git a/src/app/dashboard/leaderboard.component.html b/src/app/dashboard/leaderboard.component.html index 34345f3..c5014ea 100644 --- a/src/app/dashboard/leaderboard.component.html +++ b/src/app/dashboard/leaderboard.component.html @@ -23,8 +23,8 @@ Position - Value - Purchase Time + Name + Amount diff --git a/src/app/dashboard/trail-map.component.html b/src/app/dashboard/trail-map.component.html index 7e0f811..e2d3c53 100644 --- a/src/app/dashboard/trail-map.component.html +++ b/src/app/dashboard/trail-map.component.html @@ -4,11 +4,39 @@
Story Trail - Click a marker to get location details. - +
+ +
+ Select a Story Trail to see all the businesses in that story on the map.
+ Click an icon on the map to get more information.
+
+
+ +
+
+ + + + +