← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 15368
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-05-22 22:02:57 +0800
message:
  Fixed bug - Error when to enroll a TEI into a program in TEI
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


--
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:35:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm	2014-05-22 14:02:57 +0000
@@ -1,14 +1,14 @@
 #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>
+	<tr name='attributesFields'>
 		<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='' )
@@ -37,20 +37,20 @@
 				<select inherit="$!attribute.inherit" class=' #validate( "default"  $mandatory  )' >
 					<option value="">[$i18n.getString("please_select")]</option>
 					#foreach( $user in $healthWorkers)
-						<option value="$user.id" #if($attributeValue == $user.id) selected="selected" #end >$user.name</option>
+						<option value="$user.id" #if($value == $user.id) selected="selected" #end >$user.name</option>
 					#end
 				</select>
 			#elseif( $attribute.valueType == "phoneNumber" ) 
-				#if($attributeValue=='')
-					#set($attributeValue=$!phoneNumberAreaCode)
+				#if($value=='')
+					#set($value=$!phoneNumberAreaCode)
 				#end
-				<input type='text' value='$attributeValue' id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{phone:true}}"/>
+				<input type='text' value='$value' id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{phone:true}}"/>
 			#elseif( $attribute.valueType == "trackerAssociate" ) 
 				<input type="checkbox" value='true' id="attr$attribute.id" name="attr$attribute.id" 
 					inherit="$!attribute.inherit" #if($value=='true') checked #end
 					onclick="toggleUnderAge(this);" class='underAge' />
 			#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}}"/>
+				<input type='text' id="attr$attribute.id" value="$!value" 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:$mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}"  > 
 			#end
@@ -58,3 +58,12 @@
 	</tr>
 #end
 </table>
+
+<script>
+	#if( $auth.hasAccess( "dhis-web-caseentry", "allowEditAttributes" ) )
+		disableButtons = false;
+	#else
+		jQuery('#identifierAndAttributeDiv [name=attributesFields] input').attr('disabled',true);
+		jQuery('#identifierAndAttributeDiv [name=attributesFields] select').attr('disabled',true);
+	#end
+</script>

=== 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-05-22 08:35:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-05-22 14:02:57 +0000
@@ -1157,6 +1157,21 @@
 				} else if (type == 'input') {
 					setMessage(json.message);
 				}
+				$("[id=tab-2] :input").each(function() {
+					 var input = $(this);
+					 var id = 'dashboard_' + input.attr('id');
+					 setInnerHTML(id, input.val());
+                 });
+                 $('#identifierAndAttributeDiv :input').each(function() {
+					 var input = $(this);
+					 var id = input.attr('id');
+					 if( input.val() != "" ){
+							 setInnerHTML('value_' + id, input.val());
+							 showById('row_' + id);
+					 }
+					 var input = $(this);
+					 jQuery("#tab-2 [id=" + id + "]").val(input.val());
+                 });
 				$('#loaderDiv').hide();
 			}
 		});