← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6392: (patient) Confirm users about creating a new stage instance after completed irregular stage insta...

 

------------------------------------------------------------
revno: 6392
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-03-27 15:30:45 +0700
message:
  (patient) Confirm users about creating a new stage instance after completed irregular stage instance.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java
  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/webapp/dhis-web-caseentry/dataRecordingSelect.vm
  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/patient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.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/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java	2012-03-14 04:06:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java	2012-03-27 08:30:45 +0000
@@ -120,7 +120,7 @@
 
             for ( ProgramStageInstance stageInstance : stageInstances )
             {
-                if ( !stageInstance.isCompleted() && !stageInstance.getProgramStage().getIrregular()  )
+                if ( !stageInstance.isCompleted() || stageInstance.getProgramStage().getIrregular()  )
                 {
                     return SUCCESS;
                 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java	2012-03-27 08:30:45 +0000
@@ -27,9 +27,8 @@
 
 package org.hisp.dhis.caseentry.action.caseentry;
 
-import java.util.Date;
-
 import org.hisp.dhis.caseentry.state.SelectedStateManager;
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 
@@ -60,7 +59,25 @@
     {
         this.selectedStateManager = selectedStateManager;
     }
-    
+
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private String dueDate;
+
+    public void setDueDate( String dueDate )
+    {
+        this.dueDate = dueDate;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -75,13 +92,12 @@
         programStageInstance.setProgramInstance( currentStageInstance.getProgramInstance() );
         programStageInstance.setProgramStage( currentStageInstance.getProgramStage() );
         programStageInstance.setStageInProgram( currentStageInstance.getStageInProgram() );
-        programStageInstance.setDueDate( new Date() );
-        programStageInstance.setExecutionDate( new Date() );
+        programStageInstance.setDueDate( format.parseDate( dueDate ) );
 
         programStageInstanceService.addProgramStageInstance( programStageInstance );
 
         selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
-        
+
         return SUCCESS;
     }
 }

=== 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	2012-03-27 07:20:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-03-27 08:30:45 +0000
@@ -218,7 +218,7 @@
 show_details=Show details
 representative_info=Representative's Information
 relationship_for=Relationship for
-enter_new_encounter=Enter new encounter
+create_new_encounter=Create new encounter
 date_of_edit=Date of edit
 anonymous_events=Anonymous Events
 intro_anonymous_events=Register anonymous events. The data to register is defined by a single event anonymous program.

=== 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-03-09 01:56:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-03-27 08:30:45 +0000
@@ -32,7 +32,7 @@
 
 
 <div class="actions">	
-	<input type="button" class='button' id="newEncounterBtn" value="$i18n.getString('enter_new_encounter')" onClick="javascript: registerIrregularEncounter();" disabled="disabled" >
+	<input type="button" class='button' id="newEncounterBtn" value="$i18n.getString('create_new_encounter')" onClick="javascript: registerIrregularEncounter( getFieldValue('executionDate') );" disabled="disabled" >
 	<input type="button" class='button' id="validationBtn" value="$i18n.getString('run_validation')" onClick="javascript: runValidation();" disabled="disabled" >
 	<input type="button" class='button' id="completeBtn" value="$i18n.getString('complete')" onClick="doComplete()" disabled="disabled" >
 	<input type="button" class='button' value="$i18n.getString( 'back_to_search' )" id='backBtnFromEntry' onclick="javascript:showSearchForm();" >
@@ -86,6 +86,24 @@
 
 </form>
 
+
+<div id='createNewEncounterDiv' class='hidden'>
+	<table>
+		<tr>
+			<td>$i18n.getString( 'due_date' )</td>
+			<td><input id='dueDateNewEncounter' name='dueDateNewEncounter' ></td>
+			<script type="text/javascript">
+			   datePickerValid( 'dueDateNewEncounter', false );
+			</script>
+		</tr>
+		<tr>
+			<td></td>
+			<td>
+				<input type='button' value='$i18n.getString("create")' onclick='registerIrregularEncounter( getFieldValue("dueDateNewEncounter" ) );' />
+				<input type='button' value='$i18n.getString("cancel")' onclick="closeDueDateDiv();" />
+			</td>
+</div>
+
 <script>
 	jQuery('#dataRecordingSelectForm').ready(function(){ 
 		var programs = byId('programId');

=== 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	2012-03-27 01:29:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-03-27 08:30:45 +0000
@@ -637,7 +637,15 @@
 					var irregular = jQuery('#entryFormContainer [name=irregular]').val();
 					if( irregular == 'true')
 					{
-						enable('newEncounterBtn');
+						jQuery('#createNewEncounterDiv').dialog({
+								title: i18n_create_new_encounter,
+								maximize: true, 
+								closable: true,
+								modal:false,
+								overlay:{background:'#000000', opacity:0.1},
+								width: 300,
+								height: 100
+							}).show('fast');
 					}
 					
 					var selectedProgram = jQuery('#dataRecordingSelectForm [name=programId] option:selected');
@@ -733,15 +741,21 @@
 // Register Irregular-encounter
 //------------------------------------------------------
 
-function registerIrregularEncounter()
+function registerIrregularEncounter( dueDate )
 {
-	jQuery.postJSON( "registerIrregularEncounter.action",{}, 
+	jQuery.postJSON( "registerIrregularEncounter.action",{ dueDate: dueDate }, 
 		function( json ) 
 		{   
 			loadDataEntry();
+			jQuery('#createNewEncounterDiv').dialog('close');
 		});
 }
 
+function closeDueDateDiv()
+{
+	jQuery('#createNewEncounterDiv').dialog('close');
+}
+
 function autocompletedField( idField )
 {
 	var input = jQuery( "#" +  idField )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-03-27 07:20:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-03-27 08:30:45 +0000
@@ -1105,6 +1105,7 @@
 		function()
 		{
 			jQuery('#dataRecordingSelectDiv [id=patientInfoDiv]').hide();
+			jQuery('#dataRecordingSelectDiv [id=backBtnFromEntry]').hide();
 			showById('dataRecordingSelectDiv');
 			hideLoader();
 			hideById('contentDiv');

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2012-03-27 04:22:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2012-03-27 08:30:45 +0000
@@ -152,4 +152,5 @@
 	var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
     var i18n_scheduled_for = '$encoder.jsEscape( $i18n.getString( "scheduled_for" ) , "'")';
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+	var i18n_create_new_encounter = '$encoder.jsEscape( $i18n.getString( "create_new_encounter" ) , "'")';
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm	2012-03-09 01:56:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm	2012-03-27 08:30:45 +0000
@@ -68,6 +68,7 @@
 	var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
     var i18n_scheduled_for = '$encoder.jsEscape( $i18n.getString( "scheduled_for" ) , "'")';
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+	var i18n_create_new_encounter = '$encoder.jsEscape( $i18n.getString( "create_new_encounter" ) , "'")';
 	
 	selection.setListenerFunction( organisationUnitSelected );
 </script>
\ No newline at end of file