petites modifs

This commit is contained in:
Romain Verger 2022-03-10 13:14:32 +01:00
parent 65ab8cf9bc
commit 9403571d83
5 changed files with 14 additions and 5 deletions

View File

@ -148,6 +148,9 @@
</div>
</div>
<div *ngIf="successMessage" class="alert alert-success">
<p class="alert-link">{{successMessage}}</p>
</div>
<div *ngIf="errorMessage" class="alert alert-danger">
<p class="alert-link">{{errorMessage}}</p>
</div>

View File

@ -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 {

View File

@ -24,11 +24,13 @@ export class UpdateDelRestauComponent implements OnInit {
}
deleteRestau(idRestau : number | undefined){
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);

View File

@ -7,3 +7,4 @@ export interface User {
preference ?: object;
roleList ?: string[];
}

View File

@ -61,6 +61,7 @@ export class SignupComponent implements OnInit {
this.successMessage = "Membre ajouté !";
}
)
this.signupForm.reset()
} else {
this.alertMessage = "Erreur d'ajout !";
}