← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15914: tracker capture - tei search output more informative

 

------------------------------------------------------------
revno: 15914
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Mon 2014-06-30 15:56:21 +0200
message:
  tracker capture - tei search output more informative
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html


--
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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-06-30 13:16:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-06-30 13:56:21 +0000
@@ -16,6 +16,7 @@
                 ProgramFactory,
                 AttributesFactory,
                 EntityQueryFactory,
+                TEIGridService,
                 TEIService) {   
    
     //Selection
@@ -147,6 +148,7 @@
     
     $scope.prepareForsearch = function(mode){ 
 
+        $scope.teiFetched = false;
         $scope.selectedSearchMode = mode;
         $scope.emptySearchText = false;
         $scope.emptySearchAttribute = false;
@@ -198,10 +200,13 @@
                                             $scope.programUrl,
                                             $scope.attributeUrl.url,
                                             $scope.pager).then(function(data){
-            $scope.trackedEntityList = data; 
+            //$scope.trackedEntityList = data;            
+            if(data.rows){
+                $scope.teiCount = data.rows.length;
+            }                    
             
-            if( data.pager ){
-                $scope.pager = data.pager;
+            if( data.metaData.pager ){
+                $scope.pager = data.metaData.pager;
                 $scope.pager.toolBarDisplay = 5;
 
                 Paginator.setPage($scope.pager.page);
@@ -210,6 +215,9 @@
                 Paginator.setItemCount($scope.pager.total);                    
             }
             
+            //process tei grid
+            $scope.trackedEntityList = TEIGridService.format(data);
+            $scope.teiFetched = true;            
         });
     };
     
@@ -356,6 +364,5 @@
     
     $scope.home = function(){        
         window.location = DHIS2URL;
-    };
-    
+    };    
 });
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-06-30 13:16:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-06-30 13:56:21 +0000
@@ -238,7 +238,7 @@
 })
 
 /* Service for getting tracked entity instances */
-.factory('TEIService', function($http, $filter, DateUtils, EntityService) {
+.factory('TEIService', function($http, DateUtils) {
     
     var promise;
     return {
@@ -264,7 +264,8 @@
             var url = '../api/trackedEntityInstances.json?ou=' + orgUnitUid + '&program=' + programUid;
             
             promise = $http.get( url ).then(function(response){               
-                return EntityService.formatter(response.data);
+                //return EntityService.formatter(response.data);
+                return response.data;
             });            
             return promise;
         },
@@ -273,7 +274,8 @@
             var url =  '../api/trackedEntityInstances.json?ou=' + orgUnitUid;
             
             promise = $http.get( url ).then(function(response){                                
-                return EntityService.formatter(response.data);
+                //return EntityService.formatter(response.data);
+                return response.data;
             });            
             return promise;
         },        
@@ -295,7 +297,8 @@
             }
             
             promise = $http.get( url + '&pageSize=' + pgSize + '&page=' + pg ).then(function(response){                                
-                return EntityService.formatter(response.data);
+                //return EntityService.formatter(response.data);
+                return response.data;
             });            
             return promise;
         },                
@@ -773,10 +776,10 @@
             
 })
 
-.service('EntityService', function(OrgUnitService, DateUtils, $filter){
+.service('TEIGridService', function(OrgUnitService, DateUtils, $filter){
     
     return {
-        formatter: function(grid){
+        format: function(grid){
             if(!grid || !grid.rows){
                 return;
             }

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-06-30 11:40:12 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-06-30 13:56:21 +0000
@@ -98,6 +98,7 @@
 
     <!-- entity grid begins -->
     <div class="row" ng-if="showTrackedEntityDiv">
+        <img class="col-md-12" src="../images/ajax-loader-bar.gif" ng-if="!teiFetched"/>
         <div class="col-md-12" ng-include="'views/tei.html'"></div>  
     </div>
     <!-- entity grid ends -->

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2014-06-30 13:16:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2014-06-30 13:56:21 +0000
@@ -1,7 +1,41 @@
-<div ng-switch="trackedEntityList">                    
-    <div ng-switch-when=""></div>
-    <div ng-switch-default>        
-        <div ng-switch="trackedEntityList.rows.length">
+<div ng-switch="teiCount">                    
+    <div ng-switch-when="undefined">
+        <div class="alert alert-warning">
+            {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
+        </div>
+    </div>
+    <div ng-switch-when="0">  
+        <div class="alert alert-warning">
+            {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
+        </div>
+    </div>    
+    <div ng-switch-default> 
+        
+        <!-- entity begins -->
+        <div class="vertical-spacing">
+            <table class="table table-striped dhis2-table-hover">               
+                <thead>                        
+                    <tr>
+                        <th ng-show="gridColumn.show" ng-repeat="gridColumn in gridColumns">
+                            {{gridColumn.name}}
+                        </th>                                    
+                    </tr>                        
+                </thead>
+                <tbody id="list">
+                    <tr ng-repeat="trackedEntity in trackedEntityList.rows" 
+                        ng-click="showDashboard(trackedEntity)">
+                        <td ng-show="gridColumn.show"                                            
+                            ng-repeat="gridColumn in gridColumns">                                                
+                            {{trackedEntity[gridColumn.id]}}                                                
+                        </td>
+                    </tr>
+                </tbody>        
+            </table>
+        </div>
+        <!-- entity ends -->  
+        <serverside-paginator></serverside-paginator> 
+                
+        <!--<div ng-switch="trackedEntityList.rows.length">
             <div ng-switch-when="undefined">
                 <p>
                     {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
@@ -13,7 +47,8 @@
                 </p>
             </div>
             <div ng-switch-default>
-                <!-- entity begins -->
+                
+  
                 <div class="vertical-spacing">
                     <table class="table table-striped dhis2-table-hover">               
                         <thead>                        
@@ -34,9 +69,9 @@
                         </tbody>        
                     </table>
                 </div>
-                <!-- entity ends -->  
+
                 <serverside-paginator></serverside-paginator>                    
             </div>
-        </div>                        
+        </div>  -->                      
     </div>
 </div> 
\ No newline at end of file