← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21917: Added drop-down menu to choose the period of upcoming events.

 

------------------------------------------------------------
revno: 21917
committer: jijukjose <jijukjose@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-02-09 16:59:55 +0100
message:
  Added drop-down menu to choose the period of upcoming events.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app_in_ID.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css


--
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/report/upcoming-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2016-01-07 10:29:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2016-02-09 15:59:55 +0000
@@ -3,7 +3,8 @@
                 $modal,
                 $location,
                 $translate,
-                DateUtils,                
+                $location,
+                DateUtils,
                 Paginator,
                 EventReportService,
                 TEIGridService,
@@ -253,6 +254,37 @@
     $scope.generateReportData = function(){
         return TEIGridService.getData($scope.upcomingEvents, $scope.gridColumns);
     };
+
+
+    $scope.dates=[ {"name":$translate.instant('events_today'), "numOfDays":1},
+                     {"name":$translate.instant('events_in_one_week'), "numOfDays":7},
+                     {"name":$translate.instant('events_in_two_weeks'), "numOfDays":14},
+                     {"name":$translate.instant('events_in_one_month'), "numOfDays":30},
+                     {"name":$translate.instant('choose_the_dates')}
+    ];
+
+    $scope.selectedDate = $scope.dates[0];
+
+    $scope.datePicker = {"visible":false};
+
+    $scope.$watch('selectedDate',function() {
+        var numOfDays = $scope.selectedDate.numOfDays;
+        $scope.report.startDate = $scope.today;
+        if ($scope.selectedDate) {
+            if (numOfDays) {
+                $scope.datePicker.visible = false;
+                if (numOfDays === 1) {
+                    $scope.report.endDate = $scope.today;
+                } else {
+                    $scope.report.endDate = DateUtils.getDateAfterOffsetDays(numOfDays);
+                }
+            } else {
+                $scope.datePicker.visible = true;
+            }
+        }
+    });
+
+
     
     $scope.generateReportHeader = function(){
         return TEIGridService.getHeader($scope.gridColumns);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2015-12-02 11:45:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2016-02-09 15:59:55 +0000
@@ -57,9 +57,9 @@
                         <td>
                             <select ng-model="selectedProgram"
                                     class="form-control"
-                                    ng-options="program as program.name for program in programs | orderBy: 'name'" 
-                                    ng-disabled="programs.length < 1">
-                                <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists'| translate}}</option>
+                                    ng-options="program as program.name for program in programs | orderBy: 'name'"
+                                    ng-disabled="programs.length < 1" ng-selected="programs.length === 1">
+                                <option ng-if="programs.length !== 1" value="">{{programs.length > 1 ? 'please_select_a_program' : 'no_program_exists'| translate}}</option>
                             </select>
                         </td>
                     </tr>
@@ -81,10 +81,40 @@
                             </label>                                
                         </td>
                     </tr>
+                    <tr>
+                        <td>
+                            {{'date'| translate}}
+                        </td>
+                        <td>
+                            <select ng-model="selectedDate" class="form-control"
+                                    ng-options="date as date.name for date in dates | orderBy: 'numOfDays'">
+                            </select>
+                        </td>
+                    </tr>
                 </table>
             </div>
+
+            <div class="col-md-5 trim" ng-if="!datePicker.visible">
+                <div class="row row-with-go-button">
+                    <button type="button" class="btn btn-primary" ng-click="generateReport()" ng-disabled="!selectedProgram">{{'go'| translate}}</button>
+                    <button type="button"
+                        class="btn btn-success small-horizonal-spacing"
+                        ng-if="upcomingEvents.length > 0"
+                        onclick="javascript:window.print()">
+                    {{'print'| translate}}
+                    </button>
+                    <button type="button"
+                        class="btn btn-info small-horizonal-spacing"
+                        ng-if="upcomingEvents.length > 0"
+                        ng-csv="generateReportData()"
+                        csv-header="generateReportHeader()"
+                        filename="upcomingEvents.csv">
+                    {{'excel_export'| translate}}
+                    </button>
+                </div>
+            </div>
         </div>
-        <div class="row">
+        <div class="row" ng-if="datePicker.visible">
             <div class="col-sm-8 col-md-6">
                 <table class="table-borderless">
                     <tr>
@@ -114,7 +144,7 @@
                         onclick="javascript:window.print()">
                     {{'print'| translate}}
                 </button>
-                <button type="button" 
+                <button type="button"
                         class="btn btn-info small-horizonal-spacing"
                         ng-if="upcomingEvents.length > 0"
                         ng-csv="generateReportData()"

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2016-02-04 10:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2016-02-09 15:59:55 +0000
@@ -460,3 +460,8 @@
 complete_enrollment_failed=Complete file failed
 are_you_sure_to_complete_enrollment_delete_schedule=Are you sure you want to complete this enrollment? Existing scheduled and overdue events will be deleted
 no_active_enrollment=No active enrollment. Please enroll to the right.
+events_today=Events due today
+events_in_one_week=Events due in a week
+events_in_two_weeks=Events due in two weeks
+events_in_one_month=Events due in a month
+choose_the_dates=Choose the dates

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app_in_ID.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app_in_ID.properties	2016-01-18 10:41:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app_in_ID.properties	2016-02-09 15:59:55 +0000
@@ -410,3 +410,9 @@
 audit_history_unavailable=There are no previous values stored, so audit history is not available for
 delete_error_audit=The event could not be deleted because it contains an auditlog.
 are_you_sure_to_remove=Are you sure you want to remove?
+events_today=Events due today
+events_in_one_week=Events due in a week
+events_in_two_weeks=Events due in two weeks
+events_in_one_month=Events due in a month
+choose_the_dates=Choose the dates
+

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2016-02-09 14:45:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2016-02-09 15:59:55 +0000
@@ -1920,3 +1920,8 @@
     width: 20px !important;
     text-align: center;
 }
+
+.row-with-go-button {
+    margin-top: 46%;
+    margin-left: 1%;
+}
\ No newline at end of file