diff --git a/omod/src/main/compass/sass/allergy.scss b/omod/src/main/compass/sass/allergy.scss
index 35859d3..4cdb48f 100644
--- a/omod/src/main/compass/sass/allergy.scss
+++ b/omod/src/main/compass/sass/allergy.scss
@@ -17,6 +17,10 @@ label {
display: inline;
}
+#types {
+ margin: 10px 0px;
+}
+
#allergy > form {
width: 100%;
}
@@ -32,7 +36,7 @@ label {
}
#allergens {
- width: 55%;
+ width: 50%;
}
#reactions {
diff --git a/omod/src/main/webapp/pages/allergy.gsp b/omod/src/main/webapp/pages/allergy.gsp
index 01457ac..f11b186 100644
--- a/omod/src/main/webapp/pages/allergy.gsp
+++ b/omod/src/main/webapp/pages/allergy.gsp
@@ -75,10 +75,22 @@ ${ ui.includeFragment("allergyui", "removeAllergyDialog") }
<% allergens.each { allergen -> %>
<% if (allergen.id == otherNonCodedConcept.id) { %>
-
<% } else { %>
-
<% } %>
@@ -86,7 +98,12 @@ ${ ui.includeFragment("allergyui", "removeAllergyDialog") }
<% if (allergen.id == otherNonCodedConcept.id) { %>
<% if(typeName == 'DRUG') { %>
-
+
<% } else {%>
<% } %>
@@ -103,10 +120,33 @@ ${ ui.includeFragment("allergyui", "removeAllergyDialog") }
<% reactionConcepts.each { reaction -> %>
-
-
-
<% if (reaction.id == otherNonCodedConcept.id) { %>
- value="${allergy.reactionNonCoded}" <% } %>/>
+
+
+ value="${allergy.reactionNonCoded}" <% } %>/>
+ <% } else { %>
+
+
<% } %>
<% } %>
diff --git a/omod/src/main/webapp/resources/scripts/allergy.js b/omod/src/main/webapp/resources/scripts/allergy.js
index f7b8ac7..a52f2d3 100644
--- a/omod/src/main/webapp/resources/scripts/allergy.js
+++ b/omod/src/main/webapp/resources/scripts/allergy.js
@@ -1,5 +1,5 @@
var app = angular.module("allergyApp", ['uicommons.widget.coded-or-free-text-answer']);
-
+
app.controller("allergyController", [ '$scope', function($scope) {
$scope.allergen = null;
@@ -27,26 +27,64 @@ app.controller("allergyController", [ '$scope', function($scope) {
$scope.allergen = null;
$scope.nonCodedAllergen = null;
$scope.otherCodedAllergen = null;
- $('.coded_allergens').attr('checked', false);
+ $('.coded_allergens').prop('checked', false);
+ $('[ng-model=otherCodedAllergen]').hide();
+ $('[ng-model=nonCodedAllergen]').hide();
});
$scope.$watch('allergen', function(newValue, oldValue) {
// if you had already specified allergen, then change it, clear other fields
if (oldValue) {
- $('input.allergy-reaction').attr('checked', false);
- $('input.allergy-severity').attr('checked', false);
+ $('input.allergy-reaction').prop('checked', false);
+ $('input.allergy-severity').prop('checked', false);
$('#allergy-comment').val('');
+ $('[ng-model=otherCodedAllergen]').hide();
+ $('[name=reactionNonCoded]').hide();
$scope.nonCodedAllergen = null;
$scope.otherCodedAllergen = null;
}
});
+ $scope.controlOtherAllergenInputVisibility = function() {
+ if ($('#allergen-' + $scope.allergenType).prop('checked')) {
+ $('[ng-model=otherCodedAllergen]').show();
+ $('[ng-model=nonCodedAllergen]').show();
+ } else {
+ $('[ng-model=otherCodedAllergen]').hide();
+ $('[ng-model=nonCodedAllergen]').hide();
+ }
+ }
+
+ $scope.controlOtherReactionInputVisibility = function(reactionId) {
+ if ($('#reaction-' + reactionId).prop('checked')) {
+ $('[name=reactionNonCoded]').show();
+ } else {
+ $('[name=reactionNonCoded]').hide();
+ }
+ }
+
+ $scope.initOtherReactionInputVisibility = function(isOtherReactionEnabled) {
+ if (isOtherReactionEnabled) {
+ $('[name=reactionNonCoded]').show();
+ } else {
+ $('[name=reactionNonCoded]').hide();
+ }
+ }
+
$scope.otherFieldFocus = function() {
- $('#allergen-' + $scope.allergenType).attr('checked', true);
+ $('#allergen-' + $scope.allergenType).prop('checked', true);
+ $scope.controlOtherAllergenInputVisibility();
};
+
$scope.otherReactionFocus = function(reactionId) {
- $('#reaction-' + reactionId).attr('checked', true);
+ $('#reaction-' + reactionId).prop('checked', true);
+ $scope.controlOtherReactionInputVisibility(reactionId);
};
+
+ $scope.selectOtherAllergenRadioInput = function() {
+ $('#allergen-' + $scope.allergenType).prop('checked', true);
+ $scope.controlOtherAllergenInputVisibility();
+ }
}]);
\ No newline at end of file