← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16388: minor

 

------------------------------------------------------------
revno: 16388
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-08-12 12:54:04 +0200
message:
  minor
modified:
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.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-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-08-01 12:22:15 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-08-12 10:54:04 +0000
@@ -159,7 +159,7 @@
                     </table>
                 </div>
                 <!-- selection ends -->
-
+                <div id="hideTypeAheadPopUp"ng-hide="true"></div>
                 <!-- event grid begins -->
                 <div ng-include="'views/eventList.html'"></div>
                 <!-- event grid ends -->
@@ -188,7 +188,7 @@
                                     <button ng-click="showEventList()" class="button not-printable">{{'go_back'| translate}}</button>
                                 </span>
                                 <span ng-if="eventRegistration">
-                                    <button ng-click="addEvent(true)" class="button not-printable">{{'save_and_add_new'| translate}}</button>
+                                    <button ng-disabled="disableSaveAndAddNew" ng-click="addEvent(true)" class="button not-printable">{{'save_and_add_new'| translate}}</button>
                                     <button ng-click="addEvent()" class="button not-printable">{{'save_and_back'| translate}}</button>
                                     <button ng-click="showEventList(null)" class="button not-printable">{{'go_back'| translate}}</button>
                                 </span> 

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-08-01 12:58:57 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-08-12 10:54:04 +0000
@@ -8,6 +8,7 @@
         function($scope,
                 $filter,
                 $modal,
+                $timeout,
                 storage,
                 Paginator,
                 TranslationService,                
@@ -373,7 +374,7 @@
         $scope.displayCustomForm = !$scope.displayCustomForm;
     };
     
-    $scope.addEvent = function(addingAnotherEvent){        
+    $scope.addEvent = function(addingAnotherEvent){                
         
         //check for form validity
         $scope.outerForm.submitted = true;        
@@ -381,6 +382,10 @@
             return false;
         }
         
+        if(addingAnotherEvent){
+            $scope.disableSaveAndAddNew = true;
+        }
+        
         //the form is valid, get the values
         var dataValues = [];        
         for(var dataElement in $scope.programStageDataElements){
@@ -437,12 +442,18 @@
                     $scope.eventRegistration = false;
                     $scope.editingEventInFull = false;
                     $scope.editingEventInGrid = false;  
-                    $scope.outerForm.submitted = false;
                 }
-                //reset form
+
+                //reset form                
                 $scope.currentEvent = angular.copy($scope.newDhis2Event); 
                 $scope.note = {};
                 $scope.outerForm.submitted = false;
+                $scope.disableSaveAndAddNew = false;
+                
+                //this is to hide typeAheadPopUps - shouldn't be an issue in the                
+                $timeout(function() {
+                    angular.element('#hideTypeAheadPopUp').trigger('click');
+                }, 10);
             }
         });
     };