← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8194: Update link to next visit after setting status of events.

 

------------------------------------------------------------
revno: 8194
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-09-22 22:52:58 +0700
message:
  Update link to next visit after setting status of events.
modified:
  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/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.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/programStageInstanceFlow.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/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-09-21 01:10:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-09-22 15:52:58 +0000
@@ -217,7 +217,7 @@
 delete_current_event=Deleted current event
 delete_event_success=Deleted event successfully
 please_enter_report_date=Please enter report date
-comfirm_delete_event=Are you sure you want to delete the event?
+comfirm_delete_event=All data values in an event will be deleted when the event is deleted. Are you sure you want to delete the event ?
 registered_by_orgunit=Registered by facility
 event_information=Event information
 history_events=History events

=== 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-22 13:08:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-22 15:52:58 +0000
@@ -663,6 +663,7 @@
 			
 			jQuery('#ps_' + programStageInstanceId ).focus();
 			jQuery('#createNewEncounterDiv_' + programInstanceId).dialog("close");
+			resetActiveEvent( programStageInstanceId );
 			loadDataEntry( programStageInstanceId );
 			showSuccessMessage(i18n_create_event_success);
 		});
@@ -758,7 +759,10 @@
 				showById('programInstanceDiv');
 			}
 			activeProgramInstanceDiv( programInstanceId );
-			loadDataEntry( activeProgramStageInstanceId );
+			if( activeProgramStageInstanceId )
+			{
+				loadDataEntry( activeProgramStageInstanceId );
+			}
 			jQuery('#loaderDiv').hide();
 		});
 }
@@ -927,6 +931,7 @@
 
 function setEventStatus( field, programStageInstanceId )
 {	
+	var status = field.value;
 	field.style.backgroundColor = SAVING_COLOR;
 	jQuery.postUTF8( 'setEventStatus.action',
 		{
@@ -936,16 +941,66 @@
 		{
 			jQuery('#ps_' + programStageInstanceId).attr('status',field.value);
 			setEventColorStatus( programStageInstanceId, field.value );
+			resetActiveEvent( programStageInstanceId );
 			if( status==1){
 				hideById('del_' + programStageInstanceId);
 			}
 			else{
 				showById('del_' + programStageInstanceId);
+				if( status==5){
+					var id = 'ps_' + programStageInstanceId;
+					if( jQuery(".stage-object-selected").attr('id')==id )
+					{
+						hideById('entryForm');
+						hideById('executionDateTB');
+						hideById('inputCriteriaDiv');
+					}
+				}
 			}
 			field.style.backgroundColor = SUCCESS_COLOR;
 		} );
 }
 
+function resetActiveEvent( programStageInstanceId )
+{
+	var activeProgramInstance = jQuery(".selected");
+	if( activeProgramInstance.length > 0 )
+	{
+		var programInstanceId = activeProgramInstance.attr('id').split('_')[1];
+		var hasActiveEvent = false;
+		jQuery(".stage-object").each(function(){
+			var status = jQuery(this).attr('status');
+			if(status !=1 && status != 5 && !hasActiveEvent){
+				var value = jQuery(this).val();
+				var programStageInstanceId = jQuery(this).attr('id').split('_')[1];
+				
+				jQuery('#td_' + programInstanceId).attr("onClick", "javascript:loadActiveProgramStageRecords("+ programInstanceId +", "+ programStageInstanceId  +")")
+				jQuery('#tr2_' + programInstanceId).html("<a>>>" + value + "</a>");
+				jQuery('#tr2_' + programInstanceId).attr("onClick", "javascript:loadActiveProgramStageRecords("+ programInstanceId +", "+ programStageInstanceId + ")");
+				
+				var id = 'ps_' + programStageInstanceId;
+				enable('ps_' + programStageInstanceId );
+				if( jQuery(".stage-object-selected").attr('id')!=jQuery(this).attr('id') )
+				{
+					hideById('entryForm');
+					hideById('executionDateTB');
+					hideById('inputCriteriaDiv');
+				}
+				hasActiveEvent = true;
+			}
+		});
+		
+		if( !hasActiveEvent ){
+			jQuery('#td_' + programInstanceId).attr("onClick", "javascript:loadActiveProgramStageRecords("+ programInstanceId +", false)")
+			jQuery('#tr2_' + programInstanceId).html("");
+			jQuery('#tr2_' + programInstanceId).attr("onClick", "");
+			
+			hideById('entryForm');
+			hideById('executionDateTB');
+			hideById('inputCriteriaDiv');
+		}
+	}	
+}
 
 function removeEvent( programStageInstanceId, isEvent )
 {	

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-09-22 13:08:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-09-22 15:52:58 +0000
@@ -6,6 +6,8 @@
 {
 	setInnerHTML('dataEntryFormDiv', '');
 	showById('dataEntryFormDiv');
+	showById('executionDateTB');
+	showById('inputCriteriaDiv');
 	setFieldValue( 'dueDate', '' );
 	setFieldValue( 'executionDate', '' );
 	disable('validationBtn');
@@ -28,9 +30,6 @@
 			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
 			var reportDateDes = jQuery("#ps_" + programStageInstanceId).attr("reportDateDes");
 			setInnerHTML('reportDateDescriptionField',reportDateDes);
-			showById('entryForm');
-			showById('executionDateTB');
-			showById('inputCriteriaDiv');
 			enable('validationBtn');
 			if( executionDate == '' )
 			{
@@ -47,7 +46,7 @@
 			resize();
 			hideLoader();
 			hideById('contentDiv'); 
-			jQuery('#executionDate').focus();
+			jQuery('#dueDate').focus();
 		} );
 }
 

=== 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-09-21 04:26:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-09-22 15:52:58 +0000
@@ -92,16 +92,17 @@
 										#set($flag = 'false')
 										#foreach( $programStageInstance in $programInstance.programStageInstances )
 											#set( $status = $statusMap.get( $programStageInstance.id ) )
-											#if( $status!=1 && $flag=='false')
+											#if( $status!=1 && $status!=5 && $flag=='false')
 												<tr id='tr1_$programInstance.id' type='$programInstance.program.type'
-													programStageInstanceId='$programStageInstanceId'>
+													programStageInstanceId='$programStageInstanceId' style='cursor:pointer;'
+													onclick='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")' >
 													<td id='td_$programInstance.id'>
-														<a href='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")'><span id='infor_$programInstance.id'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</span></a>
+														<a><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>
-														<a>&#8226; $programStageInstance.programStage.name ($format.formatDate($programStageInstance.dueDate))</a>
+												<tr>
+													<td id='tr2_$programInstance.id' onclick='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")' style='cursor:pointer;'>
+														<a>>> $programStageInstance.programStage.name ($format.formatDate($programStageInstance.dueDate))</a>
 													</td>
 												</tr>
 											#set($flag = 'true')
@@ -109,11 +110,15 @@
 										#end
 										#if($flag=='false')
 										<tr id='tr1_$programInstance.id' type='$programInstance.program.type'
-											programStageInstanceId='$programStageInstanceId'>
+											programStageInstanceId='$programStageInstanceId' style='cursor:pointer;'
+											onclick='javascript:loadActiveProgramStageRecords("$programInstance.id", false)' >
 											<td id='td_$programInstance.id'>
-												<a href='javascript:loadProgramInstance($programInstance.id, false)'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
+												<a><span id='infor_$programInstance.id'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</span></a>
 											</td>
 										</tr>
+										<tr style='cursor:pointer;'>
+											<td id='tr2_$programInstance.id'></td>
+										</tr>
 										#end
 									#end
 								</table>

=== 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-21 10:08:15 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-09-22 15:52:58 +0000
@@ -19,6 +19,7 @@
 								id="ps_$!programStageInstance.id"
 								psid="$programStageInstance.programStage.id"
 								psname="$programStageInstance.programStage.name"
+								status="$programStageInstance.getEventStatus()"
 								orgunit="$!programStageInstance.organisationUnit.name"
 								programType='$programInstance.program.type'
 								reportDate="$!format.formatDate( $!programStageInstance.executionDate )"