← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 20272
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-21 18:09:31 +0200
message:
  event-capture: hide section based on program rule action
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-09-21 08:48:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-09-21 16:09:31 +0000
@@ -888,6 +888,7 @@
     //listen for rule effect changes    
     $scope.$on('ruleeffectsupdated', function(event, args) {
         $scope.warningMessages = [];
+        $scope.hiddenSections = [];
         //console.log('args.event:  ', $rootScope.ruleeffects['SINGLE_EVENT'][0]);
         if($rootScope.ruleeffects[args.event]) {
             //Establish which event was affected:
@@ -928,7 +929,9 @@
                         }
                     }
                     if(effect.action === "HIDESECTION") {
-                        //get section id
+                        if(effect.programStageSection){
+                            $scope.hiddenSections[effect.programStageSection] = effect.programStageSection;
+                        }
                     }
                     if(effect.action === "SHOWERROR" && effect.dataElement.id){
                         var dialogOptions = {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2015-09-21 15:21:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2015-09-21 16:09:31 +0000
@@ -313,7 +313,7 @@
         </tbody>
     </table>    
 
-    <div ng-repeat='section in selectedProgramStage.programStageSections' ng-if="section.id === selectedSection.id || selectedSection.id === 'ALL'">
+    <div ng-repeat='section in selectedProgramStage.programStageSections' ng-if="section.id === selectedSection.id || selectedSection.id === 'ALL' && !hiddenSections[section.id] ">
         <div class="vertical-spacing section-label">
            {{section.name}}
         </div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2015-09-21 08:48:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2015-09-21 16:09:31 +0000
@@ -62,7 +62,7 @@
                                 name="section"                             
                                 ng-model="selectedSection.id">
                             <option value="ALL">{{'show_all'| translate}}</option>
-                            <option ng-repeat="section in selectedProgramStage.programStageSections" value={{section.id}}>{{section.name}}</option>
+                            <option ng-if="!hiddenSections[section.id]" ng-repeat="section in selectedProgramStage.programStageSections" value={{section.id}}>{{section.name}}</option>
                         </select>
                     </div>
                 </div>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-09-21 15:21:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-09-21 16:09:31 +0000
@@ -1464,6 +1464,7 @@
                                     action:action.programRuleActionType,
                                     dataElement:action.dataElement,
                                     trackedEntityAttribute:action.trackedEntityAttribute,
+                                    programStageSection: action.programStageSection && action.programStageSection.id ? action.programStageSection.id : null,
                                     content:action.content,
                                     data:action.data,
                                     ineffect:undefined