Skip to content

Commit

Permalink
Kavitha | refactor to accept grouped configs
Browse files Browse the repository at this point in the history
  • Loading branch information
kavitha-sundararajan committed Apr 4, 2024
1 parent 88afcc5 commit 693c8ca
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
10 changes: 5 additions & 5 deletions ui/app/common/patient/services/patientService.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ angular.module('bahmni.common.patient')
q: query,
startIndex: offset,
identifier: identifier,
loginLocationUuid: sessionService.getLoginLocationUuid(),
patientSearchResultsConfig: customAttribute
loginLocationUuid: sessionService.getLoginLocationUuid()
};
if (appService.getAppDescriptor().getConfigValue("filterAttributeForAllSearch")) {
searchParams.attributeToFilterOut = appService.getAppDescriptor().getConfigValue("filterAttributeForAllSearch");
searchParams.attributeValueToFilterOut = appService.getAppDescriptor().getConfigValue("filterAttrValueForAllSearch");
var filterAttributeForAllSearch = appService.getAppDescriptor().getConfigValue("filterAttributeForAllSearch");
if (filterAttributeForAllSearch && filterAttributeForAllSearch != undefined) {
searchParams.attributeToFilterOut = filterAttributeForAllSearch.attrName;
searchParams.attributeValueToFilterOut = filterAttributeForAllSearch.attrValue;
}
return $http.get(Bahmni.Common.Constants.bahmniCommonsSearchUrl + "/patient/lucene", {
method: "GET",
Expand Down
4 changes: 3 additions & 1 deletion ui/app/registration/controllers/createPatientController.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ angular.module('bahmni.registration')

_.chain(defaultsWithAnswers).filter(isConcept).each(setDefaultConcept).value();
_.chain(defaultsWithAnswers).filter(isDateType).each(setDefaultValue).value();
$scope.patient[$scope.prePatientAttribute] = false;
if ($scope.prePatientAttribute && $scope.prePatientAttribute.name) {
$scope.patient[$scope.prePatientAttribute.name] = false;
}
};

var expandSectionsWithDefaultValue = function () {
Expand Down
11 changes: 7 additions & 4 deletions ui/app/registration/controllers/editPatientController.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ angular.module('bahmni.registration')
$scope.patientLoaded = true;
$scope.enableWhatsAppButton = (appService.getAppDescriptor().getConfigValue("enableWhatsAppButton") || Bahmni.Registration.Constants.enableWhatsAppButton) && ($scope.patient.phoneNumber != undefined);
$scope.prePatientAttribute = appService.getAppDescriptor().getConfigValue('prePatientAttribute');
const hideOrDisablePrePatientAttr = appService.getAppDescriptor().getConfigValue('hideOrDisablePrePatientAttr');
const hidePrePatientAttrOnValue = appService.getAppDescriptor().getConfigValue('hidePrePatientAttrOnValue');
$scope.hidePrePatientOption = (hideOrDisablePrePatientAttr === "hide" && $scope.patient[$scope.prePatientAttribute].toString() === hidePrePatientAttrOnValue) ? true : false;
$scope.showDisabledPrePatientOption = hideOrDisablePrePatientAttr === "disable" ? true : false;
if ($scope.prePatientAttribute && $scope.prePatientAttribute.name) {
const hideOrDisablePrePatientAttr = $scope.prePatientAttribute.hideOrDisable;
const hidePrePatientAttrOnValue = $scope.prePatientAttribute.hideOnValue;
$scope.showPrePatientOption = !(hideOrDisablePrePatientAttr === "hide" && $scope.patient[$scope.prePatientAttribute.name] &&
$scope.patient[$scope.prePatientAttribute.name].toString() === hidePrePatientAttrOnValue);
$scope.showDisabledPrePatientOption = hideOrDisablePrePatientAttr === "disable" ? true : false;
}
};

var expandDataFilledSections = function () {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/registration/views/editpatient.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<div class="field-value">
<span class="uneditable-input text-only">{{patient.registrationDate | bahmniDate}}</span>
</div>
<div ng-if="!hidePrePatientOption" class="field-value field-value-has-identifier">
<div ng-if="showPrePatientOption" class="field-value field-value-has-identifier">
<div class="fl">
<div class="field-attribute hasOldIdentifier-field-attribute">
<label for="pre-patient-attribute" class="control-label pre-patient-label">{{::'PRE_PATIENT_LABEL' | translate}}</label>
</div>
<div class="field-value">
<input class="input-label-inline" type="checkbox" id="pre-patient-attribute" ng-model="patient[prePatientAttribute]"
ng-change="patient[prePatientAttribute].handleUpdate()" ng-disabled="showDisabledPrePatientOption" ng-style="{'opacity' : showDisabledPrePatientOption ? '0.4':'unset'}">
<input class="input-label-inline" type="checkbox" id="pre-patient-attribute" ng-model="patient[prePatientAttribute.name]"
ng-change="patient[prePatientAttribute.name].handleUpdate()" ng-disabled="showDisabledPrePatientOption" ng-style="{'opacity' : showDisabledPrePatientOption ? '0.4':'unset'}">
</div>
</div>
</article>
Expand Down
6 changes: 3 additions & 3 deletions ui/app/registration/views/newpatient.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
</div>
</div>
</div>
<div ng-show="::prePatientAttribute" class="field-value field-value-has-identifier">
<div ng-show="::prePatientAttribute.name" class="field-value field-value-has-identifier">
<div class="fl">
<div class="field-attribute hasOldIdentifier-field-attribute">
<label for="pre-patient-attribute" class="control-label">{{::'PRE_PATIENT_LABEL' | translate}}</label>
</div>
<div class="field-value">
<input type="checkbox" class="input-label-inline" id="pre-patient-attribute" ng-model="patient[prePatientAttribute]"
ng-change="patient[prePatientAttribute].handleUpdate()">
<input type="checkbox" class="input-label-inline" id="pre-patient-attribute" ng-model="patient[prePatientAttribute.name]"
ng-change="patient[prePatientAttribute.name].handleUpdate()">
</div>
</div>
</div>
Expand Down

0 comments on commit 693c8ca

Please sign in to comment.