← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21265: Added 'completed' checkbox to the form

 

------------------------------------------------------------
revno: 21265
committer: jijukjose <jijukjose@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-12-02 14:43:14 +0100
message:
  Added 'completed' checkbox to the form
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/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/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-12-01 14:01:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-12-02 13:43:14 +0000
@@ -60,6 +60,7 @@
     $scope.currentEvent = {};
     $scope.currentEventOriginialValue = {}; 
     $scope.displayCustomForm = false;
+            console.log("displayCustomForm set to false");
     $scope.currentElement = {id: '', update: false};
     $scope.optionSets = [];
     $scope.proceedSelection = true;
@@ -149,6 +150,7 @@
         $scope.updateSuccess = false;
         $scope.currentGridColumnId = '';           
         $scope.displayCustomForm = false;
+        console.log("displayCustomForm set to false");
         
         if (angular.isObject($scope.selectedOrgUnit)) {
             ProgramFactory.getProgramsByOu($scope.selectedOrgUnit, $scope.selectedProgram).then(function(response){
@@ -369,6 +371,12 @@
                             event['uid'] = event.event;                                
                             event.eventDate = DateUtils.formatFromApiToUser(event.eventDate);                                
                             event['eventDate'] = event.eventDate;
+                            if(event.status === "ACTIVE") {
+                                event.status = false;
+                            } else if(event.status === "COMPLETED") {
+                                event.status = true;
+                            }
+
 
                             delete event.dataValues;
                         }
@@ -520,7 +528,8 @@
     };
     
     $scope.showEventRegistration = function(){        
-        $scope.displayCustomForm = $scope.customForm ? true:false;        
+        $scope.displayCustomForm = $scope.customForm ? true:false;
+        console.log("displayCustomForm set to "+$scope.displayCustomForm);
         $scope.currentEvent = {};
         $scope.eventRegistration = !$scope.eventRegistration;          
         $scope.currentEvent = angular.copy($scope.newDhis2Event);        
@@ -549,6 +558,7 @@
     $scope.showEditEventInFull = function(){       
         $scope.note = {};
         $scope.displayCustomForm = $scope.customForm ? true:false;
+        console.log("displayCustomForm set to "+$scope.displayCustomForm);
 
         $scope.currentEvent = ContextMenuSelectedItem.getSelectedItem();
         $scope.editingEventInFull = !$scope.editingEventInFull;   
@@ -571,6 +581,8 @@
     
     $scope.switchDataEntryForm = function(){
         $scope.displayCustomForm = !$scope.displayCustomForm;
+        console.log("displayCustomForm set to "+$scope.displayCustomForm);
+
     };
     
     $scope.addEvent = function(addingAnotherEvent){                
@@ -622,7 +634,7 @@
                 program: $scope.selectedProgram.id,
                 programStage: $scope.selectedProgramStage.id,
                 orgUnit: $scope.selectedOrgUnit.id,
-                status: 'ACTIVE',            
+                status: $scope.currentEvent.status ? 'COMPLETED' : 'ACTIVE',
                 eventDate: DateUtils.formatFromUserToApi(newEvent.eventDate),
                 dataValues: dataValues
         }; 
@@ -735,7 +747,7 @@
                             program: $scope.currentEvent.program,
                             programStage: $scope.currentEvent.programStage,
                             orgUnit: $scope.currentEvent.orgUnit,
-                            status: 'ACTIVE',                                        
+                            status: $scope.currentEvent.status ? 'COMPLETED' : 'ACTIVE',
                             eventDate: DateUtils.formatFromUserToApi($scope.currentEvent.eventDate),
                             event: $scope.currentEvent.event, 
                             dataValues: dataValues

=== 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-12-01 14:01:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2015-12-02 13:43:14 +0000
@@ -2,6 +2,7 @@
     <a href="javascript:dhis2.leftBar.showAnimated()" title="$i18n.getString('show_menu' )"><i class="fa fa-arrow-right leftBarIcon"></i></a>
 </span>
 
+i just write somehitn
 <div id="leftBar">
     
     <d2-left-bar></d2-left-bar>
@@ -61,6 +62,7 @@
                     </div>
                 </div>
                 <div class="row col-sm-12 small-vertical-spacing" ng-if="selectedProgram" ng-repeat="category in selectedCategories">
+                    it is here
                     <div class="col-sm-4">
                         {{category.name}}
                     </div>
@@ -116,13 +118,17 @@
         <form name="outerForm" novalidate>
             <div ng-if="editingEventInFull || eventRegistration">
                 <h3>
-                    <span ng-if="editingEventInFull">{{'event_details'| translate}}</span>                       
-                    <span ng-if="eventRegistration">{{'new_event'| translate}}</span>                            
+                    <span ng-if="editingEventInFull">{{'event_details'| translate}}</span>
+                    <span ng-if="eventRegistration">{{'new_event'| translate}}</span>
                 </h3>
                 <div class="col-sm-8">
                     <div class="bordered-div">
                         <div ng-if="displayCustomForm" ng-include="'views/ec-custom-form.html'"></div>  
                         <div ng-if="!displayCustomForm" ng-include="'views/defaultForm.html'"></div>
+                        <div class="row">
+                            <div class="col-sm-1">Completed</div>
+                            <input type="checkbox" ng-model="currentEvent.status" style="margin-left: 50px;">
+                        </div>
                         <div ng-include="'views/comments-section.html'"></div>
                         <div ng-include="'views/buttons-section.html'"></div>
                     </div>