← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20246: event-capture: program rule error and warning actions complete. when action is error event regist...

 

------------------------------------------------------------
revno: 20246
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-21 10:48:11 +0200
message:
  event-capture: program rule error and warning actions complete. when action is error event registration/editing is blocked. for warning actions a message is simply displayed in a div
added:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.html
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html
  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/styles/style.css
  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/ec-custom-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.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-event-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties	2015-09-18 14:40:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties	2015-09-21 08:48:11 +0000
@@ -140,7 +140,7 @@
 loading_tree=Loading orgunit tree
 loading_metadata=Loading meta-data
 future_date_not_allowed=Future date is not allowed
-warning=Warning
+warnings=Warnings
 unsaved_data_exists_proceed=Unsaved data exists. Do you want to proceed?
 proceed=Proceed
 lacking_required_authority_to_add_update_event=Lacking required authority to add/update event.

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html	2015-09-17 11:21:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html	2015-09-21 08:48:11 +0000
@@ -1,5 +1,6 @@
 <!DOCTYPE html>
-<html manifest="cacheManifest.action" ng-app="eventCapture">
+<html ng-app="eventCapture">
+<!--<html manifest="cacheManifest.action" ng-app="eventCapture">-->
     <head>
         <title>Event Capture</title>
 
@@ -62,7 +63,7 @@
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
-        <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>
+        <!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>-->
         <script type="text/javascript" src="../dhis-web-commons/ouwt/ouwt.js"></script>
         <script type="text/javascript" src="scripts/event-capture.js"></script>
         

=== 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-18 14:40:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-09-21 08:48:11 +0000
@@ -885,9 +885,10 @@
         $scope.infiniteScroll.currentOptions += $scope.infiniteScroll.optionsToAdd;
     };
     
-    //listen for rule effect changes
-    $scope.warningMessages = [];
+    //listen for rule effect changes    
     $scope.$on('ruleeffectsupdated', function(event, args) {
+        $scope.warningMessages = [];
+        //console.log('args.event:  ', $rootScope.ruleeffects['SINGLE_EVENT'][0]);
         if($rootScope.ruleeffects[args.event]) {
             //Establish which event was affected:
             var affectedEvent = $scope.currentEvent;
@@ -899,7 +900,8 @@
                     }
                 });
             }
-            angular.forEach($rootScope.ruleeffects[args.event], function(effect) {                
+            angular.forEach($rootScope.ruleeffects[args.event], function(effect) {
+                
                 if( effect.dataElement && effect.ineffect ) {
                     //in the data entry controller we only care about the "hidefield" actions
                     if(effect.action === "HIDEFIELD") {
@@ -925,6 +927,9 @@
                             $log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
                         }
                     }
+                    if(effect.action === "HIDESECTION") {
+                        //get section id
+                    }
                     if(effect.action === "SHOWERROR" && effect.dataElement.id){
                         var dialogOptions = {
                             headerText: 'validation_error',
@@ -935,12 +940,7 @@
                         $scope.currentEvent[effect.dataElement.id] = $scope.currentEventOriginialValue[effect.dataElement.id];
                     }
                     if(effect.action === "SHOWWARNING"){
-                        $scope.warningMessages[effect.dataElement.id] = effect.content + '<br>';
-                        var dialogOptions = {
-                            headerText: 'validation_warning',
-                            bodyText: effect.content
-                        };
-                        DialogService.showDialog({}, dialogOptions);
+                        $scope.warningMessages.push(effect.content);
                     }
                 }
             });
@@ -953,9 +953,7 @@
         $scope.eventsByStage[$scope.selectedProgramStage.id] = [$scope.currentEvent];
         var evs = {all: [$scope.currentEvent], byStage: $scope.eventsByStage};
         
-        var flag = {debug: true, verbose: false};
-        
-        //TrackerRulesExecutionService.executeRules($scope.selectedProgram.id,$scope.currentEvent,$scope.eventsByStage,$scope.prStDes,null,false);
+        var flag = {debug: true, verbose: false};        
         TrackerRulesExecutionService.executeRules($scope.allProgramRules, $scope.currentEvent, evs, $scope.prStDes, $scope.selectedTei, $scope.selectedEnrollment, flag);
     };
        

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2015-09-18 14:40:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2015-09-21 08:48:11 +0000
@@ -362,4 +362,9 @@
 .form-control{
     color: black;
     padding: 5px !important;
+}
+
+.form-control-label {
+    height: 34px;
+    font-size: 14px;
 }
\ No newline at end of file

=== 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-18 14:40:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2015-09-21 08:48:11 +0000
@@ -249,7 +249,6 @@
     </table>    
 </div>
 
-
 <div ng-if='selectedProgramStage.programStageSections.length'>
     <table class="dhis2-list-table-striped">        
         <tbody>
@@ -507,6 +506,9 @@
                             </div>                        
                             <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
                             </div>
+                            <div ng-if="warningMessages[de.dataElement.id]">
+                                {{warningMessages[de.dataElement.id]}}
+                            </div>
                         </ng-form>
                     </td>
                 </tr>
@@ -516,6 +518,6 @@
 
 </div>
 
-<div ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0" ng-include="'views/indicators-section.html'"></div>
-<div ng-include="'views/comments-section.html'"></div>
-<div ng-include="'views/buttons-section.html'"></div>
\ No newline at end of file
+
+<!--<div ng-include="'views/comments-section.html'"></div>
+<div ng-include="'views/buttons-section.html'"></div>-->
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html	2015-07-02 07:19:49 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html	2015-09-21 08:48:11 +0000
@@ -58,7 +58,4 @@
         </td>                                                            
     </tr>
 </table>
-<div ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
-<div ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0" ng-include="'views/indicators-section.html'"></div>
-<div ng-include="'views/comments-section.html'" style="width: 50%;"></div>
-<div ng-include="'views/buttons-section.html'"></div>
\ No newline at end of file
+<div ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
\ No newline at end of file

=== 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-17 11:21:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2015-09-21 08:48:11 +0000
@@ -98,13 +98,15 @@
                     <span ng-if="editingEventInFull">{{'event_details'| translate}}</span>                       
                     <span ng-if="eventRegistration">{{'new_event'| translate}}</span>                            
                 </h3>
-                <div class="bordered-div" ng-if="displayCustomForm">
-                    <!--<div ng-if="programIndicators.length > 0" ng-include="'views/indicators.html'"></div>-->
-                    <div ng-include="'views/ec-custom-form.html'"></div>  
+                <div class="bordered-div col-sm-8">
+                    <div ng-if="displayCustomForm" ng-include="'views/ec-custom-form.html'"></div>  
+                    <div ng-if="!displayCustomForm" ng-include="'views/defaultForm.html'"></div>
+                    <div ng-include="'views/comments-section.html'"></div>
+                    <div ng-include="'views/buttons-section.html'"></div>
                 </div>
-                <div class="bordered-div container-default-form" ng-if="!displayCustomForm">
-                    <!--<div ng-if="programIndicators.length > 0" ng-include="'views/indicators.html'"></div>-->
-                    <div ng-include="'views/defaultForm.html'"></div>                
+                <div class="bordered-div col-sm-4"ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0">
+                    <div ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0" ng-include="'views/indicators.html'"></div>
+                    <div ng-if="warningMessages.length > 0" ng-include="'views/warnings.html'"></div>
                 </div>
             </div>
         </form>

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators.html	2015-09-21 08:48:11 +0000
@@ -0,0 +1,13 @@
+<div class="section-label">
+    {{'indicators' | translate}}
+</div>
+<table class="dhis2-list-table-striped">
+    <tr ng-repeat="pid in allProgramRules.programIndicators.rules">
+        <td>
+            {{pid.name}}
+        </td>
+        <td>
+            <input type="text" class="form-control" value={{formatNumberResult(ruleeffects[currentEvent.event][pid.id].data)}} ng-disabled="true">
+        </td>
+    </tr>
+</table>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.html	2015-09-21 08:48:11 +0000
@@ -0,0 +1,10 @@
+<div class="section-label">
+    {{'warnings' | translate}}
+</div>
+<table class="dhis2-list-table-striped">
+    <tr ng-repeat="msg in warningMessages">
+        <td class="form-control-label">
+            {{msg}}
+        </td>
+    </tr>
+</table>
\ No newline at end of file