← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14749: tracked entity UI with option for advanced search

 

------------------------------------------------------------
revno: 14749
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2014-04-08 17:37:00 +0200
message:
  tracked entity UI with option for advanced search
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html
  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/styles/style.css
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.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/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-04-07 11:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-04-08 15:37:00 +0000
@@ -58,5 +58,7 @@
     "scheduling": "Scheduling",
     "enroll": "Enroll",
     "like": "LIKE",
-    "not_like": "NOT LIKE"
+    "not_like": "NOT LIKE",
+    "move_to_selected": "Move to selected",
+    "move_all_to_selected": "Move all to selected"
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html	2014-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html	2014-04-08 15:37:00 +0000
@@ -75,6 +75,6 @@
             <div id="headerMessage" class="bold"></div>        
         </div>
         
-        <div data-ng-view=''></div>    
+        <div class="container-1" data-ng-view=''></div>    
     </body>
 </html>
\ No newline at end of file

=== 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-04-08 14:12:56 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-04-08 15:37:00 +0000
@@ -5,7 +5,8 @@
 
 //Controller for settings page
 .controller('SelectionController',
-        function($scope,
+        function($rootScope,
+                $scope,
                 $location,
                 Paginator,
                 TranslationService, 
@@ -83,7 +84,7 @@
     
     $scope.hideSearch = function(){        
         $scope.showSearchDiv = false;
-        $scope.showAdvancedSearchDiv = false;
+        $rootScope.showAdvancedSearchDiv = false;
     };
     
     $scope.closeSearch = function(){
@@ -134,7 +135,8 @@
 
 //Controller for the search section
 .controller('SearchController',
-        function($scope,                
+        function($rootScope,
+                $scope,                
                 storage,
                 TranslationService) {
 
@@ -144,7 +146,8 @@
     $scope.attributes = storage.get('ATTRIBUTES');     
     $scope.availableAttributes = [];
     $scope.selectedAttributes = [];
-    $scope.showAdvancedSearchDiv = false;
+    $rootScope.showAdvancedSearchDiv = false;
+    $scope.ouMode = 'SELECTED';
     
     angular.forEach($scope.attributes, function(attribute){
         $scope.availableAttributes.push(attribute);
@@ -241,8 +244,7 @@
         
         var index = attribute.filters.indexOf(filter);        
         attribute.filters.splice(index, 1);
-        
-        console.log();
+
         if(attribute.filters.length === 0 || angular.isUndefined(attribute.filters.length)){
             index = $scope.selectedAttributes.indexOf(attribute);
             $scope.selectedAttributes.splice(index, 1);
@@ -252,21 +254,26 @@
     };
     
     $scope.showAdvancedSearch = function(){        
-        $scope.showAdvancedSearchDiv = !$scope.showAdvancedSearchDiv;
+        $rootScope.showAdvancedSearchDiv = !$rootScope.showAdvancedSearchDiv;
     };
     
     $scope.hideAdvancedSearch = function(){        
-        $scope.showAdvancedSearchDiv = false;
+        $rootScope.showAdvancedSearchDiv = false;
     };
     
     $scope.closeAdvancedSearch = function(){
-        $scope.showAdvancedSearchDiv = !$scope.showAdvancedSearchDiv;
+        $rootScope.showAdvancedSearchDiv = !$rootScope.showAdvancedSearchDiv;
     }; 
     
     $scope.search = function(){
         console.log($scope.attributes);
+        console.log($scope.ouMode);
     };
     
+    $scope.test = function(){
+        console.log('the mode is:  ', $scope.ouMode);
+    };                
+    
 })
 
 //Controller for dashboard

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-04-07 11:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-04-08 15:37:00 +0000
@@ -509,7 +509,8 @@
 
 .container-1 {
     height: 100%; 
-    min-height: 100%;     
+    width: 100%;
+    overflow:auto; 
 }
 
 .container-1-1 {

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html	2014-04-07 11:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html	2014-04-08 15:37:00 +0000
@@ -8,173 +8,184 @@
         </span>
     </div>
     <div class="vertial-spacing">
-        <div ng-switch="showAdvancedSearchDiv">
-            <div ng-switch-when=true>
-                <div class="panel panel-default">
-                    <div class="panel-heading">
-                        {{'available_search_attributes'| translate}} |
-                        <span ng-show="availableAttributes.length > 0">                                        
-                            <a href ng-click="moveToSelected(selectedAttribute, true)" title="{{'move_to_selected'| translate}}"><i class="fa fa-angle-down"></i></a>                                        
-                            <a href ng-click="moveAllToSelected()" title="{{'move_all_to_selected'| translate}}"><i class="fa fa-angle-double-down"></i></a>                                        
-                        </span>                        
-                    </div>                                
-                    <select class="form-control" multiple ng-model="selectedAttribute" ng-options="attribute as attribute.name for attribute in availableAttributes | orderBy:'name'" ng-dblclick="moveToSelected(selectedAttribute, true)">                                        
-                    </select>
-                </div>
-                <div class="panel panel-default">
-                    <div class="panel-heading">
-                        {{'selected_search_attributes'| translate}}                                   
-                    </div>
-                    <div class="selected-data-item-list">
-                        <div class="selected-data-item" ng-show="selectedAttributes.length > 0" ng-repeat="attribute in selectedAttributes">
-                            <div class="filter-name">
-                                {{attribute.name}}                                         
-                            </div>
-                            <div>
-                                <div ng-switch="attribute.valueType">
-                                    <div ng-switch-when="number">
-                                        <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
-                                            <div class="filter-operand">
-                                                <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
-                                                </select>
-                                            </div>
-                                            <div class="filter-value">
-                                                <input type="number" ng-model="filter.value" class="input-field">
-                                            </div>
-                                            <div class="filter-add">
-                                                <a href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
-                                            </div>
-                                            <div class="filter-remove">
-                                                <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
-                                            </div>
-                                        </div>                        
-                                    </div>
-                                    <div ng-switch-when="combo">
-                                        <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
-                                            <div class="filter-operand">
-                                                <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
-                                                </select>
-                                            </div>
-                                            <div class="filter-value">
-                                                <select ng-model="filter.value" class="input-field" ng-options="value for value in filter.values">
-                                                </select>                                                            
-                                            </div>
-                                            <div class="filter-add">
-                                                <a ng-show="attribute.filters.length < filter.values.length" href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
-                                            </div>
-                                            <div class="filter-remove">
-                                                <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
-                                            </div>
-                                        </div>
-                                    </div>
-                                    <div ng-switch-when="bool">
-                                        <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
-                                            <div class="filter-operand">
-                                                <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
-                                                </select>
-                                            </div>
-                                            <div class="filter-value">
-                                                <select ng-model="filter.value" class="input-field" ng-options="value for value in filter.values">
-                                                </select>                                                            
-                                            </div>
-                                            <div class="filter-add">
-                                                <a ng-show="attribute.filters.length < filter.values.length" href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
-                                            </div>
-                                            <div class="filter-remove">
-                                                <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
-                                            </div>
-                                        </div>
-                                    </div>
-                                    <div ng-switch-when="date">
-                                        <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
-                                            <div class="filter-operand">
-                                                <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
-                                                </select>
-                                            </div>
-                                            <div class="filter-value">
-                                                <input type="text" ng-date ng-model="filter.value" class="input-field">
-                                            </div>
-                                            <div class="filter-add">
-                                                <a href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
-                                            </div>
-                                            <div class="filter-remove">
-                                                <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
-                                            </div>
-                                        </div>
-                                    </div>
-                                    <div ng-switch-default>
-                                        <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
-                                            <div class="filter-operand">
-                                                <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
-                                                </select>
-                                            </div>
-                                            <div class="filter-value">
-                                                <input type="text" ng-model="filter.value" class="input-field">
-                                            </div>
-                                            <div class="filter-add">
-                                                <a href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
-                                            </div>
-                                            <div class="filter-remove">
-                                                <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
-                                            </div>
-                                        </div> 
-                                    </div>
-                                </div>
-                            </div>
-                            <div class="clearfix"></div>
+
+        <div ng-if="showAdvancedSearchDiv">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    {{'org_unit_mode'| translate}}
+                </div>
+                <div class="panel-body">
+                    <input type='radio' ng-model='ouMode' value='SELECTED'>{{'use_selected'| translate}}<br/>
+                    <input type='radio' ng-model='ouMode' value='CHILDREN'>{{'use_immediate_children'| translate}}<br/>
+                    <input type='radio' ng-model='ouMode' value='DESCENDANTS'>{{'use_all_children'| translate}}
+                </div>
+            </div>
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    {{'available_search_attributes'| translate}} |
+                    <span ng-show="availableAttributes.length > 0">                                        
+                        <a href ng-click="moveToSelected(selectedAttribute, true)" title="{{'move_to_selected'| translate}}"><span class="black"><i class="fa fa-angle-down"></i></span></a>                                        
+                        <a href ng-click="moveAllToSelected()" title="{{'move_all_to_selected'| translate}}"><span class="black"><i class="fa fa-angle-double-down"></i></span></a>                                        
+                    </span>                        
+                </div>                                
+                <select class="form-control" multiple ng-model="selectedAttribute" ng-options="attribute as attribute.name for attribute in availableAttributes | orderBy:'name'" ng-dblclick="moveToSelected(selectedAttribute, true)">                                        
+                </select>
+            </div>
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    {{'selected_search_attributes'| translate}}                                   
+                </div>
+                <div class="selected-data-item-list">
+                    <div class="selected-data-item" ng-show="selectedAttributes.length > 0" ng-repeat="attribute in selectedAttributes">
+                        <div class="filter-name">
+                            {{attribute.name}}                                         
                         </div>
-                    </div>
-                </div>
-            </div>
-            <div ng-switch-when="false">
-                <table class="dhis2-list-table-striped dhis2-table-hover">
-                    <tr ng-repeat="attribute in attributes">
-                        <td>
-                            {{attribute.name}}
-                        </td>
-                        <td>
+                        <div>
                             <div ng-switch="attribute.valueType">
+                                <div ng-switch-when="number">
+                                    <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
+                                        <div class="filter-operand">
+                                            <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
+                                            </select>
+                                        </div>
+                                        <div class="filter-value">
+                                            <input type="number" ng-model="filter.value" class="input-field">
+                                        </div>
+                                        <div class="filter-add">
+                                            <a href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
+                                        </div>
+                                        <div class="filter-remove">
+                                            <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
+                                        </div>
+                                    </div>                        
+                                </div>
+                                <div ng-switch-when="combo">
+                                    <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
+                                        <div class="filter-operand">
+                                            <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
+                                            </select>
+                                        </div>
+                                        <div class="filter-value">
+                                            <select ng-model="filter.value" class="input-field" ng-options="value for value in filter.values">
+                                            </select>                                                            
+                                        </div>
+                                        <div class="filter-add">
+                                            <a ng-show="attribute.filters.length < filter.values.length" href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
+                                        </div>
+                                        <div class="filter-remove">
+                                            <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div ng-switch-when="bool">
+                                    <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
+                                        <div class="filter-operand">
+                                            <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
+                                            </select>
+                                        </div>
+                                        <div class="filter-value">
+                                            <select ng-model="filter.value" class="input-field" ng-options="value for value in filter.values">
+                                            </select>                                                            
+                                        </div>
+                                        <div class="filter-add">
+                                            <a ng-show="attribute.filters.length < filter.values.length" href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
+                                        </div>
+                                        <div class="filter-remove">
+                                            <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
+                                        </div>
+                                    </div>
+                                </div>
                                 <div ng-switch-when="date">
-                                    <input type="text" class="form-control" ng-date ng-model="attribute.value" />
-                                </div>
-                                <div ng-switch-when="trueOnly">
-                                    <input type="checkbox" class="form-control" ng-model="attribute.value" />
-                                </div>
-                                <div ng-switch-when="bool">
-                                    <select ng-model="attribute.value" class="form-control">
-                                        <option value="">{{'please_select'| translate}}</option>                        
-                                        <option value="0">{{'no'| translate}}</option>
-                                        <option value="1">{{'yes'| translate}}</option>
-                                    </select>
-                                </div>
-                                <div ng-switch-when="combo">
-                                    <input type="text" 
-                                           class="form-control"
-                                           ng-model="attribute.value"                                                 
-                                           typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
-                                           typeahead-open-on-focus 
-                                           />
-                                </div>
-                                <div ng-switch-when="number">
-                                    <input type="number" class="form-control" ng-model="attribute.value"/>
+                                    <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
+                                        <div class="filter-operand">
+                                            <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
+                                            </select>
+                                        </div>
+                                        <div class="filter-value">
+                                            <input type="text" ng-date ng-model="filter.value" class="input-field">
+                                        </div>
+                                        <div class="filter-add">
+                                            <a href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
+                                        </div>
+                                        <div class="filter-remove">
+                                            <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
+                                        </div>
+                                    </div>
                                 </div>
                                 <div ng-switch-default>
-                                    <input type="text" class="form-control" ng-model="attribute.value" />                                        
+                                    <div class="dataelement-filter" ng-repeat="filter in attribute.filters">
+                                        <div class="filter-operand">
+                                            <select ng-model="filter.operand" class="input-field" ng-options="operand for operand in filter.operands">
+                                            </select>
+                                        </div>
+                                        <div class="filter-value">
+                                            <input type="text" ng-model="filter.value" class="input-field">
+                                        </div>
+                                        <div class="filter-add">
+                                            <a href ng-click="addFilter(attribute)" title="{{'add_new_filter'| translate}}"><span class="black"><i class="fa fa-plus"></i></span></a> 
+                                        </div>
+                                        <div class="filter-remove">
+                                            <a href ng-click="removeFilter(filter, attribute)" title="{{'remove_filter'| translate}}"><span class="black"><i class="fa fa-trash-o"></i></span></a>
+                                        </div>
+                                    </div> 
                                 </div>
-                            </div>                                                                                                    
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{{'org_unit_mode'| translate}}</td>
-                        <td>
-                            <input type='radio' ng-model='ouMode' value='SELECTED'>{{'use_selected'| translate}}<br/>
-                            <input type='radio' ng-model='ouMode' value='CHILDREN'>{{'use_immediate_children'| translate}}<br/>
-                            <input type='radio' ng-model='ouMode' value='DESCENDANTS'>{{'use_all_children'| translate}}
-                        </td>
-                    </tr>        
-                </table>
-            </div>
-        </div>
+                            </div>
+                        </div>
+                        <div class="clearfix"></div>
+                    </div>
+                </div>
+            </div>                
+        </div>
+
+        <div ng-if="!showAdvancedSearchDiv">
+            <table class="dhis2-list-table-striped dhis2-table-hover">
+                <tr ng-repeat="attribute in attributes">
+                    <td>
+                        {{attribute.name}}
+                    </td>
+                    <td>
+                        <div ng-switch="attribute.valueType">
+                            <div ng-switch-when="date">
+                                <input type="text" class="form-control" ng-date ng-model="attribute.value" />
+                            </div>
+                            <div ng-switch-when="trueOnly">
+                                <input type="checkbox" class="form-control" ng-model="attribute.value" />
+                            </div>
+                            <div ng-switch-when="bool">
+                                <select ng-model="attribute.value" class="form-control">
+                                    <option value="">{{'please_select'| translate}}</option>                        
+                                    <option value="0">{{'no'| translate}}</option>
+                                    <option value="1">{{'yes'| translate}}</option>
+                                </select>
+                            </div>
+                            <div ng-switch-when="combo">
+                                <input type="text" 
+                                       class="form-control"
+                                       ng-model="attribute.value"                                                 
+                                       typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
+                                       typeahead-open-on-focus 
+                                       />
+                            </div>
+                            <div ng-switch-when="number">
+                                <input type="number" class="form-control" ng-model="attribute.value"/>
+                            </div>
+                            <div ng-switch-default>
+                                <input type="text" class="form-control" ng-model="attribute.value" />                                        
+                            </div>
+                        </div>                                                                                                    
+                    </td>
+                </tr>
+                <tr>
+                    <td>{{'org_unit_mode'| translate}}</td>
+                    <td>
+                        <input type='radio' ng-model='ouMode' value='SELECTED'>{{'use_selected'| translate}}<br/>
+                        <input type='radio' ng-model='ouMode' value='CHILDREN'>{{'use_immediate_children'| translate}}<br/>
+                        <input type='radio' ng-model='ouMode' value='DESCENDANTS'>{{'use_all_children'| translate}}
+                    </td>
+                </tr>        
+            </table>
+        </div>
+
     </div>
 
     <button type="button" class="btn big-button" title="{{'search'| translate}}" ng-click="search()">