← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16504: tracker capture - respect allowFutureIncident(Enrollment)dates set for program

 

------------------------------------------------------------
revno: 16504
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-08-25 15:40:37 +0200
message:
  tracker capture - respect allowFutureIncident(Enrollment)dates set for program
modified:
  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/components/registration/registration-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js
  dhis-2/dhis-web/dhis-web-apps/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-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	2014-08-25 08:55:18 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2014-08-25 13:40:37 +0000
@@ -3,7 +3,6 @@
                 $scope,  
                 $timeout,
                 $location,
-                orderByFilter,
                 DateUtils,
                 EventUtils,
                 storage,
@@ -16,7 +15,8 @@
                 ModalService,
                 DialogService) {
     TranslationService.translate();
-
+    
+    $scope.today = DateUtils.format(moment());
     
     //listen for the selected items
     $scope.$on('selectedItems', function(event, args) {   

=== 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	2014-07-25 10:09:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2014-08-25 13:40:37 +0000
@@ -24,7 +24,7 @@
         <div ng-if="selectedEnrollment && !showEnrollmentHistoryDiv && !showReSchedulingDiv">
             <table class="table-borderless table-striped">
                 <tr class="col-md-12">
-                    <td class="col-md-6">
+                    <td class="col-md-6">d
                         {{selectedProgram.dateOfEnrollmentDescription}}
                     </td>
                     <td class="col-md-6">
@@ -64,8 +64,13 @@
                             {{selectedProgram.dateOfEnrollmentDescription}}
                         </td>
                         <td class="col-md-6">
-                            <input type="text" placeholder="yyyy-mm-dd" name="dateOfEnrollment" class="form-control" ng-date ng-model="newEnrollment.dateOfEnrollment" ng-required="true"/>
-                            <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+                            <span ng-if="selectedProgram.selectEnrollmentDatesInFuture">
+                                <input type="text" placeholder="yyyy-mm-dd" name="dateOfEnrollment" class="form-control" ng-date ng-model="newEnrollment.dateOfEnrollment" ng-required="true"/>
+                            </span>
+                            <span ng-if="!selectedProgram.selectEnrollmentDatesInFuture">
+                                <input type="text" placeholder="yyyy-mm-dd" name="dateOfEnrollment" class="form-control" ng-date ng-model="newEnrollment.dateOfEnrollment" max-date="today" ng-required="true"/>
+                            </span>
+                            <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="red">{{'required'| translate}}</span>
                         </td>
                     </tr>     
                     <tr class="col-md-12" ng-if="selectedProgram.displayIncidentDate">
@@ -73,7 +78,12 @@
                             {{selectedProgram.dateOfIncidentDescription}}
                         </td>
                         <td class="col-md-6">
-                            <input type="text" placeholder="yyyy-mm-dd" class="form-control" ng-date ng-model="newEnrollment.dateOfIncident" />                    
+                            <span ng-if="selectedProgram.selectIncidentDatesInFuture">
+                                <input type="text" placeholder="yyyy-mm-dd" class="form-control" ng-date ng-model="newEnrollment.dateOfIncident" />                        
+                            </span>
+                            <span ng-if="!selectedProgram.selectIncidentDatesInFuture">
+                                <input type="text" placeholder="yyyy-mm-dd" class="form-control" ng-date ng-model="newEnrollment.dateOfIncident" max-date="today"/>                        
+                            </span>
                         </td>
                     </tr>
                 </table>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2014-07-17 10:35:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2014-08-25 13:40:37 +0000
@@ -16,8 +16,10 @@
                 TranslationService) {
 
     //do translation of the registration page
-    TranslationService.translate();   
-
+    TranslationService.translate();    
+    
+    $scope.today = DateUtils.format(moment());
+    
     $scope.selectedOrgUnit = storage.get('SELECTED_OU');
     $scope.enrollment = {enrollmentDate: '', incidentDate: ''};   
     

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2014-08-08 14:59:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2014-08-25 13:40:37 +0000
@@ -76,7 +76,12 @@
                         {{selectedProgram.dateOfEnrollmentDescription}}
                     </td>
                     <td>
-                        <input type="text" placeholder="yyyy-mm-dd" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.incidentDate" ng-required="true"/>
+                        <span ng-if="selectedProgram.selectEnrollmentDatesInFuture">
+                            <input type="text" placeholder="yyyy-mm-dd" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.enrollmentDate" ng-required="true"/>
+                        </span>                        
+                        <span ng-if="!selectedProgram.selectEnrollmentDatesInFuture">
+                            <input type="text" placeholder="yyyy-mm-dd" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.enrollmentDate" max-date="today" ng-required="true"/>
+                        </span>
                         <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="error">{{'required'| translate}}</span>
                     </td>
                 </tr>     
@@ -85,7 +90,12 @@
                         {{selectedProgram.dateOfIncidentDescription}}
                     </td>
                     <td>
-                        <input type="text" placeholder="yyyy-mm-dd" class="form-control" ng-date ng-model="enrollment.enrollmentDate" />
+                        <span ng-if="selectedProgram.selectIncidentDatesInFuture">
+                            <input type="text" placeholder="yyyy-mm-dd" class="form-control" ng-date ng-model="enrollment.incidentDate" />
+                        </span>                        
+                        <span ng-if="!selectedProgram.selectIncidentDatesInFuture">
+                            <input type="text" placeholder="yyyy-mm-dd" class="form-control" ng-date ng-model="enrollment.incidentDate" max-date="today"/>
+                        </span>
                     </td>
                 </tr>
             </table>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js	2014-08-18 10:01:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js	2014-08-25 13:40:37 +0000
@@ -11,6 +11,8 @@
 
     TranslationService.translate();
     
+    $scope.today = DateUtils.format(moment());
+    
     $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
     $scope.selectedOuMode = $scope.ouModes[0];
     $scope.report = {};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	2014-07-25 10:52:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	2014-08-25 13:40:37 +0000
@@ -20,11 +20,11 @@
                 <table class="table-borderless table-with-fixed-layout">
                     <tr>
                         <td>
-                            <input type="text" name="reportStartDate" placeholder="{{'start_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.startDate" ng-required="true"/> 
+                            <input type="text" name="reportStartDate" placeholder="{{'start_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.startDate" max="today" ng-required="true"/> 
                             <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
                         </td>
                         <td>
-                            <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.endDate" ng-required="true"/>
+                            <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.endDate" max="today" ng-required="true"/>
                             <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
                         </td>
                     </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js	2014-08-13 08:20:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js	2014-08-25 13:40:37 +0000
@@ -196,6 +196,8 @@
                 changeMonth: true,
                 dateFormat: 'yy-mm-dd',
                 yearRange: '-120:+0',
+                minDate: attrs.minDate,
+                maxDate: attrs.maxDate,
                 onSelect: function(date) {
                     //scope.date = date;
                     ctrl.$setViewValue(date);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2014-08-14 05:46:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2014-08-25 13:40:37 +0000
@@ -377,7 +377,7 @@
         return $.ajax( {
             url: '../api/programs.json',
             type: 'GET',
-            data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,version,relationshipText,relationshipFromA,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,realionshipText,trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],programStages[id,name,version,minDaysFromStart,reportDateDescription,repeatable,autoGenerateEvent],programTrackedEntityAttributes[displayInList,mandatory,trackedEntityAttribute[id]]'
+            data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,version,relationshipText,relationshipFromA,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,realionshipText,relationshipFromA,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],programStages[id,name,version,minDaysFromStart,reportDateDescription,repeatable,autoGenerateEvent],programTrackedEntityAttributes[displayInList,mandatory,trackedEntityAttribute[id]]'
         }).done( function( response ){
             
             _.each( _.values( response.programs ), function ( program ) {