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 adc0a1a7db
commit e9b659a4bb
2 changed files with 2 additions and 46 deletions

View file

@ -164,34 +164,5 @@
</div> </div>
</div> </div>
</div><!--/.col--> </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><!--/.row-->
</div> </div>

View file

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