dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32161
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16434: tracker capture - print feature for tei based program reports
------------------------------------------------------------
revno: 16434
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-08-18 12:01:22 +0200
message:
tracker capture - print feature for tei based program reports
added:
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/screen.css
modified:
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html
dhis-2/dhis-web/dhis-web-tracker-capture/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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2014-07-15 13:13:11 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2014-08-18 10:01:22 +0000
@@ -1,5 +1,5 @@
<div class="container-1-1">
- <div class="col-sm-12 vertical-spacing">
+ <div class="col-sm-12 vertical-spacing not-printable">
<button type="button" class="btn btn-default" ng-click="back()">{{'back'| translate}}</button>
@@ -30,14 +30,14 @@
<div class="col-sm-6 col-md-8">
<div sortable class="row connectedSortable empty-dashboard-container">
<div ng-repeat="biggerWidget in biggerDashboardWidgets">
- <div class="col-sm-12" ng-show="biggerWidget.show" ng-include="biggerWidget.view"></div>
+ <div class="col-sm-12" ng-show="biggerWidget.show" ng-include="biggerWidget.view" ng-class="{true: 'not-printable'} [biggerWidget.title != 'report']"></div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div sortable class="row connectedSortable empty-dashboard-container">
<div class="col-sm-12" ng-repeat="smallerWidget in smallerDashboardWidgets">
- <div ng-show="smallerWidget.show" ng-include="smallerWidget.view"></div>
+ <div ng-show="smallerWidget.show" ng-include="smallerWidget.view" ng-class="{true: 'not-printable'} [smallerWidget.title != 'report']"></div>
</div>
</div>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html 2014-07-21 13:20:58 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html 2014-08-18 10:01:22 +0000
@@ -1,6 +1,6 @@
<div class="modal-header">
<h1>{{selectedProgram.name}} {{'report'| translate}}</h1>
- <span class="pull-right bold">
+ <span class="pull-right">
{{'date'| translate}}: {{today}}
</span>
</div>
@@ -9,7 +9,7 @@
<div class="col-sm-6">
<h2>{{selectedProgram.trackedEntity.name}} {{'_details'| translate}}</h2>
<table class="table table-bordered table-compact">
- <tr ng-repeat="attribute in selectedTei.attributes" ng-show="attribute.show">
+ <tr ng-repeat="attribute in tei.attributes" ng-show="attribute.show">
<td class="bold">
{{attribute.displayName}}
</td>
@@ -47,7 +47,7 @@
</div>
<h2 class='col-sm-12'>{{'visits'| translate}}</h2>
- <div class='vertical-spacing' ng-repeat="dhis2Event in report.enrollments[enrollment.enrollment] | orderBy:'sortingDate':reverse">
+ <div class='vertical-spacing' ng-repeat="dhis2Event in selectedReport.enrollments[enrollment.enrollment] | orderBy:'sortingDate':reverse">
<!--<h3 class='col-sm-12'>{{'visits'| translate}}</h3>-->
<div class="col-sm-2">
<span class="bold">{{'name'| translate}}:</span> {{dhis2Event.name}}
@@ -92,7 +92,7 @@
</table>
</div>
<div class="alert alert-warning visit-details col-sm-6" ng-if="!dhis2Event.visited">{{'visit_not_made'| translate}}</div>
- <div class="alert alert-warning visit-details col-sm-6" ng-if="!dhis2Event.dataValues">{{'no_data'| translate}}</div>
+ <div class="alert alert-warning visit-details col-sm-6" ng-if="!dhis2Event.dataValues && dhis2Event.visited">{{'no_data'| translate}}</div>
<div class='row vertical-spacing'></div>
<div ng-if="dhis2Event.notes">
<h4 class='col-sm-12'>{{'notes'| translate}}</h4>
@@ -107,11 +107,12 @@
</tr>
</table>
</div>
- <hr class="visit-details" ng-show="$index < report.enrollments[enrollment.enrollment].length - 1">
+ <hr class="visit-details" ng-show="$index < selectedReport.enrollments[enrollment.enrollment].length - 1">
</div>
</div>
</div>
-<div class="modal-footer">
- <button class="btn btn-default" data-ng-click="close()">{{'close'| translate}}</button>
+<div class="modal-footer not-printable">
+ <button class="btn btn-default" data-ng-click="close()">{{'close'| translate}}</button>
+ <button class="btn btn-primary" data-ng-click="print()" onclick="javascript:window.print()">{{'print'| translate}}</button>
</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/report/report-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js 2014-07-21 13:20:58 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js 2014-08-18 10:01:22 +0000
@@ -162,17 +162,20 @@
//conroller for tei report
.controller('TeiReportController',
function($scope,
- $modal,
+ $filter,
CurrentSelection,
storage,
DateUtils,
EventUtils,
+ TEIService,
TranslationService,
ProgramFactory,
+ ProgramStageFactory,
+ EnrollmentService,
DHIS2EventFactory) {
TranslationService.translate();
-
+ $scope.showProgramReportDetailsDiv = false;
$scope.programs = [];
$scope.programNames = [];
$scope.programStageNames = [];
@@ -188,6 +191,7 @@
});
$scope.$on('dashboardWidgets', function(event, args) {
+ $scope.showProgramReportDetailsDiv = false;
var selections = CurrentSelection.get();
$scope.selectedOrgUnit = storage.get('SELECTED_OU');
$scope.selectedTei = selections.tei;
@@ -216,7 +220,6 @@
});
DHIS2EventFactory.getEventsByProgram($scope.selectedTei.trackedEntityInstance, orgUnitId, programId).then(function(eventList){
-
angular.forEach(eventList, function(ev){
if(ev.program){
ev.visited = true;
@@ -256,119 +259,75 @@
});
};
-
-
$scope.showProgramReportDetails = function(pr){
- var modalInstance = $modal.open({
- templateUrl: 'components/report/program-details.html',
- controller: 'ProgramDetailsController',
- windowClass: 'modal-full-window',
- resolve: {
- program: function () {
- return pr;
- },
- report: function(){
- return $scope.report[pr.id];
- },
- selectedTei: function(){
- return $scope.selectedTei;
- },
- entityName: function(){
- return $scope.selectedEntity.name;
- },
- reportMode: function(){
- return 'TEI';
+ $scope.showProgramReportDetailsDiv = !$scope.showProgramReportDetailsDiv;
+ $scope.selectedProgram = pr;
+ $scope.selectedReport = $scope.report[pr.id];
+
+ //today as report date
+ $scope.today = moment();
+ $scope.today = Date.parse($scope.today);
+ $scope.today = $filter('date')($scope.today, 'yyyy-MM-dd');
+
+ //process tei attributes, this is to have consistent display so that the tei
+ //contains program attributes whether it has value or not
+ TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, null).then(function(tei){
+ $scope.tei = tei;
+ });
+
+ //get program stage for the selected program
+ //they are needed assign data element names for event data values
+ $scope.programStages = [];
+ $scope.allowProvidedElsewhereExists = [];
+ angular.forEach($scope.selectedProgram.programStages, function(st){
+ ProgramStageFactory.get(st.id).then(function(stage){
+ $scope.programStages[stage.id] = stage;
+ var providedElsewhereExists = false;
+ for(var i=0; i<stage.programStageDataElements.length && !providedElsewhereExists; i++){
+ if(stage.programStageDataElements[i].allowProvidedElsewhere){
+ providedElsewhereExists = true;
+ $scope.allowProvidedElsewhereExists[st.id] = true;
+ }
+ }
+ });
+ });
+
+ //program reports come grouped in enrollment, process for each enrollment
+ $scope.enrollments = [];
+ angular.forEach(Object.keys($scope.selectedReport.enrollments), function(enr){
+ //format report data values
+ angular.forEach($scope.selectedReport.enrollments[enr], function(ev){
+ angular.forEach(ev.notes, function(note){
+ note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+ });
+
+ if(ev.dataValues){
+ angular.forEach(ev.dataValues, function(dv){
+ if(dv.dataElement){
+ ev[dv.dataElement] = dv;
+ }
+ });
}
- }
- });
-
- modalInstance.result.then({
- });
- };
-})
-
-//Controller for program details
-.controller('ProgramDetailsController',
- function($scope,
- $modalInstance,
- $filter,
- ProgramStageFactory,
- TEIService,
- EnrollmentService,
- DateUtils,
- program,
- report,
- selectedTei,
- entityName,
- reportMode){
-
- $scope.selectedTei = selectedTei;
- $scope.entityName = entityName;
- $scope.reportMode = reportMode;
- $scope.selectedProgram = program;
- $scope.report = report;
-
- //today as report date
- $scope.today = moment();
- $scope.today = Date.parse($scope.today);
- $scope.today = $filter('date')($scope.today, 'yyyy-MM-dd');
-
- //process tei attributes, this is to have consistent display that the tei
- //contains program attributes whether is has value or not
- TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, null).then(function(tei){
- $scope.selectedTei = tei;
- });
-
- //get program stage for the selected program
- //they are needed assign data element names for event data values
- $scope.programStages = [];
- $scope.allowProvidedElsewhereExists = [];
- angular.forEach($scope.selectedProgram.programStages, function(st){
- ProgramStageFactory.get(st.id).then(function(stage){
- $scope.programStages[stage.id] = stage;
- var providedElsewhereExists = false;
- for(var i=0; i<stage.programStageDataElements.length && !providedElsewhereExists; i++){
- if(stage.programStageDataElements[i].allowProvidedElsewhere){
- providedElsewhereExists = true;
- $scope.allowProvidedElsewhereExists[st.id] = true;
- }
- }
- });
- });
-
- //program reports come grouped in enrollment
- //process for each enrollment
- $scope.enrollments = [];
- angular.forEach(Object.keys($scope.report.enrollments), function(enr){
- //format report data values
- angular.forEach($scope.report.enrollments[enr], function(ev){
- angular.forEach(ev.notes, function(note){
- note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
- });
-
- if(ev.dataValues){
- angular.forEach(ev.dataValues, function(dv){
- if(dv.dataElement){
- ev[dv.dataElement] = dv;
- }
- });
- }
- });
-
- //get enrollment details
- EnrollmentService.get(enr).then(function(enrollment){
- enrollment.dateOfEnrollment = DateUtils.format(enrollment.dateOfEnrollment);
- enrollment.dateOfIncident = DateUtils.format(enrollment.dateOfIncident);
- angular.forEach(enrollment.notes, function(note){
- note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
- });
- $scope.enrollments.push(enrollment);
- });
- });
-
- $scope.close = function () {
- $modalInstance.close();
- };
-
+ });
+
+ //get enrollment details
+ EnrollmentService.get(enr).then(function(enrollment){
+ enrollment.dateOfEnrollment = DateUtils.format(enrollment.dateOfEnrollment);
+ enrollment.dateOfIncident = DateUtils.format(enrollment.dateOfIncident);
+ angular.forEach(enrollment.notes, function(note){
+ note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+ });
+ $scope.enrollments.push(enrollment);
+ });
+ });
+ };
+
+ $scope.close = function(){
+ $scope.showProgramReportDetailsDiv = false;
+ };
+
+ $scope.print = function(){
+ $scope.showProgramReportDetailsDiv = false;
+ };
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report.html 2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report.html 2014-08-18 10:01:22 +0000
@@ -1,5 +1,5 @@
<div class="panel panel-default" ng-controller="TeiReportController">
- <div class="panel-heading handle bold">
+ <div class="panel-heading handle bold not-printable">
{{reportWidget.title| translate}}
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(reportWidget)">
@@ -11,7 +11,7 @@
</div>
<div ng-show="reportWidget.expand" class="panel-body dashboard-widget-container">
<div ng-if="!dataExists" class="alert alert-warning">{{'no_data_report'| translate}}</div>
- <div ng-if="dataExists" class="remove-default-padding">
+ <div ng-if="dataExists" class="remove-default-padding not-printable">
<table class="table table-striped dhis2-table-hover">
<tr ng-click="showProgramReportDetails(pr)" ng-repeat="pr in programs" ng-if="report[pr.id].enrollments" title="{{'details'| translate}}">
<td>
@@ -20,5 +20,8 @@
</tr>
</table>
</div>
+ <div ng-if="showProgramReportDetailsDiv">
+ <div ng-class="printable" ng-include="'components/report/program-details.html'"></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/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-08-13 08:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-08-18 10:01:22 +0000
@@ -140,6 +140,7 @@
"select_widgets_to_show": "Select widgets to show",
"close": "Close",
"generate": "Generate",
+ "print": "Print",
"list_programs": "List programs",
"program_stage": "Program stage",
"due_date": "Due date",
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html 2014-07-07 15:04:56 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html 2014-08-18 10:01:22 +0000
@@ -82,11 +82,12 @@
<link type="text/css" rel="stylesheet" href="../dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
- <link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/light_blue/light_blue.css"/>
- <link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/widgets.css"/>
+ <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/light_blue/light_blue.css"/>
+ <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/widgets.css"/>
<link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css">
<link type="text/css" rel="stylesheet" href="styles/style.css">
+ <link type="text/css" rel="stylesheet" media="screen" href="styles/screen.css">
<script type="text/javascript" src="../main.js"></script>
=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/screen.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/screen.css 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/screen.css 2014-08-18 10:01:22 +0000
@@ -0,0 +1,17 @@
+/*
+To change this license header, choose License Headers in Project Properties.
+To change this template file, choose Tools | Templates
+and open the template in the editor.
+*/
+/*
+ Created on : Aug 18, 2014, 11:31:40 AM
+ Author : abyot
+*/
+
+html, body {
+ height:100%;
+ margin: 0;
+ padding: 0;
+ background-color: white;
+ font-size: 10pt;
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-07-23 15:14:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-08-18 10:01:22 +0000
@@ -1,11 +1,3 @@
-html, body {
- height:100%;
- margin: 0;
- padding: 0;
- background-color: white;
- font-size: 10pt;
-}
-
h1 {
font-size: 1.8em;
}
@@ -659,26 +651,26 @@
}
.form-control-program:focus {
- border-color: #66afe9;
- outline: 0;
- -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6);
- box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6)
+ border-color: #66afe9;
+ outline: 0;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6);
+ box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6)
}
.form-control-program:-moz-placeholder {
- color: #999
+ color: #999
}
.form-control-program::-moz-placeholder {
- color: #999
+ color: #999
}
.form-control-program:-ms-input-placeholder {
- color: #999
+ color: #999
}
.form-control-program::-webkit-input-placeholder {
- color: #999
+ color: #999
}
.form-control-program[disabled], .form-control-program[readonly], fieldset[disabled] .form-control-program {
- cursor: not-allowed;
- background-color: #eee
+ cursor: not-allowed;
+ background-color: #eee
}
.form-control-select2 {
@@ -767,4 +759,14 @@
.dropdown-menu-right{
right: 0;
left: auto;
+}
+
+
+@media print {
+ #header, #leftBar, .not-printable {
+ display: none;
+ }
+
+
+
}
\ No newline at end of file