← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9107: Add Add-person-and-new button in Register new person form.

 

------------------------------------------------------------
revno: 9107
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-11-23 11:16:41 +0700
message:
  Add Add-person-and-new button in Register new person 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/javascript/patient.js


--
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-11-15 15:58:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-11-23 04:16:41 +0000
@@ -475,4 +475,5 @@
 clear_all = Clear all
 show_all = Show all
 you_have_active_filters = You have active filters
-back_to_event_list = Back to event list
\ No newline at end of file
+back_to_event_list = Back to event list
+add_patient_and_add_new = Add person and Add new
\ 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-11-22 14:44:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2012-11-23 04:16:41 +0000
@@ -10,7 +10,7 @@
 				,errorElement:"span"
 				,submitHandler: function(form)
 					{
-						validateAddPatient();
+						validateAddPatient(isContinue);
 					}
 				,beforeValidateHandler: function(form)
 					{
@@ -51,10 +51,16 @@
 	<tr>
 		<td></td>
 		<td>
-			<input type="submit" class="button" value="$i18n.getString( 'add' )"/>
+			<input type="submit" class="button" value="$i18n.getString( 'add' )" onclick="isContinue=false;"/>
 			<input type='button' class="button" value="$i18n.getString( 'cancel' )" onclick="loadPatientList();" />
 		</td>
 	</tr>
+	<tr>
+		<td></td>
+		<td>			
+			<input type="submit" class="button" value="$i18n.getString( 'add_patient_and_add_new' )" style="width:260px;" onclick="isContinue=true;"/>
+		</td>
+	</tr>
 </table>
 
 </form>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-11-22 14:44:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-11-23 04:16:41 +0000
@@ -89,18 +89,21 @@
 	
 }
 
-function validateAddPatient()
+function validateAddPatient( isContinue )
 {	
 	$("#patientForm :input").attr("disabled", true);
+	$("#patientForm").find("select").attr("disabled", true);
 	$.ajax({
 		type: "POST",
 		url: 'validatePatient.action',
 		data: getParamsForDiv('patientForm'),
-		success:addValidationCompleted
+		success: function(data){
+			addValidationCompleted(data,isContinue);
+		}
     });	
 }
 
-function addValidationCompleted( data )
+function addValidationCompleted( data, isContinue )
 {
     var type = jQuery(data).find('message').attr('type');
 	var message = jQuery(data).find('message').text();
@@ -108,7 +111,7 @@
 	if ( type == 'success' )
 	{
 		removeDisabledIdentifier( );
-		addPatient();
+		addPatient( isContinue );
 	}
 	else
 	{
@@ -126,10 +129,11 @@
 		}
 			
 		$("#patientForm :input").attr("disabled", false);
+		$("#patientForm").find("select").attr("disabled", false);
 	}
 }
 
-function addPatient()
+function addPatient( isContinue )
 {
 	$.ajax({
       type: "POST",
@@ -137,7 +141,21 @@
       data: getParamsForDiv('patientForm'),
       success: function(json) {
 		var patientId = json.message.split('_')[0];
-		showPatientDashboardForm( patientId );
+		if(isContinue){
+			jQuery("#patientForm :input").each( function(){
+				if( $(this).attr('id') != "registrationDate" 
+					&& $(this).attr('type') != 'button'
+					&& $(this).attr('type') != 'submit' )
+				{
+					$(this).val("");
+				}
+			});
+			$("#patientForm :input").attr("disabled", false);
+			$("#patientForm").find("select").attr("disabled", false);
+		}
+		else{
+			showPatientDashboardForm( patientId );
+		}
       }
      });
     return false;