← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18039: tracker-capture - disable editing of historical enrollment values in custom form

 

------------------------------------------------------------
revno: 18039
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-01-17 11:50:24 +0100
message:
  tracker-capture - disable editing of historical enrollment values in custom form
modified:
  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/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/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-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-01-16 12:24:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-01-17 10:50:24 +0000
@@ -121,7 +121,8 @@
             <td class="col-md-2" ng-if="allowProvidedElsewhereExists">                
                 <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
                     <input type="checkbox" 
-                           ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]"
+                           ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]" 
+                           ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'" 
                            ng-change="saveDatavalueLocation(prStDe)"/>                
                 </div>
             </td>
@@ -255,6 +256,7 @@
                                 <div class="align-center" ng-show="prStDes[de.dataElement.id].allowProvidedElsewhere">
                                     <input type="checkbox" 
                                            ng-model="currentEvent.providedElsewhere[prStDes[de.dataElement.id].dataElement.id]"
+                                           ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'" 
                                            ng-change="saveDatavalueLocation(prStDes[de.dataElement.id])"/>                
                                 </div>
                             </td>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-01-16 12:24:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-01-17 10:50:24 +0000
@@ -253,7 +253,7 @@
         ModalService.showModal({}, modalOptions).then(function(result){            
             EnrollmentService.cancel($scope.selectedEnrollment).then(function(data){                
                 $scope.selectedEnrollment.status = 'CANCELLED';
-                $scope.loadEnrollmentDetails();                
+                $scope.loadEnrollmentDetails($scope.selectedEnrollment.status);                
             });
         });
     };
@@ -270,11 +270,11 @@
         ModalService.showModal({}, modalOptions).then(function(result){            
             EnrollmentService.complete($scope.selectedEnrollment).then(function(data){                
                 $scope.selectedEnrollment.status = 'COMPLETED';
-                $scope.loadEnrollmentDetails();                
+                $scope.loadEnrollmentDetails($scope.selectedEnrollment);                
             });
         });
     };
-        
+            
     $scope.autoGenerateEvents = function(){
         if($scope.selectedTei && $scope.selectedProgram && $scope.selectedOrgUnit && $scope.selectedEnrollment){            
             var dhis2Events = {events: []};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-01-16 12:24:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-01-17 10:50:24 +0000
@@ -47,13 +47,13 @@
 
                 <button type="button" 
                         class="btn btn-primary"
-                        ng-disabled="selectedEnrollment.status === 'COMPLETED'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
                         ng-click="completeEnrollment()">
                     {{'complete'| translate}}
                 </button>
                 <button type="button" 
                         class="btn btn-warning"
-                        ng-disabled="selectedEnrollment.status === 'COMPLETED'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
                         ng-click="terminateEnrollment()">
                     {{'terminate'| translate}}
                 </button>   
@@ -61,7 +61,7 @@
                 <button type="button"
                         title="{{'unmark_for_followup'| translate}}"
                         class="btn btn-danger horizonal-spacing"
-                        ng-disabled="selectedEnrollment.status === 'COMPLETED'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
                         ng-if="selectedEnrollment.followup"
                         ng-click="markForFollowup()">
                     <i class="fa fa-exclamation-triangle"></i>
@@ -69,7 +69,7 @@
                 <button type="button" 
                         title="{{'mark_for_followup'| translate}}"
                         class="btn btn-default horizonal-spacing"
-                        ng-disabled="selectedEnrollment.status === 'COMPLETED'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
                         ng-if="!selectedEnrollment.followup"
                         ng-click="markForFollowup()">
                     <i class="fa fa-exclamation-triangle"></i>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-01-14 11:21:15 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-01-17 10:50:24 +0000
@@ -295,7 +295,8 @@
             });
             return promise;
         },
-        update: function( enrollment){
+        update: function( enrollment ){
+            console.log('the enrollment I got is:  ', enrollment);
             var promise = $http.put( '../api/enrollments/' + enrollment.enrollment , enrollment).then(function(response){
                 return response.data;
             });
@@ -312,7 +313,7 @@
                 return response.data;               
             });
             return promise;           
-        }        
+        }
     };   
 })
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/services.js	2015-01-16 15:40:31 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/services.js	2015-01-17 10:50:24 +0000
@@ -220,7 +220,7 @@
                                                 this.getAttributesAsString(attributes) +
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '"' +
-                                                ' input-field-id=" ' + fieldId + '"' +
+                                                ' input-field-id="' + fieldId + '"' +
                                                 ' d2-date ' +
                                                 ' max-date="' + 0 + '"' + 
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
@@ -244,8 +244,9 @@
                                                 ' d2-number-validation ' +
                                                 ' number-type="' + programStageDataElements[fieldId].dataElement.numberType + '" ' +
                                                 ' ng-model="currentEvent.' + fieldId + '"' +
-                                                ' input-field-id=" ' + fieldId + '"' +
+                                                ' input-field-id="' + fieldId + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+                                                ' ng-disabled="currentEvent.enrollmentStatus!=\'ACTIVE\'"' +
                                                 ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' + 
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">';
                             }
@@ -256,8 +257,8 @@
                                                 this.getAttributesAsString(attributes) +
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '" ' +
-                                                ' input-field-id=" ' + fieldId + '"' +
-                                                ' ng-disabled="currentEvent[uid] == \'uid\'" ' +
+                                                ' input-field-id="' + fieldId + '"' +
+                                                ' ng-disabled="currentEvent.enrollmentStatus!=\'ACTIVE\' || currentEvent[uid]==\'uid\'"' +
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"' +
                                                 ' typeahead="option.name as option.name for option in optionSets.'+optionSetId+'.options | filter:$viewValue | limitTo:20"' +
                                                 ' typeahead-editable="false" ' +
@@ -273,8 +274,8 @@
                                                 this.getAttributesAsString(attributes) +
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '" ' +
-                                                ' input-field-id=" ' + fieldId + '"' +
-                                                ' ng-disabled="currentEvent[uid] == \'uid\'" ' +
+                                                ' input-field-id="' + fieldId + '"' +
+                                                ' ng-disabled="currentEvent.enrollmentStatus!=\'ACTIVE\' || currentEvent[uid]==\'uid\'"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
                                                 ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' +
                                                 ' ng-required="prStDes.' + fieldId + '.compulsory"> ';                                     
@@ -285,8 +286,9 @@
                                                 this.getAttributesAsString(attributes) +
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '" ' +
-                                                ' input-field-id=" ' + fieldId + '"' +
+                                                ' input-field-id="' + fieldId + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+                                                ' ng-disabled="currentEvent.enrollmentStatus!=\'ACTIVE\'"' +
                                                 ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">' + 
                                                 '<option value="">{{\'please_select\'| translate}}</option>' +
@@ -300,10 +302,11 @@
                                                 this.getAttributesAsString(attributes) +
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '"' +
-                                                ' input-field-id=" ' + fieldId + '"' +
+                                                ' input-field-id="' + fieldId + '"' +
                                                 ' d2-date ' +
-                                                ' max-date="' + maxDate + '"' + '\'' +
+                                                ' max-date="' + maxDate + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+                                                ' ng-disabled="currentEvent.enrollmentStatus!=\'ACTIVE\'"' +
                                                 ' blur-or-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> '; 
                             }
@@ -312,8 +315,9 @@
                                                 this.getAttributesAsString(attributes) +
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '"' +
-                                                ' input-field-id=" ' + fieldId + '"' +
+                                                ' input-field-id="' + fieldId + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+                                                ' ng-disabled="currentEvent.enrollmentStatus!=\'ACTIVE\'"' +
                                                 ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' +
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> ';
                             }