← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6434: (patient) Add validation for birthdate and age; add program list which patient enrolled into Enro...

 

------------------------------------------------------------
revno: 6434
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-03-29 15:04:10 +0700
message:
  (patient) Add validation for birthdate and age; add program list which patient enrolled into Enrollment form.
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/webapp/dhis-web-caseentry/addPatientForm.vm
  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/programEnrollmentForm.vm
  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/selectPatient.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.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/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-03-28 08:26:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-03-29 08:04:10 +0000
@@ -297,4 +297,5 @@
 unenrollment = Un-Enrollment
 modify_due_date_or_visit_date = Modify Due/Visit dates
 data_entry_screen = Data entry Screen
-unenrol_success = Beneficiary un-enrolled successfully
\ No newline at end of file
+unenrol_success = Beneficiary un-enrolled successfully
+enrolled_for = Enrolled for
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2012-03-28 08:26:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2012-03-29 08:04:10 +0000
@@ -4,13 +4,17 @@
 
 		currentDiv = 'patientForm';
 		checkedDuplicate = false;
-
+		isSubmit = true;
+		
 		jQuery("#patientForm").validate({
 				 meta:"validate"
 				,errorElement:"span"
 				,submitHandler: function(form)
 					{
-						validateAddPatient();
+						if( isSubmit ) 
+						{
+							validateAddPatient();
+						}
 					}
 				,beforeValidateHandler: function(form)
 					{
@@ -20,25 +24,24 @@
 						var age = $('#patientForm [id=age]').val();
 						if( birthDate != '' && age!='' )
 						{
-							showById( 'validateBirthdate' );
 							$("#patientForm [id=memberValidator]").val("birthDate");
-							return false;
+							alert( i18n_please_fill_out_only_one_of_these_fields );
+							jQuery('#birthDate').focus();
+							isSubmit = false;
+							return;
 						}
 						else if( birthDate == '' && age == '' ) {
-							jQuery( '#validateBirthdate' ).removeClass( 'error').addClass('error valid');
 							$("#patientForm [id=memberValidator]").val("");
 						}
 						else if ( birthDate != '' )
 						{
-							jQuery( '#validateBirthdate' ).removeClass( 'error').addClass('error valid');
 							$("#patientForm [id=memberValidator]").val("birthDate");
 						}
 						else if ( age!='' )
 						{
-							jQuery( '#validateBirthdate' ).removeClass( 'error').addClass('error valid');
 							$("#patientForm [id=memberValidator]").val("age");
 						}
-						hideById( 'validateBirthdate' );
+						isSubmit = true;
 					}
 			});
 		

=== 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-03-28 08:26:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2012-03-29 08:04:10 +0000
@@ -45,8 +45,8 @@
 	<td class="input-column">		
 		<input type="text" id="birthDate" name="birthDate" style='width:110px' />
 		<input type='button' onclick='setFieldValue("birthDate","")' value='$i18n.getString("clear")'>
-		$i18n.getString( "verified" ) <input type='checkbox' id='verified' name='verified' onchange='verifiedOnchange();' value='true' checked >
-		$i18n.getString( "age_year" ) <input type="text" id="age" name="age" class="{validate:{number:true}}"  style="width:50px" disabled />
+		$i18n.getString( "verified" ) <input type='checkbox' id='verified' name='verified' onchange='verifiedOnchange();' value='true' >
+		$i18n.getString( "age_year" ) <input type="text" id="age" name="age" class="{validate:{number:true}}" style="width:50px" />
 	</td>
    <td></td>
 </tr>
@@ -54,7 +54,6 @@
 <tr>
 	<td></td>
 	<td class="input-column" >
-		<span id='validateBirthdate' class="hidden"><i>$i18n.getString('please_fill_out_only_one_of_these_fields')</i></span>
 		<input id="memberValidator" class="hidden {validate:{required:true}}"/>
 	</td>
 </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-03-29 04:23:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-03-29 08:04:10 +0000
@@ -119,6 +119,7 @@
 						#end
 					#end
 				#end
+				<tr><td>&nbsp;</td></tr>
 				<tr>
 					<td></td>
 					<td><input type='submit' value='$i18n.getString("save")' class='button' /></td>

=== 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	2012-03-28 07:10:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2012-03-29 08:04:10 +0000
@@ -15,6 +15,16 @@
 				<td class='bold text-column'>$i18n.getString( "date_of_birth" ):</td>
 				<td>$format.formatDate( $patient.birthDate ) $patient.getAge()</td>
 			</tr>
+			#if( $patient.programs)
+				<tr>
+					<td class='bold text-column'>$i18n.getString( "enrolled_for" ):</td>
+					#foreach( $program in $patient.programs ) 
+						<td>$program.name</td>
+					</tr>
+					<tr><td></td>
+					#end
+				</tr>
+			#end
 			<tr>
 				<td>&nbsp;</td>
 			</tr>

=== 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	2012-03-28 07:10:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-03-29 08:04:10 +0000
@@ -121,7 +121,7 @@
 	
 	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
-	
+	var i18n_please_fill_out_only_one_of_these_fields = '$encoder.jsEscape( $i18n.getString( "please_fill_out_only_one_of_these_fields" ) , "'")';
 	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/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm	2012-03-28 08:26:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm	2012-03-29 08:04:10 +0000
@@ -15,13 +15,17 @@
 		datePickerValid( 'patientForm [id=birthDate]' );
 		datePickerValid( 'patientForm [id=deathDate]' );
 		addEventForPatientForm('patientForm');
+		isSubmit = true;
 		
 		jQuery("#patientForm").validate({
 				 meta:"validate"
 				,errorElement:"span"
 				,submitHandler: function(form)
 					{
-						validateUpdatePatient();
+						if( isSubmit ) 
+						{
+							validateUpdatePatient();
+						}
 					}
 				,beforeValidateHandler: function(form)
 					{
@@ -31,26 +35,24 @@
 						var age = $('#patientForm [id=age]').val();
 						if( birthDate != '' && age!='' )
 						{
-							showById( 'validateBirthdate' );
 							$("#patientForm [id=memberValidator]").val("birthDate");
-							return false;
+							alert( i18n_please_fill_out_only_one_of_these_fields );
+							jQuery('#birthDate').focus();
+							isSubmit = false;
+							return;
 						}
 						else if( birthDate == '' && age == '' ) {
-							jQuery( '#validateBirthdate' ).removeClass( 'error').addClass('error valid');
 							$("#patientForm [id=memberValidator]").val("");
 						}
 						else if ( birthDate != '' )
 						{
-							jQuery( '#validateBirthdate' ).removeClass( 'error').addClass('error valid');
 							$("#patientForm [id=memberValidator]").val("birthDate");
 						}
 						else if ( age!='' )
 						{
-							jQuery( '#validateBirthdate' ).removeClass( 'error').addClass('error valid');
 							$("#patientForm [id=memberValidator]").val("age");
 						}
-						hideById( 'validateBirthdate' );
-						
+						isSubmit = true;
 					}
 			});