← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11429: Display birthdate for enrollment date field / incident date field if birthdate is used for the fi...

 

------------------------------------------------------------
revno: 11429
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-07-18 11:01:13 +0700
message:
  Display birthdate for enrollment date field / incident date field if birthdate is used for the fields in Enrollment form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.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/identifierAndAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm	2013-03-08 09:15:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm	2013-07-18 04:01:13 +0000
@@ -1,4 +1,5 @@
 
+	
 #foreach ($identifierType in $program.patientIdentifierTypes) 
 	<tr>
 		<td class='text-column'><label>$identifierType.displayName #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>       
@@ -36,4 +37,7 @@
 			#end
 		</td>		
 	</tr>
-#end
\ No newline at end of file
+#end
+
+<input type='hidden' id='useBirthDateAsEnrollmentDate' value='$program.useBirthDateAsEnrollmentDate'>
+<input type='hidden' id='useBirthDateAsIncidentDate' value='$program.useBirthDateAsIncidentDate'>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-07-12 04:32:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-07-18 04:01:13 +0000
@@ -1272,6 +1272,16 @@
 		{
 			id:programId
 		}, function(){
+			if(getFieldValue('useBirthDateAsEnrollmentDate')=='true'){ 
+				setFieldValue("enrollmentDateField", birthDate)
+			}
+			
+			if(getFieldValue('useBirthDateAsIncidentDate')=='true'){ 
+				setFieldValue("dateOfIncidentField", birthDate)
+			}
+			else{
+				setFieldValue("dateOfIncidentField", "");
+			}
 			showById('identifierAndAttributeDiv');
 		});
 	}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2013-05-28 03:10:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2013-07-18 04:01:13 +0000
@@ -11,7 +11,7 @@
 			validateProgramEnrollment();
 		});
 		datePickerInRangeValid( 'dateOfIncidentField' , 'enrollmentDateField' );
-		setFieldValue("dateOfIncidentField", "");
+		
 		var unSave = false;
 	});	
 </script>
@@ -42,12 +42,14 @@
 		
 		<tr id='enrollmentDateTR' class='hidden'>
 			<td class='text-column'><label for="enrollmentDate"><span id='enrollmentDateDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
-			<td colspan='2' class='input-column'><input type="text" id="enrollmentDateField" name="enrollmentDateField" class="{validate:{required:true}}"></td>
+			<td colspan='2' class='input-column'>
+				<input type="text" id="enrollmentDateField" name="enrollmentDateField" class="{validate:{required:true}}" >
+			</td>
 		</tr>
 		
 		<tr id='dateOfIncidentTR' class='hidden'>
 			<td class='text-column'><label for="dateOfIncident"><span id='dateOfIncidentDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
-			<td colspan='2' class='input-column'><input type="text" id="dateOfIncidentField" name="dateOfIncidentField"  class="{validate:{required:true}}"></td>
+			<td colspan='2' class='input-column'><input type="text" id="dateOfIncidentField" name="dateOfIncidentField" class="{validate:{required:true}}" ></td>
 		</tr>
 	
 		<tr>
@@ -75,4 +77,5 @@
 <script>
 	var i18n_enroll = '$encoder.jsEscape( $i18n.getString( "enroll" ) , "'")';
 	var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
+	var birthDate = '$!format.formatDate($!patient.birthDate)';
 </script>