Update snippets to use new snippets api and dataset
This commit is contained in:
parent
a0e077852d
commit
f0ed1e9369
2 changed files with 31 additions and 13 deletions
|
@ -3,19 +3,19 @@
|
|||
<ul>
|
||||
<li class="hidden-sm-down">
|
||||
<div class="text-muted">Customers This Month</div>
|
||||
<strong>{{customersThisMonth}}</strong>
|
||||
<strong>{{ thisMonthSalesCount }}</strong>
|
||||
</li>
|
||||
<li class="hidden-sm-down">
|
||||
<div class="text-muted">Money Spent This Month</div>
|
||||
<strong>{{moneySpentThisMonth | currency:'GBP':true:'1.2-2'}}</strong>
|
||||
<strong>{{ thisMonthPurchasesTotal | currency:'GBP':true:'1.2-2'}}</strong>
|
||||
</li>
|
||||
<li class="hidden-sm-down">
|
||||
<div class="text-muted">Points Total</div>
|
||||
<strong>{{pointsTotal}}</strong>
|
||||
<div class="text-muted">Customers Today</div>
|
||||
<strong>{{ todaySalesCount }}</strong>
|
||||
</li>
|
||||
<li class="hidden-sm-down">
|
||||
<div class="text-muted">Average Transaction Today</div>
|
||||
<strong>{{averageTransactionToday | currency:'GBP':true:'1.2-2'}}</strong>
|
||||
<strong>{{ ( todaySalesTotal / todaySalesCount ) || 0 | currency:'GBP':true:'1.2-2'}}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Reference in a new issue