Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identified and handled global properties and missing values #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions omod/src/main/webapp/patientDashboardForm.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@
}
return false;
}

//hide the feature(concepts that are not defined either by property or value).
window.onload = function showOrHide() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done on this. Do you mind sharing a small vedio or screenshots for this fix.

if(GlobalProperty("concept.causeOfDeath", "5002", "Concept id of the concept defining the CAUSE OF DEATH concept")) {
document.getElementById("patientDashboardDeceased").style.display = "none";
}

else {
document.getElementById("patientDashboardDeceased").style.display = "block";
}
}


</script>

<c:if test="${patient.voided}">
Expand All @@ -98,6 +111,8 @@
&nbsp;&nbsp;&nbsp;&nbsp;
<openmrs:message code="Person.deathDate"/>: <openmrs:formatDate date="${patient.deathDate}"/>
</c:if>
<%--removed global concept id and property:causeOfDeath --%>

<c:if test="${not empty patient.causeOfDeath}">
&nbsp;&nbsp;&nbsp;&nbsp;
<openmrs:message code="Person.causeOfDeath"/>: <openmrs:format concept="${patient.causeOfDeath}"/>
Expand Down
28 changes: 27 additions & 1 deletion omod/src/main/webapp/portlets/patientOverview.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,42 @@
</td>
</tr>
</table>
<%--script to handle the missing properties,GP --%>>

<script>

window.onload = function handleMissingProperrties(){
var propertyValue = new GlobalProperty(globalProperty);
var outcomeType = dwr.util.getValue("reasonForExit");
if(outcomeType == ''){
alert("<openmrs:message code="Patient.outcome.error.noType" />");
return;
}

else if( propertyValue === "undefined"){

document.getElementById("patientActionsCauseOfDeath").style.display = "none";
return;
}

}



</script>
<!--Copied from OpenMRS core 1.9.13
See https://github.com/openmrs/openmrs-core/blob/1.9.13/webapp/src/main/webapp/WEB-INF/view/portlets/patientOverview.jsp#L36
-->
<table id="patientActions">
<openmrs:extensionPoint pointId="org.openmrs.patientDashboard.patientActionsContent" type="html" parameters="patientId=${model.patient.patientId}"/>
<c:if test="${exitFromCareEnabled}">
<tr class="patientActionsRow">
<%-- removed global property--%>
<openmrs:globalProperty key="concept.reasonExitedCare" var="reasonExitedCare" />
<c:if test="${empty model.patientReasonForExit && !empty reasonExitedCare}">
<td id="patientActionsOutcome">
<div id="patientActionsOutcomeLink">
<button id="cancelExitButton" onClick="return showExitForm();"><openmrs:message code="Patient.outcome.exitFromCare"/></button>
<button id="cancelExitButton" onClick="handleMissingProperrties();"><openmrs:message code="Patient.outcome.exitFromCare"/></button>
</div>
<div id="patientActionsOutcomeForm" style="display:none; padding: 3px; border: 1px black dashed">
<form method="post" id="exitForm">
Expand All @@ -58,6 +82,8 @@
</td>
<td id="patientActionsCauseOfDeath" style="display:none;">
<span id="patientOutcomeTextDeathCause"><openmrs:message code="Person.causeOfDeath"/></span>
<%-- removed global properties--%>

<openmrs:globalProperty key="concept.causeOfDeath" var="conceptCauseOfDeath" />
<openmrs:globalProperty key="concept.otherNonCoded" var="conceptOther" />
<openmrs:fieldGen type="org.openmrs.Concept" formFieldName="causeOfDeath" val="${status.value}" parameters="showAnswers=${conceptCauseOfDeath}|showOther=${conceptOther}|otherValue=${causeOfDeathOther}" />
Expand Down