Skip to content

Commit

Permalink
Arjun | A-1205463335092754 | Feedback [Triage program/Pre-patient flo…
Browse files Browse the repository at this point in the history
…w] (#713)

* fix. alert dependency issue used as part of consultation

* add. config capability to show/hide program outcome field

* add. ability to show dropdown for custom concept program attribute types

* fix. pre-filling of programs on reload

* refactor. encorporate code feedbacks
  • Loading branch information
Arjun-Go authored Sep 28, 2023
1 parent 88d3ff6 commit 7c2b0a0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ui/app/common/attributeTypes/views/attributeInformation.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,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
7 changes: 6 additions & 1 deletion ui/app/common/domain/services/programService.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ angular.module('bahmni.common.domain')
});
};

var disableProgramOutcome = function () {
return appService.getAppDescriptor().getConfigValue('disableProgramOutcome') || false;
};

return {
getAllPrograms: getAllPrograms,
enrollPatientToAProgram: enrollPatientToAProgram,
Expand All @@ -132,6 +136,7 @@ angular.module('bahmni.common.domain')
getProgramStateConfig: getProgramStateConfig,
getEnrollmentInfoFor: getEnrollmentInfoFor,
getDefaultProgram: getDefaultProgram,
getProgramRedirectionConfig: getProgramRedirectionConfig
getProgramRedirectionConfig: getProgramRedirectionConfig,
disableProgramOutcome: disableProgramOutcome
};
}]);
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ angular.module('bahmni.common.uicontrols.programmanagment')
}), id);
$scope.patientProgramAttributes = {};
$scope.programEnrollmentDate = new Date($scope.today + ".00:00:00");
$scope.disableProgramOutcome = programService.disableProgramOutcome();
updateActiveProgramsList();
};

var successCallback = function () {
messagingService.showMessage("info", "CLINICAL_SAVE_SUCCESS_MESSAGE_KEY");
$scope.programSelected = defaultProgram !== null ? $scope.initialProgram : null;
$scope.programSelected != null && $scope.setWorkflowStates($scope.programSelected);
$scope.workflowStateSelected = defaultProgram !== null ? $scope.initialProgramWorkflowState : null;
$scope.patientProgramAttributes = {};
$scope.programEnrollmentDate = new Date($scope.today + ".00:00:00");
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</div>
</div>

<div class="form-field program-outcome-container" ng-show="patientProgram.editing">
<div class="form-field program-outcome-container" ng-show="patientProgram.editing && !disableProgramOutcome">
<div class="field-attribute">
<label>{{::'PROGRAM_MANAGEMENT_LABEL_PROGRAM_OUTCOME' | translate}} : </label>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("ManageProgramController", function () {
_provide = $provide;
programService = jasmine.createSpyObj('programService', ['getPatientPrograms', 'getAllPrograms',
'deletePatientState', 'getProgramAttributeTypes', 'updatePatientProgram',
'getDefaultProgram', 'getProgramRedirectionConfig']);
'getDefaultProgram', 'getProgramRedirectionConfig', 'disableProgramOutcome']);

programService.getDefaultProgram.and.callFake(function () {
deferred = q.defer();
Expand Down

0 comments on commit 7c2b0a0

Please sign in to comment.