← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15234: UI for tracked entity instance registration

 

------------------------------------------------------------
revno: 15234
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Mon 2014-05-12 17:31:40 +0200
message:
  UI for tracked entity instance registration
added:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/registration.html
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/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/home.html
  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-05-12 14:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-05-12 15:31:40 +0000
@@ -62,7 +62,10 @@
     "not_like": "NOT LIKE",
     "move_to_selected": "Move to selected",
     "move_all_to_selected": "Move all to selected",
-    "more": "More",    
+    "save_and_add_new": "Save and add new",
+    "save_and_go_back": "Save and go back",
+    "go_back": "Go back",
+    "more": "More",
     "profile": "Profile",
     "applications": "Apps",
     "more_applications": "More apps",

=== 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-05-12 14:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-05-12 15:31:40 +0000
@@ -29,11 +29,17 @@
     $scope.rowsPerPage = 50;
     $scope.currentPage = Paginator.getPage() + 1;   
     
+    //EntityList
+    $scope.showTrackedEntityDiv = false;
+    
     //Searching
     $scope.showSearchDiv = false;
     $scope.searchField = {title: 'search', isOpen: false};  
     $scope.attributes = [];
     
+    //Registration
+    $scope.showRegistrationDiv = false;
+    
     //watch for selection of org unit from tree
     $scope.$watch('selectedOrgUnit', function() {
         
@@ -85,7 +91,10 @@
     //get events for the selected program (and org unit)
     $scope.loadTrackedEntities = function(){
         
+        $scope.showTrackedEntityDiv = !$scope.showTrackedEntityDiv;
+        
         $scope.showSearchDiv = false;
+        $scope.showRegistrationDiv = false;        
         
         $scope.trackedEntityList = null;
         
@@ -111,11 +120,15 @@
     };
     
     $scope.showRegistration = function(){
-        
+        $scope.showRegistrationDiv = !$scope.showRegistrationDiv;
+        $scope.showTrackedEntityDiv = false;
+        $scope.showSearchDiv = false;
     };  
     
     $scope.showSearch = function(){        
         $scope.showSearchDiv = !$scope.showSearchDiv;
+        $scope.showRegistrationDiv = false;
+        $scope.showTrackedEntityDiv = false;       
     };
     
     $scope.hideSearch = function(){        
@@ -314,10 +327,29 @@
     
     $scope.test = function(){
         console.log('the mode is:  ', $scope.ouMode);
-    };                
-    
+    };   
 })
 
+.controller('RegistrationController', 
+        function($scope,
+                AttributesFactory,
+                TranslationService) {
+    
+    //do translation of the registration page
+    TranslationService.translate();   
+    
+    $scope.attributes = AttributesFactory.getAll();
+    
+    $scope.getProgramAttributes = function(program){        
+        if(program){
+            $scope.attributes = AttributesFactory.getByProgram(program);
+        }
+        else{
+            $scope.attributes = AttributesFactory.getAll();
+        }
+    };
+    
+})
 //Controller for dashboard
 .controller('DashboardController',
         function($rootScope,

=== 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-05-12 14:26:25 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-05-12 15:31:40 +0000
@@ -370,6 +370,7 @@
     border: 1px solid #c2c2c2;
     border-radius: 5px;
     padding: 5px 10px;
+    margin-top: 20px;
     margin-bottom: 20px;
 }
 
@@ -563,6 +564,11 @@
     margin-bottom: 20px;
 }
 
+.registration-container{
+    margin-top: 20px;
+    margin-bottom: 10px;
+}
+
 /*----------------------------------------------------------------------------*/
 /* Bootstrap modal style
 /*----------------------------------------------------------------------------*/

=== 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-05-08 09:34:02 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-05-12 15:31:40 +0000
@@ -22,26 +22,48 @@
     <div class="row">
         <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
         <div class="input-group col-md-6">
-            <input type="text" class="form-control" ng-focus="hideSearch()">
+            <input type="text" class="form-control" ng-focus="hideSearch()" ng-disabled="showRegistrationDiv">
             <span class="input-group-btn">
-                <button class="btn btn-default" type="button" title="{{'more' | translate}}" ng-click="showSearch()"><i class="fa fa-caret-down"></i></button>
+                <button class="btn btn-default" type="button" title="{{'more' | translate}}" ng-click="showSearch()" ng-disabled="showRegistrationDiv"><i class="fa fa-caret-down"></i></button>
             </span>                
         </div>
         <div class="btn-group col-md-6">
-            <button type="button" class="btn btn-default">{{'search'| translate}}</button>
-            <button type="button" class="btn btn-default" ng-click="loadTrackedEntities()">{{'list_all_entities'| translate}}</button>
-            <button type="button" class="btn btn-default" ng-click="showRegisteration()">{{'add_new'| translate}}</button>
+            <button type="button" 
+                    class="btn btn-default"
+                    ng-disabled="showRegistrationDiv">
+                {{'search'| translate}}
+            </button>
+            <button type="button" 
+                    class="btn btn-default" 
+                    ng-click="loadTrackedEntities()">
+                {{'list_all_entities'| translate}}
+            </button>
+            <button type="button" 
+                    class="btn btn-default" 
+                    ng-click="showRegistration()">
+                {{'add_new'| translate}}
+            </button>
         </div>
     </div>
-    <div class="row" ng-show="showSearchDiv">
+    
+    <!-- search begins -->
+    <div class="row" ng-if="showSearchDiv">
         <div class="col-md-6">
             <div ng-include="'views/search.html'" ng-controller='SearchController'></div>             
         </div>
     </div>
-
-
+    <!-- search ends -->
+    
+    <!--registration begins -->
+    <div class="row" ng-if="showRegistrationDiv">
+        <div class="col-md-6">
+            <div ng-include="'views/registration.html'" ng-controller='RegistrationController'></div>             
+        </div>
+    </div>
+    <!-- registration ends -->
+    
     <!-- entity grid begins -->
-    <div ng-show="trackedEntityList">
+    <div ng-if="showTrackedEntityDiv">
         <div id="listDiv" ng-switch="trackedEntityList">                    
             <div ng-switch-when=""></div>
             <div ng-switch-default>

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/registration.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/registration.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/registration.html	2014-05-12 15:31:40 +0000
@@ -0,0 +1,63 @@
+<div class="bordered-div col-md-12">
+    <div class="registration-container">
+        <form name="outerForm" novalidate>
+
+            <table class="dhis2-list-table-striped dhis2-table-hover">
+                <tr>
+                    <td>
+                        {{'program'| translate}}
+                    </td>
+                    <td>
+                        <select class="form-control" ng-model="pr" ng-change="getProgramAttributes(pr)" ng-options="program as program.name for program in programs | orderBy: 'name'">
+                            <option value="">{{'please_select'| translate}}</option>
+                        </select>
+                    </td>
+                </tr>      
+
+                <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>                        
+            </table>
+
+            <div class="btn-group">
+                <button type="button" class="btn btn-default">{{'save_and_add_new'| translate}}</button>
+                <button type="button" class="btn btn-default" ng-click="loadTrackedEntities()">{{'save_and_go_back'| translate}}</button>
+                <button type="button" class="btn btn-default" ng-click="showRegistration()">{{'go_back'| translate}}</button>
+            </div>
+
+        </form>
+    </div>
+</div>
\ No newline at end of file

=== 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-05-12 14:26:25 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html	2014-05-12 15:31:40 +0000
@@ -163,7 +163,6 @@
                 <tr>
                     <td>
                         {{'program'| translate}}
-                        {{attributes.size}}
                     </td>
                     <td>
                         <select class="form-control" ng-model="pr" ng-change="getProgramAttributes(pr)" ng-options="program as program.name for program in programs | orderBy: 'name'">