← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8170: Use report-dates in rescheduled visits in Dashboard.

 

------------------------------------------------------------
revno: 8170
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-09-21 13:20:26 +0700
message:
  Use report-dates in rescheduled visits in Dashboard.
modified:
  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/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  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/programStageInstanceFlow.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.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-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-09-15 09:55:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java	2012-09-21 06:20:26 +0000
@@ -111,6 +111,13 @@
         this.executionDate = executionDate;
     }
 
+    private Integer programStageInstanceId;
+    
+    public void setProgramStageInstanceId( Integer programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
+
     private Integer programId;
 
     public void setProgramId( Integer programId )
@@ -136,8 +143,10 @@
         
         if ( dateValue != null )
         {
-            // Get program-stage-instance of the patient
-            ProgramStageInstance programStageInstance = selectedStateManager.getSelectedProgramStageInstance();
+//            // Get program-stage-instance of the patient
+//            ProgramStageInstance programStageInstance = selectedStateManager.getSelectedProgramStageInstance();
+            
+            ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
 
             // If the program-stage-instance of the patient not exists,
             // create a program-instance and program-stage-instance for

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-21 04:26:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-21 06:20:26 +0000
@@ -834,7 +834,6 @@
 			   data: params,
 			   dataType: "xml",
 			   success: function(result){
-					jQuery('#ps_' + programStageInstanceId ).attr('dueDate', dueDate );
 					handleResponse (result);
 			   },
 			   error: function(request,status,errorThrown) {
@@ -850,6 +849,20 @@
    
 		if ( code == 0 )
 		{
+			var box = jQuery('#ps_' + programStageInstanceId );
+			box.attr('dueDate', dueDate );
+			var boxName = box.attr('psname') + getInnerHTML('enterKey') + dueDate;
+			box.val( boxName );
+			if( dueDate < getCurrentDate() )
+			{
+				box.css('border-color', COLOR_RED);
+				box.css('background-color', COLOR_LIGHT_RED);
+			}
+			else
+			{
+				box.css('border-color', COLOR_YELLOW);
+				box.css('background-color', COLOR_LIGHT_YELLOW);
+			}
 			markValue( resultColor );                   
 		}
 		else

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-09-20 11:17:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-09-21 06:20:26 +0000
@@ -189,13 +189,10 @@
     
 }
 
-function saveExecutionDate( programId, executionDateValue )
+function saveExecutionDate( programId, programStageInstanceId, field )
 {
-    var field = document.getElementById( 'executionDate' );
-	
-    field.style.backgroundColor = SAVING_COLOR;
-	
-    var executionDateSaver = new ExecutionDateSaver( programId, executionDateValue, SUCCESS_COLOR );
+	field.style.backgroundColor = SAVING_COLOR;
+    var executionDateSaver = new ExecutionDateSaver( programId, programStageInstanceId, field.value, SUCCESS_COLOR );
     executionDateSaver.save();
 	
     if( !jQuery("#entryForm").is(":visible") )
@@ -424,9 +421,10 @@
     }
 }
 
-function ExecutionDateSaver( programId_, executionDate_, resultColor_ )
+function ExecutionDateSaver( programId_, programStageInstanceId_, executionDate_, resultColor_ )
 {
     var programId = programId_;
+    var programStageInstanceId = programStageInstanceId_;
     var executionDate = executionDate_;
     var resultColor = resultColor_;
 
@@ -434,6 +432,7 @@
     {
 		var params  = "executionDate=" + executionDate;
 			params += "&programId=" + programId;
+			params += "&programStageInstanceId=" + programStageInstanceId;
 			
 		$.ajax({
 			   type: "POST",
@@ -444,13 +443,17 @@
 					handleResponse (result);
 					var selectedProgramStageInstance = jQuery( '#' + prefixId + getFieldValue('programStageInstanceId') );
 					var box = jQuery(".stage-object-selected");
-					box.val( box.attr('psname') + "  " + executionDate );
+					var boxName = box.attr('psname') + getInnerHTML('enterKey') + executionDate;
+					box.val( boxName );
 					box.css('border-color', COLOR_LIGHTRED);
 					box.css('background-color', COLOR_LIGHT_LIGHTRED);
 					disableCompletedButton(false);
 					enable('validationBtn');
 					setFieldValue( 'programStageId', selectedProgramStageInstance.attr('psid') );
 					
+					var fieldId = "value_" + programStageInstanceId + "_date";
+					jQuery("#" + fieldId).css('background-color', SUCCESS_COLOR);
+					jQuery('#executionDate').val(executionDate);
 			   },
 			   error: function(request,status,errorThrown) {
 					handleHttpError (request);

=== 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-09-21 04:26:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-09-21 06:20:26 +0000
@@ -173,6 +173,5 @@
 			getEventMessages(getFieldValue('programInstanceId'));
 		}
 	});
-	
 	resize();
 </script>

=== 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-20 04:13:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-09-21 06:20:26 +0000
@@ -82,6 +82,8 @@
 	</table>
 </div>
 
+<div id='enterKey'>&#13;&#10;</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" ) , "'" )';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-09-20 14:02:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-09-21 06:20:26 +0000
@@ -105,6 +105,8 @@
 	var i18n_enroll_program = '$encoder.jsEscape( $i18n.getString( "enroll_program" ) , "'")';
 	var i18n_comfirm_delete_event = '$encoder.jsEscape( $i18n.getString( "comfirm_delete_event" ) , "'")';
 	var i18n_the_date_is_scheduled = '$encoder.jsEscape( $i18n.getString( "the_date_is_scheduled" ) , "'")';
+	var i18n_overdue = '$encoder.jsEscape( $i18n.getString( "overdue" ) , "'")';
+	
 	var checkedDuplicate = false;
 	// -1: no search anything
 	//  0: show list all patient