← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8485: Small changes single event with registration entry form.

 

------------------------------------------------------------
revno: 8485
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-10-11 21:31:43 +0700
message:
  Small changes single event with registration entry form.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.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/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java	2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java	2012-10-11 14:31:43 +0000
@@ -47,6 +47,7 @@
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.user.User;
 
 import com.opensymphony.xwork2.Action;
 
@@ -117,6 +118,8 @@
 
     private ProgramStage programStage;
 
+    private Collection<User> healthWorkers;
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -132,19 +135,20 @@
             patientAttributes.removeAll( program.getPatientAttributes() );
         }
 
-        for( PatientAttribute patientAttribute : patientAttributes )
+        for ( PatientAttribute patientAttribute : patientAttributes )
         {
             PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
-            if( attributeGroup!=null){
-                if( attributeGroupsMap.containsKey( attributeGroup ) )
+            if ( attributeGroup != null )
+            {
+                if ( attributeGroupsMap.containsKey( attributeGroup ) )
                 {
                     Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
-                    attributes.add(patientAttribute);
+                    attributes.add( patientAttribute );
                 }
                 else
                 {
-                    Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>(); 
-                    attributes.add(patientAttribute);
+                    Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
+                    attributes.add( patientAttribute );
                     attributeGroupsMap.put( attributeGroup, attributes );
                 }
             }
@@ -153,7 +157,7 @@
                 noGroupAttributes.add( patientAttribute );
             }
         }
-        
+
         organisationUnit = selectionManager.getSelectedOrganisationUnit();
 
         // Get data entry form
@@ -162,18 +166,12 @@
 
         programStage = program.getProgramStages().iterator().next();
 
-        DataEntryForm dataEntryForm = programStage.getDataEntryForm();
-
-        if ( dataEntryForm != null )
-        {
-            customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEdit( dataEntryForm.getHtmlCode() );
-        }
-        else
-        {
-            programStageDataElements = new ArrayList<ProgramStageDataElement>(
-                programStage.getProgramStageDataElements() );
-        }
-
+        programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
+        
+        // Get health workers
+        
+        healthWorkers = organisationUnit.getUsers();
+       
         return SUCCESS;
     }
 
@@ -181,6 +179,11 @@
     // Getter/Setter
     // -------------------------------------------------------------------------
 
+    public Collection<User> getHealthWorkers()
+    {
+        return healthWorkers;
+    }
+
     public Collection<PatientIdentifierType> getIdentifierTypes()
     {
         return identifierTypes;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2012-08-02 06:46:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2012-10-11 14:31:43 +0000
@@ -35,20 +35,24 @@
 	});	
 	
 </script>
-
+<h3>
+	<a href="javascript:backMainPage();">$i18n.getString( "single_event_with_registration" )</a>
+	&#8226; <span id='singleProgramName' name='singleProgramName'></span>
+	&raquo; $i18n.getString( "add_new_patient" )
+</h3>	
+	
 <form id='singleEventForm'>
  
-	<h3>$i18n.getString( "add_new_patient" )</h3>	
 	<input type="hidden" id="representativeId" name="representativeId"/> 
 	<input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
 	<input type="hidden" id="programStageId" name="programStageId" value='$programStage.id'/>
 	
 	<table id='patientForm'>
 		#parse( "/dhis-web-caseentry/patientForm.vm" )
+		
+		<tr><td>$programStage.program.name</td></tr>
+		#parse( "/dhis-web-caseentry/singleDataEntryForm.vm" )
 	</table>
-
-	<h3 id='entryName'></h3>
-	<div id='dataForm'>#parse( "/dhis-web-caseentry/dataEntryForm.vm" )</div>
 	<p>
 		<input type="submit" class="button" value="$i18n.getString( 'add' )" onclick='_continue=false;'/>
 		<input type="submit" class="button" value="$i18n.getString( 'add_and_continue' )" onclick='_continue=true;'/>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-10-05 07:22:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-10-11 14:31:43 +0000
@@ -1,6 +1,7 @@
 <h3>
  <a href="javascript:backMainPage();">$i18n.getString( 'single_event_with_registration' )</a>
- &raquo; <span id='singleProgramName' name='singleProgramName'></span>
+ &#8226; <span id='singleProgramName' name='singleProgramName'></span>
+ &raquo; $i18n.getString( "edit" )
 </h3>
 
 <form id='dataRecordingSelectForm' name='dataRecordingSelectForm' method='post'>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2012-10-05 06:46:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2012-10-11 14:31:43 +0000
@@ -3,6 +3,7 @@
 
 function orgunitSelected( orgUnits, orgUnitNames )
 {	
+	hideById('mainLinkLbl');
 	organisationUnitSelected( orgUnits, orgUnitNames );
 	clearListById('programIdAddPatient');
 	$.postJSON( 'singleEventPrograms.action', {}, function( json )
@@ -19,21 +20,23 @@
 function showAddPatientForm()
 {
 	hideById('contentDiv');
+	hideById('mainLinkLbl');
 	hideById('searchDiv');
 	hideById('advanced-search');
 	setInnerHTML('addNewDiv','');
 	setInnerHTML('dataRecordingSelectDiv','');
-	unSave = true;
+	
 	jQuery('#loaderDiv').show();
 	jQuery('#addNewDiv').load('showEventWithRegistrationForm.action',
 		{
 			programId: getFieldValue('programIdAddPatient')
 		}, function()
 		{
+			setInnerHTML('singleProgramName',jQuery('#programIdAddPatient option:selected').text());	unSave = true;
 			showById('addNewDiv');
 			showById('entryForm');
 			hideById('newEncounterBtn');
-			jQuery("#dataForm :input").each(function()
+			jQuery("#entryForm :input").each(function()
 			{
 				$( this ).attr('onchange','');
 				$( this ).attr('onblur','');
@@ -109,7 +112,7 @@
 {		
 	var params = "programId=" + getFieldValue('programIdAddPatient');
 		params += "&patientId=" + patientId;
-		params += "&" + getParamsForDiv('dataForm');
+		params += "&" + getParamsForDiv('entryForm');
 		
 	$.ajax({
 		type: "POST",
@@ -128,7 +131,7 @@
 					}
 					enable(this.id);
 				});
-				jQuery('#dataForm :input').each(function()
+				jQuery('#entryForm :input').each(function()
 				{
 					var type=$( this ).attr('type');
 					if(type!='button'){
@@ -235,6 +238,7 @@
 
 function backMainPage()
 {
+	showById('mainLinkLbl');
 	showSearchForm();
 	if( getFieldValue('listAll')=='true'){
 		listAllPatient();

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	2012-10-11 14:31:43 +0000
@@ -0,0 +1,88 @@
+<tbody id="entryForm">
+	<tr>
+		<th colspan='2'>$programStage.program.name</th>
+	</tr>
+#set( $dataElementRowCount = 0 )
+#set( $mark = true )
+#set( $tabIndex = 1 )
+#foreach( $programStageDataElement in $programStageDataElements )
+	#set( $dataElementRowCount = $dataElementRowCount + 1 )    
+	#set( $mark = !$mark )
+	#set( $patientDataValue = false )
+	#set( $key = $programStageDataElement.dataElement.id )
+	#set( $patientDataValue = $patientDataValueMap.get( $key ) )    
+	<tr #alternate( $mark )>
+		##data element name
+		<td class='text-column' align='center'>
+			<span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
+				$encoder.htmlEncode( $programStageDataElement.dataElement.formNameFallback )						
+				#if ( $programStageDataElement.compulsory )
+					<em title="$i18n.getString( "required" )" class="required">*</em>
+				#end        
+			</span>
+			##type        
+			<span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>       
+		</td>        
+		##entry        
+		<td class='input-column'>   
+			#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
+			#if( $!programStageDataElement.dataElement.optionSet )
+				#set($hasOptionSet = 'true')
+			#else
+				#set($hasOptionSet = 'false')
+			#end
+			
+			#set($type=$programStageDataElement.dataElement.getDetailedNumberType())
+			#set($validate = '')
+			#if( $type=='number' ) 
+				#set($validate="number:true") 
+			#elseif( $type=='positiveNumber' )
+				#set($validate="positive_integer:true") 
+			#elseif( $type=='negativeNumber' )
+				#set($validate="negative_integer:true")
+			#elseif( $type=='int' )
+				#set($validate="integer:true")
+			#end
+			
+			#if($programStageDataElement.compulsory=='true')
+				#if($validate != '')
+					#set($validate=$validate + ",")
+				#end
+				#set($validate=$validate + "required:true")
+			#end
+				
+			#if( $programStageDataElement.dataElement.textType == "longText" )
+				<textarea name="entryfield" type="text" id="$id" maxlength=255 class="{validate:{$validate}}" >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
+			#elseif( $programStageDataElement.dataElement.type == "bool" )
+				<select name="entryfield" id="$id" class="{validate:{$validate}}" >
+					<option value="">[$i18n.getString( "select_value" )]</option>
+					<option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+					<option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+				</select>
+			#elseif( $programStageDataElement.dataElement.type == "trueOnly" )
+				<input name="entryfield" type="checkbox" id="$id" class="{validate:{$validate}}" >
+			#elseif( $programStageDataElement.dataElement.type == "date" )
+				<input name="entryfield" type="text" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )"class="{validate:{$validate}}">
+				<script type="text/javascript">
+					datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
+				</script> 
+			#elseif($hasOptionSet=='true')
+				<input name="entryfield" options='$hasOptionSet' id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" class="{validate:{$validate}}" />
+			#else
+				<input name="entryfield" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" class="{validate:{$validate}}" />
+			#end
+			#if( $programStage.program.displayProvidedOtherFacility=='true' )
+				#set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
+				#if( $programStageDataElement.allowProvidedElsewhere == 'true')
+					<input class='provided-elsewhere' name="$id" id="$id" type="checkbox" />
+				#end
+			#end
+		</td>
+	</tr>
+	#set( $tabIndex = $tabIndex + 1 )
+#end	
+</tbody>
+
+<script>
+	entryFormContainerOnReady();
+</script>