← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10536: wip, load psiid information from server in forms

 

------------------------------------------------------------
revno: 10536
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-04-13 13:52:26 +0700
message:
  wip, load psiid information from server in forms
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.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/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-04-13 05:50:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-04-13 06:52:26 +0000
@@ -1,16 +1,5 @@
 <script>
 	jQuery("#entryFormContainer").ready(function(){
-		#if($!program.type!='1')
-			hideById('newEncounterBtn');
-		#end
-		#if($!programStage.id)
-			setFieldValue('programStageId', "$!programStage.id");
-		#end
-		#if( $programStageInstance )
-			setFieldValue( 'dueDate', "$!format.formatDate( $programStageInstance.dueDate )" );
-			setFieldValue( 'executionDate', "$!format.formatDate( $programStageInstance.executionDate )" );
-		#end
-
 		entryFormContainerOnReady();
 	});
 </script>
@@ -30,26 +19,26 @@
 <input type='hidden' name='blockEntryForm' id='blockEntryForm'>
 <input type='hidden' name='remindCompleted' id='remindCompleted'>
 
-<div id='entryForm' #if($!programStageInstance.executionDate) class='visible' #else class='hidden' #end>					
+<div id='entryForm' class='hidden'>
 	<table style="width:600px;margin-top:-9px" class="listTable">
 
 		#if($programStage.captureCoordinates=='true')
 		<tr>
 			<th class='coordinates1'><label for="longitude">$i18n.getString( "longitude" )</label></th>
-			<th class='coordinates2'><input type="text" class='criteria' id="longitude" name="longitude" value="$!{longitude}" class="{validate:{number:true,min:-180,max:180}}" placeholder='$i18n.getString("enter_a_number")' ></th>
+			<th class='coordinates2'><input type="text" class='criteria' id="longitude" name="longitude" class="{validate:{number:true,min:-180,max:180}}" placeholder='$i18n.getString("enter_a_number")' ></th>
 			<th class='coordinates1'><label for="latitude">&nbsp;$i18n.getString( "latitude" )</label></th>
 			<th class='coordinates2'>
-				<input type="text" class='criteria' id="latitude" name="latitude" value="$!{latitude}" class="{validate:{number:true,min:-90,max:90}}" placeholder='$i18n.getString("enter_a_number")' >
+				<input type="text" class='criteria' id="latitude" name="latitude" class="{validate:{number:true,min:-90,max:90}}" placeholder='$i18n.getString("enter_a_number")' >
 				<img style='cursor:pointer' src='images/save.png' title='$i18n.getString("save")' onclick='saveCoordinatesEvent($!programStageInstance.id);' />
 			</th>
 		</tr>
 		#end
 		
 		<tr>
-			<th class='coordinates1'><label for="postComment">$i18n.getString('post_comment'):</label></td>
+			<th class='coordinates1'><label for="postComment">$i18n.getString('post_comment'):</label></th>
 			<th colspan='3'>
 				<input type="text" class="{validate:{maxlength:160}} criteria" name="comment_$programStageInstance.id" id="comment_$programStageInstance.id" style="width:430px;#if($programStageInstance.programStage.captureCoordinates=='false') margin-left:10px; #end " onkeypress="keypressOnComent(event,this,$programStageInstance.id);">
-			</td>
+			</th>
 		</tr>
 
 		#if( $programStage.getDataEntryType()=='section' )
@@ -71,13 +60,6 @@
 			<td colspan='3'>
 				<table>
 					<tbody id="commentTB">
-						#foreach( $comment in $programStageInstance.patientComments )
-						<tr>
-							<td>$format.formatDateTime($comment.createdDate) </td>
-							<td>$comment.creator </td>
-							<td>$!comment.commentText</td>
-						</tr>
-						#end
 					</tbody>
 				</table>
 			</td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-13 05:50:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-13 06:52:26 +0000
@@ -784,6 +784,7 @@
         enable( "completeBtn" );
         disable( "uncompleteBtn" );
     }
+
     hideById( 'loaderDiv' );
     showById( 'dataEntryInfor' );
     showById( 'entryFormContainer' );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-04-13 05:50:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-04-13 06:52:26 +0000
@@ -640,12 +640,43 @@
         $( "#entryFormContainer input[id='irregular']" ).val( data.programStage.irregular );
         $( "#entryFormContainer input[id='displayGenerateEventBox']" ).val( data.programStage.displayGenerateEventBox );
         $( "#entryFormContainer input[id='completed']" ).val( data.completed );
+        $( "#entryFormContainer input[id='programStageId']" ).val( data.programStage.id  );
         $( "#entryFormContainer input[id='programStageUid']" ).val( data.programStage.uid  );
         $( "#entryFormContainer input[id='programId']" ).val( data.program.id );
         $( "#entryFormContainer input[id='validCompleteOnly']" ).val( data.programStage.validCompleteOnly );
         $( "#entryFormContainer input[id='currentUsername']" ).val( data.currentUsername );
         $( "#entryFormContainer input[id='blockEntryForm']" ).val( data.program.blockEntryForm );
         $( "#entryFormContainer input[id='remindCompleted']" ).val( data.program.remindCompleted );
+
+        $( "#entryFormContainer input[id='dueDate']" ).val( data.dueDate );
+        $( "#entryFormContainer input[id='executionDate']" ).val( data.executionDate );
+
+        if ( data.program.type != '1' ) {
+            hideById( 'newEncounterBtn' );
+        }
+
+        if(data.executionDate) {
+            $( '#entryForm' ).removeClass( 'hidden' ).addClass( 'visible' );
+        }
+
+        if ( data.programStage.captureCoordinates ) {
+            $( '#longitude' ).val( data.longitude );
+            $( '#latitude' ).val( data.latitude );
+        }
+
+        if(data.comments.length > 0) {
+            $.each(data.comments, function(idx, item) {
+                var comment = [
+                    "<tr>",
+                    "<td>" + item.createdDate + "</td>",
+                    "<td>" + item.creator + "</td>",
+                    "<td>" + item.text + "</td>",
+                    "</tr>"
+                ].join(' ');
+
+                $( '#commentTB' ).append( comment )
+            });
+        }
     });
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm	2013-04-13 05:50:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm	2013-04-13 06:52:26 +0000
@@ -32,6 +32,7 @@
     "program": {
         "id": "$!programStageInstance.programInstance.program.id",
         "uid": "$!programStageInstance.programInstance.program.uid",
+        "type": "$!programStageInstance.programInstance.program.type",
         "blockEntryForm": "$!programStageInstance.programInstance.program.blockEntryForm",
         "remindCompleted": "$!programStageInstance.programInstance.program.remindCompleted"
     },