dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31466
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16031: tracker capture - program based report completed; tei based report, WIP
------------------------------------------------------------
revno: 16031
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2014-07-08 21:07:43 +0200
message:
tracker capture - program based report completed; tei based report, WIP
added:
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/eventDetails.html
modified:
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.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
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/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
=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/eventDetails.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/eventDetails.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/eventDetails.html 2014-07-08 19:07:43 +0000
@@ -0,0 +1,83 @@
+<div class="modal-header">
+ <h2>{{'details'| translate}}</h2>
+</div>
+<div class="modal-body">
+ <div class='row'>
+ <table class="table-borderless table-striped">
+ <tr>
+ <th colspan="2">
+ {{entityName}}
+ </th>
+ </tr>
+ <tr class="col-md-12" ng-repeat="gridColumn in gridColumns">
+ <td class="col-md-6">
+ {{gridColumn.name}}
+ </td>
+ <td class="col-md-6">
+ <input type="text" ng-model="selectedTei[gridColumn.id]" ng-disabled='true'/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class='row' ng-if='currentEvent'>
+ <hr>
+ <span class="bold">
+ {{currentEvent.name}} | {{currentEvent.orgUnitName}} | {{currentEvent.eventDate}}
+ </span>
+ <table class="table-borderless table-striped">
+ <thead>
+ <tr class="col-md-12">
+ <th class="col-md-5">
+ {{'data_element'| translate}}
+ </th>
+ <th class="col-md-5">
+ {{'value'| translate}}
+ </th>
+ <th class="col-md-2" ng-if="allowProvidedElsewhereExists">
+ {{'provided_elsewhere'| translate}}
+ </th>
+ </tr>
+ </thead>
+ <tr class="col-md-12" ng-repeat="prStDe in currentStage.programStageDataElements">
+ <td class="col-md-5">
+ {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
+ </td>
+ <td class="col-md-5">
+ <input type="text" ng-model="currentEvent[prStDe.dataElement.id]" ng-disabled='true'/>
+ </td>
+ <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-disabled='true'/>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="row" ng-if='currentEvent.notes'>
+ <hr>
+ <table class="table-borderless table-striped dhis2-table-hover">
+ <tr>
+ <th>
+ {{'notes' | translate}}
+ </th>
+ </tr>
+ <tr class="col-md-12" ng-repeat="note in currentEvent.notes">
+ <td class="over-flow-hidden">
+ <d2-pop-over content="note" template="note.html" details="{{'details'| translate}}">
+ <div class='col-md-12'>{{note.value}}</div>
+ </d2-pop-over>
+ <script type="text/ng-template" id="note.html">
+ <p>{{content.value}}</p>
+ <hr>
+ <p><strong>{{'created_by' | translate}}: </strong>{{content.storedBy}}</p>
+ <p><strong>{{'date' | translate}}: </strong>{{content.storedDate}}</p>
+ </script>
+ </td>
+ </tr>
+ </table>
+ <!--</div> -->
+ </div>
+</div>
+<div class="modal-footer">
+ <button class="btn btn-default" data-ng-click="close()">{{'close'| 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-08 16:14:36 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js 2014-07-08 19:07:43 +0000
@@ -1,7 +1,6 @@
trackerCapture.controller('ReportController',
function($scope,
- CurrentSelection,
- storage,
+ $modal,
DateUtils,
EventUtils,
TEIService,
@@ -73,11 +72,85 @@
});
};
- $scope.showEventDetails = function(dhis2Event){
- console.log('I will show details of...: ', dhis2Event);
+ $scope.showEventDetails = function(dhis2Event, selectedTei){
+
+ var modalInstance = $modal.open({
+ templateUrl: 'components/report/eventDetails.html',
+ controller: 'EventDetailsController',
+ resolve: {
+ dhis2Event: function () {
+ return dhis2Event;
+ },
+ gridColumns: function(){
+ return $scope.gridColumns;
+ },
+ selectedTei: function(){
+ return selectedTei;
+ },
+ entityName: function(){
+ return $scope.selectedProgram.trackedEntity.name;
+ }
+ }
+ });
+
+ modalInstance.result.then({
+ });
};
})
+//Controller for event details
+.controller('EventDetailsController',
+ function($scope,
+ $modalInstance,
+ orderByFilter,
+ ProgramStageFactory,
+ dhis2Event,
+ selectedTei,
+ gridColumns,
+ entityName){
+
+ $scope.selectedTei = selectedTei;
+ $scope.gridColumns = gridColumns;
+ $scope.entityName = entityName;
+ $scope.currentEvent = dhis2Event;
+ $scope.currentEvent.providedElsewhere = [];
+
+ if(!angular.isUndefined( $scope.currentEvent.notes)){
+ $scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate');
+ angular.forEach($scope.currentEvent.notes, function(note){
+ note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+ });
+ }
+
+ ProgramStageFactory.get($scope.currentEvent.programStage).then(function(stage){
+ $scope.currentStage = stage;
+
+ $scope.allowProvidedElsewhereExists = false;
+ angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
+ $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
+ if(prStDe.allowProvidedElsewhere){
+ $scope.allowProvidedElsewhereExists = true;
+ $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = '';
+ }
+ });
+ angular.forEach($scope.currentEvent.dataValues, function(dataValue){
+ var val = dataValue.value;
+ if(val){
+ var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
+ if( de && de.type === 'int' && val){
+ val = parseInt(val);
+ dataValue.value = val;
+ }
+ $scope.currentEvent[dataValue.dataElement] = val;
+ }
+ });
+ });
+
+ $scope.close = function () {
+ $modalInstance.close();
+ };
+})
+
//conroller for tei report
.controller('TeiReportController',
function($scope,
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report.html 2014-07-08 16:14:36 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report.html 2014-07-08 19:07:43 +0000
@@ -74,13 +74,22 @@
<div class='bold vertical-center' ng-if='!dhis2Events[tei.id]'>{{'no_visit_made' | translate}}</div>
<div class="inline-block vertical-center" ng-repeat="ev in dhis2Events[tei.id] | orderBy: 'eventDate'">
<div class="block align-center">{{ev.orgUnitName}}</div>
+ <div class="empty-stage-container"
+ title="{{ev.dataValues ? 'details' : 'no_data_registerd' | translate}}"
+ ng-class="{'{{ev.statusColor}}': true}"
+ ng-if='!ev.dataValues'>
+ {{ev.name}}<br/>
+ {{ev.eventDate}}
+ </div>
<div class="stage-container"
title="{{ev.dataValues ? 'details' : 'no_data_registerd' | translate}}"
ng-class="{'{{ev.statusColor}}': true}"
- ng-click="showEventDetails(ev)">
+ ng-if='ev.dataValues'
+ ng-click="showEventDetails(ev, tei)">
{{ev.name}}<br/>
{{ev.eventDate}}
</div>
+
<i class="fa fa-arrow-right" ng-show="$index < dhis2Events[tei.id].length - 1"></i>
</div>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2014-07-08 16:14:36 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2014-07-08 19:07:43 +0000
@@ -75,7 +75,7 @@
$scope.attributes = atts;
$scope.attributes = $scope.generateAttributeFilters($scope.attributes);
- $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+ $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);
$scope.search($scope.searchMode.listAll);
});
}
@@ -105,7 +105,7 @@
$scope.$apply(function () {
$scope.attributes = atts;
$scope.attributes = $scope.generateAttributeFilters($scope.attributes);
- $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+ $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);
});
}, 100);
});
@@ -125,7 +125,7 @@
$scope.$apply(function () {
$scope.attributes = atts;
$scope.attributes = $scope.generateAttributeFilters($scope.attributes);
- $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+ $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);
});
}, 100);
});
@@ -136,7 +136,7 @@
$scope.$apply(function () {
$scope.attributes = atts;
$scope.attributes = $scope.generateAttributeFilters($scope.attributes);
- $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+ $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);
});
}, 100);
});
@@ -257,31 +257,6 @@
return attributes;
};
-
- //generate grid columns from teilist attributes
- $scope.generateGridColumns = function(attributes){
- var columns = attributes ? angular.copy(attributes) : [];
-
- //also add extra columns which are not part of attributes (orgunit for example)
- columns.push({id: 'orgUnitName', name: 'Organisation unit', type: 'string', displayInListNoProgram: false});
- columns.push({id: 'created', name: 'Registration date', type: 'string', displayInListNoProgram: false});
-
- //generate grid column for the selected program/attributes
- angular.forEach(columns, function(column){
- if(column.id === 'orgUnitName' && $scope.selectedOuMode.name !== 'SELECTED'){
- column.show = true;
- }
-
- if(column.displayInListNoProgram){
- column.show = true;
- }
-
- if(column.type === 'date'){
- $scope.filterText[column.id]= {start: '', end: ''};
- }
- });
- return columns;
- };
$scope.clearEntities = function(){
$scope.trackedEntityList = null;
=== 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-07-08 16:14:36 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-07-08 19:07:43 +0000
@@ -950,7 +950,7 @@
var columns = attributes ? angular.copy(attributes) : [];
//also add extra columns which are not part of attributes (orgunit for example)
- columns.push({id: 'orgUnitName', name: 'Organisation unit', type: 'string', displayInListNoProgram: false});
+ columns.push({id: 'orgUnitName', name: 'Registering unit', type: 'string', displayInListNoProgram: false});
columns.push({id: 'created', name: 'Registration date', type: 'string', displayInListNoProgram: false});
//generate grid column for the selected program/attributes
=== 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-08 16:14:36 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-07-08 19:07:43 +0000
@@ -11,15 +11,15 @@
}
h2 {
- font-size: 1.4em;
+ font-size: 1.6em;
}
h3 {
- font-size: 1em;
+ font-size: 1.2em;
}
h4 {
- font-size: 0.8em;
+ font-size: 1em;
font-weight: bold;
}
@@ -103,6 +103,16 @@
vertical-align: middle;
}
+.empty-stage-container {
+ display: inline-block;
+ width: 135px;
+ height: 60px;
+ opacity: 1.0;
+ white-space: normal;
+ padding-top: 5px;
+ text-align: center;
+}
+
.stage-container {
display: inline-block;
width: 135px;
@@ -488,6 +498,11 @@
width: 100%;
height: 100%;
}
+
+.modal-dialog {
+ top: 50%;
+
+}
.expanded{
border: 1px solid #aaa;
padding: 6px 8px;