Merge pull request #84 from Pear-Trading/hotfix-index

Icons and colours properly added for category list
This commit is contained in:
Finn 2018-06-18 12:15:38 +01:00 committed by GitHub
commit e7d2038041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View file

@ -53,15 +53,6 @@
] ]
}, },
"local": { "local": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [ "fileReplacements": [
{ {
"replace": "src/environments/environment.ts", "replace": "src/environments/environment.ts",

View file

@ -147,7 +147,7 @@
<ul class="icons-list"> <ul class="icons-list">
<!-- New loop --> <!-- New loop -->
<li *ngFor="let category of totalCategoryList | slice:0:totalCategoryLimit; let i=index"> <li *ngFor="let category of totalCategoryList | slice:0:totalCategoryLimit; let i=index">
<i [ngClass]="[ 'icon-question', 'bg-info']"></i> <i [ngClass]="['icon-' + category.icon, getBootstrapColour(i)]"></i>
<div class="desc"> <div class="desc">
<div class="title">{{ category.category || 'N/A' }}</div> <div class="title">{{ category.category || 'N/A' }}</div>
</div> </div>

View file

@ -25,6 +25,9 @@ export class DashboardCustomerComponent implements OnInit {
disableCategoryButton: boolean = false; disableCategoryButton: boolean = false;
public bootstrapColours: string[] = ['bg-primary', 'bg-secondary', 'bg-success',
'bg-danger', 'bg-warning', 'bg-info'];
public chartType = 'doughnut'; public chartType = 'doughnut';
public chartLegend = true; public chartLegend = true;
public doughnutChartDataCategory: any[] = []; public doughnutChartDataCategory: any[] = [];
@ -205,6 +208,10 @@ export class DashboardCustomerComponent implements OnInit {
this.totalCategoryLimit = 30; this.totalCategoryLimit = 30;
} }
public getBootstrapColour(index: number) {
return this.bootstrapColours[index % this.bootstrapColours.length];
}
public convertHex(hex: string, opacity: number) { public convertHex(hex: string, opacity: number) {
hex = hex.replace('#', ''); hex = hex.replace('#', '');
const r = parseInt(hex.substring(0, 2), 16); const r = parseInt(hex.substring(0, 2), 16);