Skip to content

Commit

Permalink
Keerthi | MOBN-2397 | Remove. additional information in medications t…
Browse files Browse the repository at this point in the history
…ab (#78)

* Keerthi | MOBN-2397 | Remove. additional information in medications tab

* Keerthi | MOBN-2397 | Add. appService to drugOrderHistory

* Keerthi | MOBN-2397 | hideAdditonalInstructions for new drug orders

* Keerthi | MOBN-2397 | Add. mockAppService and mockAppDescriptor in drugOrderHistoryController test
  • Loading branch information
keerthi-magantii authored Jun 28, 2024
1 parent e214da9 commit 54b0c8a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

angular.module('bahmni.clinical')
.controller('DrugOrderHistoryController', ['$scope', '$filter', '$stateParams', 'activeDrugOrders',
'treatmentConfig', 'treatmentService', 'spinner', 'drugOrderHistoryHelper', 'visitHistory', '$translate', '$rootScope',
function ($scope, $filter, $stateParams, activeDrugOrders, treatmentConfig, treatmentService, spinner,
'treatmentConfig', 'treatmentService', 'appService', 'spinner', 'drugOrderHistoryHelper', 'visitHistory', '$translate', '$rootScope',
function ($scope, $filter, $stateParams, activeDrugOrders, treatmentConfig, treatmentService, appService, spinner,
drugOrderHistoryHelper, visitHistory, $translate, $rootScope) {
var DrugOrderViewModel = Bahmni.Clinical.DrugOrderViewModel;
var DateUtil = Bahmni.Common.Util.DateUtil;
Expand All @@ -12,6 +12,7 @@ angular.module('bahmni.clinical')
var prescribedDrugOrders = [];
$scope.dispensePrivilege = Bahmni.Clinical.Constants.dispensePrivilege;
$scope.scheduledDate = DateUtil.getDateWithoutTime(DateUtil.addDays(DateUtil.now(), 1));
$scope.hideAdditionalInstructions = appService.getAppDescriptor().getConfigValue("hideAdditionalInstructions");

var createPrescriptionGroups = function (activeAndScheduledDrugOrders) {
$scope.consultation.drugOrderGroups = [];
Expand Down
3 changes: 2 additions & 1 deletion ui/app/clinical/consultation/directives/newDrugOrders.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use strict';

angular.module('bahmni.clinical')
.directive('newDrugOrders', ['messagingService', function (messagingService) {
.directive('newDrugOrders', ['messagingService', 'appService', function (messagingService, appService) {
var controller = function ($scope, $rootScope) {
$scope.hideAdditionalInstructions = appService.getAppDescriptor().getConfigValue("hideAdditionalInstructions");
$scope.edit = function (drugOrder, index) {
$rootScope.$broadcast("event:editDrugOrder", drugOrder, index);
};
Expand Down
2 changes: 1 addition & 1 deletion ui/app/clinical/consultation/views/newDrugOrders.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h2 class="section-title fl">{{ ::'MEDICATION_NEW_PRESCRIPTION' | translate}}</h
<div>
<span ng-if="newTreatment.asNeeded">{{newTreatment.getAsNeededText(newTreatment.asNeeded)}}, </span>
<span ng-if="newTreatment.route">{{newTreatment.route}}, </span>
{{newTreatment.instructions}} |
<span ng-hide="hideAdditionalInstructions">{{newTreatment.instructions}} |</span>
</div>
<div ng-if="newTreatment.additionalInstructions">
{{newTreatment.additionalInstructions}} |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<div>
<span ng-if="drugOrder.asNeeded">{{drugOrder.getAsNeededText(drugOrder.asNeeded)}}, </span>
<span nf-if="drugOrder.route"> {{drugOrder.route}}, </span>
{{drugOrder.instructions}} |
<span ng-hide="hideAdditionalInstructions">{{drugOrder.instructions}} |</span>
</div>
<div ng-if="drugOrder.additionalInstructions">{{drugOrder.additionalInstructions}} | </div>
<div>{{drugOrder.getQuantityWithUnit()}}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ describe("DrugOrderHistoryController", function () {
}
}

var mockAppDescriptor = jasmine.createSpyObj('appDescriptor', ['getConfigValue']);
var mockAppService = jasmine.createSpyObj("appService", ["getAppDescriptor"]);

beforeEach(function() {
mockAppDescriptor.getConfigValue.and.returnValue(treatmentConfig);
mockAppService.getAppDescriptor.and.returnValue(mockAppDescriptor);
});

var translate;
beforeEach(module(function ($provide) {
translate = jasmine.createSpyObj('$translate', ['instant']);
Expand Down Expand Up @@ -57,7 +65,8 @@ describe("DrugOrderHistoryController", function () {
visitContext: {},
spinner: spinner,
visitHistory: visitHistory,
treatmentConfig: treatmentConfig
treatmentConfig: treatmentConfig,
appService: mockAppService
});
rootScope.$apply();
};
Expand Down

0 comments on commit 54b0c8a

Please sign in to comment.