← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8358: Add relationship bIsToA for add new person in relationship management .

 

------------------------------------------------------------
revno: 8358
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-10-03 15:45:36 +0700
message:
  Add relationship bIsToA for add new person in relationship management .
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddRelationshipPatientAction.java
  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/webapp/dhis-web-caseentry/addRelationshipForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.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/java/org/hisp/dhis/caseentry/action/patient/AddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddRelationshipPatientAction.java	2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddRelationshipPatientAction.java	2012-10-03 08:45:36 +0000
@@ -24,7 +24,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
- package org.hisp.dhis.caseentry.action.patient;
+package org.hisp.dhis.caseentry.action.patient;
 
 import java.util.Collection;
 
@@ -102,7 +102,7 @@
     private Character dobType;
 
     private String gender;
-    
+
     private String phoneNumber;
 
     private String registrationDate;
@@ -113,6 +113,8 @@
 
     private Integer relationshipTypeId;
 
+    private boolean relationshipFromA;
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -256,9 +258,16 @@
                     patient.setRepresentative( relationship );
 
                 Relationship rel = new Relationship();
-                rel.setPatientA( relationship );
-                rel.setPatientB( patient );
-
+                if ( relationshipFromA )
+                {
+                    rel.setPatientA( relationship );
+                    rel.setPatientB( patient );
+                }
+                else
+                {
+                    rel.setPatientA( patient );
+                    rel.setPatientB( relationship );
+                }
                 if ( relationshipTypeId != null )
                 {
                     RelationshipType relType = relationshipTypeService.getRelationshipType( relationshipTypeId );
@@ -330,6 +339,11 @@
         this.patientIdentifierTypeService = patientIdentifierTypeService;
     }
 
+    public void setRelationshipFromA( boolean relationshipFromA )
+    {
+        this.relationshipFromA = relationshipFromA;
+    }
+
     public void setBirthDate( String birthDate )
     {
         this.birthDate = birthDate;

=== 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	2012-10-03 08:00:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-10-03 08:45:36 +0000
@@ -467,4 +467,5 @@
 stage_skipped = Stage is skipped
 location = Location
 some_data_element_not_exist = Some data elements not exist 
-guardian=Guardian/caretaker
\ No newline at end of file
+guardian=Guardian/caretaker
+of = of
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipForm.vm	2012-09-21 03:50:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipForm.vm	2012-10-03 08:45:36 +0000
@@ -2,7 +2,7 @@
 	jQuery('#relationshipSelectForm').ready(function(){
 		
 		jQuery('name').focus();
-			
+		
 		validation( 'relationshipSelectForm', function(form){
 			validateSearchPartner();
 		}); 
@@ -71,8 +71,8 @@
                     <select id="relationshipTypeId" name="relationshipTypeId" class="{validate:{required:true}}" >
                         <option value="">[$i18n.getString( "select_relationship" )]</option>
                         #foreach( $relationshipType in $relationshipTypes )                        
-                            <option value="$relationshipType.id:$encoder.htmlEncode( $relationshipType.aIsToB )" #if( $relationshipTypeId && "$relationshipType.id:$encoder.htmlEncode( $relationshipType.aIsToB )" == $relationshipTypeId ) selected="selected" #end>$encoder.htmlEncode( $relationshipType.aIsToB )</option>
-                            <option value="$relationshipType.id:$encoder.htmlEncode( $relationshipType.bIsToA )" #if( $relationshipTypeId && "$relationshipType.id:$encoder.htmlEncode( $relationshipType.bIsToA )" == $relationshipTypeId ) selected="selected" #end>$encoder.htmlEncode( $relationshipType.bIsToA )</option>
+                            <option value="$relationshipType.id:$encoder.htmlEncode( $relationshipType.aIsToB )" #if( $relationshipTypeId && "$relationshipType.id:$encoder.htmlEncode( $relationshipType.aIsToB )" == $relationshipTypeId ) selected="selected" #end>${relationshipType.aIsToB} $i18n.getString("of") $patient.getFullName() (${relationshipType.bIsToA})</option>
+                            <option value="$relationshipType.id:$encoder.htmlEncode( $relationshipType.bIsToA )" #if( $relationshipTypeId && "$relationshipType.id:$encoder.htmlEncode( $relationshipType.bIsToA )" == $relationshipTypeId ) selected="selected" #end>${relationshipType.bIsToA} $i18n.getString("of") $patient.getFullName() (${relationshipType.aIsToB})</option>
                         #end
                     </select>
                     &nbsp; $i18n.getString( "is" )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm	2012-10-03 07:06:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm	2012-10-03 08:45:36 +0000
@@ -22,6 +22,8 @@
 				}
 		});
 		jQuery('#patientForm [id=fullName]').val("");
+		hideById('underAgeDiv');
+		hideById('representativeFormDiv');
 		jQuery('#patientForm [inherit=false]').val("");
 		jQuery('#patientForm [inherit=]').val("");
 		jQuery('#patientForm [id=healthWorkerId]').val("");
@@ -52,7 +54,8 @@
 			<select name="relationshipTypeId" id="relationshipTypeId" class="{validate:{required:true}}" >
 				<option value="">[$i18n.getString( "please_select" )]</option>        
 				#foreach ($relationship in $relationshipTypes)
-					<option value="$relationship.id">${relationship.aIsToB} - ${relationship.bIsToA}</option>
+					<option value="$relationship.id" relationshipFromA='true'>${relationship.aIsToB} $i18n.getString("of") $patient.getFullName() (${relationship.bIsToA})</option>
+					<option value="$relationship.id" relationshipFromA='false'>${relationship.bIsToA} $i18n.getString("of") $patient.getFullName() (${relationship.aIsToB})</option>
 				#end
 			</select>
 		</td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-09-25 06:10:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-10-03 08:45:36 +0000
@@ -88,10 +88,12 @@
 function addRelationshipPatient()
 {
 	jQuery('#loaderDiv').show();
+	var params = getParamsForDiv('addRelationshipDiv');
+		params += "&relationshipFromA=" + jQuery('#patientForm option:selected').attr("relationshipFromA");
 	$.ajax({
 		type: "POST",
 		url: 'addRelationshipPatient.action',
-		data: getParamsForDiv('addRelationshipDiv'),
+		data: params,
 		success: function( json ) {
 			hideById('addRelationshipDiv');
 			showById('selectDiv');

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2012-10-03 07:06:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2012-10-03 08:45:36 +0000
@@ -80,7 +80,7 @@
 
 #if($!patient.underAge)
 	#set( $representative = $!patient.representative ) 
-	<tr>
+	<tr id="representativeFormDiv" name="representativeFormDiv">
 		<td class='text-column'>$i18n.getString("guardian")</td>
 		<td> 
 			$!patient.representative.getFullName() <img src="../images/information.png" alt="$i18n.getString( 'show_details' )" onclick='showRepresentativeInfo()' class='img-button'>