From f0ed1e9369a2ef464bcc08cbc2b59918dff68910 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 7 Sep 2017 16:02:29 +0100 Subject: [PATCH] Update snippets to use new snippets api and dataset --- .../snippets/org-snippet-bar.component.html | 10 +++--- src/app/snippets/org-snippet-bar.component.ts | 34 ++++++++++++++----- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/app/snippets/org-snippet-bar.component.html b/src/app/snippets/org-snippet-bar.component.html index 92c6f9a..e1e76ef 100644 --- a/src/app/snippets/org-snippet-bar.component.html +++ b/src/app/snippets/org-snippet-bar.component.html @@ -3,19 +3,19 @@ diff --git a/src/app/snippets/org-snippet-bar.component.ts b/src/app/snippets/org-snippet-bar.component.ts index a545202..76a47ab 100644 --- a/src/app/snippets/org-snippet-bar.component.ts +++ b/src/app/snippets/org-snippet-bar.component.ts @@ -7,10 +7,19 @@ import { OrgSnippetsService } from '../providers/org-snippets.service'; }) export class OrgBarSnippetComponent implements OnInit { - public customersThisMonth = 0; - public moneySpentThisMonth = 0; - public pointsTotal = 0; - public averageTransactionToday = 0; + public thisMonthSalesCount = 0; + public thisMonthSalesTotal = 0; + public thisWeekSalesCount = 0; + public thisWeekSalesTotal = 0; + public todaySalesCount = 0; + public todaySalesTotal = 0; + + public thisMonthPurchasesCount = 0; + public thisMonthPurchasesTotal = 0; + public thisWeekPurchasesCount = 0; + public thisWeekPurchasesTotal = 0; + public todayPurchasesCount = 0; + public todayPurchasesTotal = 0; constructor( private snippetsService: OrgSnippetsService, @@ -20,10 +29,19 @@ export class OrgBarSnippetComponent implements OnInit { this.snippetsService.getData() .subscribe( result => { - this.customersThisMonth = result.snippets.this_month_customer_count; - this.moneySpentThisMonth = result.snippets.this_month_customer_spend; - this.pointsTotal = result.snippets.pear_points_total; - this.averageTransactionToday = result.snippets.today_sales_average; + this.thisMonthSalesCount = result.snippets.this_month_sales_count; + this.thisMonthSalesTotal = result.snippets.this_month_sales_total; + this.thisWeekSalesCount = result.snippets.this_week_sales_count; + this.thisWeekSalesTotal = result.snippets.this_week_sales_total; + this.todaySalesCount = result.snippets.today_sales_count; + this.todaySalesTotal = result.snippets.today_sales_total; + + this.thisMonthPurchasesCount = result.snippets.this_week_purchases_count; + this.thisMonthPurchasesTotal = result.snippets.this_week_purchases_total; + this.thisWeekPurchasesCount = result.snippets.this_month_purchases_count; + this.thisWeekPurchasesTotal = result.snippets.this_month_purchases_total; + this.todayPurchasesCount = result.snippets.today_purchases_count; + this.todayPurchasesTotal = result.snippets.today_purchases_total; } ); }