Skip to content

Commit db4d8ff

Browse files
committed
Reverse routing & confirmation fix
1 parent e08ca07 commit db4d8ff

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

eform-client/src/app/modules/cases/components/case-edit-confirmation/case-edit-confirmation.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h4>{{'If you leave before saving your changes will be lost'}}.</h4>
1414
<button class="btn btn-danger" (click)="confirmationClicked(false)">
1515
{{ 'Leave' | translate }}
1616
</button>
17-
<button class="btn btn-accent text-black-50" (click)="frame.hide()">{{'Cancel' | translate}}</button>
17+
<button class="btn btn-accent text-black-50" (click)="cancelExit()">{{'Cancel' | translate}}</button>
1818
</div>
1919
</div>
2020
</div>

eform-client/src/app/modules/cases/components/case-edit-confirmation/case-edit-confirmation.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ export class CaseEditConfirmationComponent implements OnInit {
2525
this.frame.hide();
2626
}
2727

28+
cancelExit() {
29+
this.frame.hide();
30+
this.navigateAwaySelection$.next(false);
31+
}
2832
}

eform-client/src/app/modules/cases/components/case-edit/case-edit.component.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ export class CaseEditComponent implements OnInit, OnDestroy {
8181
this.spinnerStatus = false;
8282
this.isNoSaveExitAllowed = true;
8383
if (this.isSaveClicked) {
84-
if (!this.reverseRoute) {
85-
this.router.navigate(['/cases/', this.currentTemplate.id]).then();
86-
} else {
87-
this.router.navigate([this.reverseRoute]);
88-
}
84+
this.navigateToReverse();
8985
}
9086
}
9187
this.spinnerStatus = false;
@@ -115,11 +111,20 @@ export class CaseEditComponent implements OnInit, OnDestroy {
115111
this.saveCase();
116112
} else {
117113
this.isNoSaveExitAllowed = true;
118-
this.router.navigate([this.reverseRoute]).then();
114+
this.navigateToReverse();
115+
}
116+
}
117+
118+
navigateToReverse() {
119+
if (!this.reverseRoute) {
120+
this.router.navigate(['/cases/', this.currentTemplate.id]).then();
121+
} else {
122+
this.router.navigate([this.reverseRoute]);
119123
}
120124
}
121125

122126
canDeactivate(): Observable<boolean> | boolean {
127+
debugger;
123128
if (!this.isNoSaveExitAllowed) {
124129
this.caseConfirmation.show();
125130
return this.caseConfirmation.navigateAwaySelection$;

0 commit comments

Comments
 (0)