← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14966: Add calendar for date attribute fields in Advanced Search TEI.

 

------------------------------------------------------------
revno: 14966
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-24 22:52:51 +0800
message:
  Add calendar for date attribute fields in Advanced Search TEI.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-04-21 16:30:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-04-24 14:52:51 +0000
@@ -69,9 +69,23 @@
 	$('#' + container + ' [id=dateOperator]').replaceWith("");
 	if (valueType == 'bool') {
 		element.replaceWith(getTrueFalseBox());
-	} else {
+	}
+	else if ( attributeId=='programDate' || valueType == 'date')
+	{
+		element.replaceWith( getDateField(container) );
+		datePickerValid( 'searchText_' + container );
+	} 
+	else {
 		element.replaceWith(searchTextBox);
 	}
+	
+}
+
+function getDateField( container )
+{
+	var dateField = '<select id="dateOperator_' + container + '" name="dateOperator" style="width:40px"><option value="GT"> > </option><option value="GE"> >= </option><option value="EQ"> = </option><option value="LT"> < </option><option value="LE"> <= </option></select>';
+	dateField += '<input type="text" id="searchText_' + container + '" name="searchText" style="width:160px;" onkeyup="searchPatientsOnKeyUp( event );">';
+	return dateField;
 }
 
 function getTrueFalseBox() {
@@ -173,7 +187,7 @@
 						} else if (item.name == 'searchText') {
 							if (item.value != '') {
 								if( isProgramDate ){
-									p += "&programDate=EQ:" + item.value;
+									p += "&programDate=" + dateOperator + ":" + item.value;
 								}
 								else if (dateOperator.length > 0) {
 									p += dateOperator + ":" + item.value.toLowerCase();