diff --git a/src/app/dashboard/category-month.component.html b/src/app/dashboard/category-month.component.html index a1f0b30..e8c9dbc 100644 --- a/src/app/dashboard/category-month.component.html +++ b/src/app/dashboard/category-month.component.html @@ -1,6 +1,93 @@
-
+
+
+
+
+
+

Purchases this week

+
+
+
+
    +
  • + Placeholder Category + {{ (weekPurchaseList.first || 0 ) }} + ({{ (weekPurchaseList.first || 0 ) / weekPurchaseList.max | percent:'1.0-0' }}) +
    +
    +
    +
    +
    +
  • +
  • + +
  • +
+
+
+
+
+
+
+
+
+
+

Purchases this week

+
+
+
+
    +
  • + Placeholder Category + {{ (weekPurchaseList.first || 0 ) }} + ({{ (weekPurchaseList.first || 0 ) / weekPurchaseList.max | percent:'1.0-0' }}) +
    +
    +
    +
    +
    +
  • +
  • + +
  • +
+
+
+
+
+
+
+
+
+
+

Purchases this week

+
+
+
+
    +
  • + Placeholder Category + {{ (weekPurchaseList.first || 0 ) }} + ({{ (weekPurchaseList.first || 0 ) / weekPurchaseList.max | percent:'1.0-0' }}) +
    +
    +
    +
    +
    +
  • +
  • + +
  • +
+
+
+
+
+
diff --git a/src/app/dashboard/category-month.component.ts b/src/app/dashboard/category-month.component.ts index cf83e6d..74f267f 100644 --- a/src/app/dashboard/category-month.component.ts +++ b/src/app/dashboard/category-month.component.ts @@ -1,6 +1,8 @@ import { Directive, Component, OnInit } from '@angular/core'; import { ApiService } from '../providers/api-service'; import { DataType } from '../shared/data-types.enum'; +import * as moment from 'moment'; +import 'rxjs/add/operator/map'; @Component({ templateUrl: 'category-month.component.html' @@ -14,14 +16,22 @@ export class CategoryMonthComponent implements OnInit { }; categoryList: number[] = []; + dayList: any[] = []; + valueList: number[] = []; categoryLimitFirst: number = 10; + myWeek1: any; + myWeek2: any; + myWeek3: any; + myWeek4: any; constructor( private api: ApiService, ) { + this.setDate(); this.api.categoryTransactionList().subscribe( result => { console.log(result); + this.setData(result); }, error => { console.log('Retrieval Error'); @@ -30,11 +40,28 @@ export class CategoryMonthComponent implements OnInit { ); } - public loadMore () { + private loadMore () { this.disableCategoryButtonFirst = true; this.categoryLimitFirst = 100; } + private setDate () { + this.myWeek1 = moment().format('YYYY-MM-DD'); + this.myWeek2 = moment(this.myWeek1).subtract(1, 'weeks').format('YYYY-MM-DD'); + this.myWeek3 = moment(this.myWeek2).subtract(1, 'weeks').format('YYYY-MM-DD'); + this.myWeek4 = moment(this.myWeek3).subtract(1, 'weeks').format('YYYY-MM-DD'); + console.log(this.myWeek1); + console.log(this.myWeek2); + console.log(this.myWeek3); + console.log(this.myWeek4); + } + + private setData (data: any) { + // this.categoryList = Object.keys(data.data.category).map(key => data.data.category[key]); + // this.dayList = Object.keys(data.data.days).map(key => data.data.days[key]); + // this.valueList = Object.keys(data.data.value).map(key => data.data.value[key]); + } + ngOnInit(): void { } } diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index 54867f2..55f1b6a 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -168,7 +168,7 @@ export class DashboardCustomerComponent implements OnInit { this.sectorPurchases = Object.keys(data.purchases).map(key => data.purchases[key]); } - public loadMore () { + private loadMore () { this.disableSectorButton = true; this.sectorLimit = 22; }