Recup info des etoiles sous forme de nombre
This commit is contained in:
parent
2225415f75
commit
bc93c272d4
4 changed files with 298 additions and 2 deletions
|
@ -7,6 +7,7 @@ import { Component, OnInit } from '@angular/core';
|
||||||
})
|
})
|
||||||
export class AvisBarComponent implements OnInit {
|
export class AvisBarComponent implements OnInit {
|
||||||
starStates: {stateSelectedUser : boolean, stateHoverUser : boolean}[];
|
starStates: {stateSelectedUser : boolean, stateHoverUser : boolean}[];
|
||||||
|
starStateNumber: number = 0;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.starStates = [];
|
this.starStates = [];
|
||||||
|
@ -50,13 +51,16 @@ export class AvisBarComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickStar(starIndex: number) {
|
onClickStar(starIndex: number) {
|
||||||
|
this.starStateNumber = 0;
|
||||||
for (let i = 0; i < this.starStates.length ; i++) {
|
for (let i = 0; i < this.starStates.length ; i++) {
|
||||||
if(i <= starIndex) {
|
if(i <= starIndex) {
|
||||||
this.starStates[i].stateSelectedUser = true;
|
this.starStates[i].stateSelectedUser = true;
|
||||||
|
this.starStateNumber++;
|
||||||
} else {
|
} else {
|
||||||
this.starStates[i].stateSelectedUser = false;
|
this.starStates[i].stateSelectedUser = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//console.log(`Rating : ${this.starStateNumber}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
{{ category }}
|
{{ category }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="listCategories.length == 0 ">S
|
<div *ngIf="listCategories.length == 0 ">
|
||||||
Aucune catégorie disponible
|
Aucune catégorie disponible
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
<div class="flex-column justify-content-start">
|
<div class="flex-column justify-content-start">
|
||||||
<app-avis-bar></app-avis-bar>
|
<app-avis-bar></app-avis-bar>
|
||||||
<a href="#" class="btn btn-success me-2">Valider</a>
|
<button class="btn btn-success me-2" (click)="onSendRating()">Valider</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -15,4 +15,8 @@ export class FilterSideBarComponent implements OnInit {
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSendRating():void {
|
||||||
|
console.log("coucou");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue