diff --git a/src/app/admin-component/add-restau/add-restau.component.html b/src/app/admin-component/add-restau/add-restau.component.html index 778cccd..a6eda64 100644 --- a/src/app/admin-component/add-restau/add-restau.component.html +++ b/src/app/admin-component/add-restau/add-restau.component.html @@ -147,7 +147,10 @@ - + +
+ +
diff --git a/src/app/admin-component/add-restau/add-restau.component.ts b/src/app/admin-component/add-restau/add-restau.component.ts index 9f86c08..c22e83d 100644 --- a/src/app/admin-component/add-restau/add-restau.component.ts +++ b/src/app/admin-component/add-restau/add-restau.component.ts @@ -20,6 +20,7 @@ export class AddRestauComponent implements OnInit { public idRestau: Subscription | undefined; public formArrayCheckbox: FormArray; public idRestauAModifier?: number = 0; // On instancie a 0 ou undefined = on est en CREATION de Restau + public successMessage?: string; constructor(private router: Router, private apiBackService: ApiBackService) { this.signupForm = new FormGroup({}); @@ -126,15 +127,16 @@ export class AddRestauComponent implements OnInit { resp => {this.idRestauAModifier = 0 // Une fois le retour du subscribe qui est la preuve du bon enregistrement alors // On reinitialise identifiant restau a 0 pour se remettre en mode CREATION - - this.router.navigate(['restaurants']) + this.successMessage = "Restaurant modifié !" } ) } else { // sinon on crée un restau this.apiBackService.addRestaurant(restaurant).subscribe( resp => - this.router.navigate(['restaurants']) + this.successMessage = "Restaurant ajouté !" + ); + this.initForm(EMPTY_RESTAU); } } else { diff --git a/src/app/admin-component/update-del-restau/update-del-restau.component.ts b/src/app/admin-component/update-del-restau/update-del-restau.component.ts index c59fe5b..c856bbc 100644 --- a/src/app/admin-component/update-del-restau/update-del-restau.component.ts +++ b/src/app/admin-component/update-del-restau/update-del-restau.component.ts @@ -24,11 +24,13 @@ export class UpdateDelRestauComponent implements OnInit { } deleteRestau(idRestau : number | undefined){ - this.apiBackService.deleteRestau(idRestau).subscribe( + if(confirm("Êtes-vous sur de vouloir supprimer ce restaurant ?")){ + this.apiBackService.deleteRestau(idRestau).subscribe( resp =>{ this.restauList = this.restauList.filter(restaus => restaus.id != idRestau) }); } +} modifRestau(restau : Restaurant){ this.apiBackService.idRestauAModifier(restau); diff --git a/src/app/pages/models/user.ts b/src/app/pages/models/user.ts index 2eba1ca..4a7fbad 100644 --- a/src/app/pages/models/user.ts +++ b/src/app/pages/models/user.ts @@ -7,3 +7,4 @@ export interface User { preference ?: object; roleList ?: string[]; } + diff --git a/src/app/pages/signup/signup.component.ts b/src/app/pages/signup/signup.component.ts index a71f47a..24fec24 100644 --- a/src/app/pages/signup/signup.component.ts +++ b/src/app/pages/signup/signup.component.ts @@ -61,6 +61,7 @@ export class SignupComponent implements OnInit { this.successMessage = "Membre ajouté !"; } ) + this.signupForm.reset() } else { this.alertMessage = "Erreur d'ajout !"; }