Skip to content

Commit

Permalink
add. changes to view dropdown for concept datatype (post OpenMRS upgr…
Browse files Browse the repository at this point in the history
…ade) (Bahmni#797)
  • Loading branch information
Arjun-Go authored Dec 18, 2023
1 parent 0bf0b65 commit 03a13d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
9 changes: 8 additions & 1 deletion ui/app/common/attributeTypes/views/attributeInformation.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
<option value=""></option>
</select>
</div>
<div class="left" data-ng-switch-when="org.openmrs.customdatatype.datatype.ConceptDatatype">
<select id="{{::attribute.name}}" ng-model="targetModel[attribute.name]"
ng-options="a.conceptId as a.description for a in ::attribute.answers"
ng-disabled="::isReadOnly(attribute.name)" ng-required="{{::attribute.required}}" ng-blur="::handleUpdate(attribute.name)">
<option value=""></option>
</select>
</div>
<div class="left" data-ng-switch-when="org.openmrs.customdatatype.datatype.FreeTextDatatype">
<input
type="text" pattern-validate id="{{::attribute.name}}"
Expand Down Expand Up @@ -71,4 +78,4 @@
<input id="{{::attribute.name}}" type="text" pattern="{{::attribute.pattern}}" ng-model="targetModel[attribute.name]"
ng-disabled="::isReadOnly(attribute.name)" ng-required="{{::attribute.required}}" ng-blur="::handleUpdate(attribute.name)"/>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ angular.module('bahmni.common.displaycontrol.programs')
$scope.getAttributeValue = function (attribute) {
if (isDateFormat(attribute.attributeType.format)) {
return Bahmni.Common.Util.DateUtil.formatDateWithoutTime(attribute.value);
} else if (isCodedConceptFormat(attribute.attributeType.format)) {
} else if (isCodedConceptFormat(attribute.attributeType.format) || isOpenmrsConceptFormat(attribute.attributeType.format)) {
var mrsAnswer = attribute.value;
var displayName = mrsAnswer.display;
if (mrsAnswer.names && mrsAnswer.names.length == 2) {
Expand All @@ -55,6 +55,11 @@ angular.module('bahmni.common.displaycontrol.programs')
var isCodedConceptFormat = function (format) {
return format == "org.bahmni.module.bahmnicore.customdatatype.datatype.CodedConceptDatatype";
};

var isOpenmrsConceptFormat = function (format) {
return format == "org.openmrs.customdatatype.datatype.ConceptDatatype";
};

$scope.translateProgram = function (program) {
var translatedName = Bahmni.Common.Util.TranslationUtil.translateAttribute(program, Bahmni.Common.Constants.program, $translate);
return translatedName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ angular.module('bahmni.common.uicontrols.programmanagment')
programAttributesMap[programAttributeType.name] = programAttribute.value && programAttribute.value.uuid;
} else if (isDateFormat(programAttributeType.format)) {
programAttributesMap[programAttributeType.name] = Bahmni.Common.Util.DateUtil.parseServerDateToDate(programAttributesMap[programAttributeType.name]);
} else if (isOpenmrsConceptFormat(programAttributeType.format)) {
programAttributesMap[programAttributeType.name] = programAttribute.value && programAttribute.value.uuid;
}
}
});
Expand All @@ -26,7 +28,7 @@ angular.module('bahmni.common.uicontrols.programmanagment')

if (isDateFormat(attributeType.format)) {
return programAttributesMap[attributeType.name] ? Bahmni.Common.Util.DateUtil.formatDateWithoutTime(programAttributesMap[attributeType.name]) : "";
} else if (isCodedConceptFormat(attributeType.format)) {
} else if (isCodedConceptFormat(attributeType.format) || isOpenmrsConceptFormat(attributeType.format)) {
var mrsAnswer = _.find(attributeType.answers, function (answer) {
return answer.conceptId == programAttributesMap[attributeType.name];
});
Expand Down Expand Up @@ -54,6 +56,10 @@ angular.module('bahmni.common.uicontrols.programmanagment')
return format == "org.bahmni.module.bahmnicore.customdatatype.datatype.CodedConceptDatatype";
};

var isOpenmrsConceptFormat = function (format) {
return format == "org.openmrs.customdatatype.datatype.ConceptDatatype";
};

$scope.patientProgram.patientProgramAttributes = $scope.getProgramAttributesMap();
}])
.directive('programAttributes', function () {
Expand Down

0 comments on commit 03a13d1

Please sign in to comment.