← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9012: Improve anonymous data entry UI.

 

------------------------------------------------------------
revno: 9012
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-14 12:52:34 +0700
message:
  Improve anonymous data entry UI.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
  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/webapp/dhis-web-caseentry/anonymousRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm


--
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/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2012-11-06 02:44:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2012-11-14 05:52:34 +0000
@@ -89,10 +89,10 @@
     List<ProgramStageInstance> getProgramStageInstances( Patient patient, Boolean completed );
 
     Grid getTabularReport( ProgramStage programStage, List<TabularReportColumn> columns, Collection<Integer> organisationUnits, 
-        int level, Date startDate, Date endDate, boolean descOrder, Integer min, Integer max );
+        int level, Date startDate, Date endDate, boolean descOrder, Boolean completed, Integer min, Integer max );
 
     int getTabularReportCount( ProgramStage programStage, List<TabularReportColumn> columns,
-        Collection<Integer> organisationUnits, int level, Date startDate, Date endDate );
+        Collection<Integer> organisationUnits, int level, Boolean completed, Date startDate, Date endDate );
 
     List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n );
     

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2012-11-06 03:01:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2012-11-14 05:52:34 +0000
@@ -77,10 +77,10 @@
     
     Grid getTabularReport( ProgramStage programStage, Map<Integer, OrganisationUnitLevel> orgUnitLevelMap,
         Collection<Integer> orgUnits, List<TabularReportColumn> columns, int level, int maxLevel, Date startDate,
-        Date endDate, boolean descOrder, Integer min, Integer max );
+        Date endDate, boolean descOrder, Boolean completed, Integer min, Integer max );
     
     int getTabularReportCount( ProgramStage programStage, List<TabularReportColumn> columns,
-        Collection<Integer> organisationUnits, int level, int maxLevel, Date startDate, Date endDate );
+        Collection<Integer> organisationUnits, int level, int maxLevel, Date startDate, Date endDate, Boolean completed  );
     
     void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit );
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2012-11-06 02:44:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2012-11-14 05:52:34 +0000
@@ -169,7 +169,7 @@
     }
 
     public Grid getTabularReport( ProgramStage programStage, List<TabularReportColumn> columns,
-        Collection<Integer> organisationUnits, int level, Date startDate, Date endDate, boolean descOrder, Integer min,
+        Collection<Integer> organisationUnits, int level, Date startDate, Date endDate, boolean descOrder, Boolean completed, Integer min,
         Integer max )
     {
         int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
@@ -177,16 +177,16 @@
         Map<Integer, OrganisationUnitLevel> orgUnitLevelMap = organisationUnitService.getOrganisationUnitLevelMap();
 
         return programStageInstanceStore.getTabularReport( programStage, orgUnitLevelMap, organisationUnits, columns,
-            level, maxLevel, startDate, endDate, descOrder, min, max );
+            level, maxLevel, startDate, endDate, descOrder, completed, min, max );
     }
 
     public int getTabularReportCount( ProgramStage programStage, List<TabularReportColumn> columns,
-        Collection<Integer> organisationUnits, int level, Date startDate, Date endDate )
+        Collection<Integer> organisationUnits, int level, Boolean completed, Date startDate, Date endDate )
     {
         int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
 
         return programStageInstanceStore.getTabularReportCount( programStage, columns, organisationUnits, level,
-            maxLevel, startDate, endDate );
+            maxLevel, startDate, endDate, completed );
     }
 
     public List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-11-06 02:44:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-11-14 05:52:34 +0000
@@ -193,7 +193,7 @@
 
     public Grid getTabularReport( ProgramStage programStage, Map<Integer, OrganisationUnitLevel> orgUnitLevelMap,
         Collection<Integer> orgUnits, List<TabularReportColumn> columns, int level, int maxLevel, Date startDate,
-        Date endDate, boolean descOrder, Integer min, Integer max )
+        Date endDate, boolean descOrder, Boolean completed, Integer min, Integer max )
     {
         // ---------------------------------------------------------------------
         // Headers TODO hidden cols
@@ -229,7 +229,7 @@
         // ---------------------------------------------------------------------
 
         String sql = getTabularReportSql( false, programStage, columns, orgUnits, level, maxLevel, startDate, endDate,
-            descOrder, min, max );
+            descOrder, completed, min, max );
 
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
 
@@ -239,10 +239,10 @@
     }
 
     public int getTabularReportCount( ProgramStage programStage, List<TabularReportColumn> columns,
-        Collection<Integer> organisationUnits, int level, int maxLevel, Date startDate, Date endDate )
+        Collection<Integer> organisationUnits, int level, int maxLevel, Date startDate, Date endDate, Boolean completed )
     {
         String sql = getTabularReportSql( true, programStage, columns, organisationUnits, level, maxLevel, startDate,
-            endDate, false, null, null );
+            endDate, false, completed, null, null );
 
         return jdbcTemplate.queryForInt( sql );
     }
@@ -346,7 +346,7 @@
 
     private String getTabularReportSql( boolean count, ProgramStage programStage, List<TabularReportColumn> columns,
         Collection<Integer> orgUnits, int level, int maxLevel, Date startDate, Date endDate, boolean descOrder,
-        Integer min, Integer max )
+        Boolean completed, Integer min, Integer max )
     {
         Set<String> deKeys = new HashSet<String>();
         String selector = count ? "count(*) " : "* ";
@@ -462,7 +462,11 @@
         {
             sql += "and ou.organisationunitid in (" + TextUtils.getCommaDelimitedString( orgUnits ) + ") ";
         }
-
+        if( completed!= null )
+        {
+            sql += "and psi.completed="+ completed + " ";
+        }
+        
         sql += "order by ";
 
         for ( int i = level; i <= maxLevel; i++ )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2012-11-08 02:58:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2012-11-14 05:52:34 +0000
@@ -196,6 +196,13 @@
         this.format = format;
     }
     
+    private Boolean completed;
+    
+    public void setCompleted( Boolean completed )
+    {
+        this.completed = completed;
+    }
+
     private List<DataElement> dataElements = new ArrayList<DataElement>();
 
     public List<DataElement> getDataElements()
@@ -317,20 +324,20 @@
             if ( type == null ) // Tabular report
             {
                 totalRecords = programStageInstanceService.getTabularReportCount( programStage, columns,
-                    organisationUnits, level, startValue, endValue );
+                    organisationUnits, level, completed, startValue, endValue );
 
                 total = getNumberOfPages( totalRecords );
 
                 this.paging = createPaging( totalRecords );
                 
                 grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
-                    startValue, endValue, !orderByOrgunitAsc, getStartPos(), paging.getPageSize() );
+                    startValue, endValue, !orderByOrgunitAsc, completed, getStartPos(), paging.getPageSize() );
             }
             else
             // Download as Excel
             {
                 grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
-                    startValue, endValue, !orderByOrgunitAsc, null, null );
+                    startValue, endValue, !orderByOrgunitAsc, completed, null, null );
             }
         }
         catch ( SQLGrammarException ex )

=== 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-11-09 14:38:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-11-14 05:52:34 +0000
@@ -473,4 +473,5 @@
 specify_a_date = Please specify a date
 clear_all = Clear all
 show_all = Show all
-you_have_active_filters = You have active filters
\ No newline at end of file
+you_have_active_filters = You have active filters
+back_to_event_list = Back to event list
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-11-13 04:54:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-11-14 05:52:34 +0000
@@ -5,7 +5,9 @@
 	});
 </script>
 				
-<h3 id='mainLinkLbl'>$i18n.getString( "anonymous_events_management" ) #openHelp('single_event_without_registration')</h3>
+<h3>$i18n.getString( "anonymous_events_management" ) #openHelp('single_event_without_registration')</h3>
+<h4 id='programName' name='programName'></h4>
+
 <input type='hidden' id='orgunitId' name='orgunitId' value='$orgunit.id'>
 <input type='hidden' id='programStageInstanceId' name='programStageInstanceId' value='0'>
 <input type='hidden' id='programStageId' name='programStageId' class='stage-object-selected'>
@@ -51,6 +53,7 @@
 					<input type="text" id='endDate' name='endDate' style="width:240px;">
 				</td>
 				<td>
+					<input type="checkbox" id="incompleted" name="incompleted" value="true">$i18n.getString("incomplete")
 					<input type="button" class='large-button' id='filterBtn' name="filterBtn" value='$i18n.getString( "filter" )' onclick="showFilterForm();">
 					<input type="button" class='large-button' id='listBtn' value="$i18n.getString( 'update' )" onclick="validateSearchEvents(false);">&nbsp;
 				</td>
@@ -103,10 +106,6 @@
 <div id='listDiv'></div>
 
 <div id='dataEntryInfor' class='hidden'>
-	<h3>
-		<a href="javascript:backEventList();">$i18n.getString( "anonymous_events_management" ) </a>
-		&raquo; <span id='programName' name='programName'></span>
-	</h3>
 	<table style="width:580px;" class="listTable">
 			<tr>
 				<th><span id="reportDateDescriptionField2">$i18n.getString( "report_date" )</span> <em title="$i18n.getString( "required" )" class="required">*</em> </th>
@@ -118,13 +117,10 @@
 	</table> 
 	<div id='dataEntryFormDiv'></div>
 	
-	<div id='actionDiv' class="page inputCriteria" style="width:800px;height:29px;">	
+	<div id='actionDiv' class="page inputCriteria" style="width:580px;height:29px;">	
 		<input type="button" onclick="doComplete()" value="$i18n.getString('complete')" id="completeBtn">
 		<input type="button" onclick="doUnComplete()" value="$i18n.getString('incomplete')" id="uncompleteBtn" >
 		<input type="button" value="$i18n.getString('run_validation')" onclick="javascript: runValidation();">
-		<input type="button" onclick="completedAndAddNewEvent()" value="$i18n.getString('complete_and_add_new_event')" id="completeAndAddNewBtn" style="width:150px;">
-		<input type="button" class='large-button' onclick="javascript:backEventList();" value="$i18n.getString('save')">
-		<input type="button" class='large-button' onclick="javascript:removeCurrentEvent();" value="$i18n.getString('remove')">
 	</div>
 </div>
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm	2012-07-26 06:12:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm	2012-11-14 05:52:34 +0000
@@ -1,12 +1,19 @@
-
 <a href="index.action"><h2>$i18n.getString( "data_entry" )&nbsp;</h2></a>
-
-<ul>
-	<li><a href="multipledataEntrySelect.action">$i18n.getString( "multiple_individual_records" )&nbsp;</a></li>
-	<li><a href="singleEventSelect.action">$i18n.getString( "single_event_with_registration" )</a></li>
-	<li><a href="anonymousRegistration.action">$i18n.getString( "anonymous_events" )</a></li>
-</ul>
-
-<br>
-
-#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
+<div id="dataEntryMenu">
+	<ul>
+		<li><a href="multipledataEntrySelect.action">$i18n.getString( "multiple_individual_records" )&nbsp;</a></li>
+		<li><a href="singleEventSelect.action">$i18n.getString( "single_event_with_registration" )</a></li>
+		<li><a href="anonymousRegistration.action">$i18n.getString( "anonymous_events" )</a></li>
+	</ul>
+
+	<br>
+	#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
+</div>
+
+<div id="eventActionMenu" class="hidden">
+	<ul>
+		<li><a href="javascript:backEventList();">$i18n.getString( "back_to_event_list" )</a></li>     
+		<li name="eventActionLink"><a href="javascript:completedAndAddNewEvent();">$i18n.getString('complete_and_add_new_event')</a></li>
+		<li name="eventActionLink"><a href="javascript:javascript:removeCurrentEvent();">$i18n.getString('remove')</a></li>
+	</ul>
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-11-13 04:54:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-11-14 05:52:34 +0000
@@ -1,11 +1,13 @@
 
 function organisationUnitSelected( orgUnits, orgUnitNames )
 {
+	showById('dataEntryMenu');
+	hideById('eventActionMenu');
 	hideById('dataEntryInfor');
 	hideById('advanced-search');
 	hideById('minimized-advanced-search');
 	hideById('listDiv');
-	showById('mainLinkLbl');
+	hideById('programName');
 	setFieldValue("listAll", true);
 	setFieldValue("startDate", '');
 	setFieldValue("endDate", '');
@@ -258,6 +260,11 @@
 		var searchingValue = '';
 		params += '&startDate=' + getFieldValue('startDate');
 		params += '&endDate=' + getFieldValue('endDate');
+		if(byId("incompleted").checked)
+		{
+			params += '&completed=false';
+		}
+		params += '&endDate=' + getFieldValue('endDate');
 		jQuery( '#advancedSearchTB tr' ).each( function(index, row){
 			if( index>1 )
 			{
@@ -363,6 +370,9 @@
 
 function showUpdateEvent( programStageInstanceId )
 {
+	hideById('dataEntryMenu');
+	showById('eventActionMenu');
+	jQuery("[name=eventActionLink]").show();
 	hideById('selectDiv');
     hideById('searchDiv');
     hideById('listDiv');
@@ -376,7 +386,7 @@
 		},function()
 		{
 			jQuery('#inputCriteriaDiv').remove();
-			hideById('mainLinkLbl');
+			showById('programName');
 			showById('actionDiv');
 			var programName = jQuery('#programId option:selected').text();
 			var programStageId = jQuery('#programId option:selected').attr('psid');
@@ -398,22 +408,27 @@
 
 function backEventList()
 {
+	showById('dataEntryMenu');
+	hideById('eventActionMenu');
 	hideById('dataEntryInfor');
-	showById('mainLinkLbl');
+	hideById('programName');
 	showById('selectDiv');
 	showById('searchDiv');
 	showById('listDiv');
-	searchEvents( getFieldValue('listAll') );
+	searchEvents( eval(getFieldValue('listAll')) );
 }
 
 function showAddEventForm()
 {
+	showById('eventActionMenu');
+	jQuery("[name=eventActionLink]").hide();
+	hideById('dataEntryMenu');
 	setInnerHTML('dataEntryFormDiv','');
 	setFieldValue('executionDate','');
 	hideById('selectDiv');
 	hideById('searchDiv');
 	hideById('listDiv');
-	hideById('mainLinkLbl');
+	showById('programName');
 	hideById('actionDiv');
 	showById('dataEntryInfor');
 	setFieldValue('programStageInstanceId','0');

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2012-11-06 13:22:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2012-11-14 05:52:34 +0000
@@ -1,4 +1,3 @@
-
 #if( $auth.hasAccess( "dhis-web-caseentry", "patient" ) )
 <h2>$i18n.getString( "patient" )&nbsp;</h2>
 <ul>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm	2012-10-22 09:04:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm	2012-11-14 05:52:34 +0000
@@ -40,7 +40,7 @@
 				<tbody id="list">
 					#foreach( $row in $grid.getRows() )
 						#set($index = 0)
-						<tr id="row"  #alternate( $mark )>
+						<tr id="row" #alternate( $mark )>
 							<td>
 								#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
 								$nr