← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4110: Add property "registration date" into Add New Beneficiary form.

 

------------------------------------------------------------
revno: 4110
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-07-11 10:52:31 +0700
message:
  Add property "registration date" into Add New Beneficiary form.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientForm.vm
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.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-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2011-05-25 06:27:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2011-07-11 03:52:31 +0000
@@ -104,6 +104,8 @@
     private String gender;
 
     private String bloodGroup;
+    
+    private String registrationDate;
 
     private boolean underAge;
 
@@ -181,7 +183,7 @@
 
         patient.setDobType( dobType );
 
-        patient.setRegistrationDate( new Date() );
+        patient.setRegistrationDate( format.parseDate( registrationDate ) );
 
         // -----------------------------------------------------------------------------
         // Prepare Patient Identifiers
@@ -358,6 +360,11 @@
         this.age = age;
     }
 
+    public void setRegistrationDate( String registrationDate )
+    {
+        this.registrationDate = registrationDate;
+    }
+
     public void setGender( String gender )
     {
         this.gender = gender;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java	2011-03-31 01:42:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java	2011-07-11 03:52:31 +0000
@@ -83,6 +83,8 @@
 
     private String bloodGroup;
 
+    private String registrationDate;
+
     private Integer relationshipTypeId;
 
     // -------------------------------------------------------------------------
@@ -109,9 +111,9 @@
         // ---------------------------------------------------------------------
         // Set FirstName, MiddleName, LastName by FullName
         // ---------------------------------------------------------------------
-        
+
         fullName = fullName.trim();
-        
+
         int startIndex = fullName.indexOf( ' ' );
         int endIndex = fullName.lastIndexOf( ' ' );
 
@@ -137,7 +139,7 @@
         patient.setFirstName( firstName );
         patient.setMiddleName( middleName );
         patient.setLastName( lastName );
-        
+
         // ---------------------------------------------------------------------
         // Get Other information for patient
         // ---------------------------------------------------------------------
@@ -159,7 +161,7 @@
 
         patient.setDobType( dobType );
 
-        patient.setRegistrationDate( new Date() );
+        patient.setRegistrationDate( format.parseDate( registrationDate ) );
 
         patientService.savePatient( patient );
 
@@ -259,7 +261,12 @@
     {
         this.fullName = fullName;
     }
-    
+
+    public void setRegistrationDate( String registrationDate )
+    {
+        this.registrationDate = registrationDate;
+    }
+
     public void setAge( Integer age )
     {
         this.age = age;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java	2011-03-31 01:42:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java	2011-07-11 03:52:31 +0000
@@ -83,6 +83,8 @@
 
     private String bloodGroup;
 
+    private String registrationDate;
+
     private boolean underAge;
 
     private Integer relationshipId;
@@ -164,7 +166,7 @@
 
         patient.setDobType( dobType );
 
-        patient.setRegistrationDate( new Date() );
+        patient.setRegistrationDate( format.parseDate( registrationDate ) );
 
         // ---------------------------------------------------------------------
         // Generate system id with this format :
@@ -249,7 +251,7 @@
         // -----------------------------------------------------------------------------
         // Save Patient Attributes
         // -----------------------------------------------------------------------------
-       
+
         Collection<PatientAttribute> attributes = patientAttributeService.getAllPatientAttributes();
 
         PatientAttributeValue attributeValue = null;
@@ -404,4 +406,9 @@
     {
         this.ageType = ageType;
     }
+
+    public void setRegistrationDate( String registrationDate )
+    {
+        this.registrationDate = registrationDate;
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-07-05 03:55:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-07-11 03:52:31 +0000
@@ -1,13 +1,3 @@
-## Macro for generating the jQuery validation rules 
-#macro( validate $type $require )
-  #if( $type == "NUMBER" )
-  	{validate:{ number:true #if($require), required:true #end }}
-  	{validate:{ number:true #if($require), required:true #end }}
-  #elseif( $require )
-  	{validate:{required:true}}
-  #end
-#end
-
 <script>
 	jQuery(document).ready(	function(){
 
@@ -46,193 +36,13 @@
 <form id="addPatientForm" name="addPatientForm" method="post" >
 <input type="hidden" id="representativeId" name="representativeId"/> 
 <input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
-<table>
-    <tr><td>&nbsp;</td></tr>
-	<tr>
-		<th colspan="2" class="heading-column">$i18n.getString( "name" )<em title="$i18n.getString( 'required' )" class="required">*</em></th>
-	</tr>
-	<tr>
-		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
-		<td class="input-column" >
-			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[7,50]}}"/>
-			<img src='../images/search.png' onclick='getPatientsByName();' style="cursor: pointer;" width="20" height="20"/>
-		</td>
-	</tr>
-	<tr><td>&nbsp;</td></tr>	
-	<tr>
-		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
-	</tr>
-		
-	<tr>
-		<td><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td class="input-column">
-			<select id="gender" name="gender" style="width:28.3em" class="{validate:{required:true}}">
-				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-				<option value="M" >$i18n.getString( "male" )</option>
-				<option value="F">$i18n.getString( "female" )</option>
-				<option value="T">$i18n.getString( "transgender" )</option>
-			</select>
-		</td>		
-	</tr>
-	
-	<tr>
-		<td><label for="dobType">$i18n.getString( "dob_type" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td class="input-column">
-			<select id='dobType' name="dobType" style="width:28.3em" onchange="dobTypeOnChange();" class="{validate:{required:false}}">
-				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-				<option value="V" >$i18n.getString( "verified" )</option>
-				<option value="D" >$i18n.getString( "declared" )</option>
-				<option value="A" >$i18n.getString( "approximated" )</option>
-			</select>
-        </td>
-	   <td></td>
-	</tr>
-	
-	<tr id='birthdaySpan' style="display:none" >
-		<td><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td>			
-			<input type="text" id="birthDate" name="birthDate" style="width:26.5em" onchange="bdOnchange()" />
-		</td>
-		<td></td>
-	</tr>
-	
-	<tr id='ageSpan' style="display:none" >
-		<td><label for="age">$i18n.getString( "age" ) </label><em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td>
-			<select id="ageType" name="ageType" style="width:18em" >
-				<option value="D"> $i18n.getString('day')</option>
-				<option value="M"> $i18n.getString('month')</option>
-				<option value="Y"> $i18n.getString('year')</option>
-			</select>
-			<input type="text" id="age" name="age" style="width:9.7em" onchange="ageOnchange()" class="{validate:{number:true, alphanumeric: true}}"/>
-		</td>
-		<td></td>
-	</tr>
-	
-	<tr>
-		<td></td>
-		<td><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
-	</tr>
-	
- 	<tr>
-		<td><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
-		<td class="input-column">
-			<select type="text" id="bloodGroup" name="bloodGroup" style="width:28.3em" >
-				<option value="">[$i18n.getString( "please_select" )]</option>
-				<option value="A+">A+</option>
-				<option value="A-">A-</option>
-				<option value="AB+">AB+</option>
-				<option value="AB-">AB-</option>
-				<option value="B+">B+</option>
-				<option value="B-">B-</option>
-				<option value="O+">O+</option>
-				<option value="O-">O-</option>
-			</select>
-		</td>		
-	</tr>
-	<tr><td colspan="2">&nbsp;</td></tr>	
-	<tr>
-		<td></td>
-		<td><input type="button" value="$i18n.getString('check_duplicate')"  onclick="checkDuplicate();"/></td>
-	</tr>
-	<tr><td colspan="2">&nbsp;</td></tr>	
-	
-	<!-- UNDERAGE -->
-	
-	<tr>
-		<td>$i18n.getString("is_underage")</td>
-		<td>
-			<input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderAge(this);" value="true"/>
-		</td>
-	</tr>
-	<!--IDENTIFIERS -->
-	
-	<tr><td colspan="2">&nbsp;</td></tr>	
-	<tr><th colspan="2" class="heading-column">$i18n.getString( "patient_identifiers" )</th></tr>
-	#foreach ($identifierType in $identifierTypes)
-	<tr>
-		<td><label>$identifierType.name #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>       
-            <td class="input-column">
-			<input type="text" style="width:28em" id="iden$identifierType.id" name="iden$identifierType.id" data="{related:$identifierType.related}" class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
-	</tr>
-	#end
-	
-	<!-- ATTRIBUTES IN GROUPS -->
-	
-	#foreach ($attributeGroup in $attributeGroups )
-		<tr><td>&nbsp;</td></tr>
-		<tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
-		#foreach($attribute in $attributeGroup.attributes )
-			#if($!attribute)
-			<tr>
-				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-				<td class="input-column">
-					#if( $attribute.valueType == "YES/NO" )
-		                <select id="attr$attribute.id" name="attr$attribute.id" style="width:28.3em"> 
-                            <option value="">[$i18n.getString( "please_select" )]</option>
-		                    <option value="true">$i18n.getString( "yes" )</option>
-		                    <option value="false" selected="selected">$i18n.getString( "no" )</option>
-		                </select>                
-		            #elseif( $attribute.valueType == "DATE" )
-	                	<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class=' #validate( "default"  $attribute.mandatory )'/>
-	                    <script type="text/javascript">
-							datePickerValid( 'attr$attribute.id' );
-	                    </script>                    
-					#elseif( $attribute.valueType == "COMBO" )
-						<select  id="attr$attribute.id"  name="attr$attribute.id" style="width:28.3em" class='#validate( "default"  $attribute.mandatory )'>
-							<option value="">[$i18n.getString( "please_select" )]</option>
-							#foreach ($option in $attribute.attributeOptions )
-								<option value="$option.id" >$option.name</option>
-							#end
-						</select>
-					#else 
-						<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
-					#end
-				</td>		
-			</tr>
-			#end
-		#end
-	#end
-	
-	<!-- ATTRIBUTES NOT IN GROUPS -->
-	
-	<tr><td>&nbsp;</td></tr>
-	#if ( $noGroupAttributes.size() > 0) 	
-		<tr><th colspan="2" class="heading-column">$i18n.getString( "other_details" )</th></tr>
-		#foreach($attribute in $noGroupAttributes )
-			<tr>
-				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-				<td class="input-column">
-					#if( $attribute.valueType == "YES/NO" )
-		                <select id="attr$attribute.id"  name="attr$attribute.id" style="width:28.3em" > 
-		                	<option value="" >[$i18n.getString( "please_select" )]</option>             
-		                    <option value="true">$i18n.getString( "yes" )</option>
-		                    <option value="false" >$i18n.getString( "no" )</option>
-		                </select>                
-		            #elseif( $attribute.valueType == "DATE" )
-		                	<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class='#validate( "default"  $attribute.mandatory )' />
-		                    <script type="text/javascript">
-		                       datePickerValid( 'attr$attribute.id' );
-		                    </script>                    
-					#elseif( $attribute.valueType == "COMBO" )
-						<select  id="attr$attribute.id" name="attr$attribute.id" style="width:28.3em" class='#validate( "default"  $attribute.mandatory )'>
-							<option value="">[$i18n.getString( "please_select" )]</option>
-							#foreach ($option in $attribute.attributeOptions )
-								<option value="$option.id" >$option.name</option>
-							#end
-						</select>
-					#else 
-						<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
-					#end
-				</td>		
-			</tr>
-		#end
-	#end
-</table>
+
+#parse( "/dhis-web-maintenance-patient/patientForm.vm" )
 
 <p style="margin-top:10px">
 	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
 </p>
+
 </form>
 
 <div id="hiddenModalContent" style="display:none">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2011-05-26 03:19:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2011-07-11 03:52:31 +0000
@@ -1,12 +1,3 @@
-## Macro for generating the jQuery validation rules 
-#macro( validate $type $require )
-  #if( $type == "NUMBER" )
-  	{validate:{ number:true #if($require), required:true #end }}
-  #elseif( $require )
-  	{validate:{required:true}}
-  #end
-#end
-
 <script>
 	jQuery('#addRelationshipPatientForm').ready(	function(){
 
@@ -38,13 +29,13 @@
 
 <h3>$i18n.getString("add_new_relationship_for"):  $patient.getFullName()</h3>
 																		
-<form  id="addRelationshipPatientForm" action="addRelationshipPatient.action" method="get" >
+<form id="addRelationshipPatientForm" action="addRelationshipPatient.action" method="get" >
 <input type="hidden" id="relationshipId"  name="relationshipId" value="$patient.id"/> 
 <table>	
 	<tr>
-		<td ><strong>$i18n.getString("relationship_type")</strong></td>
-		<td  class="input-column">
-			<select name="relationshipTypeId" id="relationshipTypeId" class="{validate:{required:true}}" >
+		<td style='width:14em'><label for="relationship_type">$i18n.getString("relationship_type")<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+		<td class="input-column">
+			<select name="relationshipTypeId" id="relationshipTypeId" style="width:28.2em" class="{validate:{required:true}}" >
 				<option value="">[$i18n.getString( "please_select" )]</option>        
 				#foreach ($relationship in $relationshipTypes)
 					<option value="$relationship.id">${relationship.aIsToB} - ${relationship.bIsToA}</option>
@@ -52,193 +43,14 @@
 			</select>
 		</td>
 	</tr>
-	<tr><td>&nbsp;</td></tr>
-	<tr>
-		<th colspan="2" class="heading-column">$i18n.getString( "name" )<em title="$i18n.getString( 'required' )" class="required">*</em></th>
-	</tr>
-	<tr>
-		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
-		<td class="input-column" >
-			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[7,50]}}">
-			<img src='../images/magnifier.png' onclick='getPatientsByName();' style="cursor: pointer;">
-		</td>
-	</tr>
-	<tr><td>&nbsp;</td></tr>	
-	<tr>
-		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
-	</tr>
-		
-	<tr>
-		<td><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td class="input-column">
-			<select id="gender" name="gender" class="{validate:{required:true}}">
-				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-				<option value="M" >$i18n.getString( "male" )</option>
-				<option value="F">$i18n.getString( "female" )</option>
-				<option value="T">$i18n.getString( "transgender" )</option>
-			</select>
-		</td>		
-	</tr>
-	
-	<tr>
-		<td><label for="dobType">$i18n.getString( "dob_type" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td class="input-column">
-			<select id='dobType' name="dobType" style="min-width:20em" onchange="dobTypeOnChange();" class="{validate:{required:false}}">
-				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-				<option value="V" >$i18n.getString( "verified" )</option>
-				<option value="D" >$i18n.getString( "declared" )</option>
-				<option value="A" >$i18n.getString( "approximated" )</option>
-			</select>
-        </td>
-	   <td></td>
-	</tr>
-	
-	<tr id='birthdaySpan' style="display:none" >
-		<td><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( 'required' )" class="required">*</em> </label></td>
-		<td class="input-column">			
-			<input type="text" id="birthDate" name="birthDate" style="width:26.5em" onchange="bdOnchange()" />
-		</td>
-		<td></td>
-	</tr>
-	
-	<tr id='ageSpan' style="display:none" >
-		<td><label for="age">$i18n.getString( "age" ) </label><em title="$i18n.getString( 'required' )" class="required">*</em> </label></td>
-		<td class="input-column">
-			<select id="ageType" name="ageType" style="width:18em" >
-				<option value="D"> $i18n.getString('day')</option>
-				<option value="M"> $i18n.getString('month')</option>
-				<option value="Y"> $i18n.getString('year')</option>
-			</select>
-			<input type="text" id="age" name="age" style="width:4em" onchange="ageOnchange()" class="{validate:{number:true, alphanumeric: true}}"/>
-		</td>
-		<td></td>
-	</tr>
-	
-	<tr>
-		<td></td>
-		<td><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
-	</tr>
-	
- 	<tr>
-		<td><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
-		<td class="input-column" >
-			<select type="text" id="bloodGroup" name="bloodGroup"  >
-				<option value="">[$i18n.getString( "please_select" )]</option>
-				<option value="A+">A+</option>
-				<option value="A-">A-</option>
-				<option value="AB+">AB+</option>
-				<option value="AB-">AB-</option>
-				<option value="B+">B+</option>
-				<option value="B-">B-</option>
-				<option value="O+">O+</option>
-				<option value="O-">O-</option>
-			</select>
-		</td>		
-	</tr>
-	<tr><td colspan="2">&nbsp;</td></tr>	
-	<tr><td colspan="2"><input type="button" value="$i18n.getString('check_duplicate')"  onclick="checkDuplicate();"/></td></tr>
-	<tr><td colspan="2">&nbsp;</td></tr>	
-	
-	<!-- UNDERAGE -->
-	
-	<tr>
-		<td>$i18n.getString("is_underage")</td>
-		<td class="input-column">
-			<input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderage(this);" value="true"/>
-		</td>
-	</tr>
-	
-	<!--IDENTIFIERS -->
-	
-	<tr><td colspan="2">&nbsp;</td></tr>	
-	<tr><th colspan="2" class="heading-column">$i18n.getString( "patient_identifiers" )</th></tr>
-	#foreach ($identifierType in $identifierTypes)
-		#set( $identifier = "" )
-		#set( $identifier = $identiferMap.get( $identifierType.id ) )
-		<tr>
-			<td><label>$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-			<td class="input-column"><input type="text" id="iden$identifierType.id" name="iden$identifierType.id"  data="{related:$identifierType.related,id:'$identifier'}"  class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}"/></td>	
-		</tr>
-	#end
-	
-	<!-- ATTRIBUTES IN GROUPS -->
-	
-	#foreach ($attributeGroup in $attributeGroups )
-		<tr><td>&nbsp;</td></tr>
-		<tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
-		#foreach($attribute in $attributeGroup.attributes )
-		#set( $attributeValue = "" ) 
-		#set( $attributeValue = $attributeMap.get( $attribute.id ) ) 
-			<tr >
-				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-				<td class="input-column">
-					#if( $attribute.valueType == "YES/NO" )
-		                <select id="attr$attribute.id"  name="attr$attribute.id" style="width:100%" class="attrField" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" >  
-		                	<option value="">[$i18n.getString( "please_select" )]</option>             
-		                    <option value="true">$i18n.getString( "yes" )</option>
-		                    <option value="false" selected="selected">$i18n.getString( "no" )</option>
-		                </select>                
-		            #elseif( $attribute.valueType == "DATE" )
-	                	<input type="text" id="attr$attribute.id" name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( "default"  $attribute.mandatory )'/>
-	                    <script type="text/javascript">
-							datePickerValid( 'attr$attribute.id' );
-                        </script>                  
-					#elseif( $attribute.valueType == "COMBO" )
-						<select  id="attr$attribute.id" name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( "default"  $attribute.mandatory )' >
-							 <option value="">[$i18n.getString( "please_select" )]</option>
-							#foreach ($option in $attribute.attributeOptions )
-								<option value="$option.id" >$option.name</option>
-							#end
-						</select>
-					#else 
-						<input type="text" id="attr$attribute.id" name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( $attribute.valueType  $attribute.mandatory )' />
-					#end
-				</td>		
-			</tr>
-		#end
-	#end
-	
-	<!-- ATTRIBUTES NOT IN GROUPS -->
-	
-	<tr><td>&nbsp;</td></tr>
-	#if ( $noGroupAttributes.size() > 0) 	
-		<tr><th colspan="2" class="heading-column">$i18n.getString( "other_details" )</th></tr>
-		#foreach($attribute in $noGroupAttributes )
-		#set( $attributeValue = "" ) 
-		#set( $attributeValue = $attributeMap.get( $attribute.id ) ) 
-			<tr>
-				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-				<td class="input-column">
-					#if( $attribute.valueType == "YES/NO" )
-		               <select id="attr$attribute.id" name="attr$attribute.id" style="width:100%" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" >  
-		                	<option value="" >[$i18n.getString( "please_select" )]</option>             
-		                    <option value="true">$i18n.getString( "yes" )</option>
-		                    <option value="false" >$i18n.getString( "no" )</option>
-		                </select>                
-		            #elseif( $attribute.valueType == "DATE" )
-		                	<input type="text" id="attr$attribute.id"   name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( "default"  $attribute.mandatory )' />
-		                    <script type="text/javascript">
-                               datePickerValid( 'attr$attribute.id' );
-                            </script>                    
-					#elseif( $attribute.valueType == "COMBO" )
-						<select id="attr$attribute.id" name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( "default"  $attribute.mandatory )'>
-							 <option value="">[$i18n.getString( "please_select" )]</option>
-							#foreach ($option in $attribute.attributeOptions )
-								<option value="$option.id" >$option.name</option>
-							#end
-						</select>
-					#else 
-						<input type="text" id="attr$attribute.id" name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( $attribute.valueType  $attribute.mandatory )' />
-					#end
-				</td>		
-			</tr>
-		#end
-	#end
 </table>
 
+#parse( "/dhis-web-maintenance-patient/patientForm.vm" )
+
 <p style="margin-top:10px">
 	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
 </p>
+
 </form> 	
 	
 <div id="hiddenModalContent" style="display:none">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js	2011-05-26 03:19:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js	2011-07-11 03:52:31 +0000
@@ -67,7 +67,10 @@
       url: 'addRelationshipPatient.action',
       data: getParamsForDiv('addRelationshipDiv'),
       success: function( json ) {
-		setMessage( i18n_save_success );
+		hideById('addRelationshipDiv');
+		showById('selectDiv');
+		showById('searchPatientDiv');
+		showById('listPatientDiv');
 		jQuery('#loaderDiv').hide();
       }
      });

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientForm.vm	2011-07-11 03:52:31 +0000
@@ -0,0 +1,198 @@
+## Macro for generating the jQuery validation rules 
+#macro( validate $type $require )
+  #if( $type == "NUMBER" )
+  	{validate:{ number:true #if($require), required:true #end }}
+  #elseif( $require )
+  	{validate:{required:true}}
+  #end
+#end
+
+<table>	
+	<tr>
+		<td><label for="registration_date">$i18n.getString( "registration_date" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td class="input-column">
+			<input type="text" id="registrationDate" name="registrationDate" style="width:28em" class="{validate:{required:true}}"/>
+			<script type="text/javascript">
+				datePickerValid( 'registrationDate', true );
+			</script>    
+		</td>		
+	</tr>
+
+	<tr>
+		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
+	</tr>
+	<tr>
+		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
+		<td class="input-column" >
+			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[7,50]}}"/>
+			<img src='../images/search.png' onclick='getPatientsByName();' style="cursor: pointer;" width="20" height="20"/>
+		</td>
+	</tr>
+		
+	<tr>
+		<td><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td class="input-column">
+			<select id="gender" name="gender" style="width:28.3em" class="{validate:{required:true}}">
+				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
+				<option value="M" >$i18n.getString( "male" )</option>
+				<option value="F">$i18n.getString( "female" )</option>
+				<option value="T">$i18n.getString( "transgender" )</option>
+			</select>
+		</td>		
+	</tr>
+
+	<tr>
+		<td><label for="dobType">$i18n.getString( "dob_type" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td class="input-column">
+			<select id='dobType' name="dobType" style="width:28.3em" onchange="dobTypeOnChange();" class="{validate:{required:false}}">
+				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
+				<option value="V" >$i18n.getString( "verified" )</option>
+				<option value="D" >$i18n.getString( "declared" )</option>
+				<option value="A" >$i18n.getString( "approximated" )</option>
+			</select>
+		</td>
+	   <td></td>
+	</tr>
+
+	<tr id='birthdaySpan' style="display:none" >
+		<td><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td>			
+			<input type="text" id="birthDate" name="birthDate" style="width:26.5em" onchange="bdOnchange()" />
+		</td>
+		<td></td>
+	</tr>
+
+	<tr id='ageSpan' style="display:none" >
+		<td><label for="age">$i18n.getString( "age" ) </label><em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td>
+			<select id="ageType" name="ageType" style="width:18em" >
+				<option value="D"> $i18n.getString('day')</option>
+				<option value="M"> $i18n.getString('month')</option>
+				<option value="Y"> $i18n.getString('year')</option>
+			</select>
+			<input type="text" id="age" name="age" style="width:9.7em" onchange="ageOnchange()" class="{validate:{number:true, alphanumeric: true}}"/>
+		</td>
+		<td></td>
+	</tr>
+
+	<tr>
+		<td></td>
+		<td><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
+	</tr>
+
+	<tr>
+		<td><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
+		<td class="input-column">
+			<select type="text" id="bloodGroup" name="bloodGroup" style="width:28.3em" >
+				<option value="">[$i18n.getString( "please_select" )]</option>
+				<option value="A+">A+</option>
+				<option value="A-">A-</option>
+				<option value="AB+">AB+</option>
+				<option value="AB-">AB-</option>
+				<option value="B+">B+</option>
+				<option value="B-">B-</option>
+				<option value="O+">O+</option>
+				<option value="O-">O-</option>
+			</select>
+		</td>		
+	</tr>
+	<tr><td colspan="2">&nbsp;</td></tr>	
+	<tr>
+		<td></td>
+		<td><input type="button" value="$i18n.getString('check_duplicate')"  onclick="checkDuplicate();"/></td>
+	</tr>
+	<tr><td colspan="2">&nbsp;</td></tr>	
+
+	<!-- UNDERAGE -->
+	<div id='underAgeDiv'>
+	<tr>
+		<td>$i18n.getString("is_underage")</td>
+		<td>
+			<input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderAge(this);" value="true"/>
+		</td>
+	</tr>
+	</div>
+	<!--IDENTIFIERS -->
+
+	<tr><td colspan="2">&nbsp;</td></tr>	
+	<tr><th colspan="2" class="heading-column">$i18n.getString( "patient_identifiers" )</th></tr>
+	#foreach ($identifierType in $identifierTypes)
+	<tr>
+		<td><label>$identifierType.name #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>       
+			<td class="input-column">
+			<input type="text" style="width:28em" id="iden$identifierType.id" name="iden$identifierType.id" data="{related:$identifierType.related}" class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
+	</tr>
+	#end
+
+	<!-- ATTRIBUTES IN GROUPS -->
+
+	#foreach ($attributeGroup in $attributeGroups )
+		<tr><td>&nbsp;</td></tr>
+		<tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
+		#foreach($attribute in $attributeGroup.attributes )
+			#if($!attribute)
+			<tr>
+				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
+				<td class="input-column">
+					#if( $attribute.valueType == "YES/NO" )
+						<select id="attr$attribute.id" name="attr$attribute.id" style="width:28.3em"> 
+							<option value="">[$i18n.getString( "please_select" )]</option>
+							<option value="true">$i18n.getString( "yes" )</option>
+							<option value="false" selected="selected">$i18n.getString( "no" )</option>
+						</select>                
+					#elseif( $attribute.valueType == "DATE" )
+						<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class=' #validate( "default"  $attribute.mandatory )'/>
+						<script type="text/javascript">
+							datePickerValid( 'attr$attribute.id' );
+						</script>                    
+					#elseif( $attribute.valueType == "COMBO" )
+						<select  id="attr$attribute.id"  name="attr$attribute.id" style="width:28.3em" class='#validate( "default"  $attribute.mandatory )'>
+							<option value="">[$i18n.getString( "please_select" )]</option>
+							#foreach ($option in $attribute.attributeOptions )
+								<option value="$option.id" >$option.name</option>
+							#end
+						</select>
+					#else 
+						<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+					#end
+				</td>		
+			</tr>
+			#end
+		#end
+	#end
+
+	<!-- ATTRIBUTES NOT IN GROUPS -->
+
+	<tr><td>&nbsp;</td></tr>
+	#if ( $noGroupAttributes.size() > 0) 	
+		<tr><th colspan="2" class="heading-column">$i18n.getString( "other_details" )</th></tr>
+		#foreach($attribute in $noGroupAttributes )
+			<tr>
+				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
+				<td class="input-column">
+					#if( $attribute.valueType == "YES/NO" )
+						<select id="attr$attribute.id"  name="attr$attribute.id" style="width:28.3em" > 
+							<option value="" >[$i18n.getString( "please_select" )]</option>             
+							<option value="true">$i18n.getString( "yes" )</option>
+							<option value="false" >$i18n.getString( "no" )</option>
+						</select>                
+					#elseif( $attribute.valueType == "DATE" )
+							<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class='#validate( "default"  $attribute.mandatory )' />
+							<script type="text/javascript">
+							   datePickerValid( 'attr$attribute.id' );
+							</script>                    
+					#elseif( $attribute.valueType == "COMBO" )
+						<select  id="attr$attribute.id" name="attr$attribute.id" style="width:28.3em" class='#validate( "default"  $attribute.mandatory )'>
+							<option value="">[$i18n.getString( "please_select" )]</option>
+							#foreach ($option in $attribute.attributeOptions )
+								<option value="$option.id" >$option.name</option>
+							#end
+						</select>
+					#else 
+						<input type="text" id="attr$attribute.id" name="attr$attribute.id" style="width:28em" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+					#end
+				</td>		
+			</tr>
+		#end
+	#end
+</table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm	2011-05-19 08:17:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm	2011-07-11 03:52:31 +0000
@@ -154,21 +154,13 @@
 	</div>
 
 		<!-- Add Person form TAB -->
-		## Macro for generating the jQuery validation rules 
-		#macro( validate $type $require )
-		  #if( $type == "NUMBER" )
-			{validate:{ number:true #if($require), required:true #end }}
-		  #elseif( $require )
-			{validate:{required:true}}
-		  #end
-		#end
 		<div id="tab-2">
 		<form id="addRepresentativeForm" name="addRepresentativeForm" action="addRepresentative.action" method="post">
 			<table id="formContainer">
 				<tr>
-					<td >$i18n.getString("relationship_type")<em title="$i18n.getString( "required" )" class="required">*</em></td>
+					<td style='width:8em'><label for="relationship_type">$i18n.getString("relationship_type")<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 					<td >
-						<select name="relationshipTypeId" id="relationshipTypeId">
+						<select name="relationshipTypeId" id="relationshipTypeId" style="width:28.2em">
 							<option value="">[$i18n.getString( "please_select" )]</option>        
 							#foreach ($relationship in $relationshipTypes)
 								<option value="$relationship.id">$relationship.aIsToB</option>
@@ -176,99 +168,13 @@
 						</select>
 					</td>
 				</tr>
-				<tr>
-					<th colspan="2">$i18n.getString( "name" )<em title="$i18n.getString( "required" )" class="required">*</em></th>
-				</tr>
-				<tr>
-					<td><label for="required">$i18n.getString( "full_name" )</label></td>
-					<td class="input-column" >
-						<input type="text" id="fullName" name="fullName" style="width:15em">
-						<img src='../images/magnifier.png' onclick='getPatientsByName();' style="cursor: pointer;">
-					</td>
-				</tr>
-				<tr><td>&nbsp;</td></tr>	
-				<tr>
-					<th colspan="2">$i18n.getString( "demographics" )</th>
-				</tr>
-					
-				<tr>
-					<td><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-					<td>
-						<select id="gender" name="gender" style="min-width:15em">
-							<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-							<option value="M" >$i18n.getString( "male" )</option>
-							<option value="F">$i18n.getString( "female" )</option>
-							<option value="T">$i18n.getString( "transgender" )</option>
-						</select>
-					</td>		
-				</tr>
-				
-				<tr>
-					<td><label for="dobType">$i18n.getString( "dob_type" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-					<td>
-						<select id='dobType' name="dobType" style="min-width:15em" onchange="dobTypeOnChange();">
-							<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-							<option value="V" >$i18n.getString( "verified" )</option>
-							<option value="D" >$i18n.getString( "declared" )</option>
-							<option value="A" >$i18n.getString( "approximated" )</option>
-						</select>
-					</td>
-				   <td></td>
-				</tr>
-				
-				<tr id='birthdaySpan' style="display:none" >
-					<td><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( "required" )" class="required">*</em> </label></td>
-					<td>			
-						<input type="text" id="birthDate" name="birthDate" style="width:13em" onchange="bdOnchange()" >
-					</td>
-					<td></td>
-				</tr>
-				
-				<tr id='ageSpan' style="display:none" >
-					<td><label for="age">$i18n.getString( "age" ) </label><em title="$i18n.getString( "required" )" class="required">*</em> </label></td>
-					<td>
-						<select id="ageType" name="ageType" style="width:8em" >
-							<option value="D"> $i18n.getString('day')</option>
-							<option value="M"> $i18n.getString('month')</option>
-							<option value="Y"> $i18n.getString('year')</option>
-						</select>
-						<input type="text" id="age" name="age"  style="width:6.5em" onchange="ageOnchange()" class="{validate:{number:true, alphanumeric: true}}">
-					</td>
-					<td></td>
-				</tr>
-				
-				<tr>
-					<td></td>
-					<td><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
-				</tr>
-				<tr>
-					<td><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
-					<td>
-						<select type="text" id="bloodGroup" name="bloodGroup" style="width:15em" >
-							 <option value="">[$i18n.getString( "please_select" )]</option>
-							<option value="A+">A+</option>
-							<option value="A-">A-</option>
-							<option value="AB+">AB+</option>
-							<option value="AB-">AB-</option>
-							<option value="B+">B+</option>
-							<option value="B-">B-</option>
-							<option value="O+">O+</option>
-							<option value="O-">O-</option>
-						</select>
-					</td>		
-				</tr>
-				<tr><td colspan="2">&nbsp;</td></tr>	
-				<tr><th colspan="2">$i18n.getString( "patient_identifiers" )</th></tr>
-				#foreach ($identifierType in $identifierTypes)
-				<tr>
-						<td><label>$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-						<td><input type="text" name="iden$identifierType.id" style="width:15em" class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}"/></td>	
-				</tr>
-				#end
-				<tr><td colspan="2">&nbsp;</td></tr>	
-				<tr>
-					<td colspan="2"><input type="submit" value="$i18n.getString( "add" )" style="width:10em"></td>
-				</tr>
+			</table>
+			
+			#parse( "/dhis-web-maintenance-patient/patientForm.vm" )
+
+			<p style="margin-top:10px">
+				<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+			</p>
 			</table>
 		</form>
 
@@ -276,4 +182,8 @@
 		</div>
 	</div>
 </div>
+
+<script>
+	hideById('underAgeDiv');
+</script>