41 lines
904 B
JavaScript
41 lines
904 B
JavaScript
export class GestionnaireTaches {
|
|
constructor() {
|
|
this.taches = [];
|
|
}
|
|
|
|
ajouterTache(tache) {
|
|
this.taches.push(tache);
|
|
}
|
|
|
|
supprimerTache(tache) {
|
|
const index = this.taches.indexOf(tache);
|
|
if (index !== -1) {
|
|
this.taches.splice(index, 1);
|
|
} else {
|
|
console.error("Tâche non trouvée");
|
|
}
|
|
}
|
|
|
|
filtrerParMots(chaine) {
|
|
|
|
if (!chaine) return this.taches;
|
|
|
|
return this.taches.filter(tache =>
|
|
tache.contientMot(chaine));
|
|
}
|
|
|
|
filtrerParDate(dateDebut, dateFin) {
|
|
return this.taches.filter(tache =>
|
|
tache.estEntreDates(dateDebut, dateFin));
|
|
}
|
|
|
|
afficherToutes() {
|
|
this.taches.forEach(tache =>
|
|
tache.afficher()
|
|
);
|
|
}
|
|
|
|
compterTaches(taches) {
|
|
return taches.length;
|
|
}
|
|
} |