...
Here, 'patientContact' and 'guardian' are the sections. Below is the javascript that is needed to show the guardian section if patient's age is greater less than 18.
Code Block | ||||
---|---|---|---|---|
| ||||
var showOrHideGuardianSection = function (patient) { var returnValues = { show: [], hide: [] }; if (patient["age"].years < 18) { returnValues.show.push("guardian") } else { returnValues.hide.push("guardian") } return returnValues }; Bahmni.Registration.AttributesConditions.rules = { 'age': function (patient) { return showOrHideGuardianSection(patient); }, 'birthdate': function (patient) { return showOrHideGuardianSection(patient); }, 'isGuardianRequired': function(patient) { var returnValues = { show: [], hide: [] }; if (patient["isGuardianRequired"]) { returnValues.show.push("guardian"); } else { returnValues.hide.push("guardian"); } return returnValues; } }; |
...