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 d4b90309dd
3 changed files with 8 additions and 10 deletions

View file

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

View file

@ -147,7 +147,7 @@
<ul class="icons-list">
<!-- New loop -->
<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="title">{{ category.category || 'N/A' }}</div>
</div>

View file

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