← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4844: Add tabs for two functions Enroll and Registry Event into Errollment part form.

 

------------------------------------------------------------
revno: 4844
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-10-06 11:38:13 +0700
message:
  Add tabs for two functions Enroll and Registry Event into Errollment part form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
  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/patient.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/programEnrollmentSelectForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties


--
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/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2011-10-04 06:28:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2011-10-06 04:38:13 +0000
@@ -1,8 +1,10 @@
-<div>
-    <input type="button" value="$i18n.getString( 'back_to_search' )" id='backBtnFromEntry' onclick="javascript:showSearchForm();" style="width:10em">
-</div>
-   
-<table class="mainPageTable"> 
+   	
+<table class="mainPageTable" id='patientInfoDiv'> 
+	<tr>
+		<td>
+			<input type="button" value="$i18n.getString( 'back_to_search' )" id='backBtnFromEntry' onclick="javascript:showSearchForm();" style="width:10em">
+		</td>
+	</tr>
 	<tr>
 		<td>
 	<table>
@@ -27,10 +29,11 @@
 			<div id="currentSelection" style="float:right"></div>
 		</td>
 	</tr>
+	<tr>
+		<td colspan='2'><hr style="clear:both"></td>
+	</tr>
 </table>
 
-<hr style="clear:both">
-
 <table width='100%'> 
    <tr>
         <td><label for="programId">$i18n.getString( "program" )</label></td>

=== 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	2011-10-04 06:28:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2011-10-06 04:38:13 +0000
@@ -7,14 +7,15 @@
 {
 	hideById('dataEntryFormDiv');
 	clearListById('programStageId');
-		
-	if ( getFieldValue('programId') == 0 )
+	var programId = jQuery('#dataRecordingSelectDiv [name=programId]').val();
+	
+	if ( programId == 0 )
 	{
 		return;
 	}
 	jQuery.postJSON( "loadProgramStages.action",
 		{
-			programId: getFieldValue('programId')
+			programId: programId
 		}, 
 		function( json ) 
 		{    
@@ -41,8 +42,8 @@
 			}
 			history += '</table>';
 			setInnerHTML( 'currentSelection', history );
-			
-			var singleEvent = jQuery('#programId option:selected').attr('singleevent');
+			jQuery('#dataRecordingSelectDiv select[name=programId] option')
+			var singleEvent = jQuery('#dataRecordingSelectDiv [name=programId] option:selected').attr('singleevent');
 			if(singleEvent=='true')
 			{
 				byId('programStageId').selectedIndex = 1;

=== 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	2011-10-05 03:39:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2011-10-06 04:38:13 +0000
@@ -473,6 +473,9 @@
 		disable('enrollBtn');
 		disable('enrollmentDate');
 		disable('dateOfIncident');
+		jQuery('#enrollBtn').attr('value',i18n_enroll_to_program);
+		setFieldValue( 'enrollmentDate', '' );
+		setFieldValue( 'dateOfIncident', '' );
 		return;
 	}
 		
@@ -849,9 +852,6 @@
 		},
 		function()
 		{
-			setInnerHTML('enrollmentDiv', "");
-			showById('dataRecordingSelectDiv');
-			
 			jQuery('#dataRecordingSelectDiv select[name=programId] option').each(function()
 			{
 				var singleEvent = jQuery(this).attr('singleevent');
@@ -861,29 +861,9 @@
 				}
 			});
 			
-			jQuery("#backBtnFromEntry").click(function() {
-					loadPatientList();
-			});
+			hideById('patientInfoDiv');
+			showById('dataRecordingSelectDiv');
+			
 			hideLoader();
 		});
 }
-
-function enableEnrollmentField()
-{
-	var status = jQuery('#programId').attr('disabled');
-	
-	if( status )
-	{
-		jQuery('#enrollBtn').attr('value',i18n_enroll);
-		jQuery("#enrollBtn").click(function() {
-			validateProgramEnrollment();
-		});
-		enable('programId');
-		enable('enrollmentDate');
-		enable('dateOfIncident');
-	}
-	else
-	{
-		jQuery('#enrollBtn').attr('value',i18n_update);
-	}
-}

=== 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	2011-10-04 06:28:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2011-10-06 04:38:13 +0000
@@ -56,7 +56,7 @@
 	setFieldValue('dateOfIncident', "$!format.formatDate( $programInstance.dateOfIncident )");
 	
 	if ( getFieldValue('enrollmentDate' ) == ''){	
-		jQuery('#enrollBtn').attr( 'value',i18n_enroll );
+		jQuery('#enrollBtn').attr( 'value',i18n_enroll_to_program );
 	}else{
 		jQuery('#enrollBtn').attr( 'value',i18n_update );
 	}	

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2011-10-05 03:39:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2011-10-06 04:38:13 +0000
@@ -4,9 +4,9 @@
 
     <input type="hidden" id="patientId" name="patientId" value="$patient.id">    
 
-	<table>
+	<table width='100%'>
 		<tr>
-			<td class='bold'>$i18n.getString( "full_name" ):</td>
+			<td class='bold' style="width:100px">$i18n.getString( "full_name" ):</td>
 			<td>$encoder.htmlEncode( $patient.getFullName() )</td>
 		</tr>
 		<tr>
@@ -20,66 +20,87 @@
 		<tr>
 			<td class='bold'>$i18n.getString( "age" ):</td>
 			<td>$encoder.htmlEncode( $patient.getAge() )</td>
-		</tr>    
-		<tr>
-			<td>&nbsp;</td>
-		</tr>
-	</table>
-
-	<hr style="clear:both">
-
-	<table width='100%'>    
-		<tr>
-			<td style="width:180px"><label for="programId">$i18n.getString( "program" )</label></td>
-			<td>
-				<select id="programId" name="programId" style='width:30.3em' onchange="showProgramEnrollmentForm('$patient.id', this.value);" style="min-width:200px" disabled="disabled" >
-					<option value="0">[$i18n.getString( "select" )]</option>
-					#foreach( $program in $programs )
-						<option value="$program.id" singleevent='$program.singleEvent'>$encoder.htmlEncode( $program.name )</option>
-					#end
-				</select>
+			<td align='right'>
+				<input type="button" value="$i18n.getString( "back_to_search" )" onclick="loadPatientList();" style="width:10em">
 			</td>
-			<td></td>
-			</td></td>
-		</tr>   
+		</tr>
+	</table>
+	
+	<hr/>
+	<!-- TAB Header -->
+	<div id="tabs">
+		<ul>
+			<li><a href="#tab-1">$i18n.getString("enroll_program")</a></li>
+			<li><a href="#tab-2">$i18n.getString("register_event")</a></li>
+		</ul>
+		
+		<!-- Enroll program TAB -->
+		<div id="tab-1">
+			<table width='100%'>    
+				<tr>
+					<td style="width:180px"><label for="programId">$i18n.getString( "program" )</label></td>
+					<td>
+						<select id="programId" name="programId" style='width:30.3em' onchange="showProgramEnrollmentForm('$patient.id', this.value);" style="min-width:200px" >
+							<option value="0">[$i18n.getString( "select" )]</option>
+							#foreach( $program in $programs )
+								<option value="$program.id" singleevent='$program.singleEvent'>$encoder.htmlEncode( $program.name )</option>
+							#end
+						</select>
+					</td>
+					<td></td>
+					</td></td>
+				</tr>   
+					
+				<tr>
+					<td><label for="enrollmentDate">$i18n.getString( "date_of_enrollment" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+					<td colspan='2' align='left'><input type="text" id="enrollmentDate" name="enrollmentDate" style='width:30em' disabled="disabled" > <i>( <span id='enrollmentDateDescription'></span> )</i></td>
+					</tr>
+				
+				<tr>
+					<td><label for="dateOfIncident">$i18n.getString( "date_of_incident" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+					<td colspan='2'><input type="text" id="dateOfIncident" name="dateOfIncident" style='width:30em' disabled="disabled" ><i>( <span id='dateOfIncidentDescription'></span> )</i></td>
+				</tr>
+				<tr>
+					<td></td>
+					<td></td>   
+					<td></td>                             
+				</tr>
+				
+				<tr>
+					<td style="width:180px"></td>
+					<td colspan='2'>
+						<input type="button" id='enrollBtn' name='enrollBtn' value="$i18n.getString( 'enroll_to_program' )" style='width:10em' onclick="validateProgramEnrollment();" disabled='disabled'/>
+					</td>
+				</tr>
+			</table>
 			
-		<tr>
-			<td><label for="enrollmentDate">$i18n.getString( "date_of_enrollment" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-			<td colspan='2' align='left'><input type="text" id="enrollmentDate" name="enrollmentDate" style='width:30em' disabled="disabled" > <i>( <span id='enrollmentDateDescription'></span> )</i></td>
-			</tr>
-		
-		<tr>
-			<td><label for="dateOfIncident">$i18n.getString( "date_of_incident" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-			<td colspan='2'><input type="text" id="dateOfIncident" name="dateOfIncident" style='width:30em' disabled="disabled" ><i>( <span id='dateOfIncidentDescription'></span> )</i></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td></td>   
-			<td></td>                             
-		</tr>
-		
-		<tr>
-			<td></td>
-			<td style="width:180px" colspan='2'>
-				<input type="button" id='enrollBtn' name='enrollBtn' value="$i18n.getString( 'enroll_to_program' )" style='width:10em' onclick="enableEnrollmentField();" />
-				<input type="button" value="$i18n.getString( 'register_event' )" onclick="showSelectedDataRecoding('$patient.id')" #if($registerEvent=='false') disabled="disabled" #end style='width:10em'/>
-				<input type="button" value="$i18n.getString( "back_to_search" )" onclick="loadPatientList();" style="width:10em">
-			</td>                                        
-		</tr>
-	</table>
+			<div id='programEnrollmentDiv' style='display:none;'></div>
+		</div>
+
+		<!-- register-event TAB -->
+		<div id="tab-2">
+			<div id='dataRecordingSelectDiv' style='display:none;'></div>
+			<div id='dataEntryFormDiv'  style='display:none;'></div>
+
+		</div>
 </div>
 
-<div id='programEnrollmentDiv' style='display:none;'></div>
-
 <script>
-	var i18n_enroll = '$encoder.jsEscape( $i18n.getString( "enroll" ) , "'")';
+	var i18n_enroll_to_program = '$encoder.jsEscape( $i18n.getString( "enroll_to_program" ) , "'")';
 	
-	jQuery('#programEnrollmentSelectDiv').ready(
-			function()
-			{
-                datePickerValid( 'enrollmentDate' );
-                datePickerValid( 'dateOfIncident' );
-			}
-	);
+	jQuery('#programEnrollmentSelectDiv').ready(function()
+		{
+			jQuery("#tabs").tabs();
+			datePickerValid( 'enrollmentDate' );
+			datePickerValid( 'dateOfIncident' );
+			
+			$( "#tabs" ).tabs( "option", "selected", 0 );
+			$('#tabs').bind('tabsselect', function(event, ui) {
+				if( ui.index == 1 )
+				{
+					showSelectedDataRecoding( getFieldValue('patientId') );
+				}
+			});
+		});
 	
 </script>

=== 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	2011-10-04 06:28:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2011-10-06 04:38:13 +0000
@@ -58,8 +58,6 @@
 <div id='enrollmentDiv'></div> <!-- Program Enrollment Form -->
 <div id='listRelationshipDiv'></div> <!-- List relationship -->
 <div id='addRelationshipDiv'></div> <!-- Add relationship -->
-<div id='dataRecordingSelectDiv'></div>
-<div id='dataEntryFormDiv'></div>
 
 #parse( "/dhis-web-commons/loader/loader.vm" )
 
@@ -82,7 +80,7 @@
     var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")'; 
 	var i18n_date_invalid = '$encoder.jsEscape( $i18n.getString( "date_invalid" ) , "'")';
 	var i18n_date_less_incident = '$encoder.jsEscape( $i18n.getString( "date_less_incident" ) , "'")';
-	var i18n_enroll = '$encoder.jsEscape( $i18n.getString( "enroll" ) , "'")';
+	var i18n_enroll_to_program = '$encoder.jsEscape( $i18n.getString( "enroll_to_program" ) , "'")';
 	var i18n_update = '$encoder.jsEscape( $i18n.getString( "update" ) , "'")';
 	var i18n_oucode_must_have_9_digits = '$encoder.jsEscape( $i18n.getString( "oucode_must_be_valid" ) , "'")';
 	var i18n_patient_identifiers = '$encoder.jsEscape( $i18n.getString( "patient_identifiers" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-10-05 09:19:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-10-06 04:38:13 +0000
@@ -382,4 +382,4 @@
 others = Others
 test_condition = Test condition
 run_success = Run successful
-run_fail = run fail
\ No newline at end of file
+run_fail = Run failed
\ No newline at end of file