← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10526: Allow to write a comment when to set followup for program-instance.

 

------------------------------------------------------------
revno: 10526
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-04-12 15:25:43 +0700
message:
  Allow to write a comment when to set followup for program-instance.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  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/struts.xml
  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/style/style.css
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.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-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2013-04-11 08:30:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2013-04-12 08:25:43 +0000
@@ -40,7 +40,7 @@
 
 		<property name="followup" />
 
-		<many-to-one name="patientComment"
+		<many-to-one name="patientComment" cascade="all"
 			class="org.hisp.dhis.patientcomment.PatientComment" column="patientcommentid"
 			foreign-key="fk_programinstance_patientcommentid" />
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-04-12 04:20:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-04-12 08:25:43 +0000
@@ -155,6 +155,15 @@
 			ref="org.hisp.dhis.program.ProgramInstanceService" />
 	</bean>
 	
+	<bean id="org.hisp.dhis.caseentry.action.caseentry.SaveProgramInstanceCommentAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.SaveProgramInstanceCommentAction"
+		scope="prototype">
+		<property name="programInstanceService"
+			ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="currentUserService"
+			ref="org.hisp.dhis.user.CurrentUserService" />
+	</bean>
+	
 	<!-- Multi DataEntry -->
 
 	<bean

=== 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	2013-04-11 08:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-04-12 08:25:43 +0000
@@ -624,4 +624,8 @@
 cancelled_programs = Cancelled programs
 quit = Quit
 unmark_followup = Un-mark followup
-mark_followup = Mark followup
\ No newline at end of file
+mark_followup = Mark followup
+save_comment = Save comment
+program_enrollement = Program enrollement
+stored_by = Stored by
+stored_date = Stored date
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-04-11 08:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-04-12 08:25:43 +0000
@@ -220,6 +220,13 @@
       <param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
     </action>
 	
+	<action name="saveProgramInstanceComment"
+      class="org.hisp.dhis.caseentry.action.caseentry.SaveProgramInstanceCommentAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
+      <param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
+    </action>
 
     <!-- save value -->
 

=== 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	2013-04-11 08:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-04-12 08:25:43 +0000
@@ -2053,3 +2053,16 @@
 			 }
 		});
 }
+
+function saveComment( programInstanceId )
+{
+	jQuery.postJSON( "saveProgramInstanceComment.action",
+		{ 
+			programInstanceId:programInstanceId,
+			comment: getFieldValue('comment')
+		}, 
+		function( json ) 
+		{   
+			 $( '#comment' ).css( 'background-color', COLOR_GREEN );
+		});
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2013-03-21 14:24:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2013-04-12 08:25:43 +0000
@@ -533,3 +533,11 @@
 .coordinates2{
     width: 150px;
 }
+
+
+.commentHeader
+{
+  color: #606060;
+  font-size: 17px;
+  padding: 5px 0;
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2013-04-11 08:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2013-04-12 08:25:43 +0000
@@ -1,48 +1,81 @@
 #set($programStageInstances = $programInstance.programStageInstances)
-<fieldset>
-	<legend>$i18n.getString("program")</legend>
-	<table>
-		<tr>
-			<td class='text-column'>$programInstance.program.dateOfEnrollmentDescription:</td>
-			<td><input name="enrollmentDate" id="enrollmentDate" readonly value="$!format.formatDate( $programInstance.enrollmentDate )" style="width:325px;"></td>
-			<td rowspan='2'>&nbsp;&nbsp;&nbsp;&nbsp;
+
+<table>
+	<tr>		
+		<!-- Comment -->
+		<td style="height:24px" valign="bottom">
+            <div class="commentHeader">$i18n.getString( "comment" )
 				<a href='javascript:markForFollowup($programInstance.id, false)' #if( $programInstance.followup == 'false') class='hidden' #end id='imgMarkFollowup' title='$i18n.getString("unmark_followup")' ><img src='../images/marked_large.png'></a>
-				<a href='javascript:markForFollowup($programInstance.id, true)' #if( $programInstance.followup == 'true') class='hidden' #end id='imgUnmarkFollowup' title='$i18n.getString("mark_followup")' ><img src='../images/unmarked_large.png'></a>
-			</td>
-		</tr>
-		<tr>
-			<td class='text-column'>$programInstance.program.dateOfIncidentDescription:</td>
-			<td><input name="dateOfIncident" id="dateOfIncident" readonly value="$!format.formatDate( $programInstance.dateOfIncident )" style="width:325px;"></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td>
-				<input type="button" style='width:80px' value="$i18n.getString( 'update' )" onclick='updateEnrollment($programInstance.patient.id, $programInstance.program.id, $programInstance.id, "$programInstance.program.displayName")'/>
-				<input type="button" style='width:80px' id='completeProgram' value="$i18n.getString( 'complete' )" onclick='unenrollmentForm($programInstance.id, 1)' />
-				<input type="button" style='width:80px' id='cancelProgram' value="$i18n.getString( 'quit' )" onclick='unenrollmentForm($programInstance.id, 2)' />
-				<input type="button" style='width:80px' id='incompleteProgram' value="$i18n.getString( 're_enrol' )" onclick='reenrollmentForm($programInstance.id)' />
-				#set($allowRemove = 'true')
-				#foreach( $programStageInstance in $programStageInstances )
-					#if( $!programStageInstance.executionDate 
-						|| $!programStageInstance.outboundSms.size() > 0 
-						|| $!programStageInstance.patientComments.size() > 0 )
-						
-						#set($allowRemove = 'false')
+				<a href='javascript:markForFollowup($programInstance.id, true)' #if( $programInstance.followup == 'true') class='hidden' #end id='imgUnmarkFollowup' title='$i18n.getString("mark_followup")' ><img src='../images/unmarked_large.png'></a>			
+			</div>
+		</td>
+		<!-- Progam Enrollement -->
+		<td style="height:24px" valign="bottom">       
+            <div class="commentHeader">$encoder.htmlEncode( $i18n.getString( "program_enrollement" ) )</div>
+        </td>
+    </tr>
+    <tr>
+		<td valign="top">
+			<textarea id="comment" name='comment' maxlength="360" style="height:157px;width:240px">$!encoder.htmlEncode( $programInstance.patientComment.commentText )</textarea><br>
+			<input type="button" value="$i18n.getString( 'save_comment' )" style="width:130px" onclick="saveComment($programInstance.id);">
+		</td>		
+        <td valign="top">
+            <table>
+			   <tr>
+					<td style="background-color:#88be3b; height:26px;">&nbsp;</td>
+                    <td class='text-column'>$programInstance.program.dateOfEnrollmentDescription:</td>
+					<td><input name="enrollmentDate" id="enrollmentDate" readonly value="$!format.formatDate( $programInstance.enrollmentDate )" style="width:325px;"></td>
+			   </tr>
+               <tr>
+					<td style="background-color:#88be3b; height:26px;">&nbsp;</td>
+                    <td class='text-column'>$programInstance.program.dateOfIncidentDescription:</td>
+					<td><input name="dateOfIncident" id="dateOfIncident" readonly value="$!format.formatDate( $programInstance.dateOfIncident )" style="width:325px;"></td>
+				</tr>
+                <tr>
+					<td style="background-color:#88be3b; height:26px;">&nbsp;</td>
+                    <td></td>
+					<td>
+						#if( !$auth.hasAccess( "dhis-web-caseentry", "saveProgramEnrollment" ) )
+							<input type="button" style='width:80px' value="$i18n.getString( 'update' )" onclick='updateEnrollment($programInstance.patient.id, $programInstance.program.id, $programInstance.id, "$programInstance.program.displayName")'/>
+						#end
+						<input type="button" style='width:80px' id='completeProgram' value="$i18n.getString( 'complete' )" onclick='unenrollmentForm($programInstance.id, 1)' />
+						<input type="button" style='width:80px' id='cancelProgram' value="$i18n.getString( 'quit' )" onclick='unenrollmentForm($programInstance.id, 2)' />
+						<input type="button" style='width:80px' id='incompleteProgram' value="$i18n.getString( 're_enrol' )" onclick='reenrollmentForm($programInstance.id)' />
+						#set($allowRemove = 'true')
+						#foreach( $programStageInstance in $programStageInstances )
+							#if( $!programStageInstance.executionDate 
+								|| $!programStageInstance.outboundSms.size() > 0 
+								|| $!programStageInstance.patientComments.size() > 0 )
+								
+								#set($allowRemove = 'false')
+							#end
+						#end
+				
+					#if($allowRemove == 'true')
+						<input type="button" style='width:80px' id='removeProgram' value="$i18n.getString( 'remove' )" onclick='removeProgramInstance($programInstance.id)' />
+						<script>
+							jQuery('#enrollmentDate').width('325');
+							jQuery('#dateOfIncident').width('325');
+						</script>
 					#end
-				#end
-				
-				#if($allowRemove == 'true')
-					<input type="button" style='width:80px' id='removeProgram' value="$i18n.getString( 'remove' )" onclick='removeProgramInstance($programInstance.id)' />
-					<script>
-						jQuery('#enrollmentDate').width('410');
-						jQuery('#dateOfIncident').width('410');
-					</script>
-				#end
-			</td>
-		</tr>
-	</table>
-</fieldset>
-<br>
+					</td>
+                </tr>
+                <tr>
+                	<td colspan="3" style="height:15px"></td>
+                </tr>
+                <tr>
+                	<td colspan="2" style="background-color: #e0e0e0; height:26px;">$i18n.getString( "stored_by" )</td>
+                	<td>$!encoder.htmlEncode( $programInstance.patientComment.creator )</td>
+                </tr>
+                <tr>
+                	<td colspan="2" style="background-color: #e0e0e0; height:26px;">$i18n.getString( "stored_date" )</td>
+                	<td>$!format.formatDate( $programInstance.patientComment.createdDate )</td>
+                </tr>
+            </table>
+        </td>
+	</tr>
+</table>
+
 
 <table>
 	#foreach($sms in $programInstance.outboundSms)
@@ -51,7 +84,8 @@
 		<td>$encoder.htmlEncode($sms.message)</td>
 	#end
 </table>
-				
+
+	
 #if( $programStageInstances.size() > 0 )
 	<table class='mainPageTable listTable' id='progarmStageListDiv' name='progarmStageListDiv' >
 		<colgroup>
@@ -146,4 +180,4 @@
 	#end
 	var i18n_insert_a_due_date = '$encoder.jsEscape( $i18n.getString( "insert_a_due_date" ) , "'")';
 	var i18n_remove_confirm_message = '$encoder.jsEscape( $i18n.getString( "remove_confirm_message" ) , "'")';
-</script>
\ No newline at end of file
+</script>