Correction valeurs par défaut de la fourchette de prix
This commit is contained in:
parent
1f1c069bdd
commit
bd0b2dc230
@ -23,8 +23,8 @@
|
|||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
<p class="mb-1 fs-5 fw-semibold">Prix</p>
|
<p class="mb-1 fs-5 fw-semibold">Prix</p>
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<input #minNum id="numberMin" type="number" placeholder="min" min=0 value="" class="me-2" style="width: 45%;">
|
<input #minNum id="numberMin" type="number" placeholder="min" class="me-2" style="width: 45%;">
|
||||||
<input #maxNum id="numberMax" type="number" placeholder="max" value="" class="me-2" style="width: 45%;">
|
<input #maxNum id="numberMax" type="number" placeholder="max" class="me-2" style="width: 45%;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
|
@ -13,10 +13,16 @@ export class FilterSideBarComponent implements OnInit {
|
|||||||
@Output() reset = new EventEmitter();
|
@Output() reset = new EventEmitter();
|
||||||
filterStateNumber: number = 0;
|
filterStateNumber: number = 0;
|
||||||
public selectedCategory: string[];
|
public selectedCategory: string[];
|
||||||
|
public rangeArray: number[];
|
||||||
|
public minPrice : any;
|
||||||
|
public maxPrice : any;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.listCategories = [];
|
this.listCategories = [];
|
||||||
this.selectedCategory = [];
|
this.selectedCategory = [];
|
||||||
|
this.minPrice = 0;
|
||||||
|
this.maxPrice = 1000;
|
||||||
|
this.rangeArray = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -45,23 +51,31 @@ export class FilterSideBarComponent implements OnInit {
|
|||||||
this.filterStateNumber = stateNumber;
|
this.filterStateNumber = stateNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSendRating(): void {
|
onSendRating():void {
|
||||||
this.stateNumber.emit(this.filterStateNumber);
|
this.stateNumber.emit(this.filterStateNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
onSendValues(minNum: any, maxNum: any): void {
|
onSendValues(minNum: any, maxNum: any): void {
|
||||||
if (minNum.value == '') {
|
if (minNum.value == "") {
|
||||||
minNum.value = 0;
|
if (maxNum.value == "") {
|
||||||
|
this.rangeArray = [parseFloat(this.minPrice), parseFloat(this.maxPrice)];
|
||||||
|
this.rangeNumber.emit(this.rangeArray);
|
||||||
|
} else {
|
||||||
|
this.rangeArray = [parseFloat(this.minPrice), parseFloat(maxNum.value)];
|
||||||
|
this.rangeNumber.emit(this.rangeArray)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (maxNum.value == "") {
|
||||||
|
this.rangeArray = [parseFloat(minNum.value), parseFloat(this.maxPrice)];
|
||||||
|
this.rangeNumber.emit(this.rangeArray);
|
||||||
|
} else {
|
||||||
|
this.rangeArray = [parseFloat(minNum.value), parseFloat(maxNum.value)];
|
||||||
|
this.rangeNumber.emit(this.rangeArray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (maxNum.value == '') {
|
|
||||||
maxNum.value = 1000;
|
|
||||||
}
|
|
||||||
let rangeArray: number[] = [parseFloat(minNum.value), parseFloat(maxNum.value)];
|
|
||||||
this.rangeNumber.emit(rangeArray);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onReset(): void {
|
onReset(): void {
|
||||||
this.reset.emit();
|
this.reset.emit();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user