← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15350: Fixed bug - Error when to enroll a TEI into a program in TEI Dashboard.

 

------------------------------------------------------------
revno: 15350
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-05-22 16:35:21 +0800
message:
  Fixed bug - Error when to enroll a TEI into a program in TEI Dashboard.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.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/attributeFormDiv.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm	2014-05-22 08:03:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm	2014-05-22 08:35:21 +0000
@@ -1,15 +1,16 @@
 #if($program) 
 	#set($attributes = $program.attributes)
 #end
-
+<table width="100%">
 #foreach($_attribute in $attributes )
 	#if($program) 
 		#set($attribute = $_attribute.attribute)
 	#end
 	#set( $attributeValue = '')
+	#set($mandatory=$!_attribute.mandatory)
 	<tr>
-		<td class='text-column'><label>$attribute.displayName #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-		<td class="input-column" >
+		<td class='text-column'><label>$attribute.displayName #if($mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+		<td class="input-column" align='right'>
 			#set( $value='' )
 			#set( $value=$!attributeValueMaps.get($attribute.id) )
 			#if( $attribute.valueType == "bool" )
@@ -21,12 +22,12 @@
 			#elseif( $attribute.valueType == "trueOnly" )
 				<input type='checkbox' value="true" id="attr$attribute.id" name="attr$attribute.id" #if($value=='true') checked #end> 
 			#elseif( $attribute.valueType == "date" )
-				<input type="text" id="attr$attribute.id" name="attr$attribute.id" value='$!format.formatDate($value)' objectId='$attribute.id' objectType='attr' class=' #validate( "default"  $attribute.mandatory )' >
+				<input type="text" id="attr$attribute.id" name="attr$attribute.id" value='$!format.formatDate($value)' objectId='$attribute.id' objectType='attr' class=' #validate( "default"  $mandatory )' >
 				<script type="text/javascript">
 					datePickerValid( 'attr$attribute.id', false );
 				</script>                 
 			#elseif( $attribute.valueType == "optionSet" )
-				<select  id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default"  $attribute.mandatory )' >
+				<select  id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default"  $mandatory )' >
 					 <option value="">[$i18n.getString( "please_select" )]</option>
 				#foreach ($option in $attribute.optionSet.options )
 					<option value="$option" #if($value==$option) selected #end >$option</option>
@@ -51,8 +52,9 @@
 			#elseif( $attribute.valueType == "age" || $attribute.valueType == "number" ) 
 				<input type='text' id="attr$attribute.id" value="$!attributeValue" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,number:true}}"/>
 			#else
-				<input type="text"  id="attr$attribute.id" name="attr$attribute.id" value='$value' class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}"  > 
+				<input type="text"  id="attr$attribute.id" name="attr$attribute.id" value='$value' class="{validate:{required:$mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}"  > 
 			#end
 		</td>		
 	</tr>
 #end
+</table>

=== 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	2014-04-24 16:30:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-05-22 08:35:21 +0000
@@ -1139,27 +1139,29 @@
 // ----------------------------------------------------------------
 // Program enrollmment && unenrollment
 // ----------------------------------------------------------------
+
 function validateProgramEnrollment()
 {
-$('#loaderDiv').show();
-$.ajax({
-		type : "GET",
-		url : 'validateProgramEnrollment.action',
-		data : getParamsForDiv('programEnrollmentSelectDiv'),
-		success : function(json) {
-			var type = json.response;
-			if (type == 'success') {
-				saveEnrollment();
-			} else if (type == 'error') {
-				setMessage(i18n_program_enrollment_failed + ':' + '\n'
-						+ message);
-			} else if (type == 'input') {
-				setMessage(json.message);
+	$('#loaderDiv').show();
+	$.ajax({
+			type : "GET",
+			url : 'validateProgramEnrollment.action',
+			data : getParamsForDiv('programEnrollmentSelectDiv'),
+			success : function(json) {
+				var type = json.response;
+				if (type == 'success') {
+					saveEnrollment();
+				} else if (type == 'error') {
+					setMessage(i18n_program_enrollment_failed + ':' + '\n'
+							+ message);
+				} else if (type == 'input') {
+					setMessage(json.message);
+				}
+				$('#loaderDiv').hide();
 			}
-			$('#loaderDiv').hide();
-		}
-	});
+		});
 }
+
 function saveEnrollment() {
 	var entityInstanceId = $('#enrollmentDiv [id=entityInstanceId]').val();
 	var programId = $('#enrollmentDiv [id=programId] option:selected').val();
@@ -1217,7 +1219,7 @@
 	if (status == 2)
 		comfirmMessage = i18n_quit_confirm_message;
 	if ( confirm(comfirmMessage) ) {
-$.ajax({
+	$.ajax({
 								type : "POST",
 					url : 'setProgramInstanceStatus.action',
 					data : "programInstanceId=" + programInstanceId

=== 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	2014-04-21 13:51:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2014-05-22 08:35:21 +0000
@@ -14,7 +14,7 @@
 	});	
 </script>
 
-<form id='programEnrollmentSelectDiv' name='programEnrollmentSelectDiv' method='POST' action='saveProgramEnrollment.action'>
+<form id='programEnrollmentSelectDiv' name='programEnrollmentSelectDiv' method='POST' >
 	<input type="hidden" id="entityInstanceId" name="entityInstanceId" value="$entityInstance.id">
 	<input type="hidden" id="entityInstanceUid" name="entityInstanceUid" value="$entityInstance.uid">
 	<table>
@@ -59,7 +59,7 @@
 			<td></td>                             
 		</tr>
 		
-		<tbody id='identifierAndAttributeDiv' name='identifierAndAttributeDiv'></tbody>
+		<tbody><tr><td id='identifierAndAttributeDiv' name='identifierAndAttributeDiv' colspan='2'></td></tr></tbody>
 		
 		<tr>
 			<td></td>