Commit 6dafc61a authored by Julien's avatar Julien
Browse files

adding filter for type of vehicules

parent ee95d498
......@@ -117,7 +117,10 @@ export class HomeComponent implements OnInit {
.queryFlex({
id: this.selectedAgence.id,
startDate: startDate.startOf('d').toJSON(),
endDate: endDate.endOf('d').toJSON(),
endDate: endDate
.add(1, 'd')
.startOf('d')
.toJSON(),
nbJours: nbDays
})
.subscribe(vehicules => {
......@@ -126,7 +129,30 @@ export class HomeComponent implements OnInit {
} else {
this.vehicules = vehicules.body;
}
this.queryVehicules = this.vehicules;
// this.queryVehicules = this.vehicules;
const type = (<HTMLInputElement>$('#inputType')[0]).value;
if (type === 'Voiture') {
this.queryVehicules = [];
for (const vehicule of this.vehicules) {
if (vehicule.voiture !== null) {
this.queryVehicules.push(vehicule);
}
}
} else if (type === 'Scooter') {
this.queryVehicules = [];
for (const vehicule of this.vehicules) {
if (vehicule.scooter !== null) {
this.queryVehicules.push(vehicule);
}
}
} else if (type === 'Velo') {
this.queryVehicules = [];
for (const vehicule of this.vehicules) {
if (vehicule.velo !== null) {
this.queryVehicules.push(vehicule);
}
}
}
});
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment