dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18767
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7950: Set suggested due-date for each repeatable program-stage.
------------------------------------------------------------
revno: 7950
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-08-22 11:49:39 +0700
message:
Set suggested due-date for each repeatable program-stage.
modified:
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/entry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.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/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-08-20 03:18:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-08-22 04:49:39 +0000
@@ -515,7 +515,7 @@
// Create New Event
// ----------------------------------------------------------------------------
-function showCreateNewEvent( programInstanceId )
+function showCreateNewEvent( programInstanceId, programStageId )
{
jQuery('#createNewEncounterDiv_' + programInstanceId ).dialog({
title: i18n_create_new_event,
@@ -527,13 +527,21 @@
height: 160
}).show('fast');
- var standardInterval = jQuery('#dataRecordingSelectDiv [name=programStageId] option:selected').attr('standardInterval');
+ if( programStageId != undefined )
+ {
+ jQuery('#repeatableProgramStageId').val(programStageId);
+ }
+ setSuggestedDueDate( programInstanceId );
+}
+
+function setSuggestedDueDate( programInstanceId )
+{
+ var standardInterval = jQuery('#repeatableProgramStageId option:selected').attr('standardInterval');
var date = new Date();
var d = date.getDate() + eval(standardInterval);
var m = date.getMonth();
var y = date.getFullYear();
var edate= new Date(y, m, d);
-
jQuery( '#dueDateNewEncounter_' + programInstanceId ).datepicker( "setDate" , edate );
}
=== 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-08-16 02:08:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-08-22 04:49:39 +0000
@@ -569,8 +569,9 @@
var irregular = jQuery('#entryFormContainer [name=irregular]').val();
if( irregular == 'true' )
{
- var programInstanceId = jQuery('#entryFormContainer [id=programInstanceId]').val()
- showCreateNewEvent( programInstanceId );
+ var programInstanceId = jQuery('#entryFormContainer [id=programInstanceId]').val();
+ var programStageId = jQuery(".stage-object-selected").css('psid');
+ showCreateNewEvent( programInstanceId, programStageId );
}
var selectedProgram = jQuery('#dataRecordingSelectForm [name=programId] option:selected');
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2012-08-16 02:08:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2012-08-22 04:49:39 +0000
@@ -45,10 +45,10 @@
<tr>
<td>$i18n.getString( 'program_stage' )</td>
<td>
- <select id='repeatableProgramStageId' name='repeatableProgramStageId'>
+ <select id='repeatableProgramStageId' name='repeatableProgramStageId' onchange="setSuggestedDueDate('$programInstance.id')">
#foreach( $programStage in $programInstance.program.programStages )
#if( $programStage.irregular=='true')
- <option value="$programStage.id">$!programStage.name</option>
+ <option value="$programStage.id" standardInterval='$programStage.standardInterval'>$!programStage.name</option>
#end
#end
</select>