diff --git a/SAS/TMSS/frontend/tmss_webapp/src/App.js b/SAS/TMSS/frontend/tmss_webapp/src/App.js index 563065029dd6533cd87ab700d05f34f874bb90b0..18f8e6f2941e5daf59de511bfbcabcea3163a757 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/App.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/App.js @@ -70,7 +70,6 @@ class App extends Component { {label: 'Reports', icon: 'pi pi-fw pi-chart-bar', to:'/reports',section: 'reports'}, ]; } - onWrapperClick(event) { if (!this.menuClick) { this.setState({ @@ -168,21 +167,22 @@ class App extends Component { subscribe('edit-dirty', (flag) => { this.setState({ isEditDirty: flag }, () => { if (flag) { - window.addEventListener("beforeunload", function (e) { - var confirmationMessage = "\o/"; - (e || window.event).returnValue = confirmationMessage; //Gecko + IE - return confirmationMessage; - // this.toggleDirtyDialog(); - }); + window.addEventListener("beforeunload", reloadDirty); // window.addEventListener('popstate', this.onBackButtonEvent); window.history.pushState(null, document.title, window.location.href); window.addEventListener('popstate', this.onBackButtonEvent); } else { - //window.removeEventListener('beforeunload'); + window.removeEventListener("beforeunload",reloadDirty); } }); }); - + + var reloadDirty =function (e) { + var confirmationMessage = "\o/"; + (e || window.event).returnValue = confirmationMessage; //Gecko + IE + return confirmationMessage; + // this.toggleDirtyDialog(); + }; } onBackButtonEvent = (e) => { @@ -286,7 +286,6 @@ class App extends Component { </Router> </> } - <CustomDialog type="confirmation" visible={this.state.showDirtyDialog} width="40vw" header={'Confirmation'} message={'Do you want to leave this page? Your changes may not be saved.'} content={''} onClose={this.close} onCancel={this.close} onSubmit={this.cancelEdit}> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.create.js index 510f8ccd624b9999e706c619a6e4035914ba676c..bfa70d3a2fd71f4aedb02a59a8540a70a0962288 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.create.js @@ -672,7 +672,7 @@ export class ReservationCreate extends Component { <CustomDialog type="confirmation" visible={this.state.showDialog} width="40vw" header={'Add Reservation'} message={'Do you want to leave this page? Your changes may not be saved.'} - content={''} onClose={this.cancelCreate} onCancel={this.close} onSubmit={this.cancelCreate}> + content={''} onClose={this.close} onCancel={this.close} onSubmit={this.cancelCreate}> </CustomDialog> </div> </React.Fragment> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.edit.js index 46e6f0f87d0ad4e0461e67ed4d31ae49e732c574..0263f87a5c5ea5823cd17c10c423b9b78fda99a8 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Reservation/reservation.edit.js @@ -630,7 +630,7 @@ export class ReservationEdit extends Component { <CustomDialog type="confirmation" visible={this.state.showDialog} width="40vw" header={'Edit Reservation'} message={'Do you want to leave this page? Your changes may not be saved.'} - content={''} onClose={this.cancelEdit} onCancel={this.close} onSubmit={this.cancelEdit}> + content={''} onClose={this.close} onCancel={this.close} onSubmit={this.cancelEdit}> </CustomDialog> </React.Fragment> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js index 8aac693a65c3ee17558a2b36c761b9373c2a1e0b..1774831fce1c7f372e7f35c55843fcbe2726b1b1 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -396,7 +396,7 @@ export class EditSchedulingUnit extends Component { this.growl.show({severity: 'error', summary: 'Error Occured', detail: 'Template Missing.'}); } this.setState({isDirty: false}); - publish('edit-dirty', true); + publish('edit-dirty', false); } @@ -657,4 +657,4 @@ export class EditSchedulingUnit extends Component { ); } } -export default EditSchedulingUnit +export default EditSchedulingUnit \ No newline at end of file