← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15775: new event creation in tei dashboard

 

------------------------------------------------------------
revno: 15775
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Fri 2014-06-20 09:32:57 +0200
message:
  new event creation in tei dashboard
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2014-06-19 15:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2014-06-20 07:32:57 +0000
@@ -1,6 +1,7 @@
 trackerCapture.controller('DataEntryController',
         function($scope, 
                 $filter,
+                DateUtils,
                 orderByFilter,
                 storage,
                 ProgramStageFactory,
@@ -10,13 +11,13 @@
                 TranslationService) {
 
     TranslationService.translate();
+    
+    var today = moment();
+    today = Date.parse(today);
+    today = $filter('date')(today, 'yyyy-MM-dd');
      
     //listen for the selected items
-    $scope.$on('dashboard', function(event, args) {  
-        var today = moment();
-        today = Date.parse(today);
-        today = $filter('date')(today, 'yyyy-MM-dd');
-
+    $scope.$on('dashboard', function(event, args) { 
         $scope.currentEvent = null;
         $scope.allowEventCreation = false;
         $scope.repeatableStages = [];        
@@ -36,77 +37,65 @@
             DHIS2EventFactory.getByEntity($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id).then(function(data){
                 $scope.dhis2Events = data;
                
-                /*if(angular.isUndefined($scope.dhis2Events)){
+                if(angular.isUndefined($scope.dhis2Events)){
                     
-                    $scope.dhis2Events = [];
+                    //create dummy events
+                    $scope.dummyEvents = [];
                     
                     if($scope.selectedEnrollment.status === 'ACTIVE'){
-                        //create events for the selected enrollment
-                        var program = storage.get($scope.selectedProgramId);
-                        //var programStages = [];
+                        //create dummy events for the selected enrollment                        
+                        angular.forEach($scope.selectedProgram.programStages, function(programStage){                                                        
+                            var dummyEvent = $scope.createDummyEvent(programStage, $scope.selectedOrgUnit, $scope.selectedEnrollment);
+                            $scope.dummyEvents.push(dummyEvent);                            
+                        });
                         
-                        angular.forEach(program.programStages, function(ps){  
-                            ps = storage.get(ps.id);
-                            //programStages.push(ps);
-                            
-                            var eventDate = moment(moment().add('d', ps.minDaysFromStart), 'YYYY-MM-DD')._d;
-                            eventDate = Date.parse(eventDate);
-                            eventDate = $filter('date')(eventDate, 'yyyy-MM-dd');
-                            var dhis2Event = {programStage: ps.id, 
-                                              orgUnit: $scope.selectedOrgUnitId, 
-                                              eventDate: eventDate,
-                                              name: ps.name,
-                                              status: 'ACTIVE'};
-                            
-                            $scope.dhis2Events.push(dhis2Event);    
-                            
-                        });
+                        $scope.dummyEvents = orderByFilter($scope.dummyEvents, '-eventDate');
+                        $scope.dummyEvents.reverse();                        
                     }
-                }*/                
-
-                angular.forEach($scope.dhis2Events, function(dhis2Event){
+                }
+                else{
+                    angular.forEach($scope.dhis2Events, function(dhis2Event){
                     
-                    ProgramStageFactory.get(dhis2Event.programStage).then(function(stage){
-                        //check if a stage is repeatable
-                        if(stage.repeatable){
-                            $scope.allowEventCreation = true;
-                            if($scope.repeatableStages.indexOf(stage) === -1){
-                                $scope.repeatableStages.push(stage);
+                        ProgramStageFactory.get(dhis2Event.programStage).then(function(stage){
+                            //check if a stage is repeatable
+                            if(stage.repeatable){
+                                $scope.allowEventCreation = true;
+                                if($scope.repeatableStages.indexOf(stage) === -1){
+                                    $scope.repeatableStages.push(stage);
+                                }
                             }
+
+                            dhis2Event.name = stage.name;
+                        });
+                        
+                        dhis2Event.eventDate = DateUtils.format(dhis2Event.eventDate);
+
+                        if(dhis2Event.status === 'COMPLETED'){
+                            dhis2Event.statusColor = 'stage-completed';
                         }
-
-                        dhis2Event.name = stage.name;
+                        else{
+                            dhis2Event.statusColor = 'stage-on-time';
+
+                            if(moment(today).isAfter(dhis2Event.eventDate)){
+                                dhis2Event.statusColor = 'stage-overdue';
+                            }                        
+                        } 
+
+                        //get orgunit name for the event
+                        if(dhis2Event.orgUnit){
+                            OrgUnitService.open().then(function(){
+                                OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
+                                    if(ou){
+                                        dhis2Event.orgUnitName = ou.n;
+                                    }                                                       
+                                });                            
+                            }); 
+                        }                                                             
                     });
-                    
-                    dhis2Event.eventDate = moment(dhis2Event.eventDate, 'YYYY-MM-DD')._d;
-                    dhis2Event.eventDate = Date.parse(dhis2Event.eventDate);
-                    dhis2Event.eventDate = $filter('date')(dhis2Event.eventDate, 'yyyy-MM-dd');
-                    
-                    if(dhis2Event.status === 'COMPLETED'){
-                        dhis2Event.statusColor = 'stage-completed';
-                    }
-                    else{
-                        dhis2Event.statusColor = 'stage-on-time';
-
-                        if(moment(today).isAfter(dhis2Event.eventDate)){
-                            dhis2Event.statusColor = 'stage-overdue';
-                        }                        
-                    } 
-                    
-                    //get orgunit name for the event
-                    if(dhis2Event.orgUnit){
-                        OrgUnitService.open().then(function(){
-                            OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
-                                if(ou){
-                                    dhis2Event.orgUnitName = ou.n;
-                                }                                                       
-                            });                            
-                        }); 
-                    }                                                             
-                });
-
-                //$scope.dhis2Events = orderByFilter($scope.dhis2Events, '-eventDate');
-                //$scope.dhis2Events.reverse();              
+
+                    $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-eventDate');
+                    $scope.dhis2Events.reverse();                    
+                }
             });          
         }
     });
@@ -115,6 +104,14 @@
         console.log('need to create new event:  ', $scope.repeatableStages);        
     };
     
+    $scope.showEventCreation = function(dummyEvent){
+        
+        if(dummyEvent){            
+            $scope.currentDummyEvent = dummyEvent;
+            console.log('need to provide event creation interface');            
+        }
+    };   
+    
     $scope.showDataEntry = function(event){
         
         if(event){
@@ -207,4 +204,22 @@
             
         }        
     };
+    
+    $scope.createDummyEvent = function(programStage, orgUnit, enrollment){
+        
+        var eventDate = moment(moment(enrollment.dateOfIncident).add('d', programStage.minDaysFromStart), 'YYYY-MM-DD')._d;
+        eventDate = Date.parse(eventDate);
+        eventDate = $filter('date')(eventDate, 'yyyy-MM-dd');
+        var dummyEvent = {programStage: programStage.id, 
+                          orgUnit: orgUnit.id,
+                          orgUnitName: orgUnit.name,
+                          eventDate: eventDate,
+                          name: programStage.name,
+                          status: 'ACTIVE'};
+        dummyEvent.statusColor = 'stage-on-time';
+        if(moment(today).isAfter(dummyEvent.eventDate)){
+            dummyEvent.statusColor = 'stage-overdue';
+        }        
+        return dummyEvent;        
+    };
 });
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2014-06-19 15:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2014-06-20 07:32:57 +0000
@@ -106,8 +106,27 @@
 
             </div>
         </div>
+        <div ng-if="!dhis2Events && selectedEnrollment">
+            <div class="alert alert-warning">{{'no_event_is_yet_created'| translate}}</div>
+            <table class="table-borderless">
+                <tbody>
+                    <tr>
+                        <td class="inline-block" ng-repeat="dummyEvent in dummyEvents">
+                            <span class="block align-center">{{dhis2Event.orgUnitName}}</span>                                              
+                            <span class="stage-container"                                                     
+                                  ng-class="{'current-stage': currentDummyEvent && currentDummyEvent.programStage == dummyEvent.programStage, '{{dummyEvent.statusColor}}': true}"                                                      
+                                  ng-click="showEventCreation(dummyEvent)">
+                                {{dummyEvent.name}}<br/>
+                                {{dummyEvent.eventDate}}         
+                            </span>
+                            <i class="fa fa-arrow-right" ng-show="$index < dummyEvents.length - 1"></i>
+                        </td>                        
+                    </tr>
+                </tbody>                
+            </table>
+        </div>
+        <div ng-if="!selectedEnrollment">
+            <div class="alert alert-warning">{{'not_yet_enrolled'| translate}}</div> 
+        </div>
     </div>
-
-
-
 </div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2014-06-19 15:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2014-06-20 07:32:57 +0000
@@ -3,7 +3,6 @@
                 $scope,  
                 $filter,
                 storage,
-                ProgramFactory,
                 ProgramStageFactory,
                 AttributesFactory,
                 CurrentSelection,
@@ -11,21 +10,19 @@
                 EnrollmentService,
                 TranslationService,
                 DialogService) {
-
-    //programs for enrollment
-    $scope.enrollments = [];
-    $scope.programs = []; 
-    $scope.showEnrollmentDiv = false;
-    $scope.showSchedulingDiv = false;    
-    $scope.selectedProgram = '';
-    $scope.selectedEnrollment = '';
-    
     TranslationService.translate();
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+
     
     //listen for the selected items
     $scope.$on('selectedEntity', function(event, args) {   
+        //programs for enrollment
+        $scope.enrollments = [];
+        $scope.showEnrollmentDiv = false;
+        $scope.showSchedulingDiv = false;    
+        $scope.selectedProgram = '';
+        $scope.selectedEnrollment = '';
         $scope.newEnrollment = {};
+        
         var selections = CurrentSelection.get();
         $scope.selectedEntity = selections.tei; 
         $scope.selectedProgram = selections.pr;
@@ -33,7 +30,7 @@
         
         if($scope.selectedProgram){ 
             EnrollmentService.getByEntityAndProgram($scope.selectedEntity.trackedEntityInstance, $scope.selectedProgram.id).then(function(data){
-                $scope.enrollments = data.enrollmentList;  
+                $scope.enrollments = data.enrollmentList;
                 $scope.loadEvents();                
             });
         }        
@@ -44,7 +41,7 @@
         if($scope.selectedProgram){
           
             //check for possible enrollment
-            $scope.selectedEnrollment = '';
+            $scope.selectedEnrollment = null;
             angular.forEach($scope.enrollments, function(enrollment){
                 if(enrollment.program === $scope.selectedProgram.id ){
                     $scope.selectedEnrollment = enrollment;
@@ -108,6 +105,13 @@
         var tei = angular.copy($scope.selectedEntity);
         tei.attributes = [];
         
+        //existing attributes
+        angular.forEach($scope.selectedEntity.attributes, function(attribute){
+            if(!angular.isUndefined(attribute.value)){
+                tei.attributes.push({attribute: attribute.attribute, value: attribute.value});
+            } 
+        });
+        
         //get enrollment attributes and their values - new attributes because of enrollment
         angular.forEach($scope.attributesForEnrollment, function(attribute){
             if(!angular.isUndefined(attribute.value)){
@@ -115,13 +119,6 @@
             } 
         });
         
-        //existing attributes
-        angular.forEach($scope.selectedEntity.attributes, function(attribute){
-            if(!angular.isUndefined(attribute.value)){
-                tei.attributes.push({attribute: attribute.attribute, value: attribute.value});
-            } 
-        });
-        
         var enrollment = {trackedEntityInstance: tei.trackedEntityInstance,
                             program: $scope.selectedProgram.id,
                             status: 'ACTIVE',
@@ -152,10 +149,9 @@
                                  attribute.value = parseInt(attribute.value);
                              }
                             $scope.selectedEntity.attributes.push({attribute: attribute.id, value: attribute.value, type: attribute.valueType, displayName: attribute.name});                            
-                        } 
+                        }
                     });
                 });
-               
             }
             else{
                 //update has failed

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2014-06-19 15:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2014-06-20 07:32:57 +0000
@@ -6,7 +6,7 @@
         </span>
     </div>
     <div class="panel-body dashboard-widget-container">
-        <div ng-if="selectedProgram">
+        <div ng-if="selectedEnrollment">
             <table class="table-borderless">
                 <tr>
                     <td>
@@ -60,80 +60,85 @@
                     {{'cancel'| translate}}
                 </button>
             </div>
-
-            <div class="vertical-spacing horizonal-spacing" ng-if="selectedProgram && !selectedEnrollment">
-                <hr>
-                <table class="table-borderless">
-                    <tr>
-                        <td>
-                            {{selectedProgram.dateOfEnrollmentDescription}}
-                        </td>
-                        <td>
-                            <input type="text" class="form-control" ng-date ng-model="newEnrollment.dateOfEnrollment" />
-                        </td>
-                    </tr>     
-                    <tr ng-if="selectedProgram.displayIncidentDate">
-                        <td>
-                            {{selectedProgram.dateOfIncidentDescription}}
-                        </td>
-                        <td>
-                            <input type="text" class="form-control" ng-date ng-model="newEnrollment.dateOfIncident" />                    
-                        </td>
-                    </tr>
-                </table>
-                <hr>
-                <table class="table-borderless table-striped">
-                    <tr ng-repeat="attribute in attributesForEnrollment">
-                        <td>
-                            {{attribute.name}}
-                        </td>
-                        <td>
-                            <div ng-switch="attribute.valueType">
-                                <div ng-switch-when="date">
-                                    <input type="text" class="form-control" ng-date ng-model="attribute.value" />
-                                </div>
-                                <div ng-switch-when="trueOnly">
-                                    <input type="checkbox" class="form-control" ng-model="attribute.value" />
-                                </div>
-                                <div ng-switch-when="bool">
-                                    <select ng-model="attribute.value" class="form-control">
-                                        <option value="">{{'please_select'| translate}}</option>                        
-                                        <option value="0">{{'no'| translate}}</option>
-                                        <option value="1">{{'yes'| translate}}</option>
-                                    </select>
-                                </div>
-                                <div ng-switch-when="optionSet">
-                                    <input type="text" 
-                                           class="form-control"
-                                           ng-model="attribute.value"                                                 
-                                           typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
-                                           typeahead-open-on-focus 
-                                           />
-                                </div>
-                                <div ng-switch-when="number">
-                                    <input type="number" class="form-control" ng-model="attribute.value"/>
-                                </div>
-                                <div ng-switch-default>
-                                    <input type="text" class="form-control" ng-model="attribute.value" />                                        
-                                </div>
-                            </div>                                                                                                    
-                        </td>
-                    </tr>                        
-                </table>
-
-                <div class="vertical-spacing small-horizonal-spacing">            
-                    <button type="button" 
-                            class="btn btn-default"
-                            ng-click="enroll()">
-                        {{'enroll'| translate}}
-                    </button>  
-                    <button type="button" 
-                            class="btn btn-default"
-                            ng-click="cancelEnrollment()">
-                        {{'cancel'| translate}}
-                    </button>
-                </div>
+        </div>
+
+
+        <div ng-if="selectedProgram && !selectedEnrollment">
+            <table class="table-borderless">
+                <tr>
+                    <td>
+                        {{selectedProgram.dateOfEnrollmentDescription}}
+                    </td>
+                    <td>
+                        <input type="text" class="form-control" ng-date ng-model="newEnrollment.dateOfEnrollment" />
+                    </td>
+                </tr>     
+                <tr ng-if="selectedProgram.displayIncidentDate">
+                    <td>
+                        {{selectedProgram.dateOfIncidentDescription}}
+                    </td>
+                    <td>
+                        <input type="text" class="form-control" ng-date ng-model="newEnrollment.dateOfIncident" />                    
+                    </td>
+                </tr>
+            </table>
+            <hr>
+            <table class="table-borderless table-striped">
+                <tr ng-repeat="attribute in attributesForEnrollment">
+                    <td>
+                        {{attribute.name}}
+                    </td>
+                    <td>
+                        <div ng-switch="attribute.valueType">
+                            <div ng-switch-when="date">
+                                <input type="text" class="form-control" ng-date ng-model="attribute.value" />
+                            </div>
+                            <div ng-switch-when="trueOnly">
+                                <input type="checkbox" class="form-control" ng-model="attribute.value" />
+                            </div>
+                            <div ng-switch-when="bool">
+                                <select ng-model="attribute.value" class="form-control">
+                                    <option value="">{{'please_select'| translate}}</option>                        
+                                    <option value="0">{{'no'| translate}}</option>
+                                    <option value="1">{{'yes'| translate}}</option>
+                                </select>
+                            </div>
+                            <div ng-switch-when="optionSet">
+                                <input type="text" 
+                                       class="form-control"
+                                       ng-model="attribute.value"                                                 
+                                       typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
+                                       typeahead-open-on-focus 
+                                       />
+                            </div>
+                            <div ng-switch-when="number">
+                                <input type="number" class="form-control" ng-model="attribute.value"/>
+                            </div>
+                            <div ng-switch-default>
+                                <input type="text" class="form-control" ng-model="attribute.value" />                                        
+                            </div>
+                        </div>                                                                                                    
+                    </td>
+                </tr>                        
+            </table>
+
+            <div class="vertical-spacing small-horizonal-spacing">            
+                <button type="button" 
+                        class="btn btn-default"
+                        ng-click="enroll()">
+                    {{'enroll'| translate}}
+                </button>  
+                <button type="button" 
+                        class="btn btn-default"
+                        ng-click="cancelEnrollment()">
+                    {{'cancel'| translate}}
+                </button>
             </div>
         </div>
+
+        <div ng-if="!selectedProgram">
+            <div class="alert alert-warning">{{'please_select_a_program'| translate}}</div> 
+        </div>
+
     </div>
 </div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-06-19 15:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-06-20 07:32:57 +0000
@@ -238,7 +238,7 @@
 })
 
 /* Service for getting tracked entity instances */
-.factory('TEIService', function($http, $filter, EntityService) {
+.factory('TEIService', function($http, $filter, DateUtils, EntityService) {
     
     var promise;
     return {
@@ -250,9 +250,7 @@
                 angular.forEach(tei.attributes, function(attribute){                   
                    if(attribute.type && attribute.value){                       
                        if(attribute.type === 'date'){                           
-                           attribute.value = moment(attribute.value, 'YYYY-MM-DD')._d;
-                           attribute.value = Date.parse(attribute.value);
-                           attribute.value = $filter('date')(attribute.value, 'yyyy-MM-dd');                           
+                           attribute.value = DateUtils.format(attribute.value);
                        }
                    } 
                 });
@@ -712,7 +710,7 @@
             
 })
 
-.service('EntityService', function(OrgUnitService, $filter){
+.service('EntityService', function(OrgUnitService, DateUtils, $filter){
     
     return {
         formatter: function(grid){
@@ -737,9 +735,7 @@
 
                     entity.id = row[0];
                     var rDate = row[1];
-                    rDate = moment(rDate, 'YYYY-MM-DD')._d;
-                    rDate = Date.parse(rDate);
-                    rDate = $filter('date')(rDate, 'yyyy-MM-dd');                           
+                    rDate = DateUtils.format(rDate);
                     entity.created = rDate;
                     entity.orgUnit = row[3];                              
                     entity.type = row[4];  
@@ -765,4 +761,16 @@
             return {headers: attributes, rows: entityList};                                    
         }        
     };
+})
+
+.service('DateUtils', function($filter){
+    
+    return {
+        format: function(dateValue) {            
+            dateValue = moment(dateValue, 'YYYY-MM-DD')._d;
+            dateValue = Date.parse(dateValue);
+            dateValue = $filter('date')(dateValue, 'yyyy-MM-dd');
+            return dateValue;
+        }
+    };            
 });
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2014-06-07 14:03:55 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2014-06-20 07:32:57 +0000
@@ -338,7 +338,7 @@
         return $.ajax( {
             url: '../api/programs.json',
             type: 'GET',
-            data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,version,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,realionshipText,trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],programStages[id,name,version,description,minDaysFromStart,repeatable],programTrackedEntityAttributes[displayInList,mandatory,attribute[id]]'
+            data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,version,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,realionshipText,trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],programStages[id,name,version,minDaysFromStart,repeatable],programTrackedEntityAttributes[displayInList,mandatory,attribute[id]]'
         }).done( function( response ){
             
             _.each( _.values( response.programs ), function ( program ) {