← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19851: tracker-capture: UI to set tei to active/inactive

 

------------------------------------------------------------
revno: 19851
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-26 00:19:06 +0200
message:
  tracker-capture: UI to set tei to active/inactive
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties


--
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/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-08-09 22:28:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-08-25 22:19:06 +0000
@@ -22,6 +22,7 @@
                 DialogService,
                 AttributesFactory,
                 CurrentSelection,
+                ModalService,
                 AuthorityService) {
     //selections
     $scope.selectedTeiId = ($location.search()).tei; 
@@ -318,10 +319,16 @@
         getDashboardLayout();
     };
     
-    $scope.broadCastSelections = function(){
+    $scope.broadCastSelections = function(tei){
         
         var selections = CurrentSelection.get();
-        $scope.selectedTei = selections.tei;
+        if(tei){
+            $scope.selectedTei = tei;
+        }
+        else{
+            $scope.selectedTei = selections.tei;
+        }
+        
         $scope.trackedEntity = selections.te;
         $scope.optionSets = selections.optionSets;
         
@@ -331,6 +338,25 @@
         }, 100);
     };     
     
+    $scope.activiateTEI = function(){
+        var st = !$scope.selectedTei.inactive || $scope.selectedTei.inactive === '' ? true : false;
+        
+        var modalOptions = {
+            closeButtonText: 'no',
+            actionButtonText: 'yes',
+            headerText: st ? 'deactivate_tei' : 'activate_tei',
+            bodyText: 'are_you_sure_to_proceed'
+        };
+
+        ModalService.showModal({}, modalOptions).then(function (result) {
+
+            $scope.selectedTei.inactive = st;
+            TEIService.update($scope.selectedTei, $scope.optionSets, $scope.attributesById).then(function (data) {
+                $scope.broadCastSelections($scope.selectedTei);                
+            });
+        }, function(){            
+        });
+    };
     $scope.back = function(){
         $location.path('/').search({program: $scope.selectedProgramId});                   
     };

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2015-08-07 10:38:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2015-08-25 22:19:06 +0000
@@ -22,7 +22,8 @@
                 </button>
                 <ul class="dropdown-menu pull-right" role="menu">
                     <li><a href ng-click="showHideWidgets()">{{'show_hide_widgets'| translate}}</a></li>
-                    <li ng-if="userAuthority.canAdministerDashboard"><a href ng-click="saveDashboarLayoutAsDefault()">{{'save_layout_as_default'| translate}}</a></li>                    
+                    <li ng-if="userAuthority.canAdministerDashboard"><a href ng-click="saveDashboarLayoutAsDefault()">{{'save_layout_as_default'| translate}}</a></li>
+                    <li><a href ng-click="activiateTEI()">{{selectedTei.inactive ? 'activate_tei' : 'deactivate_tei' | translate}}</a></li>
                 </ul>
             </div>
         </div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-08-24 09:55:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-08-25 22:19:06 +0000
@@ -294,6 +294,7 @@
 are_you_sure_to_skip_event=Are you sure you want to skip the selected event?
 are_you_sure_to_unskip_event=Are you sure you want to schedule back the selected event?
 do_you_want_to_proceed=Do you want to proceed with invalid criteria?
+are_you_sure_to_proceed=Are you sure to proceed?
 more=More
 under_construction=Under construction.    
 advanced_search=Advanced search
@@ -349,4 +350,7 @@
 but_found=but found
 equals_to=equals to
 less_than=less than
-greater_than=greater than
\ No newline at end of file
+greater_than=greater than
+inactive=Inactive
+activate_tei=Set TEI to active
+deactivate_tei=Set TEI to inactive
\ No newline at end of file