← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16673: tracker capture - report for upcoming events now provides option to filter those marked for followup

 

------------------------------------------------------------
revno: 16673
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-09-09 14:54:28 +0200
message:
  tracker capture - report for upcoming events now provides option to filter those marked for followup
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json


--
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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2014-09-08 13:35:02 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2014-09-09 12:54:28 +0000
@@ -65,7 +65,7 @@
     
     private List<Note> notes = new ArrayList<>();
     
-    protected Boolean followup;
+    private Boolean followup;
 
     public Enrollment()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2014-08-21 16:30:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2014-09-09 12:54:28 +0000
@@ -556,6 +556,7 @@
             event.setTrackedEntityInstance( programStageInstance.getProgramInstance().getEntityInstance().getUid() );
         }
 
+        event.setFollowup( programStageInstance.getProgramInstance().getFollowup() );
         event.setEnrollmentStatus( EventStatus.fromInt( programStageInstance.getProgramInstance().getStatus() ) );
         event.setStatus( programStageInstance.getStatus() );
         event.setEventDate( DateUtils.getLongDateString( programStageInstance.getExecutionDate() ) );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java	2014-08-15 12:54:04 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java	2014-09-09 12:54:28 +0000
@@ -32,6 +32,7 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
 import org.hisp.dhis.common.BaseLinkableObject;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.event.EventStatus;
@@ -72,6 +73,8 @@
     private List<DataValue> dataValues = new ArrayList<>();
 
     private List<Note> notes = new ArrayList<>();
+    
+    private Boolean followup;
 
     public Event()
     {
@@ -246,6 +249,18 @@
     {
         this.notes = notes;
     }
+    
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public Boolean getFollowup()
+    {
+        return followup;
+    }
+
+    public void setFollowup( Boolean followup )
+    {
+        this.followup = followup;
+    }
 
     @Override
     public boolean equals( Object o )

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2014-08-22 04:48:43 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2014-09-09 12:54:28 +0000
@@ -125,6 +125,7 @@
                 {
                     event.setEnrollment( rowSet.getString( "pi_uid" ) );
                     event.setEnrollmentStatus( EventStatus.fromInt( rowSet.getInt( "pi_status" ) ) );
+                    event.setFollowup( rowSet.getBoolean( "pi_followup" ) );
                 }
 
                 event.setTrackedEntityInstance( rowSet.getString( "tei_uid" ) );
@@ -203,7 +204,7 @@
         SqlHelper hlp = new SqlHelper();
 
         String sql =
-            "select pa.uid as tei_uid, pi.uid as pi_uid, pi.status as pi_status, p.uid as p_uid, p.type as p_type, ps.uid as ps_uid, ps.capturecoordinates as ps_capturecoordinates, pa.uid as pa_uid, psi.uid as psi_uid, psi.status as psi_status, ou.uid as ou_uid, " +
+            "select pa.uid as tei_uid, pi.uid as pi_uid, pi.status as pi_status, pi.followup as pi_followup, p.uid as p_uid, p.type as p_type, ps.uid as ps_uid, ps.capturecoordinates as ps_capturecoordinates, pa.uid as pa_uid, psi.uid as psi_uid, psi.status as psi_status, ou.uid as ou_uid, " +
                 "psi.executiondate as psi_executiondate, psi.duedate as psi_duedate, psi.completeduser as psi_completeduser, psi.longitude as psi_longitude, psi.latitude as psi_latitude, " +
                 "psinote.trackedentitycommentid as psinote_id, psinote.commenttext as psinote_value, psinote.createddate as psinote_soreddate, psinote.creator as psinote_storedby, " +
                 "pdv.value as pdv_value, pdv.storedby as pdv_storedby, pdv.providedelsewhere as pdv_providedelsewhere, de.uid as de_uid " +

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2014-09-09 12:06:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2014-09-09 12:54:28 +0000
@@ -21,6 +21,7 @@
     $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
     $scope.selectedOuMode = $scope.ouModes[0];
     $scope.report = {};
+    $scope.displayMode = {};
     
     //watch for selection of org unit from tree
     $scope.$watch('selectedOrgUnit', function() {        
@@ -134,13 +135,14 @@
                 //incase a TEI happens to have more than one overdue, sort using duedate
                 for(var tei in $scope.dhis2Events){                    
                     $scope.dhis2Events[tei] = orderByFilter($scope.dhis2Events[tei], '-dueDate');
-                    $scope.dhis2Events[tei].reverse();                    
+                    $scope.dhis2Events[tei].reverse();
                 }
                 
                 //make upcoming event name and its due date part of the grid column
                 for(var i=0; i<$scope.teiList.length; i++){
                     $scope.teiList[i].event_name = $scope.dhis2Events[$scope.teiList[i].id][0].name;
                     $scope.teiList[i].due_date = $scope.dhis2Events[$scope.teiList[i].id][0].dueDate;
+                    $scope.teiList[i].followup = $scope.dhis2Events[$scope.teiList[i].id][0].followup;
                 }
                
                 $scope.reportFinished = true;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2014-09-09 12:06:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2014-09-09 12:54:28 +0000
@@ -37,18 +37,94 @@
         </div>        
     </div>
     <!-- top bar ends -->
-    
+
     <!--input form begins -->
     <form name="outerForm" novalidate>               
-        <div ng-include="'components/report/reportForm.html'"></div>
+        <div class="row">
+            <div class="col-sm-8 col-md-6">
+                <table class="table table-borderless table-striped">
+                    <tr>
+                        <td class='col-sm-4 col-md-3 vertical-center'>
+                            {{'program'| translate}}
+                        </td>
+                        <td class='col-sm-4 col-md-3'>
+                            <select ng-model="selectedProgram"
+                                    class="form-control"
+                                    ng-options="program as program.name for program in programs | orderBy: 'name'" 
+                                    ng-disabled="programs.length < 1">
+                                <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists'| translate}}</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='col-sm-4 col-md-3 vertical-center'>{{'org_unit'| translate}}</td>
+                        <td class='col-sm-4 col-md-3'>                 
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="selected" value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="children" value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="descendants" value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="accessible" value="ACCESSIBLE"> {{'ACCESSIBLE'| translate}}</label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <label>                    
+                            <td class='col-sm-4 col-md-3 vertical-center'>
+                                {{'filter'| translate}}
+                            </td>
+                            <td>
+                                <label>
+                                    <input type="checkbox" ng-change="markForFollowup()" ng-model="displayMode.onlyMarkedFollowup"/>  {{'only_marked_for_followup' | translate}}
+                                </label>                                
+                            </td>
+                        </label>
+                    </tr>
+                </table>
+            </div>
+        </div>
+        <div class="row">
+            <div class="col-sm-8 col-md-6">
+                <table class="table-borderless">
+                    <tr>
+                        <td>
+                            <input type="text" 
+                                   name="reportStartDate" 
+                                   placeholder="{{'start_date'| translate}} (yyyy-mm-dd)" 
+                                   class="form-control" 
+                                   ng-date 
+                                   ng-model="report.startDate" 
+                                   max="today" 
+                                   ng-required="true"/> 
+                            <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                        </td>
+                        <td>
+                            <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.endDate" max="today" ng-required="true"/>
+                            <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                        </td>
+                    </tr>
+                </table>                
+            </div>
+            <div class="col-md-6 trim">
+                <button type="button" class="btn btn-primary" ng-click="generateReport(selectedProgram, report, selectedOuMode)" ng-disabled="!selectedProgram">{{'go'| translate}}</button>               
+            </div>
+        </div>
+
+        <div class="row" ng-if="programs.length < 1">        
+            <div class="col-sm-8 col-md-6 vertical-spacing">
+                <div class="alert alert-warning">{{'no_program_exists_report'| translate}}</div> 
+            </div>
+        </div>
+        <div class="row" ng-if="programs.length > 0 && !selectedProgram">        
+            <div class="col-sm-8 col-md-6 vertical-spacing">
+                <div class="alert alert-warning">{{'please_select_program_report'| translate}}</div> 
+            </div>
+        </div>
     </form>    
     <!--input form ends -->
-    
+
     <img src="../images/ajax-loader-bar.gif" ng-if="reportStarted && !reportFinished"/>
-    
+
     <!-- upcoming events list begins -->
     <div ng-if="reportFinished">
-        
+
         <div ng-switch="teiList.length">                    
             <div ng-switch-when="undefined">
                 <div class="alert alert-warning vertical-spacing">
@@ -67,39 +143,39 @@
                         <thead>                        
                             <tr>
                                 <th ng-show="gridColumn.show" ng-repeat="gridColumn in gridColumns">
-                                    
+
                                     <!-- sort icon begins -->
                                     <span ng-click="sortTEIGrid(gridColumn)">
-                                        {{gridColumn.name | translate}}
+                                        {{gridColumn.name| translate}}
                                         <i ng-if="sortHeader == gridColumn.id && reverse" class="fa fa-sort-desc"></i>
                                         <i ng-if="sortHeader == gridColumn.id && !reverse" class="fa fa-sort-asc"></i>
                                     </span>
                                     <!-- sort icon ends -->
-                                    
+
                                     <!-- filter icon begins -->
                                     <span class='pull-right'>
-                                        <span ng-show="gridColumn.type !='date' && gridColumn.type !='int'">
-                                            <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [filterText[gridColumn.id] == undefined || filterText[gridColumn.id] == '']"><i class="fa fa-search"></i></span></a>
+                                        <span ng-show="gridColumn.type != 'date' && gridColumn.type != 'int'">
+                                            <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter - without - content', false: 'filter - with - content'} [filterText[gridColumn.id] == undefined || filterText[gridColumn.id] == '']"><i class="fa fa-search"></i></span></a>
                                         </span>
-                                        <span ng-show="gridColumn.type ==='date' || gridColumn.type ==='int'">
-                                            <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [(filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == '') && (filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == '')]"><i class="fa fa-search"></i></span></a>
+                                        <span ng-show="gridColumn.type === 'date' || gridColumn.type === 'int'">
+                                            <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter - without - content', false: 'filter - with - content'} [(filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == '') && (filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == '')]"><i class="fa fa-search"></i></span></a>
                                         </span>                                                    
                                     </span>
                                     <!-- filter icon ends -->
-                                    
-                                     <!-- filter input field begins -->
+
+                                    <!-- filter input field begins -->
                                     <span ng-show="gridColumn.showFilter">  
                                         <span ng-switch="gridColumn.type">
                                             <span ng-switch-when="int">
-                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
-                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit'| translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit'| translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
                                             </span>
                                             <span ng-switch-when="date">
-                                                <input style="width: 70%;" placeholder="{{'start_date' | translate}}" type="text" ng-model="filterText[gridColumn.id].start" data-ng-date readonly="readonly">
+                                                <input style="width: 70%;" placeholder="{{'start_date'| translate}}" type="text" ng-model="filterText[gridColumn.id].start" data-ng-date readonly="readonly">
                                                 <span ng-hide="filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == ''">
                                                     <a href ng-click='removeStartFilterText(gridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>                                                        
                                                 </span>
-                                                <input style="width: 70%;" placeholder="{{'end_date' | translate}}" type="text" ng-model="filterText[gridColumn.id].end" data-ng-date readonly="readonly">
+                                                <input style="width: 70%;" placeholder="{{'end_date'| translate}}" type="text" ng-model="filterText[gridColumn.id].end" data-ng-date readonly="readonly">
                                                 <span ng-hide="filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == ''">
                                                     <a href ng-click='removeEndFilterText(gridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>                                                        
                                                 </span> 
@@ -110,16 +186,16 @@
                                         </span>                                                    
                                     </span>
                                     <!-- filter input field ends -->
-                                    
+
                                 </th>
                             </tr>                        
                         </thead>
                         <tbody id="list">
-                            <tr ng-repeat="tei in teiList | orderBy:sortHeader:reverse | gridFilter:filterText:filterTypes"
+                            <tr ng-repeat="tei in teiList| orderBy:sortHeader:reverse | gridFilter:filterText:filterTypes"
                                 ng-click="showDashboard(tei)"
                                 title="{{'go_to_dashboard'| translate}}">
                                 <td ng-show="gridColumn.show"                                            
-                                    ng-repeat="gridColumn in gridColumns">                                                
+                                    ng-repeat="gridColumn in gridColumns" ng-if='displayMode.onlyMarkedFollowup ? tei.followup:true'>                                                
                                     {{tei[gridColumn.id]}}                                                
                                 </td>                                
                             </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-09-08 13:35:02 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-09-09 12:54:28 +0000
@@ -30,6 +30,7 @@
     "required": "Required",
     "number_required": "Number required",
     "date_required": "Date required (yyyy-mm-dd)",
+    "filter": "Filter",
     "search": "Search",
     "_search": "search",  
     "advanced_search": "Advanced search",
@@ -132,6 +133,7 @@
     "_report": "report",     
     "visit_schedule": "Visit Schedule",
     "mark_for_followup": "Mark for followup",
+    "only_marked_for_followup": "Only marked for followup",
     "registered_data": "Registered data",
     "no_data_found": "No data found",
     "no_data": "No data",