dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19119
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8214: Remove unused file; reorganize Program Tracking.
------------------------------------------------------------
revno: 8214
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-09-24 12:50:08 +0700
message:
Remove unused file; reorganize Program Tracking.
removed:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientForm.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
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/patient.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.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/reminder/SendSmsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java 2012-09-23 11:52:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java 2012-09-24 05:50:08 +0000
@@ -65,14 +65,14 @@
{
this.programStageInstanceService = programStageInstanceService;
}
-
+
private CurrentUserService currentUserService;
public void setCurrentUserService( CurrentUserService currentUserService )
{
this.currentUserService = currentUserService;
}
-
+
private I18n i18n;
public void setI18n( I18n i18n )
@@ -90,7 +90,7 @@
{
this.programStageInstanceId = programStageInstanceId;
}
-
+
private String msg;
public void setMsg( String msg )
@@ -125,28 +125,31 @@
OutboundSms outboundSms = new OutboundSms( msg, phoneNumber );
outboundSms.setSender( currentUserService.getCurrentUsername() );
outboundSmsService.sendMessage( outboundSms, null );
-
+
List<OutboundSms> outboundSmsList = programStageInstance.getOutboundSms();
- if( outboundSmsList == null)
+ if ( outboundSmsList == null )
{
outboundSmsList = new ArrayList<OutboundSms>();
}
outboundSmsList.add( outboundSms );
programStageInstance.setOutboundSms( outboundSmsList );
programStageInstanceService.updateProgramStageInstance( programStageInstance );
-
+
message = i18n.getString( "sent_message_to" ) + " " + phoneNumber;
+
+ return SUCCESS;
}
catch ( SmsServiceException e )
{
message = e.getMessage();
+
+ return ERROR;
}
}
- else
- {
- message = i18n.getString( "patient_did_not_register_a_phone_number" );
- }
- return SUCCESS;
+
+ message = i18n.getString( "patient_did_not_register_a_phone_number" );
+
+ return INPUT;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-09-24 05:50:08 +0000
@@ -416,7 +416,6 @@
../dhis-web-commons/ouwt/ouwt.js
,javascript/commons.js
,javascript/patient.js
- ,javascript/patientForm.js
,javascript/entry.js
,javascript/relationshipPatient.js
</param>
@@ -887,8 +886,8 @@
<param name="javascripts">
../dhis-web-commons/ouwt/ouwt.js,
javascript/commons.js,
- javascript/patient.js,
javascript/relationshipPatient.js,
+ javascript/entry.js,
javascript/smsReminder.js</param>
<param name="requiredAuthorities">F_SMS_REMINDER</param>
</action>
@@ -916,10 +915,9 @@
<action name="sendSMS"
class="org.hisp.dhis.caseentry.action.reminder.SendSmsAction">
- <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm
- </result>
- <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm
- </result>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
=== 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-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-09-24 05:50:08 +0000
@@ -56,35 +56,6 @@
}
}
-// ----------------------------------------------------------------------------
-// Search patients by name
-// ----------------------------------------------------------------------------
-
-function getPatientsByName( divname )
-{
- var fullName = jQuery('#' + divname + ' [id=fullName]').val().replace(/^\s+|\s+$/g,"");
- if( fullName.length > 0)
- {
- contentDiv = 'resultSearchDiv';
- $('#resultSearchDiv' ).load("getPatientsByName.action",
- {
- fullName: fullName
- }).dialog({
- title: i18n_search_result,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{ background:'#000000', opacity: 0.8},
- width: 800,
- height: 400
- });
- }
- else
- {
- alert( i18n_no_patients_found );
- }
-}
-
// -----------------------------------------------------------------------------
// Advanced search
// -----------------------------------------------------------------------------
@@ -684,131 +655,6 @@
}
}
-// load program instance history
-function programReports( programInstanceId )
-{
- $('#programReportDiv').load("getProgramReportHistory.action", {programInstanceId:programInstanceId});
-}
-
-// load SMS message and comments
-function getEventMessages( programInstanceId )
-{
- $('#eventMessagesDiv').load("getEventMessages.action", {programInstanceId:programInstanceId});
-}
-
-// ----------------------------------------------------------------
-// Dash board
-// ----------------------------------------------------------------
-
-function showPatientDashboardForm( patientId )
-{
- hideById('selectDiv');
- hideById('searchDiv');
- hideById('listPatientDiv');
- hideById('editPatientDiv');
- hideById('listRelationshipDiv');
- hideById('addRelationshipDiv');
- hideById('migrationPatientDiv');
- hideById('patientProgramTrackingDiv');
- hideById('smsManagementDiv');
- setInnerHTML('listEventDiv','');
-
- jQuery('#loaderDiv').show();
- jQuery('#patientDashboard').load('patientDashboard.action',
- {
- patientId:patientId
- }, function()
- {
- setInnerHTML('mainFormLink', i18n_main_form_link);
- showById('patientDashboard');
- jQuery('#loaderDiv').hide();
- });
-}
-
-function activeProgramInstanceDiv( programInstanceId )
-{
- jQuery(".selected").each(function(){
- jQuery(this).removeClass();
- });
-
- jQuery("#infor_" + programInstanceId).each(function(){
- jQuery(this).addClass('selected bold');
- });
-
- showById('pi_' + programInstanceId);
-}
-
-function hideProgramInstanceDiv( programInstanceId )
-{
- hideById('pi_' + programInstanceId);
- jQuery('#pi_' + programInstanceId).removeClass("link-area-active");
- jQuery("#img_" + programInstanceId).attr('src','');
-}
-
-function loadActiveProgramStageRecords(programInstanceId, activeProgramStageInstanceId)
-{
- jQuery('#loaderDiv').show();
- jQuery('#programEnrollmentDiv').load('enrollmentform.action',
- {
- programInstanceId:programInstanceId
- }, function()
- {
- showById('programEnrollmentDiv');
- var type = jQuery('#tr_'+programInstanceId).attr('programType');
- if(type=='2'){
- hideById('programInstanceDiv');
- var programStageInstanceId = jQuery('#tr_'+programInstanceId).attr('programStageInstanceId');
- loadDataEntry( programStageInstanceId );
- }
- else{
- showById('programInstanceDiv');
- }
- activeProgramInstanceDiv( programInstanceId );
- if( activeProgramStageInstanceId )
- {
- loadDataEntry( activeProgramStageInstanceId );
- }
- jQuery('#loaderDiv').hide();
- });
-}
-
-function loadProgramStageRecords( programStageInstanceId, completed )
-{
- showLoader();
- jQuery('#dataEntryFormDiv').load( "viewProgramStageRecords.action",
- {
- programStageInstanceId: programStageInstanceId
- }, function() {
- if(completed){
- jQuery( "#dataEntryFormDiv :input").each(function(){
- disable(this.id);
- });
- }
- showById('dataEntryFormDiv');
- hideLoader();
- });
-}
-
-function updateEnrollment( patientId, programId, programInstanceId, programName )
-{
- var dateOfIncident = jQuery('#tab-3 [id=dateOfIncident]').val();
- var enrollmentDate = jQuery('#tab-3 [id=enrollmentDate]').val();
-
- jQuery.postJSON( "saveProgramEnrollment.action",
- {
- patientId: getFieldValue('patientId'),
- programId: programId,
- dateOfIncident: dateOfIncident,
- enrollmentDate: enrollmentDate
- },
- function( json )
- {
- var infor = programName + " (" + enrollmentDate + ")";
- setInnerHTML("infor_" + programInstanceId, infor );
- showSuccessMessage(i18n_enrol_success);
- });
-}
-
//-----------------------------------------------------------------------------
// Save due-date
//-----------------------------------------------------------------------------
@@ -904,6 +750,10 @@
}
}
+//-----------------------------------------------------------------------------
+// Cosmetic UI
+//-----------------------------------------------------------------------------
+
function resize(){
var width = 400;
var w = $(window).width();
@@ -1059,3 +909,794 @@
);
}
}
+
+
+// -----------------------------------------------------------------------------
+// Show relationship with new patient
+// -----------------------------------------------------------------------------
+
+function showRelationshipList( patientId )
+{
+ hideById('addRelationshipDiv');
+ hideById('patientDashboard');
+ hideById('selectDiv');
+ hideById('searchDiv');
+ hideById('listPatientDiv');
+
+ jQuery('#loaderDiv').show();
+ jQuery('#listRelationshipDiv').load('showRelationshipList.action',
+ {
+ id:patientId
+ }, function()
+ {
+ showById('listRelationshipDiv');
+ jQuery('#loaderDiv').hide();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Update Patient
+// -----------------------------------------------------------------------------
+
+function showUpdatePatientForm( patientId )
+{
+ hideById('listPatientDiv');
+ setInnerHTML('editPatientDiv', '');
+ hideById('selectDiv');
+ hideById('searchDiv');
+ hideById('migrationPatientDiv');
+ hideById('patientDashboard');
+
+ jQuery('#loaderDiv').show();
+ jQuery('#editPatientDiv').load('showUpdatePatientForm.action',
+ {
+ id:patientId
+ }, function()
+ {
+ jQuery('#searchPatientsDiv').dialog('close');
+ jQuery('#loaderDiv').hide();
+ showById('editPatientDiv');
+ });
+
+ jQuery('#resultSearchDiv').dialog('close');
+}
+
+function validateUpdatePatient()
+{
+ $("#editPatientDiv :input").attr("disabled", true);
+ $.ajax({
+ type: "POST",
+ url: 'validatePatient.action',
+ data: getParamsForDiv('editPatientDiv'),
+ success:updateValidationCompleted
+ });
+}
+
+function updateValidationCompleted( messageElement )
+{
+ var type = jQuery(messageElement).find('message').attr('type');
+ var message = jQuery(messageElement).find('message').text();
+
+ if ( type == 'success' )
+ {
+ removeDisabledIdentifier();
+ updatePatient();
+ }
+ else
+ {
+ $("#editPatientDiv :input").attr("disabled", true);
+ if ( type == 'error' )
+ {
+ showErrorMessage( i18n_saving_patient_failed + ':' + '\n' + message );
+ }
+ else if ( type == 'input' )
+ {
+ showWarningMessage( message );
+ }
+ else if( type == 'duplicate' )
+ {
+ showListPatientDuplicate(messageElement, true);
+ }
+ $("#editPatientDiv :input").attr("disabled", false);
+ }
+}
+
+function updatePatient()
+{
+ $.ajax({
+ type: "POST",
+ url: 'updatePatient.action',
+ data: getParamsForDiv('editPatientDiv'),
+ success: function( json ) {
+ showPatientDashboardForm( getFieldValue('id') );
+ }
+ });
+}
+
+function addEventForPatientForm( divname )
+{
+ jQuery("#" + divname + " [id=checkDuplicateBtn]").click(function() {
+ checkDuplicate( divname );
+ });
+
+ jQuery("#" + divname + " [id=dobType]").change(function() {
+ dobTypeOnChange( divname );
+ });
+}
+
+function showRepresentativeInfo( patientId)
+{
+ jQuery('#representativeInfo' ).dialog({
+ title: i18n_representative_info,
+ maximize: true,
+ closable: true,
+ modal: false,
+ overlay: {background:'#000000', opacity:0.1},
+ width: 400,
+ height: 300
+ });
+}
+
+function removeDisabledIdentifier()
+{
+ jQuery("input.idfield").each(function(){
+ if( jQuery(this).is(":disabled"))
+ jQuery(this).val("");
+ });
+}
+
+/**
+ * Show list patient duplicate by jQuery thickbox plugin
+ * @param rootElement : root element of the response xml
+ * @param validate : is TRUE if this method is called from validation method
+ */
+function showListPatientDuplicate( rootElement, validate )
+{
+ var message = jQuery(rootElement).find('message').text();
+ var patients = jQuery(rootElement).find('patient');
+
+ var sPatient = "";
+ jQuery( patients ).each( function( i, patient )
+ {
+ sPatient += "<hr style='margin:5px 0px;'><table>";
+ sPatient += "<tr><td class='bold'>" + i18n_patient_system_id + "</td><td>" + jQuery(patient).find('systemIdentifier').text() + "</td></tr>" ;
+ sPatient += "<tr><td class='bold'>" + i18n_patient_full_name + "</td><td>" + jQuery(patient).find('fullName').text() + "</td></tr>" ;
+ sPatient += "<tr><td class='bold'>" + i18n_patient_gender + "</td><td>" + jQuery(patient).find('gender').text() + "</td></tr>" ;
+ sPatient += "<tr><td class='bold'>" + i18n_patient_date_of_birth + "</td><td>" + jQuery(patient).find('dateOfBirth').text() + "</td></tr>" ;
+ sPatient += "<tr><td class='bold'>" + i18n_patient_age + "</td><td>" + jQuery(patient).find('age').text() + "</td></tr>" ;
+ sPatient += "<tr><td class='bold'>" + i18n_patient_phone_number + "</td><td>" + jQuery(patient).find('phoneNumber').text() + "</td></tr>";
+
+ var identifiers = jQuery(patient).find('identifier');
+ if( identifiers.length > 0 )
+ {
+ sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_identifiers + "</td></tr>";
+
+ jQuery( identifiers ).each( function( i, identifier )
+ {
+ sPatient +="<tr class='identifierRow'>"
+ +"<td class='bold'>" + jQuery(identifier).find('name').text() + "</td>"
+ +"<td>" + jQuery(identifier).find('value').text() + "</td> "
+ +"</tr>";
+ });
+ }
+
+ var attributes = jQuery(patient).find('attribute');
+ if( attributes.length > 0 )
+ {
+ sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_attributes + "</td></tr>";
+
+ jQuery( attributes ).each( function( i, attribute )
+ {
+ sPatient +="<tr class='attributeRow'>"
+ +"<td class='bold'>" + jQuery(attribute).find('name').text() + "</td>"
+ +"<td>" + jQuery(attribute).find('value').text() + "</td> "
+ +"</tr>";
+ });
+ }
+ sPatient += "<tr><td colspan='2'><input type='button' id='"+ jQuery(patient).find('id').first().text() + "' value='" + i18n_edit_this_patient + "' onclick='showUpdatePatientForm(this.id)'/></td></tr>";
+ sPatient += "</table>";
+ });
+
+ var result = i18n_duplicate_warning;
+ if( !validate )
+ {
+ result += "<input type='button' value='" + i18n_create_new_patient + "' onClick='removeDisabledIdentifier( );addPatient();'/>";
+ result += "<br><hr style='margin:5px 0px;'>";
+ }
+
+ result += "<br>" + sPatient;
+ jQuery('#resultSearchDiv' ).html( result );
+ jQuery('#resultSearchDiv' ).dialog({
+ title: i18n_duplicated_patient_list,
+ maximize: true,
+ closable: true,
+ modal:true,
+ overlay:{background:'#000000', opacity:0.1},
+ width: 800,
+ height: 400
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Show representative form
+// -----------------------------------------------------------------------------
+
+function toggleUnderAge(this_)
+{
+ if( jQuery(this_).is(":checked"))
+ {
+ jQuery('#representativeDiv').dialog('destroy').remove();
+ jQuery('<div id="representativeDiv">' ).load( 'showAddRepresentative.action',{},
+ function(){
+ $('#patientForm [id=birthDate]').attr('id','birthDate_id');
+ $('#patientForm [id=birthDate_id]').attr('name','birthDate_id');
+ }).dialog({
+ title: i18n_child_representative,
+ maximize: true,
+ closable: true,
+ modal:true,
+ overlay:{background:'#000000', opacity:0.1},
+ width: 800,
+ height: 450,
+ close:function()
+ {
+ $('#patientForm [id=birthDate_id]').attr('id','birthDate');
+ $('#patientForm [id=birthDate]').attr('name','birthDate');
+ }
+ });
+ }else
+ {
+ jQuery("#representativeDiv :input.idfield").each(function(){
+ if( jQuery(this).is(":disabled"))
+ {
+ jQuery(this).removeAttr("disabled").val("");
+ }
+ });
+ jQuery("#representativeId").val("");
+ jQuery("#relationshipTypeId").val("");
+ }
+}
+
+// ----------------------------------------------------------------
+// Enrollment program
+// ----------------------------------------------------------------
+
+function showProgramEnrollmentForm( patientId )
+{
+ jQuery('#enrollmentDiv').load('showProgramEnrollmentForm.action',
+ {
+ id:patientId
+ }).dialog({
+ title: i18n_enroll_program,
+ maximize: true,
+ closable: true,
+ modal:true,
+ overlay:{background:'#000000', opacity:0.1},
+ width: 550,
+ height: 450
+ });
+}
+
+function programOnchange( programId )
+{
+ if( programId==0){
+ hideById('enrollmentDateTR');
+ hideById('dateOfIncidentTR');
+ }
+ else{
+ var type = jQuery('#enrollmentDiv [name=programId] option:selected').attr('programType')
+ if(type=='2'){
+ hideById('enrollmentDateTR');
+ hideById('dateOfIncidentTR');
+ disable('enrollmentDate');
+ disable('dateOfIncident');
+ }
+ else{
+ showById( 'enrollmentDateTR');
+ enable('enrollmentDate');
+
+ var dateOfEnrollmentDescription = jQuery('#enrollmentDiv [name=programId] option:selected').attr('dateOfEnrollmentDescription');
+ var dateOfIncidentDescription = jQuery('#enrollmentDiv [name=programId] option:selected').attr('dateOfIncidentDescription');
+ setInnerHTML('enrollmentDateDescription', dateOfEnrollmentDescription);
+ setInnerHTML('dateOfIncidentDescription', dateOfIncidentDescription);
+
+ var displayIncidentDate = jQuery('#enrollmentDiv [name=programId] option:selected').attr('displayIncidentDate');
+ if( displayIncidentDate=='true'){
+ showById('dateOfIncidentTR');
+ enable('dateOfIncident');
+ }
+ else{
+ hideById('dateOfIncidentTR');
+ disable('dateOfIncident');
+ }
+ }
+ var programId = jQuery('#programEnrollmentSelectDiv [id=programId] option:selected').val();
+ jQuery('#identifierAndAttributeDiv').load("getPatientIdentifierAndAttribute.action",
+ {
+ id:programId
+ }, function(){
+ showById('identifierAndAttributeDiv');
+ });
+ }
+}
+
+function saveEnrollment( patientId, programId )
+{
+ var patientId = jQuery('#enrollmentDiv [id=patientId]').val();
+ var programId = jQuery('#enrollmentDiv [id=programId] option:selected').val();
+ var programName = jQuery('#enrollmentDiv [id=programId] option:selected').text();
+ var dateOfIncident = jQuery('#enrollmentDiv [id=dateOfIncidentField]').val();
+ var enrollmentDate = jQuery('#enrollmentDiv [id=enrollmentDateField]').val();
+
+ jQuery.postJSON( "saveProgramEnrollment.action",
+ {
+ patientId: patientId,
+ programId: programId,
+ dateOfIncident: dateOfIncident,
+ enrollmentDate: enrollmentDate
+ },
+ function( json )
+ {
+ var programInstanceId = json.programInstanceId;
+ var programStageInstanceId = json.activeProgramStageInstanceId;
+ var programStageName = json.activeProgramStageName;
+ var dueDate = json.dueDate;
+ var type = jQuery('#enrollmentDiv [id=programId] option:selected').attr('programType');
+
+ var activedRow = "<tr id='tr1_" + programInstanceId
+ + "' type='" + type +"'"
+ + " programStageInstanceId='" + programStageInstanceId + "'>"
+ + " <td id='td_" + programInstanceId + "'>"
+ + " <a href='javascript:loadActiveProgramStageRecords(" + programInstanceId + "," + programStageInstanceId + ")'>"
+ + "<span id='infor_" + programInstanceId + "' class='selected bold'>"
+ + programName + "(" + enrollmentDate + ")</span></a></td>"
+ + "</tr>";
+
+ activedRow += "<tr id='tr2_" + programInstanceId +"'"+
+ + " onclick='javascript:loadActiveProgramStageRecords(" + programInstanceId + "," + programStageInstanceId + ")' style='cursor:pointer;'>"
+ + "<td colspan='2'><a>• " + programStageName + "(" + dueDate + ")</a></td></tr>";
+
+ jQuery('#activeTB' ).prepend(activedRow);
+ jQuery('#enrollmentDiv').dialog("close");
+ saveIdentifierAndAttribute( patientId, programId,'identifierAndAttributeDiv' );
+ loadProgramInstance( programInstanceId, false );
+ showSuccessMessage(i18n_enrol_success);
+ });
+}
+
+// ----------------------------------------------------------------
+// Load program instance
+// ----------------------------------------------------------------
+
+function loadProgramInstance( programInstanceId, completed )
+{
+ if( programInstanceId=='') {
+ hideById('programEnrollmentDiv');
+ return;
+ }
+ jQuery('#loaderDiv').show();
+ jQuery('#programEnrollmentDiv').load('enrollmentform.action',
+ {
+ programInstanceId:programInstanceId
+ }, function()
+ {
+ showById('programEnrollmentDiv');
+ var type = jQuery('#tr_'+programInstanceId).attr('programType');
+ if(type=='2'){
+ hideById('programInstanceDiv');
+ var programStageInstanceId = jQuery('#tr_'+programInstanceId).attr('programStageInstanceId');
+ loadDataEntry( programStageInstanceId );
+ }
+ else{
+ showById('programInstanceDiv');
+ }
+ activeProgramInstanceDiv( programInstanceId );
+ if( completed ){
+ hideById('newEncounterBtn_' + programInstanceId);
+ }
+ jQuery('#loaderDiv').hide();
+ resize();
+ });
+}
+
+// ----------------------------------------------------------------
+// Program enrollmment && unenrollment
+// ----------------------------------------------------------------
+
+function validateProgramEnrollment()
+{
+ jQuery('#loaderDiv').show();
+ $.ajax({
+ type: "GET",
+ url: 'validatePatientProgramEnrollment.action',
+ data: getParamsForDiv('programEnrollmentSelectDiv'),
+ success: function(json) {
+ hideById('message');
+ var type = json.response;
+ if ( type == 'success' ){
+ saveProgramEnrollment();
+ }
+ else if ( type == 'error' ){
+ setMessage( i18n_program_enrollment_failed + ':' + '\n' + message );
+ }
+ else if ( type == 'input' ){
+ setMessage( json.message );
+ }
+ jQuery('#loaderDiv').hide();
+ }
+ });
+}
+
+function saveProgramEnrollment()
+{
+ $.ajax({
+ type: "POST",
+ url: 'saveProgramEnrollment.action',
+ data: getParamsForDiv('programEnrollmentSelectDiv'),
+ success: function( html ) {
+ setInnerHTML('programEnrollmentDiv', html );
+ jQuery('#enrollBtn').attr('value',i18n_update);
+ showSuccessMessage( i18n_enrol_success );
+ }
+ });
+ return false;
+}
+
+function unenrollmentForm( programInstanceId )
+{
+ $.ajax({
+ type: "POST",
+ url: 'removeEnrollment.action',
+ data: "programInstanceId=" + programInstanceId,
+ success: function( json )
+ {
+ jQuery('#completedList' ).append('<option value="' + programInstanceId + '">' + getInnerHTML('infor_' + programInstanceId ) + '</option>');
+ hideById('tr1_' + programInstanceId );
+ hideById('tr2_' + programInstanceId );
+ setInnerHTML('programEnrollmentDiv','');
+ showSuccessMessage( i18n_unenrol_success );
+ }
+ });
+
+
+}
+
+// ----------------------------------------------------------------
+// Identifiers && Attributes for selected program
+// ----------------------------------------------------------------
+
+function saveIdentifierAndAttribute( patientId, programId, paramsDiv)
+{
+ var params = getParamsForDiv(paramsDiv);
+ params += "&patientId=" + patientId;
+ params +="&programId=" + programId;
+ $.ajax({
+ type: "POST",
+ url: 'savePatientIdentifierAndAttribute.action',
+ data: params,
+ success: function(json)
+ {
+ showSuccessMessage( i18n_save_success );
+ }
+ });
+}
+
+// ----------------------------------------------------------------
+// Show selected data-recording
+// ----------------------------------------------------------------
+
+function showSelectedDataRecoding( patientId )
+{
+ showLoader();
+ hideById('searchDiv');
+ hideById('dataEntryFormDiv');
+ hideById('migrationPatientDiv');
+ hideById('dataRecordingSelectDiv');
+
+ jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action',
+ {
+ patientId: patientId
+ },
+ function()
+ {
+ jQuery('#dataRecordingSelectDiv [id=backBtnFromEntry]').hide();
+ showById('dataRecordingSelectDiv');
+
+ var programId = jQuery('#programEnrollmentSelectDiv [id=programId] option:selected').val();
+ $('#dataRecordingSelectDiv [id=programId]').val( programId );
+ $('#dataRecordingSelectDiv [id=inputCriteria]').hide();
+ showById('dataRecordingSelectDiv');
+ hideLoader();
+ hideById('contentDiv');
+ });
+}
+
+// ----------------------------------------------------------------
+// Patient Location
+// ----------------------------------------------------------------
+
+function getPatientLocation( patientId )
+{
+ hideById('listPatientDiv');
+ hideById('selectDiv');
+ hideById('searchDiv');
+ setInnerHTML('patientDashboard','');
+
+ jQuery('#loaderDiv').show();
+
+ jQuery('#migrationPatientDiv').load("getPatientLocation.action",
+ {
+ patientId: patientId
+ }
+ , function(){
+ showById( 'migrationPatientDiv' );
+ jQuery( "#loaderDiv" ).hide();
+ });
+}
+
+function registerPatientLocation( patientId )
+{
+ $.getJSON( 'registerPatientLocation.action',{ patientId:patientId }
+ , function( json )
+ {
+ showPatientDashboardForm(patientId);
+ showSuccessMessage( i18n_save_success );
+ } );
+}
+
+// ----------------------------------------------------------------
+// List program-stage-instance of selected program
+// ----------------------------------------------------------------
+
+function getVisitSchedule( programInstanceId )
+{
+ $('#tab-3').load("getVisitSchedule.action", {programInstanceId:programInstanceId});
+}
+
+
+// ----------------------------------------------------------------
+// Dash board
+// ----------------------------------------------------------------
+
+function showPatientDashboardForm( patientId )
+{
+ hideById('selectDiv');
+ hideById('searchDiv');
+ hideById('listPatientDiv');
+ hideById('editPatientDiv');
+ hideById('listRelationshipDiv');
+ hideById('addRelationshipDiv');
+ hideById('migrationPatientDiv');
+ hideById('smsManagementDiv');
+ setInnerHTML('listEventDiv','');
+
+ jQuery('#loaderDiv').show();
+ jQuery('#patientDashboard').load('patientDashboard.action',
+ {
+ patientId:patientId
+ }, function()
+ {
+ setInnerHTML('mainFormLink', i18n_main_form_link);
+ showById('patientDashboard');
+ jQuery('#loaderDiv').hide();
+ });
+}
+
+function activeProgramInstanceDiv( programInstanceId )
+{
+ jQuery(".selected").each(function(){
+ jQuery(this).removeClass();
+ });
+
+ jQuery("#infor_" + programInstanceId).each(function(){
+ jQuery(this).addClass('selected bold');
+ });
+
+ showById('pi_' + programInstanceId);
+}
+
+function hideProgramInstanceDiv( programInstanceId )
+{
+ hideById('pi_' + programInstanceId);
+ jQuery('#pi_' + programInstanceId).removeClass("link-area-active");
+ jQuery("#img_" + programInstanceId).attr('src','');
+}
+
+function loadActiveProgramStageRecords(programInstanceId, activeProgramStageInstanceId)
+{
+ jQuery('#loaderDiv').show();
+ jQuery('#programEnrollmentDiv').load('enrollmentform.action',
+ {
+ programInstanceId:programInstanceId
+ }, function()
+ {
+ showById('programEnrollmentDiv');
+ var type = jQuery('#tr_'+programInstanceId).attr('programType');
+ if(type=='2'){
+ hideById('programInstanceDiv');
+ var programStageInstanceId = jQuery('#tr_'+programInstanceId).attr('programStageInstanceId');
+ loadDataEntryloadDataEntry( programStageInstanceId );
+ }
+ else{
+ showById('programInstanceDiv');
+ }
+ activeProgramInstanceDiv( programInstanceId );
+ if( activeProgramStageInstanceId )
+ {
+ loadDataEntry( activeProgramStageInstanceId );
+ }
+ jQuery('#loaderDiv').hide();
+ });
+}
+
+function loadProgramStageRecords( programStageInstanceId, completed )
+{
+ showLoader();
+ jQuery('#dataEntryFormDiv').load( "viewProgramStageRecords.action",
+ {
+ programStageInstanceId: programStageInstanceId
+ }, function() {
+ if(completed){
+ jQuery( "#dataEntryFormDiv :input").each(function(){
+ disable(this.id);
+ });
+ }
+ showById('dataEntryFormDiv');
+ hideLoader();
+ });
+}
+
+function updateEnrollment( patientId, programId, programInstanceId, programName )
+{
+ var dateOfIncident = jQuery('#tab-3 [id=dateOfIncident]').val();
+ var enrollmentDate = jQuery('#tab-3 [id=enrollmentDate]').val();
+
+ jQuery.postJSON( "saveProgramEnrollment.action",
+ {
+ patientId: getFieldValue('patientId'),
+ programId: programId,
+ dateOfIncident: dateOfIncident,
+ enrollmentDate: enrollmentDate
+ },
+ function( json )
+ {
+ var infor = programName + " (" + enrollmentDate + ")";
+ setInnerHTML("infor_" + programInstanceId, infor );
+ showSuccessMessage(i18n_enrol_success);
+ });
+}
+
+// load program instance history
+function programReports( programInstanceId )
+{
+ $('#programReportDiv').load("getProgramReportHistory.action", {programInstanceId:programInstanceId});
+}
+
+// load SMS message and comments
+function getEventMessages( programInstanceId )
+{
+ $('#eventMessagesDiv').load("getEventMessages.action", {programInstanceId:programInstanceId});
+}
+
+// --------------------------------------------------------------------
+// Comment && Message
+// --------------------------------------------------------------------
+
+function sendSmsOnePatient( field, programStageInstanceId )
+{
+ setInnerHTML('smsError', '');
+ if(field.value==""){
+ field.style.backgroundColor = ERROR_COLOR;
+ jQuery('#smsError').css("color", "red");
+ setInnerHTML('smsError', i18n_this_field_is_required);
+ return;
+ }
+
+ field.style.backgroundColor = SAVING_COLOR;
+ programStageInstanceId = getFieldValue( 'programStageInstanceId' );
+ jQuery.postUTF8( 'sendSMS.action',
+ {
+ programStageInstanceId: programStageInstanceId,
+ msg: field.value
+ }, function ( json )
+ {
+ if ( json.response == "success" ) {
+ field.value="";
+ jQuery('#smsError').css("color", "green");
+ setInnerHTML('smsError', json.message);
+ var date = new Date();
+ var currentTime = date.getHours() + ":" + date.getMinutes();
+ jQuery('#commentTB').prepend("<tr><td>" + getFieldValue('currentDate') + " " + currentTime + "</td>"
+ + "<td>" + getFieldValue('programStageName') + "</td>"
+ + "<td>" + getFieldValue('currentUsername') + "</td>"
+ + "<td>" + field.value + "</td></tr>");
+ field.style.backgroundColor = SUCCESS_COLOR;
+ }
+ else {
+ showSuccessMessage( json.message );
+ jQuery('#smsError').css("color", "red");
+ setInnerHTML('smsError', json.message);
+ field.style.backgroundColor = ERROR_COLOR;
+ }
+
+ if( jQuery("#commentTB tr.hidden").length > 0 ){
+ commentDivToggle(true);
+ }
+ else{
+ commentDivToggle(false);
+ }
+ });
+}
+
+function addComment( field, programStageInstanceId )
+{
+ field.style.backgroundColor = SAVING_COLOR;
+ var commentText = field.value;
+ if( commentText == ''){
+ field.style.backgroundColor = ERROR_COLOR;
+ return;
+ }
+
+ jQuery.postUTF8( 'addPatientComment.action',
+ {
+ programStageInstanceId: programStageInstanceId,
+ commentText: commentText
+ }, function ( json )
+ {
+ var programStageName = jQuery("#ps_" + programStageInstanceId).attr('programStageName');
+ var date = new Date();
+ var currentTime = date.getHours() + ":" + date.getMinutes();
+ jQuery('#commentTB').prepend("<tr><td>" + getFieldValue("currentDate") + " " + currentTime + "</td>"
+ + "<td>" + programStageName + "</td>"
+ + "<td>" + getFieldValue('currentUsername') + "</td>"
+ + "<td>" + commentText + "</td></tr>");
+ field.value="";
+ showSuccessMessage( i18n_comment_added );
+ field.style.backgroundColor = SUCCESS_COLOR;
+
+ if( jQuery("#commentTB tr.hidden").length > 0 ){
+ commentDivToggle(true);
+ }
+ else{
+ commentDivToggle(false);
+ }
+ });
+}
+
+function removeComment( programStageInstanceId, commentId )
+{
+ jQuery.postUTF8( 'removePatientComment.action',
+ {
+ programStageInstanceId:programStageInstanceId,
+ id: commentId
+ }, function ( json )
+ {
+ showSuccessMessage( json.message );
+ hideById( 'comment_' + commentId );
+ } );
+}
+
+function commentDivToggle(isHide)
+{
+ var index = 1;
+ jQuery("#commentTB tr").removeClass("hidden");
+ jQuery("#commentTB tr").each( function(){
+ if(isHide && index > 5){
+ jQuery(this).addClass("hidden");
+ }
+ else if(!isHide){
+ jQuery(this).removeClass("hidden");
+ }
+ index++;
+ });
+
+ if( isHide ){
+ showById('showCommentBtn');
+ hideById('hideCommentBtn');
+ }
+ else
+ {
+ hideById('showCommentBtn');
+ showById('hideCommentBtn');
+ }
+}
=== 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-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-09-24 05:50:08 +0000
@@ -1,92 +1,118 @@
-function addEventForPatientForm( divname )
-{
- jQuery("#" + divname + " [id=checkDuplicateBtn]").click(function() {
- checkDuplicate( divname );
- });
-
- jQuery("#" + divname + " [id=dobType]").change(function() {
- dobTypeOnChange( divname );
- });
-}
-
-// -----------------------------------------------------------------------------
-// Show relationship with new patient
-// -----------------------------------------------------------------------------
-
-function showRelationshipList( patientId )
-{
+function organisationUnitSelected( orgUnits, orgUnitNames )
+{
+ showById('selectDiv');
+ showById('searchDiv');
+ hideById('listPatientDiv');
+ hideById('editPatientDiv');
+ hideById('enrollmentDiv');
+ hideById('listRelationshipDiv');
hideById('addRelationshipDiv');
- hideById('patientDashboard');
- hideById('selectDiv');
- hideById('searchDiv');
- hideById('listPatientDiv');
-
- jQuery('#loaderDiv').show();
- jQuery('#listRelationshipDiv').load('showRelationshipList.action',
- {
- id:patientId
- }, function()
- {
- showById('listRelationshipDiv');
- jQuery('#loaderDiv').hide();
- });
-}
-
-// -----------------------------------------------------------------------------
-// Update Patient
-// -----------------------------------------------------------------------------
-
-function showUpdatePatientForm( patientId )
-{
- hideById('listPatientDiv');
- setInnerHTML('editPatientDiv', '');
- hideById('selectDiv');
- hideById('searchDiv');
- hideById('migrationPatientDiv');
- hideById('patientDashboard');
-
- jQuery('#loaderDiv').show();
- jQuery('#editPatientDiv').load('showUpdatePatientForm.action',
- {
- id:patientId
- }, function()
- {
- jQuery('#searchPatientsDiv').dialog('close');
- jQuery('#loaderDiv').hide();
+ hideById('migrationPatientDiv');
+ hideById('patientDashboard');
+ enable('listPatientBtn');
+ enable('addPatientBtn');
+ enable('advancedSearchBtn');
+ setFieldValue("orgunitName", orgUnitNames[0]);
+}
+
+selection.setListenerFunction( organisationUnitSelected );
+
+// -----------------------------------------------------------------------------
+// List && Search patients
+// -----------------------------------------------------------------------------
+
+function listAllPatient()
+{
+ hideById('listPatientDiv');
+ hideById('editPatientDiv');
+ hideById('migrationPatientDiv');
+
+ jQuery('#loaderDiv').show();
+ contentDiv = 'listPatientDiv';
+ jQuery('#listPatientDiv').load('searchRegistrationPatient.action',{
+ listAll:true
+ },
+ function(){
+ statusSearching = 0;
+ showById('listPatientDiv');
+ jQuery('#loaderDiv').hide();
+ });
+ hideLoader();
+}
+
+function advancedSearch( params )
+{
+ $.ajax({
+ url: 'searchRegistrationPatient.action',
+ type:"POST",
+ data: params,
+ success: function( html ){
+ statusSearching = 1;
+ setInnerHTML( 'listPatientDiv', html );
+ showById('listPatientDiv');
+ setFieldValue('listAll',false);
+ jQuery( "#loaderDiv" ).hide();
+ }
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove patient
+// -----------------------------------------------------------------------------
+
+function removePatient( patientId, fullName )
+{
+ removeItem( patientId, fullName, i18n_confirm_delete, 'removePatient.action' );
+}
+
+// -----------------------------------------------------------------------------
+// Add Patient
+// -----------------------------------------------------------------------------
+
+function showAddPatientForm()
+{
+ hideById('listPatientDiv');
+ hideById('selectDiv');
+ hideById('searchDiv');
+ hideById('migrationPatientDiv');
+
+ jQuery('#loaderDiv').show();
+ jQuery('#editPatientDiv').load('showAddPatientForm.action'
+ , function()
+ {
showById('editPatientDiv');
+ jQuery('#loaderDiv').hide();
});
-
- jQuery('#resultSearchDiv').dialog('close');
+
}
-function validateUpdatePatient()
-{
- $("#editPatientDiv :input").attr("disabled", true);
+function validateAddPatient()
+{
+ $("#patientForm :input").attr("disabled", true);
$.ajax({
type: "POST",
url: 'validatePatient.action',
- data: getParamsForDiv('editPatientDiv'),
- success:updateValidationCompleted
- });
+ data: getParamsForDiv('patientForm'),
+ success:addValidationCompleted
+ });
}
-function updateValidationCompleted( messageElement )
+function addValidationCompleted( data )
{
- var type = jQuery(messageElement).find('message').attr('type');
- var message = jQuery(messageElement).find('message').text();
-
- if ( type == 'success' )
- {
- removeDisabledIdentifier();
- updatePatient();
- }
+ var type = jQuery(data).find('message').attr('type');
+ var message = jQuery(data).find('message').text();
+
+ if ( type == 'success' )
+ {
+ removeDisabledIdentifier( );
+ addPatient();
+ }
else
{
- $("#editPatientDiv :input").attr("disabled", true);
if ( type == 'error' )
{
- showErrorMessage( i18n_saving_patient_failed + ':' + '\n' + message );
+ showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message );
}
else if ( type == 'input' )
{
@@ -94,449 +120,125 @@
}
else if( type == 'duplicate' )
{
- showListPatientDuplicate(messageElement, true);
+ showListPatientDuplicate(data, false);
}
- $("#editPatientDiv :input").attr("disabled", false);
+
+ $("#patientForm :input").attr("disabled", false);
}
}
-function updatePatient()
+function addPatient()
{
$.ajax({
type: "POST",
- url: 'updatePatient.action',
- data: getParamsForDiv('editPatientDiv'),
- success: function( json ) {
- showPatientDashboardForm( getFieldValue('id') );
+ url: 'addPatient.action',
+ data: getParamsForDiv('patientForm'),
+ success: function(json) {
+ var patientId = json.message.split('_')[0];
+ jQuery('#resultSearchDiv').dialog('close');
+ showPatientDashboardForm( patientId );
}
});
-}
-
-function showRepresentativeInfo( patientId)
-{
- jQuery('#representativeInfo' ).dialog({
- title: i18n_representative_info,
- maximize: true,
- closable: true,
- modal: false,
- overlay: {background:'#000000', opacity:0.1},
- width: 400,
- height: 300
- });
-}
-
-function removeDisabledIdentifier()
-{
- jQuery("input.idfield").each(function(){
- if( jQuery(this).is(":disabled"))
- jQuery(this).val("");
- });
-}
-
-/**
- * Show list patient duplicate by jQuery thickbox plugin
- * @param rootElement : root element of the response xml
- * @param validate : is TRUE if this method is called from validation method
- */
-function showListPatientDuplicate( rootElement, validate )
-{
- var message = jQuery(rootElement).find('message').text();
- var patients = jQuery(rootElement).find('patient');
-
- var sPatient = "";
- jQuery( patients ).each( function( i, patient )
- {
- sPatient += "<hr style='margin:5px 0px;'><table>";
- sPatient += "<tr><td class='bold'>" + i18n_patient_system_id + "</td><td>" + jQuery(patient).find('systemIdentifier').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_full_name + "</td><td>" + jQuery(patient).find('fullName').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_gender + "</td><td>" + jQuery(patient).find('gender').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_date_of_birth + "</td><td>" + jQuery(patient).find('dateOfBirth').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_age + "</td><td>" + jQuery(patient).find('age').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_phone_number + "</td><td>" + jQuery(patient).find('phoneNumber').text() + "</td></tr>";
-
- var identifiers = jQuery(patient).find('identifier');
- if( identifiers.length > 0 )
- {
- sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_identifiers + "</td></tr>";
-
- jQuery( identifiers ).each( function( i, identifier )
- {
- sPatient +="<tr class='identifierRow'>"
- +"<td class='bold'>" + jQuery(identifier).find('name').text() + "</td>"
- +"<td>" + jQuery(identifier).find('value').text() + "</td> "
- +"</tr>";
- });
- }
-
- var attributes = jQuery(patient).find('attribute');
- if( attributes.length > 0 )
- {
- sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_attributes + "</td></tr>";
-
- jQuery( attributes ).each( function( i, attribute )
- {
- sPatient +="<tr class='attributeRow'>"
- +"<td class='bold'>" + jQuery(attribute).find('name').text() + "</td>"
- +"<td>" + jQuery(attribute).find('value').text() + "</td> "
- +"</tr>";
- });
- }
- sPatient += "<tr><td colspan='2'><input type='button' id='"+ jQuery(patient).find('id').first().text() + "' value='" + i18n_edit_this_patient + "' onclick='showUpdatePatientForm(this.id)'/></td></tr>";
- sPatient += "</table>";
- });
-
- var result = i18n_duplicate_warning;
- if( !validate )
- {
- result += "<input type='button' value='" + i18n_create_new_patient + "' onClick='removeDisabledIdentifier( );addPatient();'/>";
- result += "<br><hr style='margin:5px 0px;'>";
- }
-
- result += "<br>" + sPatient;
- jQuery('#resultSearchDiv' ).html( result );
- jQuery('#resultSearchDiv' ).dialog({
- title: i18n_duplicated_patient_list,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{background:'#000000', opacity:0.1},
- width: 800,
- height: 400
- });
-}
-
-// -----------------------------------------------------------------------------
-// Show representative form
-// -----------------------------------------------------------------------------
-
-function toggleUnderAge(this_)
-{
- if( jQuery(this_).is(":checked"))
- {
- jQuery('#representativeDiv').dialog('destroy').remove();
- jQuery('<div id="representativeDiv">' ).load( 'showAddRepresentative.action',{},
- function(){
- $('#patientForm [id=birthDate]').attr('id','birthDate_id');
- $('#patientForm [id=birthDate_id]').attr('name','birthDate_id');
- }).dialog({
- title: i18n_child_representative,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{background:'#000000', opacity:0.1},
- width: 800,
- height: 450,
- close:function()
- {
- $('#patientForm [id=birthDate_id]').attr('id','birthDate');
- $('#patientForm [id=birthDate]').attr('name','birthDate');
- }
- });
- }else
- {
- jQuery("#representativeDiv :input.idfield").each(function(){
- if( jQuery(this).is(":disabled"))
- {
- jQuery(this).removeAttr("disabled").val("");
- }
- });
- jQuery("#representativeId").val("");
- jQuery("#relationshipTypeId").val("");
- }
-}
-
-// ----------------------------------------------------------------
-// Enrollment program
-// ----------------------------------------------------------------
-
-function showProgramEnrollmentForm( patientId )
-{
- jQuery('#enrollmentDiv').load('showProgramEnrollmentForm.action',
- {
- id:patientId
- }).dialog({
- title: i18n_enroll_program,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{background:'#000000', opacity:0.1},
- width: 550,
- height: 450
- });
-}
-
-function programOnchange( programId )
-{
- if( programId==0){
- hideById('enrollmentDateTR');
- hideById('dateOfIncidentTR');
- }
- else{
- var type = jQuery('#enrollmentDiv [name=programId] option:selected').attr('programType')
- if(type=='2'){
- hideById('enrollmentDateTR');
- hideById('dateOfIncidentTR');
- disable('enrollmentDate');
- disable('dateOfIncident');
- }
- else{
- showById( 'enrollmentDateTR');
- enable('enrollmentDate');
-
- var dateOfEnrollmentDescription = jQuery('#enrollmentDiv [name=programId] option:selected').attr('dateOfEnrollmentDescription');
- var dateOfIncidentDescription = jQuery('#enrollmentDiv [name=programId] option:selected').attr('dateOfIncidentDescription');
- setInnerHTML('enrollmentDateDescription', dateOfEnrollmentDescription);
- setInnerHTML('dateOfIncidentDescription', dateOfIncidentDescription);
-
- var displayIncidentDate = jQuery('#enrollmentDiv [name=programId] option:selected').attr('displayIncidentDate');
- if( displayIncidentDate=='true'){
- showById('dateOfIncidentTR');
- enable('dateOfIncident');
- }
- else{
- hideById('dateOfIncidentTR');
- disable('dateOfIncident');
- }
- }
- var programId = jQuery('#programEnrollmentSelectDiv [id=programId] option:selected').val();
- jQuery('#identifierAndAttributeDiv').load("getPatientIdentifierAndAttribute.action",
- {
- id:programId
- }, function(){
- showById('identifierAndAttributeDiv');
- });
- }
-}
-
-function saveEnrollment( patientId, programId )
-{
- var patientId = jQuery('#enrollmentDiv [id=patientId]').val();
- var programId = jQuery('#enrollmentDiv [id=programId] option:selected').val();
- var programName = jQuery('#enrollmentDiv [id=programId] option:selected').text();
- var dateOfIncident = jQuery('#enrollmentDiv [id=dateOfIncidentField]').val();
- var enrollmentDate = jQuery('#enrollmentDiv [id=enrollmentDateField]').val();
-
- jQuery.postJSON( "saveProgramEnrollment.action",
- {
- patientId: patientId,
- programId: programId,
- dateOfIncident: dateOfIncident,
- enrollmentDate: enrollmentDate
- },
- function( json )
- {
- var programInstanceId = json.programInstanceId;
- var programStageInstanceId = json.activeProgramStageInstanceId;
- var programStageName = json.activeProgramStageName;
- var dueDate = json.dueDate;
- var type = jQuery('#enrollmentDiv [id=programId] option:selected').attr('programType');
-
- var activedRow = "<tr id='tr1_" + programInstanceId
- + "' type='" + type +"'"
- + " programStageInstanceId='" + programStageInstanceId + "'>"
- + " <td id='td_" + programInstanceId + "'>"
- + " <a href='javascript:loadActiveProgramStageRecords(" + programInstanceId + "," + programStageInstanceId + ")'>"
- + "<span id='infor_" + programInstanceId + "' class='selected bold'>"
- + programName + "(" + enrollmentDate + ")</span></a></td>"
- + "</tr>";
-
- activedRow += "<tr id='tr2_" + programInstanceId +"'"+
- + " onclick='javascript:loadActiveProgramStageRecords(" + programInstanceId + "," + programStageInstanceId + ")' style='cursor:pointer;'>"
- + "<td colspan='2'><a>• " + programStageName + "(" + dueDate + ")</a></td></tr>";
-
- jQuery('#activeTB' ).prepend(activedRow);
- jQuery('#enrollmentDiv').dialog("close");
- saveIdentifierAndAttribute( patientId, programId,'identifierAndAttributeDiv' );
- loadProgramInstance( programInstanceId, false );
- showSuccessMessage(i18n_enrol_success);
- });
-}
-
-// ----------------------------------------------------------------
-// Load program instance
-// ----------------------------------------------------------------
-
-function loadProgramInstance( programInstanceId, completed )
-{
- if( programInstanceId=='') {
- hideById('programEnrollmentDiv');
- return;
- }
- jQuery('#loaderDiv').show();
- jQuery('#programEnrollmentDiv').load('enrollmentform.action',
- {
- programInstanceId:programInstanceId
- }, function()
- {
- showById('programEnrollmentDiv');
- var type = jQuery('#tr_'+programInstanceId).attr('programType');
- if(type=='2'){
- hideById('programInstanceDiv');
- var programStageInstanceId = jQuery('#tr_'+programInstanceId).attr('programStageInstanceId');
- loadDataEntry( programStageInstanceId );
- }
- else{
- showById('programInstanceDiv');
- }
- activeProgramInstanceDiv( programInstanceId );
- if( completed ){
- hideById('newEncounterBtn_' + programInstanceId);
- }
- jQuery('#loaderDiv').hide();
- resize();
- });
-}
-
-// ----------------------------------------------------------------
-// Program enrollmment && unenrollment
-// ----------------------------------------------------------------
-
-function validateProgramEnrollment()
-{
- jQuery('#loaderDiv').show();
- $.ajax({
- type: "GET",
- url: 'validatePatientProgramEnrollment.action',
- data: getParamsForDiv('programEnrollmentSelectDiv'),
- success: function(json) {
- hideById('message');
- var type = json.response;
- if ( type == 'success' ){
- saveProgramEnrollment();
- }
- else if ( type == 'error' ){
- setMessage( i18n_program_enrollment_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' ){
- setMessage( json.message );
- }
- jQuery('#loaderDiv').hide();
- }
- });
-}
-
-function saveProgramEnrollment()
-{
- $.ajax({
- type: "POST",
- url: 'saveProgramEnrollment.action',
- data: getParamsForDiv('programEnrollmentSelectDiv'),
- success: function( html ) {
- setInnerHTML('programEnrollmentDiv', html );
- jQuery('#enrollBtn').attr('value',i18n_update);
- showSuccessMessage( i18n_enrol_success );
- }
- });
return false;
}
-function unenrollmentForm( programInstanceId )
-{
- $.ajax({
- type: "POST",
- url: 'removeEnrollment.action',
- data: "programInstanceId=" + programInstanceId,
- success: function( json )
- {
- jQuery('#completedList' ).append('<option value="' + programInstanceId + '">' + getInnerHTML('infor_' + programInstanceId ) + '</option>');
- hideById('tr1_' + programInstanceId );
- hideById('tr2_' + programInstanceId );
- setInnerHTML('programEnrollmentDiv','');
- showSuccessMessage( i18n_unenrol_success );
- }
- });
-
-
-}
-
-// ----------------------------------------------------------------
-// Identifiers && Attributes for selected program
-// ----------------------------------------------------------------
-
-function saveIdentifierAndAttribute( patientId, programId, paramsDiv)
-{
- var params = getParamsForDiv(paramsDiv);
- params += "&patientId=" + patientId;
- params +="&programId=" + programId;
- $.ajax({
- type: "POST",
- url: 'savePatientIdentifierAndAttribute.action',
- data: params,
- success: function(json)
- {
- showSuccessMessage( i18n_save_success );
- }
- });
-}
-
-// ----------------------------------------------------------------
-// Show selected data-recording
-// ----------------------------------------------------------------
-
-function showSelectedDataRecoding( patientId )
-{
- showLoader();
- hideById('searchDiv');
+// ----------------------------------------------------------------
+// Click Back to main form
+// ----------------------------------------------------------------
+
+function onClickBackBtn()
+{
+ showById('mainLinkLbl');
+ showById('selectDiv');
+ showById('searchDiv');
+ showById('listPatientDiv');
+
+ hideById('editPatientDiv');
+ hideById('enrollmentDiv');
+ hideById('listRelationshipDiv');
+ hideById('addRelationshipDiv');
+ hideById('migrationPatientDiv');
+ setInnerHTML('patientDashboard','');
+}
+
+function loadPatientList()
+{
+ hideById('editPatientDiv');
+ hideById('enrollmentDiv');
+ hideById('listRelationshipDiv');
+ hideById('addRelationshipDiv');
+ hideById('dataRecordingSelectDiv');
hideById('dataEntryFormDiv');
hideById('migrationPatientDiv');
- hideById('dataRecordingSelectDiv');
-
- jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action',
- {
- patientId: patientId
- },
- function()
- {
- jQuery('#dataRecordingSelectDiv [id=backBtnFromEntry]').hide();
- showById('dataRecordingSelectDiv');
-
- var programId = jQuery('#programEnrollmentSelectDiv [id=programId] option:selected').val();
- $('#dataRecordingSelectDiv [id=programId]').val( programId );
- $('#dataRecordingSelectDiv [id=inputCriteria]').hide();
- showById('dataRecordingSelectDiv');
+
+ showById('mainLinkLbl');
+ showById('selectDiv');
+ showById('searchDiv');
+
+ if( statusSearching == 0)
+ {
+ listAllPatient();
+ }
+ else if( statusSearching == 1 )
+ {
+ validateAdvancedSearch();
+ }
+}
+
+//------------------------------------------------------------------------------
+// Load data entry form
+//------------------------------------------------------------------------------
+
+function loadDataEntry( programStageInstanceId )
+{
+ setInnerHTML('dataEntryFormDiv', '');
+ showById('dataEntryFormDiv');
+ showById('executionDateTB');
+ showById('inputCriteriaDiv');
+ setFieldValue( 'dueDate', '' );
+ setFieldValue( 'executionDate', '' );
+ disable('validationBtn');
+ disableCompletedButton(true);
+ disable('uncompleteBtn');
+
+ jQuery(".stage-object-selected").removeClass('stage-object-selected');
+ var selectedProgramStageInstance = jQuery( '#' + prefixId + programStageInstanceId );
+ selectedProgramStageInstance.addClass('stage-object-selected');
+ setFieldValue( 'programStageId', selectedProgramStageInstance.attr('psid') );
+
+ showLoader();
+ $( '#dataEntryFormDiv' ).load( "dataentryform.action",
+ {
+ programStageInstanceId: programStageInstanceId
+ },function( )
+ {
+ var executionDate = jQuery('#executionDate').val();
+ var completed = jQuery('#entryFormContainer input[id=completed]').val();
+ var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
+ var reportDateDes = jQuery("#ps_" + programStageInstanceId).attr("reportDateDes");
+ setInnerHTML('reportDateDescriptionField',reportDateDes);
+ enable('validationBtn');
+ if( executionDate == '' )
+ {
+ disable('validationBtn');
+ }
+ else if( executionDate != '' && completed == 'false' )
+ {
+ disableCompletedButton(false);
+ }
+ else if( completed == 'true' )
+ {
+ disableCompletedButton(true);
+ }
+ resize();
hideLoader();
- hideById('contentDiv');
- });
-}
-
-// ----------------------------------------------------------------
-// Patient Location
-// ----------------------------------------------------------------
-
-function getPatientLocation( patientId )
-{
- hideById('listPatientDiv');
- hideById('selectDiv');
- hideById('searchDiv');
- setInnerHTML('patientDashboard','');
-
- jQuery('#loaderDiv').show();
-
- jQuery('#migrationPatientDiv').load("getPatientLocation.action",
- {
- patientId: patientId
- }
- , function(){
- showById( 'migrationPatientDiv' );
- jQuery( "#loaderDiv" ).hide();
- });
-}
-
-function registerPatientLocation( patientId )
-{
- $.getJSON( 'registerPatientLocation.action',{ patientId:patientId }
- , function( json )
- {
- showPatientDashboardForm(patientId);
- showSuccessMessage( i18n_save_success );
+ hideById('contentDiv');
+ jQuery('#dueDate').focus();
} );
}
// ----------------------------------------------------------------
-// List program-stage-instance of selected program
+// Cosmetic UI
// ----------------------------------------------------------------
-function getVisitSchedule( programInstanceId )
-{
- $('#tab-3').load("getVisitSchedule.action", {programInstanceId:programInstanceId});
-}
+function reloadOneRecord(){}
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientForm.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientForm.js 2012-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientForm.js 1970-01-01 00:00:00 +0000
@@ -1,244 +0,0 @@
-
-function organisationUnitSelected( orgUnits, orgUnitNames )
-{
- showById('selectDiv');
- showById('searchDiv');
- hideById('listPatientDiv');
- hideById('editPatientDiv');
- hideById('enrollmentDiv');
- hideById('listRelationshipDiv');
- hideById('addRelationshipDiv');
- hideById('migrationPatientDiv');
- hideById('patientDashboard');
- enable('listPatientBtn');
- enable('addPatientBtn');
- enable('advancedSearchBtn');
- setFieldValue("orgunitName", orgUnitNames[0]);
-}
-
-selection.setListenerFunction( organisationUnitSelected );
-
-// -----------------------------------------------------------------------------
-// List && Search patients
-// -----------------------------------------------------------------------------
-
-function listAllPatient()
-{
- hideById('listPatientDiv');
- hideById('editPatientDiv');
- hideById('migrationPatientDiv');
-
- jQuery('#loaderDiv').show();
- contentDiv = 'listPatientDiv';
- jQuery('#listPatientDiv').load('searchRegistrationPatient.action',{
- listAll:true
- },
- function(){
- statusSearching = 0;
- showById('listPatientDiv');
- jQuery('#loaderDiv').hide();
- });
- hideLoader();
-}
-
-function advancedSearch( params )
-{
- $.ajax({
- url: 'searchRegistrationPatient.action',
- type:"POST",
- data: params,
- success: function( html ){
- statusSearching = 1;
- setInnerHTML( 'listPatientDiv', html );
- showById('listPatientDiv');
- setFieldValue('listAll',false);
- jQuery( "#loaderDiv" ).hide();
- }
- });
-}
-
-// -----------------------------------------------------------------------------
-// Remove patient
-// -----------------------------------------------------------------------------
-
-function removePatient( patientId, fullName )
-{
- removeItem( patientId, fullName, i18n_confirm_delete, 'removePatient.action' );
-}
-
-// -----------------------------------------------------------------------------
-// Add Patient
-// -----------------------------------------------------------------------------
-
-function showAddPatientForm()
-{
- hideById('listPatientDiv');
- hideById('selectDiv');
- hideById('searchDiv');
- hideById('migrationPatientDiv');
-
- jQuery('#loaderDiv').show();
- jQuery('#editPatientDiv').load('showAddPatientForm.action'
- , function()
- {
- showById('editPatientDiv');
- jQuery('#loaderDiv').hide();
- });
-
-}
-
-function validateAddPatient()
-{
- $("#patientForm :input").attr("disabled", true);
- $.ajax({
- type: "POST",
- url: 'validatePatient.action',
- data: getParamsForDiv('patientForm'),
- success:addValidationCompleted
- });
-}
-
-function addValidationCompleted( data )
-{
- var type = jQuery(data).find('message').attr('type');
- var message = jQuery(data).find('message').text();
-
- if ( type == 'success' )
- {
- removeDisabledIdentifier( );
- addPatient();
- }
- else
- {
- if ( type == 'error' )
- {
- showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- showWarningMessage( message );
- }
- else if( type == 'duplicate' )
- {
- showListPatientDuplicate(data, false);
- }
-
- $("#patientForm :input").attr("disabled", false);
- }
-}
-
-function addPatient()
-{
- $.ajax({
- type: "POST",
- url: 'addPatient.action',
- data: getParamsForDiv('patientForm'),
- success: function(json) {
- var patientId = json.message.split('_')[0];
- jQuery('#resultSearchDiv').dialog('close');
- showPatientDashboardForm( patientId );
- }
- });
- return false;
-}
-
-// ----------------------------------------------------------------
-// Click Back to main form
-// ----------------------------------------------------------------
-
-function onClickBackBtn()
-{
- showById('mainLinkLbl');
- showById('selectDiv');
- showById('searchDiv');
- showById('listPatientDiv');
-
- hideById('editPatientDiv');
- hideById('enrollmentDiv');
- hideById('listRelationshipDiv');
- hideById('addRelationshipDiv');
- hideById('migrationPatientDiv');
- setInnerHTML('patientDashboard','');
-}
-
-function loadPatientList()
-{
- hideById('editPatientDiv');
- hideById('enrollmentDiv');
- hideById('listRelationshipDiv');
- hideById('addRelationshipDiv');
- hideById('dataRecordingSelectDiv');
- hideById('dataEntryFormDiv');
- hideById('migrationPatientDiv');
-
- showById('mainLinkLbl');
- showById('selectDiv');
- showById('searchDiv');
-
- if( statusSearching == 0)
- {
- listAllPatient();
- }
- else if( statusSearching == 1 )
- {
- validateAdvancedSearch();
- }
-}
-
-//------------------------------------------------------------------------------
-// Load data entry form
-//------------------------------------------------------------------------------
-
-function loadDataEntry( programStageInstanceId )
-{
- setInnerHTML('dataEntryFormDiv', '');
- showById('dataEntryFormDiv');
- showById('executionDateTB');
- showById('inputCriteriaDiv');
- setFieldValue( 'dueDate', '' );
- setFieldValue( 'executionDate', '' );
- disable('validationBtn');
- disableCompletedButton(true);
- disable('uncompleteBtn');
-
- jQuery(".stage-object-selected").removeClass('stage-object-selected');
- var selectedProgramStageInstance = jQuery( '#' + prefixId + programStageInstanceId );
- selectedProgramStageInstance.addClass('stage-object-selected');
- setFieldValue( 'programStageId', selectedProgramStageInstance.attr('psid') );
-
- showLoader();
- $( '#dataEntryFormDiv' ).load( "dataentryform.action",
- {
- programStageInstanceId: programStageInstanceId
- },function( )
- {
- var executionDate = jQuery('#executionDate').val();
- var completed = jQuery('#entryFormContainer input[id=completed]').val();
- var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
- var reportDateDes = jQuery("#ps_" + programStageInstanceId).attr("reportDateDes");
- setInnerHTML('reportDateDescriptionField',reportDateDes);
- enable('validationBtn');
- if( executionDate == '' )
- {
- disable('validationBtn');
- }
- else if( executionDate != '' && completed == 'false' )
- {
- disableCompletedButton(false);
- }
- else if( completed == 'true' )
- {
- disableCompletedButton(true);
- }
- resize();
- hideLoader();
- hideById('contentDiv');
- jQuery('#dueDate').focus();
- } );
-}
-
-// ----------------------------------------------------------------
-// Cosmetic UI
-// ----------------------------------------------------------------
-
-function reloadOneRecord(){}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2012-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2012-09-24 05:50:08 +0000
@@ -6,7 +6,6 @@
hideById('listEventDiv');
hideById('listEventDiv');
hideById('patientDashboard');
- hideById('patientProgramTrackingDiv');
hideById('smsManagementDiv');
hideById('sendSmsFormDiv');
hideById('editPatientDiv');
@@ -104,30 +103,12 @@
}
// --------------------------------------------------------------------
-// Patient program tracking
+// program tracking form
// --------------------------------------------------------------------
-function showPatientProgramTracking(programInstanceId)
-{
- hideById("listEventDiv");
- hideById("searchDiv");
- setInnerHTML("smsManagementDiv", "");
- showLoader();
- $( '#patientProgramTrackingDiv' ).load( "patientProgramTracking.action",
- {
- programInstanceId:programInstanceId
- },function( )
- {
- hideById('mainLinkLbl');
- showById('patientProgramTrackingDiv');
- hideLoader();
- });
-}
-
function getOutboundSmsList( programStageInstanceId, isSendSMS )
{
setFieldValue('sendToList', "false");
- setInnerHTML('patientProgramTrackingDiv', '');
$('#smsManagementDiv' ).load("getOutboundSmsList.action",
{
programStageInstanceId: programStageInstanceId
@@ -190,48 +171,6 @@
}
}
-function sendSmsOnePatient( field, programStageInstanceId )
-{
- setInnerHTML('smsError', '');
- if(field.value==""){
- field.style.backgroundColor = ERROR_COLOR;
- jQuery('#smsError').css("color", "red");
- setInnerHTML('smsError', i18n_this_field_is_required);
- return;
- }
-
- field.style.backgroundColor = SAVING_COLOR;
- programStageInstanceId = getFieldValue( 'programStageInstanceId' );
- jQuery.postUTF8( 'sendSMS.action',
- {
- programStageInstanceId: programStageInstanceId,
- msg: field.value
- }, function ( json )
- {
- if ( json.response == "success" ) {
- jQuery('#smsError').css("color", "green");
- setInnerHTML('smsError', json.message);
- var currentTime = date.getHours() + ":" + date.getMinutes();
- jQuery('#commentTB').prepend("<tr><td>" + getFieldValue('currentDate') + " " + currentTime + "</td>"
- + "<td>" + getFieldValue('programStageName') + "</td>"
- + "<td>" + getFieldValue('currentUsername') + "</td>"
- + "<td>" + field.value + "</td></tr>");
- var noMessage = eval( getInnerHTML('noMessageDiv_' + programStageInstanceId)) + 1;
- }
- else {
- showErrorMessage( json.message, 7000 );
- }
-
- if( jQuery("#commentTB tr.hidden").length > 0 ){
- commentDivToggle(true);
- }
- else{
- commentDivToggle(false);
- }
- field.style.backgroundColor = SUCCESS_COLOR;
- });
-}
-
function sendSmsToList()
{
params = getSearchParams();
@@ -258,31 +197,6 @@
});
}
-function commentDivToggle(isHide)
-{
- var index = 1;
- jQuery("#commentTB tr").removeClass("hidden");
- jQuery("#commentTB tr").each( function(){
- if(isHide && index > 5){
- jQuery(this).addClass("hidden");
- }
- else if(!isHide){
- jQuery(this).removeClass("hidden");
- }
- index++;
- });
-
- if( isHide ){
- showById('showCommentBtn');
- hideById('hideCommentBtn');
- }
- else
- {
- hideById('showCommentBtn');
- showById('hideCommentBtn');
- }
-}
-
// --------------------------------------------------------------------
// Post Comments
// --------------------------------------------------------------------
@@ -316,53 +230,6 @@
}
}
-function addComment( field, programStageInstanceId )
-{
- field.style.backgroundColor = SAVING_COLOR;
- var commentText = field.value;
- if( commentText == ''){
- field.style.backgroundColor = ERROR_COLOR;
- return;
- }
-
- jQuery.postUTF8( 'addPatientComment.action',
- {
- programStageInstanceId: programStageInstanceId,
- commentText: commentText
- }, function ( json )
- {
- var programStageName = jQuery("#ps_" + programStageInstanceId).attr('programStageName');
- var date = new Date();
- var currentTime = date.getHours() + ":" + date.getMinutes();
- jQuery('#commentTB').prepend("<tr><td>" + getFieldValue("currentDate") + " " + currentTime + "</td>"
- + "<td>" + programStageName + "</td>"
- + "<td>" + getFieldValue('currentUsername') + "</td>"
- + "<td>" + commentText + "</td></tr>");
- field.value="";
- showSuccessMessage( i18n_comment_added );
- field.style.backgroundColor = SUCCESS_COLOR;
-
- if( jQuery("#commentTB tr.hidden").length > 0 ){
- commentDivToggle(true);
- }
- else{
- commentDivToggle(false);
- }
- });
-}
-
-function removeComment( programStageInstanceId, commentId )
-{
- jQuery.postUTF8( 'removePatientComment.action',
- {
- programStageInstanceId:programStageInstanceId,
- id: commentId
- }, function ( json )
- {
- showSuccessMessage( json.message );
- hideById( 'comment_' + commentId );
- } );
-}
// --------------------------------------------------------------------
// Dashboard
@@ -489,7 +356,6 @@
showById('migrationPatientDiv');
hideById('smsManagementDiv');
hideById('patientDashboard');
- hideById('patientProgramTrackingDiv');
if( eventList == 1){
listAllPatient();
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm 2012-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm 1970-01-01 00:00:00 +0000
@@ -1,217 +0,0 @@
-<h3>
- <a href="javascript:onClickBackBtn();">$i18n.getString( 'program_tracking' )</a>
- • <a href="javascript:showPatientDashboardForm( $programInstance.patient.id );">$i18n.getString( 'patient_dashboard' )</a>
- » $!programInstance.program.name
-</h3>
-
-<input type='hidden' id='programInstanceId' name='programInstanceId' value='$programInstance.id' />
-<input type='hidden' id='patientId' name='patientId' value='$programInstance.patient.id' />
-<input type='hidden' id='currentUsername' name='currentUsername' value='$currentUsername'>
-
-<table>
- <tr>
- <td>$i18n.getString("full_name")</td>
- <td>$!programInstance.patient.getFullName()</td>
- </tr>
- <tr>
- <td>$i18n.getString("gender")</td>
- <td>$programInstance.patient.gender</td>
- </tr>
- <tr>
- <td>$i18n.getString("date_of_birth")</td>
- <td>$format.formatDate( $!programInstance.patient.birthDate) $!programInstance.patient.getAge()</td>
- </tr>
- <tr>
- <td>$i18n.getString("phone_number")</td>
- <td>
- #if($!programInstance.patient.phoneNumber && $!programInstance.patient.phoneNumber!='')
- $!programInstance.patient.phoneNumber
- #else
- [$i18n.getString('none')]
- #end
- </td>
- </tr>
- <tr>
- <td><input type="button" value='$i18n.getString("back_to_search")' onclick="javascript:onClickBackBtn();"></td>
- </tr>
-</table>
-
-<div id="tabs">
- <ul>
- <li><a href="#tab-2">$i18n.getString("demographics")</a></li>
- <li><a href="#tab-3">$i18n.getString("reschedule_and_set_status")</a></li>
- <li><a href="#tab-4">$i18n.getString("tracking_history")</a></li>
- <li><a href="#tab-5">$i18n.getString("program_reports")</a></li>
- </ul>
-
- <!-- Demographics -->
- <div id="tab-2">
- <table class="mainPageTable">
- <tr>
- <td>$i18n.getString("health_worker")</td>
- <td>
- #if($!programInstance.patient.healthWorker )
- $!programInstance.patient.healthWorker.name
- #else
- [$i18n.getString('none')]
- #end
- </td>
- </tr>
- #set( $mark = true )
- #foreach ($identifierType in $identifierTypes)
- #set( $identifier = '')
- #set( $identifier = $identiferMap.get( $identifierType.id ) )
- #if($identifier)
- <tr #alternate( $mark )>
- <td>$identifierType.name</td>
- <td>$identifier</td>
- </tr>
- #set( $mark = !$mark )
- #end
- #end
-
- <!-- ATTRIBUTES IN GROUPS -->
- #foreach ($attributeGroup in $attributeGroupsMap.keySet() )
- #set($attributes = $attributeGroupsMap.get($attributeGroup))
- #foreach($attribute in $attributes )
- #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
- #if($attributeValue)
- <tr #alternate( $mark )>
- <td>$attribute.name</td>
- <td>$attributeValue</td>
- </tr>
- #set( $mark = !$mark )
- #end
- #end
- #end
- </table>
- </div>
-
- <!-- Program-stage-instance TAB -->
- <div id="tab-3">
- <fieldset>
- <legend>$i18n.getString("program")</legend>
- <table>
- <tr>
- <td class='text-column'>$programInstance.program.dateOfEnrollmentDescription:</td>
- <td><input name="enrollmentDate" id="enrollmentDate" readonly value="$!format.formatDate( $programInstance.enrollmentDate )"></td>
- </tr>
- <tr>
- <td class='text-column'>$programInstance.program.dateOfIncidentDescription:</td>
- <td><input name="dateOfIncident" id="dateOfIncident" readonly value="$!format.formatDate( $programInstance.dateOfIncident )"></td>
- </tr>
- </table>
- </fieldset>
- <br>
- #if( $programStageInstances.size() > 0 )
- <table class='mainPageTable' id='progarmStageListDiv' name='progarmStageListDiv' >
- <col width="10px">
- <col width="200px">
- <col width="200px">
- <col width="160px">
- <col/>
- <col width='60px'/>
- <tr>
- <th>$i18n.getString( "nr" )</th>
- <th>$i18n.getString( "program_stage" )</th>
- <th>$i18n.getString( "reschedule_due_date" )</th>
- <th>$i18n.getString( "status" )</th>
- <th>$i18n.getString( "message" )</th>
- <th>$i18n.getString( "remove" )</th>
- </tr>
-
- #set( $rowCount = 0 )
- #set( $mark = false )
- #foreach( $programStageInstance in $programStageInstances )
- #set( $rowCount = $rowCount + 1 )
- <tr id="tr${programStageInstance.id}" #alternate( $mark ) >
- ##rowCount
- <td>$rowCount</td>
- ##stage name
- <td>
- $encoder.htmlEncode( $programStageInstance.programStage.name )
- </td>
- #set( $duedateId = "value_" + $programStageInstance.id + "_date" )
- #set($status = $statusMap.get( $programStageInstance.id ))
- <td>
- <input type="text" id="$duedateId" style='width:150px;' value="$!format.formatDate( $programStageInstance.dueDate )" onchange="saveDueDate( $programInstance.id, $programStageInstance.id, '$encoder.jsEncode( $programStageInstance.programStage.name )' )" />
- <script type="text/javascript">
- #if($status==1 || $status==5 )
- disable('$duedateId');
- #else
- datePicker( '$duedateId' );
- #end
- </script>
- </td>
- <td>
- <select id="stat_$programStageInstance.id" name="status_$programStageInstance.id" style='width:150px;' onchange="setEventStatus(this, $programStageInstance.id)">
- #if($status==4)
- <option value='4'>$i18n.getString("overdue")</option>
- <option value='5'>$i18n.getString("skipped")</option>
- #elseif($status==3)
- <option value='3'>$i18n.getString("scheduled_in_future")</option>
- <option value='5'>$i18n.getString("skipped")</option>
- #elseif($status==5)
- <option value='4'>$i18n.getString("overdue")</option>
- <option value='3'>$i18n.getString("scheduled_in_future")</option>
- <option value='5'>$i18n.getString("skipped")</option>
- #else
- <option value='1'>$i18n.getString("completed")</option>
- <option value='2'>$i18n.getString("incompleted")</option>
- #end
- </select>
- <script>
- setFieldValue("stat_$programStageInstance.id", $status);
- </script>
- </td>
- <td>
- <input type='text' id='message_$programStageInstance.id' name='message_$programStageInstance.id' style="width:300px;" class="{validate:{required:true,maxlength:160}}">
- <input type='button' value="+" class='tiny-button' title='$i18n.getString("post_comment")' onclick="addComment(byId('message_$programStageInstance.id'),'$programStageInstance.id')">
- <input type="button" value="»" class='tiny-button' title="$i18n.getString( 'send_sms' )" onclick="setFieldValue( 'programStageInstanceId',$programStageInstance.id);sendSmsOnePatient(byId('message_$programStageInstance.id'),'$programStageInstance.id');"/>
- </td>
- <td>
- #if($programStageInstance.programStage.irregular=='true' && ($status==3 || $status==4 || $status==5 ))
- <a href="javascript:removeEvent($programStageInstance.id, false)" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
- #end
- </td>
- </tr>
- #set( $mark = !$mark )
- #end
- </table>
- #end
- </div>
-
- <!-- Comments and SMS messages -->
- <div id='tab-4'>
- #parse( "/dhis-web-caseentry/eventMessage.vm" )
- </div>
-
- <div id='tab-5'><div id='programReportDiv'></div></div>
-
-</div>
-
-<script type="text/javascript">
-
- jQuery("#programEnrollmentInforForm").ready( function(){
- validation( 'programEnrollmentInforForm', function(form){
- saveIdentifierAndAttribute($!programInstance.patient.id,$!programInstance.program.id,'tab-3');
- });
-
- disable("dateOfIncident");
- disable("enrollmentDate");
-
- });
-
- $('#tabs').tabs();
- $( "#tabs" ).bind( "tabsselect", function(event, ui) {
- if( ui.tab.hash == '#tab-5' ){
- programReports(getFieldValue('programInstanceId'));
- }
- });
-
- if ( getFieldValue('enrollmentDate' ) == ''){
- jQuery('#enrollBtn').attr( 'value',i18n_enroll );
- }else{
- jQuery('#enrollBtn').attr( 'value',i18n_update );
- }
-</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2012-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2012-09-24 05:50:08 +0000
@@ -1,6 +1,3 @@
-<script type="text/javascript" src="javascript/entry.js"></script>
-<script type="text/javascript" src="javascript/relationshipPatient.js"></script>
-
<script>
jQuery(document).ready( function(){
showById('programAddPatientTR');
@@ -29,7 +26,6 @@
<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
<input type='hidden' id='listAll' name='listAll'>
<input type='hidden' id='sendToList' name='sendToList'>
- <input type='hidden' id='programStageInstanceId' name='programStageInstanceId' value='$programStageInstance.id'>
<input type='hidden' id='programStageName' name='programStageName'>
<div id='searchDiv'>
#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )
@@ -38,7 +34,6 @@
<div id='listEventDiv'></div>
<div id='patientDashboard'></div> <!-- Patient dashboard -->
-<div id='patientProgramTrackingDiv'></div>
<div id='smsManagementDiv'></div>
<div id='sendSmsFormDiv'></div>
<div id='editPatientDiv'></div> <!-- Add Patient Form -->
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-09-24 05:50:08 +0000
@@ -107,6 +107,8 @@
var i18n_overdue = '$encoder.jsEscape( $i18n.getString( "overdue" ) , "'")';
var i18n_scheduled_in_future = '$encoder.jsEscape( $i18n.getString( "scheduled_in_future" ) , "'")';
var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "patient_management" ) , "'")';
+ var i18n_comment_added = '$encoder.jsEscape( $i18n.getString( "comment_added" ) , "'")';
+ var i18n_update = '$encoder.jsEscape( $i18n.getString( "update" ) , "'")';
var checkedDuplicate = false;
// -1: no search anything
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm 2012-09-24 05:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm 2012-09-24 05:50:08 +0000
@@ -12,6 +12,7 @@
</table>
</fieldset>
<br>
+#set($programStageInstances = $programInstance.programStageInstances)
#if( $programStageInstances.size() > 0 )
<table class='mainPageTable' id='progarmStageListDiv' name='progarmStageListDiv' >
<col width="10px">
@@ -41,7 +42,7 @@
$encoder.htmlEncode( $programStageInstance.programStage.name )
</td>
#set( $duedateId = "value_" + $programStageInstance.id + "_date" )
- #set($status = $statusMap.get( $programStageInstance.id ))
+ #set($status = $programStageInstance.getEventStatus())
<td>
<input type="text" id="$duedateId" style='width:150px;' value="$!format.formatDate( $programStageInstance.dueDate )" onchange="saveDueDate( $programInstance.id, $programStageInstance.id, '$encoder.jsEncode( $programStageInstance.programStage.name )' )" />
<script type="text/javascript">
@@ -79,7 +80,7 @@
<input type="button" value="»" class='tiny-button' title="$i18n.getString( 'send_sms' )" onclick="setFieldValue( 'programStageInstanceId',$programStageInstance.id);sendSmsOnePatient(byId('message_$programStageInstance.id'),'$programStageInstance.id');"/>
</td>
<td>
- #if($programStageInstance.programStage.irregular=='true' && ($status==3 || $status==4 || $status==5 ))
+ #if($programStageInstance.programStage.irregular=='true' && $status!=1 )
<a href="javascript:removeEvent($programStageInstance.id, false)" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
#end
</td>