Skip to content

Commit

Permalink
Merge pull request #10 from PiusKariuki/chore/BAH-20
Browse files Browse the repository at this point in the history
Specify Occupation
  • Loading branch information
nyatindopatrick authored Nov 19, 2024
2 parents 15a20d5 + 7fc2773 commit 1b72ac8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
19 changes: 11 additions & 8 deletions openmrs/apps/registration/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@
"title": "Additional Patient Information",
"attributes": [
"occupation",
"Specify Occupation",
"civilstatus",
"highestEducationlevel"
]
],
"order": 3
},
"specifyOccupation": {
"title": "Specify patient Occupation",
"translationKey": "OTHER_OCCUPATION_INFO_KEY",
"attributes": [
"Specify Occupation"
],
"expand": true,
"order": 4
},
"nextofKinInformation": {
"title": "Additional Patient Information",
Expand Down Expand Up @@ -101,12 +110,6 @@
"REGISTRATION FEES": {
"required": true,
"label": "Fee"
},
"FHS": {
"buttonSelect": true
},
"defaults":{
"FHS": "Present"
}
},
"fieldValidation" : {
Expand Down
18 changes: 18 additions & 0 deletions openmrs/apps/registration/attributesConditions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var showOrHideOtherOccupation = function (patient) {
var returnValues = {
show: [],
hide: []
}
if(patient.occupation && patient.occupation.value === "Other non-coded"){
returnValues.show.push("specifyOccupation")
} else{
returnValues.hide.push("specifyOccupation")
}
return returnValues
}

Bahmni.Registration.AttributesConditions.rules = {
'occupation': function (patient) {
return showOrHideOtherOccupation(patient)
}
}

0 comments on commit 1b72ac8

Please sign in to comment.