Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 1x 4x 4x 4x 4x 4x 4x 4x 5x 5x 5x 5x 1x 1x 1x 1x 1x 24x 1x | import { Component, OnInit } from '@angular/core'; import { Tache, TacheService } from '../tache.service'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { UtilisateurService } from '../utilisateur.service'; import { ProjetService } from '../projet.service'; @Component({ selector: 'app-tache', standalone: true, imports: [CommonModule, FormsModule], templateUrl: './tache.component.html', styleUrls: ['./tache.component.css'], }) export class TacheComponent implements OnInit { taches: Tache[] = []; nouvelleTache: Tache = { titre: '', description: '', dateDebut: '', dateFin: '', statut: 'A_FAIRE', utilisateurId: 1, projetId: 1, }; constructor( private tacheService: TacheService, private utilisateurService: UtilisateurService, private projetService: ProjetService ) {} utilisateurs: any[] = []; projets: any[] = []; ngOnInit(): void { this.chargerTaches(); this.utilisateurService .getUtilisateurs() .subscribe((data) => (this.utilisateurs = data)); this.projetService.getProjets().subscribe((data) => (this.projets = data)); } chargerTaches(): void { this.tacheService.getAllTaches().subscribe((data) => (this.taches = data)); } ajouterTache(): void { Iif (this.nouvelleTache.id) { this.tacheService .updateTache(this.nouvelleTache.id, this.nouvelleTache) .subscribe(() => { this.chargerTaches(); this.resetFormulaire(); }); } else { this.tacheService.addTache(this.nouvelleTache).subscribe(() => { this.chargerTaches(); this.resetFormulaire(); }); } } supprimerTache(id: number): void { this.tacheService.deleteTache(id).subscribe(() => this.chargerTaches()); } getTachesParStatut(statut: string): Tache[] { return this.taches.filter((t) => t.statut === statut); } modifierTache(tache: Tache): void { this.nouvelleTache = { ...tache, utilisateurId: tache.utilisateurAssigne?.id ?? 1, projetId: tache.projet?.id ?? 1, }; } resetFormulaire(): void { this.nouvelleTache = { titre: '', description: '', dateDebut: '', dateFin: '', statut: 'A_FAIRE', utilisateurId: 1, projetId: 1, }; } } |