-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-2359 | Alert for unsaved observations while navigating out of pat…
…ient dashboard (#665) * Parvathy | BAH-2359 | Add. Alert for unsaved observation under consultation * Parvathy | BAH-2359 | Add. Alert box with review and discard button * Parvathy | BAH-2359 | Fix. Separated alert message from error messages * Parvathy | BAH-2359 | Refactor. Removed unwanted lines of code * Parvathy | BAH-2359 | Fix. New variable to record state of changes when discarded * Parvathy | BAH-2359 | Refactor. Improvements to code * Parvathy | BAH-2359 | Refactor. Removed code duplicacy by extracting logic to new service * Parvathy | BAH-2359 | Add. Alert when trying to navigate to new patient dashboard * Parvathy | BAH-2359 | Fix. eslint issues * Parvathy | BAH-2359 | Fix. failing tests * Parvathy | BAH-2359 | Add. Tests for showing alert * Parvathy | BAH-2359 | Fix. Check for unsaved observations * Parvathy | BAH-2359 | Fix. Eslint issues and test cases * Parvathy | BAH-2359 | Fix. checking for group members * Parvathy | BAH-2359 | Add. Handle unsaved observations in bahmni standard * Parvathy | BAH-2359 | Refactor. Changed alert message and button alignment * Parvathy | BAH-2359 | Refactor. Alignment of text message and buttons * Parvathy | BAH-2359 | Fix. failing test * Parvathy | BAH-2359 | Refactor. Button alignment * Parvathy | BAH-2359 | Revert changes for observations tab * Parvathy | BAH-2359 | Add. Handle changes when clicked on clear button in medication tab * Parvathy | BAH-2359 | Refactor. Handle unsaved observations in bacteriology tab
- Loading branch information
1 parent
a264d7f
commit adb0b99
Showing
33 changed files
with
328 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use strict"; | ||
|
||
angular.module('bahmni.clinical') | ||
.directive('alertOnExit', ['exitAlertService', '$state', | ||
function (exitAlertService, $state) { | ||
return { | ||
link: function ($scope) { | ||
$scope.$on('$stateChangeStart', function (event, next, current) { | ||
var uuid = $state.params.patientUuid; | ||
var currentUuid = current.patientUuid; | ||
var isNavigating = exitAlertService.setIsNavigating(next, uuid, currentUuid); | ||
$state.dirtyConsultationForm = $state.discardChanges ? false : $state.dirtyConsultationForm; | ||
exitAlertService.showExitAlert(isNavigating, $state.dirtyConsultationForm, event, next.spinnerToken); | ||
}); | ||
} | ||
}; | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
angular.module('bahmni.clinical') | ||
.factory('exitAlertService', ['messagingService', 'spinner', '$state', '$location', | ||
function (messagingService, spinner, $state, $location) { | ||
return { | ||
showExitAlert: function (isNavigating, dirtyConsultationForm, event, spinnerToken) { | ||
if (isNavigating && dirtyConsultationForm) { | ||
messagingService.showMessage('alert', "{{'ALERT_MESSAGE_ON_EXIT' | translate }}"); | ||
$state.reviewButtonFocused = true; | ||
event.preventDefault(); | ||
spinner.hide(spinnerToken); | ||
} | ||
}, | ||
setIsNavigating: function (next, uuid, currentUuid) { | ||
$state.newPatientUuid = currentUuid; | ||
next.url.includes("/patient/search") ? $state.isPatientSearch = true : $state.isPatientSearch = false; | ||
return (next.url.includes("/patient/search") || (uuid !== currentUuid)); | ||
}, | ||
redirectUrl: function () { | ||
return $state.isPatientSearch ? $location.path('/default/patient/search') : $location.path('/default/patient/' + $state.newPatientUuid + "/dashboard"); | ||
} | ||
}; | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.