← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14878: Applying metaData of events-result of web-api to lost-to-follow-up function.

 

------------------------------------------------------------
revno: 14878
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-04-15 23:19:24 +0800
message:
  Applying metaData of events-result of web-api to lost-to-follow-up function.
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/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/trackingEventMessage.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	2014-04-12 04:55:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2014-04-15 15:19:24 +0000
@@ -685,4 +685,5 @@
 cancelled_enrollments_only = Cancelled enrollments only
 all_statuses = All statuses
 event_date = Event date
-duplicate_value_of = Duplicate value of
\ No newline at end of file
+duplicate_value_of = Duplicate value of
+data_values = Data values
\ No newline at end of file

=== 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	2014-04-13 14:27:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2014-04-15 15:19:24 +0000
@@ -101,35 +101,41 @@
 		// Event list
 		table += "<table class='listTable' width='100%'>";
 		
-		table += "<col width='30' />";
-		table += "<col />"; // Ordered no.
+		table += "<col width='30' />";// Ordered no.
 		table += "<col />"; // Event-date
-		for(var i in json.events[0].dataValues.length ){
-			table += "<col />";
-		}
-		table += "<col width='200' />";
+		table += "<col />"; // Data values
+		table += "<col width='200' />"; // Operations
 		
 		table += "<thead><tr><th>#</th>";
 		table += "<th>" + i18n_event_date + "</th>";
-
-		for(var i in json.events[0].dataValues ){
-			table += "<th>" + json.events[0].dataValues[i].dataElement + "</th>";
-		}
+		table += "<th>" + i18n_data_values + "</th>";
 		table += "<th>" + i18n_operations + "</th>";
 		table += "</tr></thead>";
 		
 		table += "<tbody id='list'>";
-		for ( var i in json.events) {
-			var cols = json.events[i];
-			var uid = cols.event;
-			var teiUid = cols.trackedEntityInstance;
+		for ( var i in json.eventList) {
+			var row = json.eventList[i];
+			var uid = row.event;
+			var teiUid = row.trackedEntityInstance;
 			var no = eval(json.pager.page);
 			no = (no - 1) * json.pager.pageSize + eval(i) + 1;
 			table += "<tr id='tr" + uid + "'>";
-			table += "<td>" + no + "</td>";
-			table += "<td>" + json.events[i].eventDate + "</td>";
-			for (var j in cols.dataValues) {
-				table += "<td>" +  cols.dataValues[j].value + "</td>";
+			table += "<td>" + no + "</td>";// No.
+			table += "<td>" + row.eventDate + "</td>";// Event-date
+			
+			// Data values
+			table += "<td>";
+			if( row.dataValues!=undefined ){
+				table += "<table>";
+				for (var j in row.dataValues) {
+					var colVal = row.dataValues[j].dataElement;
+					table += "<tr><td>" +  json.metaData.de[colVal] + ": </td>";
+					table += "<td>" +  row.dataValues[j].value + "</td></tr>";
+				}
+				table += "</table>";
+			}
+			else{
+				table += "</td>";
 			}
 			
 			// Operations column
@@ -166,7 +172,7 @@
 		searchMethod = "validateAdvancedSearch";
 	}
 	
-	var table = "<table width='100%' style='background-color: #ebf0f6;'><tr><td colspan='"
+	var table = "<table width='100%' style='background-color: #ebf0f6;'><tr><td rowpan='"
 			+ json.width + "'>";
 	table += "<div class='paging'>";
 	table += "<span class='first' title='" + i18n_first + "'>««</span>";
@@ -190,7 +196,7 @@
 }
 
 // --------------------------------------------------------------------
-// Search events
+// Search eventList
 // --------------------------------------------------------------------
 
 followup = true;
@@ -204,7 +210,7 @@
 	showLoader();
 	params += "&orgUnit=" + getFieldValue("orgunitId");
 	$.ajax({
-		url : '../api/events.json',
+		url : '../api/eventList.json',
 		type : "GET",
 		data : params,
 		success : function(json) {

=== 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	2014-04-13 14:27:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm	2014-04-15 15:19:24 +0000
@@ -175,6 +175,7 @@
 	var i18n_next = '$encoder.jsEscape( $i18n.getString( "next" ) , "'")';
 	var i18n_last = '$encoder.jsEscape( $i18n.getString( "last" ) , "'")';
 	var i18n_no_result_found = '$encoder.jsEscape( $i18n.getString( "no_result_found" ) , "'")';
+	var i18n_data_values = '$encoder.jsEscape( $i18n.getString( "data_values" ) , "'")';
 	
 	var checkedDuplicate = false;
 	var registration = false;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackingEventMessage.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackingEventMessage.vm	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackingEventMessage.vm	2014-04-15 15:19:24 +0000
@@ -16,6 +16,7 @@
 	</tr>
 	<tbody id='commentTB' name='commentTB'>
 		#set( $mark = false )
+		#if($programStageInstance.comment)
 		<tr id="comment_$programStageInstance.comment.id" #alternate( $mark )>
 			<td>$format.formatDateTime($programStageInstance.comment.createdDate)</td>
 			<td>$encoder.htmlEncode($programStageInstance.programStage.displayName)</td>
@@ -27,6 +28,7 @@
 				<a href="javascript:removeComment( '$programStageInstance.id', '$programStageInstance.comment.id' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
 			</td>
 		</tr>
+		#end
 		
 		#set( $mark = !$mark )
 		#foreach( $sms in $programStageInstance.outboundSms )