petites modifs
This commit is contained in:
parent
65ab8cf9bc
commit
9403571d83
@ -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>
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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);
|
||||
|
@ -7,3 +7,4 @@ export interface User {
|
||||
preference ?: object;
|
||||
roleList ?: string[];
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ export class SignupComponent implements OnInit {
|
||||
this.successMessage = "Membre ajouté !";
|
||||
}
|
||||
)
|
||||
this.signupForm.reset()
|
||||
} else {
|
||||
this.alertMessage = "Erreur d'ajout !";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user