dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18806
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7981: Have to select a report-date before entering data-values for entry form.
------------------------------------------------------------
revno: 7981
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-08-29 18:43:12 +0700
message:
Have to select a report-date before entering data-values for entry form.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.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/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-08-17 13:51:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-08-29 11:43:12 +0000
@@ -15,8 +15,8 @@
<h3>$i18n.getString( "anonymous_events" ) #openHelp('single_event_without_registration')</h3>
<input type='hidden' id='orgunitId' name='orgunitId' value='$orgunit.id'>
-<input type='hidden' id='programStageInstanceId' name='programStageInstanceIdrgunitId'>
-<input type='hidden' id='programStageId' name='programStageId'>
+<input type='hidden' id='programStageInstanceId' name='programStageInstanceId'>
+<input type='hidden' id='programStageId' name='programStageId' class='stage-object-selected'>
<input type='hidden' id='isShowEventList' name='isShowEventList'>
<select multiple id='compulsoryDE' name='compulsoryDE' class='hidden'></select>
@@ -33,11 +33,10 @@
$i18n.getString("program") <em title="$i18n.getString( "required" )" class="required">*</em></label>
</td>
<td>
- <select type="text" id="programId" name="programId" onchange='getDataElements();' >
- <option value='' programStageId='' >[$i18n.getString("please_select")]</option>
+ <select type="text" id="programId" name="programId" onchange='getDataElements();' class='stage-object-selected'>
#foreach( $program in $programs )
#foreach( $programStage in $program.programStages )
- <option value='$program.id' programStageId='$programStage.id'>$program.name</option>
+ <option value='$program.id' psid='$programStage.id'>$program.name</option>
#end
#end
</select>
@@ -104,8 +103,6 @@
</div>
</div>
-#parse( "dhis-web-commons/loader/loader.vm" )
-
<div id='listDiv'></div>
<div id='dataEntryInfor' class='hidden'>
@@ -116,16 +113,23 @@
<input type="button" onclick="doUnComplete()" value="$i18n.getString('incomplete')" id="uncompleteBtn" style='width:150px;' >
<input type="button" onclick="completedAndAddNewEvent()" value="$i18n.getString('complete_and_add_new_event')" id="completeAndAddNewBtn" style='width:150px;'>
</p>
+ <table>
+ <tr>
+ <th><label for="executionDate">$i18n.getString( "report_date" ) </label></th>
+ <th><input type="text" id="executionDate" name="executionDate" onchange="addNewEvent();"></th>
+ <script type="text/javascript">
+ datePickerValid( 'executionDate', false );
+ </script>
+ <th><label for="dueDate">$i18n.getString( "due_date" ) </label></th>
+ <th><input type="text" id="dueDate" name="dueDate" value="$!format.formatDate( $programStageInstance.dueDate )" disabled="disabled"></th>
+ </tr>
+ </table>
<div id='dataEntryFormDiv'></div>
</div>
-<div class='hidden'>
- <input id='executionDateNewEvent' name='executionDateNewEvent'>
-</div>
+#parse( "dhis-web-commons/loader/loader.vm" )
-<script>
- datePickerValid( 'executionDateNewEvent', true );
-
+<script>
var i18n_please_select = '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'")';
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
=== 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 2012-08-17 13:51:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-08-29 11:43:12 +0000
@@ -11,9 +11,9 @@
clearListById('compulsoryDE');
clearListById('programId');
- jQuery( '#programId').append( '<option value="" programStageId="">[' + i18n_please_select + ']</option>' );
+ jQuery( '#programId').append( '<option value="" psid="">[' + i18n_please_select + ']</option>' );
for ( i in json.programs ) {
- jQuery( '#programId').append( '<option value="' + json.programs[i].id +'" programStageId="' + json.programs[i].programStageId + '">' + json.programs[i].name + '</option>' );
+ jQuery( '#programId').append( '<option value="' + json.programs[i].id +'" psid="' + json.programs[i].psid + '">' + json.programs[i].name + '</option>' );
}
disableCriteriaDiv();
@@ -48,7 +48,7 @@
hideById('dataEntryInfor');
hideById('listDiv');
clearListById('searchObjectId');
- programStageId = jQuery('#programId option:selected').attr('programStageId');
+ programStageId = jQuery('#programId option:selected').attr('psid');
setFieldValue('programStageId', programStageId );
if( programStageId == '')
@@ -218,7 +218,7 @@
params += '&facilityLB=' + $('input[name=facilityLB]:checked').val();
params += '&level=' + $('select[id=level]').val();
params += '&orgunitIds=' + getFieldValue('orgunitId');
- params += '&programStageId=' + getFieldValue('programStageId');
+ params += '&programStageId=' + jQuery('#programId option:selected').attr('psid');
params += '&orderByOrgunitAsc=false';
contentDiv = 'listDiv';
@@ -276,28 +276,29 @@
return value;
}
-function removeEvent( psId )
+function removeEvent( programStageId )
{
- removeItem( psId, '', i18n_comfirm_delete_event, 'removeCurrentEncounter.action' );
+ removeItem( programStageId, '', i18n_comfirm_delete_event, 'removeCurrentEncounter.action' );
}
-function showUpdateEvent( psId )
+function showUpdateEvent( programStageInstanceId )
{
hideById('selectDiv');
hideById('searchDiv');
hideById('listDiv');
- setFieldValue('programStageInstanceId', psId);
+ setFieldValue('programStageInstanceId', programStageInstanceId);
setInnerHTML('dataEntryFormDiv','');
showLoader();
$( '#dataEntryFormDiv' ).load( "dataentryform.action",
{
- programStageInstanceId: psId
+ programStageInstanceId: programStageInstanceId
},function( )
{
var programName = jQuery('#programId option:selected').text();
programName += ' - ' + i18n_report_date + ' : ' + jQuery('#incidentDate').val();
-
+ var programStageId = jQuery('#programId option:selected').attr('psid');
+ jQuery('.stage-object-selected').attr('psid',programStageId);
setInnerHTML('programName', programName );
if( getFieldValue('completed')=='true' ){
@@ -324,16 +325,26 @@
function showAddEventForm()
{
+ setInnerHTML('dataEntryFormDiv','');
+ setFieldValue('executionDate','');
+ hideById('selectDiv');
+ hideById('searchDiv');
+ hideById('listDiv');
+ showById('dataEntryInfor');
+}
+
+function addNewEvent()
+{
jQuery.postJSON( "createAnonymousEncounter.action",
{
programId: jQuery('#programId option:selected').val(),
- executionDate: getFieldValue('executionDateNewEvent')
+ executionDate: getFieldValue('executionDate')
},
function( json )
{
if(json.response=='success')
{
- setFieldValue('programStageInstanceId', json.message );
+ setFieldValue('programStageInstanceId',json.message);
showUpdateEvent( json.message )
}
else
@@ -356,7 +367,7 @@
{
jQuery.getJSON( "removeEmptyEvents.action",
{
- programStageId: jQuery('#selectDiv [id=programId] option:selected').attr('programStageId')
+ programStageId: jQuery('#selectDiv [id=programId] option:selected').attr('psid')
},
function( json )
{