← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22146: Approval. Including level in item overview.

 

------------------------------------------------------------
revno: 22146
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-03-04 16:23:40 +0100
message:
  Approval. Including level in item overview.
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css


--
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-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2016-02-09 21:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2016-03-04 15:23:40 +0000
@@ -265,4 +265,6 @@
 approval_entity=Approval entity
 approval_status=Approval status
 please_make_selection=Please make a selection below
-data_criteria=Data criteria
\ No newline at end of file
+data_criteria=Data criteria
+approval_level=Approval level
+not_yet_approved=Not yet approved
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm	2016-02-17 19:02:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm	2016-03-04 15:23:40 +0000
@@ -19,6 +19,8 @@
 var i18n_select_items_for = '$encoder.jsEscape( $i18n.getString( "select_items_for" ), "'")';
 var i18n_item = '$encoder.jsEscape( $i18n.getString( "item" ), "'")';
 var i18n_organisation_unit = '$encoder.jsEscape( $i18n.getString( "organisation_unit" ), "'")';
+var i18n_approval_level = '$encoder.jsEscape( $i18n.getString( "approval_level" ), "'")';
+var i18n_not_yet_approved = '$encoder.jsEscape( $i18n.getString( "not_yet_approved" ), "'")';
 var i18n_action = '$encoder.jsEscape( $i18n.getString( "action" ), "'")';
 var i18n_generating_report = '$encoder.jsEscape( $i18n.getString( "generating_report" ), "'")';    
 var i18n_select_option_view_all = '$encoder.jsEscape( $i18n.getString( "select_option_view_all" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2016-03-04 14:43:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2016-03-04 15:23:40 +0000
@@ -4,6 +4,7 @@
 dhis2.appr.currentPeriodOffset = 0;
 dhis2.appr.permissions = null;
 dhis2.appr.dataSets = {};
+dhis2.appr.dataApprovalLevels = {};
 
 /**
  * Object with properties: ds, pe, ou, array of approvals with aoc, ou.
@@ -33,6 +34,12 @@
 		
 		$( "#dataSetId" ).html( dsHtml );
 	} );
+	
+	$.getJSON( "../api/dataApprovalLevels.json", function( json ) {
+		$.each( json.dataApprovalLevels, function( inx, al ) {
+			dhis2.appr.dataApprovalLevels[al.id] = al;
+		} );
+	} );
 } );
 
 /**
@@ -120,19 +127,28 @@
 		$.getJSON( apUrl, function( approvals ) {
 		
 			html = "<table id='attributeOptionComboTable'>";
-			html += "<tr><th>" + i18n_item + "</th><th>" + i18n_organisation_unit + "</th><th>" + i18n_action + "</th></tr>";
+			html += "<col width='2%'><col width='53%'><col width='17%'><col width='15%'><col width='10%'>";
+			html += "<tr><th></th><th>" + i18n_item + "</th><th>" + i18n_organisation_unit + "</th><th>" + i18n_approval_level + "</th><th>" + i18n_action + "</th></tr>";
 			
 			$.each( approvals, function( inx, ap ) {
 				
 				var cocName = cocs[ap.id].displayName,
-					pm = ap.permissions;
+					pm = ap.permissions,
+					level,
+					levelName = i18n_not_yet_approved;
+				
+				if ( ap.level && ap.level.hasOwnProperty( "level" ) ) {
+					level = dhis2.appr.dataApprovalLevels[ap.level.id];
+					levelName = level && level.displayName ? level.displayName : levelName;
+				}
 				
 				if ( cocName && pm ) {
 					html += "<tr>";
 					html += "<td><input type='checkbox' class='itemCheckbox' id='coc-" + ap.id + "-" + ap.ou + "' data-coc='" + ap.id + "' data-ou='" + ap.ou + "' ";
-					html += "data-approve='" + pm.mayApprove + "' data-unapprove='" + pm.mayUnapprove + "' data-accept='" + pm.mayAccept + "' data-unaccept='" + pm.mayUnaccept + "'>";
-					html += "<label for='coc-" + ap.id + "-" + ap.ou + "'>" + cocName + "</label></td>";
+					html += "data-approve='" + pm.mayApprove + "' data-unapprove='" + pm.mayUnapprove + "' data-accept='" + pm.mayAccept + "' data-unaccept='" + pm.mayUnaccept + "'></td>";
+					html += "<td><label for='coc-" + ap.id + "-" + ap.ou + "'>" + cocName + "</label></td>";
 					html += "<td>" + ap.ouName + "</td>";
+					html += "<td>" + levelName + "</td>";
 					html += "<td>" + dhis2.appr.getPermissions( ap ) + "</td>";
 					html += "</tr>";
 				}

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css	2016-03-03 18:48:22 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css	2016-03-04 15:23:40 +0000
@@ -31,9 +31,21 @@
 
 #attributeOptionComboTable
 {
+  border-collapse: collapse;
   width: 97%;
 }
 
+#attributeOptionComboTable th
+{
+  padding: 2px 3px 2px 3px;
+}
+
+#attributeOptionComboTable td
+{
+  padding: 5px 3px 6px 3px;
+  border-bottom: 1px solid #e0e0e0;
+}
+
 #attributeOptionComboItemDiv
 {
   height: 460px;