Skip to content

Commit

Permalink
BAH-3445 | Fix. Unsaved Alert Popup Issue When Saved Orders Are Removed
Browse files Browse the repository at this point in the history
* Parvathy | BAH-3445 | Fix. Alert Message after Removing Orders

* Parvathy | BAH-3445 | Fix. Eslint issues
  • Loading branch information
parvathy00 authored Jan 19, 2024
1 parent ed3d493 commit 7dc0eac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ angular.module('bahmni.clinical').controller('ConsultationController',
return encounterService.create(encounterData)
.then(function (saveResponse) {
$state.dirtyConsultationForm = false;
$state.orderRemoved = false;
$scope.$parent.$broadcast("event:changes-saved");
var messageParams = {
encounterUuid: saveResponse.data.encounterUuid,
Expand Down
3 changes: 2 additions & 1 deletion ui/app/clinical/consultation/controllers/orderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ angular.module('bahmni.clinical')
if (order) {
if (order.uuid) {
order.isDiscontinued = true;
$state.orderRemoved = true;
} else {
_.remove($scope.consultation.orders, order);
}
Expand Down Expand Up @@ -133,7 +134,7 @@ angular.module('bahmni.clinical')
};

$scope.$on('$stateChangeStart', function () {
if ($scope.consultation.orders.length !== $scope.consultation.investigations.length) {
if ($state.orderRemoved || ($scope.consultation.orders.length > $scope.consultation.investigations.length)) {
$state.dirtyConsultationForm = true;
}
});
Expand Down
2 changes: 1 addition & 1 deletion ui/test/unit/clinical/controllers/orderController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("OrderController", function () {
retrospectiveEntryService: retrospectiveEntryService,
appService: appServiceMock,
$translate: translate,
$state: $state
$state: {}
});
}));

Expand Down

0 comments on commit 7dc0eac

Please sign in to comment.