Commit Rating (Julian)
This commit is contained in:
parent
2225415f75
commit
cf65a3a258
|
@ -1,5 +1,5 @@
|
|||
<div class="d-flex align-items-stretch">
|
||||
<app-filter-side-bar [listCategories]="listCategoriesFilter"></app-filter-side-bar>
|
||||
<app-filter-side-bar [listCategories]="listCategoriesFilter" (stateNumber)=onRatingFilter($event)></app-filter-side-bar>
|
||||
|
||||
<div class="custom-main container p-3">
|
||||
<input class="form-control"
|
||||
|
|
|
@ -9,10 +9,12 @@ import * as _ from 'underscore';
|
|||
})
|
||||
export class PageAccueilComponent implements OnInit {
|
||||
public listData: any[];
|
||||
public listRate: any[];
|
||||
public listCategoriesFilter: string[];
|
||||
|
||||
constructor(private plantouneService: PlantouneService) {
|
||||
this.listData = [];
|
||||
this.listRate = [];
|
||||
this.listCategoriesFilter = [];
|
||||
}
|
||||
|
||||
|
@ -54,6 +56,7 @@ export class PageAccueilComponent implements OnInit {
|
|||
this.listCategoriesFilter = listUniqJsCategories;
|
||||
this.listData = listPlant;
|
||||
this.listData.length = 9;
|
||||
console.log(this.listData);
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -62,4 +65,15 @@ export class PageAccueilComponent implements OnInit {
|
|||
this.plantouneService.plantLiked$.next('')
|
||||
}
|
||||
|
||||
onRatingFilter(stateNumber: number): void {
|
||||
console.log(stateNumber);
|
||||
this.listData.forEach(product => {
|
||||
if(product.product_rating >= stateNumber) {
|
||||
this.listRate.push(product);
|
||||
}
|
||||
});
|
||||
this.listData = this.listRate;
|
||||
console.log(this.listData);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue