← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4451: Don't show Duplicated form when clicking the Add button in Add new patient form ( finished ).

 

------------------------------------------------------------
revno: 4451
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-08-26 12:59:37 +0700
message:
  Don't show Duplicated form when clicking the Add button in Add new patient form ( finished ).
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.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/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-08-26 05:54:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-08-26 05:59:37 +0000
@@ -199,7 +199,7 @@
 	}
 	else if( type == 'duplicate' )
 	{
-		showListPatientDuplicate(data, true);
+		showListPatientDuplicate(data, false);
 	}
 }
 
@@ -239,8 +239,7 @@
     }
     else if( type == 'duplicate' )
     {
-    	if( !checkedDuplicate )
-    		showListPatientDuplicate(messageElement, true);
+    	showListPatientDuplicate(messageElement, true);
     }
 }
 // get and build a param String of all the identifierType id and its value
@@ -290,10 +289,14 @@
     }
     else if( type == 'duplicate' )
     {
-    	showListPatientDuplicate( messageElement, false );
+    	showListPatientDuplicate( messageElement, true );
     }
 }
-
+/**
+ * Show list patient duplicate  by jQuery thickbox plugin
+ * @param rootElement : root element of the response xml
+ * @param validate  :  is TRUE if this method is called from validation method  
+ */
 function showListPatientDuplicate( rootElement, validate )
 {
 	var message = $(rootElement).find('message').text();
@@ -341,8 +344,15 @@
         	sPatient += "</table>";
 		});
 		
-		sPatient = i18n_duplicate_warning + "<br>" + sPatient;
-		$('#resultSearchDiv' ).html( sPatient );
+		var result = i18n_duplicate_warning;
+		if( !validate )
+		{
+			result += "<input type='button' value='" + i18n_create_new_patient + "' onClick='removeDisabledIdentifier( );addPatient();/>";
+			result += "<br><hr style='margin:5px 0px;'>";
+		}
+		
+		result += "<br>" + sPatient;
+		$('#resultSearchDiv' ).html( result );
 		$('#resultSearchDiv' ).dialog({
 			title: i18n_duplicated_patient_list,
 			maximize: true, 
@@ -416,6 +426,7 @@
       success: function(json) {
 		var type = json.response;
 		showProgramEnrollmentSelectForm( json.message );
+		jQuery('#resultSearchDiv').dialog('close');
       }
      });
     return false;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2011-08-26 05:59:37 +0000
@@ -64,11 +64,11 @@
 	});
 }
 
-function deleteDataEntryForm( associationId )
+function deleteDataEntryForm( dataEntryFormId, programStageId )
 {
-	if( window.confirm( i18n_delete_confirm ) )
+	if( window.confirm( i18n_delete_program_data_entry_confirm ) )
 	{
-		window.location.href = 'delDataEntryForm.action?associationId=' + associationId;
+		window.location.href = 'delDataEntryForm.action?id=' + dataEntryFormId + "&programStageId=" + programStageId;
 	}
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm	2011-08-03 04:48:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm	2011-08-26 05:59:37 +0000
@@ -103,6 +103,7 @@
 	var i18n_duplicate_warning = '$encoder.jsEscape( $i18n.getString( "duplicate_warning" ) , "'")';
 	var i18n_search_by_name_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_name_identifier" ) , "'")';
 	var i18n_search_by_program = '$encoder.jsEscape( $i18n.getString( "search_by_program" ) , "'")';
+	var i18n_create_new_patient = '$encoder.jsEscape( $i18n.getString( "create_new_patient" ) , "'")';
 	
 	var checkedDuplicate = false;
 	// -1: no search anything

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2011-07-21 08:12:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2011-08-26 05:59:37 +0000
@@ -109,7 +109,7 @@
             <input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:100px"/>
             <input type="button" name="cancel" value="$i18n.getString( 'cancel' )" style="width:100px" onclick="window.location='programStage.action?id=$!programStage.program.id'">            
 			#if( $!dataEntryForm )
-			<input type="button" name="delete" value="$i18n.getString( 'delete' )" style="width:100px" onclick="deleteDataEntryForm( $programStage.id )" />
+			<input type="button" name="delete" value="$i18n.getString( 'delete' )" style="width:100px" onclick="deleteDataEntryForm( $programStage.dataEntryForm.id, $programStage.id )" />
 			#end
         </td>		
     </tr>
@@ -201,3 +201,8 @@
 	</select>
 	<input type="button" value="$i18n.getString( 'load' )" style="float:left" onclick="loadExistedForm()"/>	
 </div>
+
+<script>
+	var i18n_delete_program_data_entry_confirm = '$encoder.jsEscape( $i18n.getString( "delete_program_data_entry_confirm" ) , "'" )';
+
+</script>