dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18830
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7999: Add more two tabs for comments, program-report for dashboard.
------------------------------------------------------------
revno: 7999
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-09-04 17:10:05 +0700
message:
Add more two tabs for comments, program-report for dashboard.
added:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programInstanceHistory.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java 2012-03-08 04:56:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java 2012-09-04 10:10:05 +0000
@@ -87,4 +87,6 @@
int countProgramInstances( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate );
List<Grid> getProgramInstanceReport( Patient patient, I18n i18n, I18nFormat format );
+
+ Grid getProgramInstanceReport( ProgramInstance programInstance, I18n i18n, I18nFormat format );
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2012-09-04 10:10:05 +0000
@@ -33,6 +33,7 @@
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.GridHeader;
+import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -42,6 +43,8 @@
import org.hisp.dhis.patient.PatientIdentifierType;
import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
import org.hisp.dhis.system.grid.ListGrid;
import org.springframework.transaction.annotation.Transactional;
@@ -71,11 +74,11 @@
this.patientAttributeValueService = patientAttributeValueService;
}
- private ProgramStageInstanceService programStageInstanceService;
+ private PatientDataValueService patientDataValueService;
- public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ public void setPatientDataValueService( PatientDataValueService patientDataValueService )
{
- this.programStageInstanceService = programStageInstanceService;
+ this.patientDataValueService = patientDataValueService;
}
// -------------------------------------------------------------------------
@@ -222,7 +225,9 @@
attrGrid.addRow();
attrGrid.addValue( i18n.getString( "phoneNumber" ) );
- attrGrid.addValue( ( patient.getPhoneNumber() == null || patient.getPhoneNumber().isEmpty() ) ? PatientAttributeValue.UNKNOWN : patient.getPhoneNumber() );
+ attrGrid
+ .addValue( (patient.getPhoneNumber() == null || patient.getPhoneNumber().isEmpty()) ? PatientAttributeValue.UNKNOWN
+ : patient.getPhoneNumber() );
// ---------------------------------------------------------------------
// Add dynamic attribues
@@ -284,42 +289,115 @@
{
for ( ProgramInstance programInstance : programInstances )
{
- Grid gridProgram = new ListGrid();
- gridProgram.setTitle( programInstance.getProgram().getName() );
- gridProgram.setSubtitle( "" );
-
- // ---------------------------------------------------------------------
- // Headers
- // ---------------------------------------------------------------------
-
- gridProgram.addHeader( new GridHeader( i18n.getString( "name" ), false, false ) );
- gridProgram.addHeader( new GridHeader( i18n.getString( "value" ), false, false ) );
- gridProgram.addHeader( new GridHeader( "", true, false ) );
-
- // ---------------------------------------------------------------------
- // Values
- // ---------------------------------------------------------------------
-
- gridProgram.addRow();
- gridProgram.addValue( i18n.getString( "date_of_enrollment" ) );
- gridProgram.addValue( format.formatDate( programInstance.getEnrollmentDate() ) );
-
- gridProgram.addRow();
- gridProgram.addValue( i18n.getString( "date_of_incident" ) );
- gridProgram.addValue( format.formatDate( programInstance.getDateOfIncident() ) );
+ Grid gridProgram = getProgramInstanceReport( programInstance, i18n, format );
+
+ // ---------------------------------------------------------------------
+ // Grids for program-stage-instance
+ // ---------------------------------------------------------------------
+
+ getProgramStageInstancesReport( gridProgram, programInstance, format, i18n );
grids.add( gridProgram );
-
- // ---------------------------------------------------------------------
- // Grids for program-stage-instance
- // ---------------------------------------------------------------------
-
- List<Grid> programInstanceGrids = programStageInstanceService.getProgramStageInstancesReport(
- programInstance, format, i18n );
- grids.addAll( programInstanceGrids );
}
}
return grids;
}
+
+ public Grid getProgramInstanceReport( ProgramInstance programInstance, I18n i18n, I18nFormat format )
+ {
+ Grid grid = new ListGrid();
+
+ // ---------------------------------------------------------------------
+ // Get all program data registered
+ // ---------------------------------------------------------------------
+
+ grid.setTitle( programInstance.getProgram().getName() );
+ grid.setSubtitle( "" );
+
+ // ---------------------------------------------------------------------
+ // Headers
+ // ---------------------------------------------------------------------
+
+ grid.addHeader( new GridHeader( i18n.getString( "name" ), false, false ) );
+ grid.addHeader( new GridHeader( i18n.getString( "value" ), false, false ) );
+ grid.addHeader( new GridHeader( "", true, false ) );
+
+ // ---------------------------------------------------------------------
+ // Grids for program-stage-instance
+ // ---------------------------------------------------------------------
+
+ grid.addRow();
+ grid.addValue( i18n.getString( "date_of_enrollment" ) );
+ grid.addValue( format.formatDate( programInstance.getEnrollmentDate() ) );
+
+ grid.addRow();
+ grid.addValue( i18n.getString( "date_of_incident" ) );
+ grid.addValue( format.formatDate( programInstance.getDateOfIncident() ) );
+
+ getProgramStageInstancesReport( grid, programInstance, format, i18n );
+
+ return grid;
+ }
+
+ // -------------------------------------------------------------------------
+ // due-date && report-date
+ // -------------------------------------------------------------------------
+
+ private void getProgramStageInstancesReport( Grid grid, ProgramInstance programInstance, I18nFormat format,
+ I18n i18n )
+ {
+ Collection<ProgramStageInstance> programStageInstances = programInstance.getProgramStageInstances();
+
+ for ( ProgramStageInstance programStageInstance : programStageInstances )
+ {
+ grid.addRow();
+ grid.addValue( "" );
+ grid.addValue( "" );
+
+ grid.addRow();
+ grid.addValue( ">> " + i18n.getString( "program_stage" ) );
+ grid.addValue( programStageInstance.getProgramStage().getName() );
+
+ // -----------------------------------------------------------------
+ // due-date && report-date
+ // -----------------------------------------------------------------
+
+ Date executionDate = programStageInstance.getExecutionDate();
+ String executionDateValue = (executionDate != null) ? format.formatDate( programStageInstance
+ .getExecutionDate() ) : "[" + i18n.getString( "none" ) + "]";
+
+ grid.addRow();
+ grid.addValue( i18n.getString( "due_date" ) );
+ grid.addValue( format.formatDate( programStageInstance.getDueDate() ) );
+
+ grid.addRow();
+ grid.addValue( i18n.getString( "report_date" ) );
+ grid.addValue( executionDateValue );
+
+ // -----------------------------------------------------------------
+ // Values
+ // -----------------------------------------------------------------
+
+ Collection<PatientDataValue> patientDataValues = patientDataValueService
+ .getPatientDataValues( programStageInstance );
+
+ for ( PatientDataValue patientDataValue : patientDataValues )
+ {
+ DataElement dataElement = patientDataValue.getDataElement();
+
+ grid.addRow();
+ grid.addValue( dataElement.getName() );
+
+ if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL ) )
+ {
+ grid.addValue( i18n.getString( patientDataValue.getValue() ) );
+ }
+ else
+ {
+ grid.addValue( patientDataValue.getValue() );
+ }
+ }
+ }
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-08-24 10:09:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-09-04 10:10:05 +0000
@@ -209,8 +209,8 @@
<property name="programInstanceStore" ref="org.hisp.dhis.program.ProgramInstanceStore" />
<property name="patientAttributeValueService"
ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
- <property name="programStageInstanceService"
- ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+ <property name="patientDataValueService"
+ ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
</bean>
<bean id="org.hisp.dhis.program.ProgramStageService" class="org.hisp.dhis.program.DefaultProgramStageService">
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java 2012-09-04 10:10:05 +0000
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2004-2009, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.patient;
+
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version GetProgramInstanceHistoryAction.java 2:15:42 PM Sep 4, 2012 $
+ */
+public class GetProgramInstanceHistoryAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Implementation Action
+ // -------------------------------------------------------------------------
+
+ private ProgramInstanceService programInstanceService;
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters && Setters
+ // -------------------------------------------------------------------------
+
+ private Integer programInstanceId;
+
+ public void setProgramInstanceId( Integer programInstanceId )
+ {
+ this.programInstanceId = programInstanceId;
+ }
+
+ private String type;
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ private Grid grid;
+
+ public Grid getGrid()
+ {
+ return grid;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation Action
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId );
+
+ grid = programInstanceService.getProgramInstanceReport( programInstance, i18n, format );
+
+ if ( type == null )
+ {
+ return SUCCESS;
+ }
+
+ return type;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-09-03 19:53:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-09-04 10:10:05 +0000
@@ -129,12 +129,23 @@
// Get single-event if patient no have any single event
// OR have un-completed single-event
Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, false );
-
+
for ( ProgramInstance programInstance : programInstances )
{
programs.remove( programInstance.getProgram() );
}
+ // Remove single-event with registation programs which patient completed
+ Collection<ProgramInstance> completedProgramInstances = programInstanceService.getProgramInstances( patient, true );
+
+ for ( ProgramInstance programInstance : completedProgramInstances )
+ {
+ if ( programInstance.getProgram().isSingleEvent() )
+ {
+ programs.remove( programInstance.getProgram() );
+ }
+ }
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-09-03 19:53:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-09-04 10:10:05 +0000
@@ -584,6 +584,12 @@
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
</bean>
+
+ <bean id="org.hisp.dhis.caseentry.action.patient.GetProgramInstanceHistoryAction"
+ class="org.hisp.dhis.caseentry.action.patient.GetProgramInstanceHistoryAction"
+ scope="prototype">
+ <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+ </bean>
<bean id="org.hisp.dhis.caseentry.action.patient.GetPatientLocationAction"
class="org.hisp.dhis.caseentry.action.patient.GetPatientLocationAction"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-08-30 07:48:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-09-04 10:10:05 +0000
@@ -421,4 +421,9 @@
no_comment = No comment
please_select_program_stage = Please select program stage
comment_added = Comment added
-enroll_program = Enroll program
\ No newline at end of file
+enroll_program = Enroll program
+comments_and_sms_message = Comments and SMS messages
+no_message = No message
+program_reports = Program reports
+show_hide_content = Show/Hide content
+completed_date = Completed date
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-08-28 05:48:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-09-04 10:10:05 +0000
@@ -501,6 +501,12 @@
<param name="page">/dhis-web-caseentry/patientHistory.vm</param>
</action>
+ <action name="getProgramReportHistory"
+ class="org.hisp.dhis.caseentry.action.patient.GetProgramInstanceHistoryAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-caseentry/programInstanceHistory.vm</param>
+ </action>
+
<action name="getPatientLocation"
class="org.hisp.dhis.caseentry.action.patient.GetPatientLocationAction">
<result name="success" type="velocity">/content.vm</result>
@@ -553,6 +559,13 @@
<result name="success" type="velocity-json">
/dhis-web-caseentry/responseProgramInstance.vm</result>
</action>
+
+ <action name="getEventMessages"
+ class="org.hisp.dhis.caseentry.action.patient.GetProgramInstanceAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-caseentry/eventMessage.vm</param>
+ <param name="requiredAuthorities">F_PATIENT_UPDATE</param>
+ </action>
<action name="removeEnrollment"
class="org.hisp.dhis.caseentry.action.patient.RemoveEnrollmentAction">
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm 2012-09-04 10:10:05 +0000
@@ -0,0 +1,31 @@
+<table class='mainPageTable'>
+ <tr>
+ <th>$i18n.getString('date')</th>
+ <th>$i18n.getString('program_stage')</th>
+ <th>$i18n.getString('message')</th>
+ </tr>
+ #set( $mark = false )
+ #foreach( $programStageInstance in $programInstance.programStageInstances )
+ #if( $programStageInstance.outboundSms.size() > 0 ||
+ $programStageInstance.outboundSms.size() > 0 )
+
+ #foreach( $comment in $programStageInstance.comments )
+ <tr #alternate( $mark ) >
+ <td>$!format.formatDate( $comment.createdDate )</td>
+ <td>$programStageInstance.programStage.name</td>
+ <td>($comment.creator) $comment.commentText</td>
+ </tr>
+ #set( $mark = !$mark )
+ #end
+
+ #foreach( $sms in $programStageInstance.outboundSms )
+ <tr #alternate( $mark ) >
+ <td>$!format.formatDate( $sms.date )</td>
+ <td>$programStageInstance.programStage.name</td>
+ <td>$sms.message</td>
+ </tr>
+ #set( $mark = !$mark )
+ #end
+ #end
+ #end
+</table>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-08-29 06:02:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-09-04 10:10:05 +0000
@@ -417,9 +417,7 @@
+ " programStageInstanceId='" + programStageInstanceId + "'>"
+ " <td id='td_" + programInstanceId + "'>"
+ " <a href='javascript:loadActiveProgramStageRecords(" + programInstanceId + "," + programStageInstanceId + "')'>"
- + programName + "(" + enrollmentDate + ")</a>"
- + "<img id='img_" + programInstanceId + "' name='imgActive'></td>"
- + "<td><img src='../images/checked.png' style='cursor:pointer;' onclick='unenrollmentForm(" + programInstanceId + ")'></td>"
+ + programName + "(" + enrollmentDate + ")</a></td>"
+ "</tr>";
activedRow += "<tr id='tr2_" + programInstanceId +"'"+
@@ -906,15 +904,14 @@
function activeProgramInstanceDiv( programInstanceId )
{
- jQuery("[name=eventDiv]").each(function(){
- hideById(this.id);
- });
-
- jQuery("[name=imgActive]").each(function(){
- jQuery(this).attr('src','');
- });
-
- jQuery("#img_" + programInstanceId ).attr('src','images/flag-blue.png');
+ jQuery(".selected").each(function(){
+ jQuery(this).removeClass();
+ });
+
+ jQuery("#infor_" + programInstanceId).each(function(){
+ jQuery(this).addClass('selected bold');
+ });
+
showById('pi_' + programInstanceId);
}
@@ -984,3 +981,33 @@
hideLoader();
});
}
+
+function programReports( programInstanceId )
+{
+ $('#programReportDiv').load("getProgramReportHistory.action", {programInstanceId:programInstanceId});
+}
+
+function getEventMessages( programInstanceId )
+{
+ $('#eventMessagesDiv').load("getEventMessages.action", {programInstanceId:programInstanceId});
+}
+
+function updateEnrollment( patientId, programId, programInstanceId, programName )
+{
+ var dateOfIncident = jQuery('#tab-3 [id=dateOfIncident]').val();
+ var enrollmentDate = jQuery('#tab-3 [id=enrollmentDate]').val();
+
+ jQuery.postJSON( "saveProgramEnrollment.action",
+ {
+ patientId: getFieldValue('patientId'),
+ programId: programId,
+ dateOfIncident: dateOfIncident,
+ enrollmentDate: enrollmentDate
+ },
+ function( json )
+ {
+ var infor = programName + " (" + enrollmentDate + ")";
+ setInnerHTML("infor_" + programInstanceId, infor );
+ showSuccessMessage(i18n_enrol_success);
+ });
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2012-08-30 07:48:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2012-09-04 10:10:05 +0000
@@ -96,15 +96,11 @@
<tr id='tr1_$programInstance.id' type='$programInstance.program.type'
programStageInstanceId='$programStageInstanceId'>
<td id='td_$programInstance.id'>
- <a href='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
- <img id="img_$programInstance.id" name='imgActive'>
+ <a href='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")'><span id='infor_$programInstance.id'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</span></a>
</td>
+ </tr>
+ <tr id='tr2_$programInstance.id' onclick='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")' style='cursor:pointer;'>
<td>
- <img src='../images/checked.png' style='cursor:pointer;' onclick='unenrollmentForm("$programInstance.id")'>
- </td>
- </tr>
- <tr id='tr2_$programInstance.id' onclick='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")' style='cursor:pointer;'>
- <td colspan='2'>
<a>• $programStageInstance.programStage.name ($format.formatDate($programStageInstance.dueDate))</a>
</td>
</tr>
@@ -116,10 +112,6 @@
programStageInstanceId='$programStageInstanceId'>
<td id='td_$programInstance.id'>
<a href='javascript:loadProgramInstance("$programInstance.id", false)'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
- <img id="img_$programInstance.id" name='imgActive'>
- </td>
- <td>
- <img src='../images/checked.png' style='cursor:pointer;' onclick='unenrollmentForm("$programInstance.id")'>
</td>
</tr>
#end
@@ -146,8 +138,7 @@
<tr id='tr_$programInstance.id' type='$programInstance.program.type' onclick="javascript:loadProgramInstance('$programInstance.id', true);" style='cursor:pointer;'
programStageInstanceId='$programStageInstanceId'>
<td>
- <a>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
- <img id="img_$programInstance.id" name='imgActive'>
+ <a><span id='infor_$programInstance.id'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</span></a>
</td>
</tr>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-08-30 07:48:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-09-04 10:10:05 +0000
@@ -3,11 +3,14 @@
#set($noGroup = $attributeGroups.size() )
#if( $programInstance || $hasDataEntry=='true')
<input type='hidden' id='programInstanceId' name='programInstanceId' value='$programInstance.id' />
+<input type='hidden' id='patientId' name='patientId' value='$programInstance.patient.id' />
<div id="tabs">
<ul>
<li><a href="#tab-1">$i18n.getString("data_entry_screen")</a></li>
<li><a href="#tab-2">$i18n.getString("identifier_and_attribute")</a></li>
<li><a href="#tab-3">$i18n.getString("modify_due_date_or_visit_date")</a></li>
+ <li><a href="#tab-4">$i18n.getString("comments_and_sms_message")</a></li>
+ <li><a href="#tab-5">$i18n.getString("program_reports")</a></li>
</ul>
<div id="tab-1">
@@ -154,11 +157,32 @@
<!-- Program-stage-instance TAB -->
<div id="tab-3">
+ <fieldset>
+ <legend>$i18n.getString("program")</legend>
+ <table>
+ <tr>
+ <td class='text-column'><label for="enrollmentDate">$programInstance.program.dateOfEnrollmentDescription<em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
+ <td><input type="text" id="enrollmentDate" name="enrollmentDate" class="{validate:{required:true}}"></td>
+ </tr>
+ <tr>
+ <td class='text-column'><label for="dateOfIncident">$programInstance.program.dateOfIncidentDescription<em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
+ <td><input type="text" id="dateOfIncident" name="dateOfIncident" class="{validate:{required:true}}"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="button" class='button' value="$i18n.getString( 'update' )" onclick='updateEnrollment($programInstance.patient.id, $programInstance.program.id, $programInstance.id, "$programInstance.program.name")'/>
+ <input type="button" class='button' value="$i18n.getString( 'unenroll' )" onclick='unenrollmentForm($programInstance.id)'/>
+ </td>
+ <tr>
+ </table>
+ </fieldset>
+ <br>
#if( $programStageInstances.size() > 0 )
<table class='mainPageTable' id='progarmStageListDiv' name='progarmStageListDiv' >
- <col id="noCol">
- <col id="stageCol">
- <col id="entryCol">
+ <col id="noCol"/>
+ <col id="stageCol"/>
+ <col id="entryCol"/>
<tr>
<th>$i18n.getString( "nr" )</th>
<th>$i18n.getString( "program_stage" )</th>
@@ -193,7 +217,14 @@
</table>
#end
</div>
+
+ <!-- Comments and SMS messages -->
+ <div id='tab-4'>
+ <div id='eventMessagesDiv'></div>
+ </div>
+ <div id='tab-5'><div id='programReportDiv'></div></div>
+
</div>
#end
@@ -207,6 +238,13 @@
#if( $!programInstance )
showById('unenrollBtn');
#end
+
+ #if( $programInstance.completed)
+ jQuery(":input").prop('disabled', true);
+ jQuery(":input").datepicker("destroy");
+ #else
+ datePickerInRangeValid( 'dateOfIncident' , 'enrollmentDate' );
+ #end
});
#if( $programInstance || $hasDataEntry == 'true')
@@ -231,6 +269,15 @@
#end
#end
+ $( "#tabs" ).bind( "tabsselect", function(event, ui) {
+ if( ui.tab.hash == '#tab-5' ){
+ programReports(getFieldValue('programInstanceId'));
+ }
+ else if( ui.tab.hash == '#tab-4' ){
+ getEventMessages(getFieldValue('programInstanceId'));
+ }
+ });
+
setInnerHTML('enrollmentDateDescription', "$!program.dateOfEnrollmentDescription" );
setInnerHTML('dateOfIncidentDescription', "$!program.dateOfIncidentDescription" );
setFieldValue('enrollmentDate', "$!format.formatDate( $programInstance.enrollmentDate )" );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-08-29 07:30:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-09-04 10:10:05 +0000
@@ -44,8 +44,8 @@
<tr>
<td></td>
<td colspan='2'>
- <input type="button" id='enrollBtn' name='enrollBtn' class='button' value="$i18n.getString( 'enroll' )" onclick='saveEnrollment()'/>
- <input type="button" id='cancelBtn' name='cancelBtn' class='button' value="$i18n.getString( 'cancel' )" onclick="jQuery('#enrollmentDiv').dialog('close')"/>
+ <input type="button" class='button' value="$i18n.getString( 'enroll' )" onclick='saveEnrollment()'/>
+ <input type="button" class='button' value="$i18n.getString( 'cancel' )" onclick="jQuery('#enrollmentDiv').dialog('close')"/>
</td>
</tr>
<tr>
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programInstanceHistory.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programInstanceHistory.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programInstanceHistory.vm 2012-09-04 10:10:05 +0000
@@ -0,0 +1,41 @@
+<table class="listTable">
+ <thead>
+ <tr>
+ #foreach( $header in $grid.getVisibleHeaders() )
+ <th #if( $header.meta )style="text-align:left"#end>$!encoder.htmlEncode( $header.name )</th>
+ #end
+ </tr>
+ </thead>
+
+ <tbody>
+ #set( $mark = false )
+ #set( $flag = 0 )
+ #foreach( $row in $grid.getVisibleRows() )
+ <tr #alternate($mark)>
+ #set( $nameCol='false' )
+ #if($flag>1) #set( $flag = 0 ) #end
+ #foreach( $col in $row )
+ #set( $index = ( $velocityCount - 1 ) )
+ #if($col=='')
+ <td> </td>
+ #set( $flag = 1 )
+ #elseif( $flag > 0 )
+ #if( $grid.getVisibleHeaders().get( $index ).meta )
+ <th>$!encoder.htmlEncode( $col )</th>
+ #else
+ <th>$!col</th>
+ #end
+ #set( $flag = $flag + 1 )
+ #else
+ #if( $grid.getVisibleHeaders().get( $index ).meta )
+ <td>$!encoder.htmlEncode( $col )</td>
+ #else
+ <td>$!col</td>
+ #end
+ #end
+ #end
+ </tr>
+ #end
+ #set( $mark = !$mark)
+ </tbody>
+</table>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2012-09-03 19:53:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2012-09-04 10:10:05 +0000
@@ -1,4 +1,3 @@
-<br/>
<table id='programStageIdTB_$!programInstance.id' style="width:850px;height:125px;">
<tr>
<td>
@@ -9,9 +8,7 @@
<table class="stage-flow">
<tr id='programStageIdTR_$!programInstance.id'>
#foreach( $programStageInstance in $programInstance.programStageInstances )
- <td width="5px">
- <img src='images/rightarrow.png'>
- </td>
+ <td width="5px" style='font-size:25px;'>→</td>
<td>
<input type="button" name="programStageBtn"
id="ps_$!programStageInstance.id"
@@ -20,7 +17,7 @@
programType='$programInstance.program.type'
dueDate="$format.formatDate( $programStageInstance.dueDate )"
class="stage-object"
- value="$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )"
+ value="$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )"
onclick="javascript:loadDataEntry( $programStageInstance.id );">
<script>
var status = $statusMap.get( $programStageInstance.id );
@@ -37,7 +34,7 @@
</td>
<td> </td>
<td>
- <input type="button" class='stage-object' id="newEncounterBtn_$!programInstance.id" name="newEncounterBtn" value="$i18n.getString('create_new_event')" onClick="javascript:showCreateNewEvent('$!programInstance.id');" >
+ <input type="button" class='patient-object' id="newEncounterBtn_$!programInstance.id" name="newEncounterBtn" value="$i18n.getString('create_new_event')" onClick="javascript:showCreateNewEvent('$!programInstance.id');" >
</td>
</tr>
</table>
@@ -79,6 +76,7 @@
</div>
<script>
+ var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'" )';
var i18n_create_event_success = '$encoder.jsEscape( $i18n.getString( "create_event_success" ) , "'" )';
var options = jQuery("#createNewEncounterDiv_$!programInstance.id [id=repeatableProgramStageId] option").length;
if( options==0 )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-09-03 19:53:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-09-04 10:10:05 +0000
@@ -142,15 +142,12 @@
input.stage-object[type="button"]
{
- width: 100px;
+ width: 120px;
height: 60px;
- white-space: normal;
- border: 2px solid;
- cursor: pointer;
+ cursor: pointer;
opacity: 1.0;
- border: 1px solid;
+ border: 2px solid;
margin: 5px;
- border-radius: 2px;
}
input.stage-object[type="button"]:hover
@@ -379,17 +376,6 @@
overflow-y:hidden;
}
-table.stage-object
-{
- white-space: normal;
- border: 2px solid;
- opacity: 1.0;
- border: 1px solid;
- margin: 5px;
- border-radius: 2px;
- text-align:center;
-}
-
.arrow-right {
width: 0;
height: 0;