← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22107: tracker-capture: searching of events in data entry widget - complete

 

------------------------------------------------------------
revno: 22107
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-03-02 15:10:42 +0100
message:
  tracker-capture: searching of events in data entry widget - complete
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/filters.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-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2016-03-01 16:47:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2016-03-02 14:10:42 +0000
@@ -16,7 +16,7 @@
         <div ng-if="!useMainMenu">            
             {{'dataentry' | translate}}
             <span class="pull-right widget-link">               
-                <a href ng-click="model.showEventSearch = !model.showEventSearch" title="{{'search'| translate}}" class="small-horizonal-spacing"><i class="fa fa-search vertical-center"></i></a>
+                <a href ng-click="model.showEventSearch = !model.showEventSearch" title="{{'search'| translate}}" ng-if="allEventsSorted.length > eventPageSize" class="small-horizonal-spacing"><i class="fa fa-search vertical-center"></i></a>
                 <a href ng-click="model.showLegend = !model.showLegend" title="{{'event_color_legend'| translate}}" class="small-horizonal-spacing"><i class="fa fa-info-circle vertical-center"></i></a>
                 <a href ng-click="toggleEventsTableDisplay()" title="{{showEventsAsTables ? 'toggle_table_view_off' : 'toggle_table_view_on'| translate}}" ng-show="stagesCanBeShownAsTable"><span ng-if="!showEventsAsTables"><i class="fa fa-bars vertical-center"></i></span><span ng-if="showEventsAsTables"><i class="fa fa-square vertical-center"></i></span></a>
                 <a class="small-horizonal-spacing" href ng-click="expandCollapse(dataentryWidget)">

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html	2016-03-01 16:47:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html	2016-03-02 14:10:42 +0000
@@ -1,9 +1,9 @@
 <div class="row">
-    <div class="col-sm-12" ng-if="allEventsSorted.length > eventPageSize && model.showEventSearch">
-        <input class="form-control" ng-model="model.eventSearchText"/>
+    <div class="col-sm-12" ng-if="model.showEventSearch">
+        <input class="form-control" placeholder="{{'type_your_search_criteria_here' | translate}}" ng-model="model.eventSearchText"/>
     </div>    
     <div ng-class="getTopLineColumnStyle(1)">
-        <div ng-if="!useMainMenu || (useMainMenu && !hideTopLineEventsForFormTypes[displayCustomForm])" ng-repeat="dhis2Event in getTopLineEventsPage() | filter:model.eventSearchText">            
+        <div ng-if="!useMainMenu || (useMainMenu && !hideTopLineEventsForFormTypes[displayCustomForm])" ng-repeat="dhis2Event in getTopLineEventsPage() | eventListFilter:allEventsSorted:model.eventSearchText">            
             <div class="event-container" ng-click="getEventPage('BACKWARD')" ng-if="$index === 0 && eventPagingStart > 0">
                 {{'previous'| translate}}
             </div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/filters.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/filters.js	2014-12-08 15:56:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/filters.js	2016-03-02 14:10:42 +0000
@@ -2,4 +2,22 @@
 
 /* Filters */
 
-var trackerCaptureFilters = angular.module('trackerCaptureFilters', []);
\ No newline at end of file
+var trackerCaptureFilters = angular.module('trackerCaptureFilters', [])
+
+.filter('eventListFilter', function($filter){    
+    
+    return function(pagedList, fullList, filterText){
+
+        if(!pagedList ){
+            return;
+        }
+        
+        if(!filterText){
+            return pagedList;
+        }        
+           
+        var filteredData = fullList;
+        filteredData = $filter('filter')(filteredData, filterText);
+        return filteredData;
+    }; 
+});
\ No newline at end of file