← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4705: Cannot select patient after searching patient in Child's representative form.

 

------------------------------------------------------------
revno: 4705
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 15:33:08 +0700
message:
  Cannot select patient after searching patient in Child's representative form.
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js
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/resources/struts.xml
  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/style/patient.css


--
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	2011-09-27 04:19:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2011-09-27 08:33:08 +0000
@@ -424,4 +424,6 @@
 save_success 													= Save successfully
 yes_and_attribute 												= Yes and Inherit Attribute
 identifiers														= Identifiers
-relationship_type												= Relationship Type
\ No newline at end of file
+relationship_type												= Relationship Type
+identifier_type													= Beneficiary Identifier Type
+choose_this_person												= Choose this person
\ No newline at end of file

=== 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	2011-09-27 08:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-09-27 08:33:08 +0000
@@ -317,6 +317,7 @@
 				,javascript/commons.js
 				,javascript/patient.js
 				,javascript/relationshipPatient.js
+				,javascript/underage.js
 			</param>
 		</action>
 
@@ -397,7 +398,7 @@
 			<param name="page">/dhis-web-caseentry/underAgeForm.vm</param>
 			<param name="javascripts">javascript/underage.js,
 				../dhis-web-commons/javascripts/date.js</param>
-			<param name="stylesheets">style/basic.css</param>
+			<param name="stylesheets">style/patient.css</param>
 		</action>
 
 		<action name="searchPerson"

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js	2011-09-27 08:33:08 +0000
@@ -0,0 +1,207 @@
+//-----------------------------------------------------------------------------
+//Add Patient
+//-----------------------------------------------------------------------------
+
+function validateAddRepresentative()
+{	
+	$.post("validatePatient.action?" + getIdentifierTypeIdParams(),
+		{
+			fullName: jQuery( '#addRepresentativeForm [id=fullName]' ).val(),
+			gender: jQuery( '#addRepresentativeForm [id=gender]' ).val(),
+			birthDate: jQuery( '#addRepresentativeForm [id=birthDate]' ).val(), 	        
+			age: jQuery( '#addRepresentativeForm [id=age]' ).val(),
+			dobType: jQuery( '#addRepresentativeForm [id=dobType]' ).val(),
+			ageType: jQuery( '#addRepresentativeForm [id=ageType]' ).val()
+		}, addValidationRepresentativeCompleted, "xml" );
+}
+
+function addValidationRepresentativeCompleted( messageElement )
+{
+	var type = $(messageElement).find('message').attr('type');
+	var message = $(messageElement).find('message').text();
+    
+	 if ( type == 'success' )
+	 {
+		jQuery.ajax({
+			type: "POST"
+			,url: "addRepresentative.action"
+			,data: jQuery("#addRepresentativeForm").serialize()
+			,dataType : "xml"
+			,success: function(xml){ 
+				autoChoosePerson( xml );
+			}
+		   ,error: function()
+		   {
+				alert(i18n_error_connect_to_server);
+		   }
+		});
+		
+	 }
+	 else if ( type == 'error' )
+	 {
+	     showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message );
+	 }
+	 else if ( type == 'input' )
+	 {
+	     showWarningMessage( message );
+	 }
+	 else if( type == 'duplicate' )
+	 {
+		 jQuery("#formContainer").hide();
+		 showPersons("listPersonsDuplicate", messageElement);
+	 }
+}
+
+//get and build a param String of all the identifierType id and its value
+//excluding  identifiers which related is False
+function getIdentifierTypeIdParams()
+{
+	var params = "";
+	jQuery("#addRepresentativeForm :input.idfield").each(
+			function()
+			{
+				if( jQuery(this).val() && !jQuery(this).is(":disabled") )
+					params += "&" + jQuery(this).attr("name") +"="+ jQuery(this).val();
+			}
+	);
+	return params;
+}
+
+function searchPerson()
+{
+	jQuery.ajax({
+		   type: "POST"
+		   ,url: "searchPerson.action"
+		   ,data: jQuery("#searchForm").serialize()
+		   ,dataType : "xml"
+		   ,success: function(xmlObject){
+				showPersons( "searchForm div[id=listPersons]", xmlObject );
+			}
+		   ,error: function(request,status,errorThrown)
+		   {
+				alert(i18n_error_connect_to_server);
+		   }
+		 });
+}
+
+function showPersons( divContainer, xmlElement )
+{
+	var container = jQuery("#"+divContainer);
+	container.html("");
+	var patients = $(xmlElement).find('patient');
+	var sPatient = "";
+	
+	if ( patients.length == 0 )
+	{
+		var message = "<p>" + i18n_no_result + "</p>";
+		container.html(message);
+	}
+	
+	$( patients ).each( function( i, patient )
+    {
+		sPatient += "<hr style='margin:5px 0px;'><table>";
+		sPatient += "<tr><td><strong>" + i18n_patient_system_id + "</strong></td><td>" + $( patient ).find('systemIdentifier').text() + "</td></tr>" ;
+		sPatient += "<tr><td><strong>" + i18n_patient_full_name + "</strong></td><td>" + $( patient ).find('fullName').text() + "</td></tr>" ;
+		sPatient += "<tr><td><strong>" + i18n_patient_gender + "</strong></td><td>" + $( patient ).find('gender').text() + "</td></tr>" ;
+		sPatient += "<tr><td><strong>" + i18n_patient_date_of_birth + "</strong></td><td>" + $( patient ).find('dateOfBirth').text() + "</td></tr>" ;
+		sPatient += "<tr><td><strong>" + i18n_patient_age + "</strong></td><td>" + $( patient ).find('age').text() + "</td></tr>" ;
+		sPatient += "<tr><td><strong>" + i18n_patient_blood_group + "</strong></td><td>" + $( patient ).find('bloodGroup').text() + "</td></tr>";
+		
+		var identifiers =  $( patient ).find('identifier');
+		$( identifiers ).each( function( i, identifier )
+		{
+			sPatient +="<tr class='identifierRow" + $(identifier).find('id').text() + "' id='iden" + $(identifier).find('id' ).text() + "'>"
+				+"<td><strong>" + $(identifier).find('name').text() + "</strong></td>"
+				+"<td class='value'>" + $(identifier).find('value').text() + "</td>	"	
+				+"</tr>";
+		});
+		
+		var attributes = $( patient ).find('attribute');
+		$( attributes ).each( function( i, attribute )
+		{
+				sPatient += "<tr class='attributeRow'>"
+					+ "<td><strong>" + $(attribute).find('name').text() + "</strong></td>"
+					+ "<td>" + $(attribute).find('value').text() + "</td>	"	
+					+ "</tr>";
+		});
+		
+		sPatient += "<tr><td colspan='2'><input type='button' id='" + $(patient).find('id' ).first().text() +"' value='" + i18n_choose_this_person + "' onclick='choosePerson(this)'/></td></tr>";
+		sPatient += "</table>";
+		
+		container.append(sPatient);
+	 } );
+}
+
+// Will be call after save new person successfully
+function autoChoosePerson( xmlElement )
+{
+	jQuery("#tab-2").html("<center><strong>" + i18n_add_person_successfully + "</strong></center>");
+	var root = jQuery(xmlElement);
+	jQuery("#addPatientForm [id=representativeId]").val( root.find("id").text() );
+	jQuery("#addPatientForm [id=relationshipTypeId]").val( root.find("relationshipTypeId").text() );
+	root.find("identifier").each(
+			function(){
+				var inputField = jQuery("#addPatientForm iden" + jQuery(this).find("identifierTypeId").text());
+				inputField.val( jQuery(this).find("identifierText").text() );
+				inputField.attr({"disabled":"disabled"});
+			}
+	);
+}
+
+//------------------------------------------------------------------------------
+// Set Representative information to parent page.
+//------------------------------------------------------------------------------
+
+function choosePerson(this_)
+{
+	var relationshipTypeId = jQuery("#searchForm [id=relationshipTypeId]").val();
+	if( isBlank( relationshipTypeId ))
+	{
+		alert(i18n_please_select_relationshipType);
+		return;
+	}
+	
+	var id = jQuery(this_).attr("id");
+	jQuery("#addPatientForm [id=representativeId]").val(id);
+	jQuery("#addPatientForm [id=relationshipTypeId]").val(relationshipTypeId);
+	jQuery(".identifierRow"+id).each(function(){
+		var inputField = window.parent.jQuery("#"+jQuery(this).attr("id"));
+		if( inputField.metadata({type:"attr",name:"data"}).related  )
+		{
+			// only inherit identifierType which related is true
+			inputField.val(jQuery(this).find("td.value").text());
+			inputField.attr({"disabled":"disabled"});
+		}
+	});
+	
+	jQuery('#representativeDiv').dialog('close');
+}
+
+function toggleSearchType(this_)
+{
+	var type = jQuery(this_).val();
+	if( "identifier" == type )
+	{
+		jQuery("#searchForm [id=rowIdentifier]").show().find("identifierTypeId").addClass('required:true');
+		jQuery("#searchForm [id=rowAttribute]").hide().find("id=attributeId").removeClass("required");
+		jQuery("#searchForm [id=searchValue]").val("");
+	}
+	else if( "attribute" == type )
+	{
+		jQuery("#searchForm [id=rowIdentifier]").hide().find("#identifierTypeId").removeClass("required");
+		jQuery("#searchForm [id=rowAttribute]").show().find("#attributeId").addClass("required:true");
+		jQuery("#searchForm [id=searchValue]").val("");
+	}
+	else if( "name" == type || "" == type )
+	{
+		jQuery("#searchForm [id=rowIdentifier]").hide().find("#identifierTypeId").removeClass("required");
+		jQuery("#searchForm [id=rowAttribute]").hide().find("#attributeId").removeClass("required");
+		jQuery("#searchForm [id=searchValue]").val("");
+	}
+}
+
+function isBlank(text)
+{
+	return !text ||  /^\s*$/.test(text);
+}
+

=== 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 08:12:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2011-09-27 08:33:08 +0000
@@ -106,7 +106,7 @@
 	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 i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_person" ) , "'")';
 	var checkedDuplicate = false;
 	// -1: no search anything
 	//  0: show list all patient

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/patient.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/patient.css	2010-08-25 08:30:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/patient.css	2011-09-27 08:33:08 +0000
@@ -33,3 +33,22 @@
 input.inputText{width: 8em}
 select.inputText{width: 8.4em}
 .inputColumn{ width:170px}
+
+#tooltip {
+    color:#000; font-size:11px; line-height:1.2;
+    background-color:#FFFFCC; border:1px solid #667295; 
+    width:210px; padding:4px;
+	z-index: 100000;
+	display: none;
+	position:absolute;
+}
+
+.heading-column { width : 30.5em;}
+td.input-column { width : 30.5em;}
+td.input-column input, td.input-column select { width: 28.5em;}
+td.error {padding-left:1em}
+
+.warnmessage {
+	color: red; 
+	font-style: italic;
+}

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js	2011-08-01 02:39:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js	1970-01-01 00:00:00 +0000
@@ -1,207 +0,0 @@
-//-----------------------------------------------------------------------------
-//Add Patient
-//-----------------------------------------------------------------------------
-
-function validateAddRepresentative()
-{	
-	$.post("validatePatient.action?" + getIdentifierTypeIdParams(),
-		{
-			fullName: jQuery( '#addRepresentativeForm [id=fullName]' ).val(),
-			gender: jQuery( '#addRepresentativeForm [id=gender]' ).val(),
-			birthDate: jQuery( '#addRepresentativeForm [id=birthDate]' ).val(), 	        
-			age: jQuery( '#addRepresentativeForm [id=age]' ).val(),
-			dobType: jQuery( '#addRepresentativeForm [id=dobType]' ).val(),
-			ageType: jQuery( '#addRepresentativeForm [id=ageType]' ).val()
-		}, addValidationRepresentativeCompleted, "xml" );
-}
-
-function addValidationRepresentativeCompleted( messageElement )
-{
-	var type = $(messageElement).find('message').attr('type');
-	var message = $(messageElement).find('message').text();
-    
-	 if ( type == 'success' )
-	 {
-		jQuery.ajax({
-			type: "POST"
-			,url: "addRepresentative.action"
-			,data: jQuery("#addRepresentativeForm").serialize()
-			,dataType : "xml"
-			,success: function(xml){ 
-				autoChoosePerson( xml );
-			}
-		   ,error: function()
-		   {
-				alert(i18n_error_connect_to_server);
-		   }
-		});
-		
-	 }
-	 else if ( type == 'error' )
-	 {
-	     showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message );
-	 }
-	 else if ( type == 'input' )
-	 {
-	     showWarningMessage( message );
-	 }
-	 else if( type == 'duplicate' )
-	 {
-		 jQuery("#formContainer").hide();
-		 showPersons("listPersonsDuplicate", messageElement);
-	 }
-}
-
-//get and build a param String of all the identifierType id and its value
-//excluding  identifiers which related is False
-function getIdentifierTypeIdParams()
-{
-	var params = "";
-	jQuery("#addRepresentativeForm :input.idfield").each(
-			function()
-			{
-				if( jQuery(this).val() && !jQuery(this).is(":disabled") )
-					params += "&" + jQuery(this).attr("name") +"="+ jQuery(this).val();
-			}
-	);
-	return params;
-}
-
-function searchPerson()
-{
-	jQuery.ajax({
-		   type: "POST"
-		   ,url: "searchPerson.action"
-		   ,data: jQuery("#searchForm").serialize()
-		   ,dataType : "xml"
-		   ,success: function(xmlObject){
-				showPersons( "searchForm div[id=listPersons]", xmlObject );
-			}
-		   ,error: function(request,status,errorThrown)
-		   {
-				alert(i18n_error_connect_to_server);
-		   }
-		 });
-}
-
-function showPersons( divContainer, xmlElement )
-{
-	var container = jQuery("#"+divContainer);
-	container.html("");
-	var patients = $(xmlElement).find('patient');
-	var sPatient = "";
-	
-	if ( patients.length == 0 )
-	{
-		var message = "<p>" + i18n_no_result + "</p>";
-		container.html(message);
-	}
-	
-	$( patients ).each( function( i, patient )
-    {
-		sPatient += "<hr style='margin:5px 0px;'><table>";
-		sPatient += "<tr><td><strong>" + i18n_patient_system_id + "</strong></td><td>" + $( patient ).find('systemIdentifier').text() + "</td></tr>" ;
-		sPatient += "<tr><td><strong>" + i18n_patient_full_name + "</strong></td><td>" + $( patient ).find('fullName').text() + "</td></tr>" ;
-		sPatient += "<tr><td><strong>" + i18n_patient_gender + "</strong></td><td>" + $( patient ).find('gender').text() + "</td></tr>" ;
-		sPatient += "<tr><td><strong>" + i18n_patient_date_of_birth + "</strong></td><td>" + $( patient ).find('dateOfBirth').text() + "</td></tr>" ;
-		sPatient += "<tr><td><strong>" + i18n_patient_age + "</strong></td><td>" + $( patient ).find('age').text() + "</td></tr>" ;
-		sPatient += "<tr><td><strong>" + i18n_patient_blood_group + "</strong></td><td>" + $( patient ).find('bloodGroup').text() + "</td></tr>";
-		
-		var identifiers =  $( patient ).find('identifier');
-		$( identifiers ).each( function( i, identifier )
-		{
-			sPatient +="<tr class='identifierRow" + $(identifier).find('id').text() + "' id='iden" + $(identifier).find('id' ).text() + "'>"
-				+"<td><strong>" + $(identifier).find('name').text() + "</strong></td>"
-				+"<td class='value'>" + $(identifier).find('value').text() + "</td>	"	
-				+"</tr>";
-		});
-		
-		var attributes = $( patient ).find('attribute');
-		$( attributes ).each( function( i, attribute )
-		{
-				sPatient += "<tr class='attributeRow'>"
-					+ "<td><strong>" + $(attribute).find('name').text() + "</strong></td>"
-					+ "<td>" + $(attribute).find('value').text() + "</td>	"	
-					+ "</tr>";
-		});
-		
-		sPatient += "<tr><td colspan='2'><input type='button' id='" + $(patient).find('id' ).first().text() +"' value='" + i18n_choose_this_person + "' onclick='choosePerson(this)'/></td></tr>";
-		sPatient += "</table>";
-		
-		container.append(sPatient);
-	 } );
-}
-
-// Will be call after save new person successfully
-function autoChoosePerson( xmlElement )
-{
-	jQuery("#tab-2").html("<center><strong>" + i18n_add_person_successfully + "</strong></center>");
-	var root = jQuery(xmlElement);
-	jQuery("#addPatientForm [id=representativeId]").val( root.find("id").text() );
-	jQuery("#addPatientForm [id=relationshipTypeId]").val( root.find("relationshipTypeId").text() );
-	root.find("identifier").each(
-			function(){
-				var inputField = jQuery("#addPatientForm iden" + jQuery(this).find("identifierTypeId").text());
-				inputField.val( jQuery(this).find("identifierText").text() );
-				inputField.attr({"disabled":"disabled"});
-			}
-	);
-}
-
-//------------------------------------------------------------------------------
-// Set Representative information to parent page.
-//------------------------------------------------------------------------------
-
-function choosePerson(this_)
-{
-	var relationshipTypeId = jQuery("#searchForm [id=relationshipTypeId]").val();
-	if( isBlank( relationshipTypeId ))
-	{
-		alert(i18n_please_select_relationshipType);
-		return;
-	}
-	
-	var id = jQuery(this_).attr("id");
-	jQuery("#addPatientForm [id=representativeId]").val(id);
-	jQuery("#addPatientForm [id=relationshipTypeId]").val(relationshipTypeId);
-	jQuery(".identifierRow"+id).each(function(){
-		var inputField = window.parent.jQuery("#"+jQuery(this).attr("id"));
-		if( inputField.metadata({type:"attr",name:"data"}).related  )
-		{
-			// only inherit identifierType which related is true
-			inputField.val(jQuery(this).find("td.value").text());
-			inputField.attr({"disabled":"disabled"});
-		}
-	});
-	
-	jQuery('#representativeDiv').dialog('close');
-}
-
-function toggleSearchType(this_)
-{
-	var type = jQuery(this_).val();
-	if( "identifier" == type )
-	{
-		jQuery("#searchForm [id=rowIdentifier]").show().find("identifierTypeId").addClass('required:true');
-		jQuery("#searchForm [id=rowAttribute]").hide().find("id=attributeId").removeClass("required");
-		jQuery("#searchForm [id=searchValue]").val("");
-	}
-	else if( "attribute" == type )
-	{
-		jQuery("#searchForm [id=rowIdentifier]").hide().find("#identifierTypeId").removeClass("required");
-		jQuery("#searchForm [id=rowAttribute]").show().find("#attributeId").addClass("required:true");
-		jQuery("#searchForm [id=searchValue]").val("");
-	}
-	else if( "name" == type || "" == type )
-	{
-		jQuery("#searchForm [id=rowIdentifier]").hide().find("#identifierTypeId").removeClass("required");
-		jQuery("#searchForm [id=rowAttribute]").hide().find("#attributeId").removeClass("required");
-		jQuery("#searchForm [id=searchValue]").val("");
-	}
-}
-
-function isBlank(text)
-{
-	return !text ||  /^\s*$/.test(text);
-}
-