← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8213: Link to person dashboard from in Program Tracking.

 

------------------------------------------------------------
revno: 8213
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-09-24 12:02:17 +0700
message:
  Link to person dashboard from in Program Tracking.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientForm.js
modified:
  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/addPatientForm.vm
  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/relationshipPatient.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/patientDashboard.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm
  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/programTrackingList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm
  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/relationshipList.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/updatePatientForm.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/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-09-24 05:02:17 +0000
@@ -416,6 +416,7 @@
 				../dhis-web-commons/ouwt/ouwt.js
 				,javascript/commons.js
 				,javascript/patient.js
+				,javascript/patientForm.js
 				,javascript/entry.js
 				,javascript/relationshipPatient.js
 			</param>
@@ -883,7 +884,12 @@
 			<param name="page">/dhis-web-caseentry/programTrackingSelect.vm</param>
 			<param name="menu">/dhis-web-caseentry/trackingMenu.vm</param>
 			<param name="stylesheets">style/style.css</param>
-			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js,javascript/smsReminder.js</param>
+			<param name="javascripts">
+				../dhis-web-commons/ouwt/ouwt.js,
+				javascript/commons.js,
+				javascript/patient.js,
+				javascript/relationshipPatient.js,
+				javascript/smsReminder.js</param>
 			<param name="requiredAuthorities">F_SMS_REMINDER</param>
 		</action>
 
@@ -972,7 +978,11 @@
 			<param name="page">/dhis-web-caseentry/activityPlanSelect.vm</param>
 			<param name="menu">/dhis-web-caseentry/trackingMenu.vm</param>
 			<param name="stylesheets">style/style.css</param>
-			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js,javascript/activityPlan.js</param>
+			<param name="javascripts">
+				../dhis-web-commons/ouwt/ouwt.js,
+				javascript/commons.js,
+				javascript/patient.js,
+				javascript/activityPlan.js</param>
 			<param name="requiredAuthorities">F_ACTIVITY_PLAN</param>
 		</action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2012-09-24 05:02:17 +0000
@@ -34,7 +34,7 @@
 		addEventForPatientForm( 'patientForm' );
 	});	
 	hideById('patientForm [id=age]');
-	hideById('patientManagementLbl');
+	hideById('mainLinkLbl');
 </script>
 
 <h3>

=== 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-23 11:52:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-24 05:02:17 +0000
@@ -452,7 +452,6 @@
 	}
 }
 
-
 // -----------------------------------------------------------------------------
 // check duplicate patient
 // -----------------------------------------------------------------------------
@@ -701,26 +700,6 @@
 // Dash board
 // ----------------------------------------------------------------
 
-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 showPatientDashboardForm( patientId )
 {
 	hideById('selectDiv');
@@ -730,6 +709,9 @@
 	hideById('listRelationshipDiv');
 	hideById('addRelationshipDiv');
 	hideById('migrationPatientDiv');
+	hideById('patientProgramTrackingDiv');
+	hideById('smsManagementDiv');
+	setInnerHTML('listEventDiv','');
 				
 	jQuery('#loaderDiv').show();
 	jQuery('#patientDashboard').load('patientDashboard.action',
@@ -737,11 +719,32 @@
 			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();
@@ -926,8 +929,7 @@
 	$('.stage-flow').css('width', w-width); 
 	$('.table-flow').css('width', w-width); 
 	$('.table-flow tr').each(function(){
-		jQuery(this).find('td:visible').attr("width", "10px");
-		jQuery(this).find('td:hidden').removeAttr("width");
+		jQuery(this).find('td').attr("width", "10px");
 		jQuery(this).find('td:last').removeAttr("width");
 	});
 }
@@ -1033,7 +1035,7 @@
 						showById('searchDiv');
 						showById('listPatientDiv');
 					}
-					var id = 'ps_'+programStageInstanceId;
+					var id = 'ps_' + programStageInstanceId;
 					var programInstanceId = jQuery('#' + id).attr('programInstanceId');
 					if(jQuery(".stage-object-selected").attr('id')== id)
 					{

=== 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-23 12:58:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-09-24 05:02:17 +0000
@@ -1,147 +1,4 @@
 
-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;
-}
-
 function addEventForPatientForm( divname )
 {
 	jQuery("#" + divname + " [id=checkDuplicateBtn]").click(function() {
@@ -154,17 +11,26 @@
 }
 
 // -----------------------------------------------------------------------------
-// remove value of all the disabled identifier fields
-// an identifier field is disabled when its value is inherited from another person ( underAge is true ) 
-// we don't save inherited identifiers. Only save the representative id.
+// Show relationship with new patient
 // -----------------------------------------------------------------------------
 
-function removeDisabledIdentifier()
+function showRelationshipList( patientId )
 {
-	jQuery("input.idfield").each(function(){
-		if( jQuery(this).is(":disabled"))
-			jQuery(this).val("");
-	});
+	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();
+		});
 }
 
 // -----------------------------------------------------------------------------
@@ -178,7 +44,7 @@
 	hideById('selectDiv');
 	hideById('searchDiv');
 	hideById('migrationPatientDiv');
-	setInnerHTML('patientDashboard','');
+	hideById('patientDashboard');
 	
 	jQuery('#loaderDiv').show();
 	jQuery('#editPatientDiv').load('showUpdatePatientForm.action',
@@ -259,6 +125,14 @@
 		});
 }
 
+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
@@ -575,6 +449,10 @@
 	
 }
 
+// ----------------------------------------------------------------
+// Identifiers && Attributes for selected program
+// ----------------------------------------------------------------
+
 function saveIdentifierAndAttribute( patientId, programId, paramsDiv)
 {
 	var params  = getParamsForDiv(paramsDiv);
@@ -591,80 +469,6 @@
 		});
 }
 
-//----------------------------------------------------
-// Show relationship with new patient
-//----------------------------------------------------
-
-function showRelationshipList( patientId )
-{
-	hideById('addRelationshipDiv');
-	setInnerHTML('patientDashboard','');
-	
-	if ( getFieldValue('isShowPatientList') == 'false' )
-	{
-		hideById('selectDiv');
-		hideById('searchDiv');
-		hideById('listPatientDiv');
-
-		jQuery('#loaderDiv').show();
-		jQuery('#listRelationshipDiv').load('showRelationshipList.action',
-			{
-				id:patientId
-			}, function()
-			{
-				showById('listRelationshipDiv');
-				jQuery('#loaderDiv').hide();
-			});
-	}
-	else
-	{
-		loadPatientList();
-	}
-}
-
-// ----------------------------------------------------------------
-// Click Back to main form
-// ----------------------------------------------------------------
-
-function onClickBackBtn()
-{
-	showById('patientManagementLbl');
-	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('patientManagementLbl');
-	showById('selectDiv');
-	showById('searchDiv');
-	
-	if( statusSearching == 0)
-	{
-		listAllPatient();
-	}
-	else if( statusSearching == 1 )
-	{
-		validateAdvancedSearch();
-	}
-}
-
 // ----------------------------------------------------------------
 // Show selected data-recording
 // ----------------------------------------------------------------
@@ -729,16 +533,10 @@
 }
 
 // ----------------------------------------------------------------
-// Load visit schedule
+// List program-stage-instance of selected program
 // ----------------------------------------------------------------
 
 function getVisitSchedule( programInstanceId )
 {
 	$('#tab-3').load("getVisitSchedule.action", {programInstanceId:programInstanceId});
 }
-
-// ----------------------------------------------------------------
-// Cosmetic UI
-// ----------------------------------------------------------------
-
-function reloadOneRecord(){}

=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientForm.js	2012-09-24 05:02:17 +0000
@@ -0,0 +1,244 @@
+
+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/relationshipPatient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-09-22 15:52:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-09-24 05:02:17 +0000
@@ -1,54 +1,3 @@
-//------------------------------------------------------------------------------
-// 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();
-		} );
-}
 
 //------------------------------------------------------------------------------
 // Add Relationship

=== 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-23 12:58:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2012-09-24 05:02:17 +0000
@@ -1,7 +1,21 @@
 
 function orgunitSelected( orgUnits, orgUnitNames )
 {
-	hideById("listPatientDiv");
+	showById('mainLinkLbl');
+	showById('searchDiv');
+	hideById('listEventDiv');
+	hideById('listEventDiv');
+	hideById('patientDashboard');
+	hideById('patientProgramTrackingDiv');
+	hideById('smsManagementDiv');
+	hideById('sendSmsFormDiv');
+	hideById('editPatientDiv');
+	hideById('resultSearchDiv');
+	hideById('enrollmentDiv');
+	hideById('listRelationshipDiv');
+	hideById('addRelationshipDiv');
+	hideById('migrationPatientDiv');
+
 	clearListById('programIdAddPatient');
 	$('#contentDataRecord').html('');
 	setFieldValue('orgunitName', orgUnitNames[0]);
@@ -28,10 +42,11 @@
 function listAllPatient()
 {
 	setFieldValue('listAll', "true");
-	hideById('listPatientDiv');
-	contentDiv = 'listPatientDiv';
+	hideById('listEventDiv');
+	contentDiv = 'listEventDiv';
 	$('#contentDataRecord').html('');
 	hideById('advanced-search');
+	eventList = 1;
 	
 	var date = new Date();
 	var d = date.getDate() - 1;
@@ -47,7 +62,7 @@
 				+ getFieldValue('orgunitId') + "_4";
 	
 	showLoader();
-	jQuery('#listPatientDiv').load('getSMSPatientRecords.action',
+	jQuery('#listEventDiv').load('getSMSPatientRecords.action',
 		{
 			programId:programId,
 			listAll:false,
@@ -58,7 +73,7 @@
 		{
 			setInnerHTML('searchInforLbl',i18n_list_all_patients);
 			showById('colorHelpLink');
-			showById('listPatientDiv');
+			showById('listEventDiv');
 			resize();
 			hideLoader();
 		});
@@ -78,9 +93,10 @@
 		type:"POST",
 		data: params,
 		success: function( html ){
-			jQuery('#listPatientDiv').html(html);
+			jQuery('#listEventDiv').html(html);
 			showById('colorHelpLink');
-			showById('listPatientDiv');
+			showById('listEventDiv');
+			eventList = 2;
 			resize();
 			hideLoader();
 		}
@@ -93,7 +109,7 @@
 
 function showPatientProgramTracking(programInstanceId)
 {
-	hideById("listPatientDiv");
+	hideById("listEventDiv");
 	hideById("searchDiv");
 	setInnerHTML("smsManagementDiv", "");
 	showLoader();	
@@ -102,6 +118,7 @@
 			programInstanceId:programInstanceId
 		},function( )
 		{
+			hideById('mainLinkLbl');
 			showById('patientProgramTrackingDiv');
 			hideLoader();
 		});
@@ -116,8 +133,10 @@
 			programStageInstanceId: programStageInstanceId
 		}
 		, function(){
+			hideById('mainLinkLbl');
+			hideById('mainFormLink');
 			hideById('searchDiv');
-			hideById('listPatientDiv');
+			hideById('listEventDiv');
 			showById('smsManagementDiv');
 		});
 }
@@ -346,6 +365,60 @@
 }
 
 // --------------------------------------------------------------------
+// Dashboard
+// --------------------------------------------------------------------
+
+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();
+		});
+}
+
+function entryFormContainerOnReady(){}
+
+// --------------------------------------------------------------------
 // Cosmetic UI
 // --------------------------------------------------------------------
 
@@ -387,8 +460,6 @@
 			hideById('ps_' + id );
 		}
 	});
-	jQuery(".arrow-left").hide();
-	jQuery(".arrow-right").hide();
 }
 
 function reloadOneRecord( programInstanceId )
@@ -412,8 +483,18 @@
 
 function onClickBackBtn()
 {
+	showById('mainLinkLbl');
 	showById('searchDiv');
-	showById('listPatientDiv');
+	showById('listEventDiv');
+	showById('migrationPatientDiv');
 	hideById('smsManagementDiv');
-	hideById('patientProgramTrackingDiv');	
+	hideById('patientDashboard');
+	hideById('patientProgramTrackingDiv');
+	
+	if( eventList == 1){
+		listAllPatient();
+	}
+	else if( eventList == 2){
+		validateAdvancedSearch();
+	}
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-09-23 13:07:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-09-24 05:02:17 +0000
@@ -1,5 +1,5 @@
 <h3>
- <a href="javascript:onClickBackBtn();">$i18n.getString( 'patient_management' )</a>
+ <a href="javascript:onClickBackBtn();" id='mainFormLink' name='mainFormLink'>$i18n.getString( 'patient_management' )</a>
  &#8226; $i18n.getString( 'patient_dashboard' )
 </h3>
 
@@ -186,5 +186,5 @@
 <div id='dataEntryFormDiv'></div>
 
 <script>
-	hideById('patientManagementLbl');
+	hideById('mainLinkLbl');
 </script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm	2012-09-21 03:50:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm	2012-09-24 05:02:17 +0000
@@ -1,5 +1,5 @@
 <script>
-	hideById('patientManagementLbl');
+	hideById('mainLinkLbl');
 </script>
 
 <h3>

=== modified 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-23 11:52:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientProgramTracking.vm	2012-09-24 05:02:17 +0000
@@ -1,4 +1,9 @@
-<h4>$programInstance.program.name</h4>
+<h3>
+ <a href="javascript:onClickBackBtn();">$i18n.getString( 'program_tracking' )</a>
+ &#8226; <a href="javascript:showPatientDashboardForm( $programInstance.patient.id );">$i18n.getString( 'patient_dashboard' )</a>
+ &raquo; $!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'>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2012-09-23 11:52:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2012-09-24 05:02:17 +0000
@@ -8,7 +8,11 @@
 	});
 </script>
 
-<h4>$programStageInstance.programStage.name</h4>
+<h3>
+ <a href="javascript:onClickBackBtn();">$i18n.getString( 'program_tracking' )</a>
+ &#8226; <a href="javascript:showPatientDashboardForm( $programStageInstance.programInstance.patient.id );">$i18n.getString( 'patient_dashboard' )</a>
+ &raquo; $programStageInstance.programStage.name
+</h3>
 
 <input type='hidden' id='currentUsername' name='currentUsername' value='$currentUsername'>
 <input type='hidden' id='programInstanceId' name='programInstanceId' value='$programStageInstance.programInstance.id'>
@@ -52,8 +56,6 @@
 	<tr>
 		<td>
 			<br>
-			<input type='button' value='$i18n.getString("back")' onclick='onClickBackBtn();'>
-			<input type='button' value='$i18n.getString("patient_dashboard")' onclick='javascript:showPatientProgramTracking( "$programStageInstance.programInstance.id" );'>
 			#set($status = $programStageInstance.getEventStatus())
 			#if( $programStageInstance.irregular!='true' && ($status==3 || $status==4 || $status==5 ) )
 				<input type="button" value="$i18n.getString('remove_this_event')" onclick="javascript:removeEvent($programStageInstance.id, true)" title='$i18n.getString( "remove_this_event" )'></a>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm	2012-09-21 01:28:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm	2012-09-24 05:02:17 +0000
@@ -42,7 +42,7 @@
 						#if($value=="")
 							#set($value=$patient.getFullName())
 						#end
-						<input type='button' class='patient-object' value='$value' onclick='javascript:showPatientProgramTracking( "$programInstance.id" );' title='$i18n.getString( "patient_dashboard" )'>
+						<input type='button' class='patient-object' value='$value' onclick='javascript:showPatientDashboardForm( "$programInstance.patient.id" );' title='$i18n.getString( "patient_dashboard" )'>
 					</td>
 					<td class='bold' style='cursor:pointer;font-size:25px' onclick="eventFlowToggle($programInstance.id)">
 						<a>&raquo;</a>

=== 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-21 01:28:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm	2012-09-24 05:02:17 +0000
@@ -1,3 +1,6 @@
+<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');
@@ -21,7 +24,7 @@
 	});	
 </script>
 
-<h3>$i18n.getString( "program_tracking" )</h3>
+<h3 id='mainLinkLbl'>$i18n.getString( "program_tracking" )</h3>
 <form>
 	<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
 	<input type='hidden' id='listAll' name='listAll'>
@@ -33,10 +36,18 @@
 	</div>
 </form>
 
-<div id='listPatientDiv'></div>
+<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 -->
+<div id='resultSearchDiv' style='font-size:13px'></div> <!-- List searching patients -->
+<div id='enrollmentDiv'></div> <!-- Program Enrollment Form -->
+<div id='listRelationshipDiv'></div> <!-- List relationship -->
+<div id='addRelationshipDiv'></div> <!-- Add relationship -->
+<div id='migrationPatientDiv'></div> <!-- Migration Patient -->
+
 #parse( "dhis-web-commons/loader/loader.vm" )
 
 <div class='hidden'>
@@ -61,7 +72,84 @@
 	var i18n_please_select_criteria = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_criteria" ) , "'")' + ']';
 	var i18n_the_date_is_scheduled = '$encoder.jsEscape( $i18n.getString( "the_date_is_scheduled" ) , "'")';
 	var i18n_list_all_patients = '$encoder.jsEscape( $i18n.getString( "list_all_patients" ) , "'")';
-	
+	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+	var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "program_tracking" ) , "'")';
+	var i18n_enroll_program = '$encoder.jsEscape( $i18n.getString( "enroll_program" ) , "'")';
+	 
+	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
+	var i18n_please_select_village = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_village" ), "'")' + ']';
+	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
+	var i18n_select_program = '[' + '$encoder.jsEscape( $i18n.getString( "select_program" ), "'")' + ']';
+	var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
+	var i18n_list_all_patient = '$encoder.jsEscape( $i18n.getString( "list_all_patient" ) , "'")';
+	var i18n_enrol_success = '$encoder.jsEscape( $i18n.getString( "enrol_success" ) , "'")';
+	var i18n_unenrol_success = '$encoder.jsEscape( $i18n.getString( "unenrol_success" ) , "'")';
+	var i18n_list_patients_by_program = '$encoder.jsEscape( $i18n.getString( "list_patients_by_program" ) , "'" )';
+	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient" ) , "'" )';
+	var i18n_adding_patient_failed = '$encoder.jsEscape( $i18n.getString( "adding_patient_failed" ), "'")';
+	var i18n_updating_patient_failed = '$encoder.jsEscape( $i18n.getString( "updating_patient_failed" ), "'")';	
+	var i18n_program_enrollment_failed = '$encoder.jsEscape( $i18n.getString( "program_enrollment_failed" ) , "'")';
+    var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+    var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
+    var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")'; 
+	var i18n_date_invalid = '$encoder.jsEscape( $i18n.getString( "date_invalid" ) , "'")';
+	var i18n_date_less_incident = '$encoder.jsEscape( $i18n.getString( "date_less_incident" ) , "'")';
+	var i18n_enroll = '$encoder.jsEscape( $i18n.getString( "enroll" ) , "'")';
+	var i18n_update = '$encoder.jsEscape( $i18n.getString( "update" ) , "'")';
+	var i18n_oucode_must_have_9_digits = '$encoder.jsEscape( $i18n.getString( "oucode_must_be_valid" ) , "'")';
+	var i18n_patient_identifiers = '$encoder.jsEscape( $i18n.getString( "patient_identifiers" ) , "'")';
+	var i18n_patient_attributes = '$encoder.jsEscape( $i18n.getString( "patient_attributes" ) , "'")';
+	var i18n_patient_id = '$encoder.jsEscape( $i18n.getString( "id" ) , "'")';
+	var i18n_patient_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ) , "'")';
+	var i18n_patient_demographics = '$encoder.jsEscape( $i18n.getString( "demographics" ) , "'")';
+	var i18n_patient_gender = '$encoder.jsEscape( $i18n.getString( "gender" ) , "'")';
+	var i18n_patient_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'")';
+	var i18n_patient_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ), "'")';
+	var i18n_patient_age = '$encoder.jsEscape( $i18n.getString( "age" ) , "'")';
+	var i18n_patient_phone_number = '$encoder.jsEscape( $i18n.getString( "phone_number" ) , "'")';
+	var i18n_edit_this_patient = '$encoder.jsEscape( $i18n.getString( "edit_this_patient" ) , "'")';
+	var i18n_no_duplicate_found = '$encoder.jsEscape( $i18n.getString( "no_duplicate_found" ) , "'")';
+	var i18n_patient_system_id = '$encoder.jsEscape( $i18n.getString( "patient_system_id" ) , "'")';
+	var i18n_child_representative = '$encoder.jsEscape( $i18n.getString( "child_representative" ) , "'")';
+	var i18n_no_patients_found = '$encoder.jsEscape( $i18n.getString( "no_patients_found" ) , "'")';
+	var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
+	var i18n_duplicated_patient_list = '$encoder.jsEscape( $i18n.getString( "duplicated_patient_list" ) , "'")';
+	var i18n_duplicate_warning = '$encoder.jsEscape( $i18n.getString( "duplicate_warning" ) , "'")';
+	var i18n_search_by_name_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_name_identifier" ) , "'")';
+	var i18n_search_by_program = '$encoder.jsEscape( $i18n.getString( "search_by_program" ) , "'")';
+	var i18n_create_new_patient = '$encoder.jsEscape( $i18n.getString( "create_new_patient" ) , "'")';
+	var i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_person" ) , "'")';
+	var i18n_representative_info = '$encoder.jsEscape( $i18n.getString( "representative_info" ) , "'")';
+	var i18n_select = '[' + '$encoder.jsEscape( $i18n.getString( "select" ), "'")' + ']';
+	var i18n_program_stages_history_plan = '$encoder.jsEscape( $i18n.getString( "program_stages_history_plan" ) , "'")';
+	
+	var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+	var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
+	var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+	var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+    var i18n_invalid_date =   '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " 
+							+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" 
+							+ dateFormat.replace('yy', 'yyyy') + " '" ; 
+    var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
+    var i18n_incomplete_confirm_message = '$encoder.jsEscape( $i18n.getString( "incomplete_confirm_message" ) , "'")';
+	var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
+	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
+	var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
+	var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'")';
+	var i18n_please_select_relationship_type = '$encoder.jsEscape( $i18n.getString( "please_select_relationship_type" ) , "'")';
+	var i18n_please_select_a_patient_for_setting_relationship = '$encoder.jsEscape( $i18n.getString( "please_select_a_patient_for_setting_relationship" ) , "'")';
+	var i18n_update_patient = '$encoder.jsEscape( $i18n.getString( "update_patient" ) , "'")';
+	var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'")';
+	var i18n_overdue = '$encoder.jsEscape( $i18n.getString( "overdue" ) , "'")';
+	var i18n_scheduled_in_futurei18n_scheduled_in_future = '$encoder.jsEscape( $i18n.getString( "scheduled_in_future" ) , "'")';
+	
+	var checkedDuplicate = false;
+	
+	// eventList - 0 : Not events
+	// eventList - 1 : List event
+	// eventList - 2 : Search events
+	var eventList = 0; 
+
 	var date = new Date();
 	var d = date.getDate();
 	var m = date.getMonth();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2012-09-21 03:50:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2012-09-24 05:02:17 +0000
@@ -1,5 +1,5 @@
 <script>
-	hideById('patientManagementLbl');
+	hideById('mainLinkLbl');
 </script>
 
 <h3>

=== 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-21 06:25:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-09-24 05:02:17 +0000
@@ -11,7 +11,7 @@
 		#end
 	});
 </script>
-<h3 id='patientManagementLbl'>$i18n.getString( "patient_management" ) #openHelp( "patient" )</h3>
+<h3 id='mainLinkLbl'>$i18n.getString( "patient_management" ) #openHelp( "patient" )</h3>
 
 <input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
 <input type='hidden' id='isShowPatientList' name= 'isShowPatientList' >
@@ -99,7 +99,6 @@
 	var i18n_please_select_relationship_type = '$encoder.jsEscape( $i18n.getString( "please_select_relationship_type" ) , "'")';
 	var i18n_please_select_a_patient_for_setting_relationship = '$encoder.jsEscape( $i18n.getString( "please_select_a_patient_for_setting_relationship" ) , "'")';
 	var i18n_update_patient = '$encoder.jsEscape( $i18n.getString( "update_patient" ) , "'")';
-	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
 	var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'")';
 	var i18n_enroll_program = '$encoder.jsEscape( $i18n.getString( "enroll_program" ) , "'")';
@@ -107,6 +106,7 @@
 	var i18n_the_date_is_scheduled = '$encoder.jsEscape( $i18n.getString( "the_date_is_scheduled" ) , "'")';
 	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 checkedDuplicate = false;
 	// -1: no search anything

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm	2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm	2012-09-24 05:02:17 +0000
@@ -49,7 +49,7 @@
 		}
 	});
 	hideById('registrationDateTR');
-	hideById('patientManagementLbl');
+	hideById('mainLinkLbl');
 </script>
 
 <h3>

=== 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-22 13:08:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2012-09-24 05:02:17 +0000
@@ -2,35 +2,31 @@
 	<legend>$i18n.getString("program")</legend>
 	<table>
 		<tr>
-			<td class='text-column'><label for="enrollmentDate">$programInstance.program.dateOfEnrollmentDescription<em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
-			<td><input type="text" id="enrollmentDate" name="enrollmentDate" class="{validate:{required:true}}" value="$!format.formatDate( $programInstance.enrollmentDate )"></td>
-		</tr>
-		<tr>
-			<td class='text-column'><label for="dateOfIncident">$programInstance.program.dateOfIncidentDescription<em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
-			<td><input type="text" id="dateOfIncident" name="dateOfIncident"  class="{validate:{required:true}}" value="$!format.formatDate( $programInstance.dateOfIncident )"></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td>
-				<input type="button" class='button' value="$i18n.getString( 'update' )" onclick='updateEnrollment($programInstance.patient.id, $programInstance.program.id, $programInstance.id, "$programInstance.program.name")'/>
-				<input type="button" class='button' value="$i18n.getString( 'unenroll' )" onclick='unenrollmentForm($programInstance.id)'/>
-			</td>
-		<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>
-#set($programStageInstances = $programInstance.programStageInstances)
 #if( $programStageInstances.size() > 0 )
 	<table class='mainPageTable' id='progarmStageListDiv' name='progarmStageListDiv' >
-		<col id="noCol"/>
-		<col id="stageCol"/>    
-		<col id="entryCol"/>    
+		<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" )</th> 
+			<th>$i18n.getString( "reschedule_due_date" )</th>       
 			<th>$i18n.getString( "status" )</th>
-			<th>$i18n.getString( "delete" )</th>
+			<th>$i18n.getString( "message" )</th>
+			<th>$i18n.getString( "remove" )</th>
 		</tr>
 		
 	#set( $rowCount = 0 )
@@ -41,38 +37,21 @@
 			##rowCount
 			<td>$rowCount</td>        
 			##stage name
-			<td class='textColumn'>
-				<span id="value[$programStageInstance.id].name" title="$!encoder.htmlEncode( $programStageInstance.programStage.description )">
-					$encoder.htmlEncode( $programStageInstance.programStage.name )            
-				</span>
-			</td>        
-				   
-			##entry
-			#set($status = $programStageInstance.getEventStatus())
-			<td class='input-column '>    
-				#set( $duedateId = "value_" + $programStageInstance.id + "_date" )        
-				#if($programStageInstance.executionDate)
-					<input type="text" id="$duedateId" name="entryfield" value="$!format.formatDate( $programStageInstance.executionDate )" onchange="saveExecutionDate( $programInstance.program.id, $programStageInstance.id, this );" />
-					<script type="text/javascript">
-						#if( $status==1 || $status==5 )
-							disable('$duedateId');
-						#else
-							datePickerValid( '$duedateId');
-						#end
-					</script> 
-
-				#else
-					<input type="text" id="$duedateId" name="entryfield" 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
-							datePickerFuture( '$duedateId');
-						#end
-					</script> 
-				#end
+			<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)
@@ -91,13 +70,17 @@
 					#end
 				</select>
 				<script>
-					setFieldValue("stat_$programStageInstance.id", "$status");
+					setFieldValue("stat_$programStageInstance.id", $status);
 				</script>
 			</td>
-			
-			<td>
-				#if($programStageInstance.programStage.irregular=='true' )
-					<a href="javascript:removeEvent($programStageInstance.id, false)" title='$i18n.getString( "remove" )'><img src="../images/delete.png" id='del_$programStageInstance.id' name='del_$programStageInstance.id' alt='$i18n.getString( "remove" )' #if($status==1) class='hidden' #end ></a>
+			<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="&raquo;" 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>