dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31391
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15971: notes for event capture - wip
------------------------------------------------------------
revno: 15971
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Sat 2014-07-05 11:16:51 +0200
message:
notes for event capture - wip
modified:
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html
--
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-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json 2014-06-22 07:04:04 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json 2014-07-05 09:16:51 +0000
@@ -37,6 +37,7 @@
"hide": "Hide",
"select_columns_to_show": "Select columns to show",
"show_details": "Show details",
+ "add_your_comment_here": "Add your comment here",
"new_event": "New Event",
"data_element": "Data element",
"value": "Value",
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-06-25 05:31:09 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-07-05 09:16:51 +0000
@@ -1,5 +1,6 @@
<!DOCTYPE html>
-<html manifest="event-capture.appcache" ng-app="eventCapture">
+<html ng-app="eventCapture">
+<!--<html manifest="event-capture.appcache" ng-app="eventCapture">-->
<head>
<title>Event Capture</title>
@@ -45,7 +46,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
- <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>
+ <!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>-->
<script type="text/javascript" src="../dhis-web-commons/ouwt/ouwt.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-06-13 06:12:21 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-07-05 09:16:51 +0000
@@ -36,6 +36,7 @@
$scope.displayCustomForm = false;
$scope.currentElement = {id: '', update: false};
$scope.selectedOrgUnit = '';
+ $scope.note = {};
//watch for selection of org unit from tree
$scope.$watch('selectedOrgUnit', function(newObj, oldObj) {
@@ -125,7 +126,12 @@
//for date type dataelements, filtering is based on start and end dates
var dataElement = prStDe.dataElement;
var name = dataElement.formName || dataElement.name;
- $scope.newDhis2Event.dataValues.push({id: dataElement.id, value: ''});
+
+ $scope.newDhis2Event.dataValues.push({id: dataElement.id, value: ''});
+ if($scope.selectedProgramStage.captureCoordinates){
+ $scope.newDhis2Event.coordinate = {};
+ }
+
$scope.eventGridColumns.push({name: name, id: dataElement.id, type: dataElement.type, compulsory: prStDe.compulsory, showFilter: false, show: prStDe.displayInReports});
$scope.filterTypes[dataElement.id] = dataElement.type;
@@ -304,11 +310,11 @@
$scope.showEventRegistration = function(){
$scope.displayCustomForm = $scope.customForm ? true:false;
- $scope.eventRegistration = !$scope.eventRegistration;
- $scope.currentEvent = $scope.newDhis2Event;
+ $scope.eventRegistration = !$scope.eventRegistration;
+ $scope.currentEvent = angular.copy($scope.newDhis2Event);
$scope.outerForm.submitted = false;
- $scope.currentEvent = {};
+ //$scope.currentEvent = {};
};
$scope.showEditEventInGrid = function(){
@@ -356,7 +362,7 @@
dataValues.push({dataElement: dataElement, value: $scope.currentEvent[dataElement]});
}
- var newEvent = angular.copy($scope.currentEvent);
+ var newEvent = angular.copy($scope.currentEvent);
//prepare the event to be created
var dhis2Event = {
@@ -366,7 +372,12 @@
status: 'ACTIVE',
eventDate: $filter('date')(newEvent.eventDate, 'yyyy-MM-dd'),
dataValues: dataValues
- };
+ };
+
+ if(!angular.isUndefined($scope.note.value) && $scope.note.value != ''){
+ console.log('the note is: ', $scope.note.value);
+ dhis2Event.notes = [{value: $scope.note.value}];
+ }
if($scope.selectedProgramStage.captureCoordinates){
dhis2Event.coordinate = {latitude: $scope.currentEvent.coordinate.latitude ? $scope.currentEvent.coordinate.latitude : '',
@@ -400,7 +411,9 @@
$scope.editingEventInGrid = false;
$scope.outerForm.submitted = false;
}
- $scope.currentEvent = {};
+ //reset form
+ $scope.currentEvent = angular.copy($scope.newDhis2Event);
+ $scope.note = {};
$scope.outerForm.submitted = false;
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2014-06-03 06:19:46 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2014-07-05 09:16:51 +0000
@@ -223,7 +223,30 @@
element.draggable();
}
};
-})
+})
+
+.directive('d2PopOver', function($compile, $templateCache){
+ return {
+ restrict: 'EA',
+ link: function(scope, element, attrs){
+ var content = $templateCache.get("note.html");
+ content = $compile(content)(scope);
+ var options = {
+ content: content,
+ placement: 'bottom',
+ trigger: 'hover',
+ html: true,
+ title: scope.title
+ };
+ $(element).popover(options);
+ },
+ scope: {
+ content: '=',
+ title: '@details',
+ template: "@template"
+ }
+ };
+})
.directive('serversidePaginator', function factory() {
return {
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css 2014-06-24 12:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css 2014-07-05 09:16:51 +0000
@@ -504,4 +504,8 @@
}
select {
padding: 3px;
+}
+
+.clear {
+ clear: both
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html 2014-06-24 12:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html 2014-07-05 09:16:51 +0000
@@ -47,4 +47,23 @@
</tr>
</table>
<hr>
-<dhis-custom-form custom-form-type="PROGRAM_STAGE" custom-form-object="selectedProgramStage"></dhis-custom-form>
\ No newline at end of file
+<dhis-custom-form custom-form-type="PROGRAM_STAGE" custom-form-object="selectedProgramStage"></dhis-custom-form>
+<div class="clear">
+ <hr>
+ <textarea rows="3" ng-model="note.value" placeholder="{{'add_your_comment_here'| translate}}" style="width:50%;"></textarea>
+ <table class="dhis2-list-table-striped" style='width: 50%;'>
+ <tr ng-repeat="note in currentEvent.notes">
+ <td colspan="2" class="over-flow-hidden" style="width:99.5%;">
+ <d2-pop-over content="note" template="note.html" details="{{'details'| translate}}">
+ <div>{{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>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-06-24 12:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-07-05 09:16:51 +0000
@@ -114,6 +114,24 @@
</div>
</ng-form>
</td>
- </tr>
+ </tr>
</tbody>
-</table>
\ No newline at end of file
+</table>
+
+<textarea rows="3" ng-model="note.value" placeholder="{{'add_your_comment_here'| translate}}" style="width:99%;"></textarea>
+
+<table class="dhis2-list-table-striped">
+ <tr ng-repeat="note in currentEvent.notes">
+ <td colspan="2" class="over-flow-hidden" style="width:99.5%;">
+ <d2-pop-over content="note" template="note.html" details="{{'details'| translate}}">
+ <div>{{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>
\ No newline at end of file