← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8169: Reschedule visits are not refreshed when events are created in Dashboard.

 

------------------------------------------------------------
revno: 8169
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-09-21 11:26:48 +0700
message:
  Reschedule visits are not refreshed when events are created in Dashboard.
modified:
  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/commons.js
  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


--
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/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-09-20 13:04:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-09-21 04:26:48 +0000
@@ -627,6 +627,13 @@
 			<param name="requiredAuthorities">F_PATIENT_UPDATE</param>
 		</action>
 
+		<action name="getVisitSchedule"
+			class="org.hisp.dhis.caseentry.action.patient.GetProgramInstanceAction">
+			<result name="success" type="velocity">/content.vm</result>
+			<param name="page">/dhis-web-caseentry/visitSchedule.vm</param>
+			<param name="requiredAuthorities">F_PROGRAM_ENROLLMENT</param>
+		</action>
+		
 		<!-- Relationship -->
 
 		<action name="getPartner"

=== 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 01:28:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-21 04:26:48 +0000
@@ -650,12 +650,13 @@
 				jQuery('#tb_' + programInstanceId + ' .arrow-right').removeClass("hidden");
 			}
 			
-			if( dueDateInStage< getCurrentDate() ){
+			if( dueDate < getCurrentDate() ){
 				setEventColorStatus( programStageInstanceId, 4 );
 			}
 			else{
 				setEventColorStatus( programStageInstanceId, 3 );
 			}
+			
 			jQuery('#ps_' + programStageInstanceId ).focus();
 			jQuery('#createNewEncounterDiv_' + programInstanceId).dialog("close");
 			loadDataEntry( programStageInstanceId );

=== 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-09-21 03:50:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-09-21 04:26:48 +0000
@@ -442,6 +442,10 @@
 
 function loadProgramInstance( programInstanceId, completed )
 {				
+	if( programInstanceId=='') {
+		hideById('programEnrollmentDiv');
+		return;
+	}
 	jQuery('#loaderDiv').show();
 	jQuery('#programEnrollmentDiv').load('enrollmentform.action',
 		{
@@ -825,4 +829,10 @@
 		} );
 }
 
+// load visit schedule
+function getVisitSchedule( programInstanceId )
+{
+	$('#tab-3').load("getVisitSchedule.action", {programInstanceId:programInstanceId});
+}
+
 function reloadOneRecord(){}

=== 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 03:50:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-09-21 04:26:48 +0000
@@ -75,7 +75,7 @@
 							<table width='100%'>
 								<tr><th>
 										$i18n.getString("active_programs")
-										<input type='button' value='$i18n.getString("enroll_program")' onclick='showProgramEnrollmentForm( "$patient.id" )'/>
+										<a href='javascript:showProgramEnrollmentForm( "$patient.id" )'><label class='bold'>&laquo; $i18n.getString("enroll_program") &raquo;</label></a>
 									</th>
 								</tr>
 							</table>
@@ -126,6 +126,7 @@
 								<tr>
 									<td>
 										<select id="completedList" name="completedList" onchange="javascript:loadProgramInstance(this.value, true);" style="width:100%">
+											<option value="">[$i18n.getString("please_select")]</option>
 											#foreach($programInstance in $completedProgramInstances)
 												#set($programStageInstanceId = '')
 												#if($programInstance.program.type==2)

=== 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-20 13:04:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-09-21 04:26:48 +0000
@@ -111,100 +111,7 @@
 
 	<!-- 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"/>    
-				<tr>
-					<th>$i18n.getString( "nr" )</th>
-					<th>$i18n.getString( "program_stage" )</th>                   
-					<th>$i18n.getString( "reschedule" )</th> 
-					<th>$i18n.getString( "status" )</th>
-					<th>$i18n.getString( "delete" )</th>
-				</tr>
-				
-			#set( $rowCount = 0 )
-			#set( $mark = false )
-			#foreach( $programStageInstance in $programStageInstances )
-				#set( $rowCount = $rowCount + 1 )   
-				<tr id="tr${programStageInstance.id}" #alternate( $mark ) >
-					##rowCount
-					<td>$rowCount</td>        
-					##stage name
-					<td class='textColumn'>
-						<span id="value[$programStageInstance.id].name" title="$!encoder.htmlEncode( $programStageInstance.programStage.description )">
-							$encoder.htmlEncode( $programStageInstance.programStage.name )            
-						</span>
-					</td>        
-						   
-					##entry
-					#set( $duedateId = "value_" + $programStageInstance.id + "_date" )        
-					#set($status = $statusMap.get( $programStageInstance.id ))
-					<td class='input-column '>        
-						<input type="text" id="$duedateId" name="entryfield" value="$!format.formatDate( $programStageInstance.dueDate )" onchange="saveDueDate( $programInstance.id, $programStageInstance.id, '$encoder.jsEncode( $programStageInstance.programStage.name )' )" />
-						<script type="text/javascript">
-							#if($status==1 || $status==5 )
-								disable('$duedateId');
-							#else
-								datePicker( '$duedateId' );
-							#end
-						</script> 
-					</td> 
-
-					<td>$status
-						<select id="stat_$programStageInstance.id" name="status_$programStageInstance.id" style='width:150px;' onchange="setEventStatus(this, $programStageInstance.id)">
-							#if($status==4)
-								<option value='4'>$i18n.getString("overdue")</option>
-								<option value='5'>$i18n.getString("skipped")</option>
-							#elseif($status==3)
-								<option value='3'>$i18n.getString("scheduled_in_future")</option>
-								<option value='5'>$i18n.getString("skipped")</option>
-							#elseif($status==5)
-								<option value='4'>$i18n.getString("overdue")</option>
-								<option value='3'>$i18n.getString("scheduled_in_future")</option>
-								<option value='5'>$i18n.getString("skipped")</option>
-							#else
-								<option value='1'>$i18n.getString("completed")</option>
-								<option value='2'>$i18n.getString("incompleted")</option>
-							#end
-						</select>
-						<script>
-							setFieldValue("stat_$programStageInstance.id", "$status");
-						</script>
-					</td>
-					
-					<td>
-						#if($programStageInstance.programStage.irregular=='true' && ($status==3 || $status==4 || $status==5 ))
-							<a href="javascript:removeEvent($programStageInstance.id, false)" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
-						#end
-					</td>
-				</tr>
-				#set( $mark = !$mark  )
-			#end
-			</table>
-		#end
+		#parse("/dhis-web-caseentry/visitSchedule.vm")
 	</div>
 	
 	<!-- Comments and SMS messages -->
@@ -224,18 +131,12 @@
 			saveIdentifierAndAttribute(programInstance.patient.id,$programInstance.program.id,'programEnrollmentInforForm');
 		});	
 		
-		#if( $!programInstance )
-			showById('unenrollBtn');
-		#end
-		
 		#if( $programInstance.completed)
 			jQuery("[id=tab-2] :input").prop('disabled', true);
 			jQuery("[id=tab-3] :input").prop('disabled', true);
 			jQuery("[id=tab-4] :input").prop('disabled', true);
 			jQuery("[id=tab-5] :input").prop('disabled', true);
 			jQuery("[id=tab-3] :input").datepicker("destroy");
-		#else
-			datePickerInRangeValid( 'dateOfIncident' , 'enrollmentDate' );
 		#end
 	});
 
@@ -262,7 +163,10 @@
 	#end
 	
 	$( "#tabs" ).bind( "tabsselect", function(event, ui) {
-		if( ui.tab.hash == '#tab-5' ){
+		if( ui.tab.hash == '#tab-3' ){
+			getVisitSchedule(getFieldValue('programInstanceId'));
+		}
+		else if( ui.tab.hash == '#tab-5' ){
 			programReports(getFieldValue('programInstanceId'));
 		}
 		else if( ui.tab.hash == '#tab-4' ){
@@ -270,15 +174,5 @@
 		}
 	});
 	
-	setInnerHTML('enrollmentDateDescription', "$!program.dateOfEnrollmentDescription" );
-	setInnerHTML('dateOfIncidentDescription', "$!program.dateOfIncidentDescription" );
-	setFieldValue('enrollmentDate', "$!format.formatDate( $programInstance.enrollmentDate )" );
-	setFieldValue('dateOfIncident', "$!format.formatDate( $programInstance.dateOfIncident )");
-	
-	if ( getFieldValue('enrollmentDate' ) == ''){	
-		jQuery('#enrollBtn').attr( 'value',i18n_enroll );
-	}else{
-		jQuery('#enrollBtn').attr( 'value',i18n_update );
-	}	
 	resize();
 </script>