From 766414f17a897a93f76d141492d45da9cc73fbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Sun, 9 Aug 2020 14:34:27 +0200 Subject: [PATCH] =?UTF-8?q?Redirection=20vers=20la=20page=20de=20la=20nouv?= =?UTF-8?q?elle=20formation=20lors=20de=20sa=20cr=C3=A9ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/formations/formations.component.ts | 26 ------------------ .../new-formation/new-formation.component.ts | 6 ++--- src/app/home/home-rh/home-rh.component.html | 10 +++---- src/app/home/home-rh/home-rh.component.ts | 27 ++----------------- 4 files changed, 9 insertions(+), 60 deletions(-) diff --git a/src/app/formations/formations.component.ts b/src/app/formations/formations.component.ts index 8e98ade..a2cf154 100644 --- a/src/app/formations/formations.component.ts +++ b/src/app/formations/formations.component.ts @@ -59,7 +59,6 @@ export class FormationsComponent implements OnInit { initFormations(formations:FormationModel[]) { this.formationsDisponibles = []; - console.log(formations); let formationDisplay : DisplayFormation; for(let formation of formations) { formationDisplay = new DisplayFormation(); @@ -71,9 +70,6 @@ export class FormationsComponent implements OnInit { } formationDisplay.datePrevu = formation.dateDebut; formationDisplay.origine = formation.origine; - console.log(formation.origine); - console.log(formationDisplay.origine); - console.log(""); formationDisplay.statut = formation.statut; this.formationsDisponibles.push(formationDisplay); } @@ -83,28 +79,6 @@ export class FormationsComponent implements OnInit { this.dataSource.sort = this.sort; } - /* - getStatut(statut:number) { - - let value =""; - switch(statut) { - case 0: - value = "Plannifiée"; - break; - case 1: - value = "Replannifiée"; - break; - case 2: - value = "Réalisée"; - break; - case 3: - value = "Annulée"; - break; - } - return value; - } - */ - ngOnDestroy() { if(this.formationsDisponiblesSubscription != undefined) { this.formationsDisponiblesSubscription.unsubscribe(); diff --git a/src/app/formations/new-formation/new-formation.component.ts b/src/app/formations/new-formation/new-formation.component.ts index 32e5b38..875e019 100644 --- a/src/app/formations/new-formation/new-formation.component.ts +++ b/src/app/formations/new-formation/new-formation.component.ts @@ -36,15 +36,13 @@ export class NewFormationComponent implements OnInit { constructor(private fb: FormBuilder, private service:FormationsService, private router: Router) { } ngOnInit() { - console.log(FormationModel.StatutEnum); } ajouterFormation() { this.nouvelleformation = this.formationForm.value; this.formationSubscription = this.service.ajouterFormation(this.nouvelleformation).subscribe( - reponse => { - console.log(reponse); - this.router.navigate(['']); + response => { + this.router.navigate(['/formations',response["id"]]); } ); } diff --git a/src/app/home/home-rh/home-rh.component.html b/src/app/home/home-rh/home-rh.component.html index c7c2c40..76900d5 100644 --- a/src/app/home/home-rh/home-rh.component.html +++ b/src/app/home/home-rh/home-rh.component.html @@ -16,14 +16,14 @@ {{ row.datePrevu | date:'dd/MM/yyyy à hh:mm' }} - + + Origine + {{row.origine}} + Statut - {{ getStatut(row.statut) }} + {{row.statut}} diff --git a/src/app/home/home-rh/home-rh.component.ts b/src/app/home/home-rh/home-rh.component.ts index 3fbb69a..973778f 100644 --- a/src/app/home/home-rh/home-rh.component.ts +++ b/src/app/home/home-rh/home-rh.component.ts @@ -29,7 +29,7 @@ export class HomeRHComponent implements OnInit { private formationsDisponiblesSubscription : Subscription; //displayedColumns: string[] = ["intitule", "participants", "date", "origine", "statut"] - displayedColumns: string[] = ["intitule", "participants", "date", "statut"] + displayedColumns: string[] = ["intitule", "origine", "participants", "date", "statut"] /** * source pour l'affichage des formations dans le tableau qui est affichée. @@ -59,14 +59,13 @@ export class HomeRHComponent implements OnInit { } ngOnInit() { - this.formationsDisponiblesSubscription = this.service.getFormations(undefined, 1).subscribe( + this.formationsDisponiblesSubscription = this.service.getProchainesFormation(undefined, 1).subscribe( formations => this.initFormations(formations) ); } initFormations(formations:FormationModel[]) { this.formationsDisponibles = []; - console.log(formations); let formationDisplay : DisplayFormation; for(let formation of formations) { formationDisplay = new DisplayFormation(); @@ -87,28 +86,6 @@ export class HomeRHComponent implements OnInit { this.dataSource.sort = this.sort; } - - getStatut(statut:number) { - - let value =""; - switch(statut) { - case 0: - value = "Plannifiée"; - break; - case 1: - value = "Replannifiée"; - break; - case 2: - value = "Réalisée"; - break; - case 3: - value = "Annulée"; - break; - } - return value; - } - - ngOnDestroy() { if(this.formationsDisponiblesSubscription != undefined) { this.formationsDisponiblesSubscription.unsubscribe();