From b2d2d5dbfaa9f5c49f066fa6f94a1d0db35adc40 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 18 Dec 2017 17:20:38 +0000 Subject: [PATCH 1/4] added initial looping --- .../dashboard-customer.component.html | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 5be3628..3d4b094 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -116,14 +116,26 @@
From 32f677c94e6cbab07a300101cec479fe5c8d046a Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 19 Dec 2017 18:01:29 +0000 Subject: [PATCH 2/4] frontpage sectors and week stats amended --- .../dashboard-customer.component.html | 144 +++--------------- .../dashboard/dashboard-customer.component.ts | 39 +++-- 2 files changed, 37 insertions(+), 146 deletions(-) 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

  • This Week - {{ (weekPurchaseList.week_0 || 0 ) }} ({{ (weekPurchaseList.week_0 || 0 ) / maxPurchase | percent:'1.0-0' }}) + {{ (weekPurchaseList.first || 0 ) }} + ({{ (weekPurchaseList.first || 0 ) / weekPurchaseList.max | percent:'1.0-0' }})
    + [style.width]="(weekPurchaseList.first || 0 ) / weekPurchaseList.max | percent:'1.0-0'" aria-valuemin="0" aria-valuemax="100">
  • 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 @@
      -
    • +
    • {{ sectorNames [sector] || 'N/A' }}
      @@ -127,84 +94,9 @@ {{ sectorPurchases[i] || 'N/A' }}
    • - - -
    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 { } } From 88a2a461912cd5f07f93e5cfaa7eabbc58a8a059 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Wed, 20 Dec 2017 12:32:23 +0000 Subject: [PATCH 3/4] added circles to snippets WARNING: They are a fixed size, therefore will spill content on larger numbers --- .../snippets/cust-snippet-bar.component.html | 18 +++++++++--------- src/scss/_custom.scss | 11 +++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/app/snippets/cust-snippet-bar.component.html b/src/app/snippets/cust-snippet-bar.component.html index 80a44ef..9c9647f 100644 --- a/src/app/snippets/cust-snippet-bar.component.html +++ b/src/app/snippets/cust-snippet-bar.component.html @@ -2,25 +2,25 @@ diff --git a/src/scss/_custom.scss b/src/scss/_custom.scss index 269a40a..de94c75 100644 --- a/src/scss/_custom.scss +++ b/src/scss/_custom.scss @@ -24,6 +24,17 @@ agm-map { width: 15%; } +// circle for text +.number-circle { + width:24%; + border-radius:50%; + text-align:center; + padding:12% 0; + line-height:0; + position:relative; + background: #20a8d8; + color: white; +} // white title font variant on type-2 as defined in _widgets.css .horizontal-bars { padding: 0; From f974ff669219931e04374e77fe42dcf20ead6a1f Mon Sep 17 00:00:00 2001 From: piratefinn Date: Wed, 20 Dec 2017 12:33:04 +0000 Subject: [PATCH 4/4] clarified a TODO in css --- src/scss/_custom.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scss/_custom.scss b/src/scss/_custom.scss index de94c75..c9858d6 100644 --- a/src/scss/_custom.scss +++ b/src/scss/_custom.scss @@ -25,6 +25,7 @@ agm-map { } // circle for text +// TODO: Make these resize based on inside content .number-circle { width:24%; border-radius:50%;