diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 3d4b094..697c23c 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -19,85 +19,52 @@
-

Purchases Per Week

+

Purchases by Week

  • Last Week - {{ weekPurchaseList.week_1 || 0 }} ({{ (weekPurchaseList.week_1 || 0 ) / maxPurchase | percent:'1.0-0' }}) + {{ weekPurchaseList.second || 0 }} + ({{ (weekPurchaseList.second || 0 ) / weekPurchaseList.max | percent:'1.0-0' }})
    + [style.width]="(weekPurchaseList.second || 0 ) / weekPurchaseList.max | percent:'1.0-0'" aria-valuemin="0" aria-valuemax="100">
  • - 2 Weeks Ago - {{ weekPurchaseList.week_2 || 0 }} ({{ (weekPurchaseList.week_2 || 0 ) / maxPurchase | percent:'1.0-0' }}) + Week Maximum + {{ weekPurchaseList.max || 0 }} + (100%)
    + style="width: 100%" aria-valuemin="0" aria-valuemax="100">
  • - 3 Weeks Ago - {{ weekPurchaseList.week_3 || 0 }} ({{ (weekPurchaseList.week_3 || 0 ) / maxPurchase | percent:'1.0-0' }}) + Weekly Average + {{ (weekPurchaseList.sum / weekPurchaseList.count) || 0 | number:'1.0-0'}} + ({{ ((weekPurchaseList.sum / weekPurchaseList.count) || 0) / weekPurchaseList.max | percent:'1.0-0' }})
    -
    -
    -
  • -
  • - 4 Weeks Ago - {{ weekPurchaseList.week_4 || 0 }} ({{ (weekPurchaseList.week_4 || 0 ) / maxPurchase | percent:'1.0-0' }}) -
    -
    -
    -
    -
    -
  • -
  • - 5 Weeks Ago - {{ weekPurchaseList.week_5 || 0 }} ({{ (weekPurchaseList.week_5 || 0 ) / maxPurchase | percent:'1.0-0' }}) -
    -
    -
    -
    -
    -
  • -
  • - 6 Weeks Ago - {{ weekPurchaseList.week_6 || 0 }} ({{ (weekPurchaseList.week_6 || 0 ) / maxPurchase | percent:'1.0-0' }}) -
    -
    -
    + [style.width]="((weekPurchaseList.sum / weekPurchaseList.count) || 0) / weekPurchaseList.max | percent:'1.0-0'" aria-valuemin="0" aria-valuemax="100">
  • @@ -117,7 +84,7 @@
    diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index 832fbac..1d9b145 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -20,14 +20,14 @@ export class DashboardCustomerComponent implements OnInit { username: any; maxPurchase: number = 0; + disableSectorButton: boolean = false; + weekPurchaseList = { - week_0: 0, - week_1: 0, - week_2: 0, - week_3: 0, - week_4: 0, - week_5: 0, - week_6: 0, + first: 0, + second: 0, + max: 0, + sum: 0, + count: 0, }; sectorNames = { @@ -75,11 +75,12 @@ export class DashboardCustomerComponent implements OnInit { R: 'icon-film', S: 'icon-calendar', T: 'icon-home', - U: 'cion-globe', + U: 'icon-globe', } sectorLetters: string[] = []; sectorPurchases: number[] = []; + sectorLimit: number = 10; sectorList: any; @@ -130,19 +131,12 @@ export class DashboardCustomerComponent implements OnInit { public setWeekPurchaseList (data: any) { this.weekPurchaseList = { - week_0: data.purchases[0], - week_1: data.purchases[1], - week_2: data.purchases[2], - week_3: data.purchases[3], - week_4: data.purchases[4], - week_5: data.purchases[5], - week_6: data.purchases[6], + first: data.first, + second: data.second, + max: data.max, + sum: data.sum, + count: data.count, }; - this.maxPurchase = Object.keys(this.weekPurchaseList).map(key => this.weekPurchaseList[key]).reduce((a,b) => { - if (! a) { a = 0 } - if (! b) { b = 0 } - return Math.max(a,b); - }); } public setSectorList (data: any) { @@ -150,6 +144,11 @@ export class DashboardCustomerComponent implements OnInit { this.sectorPurchases = Object.keys(data.purchases).map(key => data.purchases[key]); } + public loadMore () { + this.disableSectorButton = true; + this.sectorLimit = 22; + } + ngOnInit(): void { } }