← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8095: Improvment Activity Plan (WIP).

 

------------------------------------------------------------
revno: 8095
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-09-15 16:55:28 +0700
message:
  Improvment Activity Plan (WIP).
modified:
  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/caseentry/SaveExecutionDateAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js


--
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-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-09-14 12:07:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-09-15 09:55:28 +0000
@@ -338,7 +338,7 @@
     {
         String selector = count ? "count(*) " : "* ";
 
-        String sql = "select " + selector + "from ( select psi.programstageinstanceid, psi.executiondate,";
+        String sql = "select " + selector + "from ( select DISTINCT psi.programstageinstanceid, psi.executiondate,";
         String where = "";
         String operator = "where ";
 
@@ -434,7 +434,7 @@
         sql += where; // filters
 
         sql = sql.substring( 0, sql.length() - 1 ) + " "; // Remove last comma
-
+        
         return sql;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java	2012-08-16 15:47:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java	2012-09-15 09:55:28 +0000
@@ -173,7 +173,7 @@
                 }
                 else if ( type == Program.SINGLE_EVENT_WITHOUT_REGISTRATION )
                 {
-                    programInstance = programInstanceService.getProgramInstances( patient, program ).iterator().next();
+                    programInstance = programInstanceService.getProgramInstances( program ).iterator().next();
                 }
 
                 // Add a new program-stage-instance

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2012-09-13 08:45:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2012-09-15 09:55:28 +0000
@@ -24,7 +24,7 @@
 #if( $patients && $patients.size()>0 )
 	<p>#parse( "/dhis-web-caseentry/colorHelp.vm" )</p>
 	
-	<table class="listTable" id="patientList">
+	<table id="patientList">
 		#set( $mark = false )                 
 		#foreach( $patient in $patients )
 			#set( $programInstance = '')
@@ -61,8 +61,8 @@
 										<tr>
 										#set( $flag = "false" )
 										#foreach( $programStageInstance in $programStageInstances )
-											<td id="arrow_$programStageInstance.id" name="arrow" width="5px" style='font-size:25px;'>&rarr;</td>
-											<td id="td_$programStageInstance.id" name="td">
+											<td id="arrow_$programStageInstance.id" style='font-size:25px;'>&rarr;</td>
+											<td>
 												#set($title="")
 												#set($index = 0)
 												#foreach( $comment in $programStageInstance.patientComments)
@@ -87,6 +87,7 @@
 													reportDate="$!format.formatDate( $!programStageInstance.executionDate )"
 													reportDateDes="$programStageInstance.programStage.reportDateDescription"
 													dueDate="$format.formatDate( $programStageInstance.dueDate )"
+													status='$programStageInstance.getEventStatus()'
 													class="stage-object" 
 													title="$title"
 													value="$programStageInstance.programStage.name&#13;&#10;$format.formatDate( $programStageInstance.dueDate )" 
@@ -125,27 +126,7 @@
 #end
 
 <script>
-	if(getFieldValue('statusEvent')!="0" ){
-		#if( $programStageInstanceIds 
-			&& $programStageInstanceIds.size() > 0 )
-			
-			jQuery("#patientList .stage-object").each( function(){
-				var programStageInstance = this.id.split('_')[1];
-				hideById('arrow_' + programStageInstance );
-				hideById('td_' + programStageInstance );
-			});
-			
-			jQuery(".arrow-left").css("display", "none");
-			jQuery(".arrow-right").css("display", "none");
-			#foreach( $id in $programStageInstanceIds )
-				showById('arrow_$id');
-				showById('td_$id');
-				jQuery("#ps_$id").addClass("stage-object-selected searched");
-			#end
-		#end
-	}
-	
-	resize();
+	reloadRecordList();
 	$(window).bind('resize', function(e){ 
 		resize();
 	});

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2012-09-13 05:37:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2012-09-15 09:55:28 +0000
@@ -1,27 +1,16 @@
 <script>
 	jQuery(document).ready(	function(){
-		showById('programAddPatientTR');
-		showById('programStageAddPatientTR');
-		showById('sendSmsToListBtn');
-		jQuery("#programIdAddPatient option").each(function(){
-			var item = jQuery(this);
-			if( item.attr('type')!=1 && item.val()!='' ){
-				item.remove();
-			}
+		validation( 'activityPlanForm', function(form){
+			showActitityList();
 		});
 		
-		jQuery("#searchObjectId [value=prg]").remove();
-		jQuery("#searchObjectId").prepend('<option value="-100">' + i18n_please_select_criteria + '</option>');
-		jQuery("#searchObjectId [value=]").attr("selected","selected");
-		hideById('addPatientBtn');
-		disable('advancedSearchBtn');
 		setFieldValue('searchByProgramStage', 'true');
 		setFieldValue('hideLink', 'true');
 	});	
 </script>
 
 <h3>$i18n.getString( "activity_plan" )</h3>
-<form>
+<form id='activityPlanForm' name='activityPlanForm'>
 	<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
 	<input type='hidden' id='listAll' name='listAll'>
 	<input type='hidden' id='sendToList' name='sendToList'>
@@ -31,7 +20,7 @@
 	<input type='hidden' id='orgunitId' name='orgunitId' value='$organisationUnit.id' >
 	<input type="hidden" id='hideLink' name='hideLink' value='false'>
 	<input type='hidden' id='isSearchByProgram' name='isSearchByProgram' value='false' >
-	<div id='advanced-search' style='width:500px;'>
+	<div id='advanced-search' style='width:550px;'>
 		<table style="margin-bottom:8px">    
 			<tr>
 				<td>
@@ -41,17 +30,20 @@
 					<input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end >
 				</td>
 			</tr> 
-			<tr id='programAddPatientTR' class='hidden'>
+			<tr>
 				<td>$i18n.getString('program')</td>
 				<td>
-					<select id='programIdAddPatient' name='programIdAddPatient' onchange='enableBtn();'>
+					<select id='programIdAddPatient' name='programIdAddPatient' class="{validate:{required:true}}" >
+						<option value="">[$i18n.getString("please_select")]</option>
 						#foreach($program in $programs)
-							<option value="$program.id" type='$program.type'>$program.name</option>
+							#if($program.type=='1') 
+								<option value="$program.id" type='$program.type'>$program.name</option>
+							#end
 						#end
 					</select>
 				</td>
 			</tr>
-			<tr id='programStageAddPatientTR'>
+			<tr>
 				<td>$i18n.getString('status')</td>
 				<td>
 					<select id="statusEvent" name="statusEvent" onchange="statusEventOnChange()">
@@ -89,8 +81,8 @@
 			</tr>
 			<tr>
 				<td></td>
-				<td valign='bottom'>
-					<input type="button" class='large-button' id='listPatientBtn' value="$i18n.getString( 'show_activity_list' )" onclick="javascript:showActitityList();" >
+				<td>
+					<input type="submit" class='large-button' id='listPatientBtn' value="$i18n.getString( 'show_activity_list' )">
 				</td>
 			</tr>
 		</table>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-08-28 07:59:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-09-15 09:55:28 +0000
@@ -11,6 +11,7 @@
 			setFieldValue( 'executionDate', "$!format.formatDate( $programStageInstance.executionDate )" );
 		#end
 		
+		$('#executionDate').unbind("change");
 		$('#executionDate').change(function() {
 				saveExecutionDate( getFieldValue('programId'), getFieldValue('executionDate') );
 			});

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2012-09-15 04:18:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2012-09-15 09:55:28 +0000
@@ -15,7 +15,6 @@
 					jQuery( '#programIdAddPatient').append( '<option value="' + json.programs[i].id +'" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' );
 				}
 			}
-			enableBtn();
 		});
 }
 
@@ -66,7 +65,7 @@
 	jQuery("#tb_" + programInstanceId + " .stage-object").each( function(){
 			var programStageInstance = this.id.split('_')[1];
 			jQuery('#arrow_' + programStageInstance ).toggle();
-			jQuery('#td_' + programStageInstance ).toggle();
+			jQuery('#ps_' + programStageInstance ).toggle();
 			jQuery(this).removeClass("stage-object-selected");
 		});
 	
@@ -74,7 +73,7 @@
 	{	
 		var id = jQuery("#tb_" + programInstanceId + " .searched").attr('id').split('_')[1];
 		showById("arrow_" + id);
-		showById("td_" + id );
+		showById("ps_" + id );
 	}
 	resize();
 }
@@ -207,13 +206,41 @@
 	jQuery("#endDueDate").val(endDate);
 }
 
-
 function setDateRangeAll()
 {
 	var date = new Date();
 	var d = date.getDate();
 	var m = date.getMonth();
 	var y= date.getFullYear();
-	
-	
+}
+
+function reloadRecordList()
+{
+	var listAll = getFieldValue('listAll');
+	var startDate = getFieldValue('startDueDate');
+	var endDate = getFieldValue('endDueDate');
+	var status = getFieldValue('statusEvent');
+	
+	jQuery("#patientList .stage-object").each( function(){
+		var id = this.id.split('_')[1];
+		var dueDate = jQuery(this).attr('dueDate');
+		var statusEvent = jQuery(this).attr('status');
+		var programInstanceId = jQuery(this).attr('programInstanceId');
+		if( dueDate >= startDate && dueDate <= endDate 
+			&& (( status!='0' && statusEvent == status ) || status=='0' ))
+		{
+			if( jQuery("#tb_" + programInstanceId + " .searched").length > 0 ){
+				jQuery("#ps_" + id ).addClass("stage-object-selected searched");
+				hideById("ps_" + id )
+				hideById('arrow_' + id );
+			}
+			jQuery("#ps_" + id ).addClass("stage-object-selected searched");
+		}
+		else
+		{
+			hideById('arrow_' + id );
+			hideById('ps_' + id );
+		}
+	});
+	resize();
 }
\ No newline at end of file