← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20307: tracker-capture: hide program stage section based on program rule action

 

------------------------------------------------------------
revno: 20307
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-23 11:40:16 +0200
message:
  tracker-capture: hide program stage section based on program rule action
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.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-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-09-22 16:33:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-09-23 09:40:16 +0000
@@ -39,6 +39,7 @@
     $scope.hiddenFields = {};
     $scope.errorMessages = {};
     $scope.warningMessages = {};
+    $scope.hiddenSections = {};
     $scope.tableMaxNumberOfDataElements = 10;
     
     //Labels
@@ -135,7 +136,19 @@
                     else {
                         $log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
                     }
+                } else if (effect.action === "HIDESECTION"){                    
+                    if(effect.programStageSection){
+                        if(effect.ineffect){
+                            $scope.hiddenSections[effect.programStageSection] = true;
+                        } else{
+                            $scope.hiddenSections[effect.programStageSection] = false;
+                        }
+                    }
+                    else {
+                        $log.warn("ProgramRuleAction " + effect.id + " is of type HIDESECTION, bot does not have a section defined");
+                    }
                 }
+                
             }
         });
     };
@@ -1172,8 +1185,6 @@
                 DialogService.showDialog({}, dialogOptions);
             }
         });
-
-
     };
 
     //If the caller wants to create right away, go ahead and save.

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-09-22 16:33:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-09-23 09:40:16 +0000
@@ -218,7 +218,7 @@
     <div ng-if='currentEvent && currentStage.programStageSections.length'>
         <accordion close-others='false'>
             <!-- The inline style was needed to override overflow:hidden in the css. Can possibly be replaced with a CSS update. --> 
-            <accordion-group heading="{{section.name}}" is-open="section.open" ng-repeat='section in currentStage.programStageSections' style="overflow:visible">
+            <accordion-group heading="{{section.name}}" is-open="section.open" ng-repeat='section in currentStage.programStageSections' ng-if="!hiddenSections[section.id]" style="overflow:visible">
                 <table class="dhis2-list-table-striped">                    
                     <thead>
                         <tr>