Removed sector stuff on dashboard

To be moved to organisation dashboard at later time
This commit is contained in:
piratefinn 2018-05-22 12:57:25 +01:00
parent 4d56dcb233
commit 9b56cf77f9
2 changed files with 2 additions and 46 deletions

View file

@ -164,34 +164,5 @@
</div>
</div>
</div><!--/.col-->
<div class="col-xl-6">
<div class="card">
<div class="card-block">
<div class="row">
<div class="col-12">
<h4 class="card-title float-left mb-0">All Purchases by Sector</h4>
</div><!--/.col-->
</div><!--/.row-->
<div class="chart-wrapper">
<ul class="icons-list">
<!-- New loop -->
<li *ngFor="let sector of sectorLetters | slice:0:sectorLimit; let i=index">
<i [ngClass]="[sectorIcons [sector] || 'icon-question', sectorClasses [sector] || 'bg-info']"></i>
<div class="desc">
<div class="title">{{ sectorNames [sector] || 'N/A' }}</div>
</div>
<div class="value">
<div class="small text-muted">Bought</div>
<strong>{{ sectorPurchases[i] || 'N/A' }}</strong>
</div>
</li>
<li *ngIf="sectorLetters.length > sectorLimit && disableSectorButton == false" class="divider text-center">
<button type="button" class="btn btn-sm btn-link text-muted" (click)="sectorLoadMore()"><i class="icon-options"></i></button>
</li>
</ul>
</div>
</div>
</div>
</div><!--/.col-->
</div><!--/.row-->
</div>

View file

@ -23,7 +23,6 @@ export class DashboardCustomerComponent implements OnInit {
username: any;
maxPurchase: number = 0;
disableSectorButton: boolean = false;
disableCategoryButton: boolean = false;
public chartType = 'doughnut';
@ -173,12 +172,9 @@ export class DashboardCustomerComponent implements OnInit {
U: 'bg-primary',
}
sectorLetters: string[] = [];
sectorPurchases: number[] = [];
sectorLimit: number = 10;
showTotalCategoryList: boolean = false;
totalCategoryLimit: number = 10;
totalCategoryList: any;
sectorList: any;
// Graph widgets
public widgetList = [
@ -218,11 +214,10 @@ export class DashboardCustomerComponent implements OnInit {
this.api.customerStats().subscribe(
result => {
this.setWeekPurchaseList(result.weeks);
this.setSectorList(result.sectors);
this.setWeekData(result);
this.setChartData(result.data.cat_total);
this.totalCategoryList = result.data.cat_list;
console.log(this.totalCategoryList);
this.showTotalCategoryList = true;
this.purchaseEssential = result.data.essentials.purchase_no_essential_total;
this.purchaseNotEssential = result.data.essentials.purchase_no_total - this.purchaseEssential;
this.barChartDataEssential = [
@ -277,16 +272,6 @@ export class DashboardCustomerComponent implements OnInit {
};
}
public setSectorList (data: any) {
this.sectorLetters = Object.keys(data.sectors).map(key => data.sectors[key]);
this.sectorPurchases = Object.keys(data.purchases).map(key => data.purchases[key]);
}
private sectorLoadMore () {
this.disableSectorButton = true;
this.sectorLimit = 22;
}
private categoryLoadMore () {
this.disableCategoryButton = true;
this.totalCategoryLimit = 30;