← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10050: Support search events/patients by date range in multi data entry form; Add 2 buttons in multi ent...

 

------------------------------------------------------------
revno: 10050
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-07 22:11:33 +0700
message:
  Support search events/patients by date range in multi data entry form; Add 2 buttons in multi entry form to load event in last 7 days and last 30 days.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  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/multiDataEntry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.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/singleEventSelect.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-06 15:47:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-07 15:11:33 +0000
@@ -577,3 +577,6 @@
 insert_a_report_date = Please enter a report date.
 insert_a_due_date = Please enter a due date.
 view_all = View all
+scheduled_today = Scheduled today
+scheduled_7_days = Scheduled 7 days
+scheduled_30_days = Scheduled 30 days
\ No newline at end of file

=== 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	2013-03-07 08:55:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-03-07 15:11:33 +0000
@@ -191,18 +191,20 @@
 	var flag = true;
 	var dateOperator = '';
 	
-	if (getFieldValue('searchByProgramStage') == "false" 
-		|| ( getFieldValue('searchByProgramStage') == "true"  
-			&& jQuery( '#advancedSearchTB tr' ).length > 1) ){
-		jQuery("#searchDiv :input").each( function( i, item )
-		{
-			var elementName = $(this).attr('name');
-			if( elementName=='searchText' && jQuery( item ).val() == '')
+	if( getFieldValue('startDueDate')=='' && getFieldValue('endDueDate')=='' ){
+		if (getFieldValue('searchByProgramStage') == "false" 
+			|| ( getFieldValue('searchByProgramStage') == "true"  
+				&& jQuery( '#advancedSearchTB tr' ).length > 1) ){
+			jQuery("#searchDiv :input").each( function( i, item )
 			{
-				showWarningMessage( i18n_specify_search_criteria );
-				flag = false;
-			}
-		});
+				var elementName = $(this).attr('name');
+				if( elementName=='searchText' && jQuery( item ).val() == '')
+				{
+					showWarningMessage( i18n_specify_search_criteria );
+					flag = false;
+				}
+			});
+		}
 	}
 	
 	if(flag){

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2013-03-05 08:35:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2013-03-07 15:11:33 +0000
@@ -22,6 +22,48 @@
 
 function listAllPatient()
 {
+	var today = getCurrentDate();
+	var searchTexts = "stat_" + getFieldValue('programIdAddPatient') + "_" 
+				+ today + "_" + today + "_" 
+				+ getFieldValue('orgunitId') + "_false_4_3";
+	
+	getPatientList(searchTexts);
+}
+
+function scheduled7Days()
+{
+	var today = getCurrentDate();
+	var date = new Date();
+	var d = date.getDate();
+	var m = date.getMonth();
+	var y= date.getFullYear();
+	var last7day = jQuery.datepicker.formatDate( dateFormat, new Date(y, m, d-7) ) ;
+	
+	var searchTexts = "stat_" + getFieldValue('programIdAddPatient') + "_" 
+				+ last7day + "_" + today + "_" 
+				+ getFieldValue('orgunitId') + "_false_4_3";
+				
+	getPatientList(searchTexts);
+}
+
+function scheduled30Days()
+{
+	var today = getCurrentDate();
+	var date = new Date();
+	var d = date.getDate();
+	var m = date.getMonth();
+	var y= date.getFullYear();
+	var last30day = jQuery.datepicker.formatDate( dateFormat, new Date(y, m-1, d) ) ;
+	
+	var searchTexts = "stat_" + getFieldValue('programIdAddPatient') + "_" 
+				+ last30day + "_" + today + "_" 
+				+ getFieldValue('orgunitId') + "_false_4_3";
+				
+	getPatientList(searchTexts);
+}
+
+function getPatientList(searchTexts)
+{
 	hideById('listPatientDiv');
 	hideById('advanced-search');
 	hideById('contentDataRecord');
@@ -30,9 +72,6 @@
 	var startDate = jQuery.datepicker.formatDate( dateFormat, new Date() );
 	var endDate = jQuery.datepicker.formatDate( dateFormat, new Date() );
 	var programId = getFieldValue('programIdAddPatient');
-	var searchTexts = "stat_" + programId + "_" 
-				+ startDate + "_" + endDate + "_" 
-				+ getFieldValue('orgunitId') + "_false_4_3";
 	
 	showLoader();
 	jQuery('#listPatientDiv').load('getDataRecords.action',

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm	2013-03-07 08:55:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm	2013-03-07 15:11:33 +0000
@@ -15,6 +15,10 @@
 			enable('listPatientBtn');
 			enable('advancedSearchBtn');
 		}
+		var i18n_scheduled_today = '$encoder.jsEscape( $i18n.getString( "scheduled_today" ) , "'")';
+		setFieldValue('listPatientBtn', i18n_scheduled_today);
+		showById('scheduled7DaysBtn');
+		showById('scheduled30DaysBtn');
 	});	
 </script>
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-03-07 08:55:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-03-07 15:11:33 +0000
@@ -12,9 +12,11 @@
 			<input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end >
 		</td>
 		<td rowspan='2' valign='bottom'>
-			<input type="button" class='large-button' id='listPatientBtn' style='260px;' value="$i18n.getString( 'list_all_patients' )" onclick="javascript:listAllPatient();" disabled >
-			<input type="button" class='large-button' id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();" disabled >
-			<input type="button" style='width:120px' id='advancedSearchBtn' value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').toggle();" disabled>
+			<input type="button" style='width:130px' id='listPatientBtn' style='260px;' value="$i18n.getString( 'list_all_patients' )" onclick="javascript:listAllPatient();" disabled >
+			<input type="button" style='width:130px' class='hidden' id='scheduled7DaysBtn' style='260px;' value="$i18n.getString( 'scheduled_7_days' )" onclick="javascript:scheduled7Days();" >
+			<input type="button" style='width:130px' class='hidden' id='scheduled30DaysBtn' style='260px;' value="$i18n.getString( 'scheduled_30_days' )" onclick="javascript:scheduled30Days();" >
+			<input type="button" style='width:130px' id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();" disabled >
+			<input type="button" style='width:130px' id='advancedSearchBtn' value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').toggle();" disabled>
 		</td>
 	</tr> 
 	<tr id='programAddPatientTR'>

=== 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	2013-03-05 13:55:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2013-03-07 15:11:33 +0000
@@ -132,4 +132,7 @@
 		disable('addPatientBtn');
 		disable('advancedSearchBtn');
 	#end
+	setFieldValue('startDueDate','');
+	setFieldValue('endDueDate','');
+	
 </script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-03-07 05:59:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-03-07 15:11:33 +0000
@@ -16,6 +16,8 @@
 			enable('addPatientBtn');
 			enable('advancedSearchBtn');
 		}
+		setFieldValue('startDueDate','');
+		setFieldValue('endDueDate','');
 	});
 </script>