diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 176b86f8f3ff8e64c1b63bcc4bd65b44481beb60..fcac2706492f309a3ca2db1b08c6b8f027b45e1b 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -1040,7 +1040,7 @@ </div> <div *ngIf="isEditMode && currentPage == 0" class="footerEditMode"> <div fxLayout="row" fxLayoutAlign="center center"> - <button class="btn-primary unique" (click)="validateForm()">Terminé</button> + <button class="btn-primary unique" (click)="closeEditMode()">Terminé</button> </div> </div> </div> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 03290090e38b46d59b4a6056ada538d20d5a0523..55847505af9520a871233dd152cc2a26fa5cd983 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -612,7 +612,7 @@ export class FormComponent implements OnInit { let user: User; if (this.isEditMode) { this.structureService.editStructure(structure).subscribe((s: Structure) => { - this.router.navigateByUrl('home', { state: { data: s } }); + this.editForm = this.createStructureForm(s); }); } else { if (this.profile) { @@ -671,7 +671,7 @@ export class FormComponent implements OnInit { public goToSpecificPage(numPage: number, isSave: boolean): void { if (isSave) { - this.editForm = this.createStructureForm(new Structure(this.structureForm.value)); + this.validateForm(); } else { const structure = new Structure(this.editForm.value); this.structureForm = this.createStructureForm(structure); @@ -679,4 +679,8 @@ export class FormComponent implements OnInit { } this.currentPage = numPage; } + + public closeEditMode(): void { + this.router.navigateByUrl('home', { state: { data: this.editForm.value } }); + } } diff --git a/src/assets/scss/_buttons.scss b/src/assets/scss/_buttons.scss index 76f220fca41bbf60fdea8cb8f0a8665d2f078bf2..ec08d9b85f7cd16f8657e20ca299f4e8392773ce 100644 --- a/src/assets/scss/_buttons.scss +++ b/src/assets/scss/_buttons.scss @@ -76,4 +76,7 @@ &.small { width: 149px; } + &.invalid { + opacity: 0.4; + } }