dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19605
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8623: Create event for available person when click on the data entry icon of single event with registra...
------------------------------------------------------------
revno: 8623
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-22 11:40:11 +0700
message:
Create event for available person when click on the data entry icon of single event with registration in search person list.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js
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/jsonProgramEnrollment.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.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/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2012-10-22 04:18:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2012-10-22 04:40:11 +0000
@@ -141,7 +141,7 @@
hideById('contentDiv');
hideById('mainLinkLbl');
setInnerHTML('singleProgramName',jQuery('#programIdAddPatient option:selected').text());
- loadProgramStages( programId );
+ loadProgramStages( patientId, programId )
});
}
@@ -166,7 +166,7 @@
// Load program-stages by the selected program
//--------------------------------------------------------------------------------------------
-function loadProgramStages( programId )
+function loadProgramStages( patientId, programId )
{
jQuery.getJSON( "loadProgramStageInstances.action",
{
@@ -174,7 +174,30 @@
},
function( json )
{
- jQuery("#selectForm [id=programStageId]").attr('psid', json.programStageInstances[0].programStageId);
- loadDataEntry( json.programStageInstances[0].id );
+ if( json.programStageInstances == 0)
+ {
+ createProgramInstance( patientId, programId );
+ }
+ else
+ {
+ jQuery("#selectForm [id=programStageId]").attr('psid', json.programStageInstances[0].programStageId);
+ loadDataEntry( json.programStageInstances[0].id );
+ }
});
}
+
+function createProgramInstance( patientId, programId )
+{
+ jQuery.postJSON( "saveProgramEnrollment.action",
+ {
+ patientId: patientId,
+ programId: programId,
+ dateOfIncident: getCurrentDate(),
+ enrollmentDate: getCurrentDate()
+ },
+ function( json )
+ {
+ jQuery("#selectForm [id=programStageId]").attr('psid', json.programStageId);
+ loadDataEntry( json.activeProgramStageInstanceId );
+ });
+};
=== 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-22 04:18:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js 2012-10-22 04:40:11 +0000
@@ -284,7 +284,6 @@
function validateAllowEnrollment( patientId, programId )
{
- jQuery('#loaderDiv').show();
jQuery.getJSON( "validatePatientProgramEnrollment.action",
{
patientId: patientId,
@@ -292,6 +291,7 @@
},
function( json )
{
+ jQuery('#loaderDiv').hide();
hideById('message');
var type = json.response;
if ( type == 'success' ){
@@ -300,6 +300,5 @@
else if ( type == 'input' ){
setMessage( json.message );
}
- jQuery('#loaderDiv').hide();
});
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramEnrollment.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramEnrollment.vm 2012-08-28 05:48:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramEnrollment.vm 2012-10-22 04:40:11 +0000
@@ -1,6 +1,7 @@
{
"programInstanceId": "${programInstance.id}",
"activeProgramStageInstanceId": "${activeProgramStageInstance.id}",
+ "programStageId": "${activeProgramStageInstance.programStage.id}",
"activeProgramStageName": "$!encoder.jsonEncode( ${activeProgramStageInstance.programStage.name} )",
"dueDate": "$!format.formatDate( ${activeProgramStageInstance.dueDate} )"
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2012-10-19 07:45:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2012-10-22 04:40:11 +0000
@@ -44,7 +44,7 @@
<div id='listRelationshipDiv'></div> <!-- List relationship -->
<div id='addRelationshipDiv'></div> <!-- Add relationship -->
<div id='migrationPatientDiv'></div> <!-- Migration Patient -->
-
+
<span id='message'></span>
<script type="text/javascript">