← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4696: Use combox instead of textbox for attributes with boolean type in searching patients.

 

------------------------------------------------------------
revno: 4696
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 14:04:57 +0700
message:
  Use combox instead of textbox for attributes with boolean type in searching patients.
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-14 06:36:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2011-09-27 07:04:57 +0000
@@ -61,11 +61,16 @@
 	var container = jQuery(this_).parent().parent().attr('id');
 	var attributeId = jQuery('#' + container+ ' [id=searchingAttributeId]').val(); 
 	var element = $('#' + container+ ' [id=searchText]');
+	var valueType = jQuery('#' + container+ ' [id=searchingAttributeId] option:selected').attr('valueType');
 	
 	if( attributeId == '0' )
 	{
 		element.replaceWith( programComboBox );
 	}
+	else if ( valueType=='YES/NO' )
+	{
+		element.replaceWith( trueFalseBox );
+	}
 	else
 	{
 		element.replaceWith( searchTextBox );

=== 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-14 06:36:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2011-09-27 07:04:57 +0000
@@ -31,7 +31,7 @@
 					<option value="">$i18n.getString( "search_by_name_identifier" )</option>
 					<option value="0">$i18n.getString( "search_by_program" )</option>
 						#foreach( $attribute in $patientAttributes )
-							<option value="$attribute.id" >$encoder.htmlEncode( $attribute.name )</option>
+							<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
 						#end
 				  </select> 
 				  <em title="$i18n.getString( "required" )" class="required">*</em></label>
@@ -104,7 +104,9 @@
 	var i18n_search_by_name_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_name_identifier" ) , "'")';
 	var i18n_search_by_program = '$encoder.jsEscape( $i18n.getString( "search_by_program" ) , "'")';
 	var i18n_create_new_patient = '$encoder.jsEscape( $i18n.getString( "create_new_patient" ) , "'")';
-	
+	var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+	var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+
 	var checkedDuplicate = false;
 	// -1: no search anything
 	//  0: show list all patient
@@ -115,5 +117,8 @@
 	
 	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>';
 </script>
\ No newline at end of file