dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31197
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15878: tracker capture - tei searching using multiple attributes, profile display based on program selec...
------------------------------------------------------------
revno: 15878
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Fri 2014-06-27 12:57:20 +0200
message:
tracker capture - tei searching using multiple attributes, profile display based on program selection and commenting in enrollment.
modified:
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.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/scripts/directives.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
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2014-06-25 14:08:18 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2014-06-27 10:57:20 +0000
@@ -6,7 +6,8 @@
$modal,
$timeout,
storage,
- TEIService,
+ TEIService,
+ TEService,
ProgramFactory,
CurrentSelection,
TranslationService) {
@@ -47,29 +48,35 @@
TEIService.get($scope.selectedEntityId).then(function(data){
$scope.selectedEntity = data;
- ProgramFactory.getAll().then(function(programs){
+ //get the entity type
+ TEService.get($scope.selectedEntity.trackedEntity).then(function(te){
+ $scope.trackedEntity = te;
+
+ ProgramFactory.getAll().then(function(programs){
- angular.forEach(programs, function(program){
- if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id) &&
- program.trackedEntity.id === $scope.selectedEntity.trackedEntity){
- $scope.programs.push(program);
- }
-
- if($scope.selectedProgramId && program.id === $scope.selectedProgramId){
- $scope.selectedProgram = program;
- }
+ //get programs valid for the selected ou and tei
+ angular.forEach(programs, function(program){
+ if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id) &&
+ program.trackedEntity.id === $scope.selectedEntity.trackedEntity){
+ $scope.programs.push(program);
+ }
+
+ if($scope.selectedProgramId && program.id === $scope.selectedProgramId){
+ $scope.selectedProgram = program;
+ }
+ });
+
+ //broadcast selected items for dashboard controllers
+ $scope.broadCastProgram();
});
-
- //broadcast selected items for dashboard controllers
- $scope.broadCastProgram();
- });
+ });
});
}
$scope.broadCastProgram = function(){
- CurrentSelection.set({tei: $scope.selectedEntity, pr: $scope.selectedProgram});
+ CurrentSelection.set({tei: $scope.selectedEntity, te: $scope.trackedEntity, pr: $scope.selectedProgram});
$timeout(function() {
- $rootScope.$broadcast('selectedEntity', {programExists: $scope.programs.length > 0});
+ $rootScope.$broadcast('selectedEntity', {programExists: $scope.programs.length > 0});
}, 100);
};
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-06-26 13:35:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-06-27 10:57:20 +0000
@@ -27,7 +27,7 @@
$scope.allowEventCreation = false;
$scope.repeatableStages = [];
- $scope.dhis2Events = [];
+ $scope.dhis2Events = null;
var selections = CurrentSelection.get();
$scope.selectedOrgUnit = storage.get('SELECTED_OU');
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-06-26 13:35:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-06-27 10:57:20 +0000
@@ -6,8 +6,8 @@
</span>
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(dataentryWidget)">
- <span ng-show="dataentryWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'collapse'| translate}}"></i></span>
- <span ng-show="!dataentryWidget.expand" class='black'><i class="fa fa-chevron-right" title="{{'expand'| translate}}"></i></span>
+ <span ng-show="dataentryWidget.expand" class='black'><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
+ <span ng-show="!dataentryWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'expand'| translate}}"></i></span>
</a>
<a class="small-horizonal-spacing" href ng-click="removeWidget(dataentryWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>
</span>
@@ -72,87 +72,87 @@
</form>
</div>
</div>
- <div>
- <form name="dataEntryOuterForm" novalidate>
- <hr>
- <table class="table-borderless table-striped" ng-if='currentEvent'>
- <thead>
- <tr class="col-md-12">
- <th class="col-md-5">
- {{'data_element'| translate}}
- </th>
- <th class="col-md-5 align-center">
- {{'value'| translate}}
- </th>
- <th class="col-md-2 align-center" 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.name}} - {{prStDe.dataElement.type}}
- </td>
- <td class="col-md-5">
- <ng-form name="dataEntryInnerForm">
- <div ng-switch="prStDe.dataElement.type">
- <div ng-switch-when="int">
- <input type="number"
- ng-class='getClass(prStDe.dataElement.id)'
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-blur="saveDatavalue(prStDe)"
- name="foo"/>
- <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" style="color:red;font-size:12px">{{'number_required' | translate}}</span>
- </div>
- <div ng-switch-when="string">
- <input type="text"
- ng-class='getClass(prStDe.dataElement.id)'
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- typeahead="option for option in prStDe.dataElement.optionSet.options | filter:$viewValue | limitTo:20"
- typeahead-open-on-focus
- ng-blur="saveDatavalue(prStDe)"
- name="foo"/>
- </div>
- <div ng-switch-when="bool">
- <select ng-class='getClass(prStDe.dataElement.id)'
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-change="saveDatavalue(prStDe)"
- name="foo">
- <option value="">{{'please_select'| translate}}</option>
- <option value="0">{{'no'| translate}}</option>
- <option value="1">{{'yes'| translate}}</option>
- </select>
+
+ <hr ng-if='currentEvent'>
+ <form name="dataEntryOuterForm" novalidate>
+ <table class="table-borderless table-striped" ng-if='currentEvent'>
+ <thead>
+ <tr class="col-md-12">
+ <th class="col-md-5">
+ {{'data_element'| translate}}
+ </th>
+ <th class="col-md-5 align-center">
+ {{'value'| translate}}
+ </th>
+ <th class="col-md-2 align-center" 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.name}} - {{prStDe.dataElement.type}}
+ </td>
+ <td class="col-md-5">
+ <ng-form name="dataEntryInnerForm">
+ <div ng-switch="prStDe.dataElement.type">
+ <div ng-switch-when="int">
+ <input type="number"
+ ng-class='getClass(prStDe.dataElement.id)'
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ ng-blur="saveDatavalue(prStDe)"
+ name="foo"/>
+ <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" style="color:red;font-size:12px">{{'number_required' | translate}}</span>
+ </div>
+ <div ng-switch-when="string">
+ <input type="text"
+ ng-class='getClass(prStDe.dataElement.id)'
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ typeahead="option for option in prStDe.dataElement.optionSet.options | filter:$viewValue | limitTo:20"
+ typeahead-open-on-focus
+ ng-blur="saveDatavalue(prStDe)"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="bool">
+ <select ng-class='getClass(prStDe.dataElement.id)'
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ ng-change="saveDatavalue(prStDe)"
+ name="foo">
+ <option value="">{{'please_select'| translate}}</option>
+ <option value="0">{{'no'| translate}}</option>
+ <option value="1">{{'yes'| translate}}</option>
+ </select>
- </div>
- <div ng-switch-when="date">
- <input type="text"
- placeholder="yyyy-mm-dd"
- ng-date
- ng-class='getClass(prStDe.dataElement.id)'
- ng-model="saveDatavalue(prStDe)"
- ng-required={{prStDe.compulsory}}
- blur-or-change="saveDatavalue(dhis2Event, eventGridColumn.id)"
- name="foo"/>
- </div>
- </div>
- </ng-form>
- </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-change="saveDatavalueLocation(prStDe)"/>
+ </div>
+ <div ng-switch-when="date">
+ <input type="text"
+ placeholder="yyyy-mm-dd"
+ ng-date
+ ng-class='getClass(prStDe.dataElement.id)'
+ ng-model="saveDatavalue(prStDe)"
+ ng-required={{prStDe.compulsory}}
+ blur-or-change="saveDatavalue(dhis2Event, eventGridColumn.id)"
+ name="foo"/>
+ </div>
</div>
- </td>
- </tr>
- </table>
- </form>
- </div>
+ </ng-form>
+ </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-change="saveDatavalueLocation(prStDe)"/>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </form>
+
<div ng-show="!selectedEnrollment">
- <div class="alert alert-warning">{{'not_yet_enrolled'| translate}}</div>
+ <div class="alert alert-warning">{{'not_yet_enrolled_data_entry'| translate}}</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/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2014-06-20 14:23:28 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2014-06-27 10:57:20 +0000
@@ -2,6 +2,7 @@
function($rootScope,
$scope,
$filter,
+ $timeout,
storage,
ProgramStageFactory,
AttributesFactory,
@@ -19,8 +20,8 @@
$scope.enrollments = [];
$scope.showEnrollmentDiv = false;
$scope.showSchedulingDiv = false;
- $scope.selectedProgram = '';
- $scope.selectedEnrollment = '';
+ $scope.selectedProgram = null;
+ $scope.selectedEnrollment = null;
$scope.newEnrollment = {};
var selections = CurrentSelection.get();
@@ -35,7 +36,10 @@
$scope.enrollments = data.enrollmentList;
$scope.loadEvents();
});
- }
+ }
+ else{
+ $scope.broadCastSelections();
+ }
});
$scope.loadEvents = function() {
@@ -83,14 +87,10 @@
});
});
- CurrentSelection.set({tei: $scope.selectedEntity, pr: $scope.selectedProgram, enrollment: $scope.selectedEnrollment});
- $rootScope.$broadcast('dashboard', {});
+ $scope.broadCastSelections();
}
else{
- $scope.selectedProgram = '';
- $scope.selectedEnrollment = '';
- CurrentSelection.set({tei: $scope.selectedEntity, pr: $scope.selectedProgram, enrollment: $scope.selectedEnrollment});
- $rootScope.$broadcast('dashboard', {});
+ $scope.broadCastSelections();
}
};
@@ -98,6 +98,14 @@
$scope.showEnrollmentDiv = !$scope.showEnrollmentDiv;
};
+ $scope.broadCastSelections = function(){
+ CurrentSelection.set({tei: $scope.selectedEntity, pr: $scope.selectedProgram, enrollment: $scope.selectedEnrollment});
+ $timeout(function() {
+ $rootScope.$broadcast('dashboard', {});
+ $rootScope.$broadcast('notesController', {});
+ }, 100);
+ };
+
$scope.showScheduling = function(){
$scope.showSchedulingDiv = !$scope.showSchedulingDiv;
};
@@ -153,6 +161,12 @@
$scope.selectedEntity.attributes.push({attribute: attribute.id, value: attribute.value, type: attribute.valueType, displayName: attribute.name});
}
});
+
+ enrollment.enrollment = enrollmentResponse.reference;
+ CurrentSelection.set({tei: $scope.selectedEntity, pr: $scope.selectedProgram, enrollment: enrollment});
+ $timeout(function() {
+ $rootScope.$broadcast('dashboard', {});
+ }, 100);
});
}
else{
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html 2014-06-25 14:08:18 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html 2014-06-27 10:57:20 +0000
@@ -3,8 +3,8 @@
{{enrollmentWidget.title| translate}}
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(enrollmentWidget)">
- <span ng-show="enrollmentWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'collapse'| translate}}"></i></span>
- <span ng-show="!enrollmentWidget.expand" class='black'><i class="fa fa-chevron-right" title="{{'expand'| translate}}"></i></span>
+ <span ng-show="enrollmentWidget.expand" class='black'><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
+ <span ng-show="!enrollmentWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'expand'| translate}}"></i></span>
</a>
<a class="small-horizonal-spacing" href ng-click="removeWidget(enrollmentWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>
</span>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js 2014-05-27 12:38:36 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js 2014-06-27 10:57:20 +0000
@@ -1,10 +1,69 @@
trackerCapture.controller('NotesController',
- function($scope,
- storage,
+ function($scope,
+ $rootScope,
+ EnrollmentService,
+ CurrentSelection,
+ orderByFilter,
TranslationService) {
TranslationService.translate();
- $scope.attributes = storage.get('ATTRIBUTES');
-
+ $scope.$on('notesController', function(event, args) {
+ $scope.selectedEnrollment = null;
+ var selections = CurrentSelection.get();
+ if(selections.enrollment){
+ EnrollmentService.get(selections.enrollment.enrollment).then(function(data){
+ $scope.selectedEnrollment = data;
+ if(!angular.isUndefined( $scope.selectedEnrollment.notes)){
+ $scope.selectedEnrollment.notes = orderByFilter($scope.selectedEnrollment.notes, '-storedDate');
+ angular.forEach($scope.selectedEnrollment.notes, function(note){
+ note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+ });
+ }
+ });
+ }
+ });
+
+ $scope.searchNoteField = false;
+ $scope.addNoteField = false;
+
+ $scope.showAddNote = function() {
+ $scope.addNoteField = true;
+ };
+
+ $scope.addNote = function(){
+
+ if(!angular.isUndefined($scope.note) && $scope.note != ""){
+
+ var newNote = {value: $scope.note};
+
+ if(angular.isUndefined( $scope.selectedEnrollment.notes) ){
+ $scope.selectedEnrollment.notes = [newNote];
+ }
+ else{
+ $scope.selectedEnrollment.notes.splice(0,0,newNote);
+ }
+
+ var e = $scope.selectedEnrollment;
+
+ e.notes = [newNote];
+ EnrollmentService.update(e).then(function(data){
+ $scope.note = '';
+ $scope.addNoteField = false; //note is added, hence no need to show note field.
+ CurrentSelection.set({enrollment: $scope.selectedEnrollment});
+ //$rootScope.$broadcast('notesController', {selectedEnrollment: $scope.selectedEnrollment.enrollment});
+ $rootScope.$broadcast('notesController', {});
+ });
+ }
+ };
+
+ $scope.closeAddNote = function(){
+ $scope.addNoteField = false;
+ $scope.note = '';
+ };
+
+ $scope.searchNote = function(){
+ $scope.searchNoteField = $scope.searchNoteField === false ? true : false;
+ $scope.noteSearchText = '';
+ };
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html 2014-06-25 14:08:18 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html 2014-06-27 10:57:20 +0000
@@ -1,15 +1,73 @@
<div class="panel panel-default" ng-controller="NotesController">
<div class="panel-heading">
{{notesWidget.title| translate}}
+ <span class="nav-pills" ng-show="selectedEnrollment.notes.length > 5">
+ | <a href ng-click="searchNote()" title="{{'search_note'| translate}}">{{'search'| translate}}</a>
+ </span>
+ <span class="nav-pills" ng-show="selectedEnrollment">
+ | <span><a href ng-click="showAddNote()" title="{{'add_note'| translate}}">{{'add'| translate}}</a></span>
+ </span>
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(notesWidget)">
- <span ng-show="notesWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'collapse'| translate}}"></i></span>
- <span ng-show="!notesWidget.expand" class='black'><i class="fa fa-chevron-right" title="{{'expand'| translate}}"></i></span>
+ <span ng-show="notesWidget.expand" class='black'><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
+ <span ng-show="!notesWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'expand'| translate}}"></i></span>
</a>
<a class="small-horizonal-spacing" href ng-click="removeWidget(notesWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>
</span>
</div>
<div ng-show="notesWidget.expand" class="panel-body dashboard-widget-container">
- This is notes.
+
+
+ <div ng-show="searchNoteField">
+ <div class="list-group">
+ <input class="form-control" ng-model="noteSearchText" ng-blur="searchNote()" placeholder="{{'search'| translate}}">
+ </div>
+ </div>
+ <div ng-show="addNoteField">
+ <div class="list-group">
+ <textarea class="form-control" rows="3" ng-model="note" placeholder="{{'add_your_note_here'| translate}}"></textarea>
+ </div>
+
+ <div class='vertical-spacing'>
+ <button type="button"
+ class="btn btn-default small-horizonal-spacing"
+ ng-click="addNote()">
+ {{'save'| translate}}
+ </button>
+ <button type="button"
+ class="btn btn-default small-horizonal-spacing"
+ ng-click="closeAddNote()">
+ {{'cancel'| translate}}
+ </button>
+ </div>
+ </div>
+
+
+ <div ng-show='selectedEnrollment' class='vertical-spacing remove-default-padding'>
+
+ <table class="table table-with-fixed-layout">
+ <tr ng-repeat="note in selectedEnrollment.notes| filter:noteSearchText">
+ <td class="over-flow-hidden">
+ <d2-pop-over content="note" template="note.html" details="{{'details'| translate}}">
+ <div class="pop-over">{{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 ng-show="!selectedEnrollment">
+ <div class="alert alert-warning">{{'not_yet_enrolled_note'| translate}}</div>
+ </div>
+ <div ng-show="selectedEnrollment && !selectedEnrollment.notes">
+ <div class="alert alert-info">{{'empty_notes'| translate}}</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/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2014-06-25 14:21:55 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2014-06-27 10:57:20 +0000
@@ -23,22 +23,17 @@
//listen for the selected entity
$scope.$on('selectedEntity', function(event, args) {
var selections = CurrentSelection.get();
- $scope.selectedEntity = selections.tei;
- $scope.selectedProgram = selections.pr;
- if($scope.selectedEntity){
- TEService.get($scope.selectedEntity.trackedEntity).then(function(te){
- $scope.trackedEntity = te;
- });
-
- $scope.processTeiAttributes();
- }
+ $scope.selectedTei = selections.tei;
+ $scope.trackedEntity = selections.te;
+ $scope.selectedProgram = selections.pr;
+ $scope.processTeiAttributes();
});
//display only those attributes that belong the selected program
//if no program, display attributesInNoProgram
$scope.processTeiAttributes = function(){
- angular.forEach($scope.selectedEntity.attributes, function(att){
+ angular.forEach($scope.selectedTei.attributes, function(att){
if(att.type === 'number' && !isNaN(parseInt(att.value))){
att.value = parseInt(att.value);
}
@@ -46,61 +41,64 @@
if($scope.selectedProgram){
//show only those attributes in selected program
- AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
-
- for(var i=0; i<atts.length; i++){
- var processed = false;
- for(var j=0; j<$scope.selectedEntity.attributes.length && !processed; j++){
- if(atts[i].id === $scope.selectedEntity.attributes[j].attribute){
- processed = true;
- $scope.selectedEntity.attributes[j].show = true;
- $scope.selectedEntity.attributes[j].order = i;
- }
- }
-
- if(!processed){//attribute was empty, so a chance to put some value
- $scope.selectedEntity.attributes.push({show: true, order: i, attribute: atts[i].id, displayName: atts[i].name, type: atts[i].valueType, value: ''});
- }
- }
+ AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
+
+ $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes);
+
});
}
else{
//show attributes in no program
AttributesFactory.getWithoutProgram().then(function(atts){
- for(var i=0; i<atts.length; i++){
- var processed = false;
- for(var j=0; j<$scope.selectedEntity.attributes.length && !processed; j++){
- if(atts[i].id === $scope.selectedEntity.attributes[j].attribute){
- processed = true;
- $scope.selectedEntity.attributes[j].show = true;
- $scope.selectedEntity.attributes[j].order = i;
- }
- }
+ $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes);
+
+ });
+ }
+
+ $scope.selectedTei.attributes = orderByFilter($scope.selectedTei.attributes, '-order');
+ $scope.selectedTei.attributes.reverse();
+ };
+
+ $scope.showRequiredAttributes = function(requiredAttributes, availableAttributes){
+
+ var teiAttributes = availableAttributes;
+ //first reset teiAttributes
+ for(var j=0; j<teiAttributes.length; j++){
+ teiAttributes[j].show = false;
+ }
+
+ //identify which ones to show
+ for(var i=0; i<requiredAttributes.length; i++){
+ var processed = false;
+ for(var j=0; j<teiAttributes.length && !processed; j++){
+ if(requiredAttributes[i].id === teiAttributes[j].attribute){
+ processed = true;
+ teiAttributes[j].show = true;
+ teiAttributes[j].order = i;
+ }
+ }
- if(!processed){//attribute was empty, so a chance to put some value
- $scope.selectedEntity.attributes.push({show: true, order: i, attribute: atts[i].id, displayName: atts[i].name, type: atts[i].valueType, value: ''});
- }
- }
- });
+ if(!processed){//attribute was empty, so a chance to put some value
+ teiAttributes.push({show: true, order: i, attribute: requiredAttributes[i].id, displayName: requiredAttributes[i].name, type: requiredAttributes[i].valueType, value: ''});
+ }
}
- $scope.selectedEntity.attributes = orderByFilter($scope.selectedEntity.attributes, '-order');
- $scope.selectedEntity.attributes.reverse();
+ return teiAttributes;
};
$scope.enableEdit = function(){
- $scope.entityAttributes = angular.copy($scope.selectedEntity.attributes);
+ $scope.entityAttributes = angular.copy($scope.selectedTei.attributes);
$scope.editProfile = !$scope.editProfile;
$rootScope.profileWidget.expand = true;
};
$scope.save = function(){
- var tei = angular.copy($scope.selectedEntity);
+ var tei = angular.copy($scope.selectedTei);
tei.attributes = [];
//prepare to update the tei on the server side
- angular.forEach($scope.selectedEntity.attributes, function(attribute){
+ angular.forEach($scope.selectedTei.attributes, function(attribute){
if(!angular.isUndefined(attribute.value)){
tei.attributes.push({attribute: attribute.attribute, value: attribute.value});
}
@@ -121,7 +119,7 @@
};
$scope.cancel = function(){
- $scope.selectedEntity.attributes = $scope.entityAttributes;
+ $scope.selectedTei.attributes = $scope.entityAttributes;
$scope.editProfile = !$scope.editProfile;
};
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html 2014-06-25 14:08:18 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html 2014-06-27 10:57:20 +0000
@@ -1,20 +1,20 @@
<div class="panel panel-default" ng-controller="ProfileController">
<div class="panel-heading">
{{trackedEntity.name|| 'entity' | translate}} {{profileWidget.title| translate}}
- <span class="nav-pills" ng-show="selectedEntity.attributes.length">
+ <span class="nav-pills" ng-show="selectedTei.attributes.length">
| <span><a href ng-click="enableEdit()" title="{{'edit_profile'| translate}}">{{'edit'| translate}}</a></span>
</span>
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(profileWidget)">
- <span ng-show="profileWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'collapse'| translate}}"></i></span>
- <span ng-show="!profileWidget.expand" class='black'><i class="fa fa-chevron-right" title="{{'expand'| translate}}"></i></span>
+ <span ng-show="profileWidget.expand" class='black'><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
+ <span ng-show="!profileWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'expand'| translate}}"></i></span>
</a>
<a class="small-horizonal-spacing" href ng-click="removeWidget(profileWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>
</span>
</div>
<div ng-show="profileWidget.expand" class="widget-content-container">
<table class="table-borderless table-striped">
- <tr ng-repeat="attribute in selectedEntity.attributes" ng-show="attribute.show">
+ <tr ng-repeat="attribute in selectedTei.attributes" ng-show="attribute.show">
<td>
{{attribute.displayName}}
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html 2014-06-25 14:08:18 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html 2014-06-27 10:57:20 +0000
@@ -3,8 +3,8 @@
{{relationshipWidget.title| translate}}
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(relationshipWidget)">
- <span ng-show="relationshipWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'collapse'| translate}}"></i></span>
- <span ng-show="!relationshipWidget.expand" class='black'><i class="fa fa-chevron-right" title="{{'expand'| translate}}"></i></span>
+ <span ng-show="relationshipWidget.expand" class='black'><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
+ <span ng-show="!relationshipWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'expand'| translate}}"></i></span>
</a>
<a class="small-horizonal-spacing" href ng-click="removeWidget(relationshipWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>
</span>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.html 2014-06-25 14:08:18 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.html 2014-06-27 10:57:20 +0000
@@ -3,8 +3,8 @@
{{selectedWidget.title| translate}}
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(selectedWidget)">
- <span ng-show="selectedWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'collapse'| translate}}"></i></span>
- <span ng-show="!selectedWidget.expand" class='black'><i class="fa fa-chevron-right" title="{{'expand'| translate}}"></i></span>
+ <span ng-show="selectedWidget.expand" class='black'><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
+ <span ng-show="!selectedWidget.expand" class='black'><i class="fa fa-chevron-down" title="{{'expand'| translate}}"></i></span>
</a>
<a class="small-horizonal-spacing" href ng-click="removeWidget(selectedWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>
</span>
=== 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-06-26 13:35:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-06-27 10:57:20 +0000
@@ -6,7 +6,9 @@
"please_select_a_program": "[Please select a program]",
"please_select_a_program_for_enrollment": "Please select a program for enrollment.",
"no_program_exists": "No program exists for the selected org unit. Enrollment not possible.",
- "not_yet_enrolled": "Not yet enrolled. Data entry not possible.",
+ "not_yet_enrolled_data_entry": "Not yet enrolled. Data entry not possible.",
+ "not_yet_enrolled_note": "Not yet enrolled. Note recording not possible.",
+ "empty_notes": "Empty notes list.",
"no_event_is_yet_created": "No event is available for data entry. Please create one from below.",
"not_selected": "Not selected",
"view_all": "[View all]",
@@ -39,6 +41,13 @@
"details_history": "Details/history",
"remove": "Remove",
"entity": "Entity",
+ "add": "Add",
+ "add_note": "Add note",
+ "search_note": "Search notes",
+ "add_your_note_here": "Add your note here.",
+ "details": "Details",
+ "created_by": "Registerd by",
+ "date": "Date",
"add_new": "Add new",
"add_filter": "Add filter",
"remove_filter": "Remove filter",
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2014-06-27 10:57:20 +0000
@@ -78,6 +78,29 @@
};
})
+.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('sortable', function() {
return {
=== 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-06-26 13:35:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-06-27 10:57:20 +0000
@@ -172,8 +172,8 @@
.service('EnrollmentService', function($http) {
return {
- get: function( entity ){
- var promise = $http.get( '../api/enrollments?trackedEntityInstance=' + entity ).then(function(response){
+ get: function( enrollmentUid ){
+ var promise = $http.get( '../api/enrollments/' + enrollmentUid ).then(function(response){
return response.data;
});
return promise;
=== 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-06-26 13:35:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-06-27 10:57:20 +0000
@@ -393,6 +393,10 @@
word-wrap:break-word;
}
+.table-with-fixed-layout {
+ table-layout: fixed;
+}
+
.table-borderless {
width: 100%;
table-layout: fixed;
@@ -595,6 +599,18 @@
margin-top: 5px;
}
+.remove-default-padding {
+ margin: -15px !important;
+}
+
+.over-flow-hidden {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -o-text-overflow: ellipsis;
+ -webkit-text-overflow: ellipsis;
+}
+
/*----------------------------------------------------------------------------*/
/* Bootstrap modal style
/*----------------------------------------------------------------------------*/
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html 2014-06-26 13:35:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html 2014-06-27 10:57:20 +0000
@@ -1,4 +1,5 @@
<div class="search-container">
+
<table data-stop-propagation="true" class="table-borderless table-striped">
<tr>
<td>{{'org_unit'| translate}}</td>