← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4703: Re-organize registration patient function (finished).

 

------------------------------------------------------------
revno: 4703
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 15:12:23 +0700
message:
  Re-organize registration patient function (finished).
modified:
  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/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/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2011-09-27 07:04:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2011-09-27 08:12:23 +0000
@@ -20,27 +20,10 @@
 				
 			if( type == 'success' )
 			{
-						
-				$( "#loaderDiv" ).show();
-				jQuery.postJSON( "patientform.action",
-					{
-					}, 
-					function( json ) 
-					{   
-						programComboBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
-						
-						for ( i in json.programs ) 
-						{
-							programComboBox += '<option value=' + json.programs[i].id + '>' + json.programs[i].name + '</option>';
-						} 
-						programComboBox += '</select>';
-						
-						showById('searchPatientDiv');
-						enable('listPatientBtn');
-						setInnerHTML('warnmessage','');
-						
-						$( "#loaderDiv" ).hide();
-					});
+				showById('searchPatientDiv');
+				enable('listPatientBtn');
+				setInnerHTML('warnmessage','');
+				setFieldValue('selectedOrgunitText', json.message );
 			}
 			else if( type == 'input' )
 			{

=== 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-09-27 07:04:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2011-09-27 08:12:23 +0000
@@ -7,9 +7,9 @@
 		
 		<tr>
 			<td><label>$i18n.getString( "registering_unit" )</label></td>
-			<td><input type="text" id='selectedOrgunitText' readonly value="[$i18n.getString( 'please_select_village' )]" style="min-width:22em"></td>
+			<td><input type="text" id='selectedOrgunitText' readonly style="min-width:22em"></td>
 			<td>&nbsp;</td>
-			<td><input type="button" id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick='loadAllPatients();' disabled ></td>
+			<td><input type="button" id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick='loadAllPatients();'></td>
 		</tr>
 		
 		<tr>
@@ -115,10 +115,27 @@
 	isAjax = true;
 	contentDiv = '';
 	
-	var programComboBox = '';
 	var searchTextBox = '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" onkeyup="searchPatientsOnKeyUp( event );">';
 	var trueFalseBox  = '<select id="searchText" name="searchText" style="width:20.2em" >';
 		trueFalseBox += '<option value="true">' + i18n_yes + '</option>';
 		trueFalseBox += '<option value="false">' + i18n_no + '</option>';
 		trueFalseBox += '</select>';
+	var programComboBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
+	#foreach ( $program in $programs ) 
+		programComboBox += '<option value="$program.id">$program.name</option>';
+	#end
+	programComboBox += '</select>';
+	
+	#if( $status == 1 )
+		setFieldValue('selectedOrgunitText', i18n_please_select_village );
+		setInnerHTML('warnmessage', '' );
+	#elseif( $status == 2 )
+		setFieldValue('selectedOrgunitText', '$organisationUnit.name' );
+		setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
+	#else
+		setFieldValue('selectedOrgunitText', '$organisationUnit.name' );
+		setInnerHTML('warnmessage', '' );
+		showById('searchPatientDiv');
+	#end
+	
 </script>
\ No newline at end of file