dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31425
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16000: tracker capture - event complete/incomplete; bug fix in relationship
------------------------------------------------------------
revno: 16000
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Mon 2014-07-07 13:46:45 +0200
message:
tracker capture - event complete/incomplete; bug fix in relationship
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/notes/notes.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
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/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/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/modal.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-07-04 21:04:49 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2014-07-07 11:46:45 +0000
@@ -39,42 +39,6 @@
$scope.selectedProgram;
$scope.selectedTei;
- $scope.$on('fromRelationship', function(event, args) {
- $scope.selectedTeiId = args.teiId;
-
- if( $scope.selectedTeiId ){
-
- //Fetch the selected entity
- TEIService.get($scope.selectedTeiId).then(function(data){
- $scope.selectedTei = data;
-
- //get the entity type
- TEService.get($scope.selectedTei.trackedEntity).then(function(te){
- $scope.trackedEntity = te;
-
- ProgramFactory.getAll().then(function(programs){
- $scope.programs = [];
- //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.selectedTei.trackedEntity){
- $scope.programs.push(program);
- }
-
- if($scope.selectedProgramId && program.id === $scope.selectedProgramId){
- $scope.selectedProgram = program;
- }
- });
-
- //broadcast selected items for dashboard controllers
- CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, pr: $scope.selectedProgram, enrollment: null});
- $scope.broadCastSelections();
- });
- });
- });
- }
- });
-
if($scope.selectedTeiId){
//Fetch the selected entity
TEIService.get($scope.selectedTeiId).then(function(data){
@@ -144,9 +108,6 @@
modalInstance.result.then(function () {
});
- };
-
- $scope.test = function(){
- console.log('test');
- };
+ };
+
});
=== 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-07-02 21:21:15 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-07-07 11:46:45 +0000
@@ -7,7 +7,7 @@
storage,
ProgramStageFactory,
DHIS2EventFactory,
- OrgUnitService,
+ ModalService,
DialogService,
CurrentSelection,
TranslationService) {
@@ -52,30 +52,11 @@
$scope.getEvents = function(){
+ $scope.dhis2Events = '';
DHIS2EventFactory.getEvents($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id, 'ACTIVE').then(function(data){
$scope.dhis2Events = data;
-
- if(angular.isUndefined($scope.dhis2Events)){
-
- //create dummy events
- $scope.dummyEvents = [];
-
- if($scope.selectedEnrollment.status === 'ACTIVE'){
- //create dummy events for the selected enrollment
- angular.forEach($scope.selectedProgram.programStages, function(programStage){
- var dummyEvent = EventUtils.createDummyEvent(programStage, $scope.selectedOrgUnit, $scope.selectedEnrollment);
- $scope.dummyEvents.push(dummyEvent);
- });
-
- $scope.dummyEvents = orderByFilter($scope.dummyEvents, '-eventDate');
- //$scope.dummyEvents.reverse();
-
- if($scope.dummyEvents){
- $scope.showEventCreationDiv = true;
- }
- }
- }
- else{
+
+ if(angular.isObject($scope.dhis2Events)){
angular.forEach($scope.dhis2Events, function(dhis2Event){
var eventStage = $scope.selectedProgramWithStage[dhis2Event.programStage];
@@ -96,31 +77,45 @@
}
});
-
- $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-eventDate');
- $scope.dhis2Events.reverse();
-
- $scope.dummyEvents = $scope.checkForEventCreation($scope.dhis2Events, $scope.selectedProgram);
}
+
+ $scope.dummyEvents = $scope.checkForEventCreation($scope.dhis2Events, $scope.selectedProgram);
});
};
$scope.checkForEventCreation = function(availableEvents, program){
- var dummyEvents = [];
-
- for(var i=0; i<program.programStages.length; i++){
- var stageHasEvent = false;
- for(var j=0; j<availableEvents.length && !program.programStages[i].repeatable && !stageHasEvent; j++){
- if(program.programStages[i].id === availableEvents[j].programStage){
- stageHasEvent = true;
- }
- }
-
- if(!stageHasEvent){
- $scope.allowEventCreation = true;
- var dummyEvent = EventUtils.createDummyEvent(program.programStages[i], $scope.selectedOrgUnit, $scope.selectedEnrollment);
- dummyEvents.push(dummyEvent);
+ var dummyEvents = [];
+ if($scope.selectedEnrollment.status === 'ACTIVE'){
+ if(!angular.isObject(availableEvents)){
+ angular.forEach($scope.selectedProgram.programStages, function(programStage){
+ var dummyEvent = EventUtils.createDummyEvent(programStage, $scope.selectedOrgUnit, $scope.selectedEnrollment);
+ dummyEvents.push(dummyEvent);
+ });
+
+ dummyEvents = orderByFilter(dummyEvents, '-eventDate');
+
+ if(dummyEvents){
+ $scope.showEventCreationDiv = true;
+ }
+
+ return dummyEvents;
+ }
+ else{
+ for(var i=0; i<program.programStages.length; i++){
+ var stageHasEvent = false;
+ for(var j=0; j<availableEvents.length && !program.programStages[i].repeatable && !stageHasEvent; j++){
+ if(program.programStages[i].id === availableEvents[j].programStage){
+ stageHasEvent = true;
+ }
+ }
+
+ if(!stageHasEvent){
+ $scope.allowEventCreation = true;
+ var dummyEvent = EventUtils.createDummyEvent(program.programStages[i], $scope.selectedOrgUnit, $scope.selectedEnrollment);
+ dummyEvents.push(dummyEvent);
+ }
+ }
}
}
return dummyEvents;
@@ -182,7 +177,7 @@
newEvent.name = $scope.currentDummyEvent.name;
newEvent.statusColor = $scope.currentDummyEvent.statusColor;
- if(angular.isUndefined($scope.dhis2Events)){
+ if(!angular.isObject($scope.dhis2Events)){
$scope.dhis2Events = [newEvent];
}
else{
@@ -429,4 +424,100 @@
$scope.currentDummyEvent = null;
$scope.showDummyEventDiv = !$scope.showDummyEventDiv;
};
+
+ $scope.completeEvent = function(){
+
+ var modalOptions = {
+ closeButtonText: 'cancel',
+ actionButtonText: 'complete',
+ headerText: 'complete',
+ bodyText: 'are_you_sure_to_complete_event'
+ };
+
+ ModalService.showModal({}, modalOptions).then(function(result){
+
+ var dhis2Event = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage);
+ dhis2Event.status = 'COMPLETED';
+
+ DHIS2EventFactory.update(dhis2Event).then(function(data){
+
+ $scope.currentEvent.status = 'COMPLETED';
+ var statusColor = EventUtils.getEventStatusColor($scope.currentEvent);
+ var continueLoop = true;
+ for(var i=0; i< $scope.dhis2Events.length && continueLoop; i++){
+ if($scope.dhis2Events[i].event === $scope.currentEvent.event ){
+ $scope.dhis2Events[i].statusColor = statusColor;
+ continueLoop = false;
+ }
+ }
+ });
+ });
+ };
+
+ $scope.incompleteEvent = function(){
+
+ var modalOptions = {
+ closeButtonText: 'cancel',
+ actionButtonText: 'incomplete',
+ headerText: 'incomplete',
+ bodyText: 'are_you_sure_to_incomplete_event'
+ };
+
+ ModalService.showModal({}, modalOptions).then(function(result){
+
+ var dhis2Event = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage);
+ dhis2Event.status = 'ACTIVE';
+ $scope.currentEvent.status = 'ACTIVE';
+
+ DHIS2EventFactory.update(dhis2Event).then(function(data){
+
+
+ $scope.currentEvent.status = 'ACTIVE';
+ var statusColor = EventUtils.getEventStatusColor($scope.currentEvent);
+ var continueLoop = true;
+ for(var i=0; i< $scope.dhis2Events.length && continueLoop; i++){
+ if($scope.dhis2Events[i].event === $scope.currentEvent.event ){
+ $scope.dhis2Events[i].statusColor = statusColor;
+ continueLoop = false;
+ }
+ }
+ });
+ });
+ };
+
+ $scope.validateEvent = function(){
+
+ };
+
+ $scope.removeEvent = function(){
+
+ var modalOptions = {
+ closeButtonText: 'cancel',
+ actionButtonText: 'remove',
+ headerText: 'remove',
+ bodyText: 'are_you_sure_to_remove_event'
+ };
+
+ ModalService.showModal({}, modalOptions).then(function(result){
+
+ DHIS2EventFactory.delete($scope.currentEvent).then(function(data){
+
+ var continueLoop = true, index = -1;
+ for(var i=0; i< $scope.dhis2Events.length && continueLoop; i++){
+ if($scope.dhis2Events[i].event === $scope.currentEvent.event ){
+ $scope.dhis2Events[i] = $scope.currentEvent;
+ continueLoop = false;
+ index = i;
+ }
+ }
+ $scope.dhis2Events.splice(index,1);
+ $scope.currentEvent = null;
+ if($scope.dhis2Events.length < 1){
+ $scope.dhis2Events = '';
+ $scope.currentDummyEvent = null;
+ $scope.dummyEvents = $scope.checkForEventCreation($scope.dhis2Events, $scope.selectedProgram);
+ }
+ });
+ });
+ };
});
\ No newline at end of file
=== 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-07-02 20:53:29 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-07-07 11:46:45 +0000
@@ -1,11 +1,8 @@
<div class="panel panel-default" ng-controller="DataEntryController">
<div class="panel-heading handle bold">
- <span ng-show="!showEventCreationDiv">{{dataentryWidget.title| translate}}</span>
- <span ng-show="showEventCreationDiv">
- <a href ng-click="showEventCreation()" title="{{'create_new_event'| translate}}"><span class="bold">{{dataentryWidget.title| translate}}</span></a>
- </span>
- <span class="nav-pills" ng-show="allowEventCreation">
- | <a href ng-click="showEventCreation()" title="{{'create_new_event'| translate}}"><span class="bold">{{'create_new_event'| translate}}</span></a>
+ {{dataentryWidget.title| translate}}
+ <span class="nav-pills" ng-if="allowEventCreation">
+ | <a href ng-click="showEventCreation()"><span class="bold">{{'create_new_event'| translate}}</span></a>
</span>
<span class="pull-right">
<a class="small-horizonal-spacing" href ng-click="expandCollapse(dataentryWidget)">
@@ -17,7 +14,7 @@
</div>
<div ng-show="dataentryWidget.expand" class="panel-body dashboard-widget-container">
- <div ng-show="dhis2Events && !showEventCreationDiv">
+ <div ng-if="dhis2Events && !showEventCreationDiv">
<table class="table-borderless">
<tbody>
<tr>
@@ -35,9 +32,9 @@
</tbody>
</table>
</div>
- <div ng-show="!dhis2Events && selectedEnrollment" class="alert alert-warning">{{'no_event_is_yet_created'| translate}}</div>
- <div ng-show="dhis2Events && showEventCreationDiv" class="alert alert-warning">{{'event_creation'| translate}}</div>
- <div ng-show="!selectedEnrollment" class="alert alert-warning">{{'not_yet_enrolled_data_entry'| translate}}</div>
+ <div ng-if="!dhis2Events && selectedEnrollment" class="alert alert-warning">{{'no_event_is_yet_created'| translate}}</div>
+ <div ng-if="dhis2Events && showEventCreationDiv" class="alert alert-warning">{{'event_creation'| translate}}</div>
+ <div ng-if="!selectedEnrollment" class="alert alert-warning">{{'not_yet_enrolled_data_entry'| translate}}</div>
<div ng-show="dummyEvents && showEventCreationDiv">
<table class="table-borderless">
<tbody>
@@ -76,9 +73,8 @@
</div>
</form>
</div>
-
+
<div ng-show="currentEvent && !showEventCreationDiv">
- <hr>
<div class="row">
<div class="col-md-6">
{{currentStage.reportDateDescription}}
@@ -111,59 +107,59 @@
{{prStDe.dataElement.name}}
</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" class="error">{{'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>
+ <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" class="error">{{'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>
- </td>
+ </div>
+ <div ng-switch-when="date">
+ <input type="text"
+ placeholder="yyyy-mm-dd"
+ ng-date
+ ng-class='getClass(prStDe.dataElement.id)'
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ 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>
+ </td>
</tr>
</table>
</form>
@@ -179,23 +175,32 @@
{{'add'| translate}}
</button>
</div>
-
+
<table class="table table-with-fixed-layout">
<tr ng-repeat="note in currentEvent.notes">
<td class="over-flow-hidden">
- <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>
+ <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>
+ <hr>
+ <div class="form-group">
+ <div class="btn-group btn-group-justified">
+ <a href ng-click="completeEvent()" class="btn btn-info" ng-disabled="currentEvent.status !== 'ACTIVE'">{{'complete'| translate}}</a>
+ <a href ng-click="incompleteEvent()" class="btn btn-warning" ng-disabled="currentEvent.status !== 'COMPLETED'">{{'incomplete'| translate}}</a>
+ <a href ng-click="validateEvent()" class="btn btn-info" ng-disabled="true">{{'validate'| translate}}</a>
+ <a href ng-click="removeEvent()" class="btn btn-info">{{'remove'| translate}}</a>
+ </div>
+ </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/notes/notes.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html 2014-07-02 20:53:29 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html 2014-07-07 11:46:45 +0000
@@ -51,7 +51,7 @@
<div class="alert alert-warning vertical-spacing">{{'not_yet_enrolled_note'| translate}}</div>
</div>
<div ng-show="selectedEnrollment && !selectedEnrollment.notes">
- <div class="alert alert-info vertical-spacing">{{'empty_notes'| translate}}</div>
+ <div class="alert alert-info">{{'empty_notes'| translate}}</div>
</div>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2014-07-06 12:46:56 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2014-07-07 11:46:45 +0000
@@ -1,8 +1,8 @@
trackerCapture.controller('RelationshipController',
function($scope,
$modal,
- $rootScope,
- $timeout,
+ $location,
+ $route,
CurrentSelection,
RelationshipFactory,
TranslationService) {
@@ -30,6 +30,7 @@
var modalInstance = $modal.open({
templateUrl: 'components/relationship/add-relationship.html',
controller: 'AddRelationshipController',
+ windowClass: 'relationship-modal-window',
resolve: {
relationshipTypes: function () {
return $scope.relationshipTypes;
@@ -44,14 +45,21 @@
});
modalInstance.result.then(function (relationships) {
- $scope.selectedTei.relationships = relationships;
+ $scope.selectedTei.relationships = relationships;
});
};
- $scope.showDashboard = function(teiId){
- $timeout(function() {
- $rootScope.$broadcast('fromRelationship', {teiId: teiId});
- }, 100);
+ $scope.showDashboard = function(rel){
+ var relativeTeiId = '';
+ if($scope.selectedTei.trackedEntityInstance === rel.trackedEntityInstanceA){
+ relativeTeiId = rel.trackedEntityInstanceB;
+ }
+ else{
+ relativeTeiId = rel.trackedEntityInstanceA;
+ }
+
+ $location.path('/dashboard').search({tei: relativeTeiId, program: null});
+ $route.reload();
};
})
@@ -297,11 +305,11 @@
};
$scope.close = function () {
- $modalInstance.close('');
+ $modalInstance.close($scope.selectedTei.relationships ? $scope.selectedTei.relationships : []);
};
- $scope.assignRelationship = function(selectedTei){
- $scope.teiForRelationship = selectedTei;
+ $scope.assignRelationship = function(relativeTei){
+ $scope.teiForRelationship = relativeTei;
};
$scope.addRelationship = function(){
=== 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-07-04 21:04:49 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html 2014-07-07 11:46:45 +0000
@@ -18,10 +18,10 @@
<div ng-show="selectedTei" class="remove-default-padding">
<table class="table table-striped dhis2-table-hover">
- <tr ng-repeat="rel in selectedTei.relationships">
+ <tr ng-click="showDashboard(rel)" ng-repeat="rel in selectedTei.relationships">
<td>
- <span ng-click="showDashboard(rel.trackedEntityInstanceB)" ng-if="selectedTei.trackedEntityInstance === rel.trackedEntityInstanceA">{{relationships[rel.relationship].bIsToA}}</span>
- <span ng-click="showDashboard(rel.trackedEntityInstanceA)" ng-if="selectedTei.trackedEntityInstance === rel.trackedEntityInstanceB">{{relationships[rel.relationship].aIsToB}}</span>
+ <span ng-if="selectedTei.trackedEntityInstance === rel.trackedEntityInstanceA">{{relationships[rel.relationship].bIsToA}}</span>
+ <span ng-if="selectedTei.trackedEntityInstance === rel.trackedEntityInstanceB">{{relationships[rel.relationship].aIsToB}}</span>
</td>
</tr>
</table>
=== 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-07-06 12:46:56 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-07-07 11:46:45 +0000
@@ -53,6 +53,9 @@
"add_note": "Add note",
"search_note": "Search notes",
"add_your_note_here": "Add your note here",
+ "complete": "Complete",
+ "incomplete": "Incomplete",
+ "validate": "Validate",
"details": "Details",
"created_by": "Registerd by",
"date": "Date",
@@ -147,6 +150,9 @@
"save_relationship": "Save relationship",
"go_back": "Go back",
"cancel": "Cancel",
+ "are_you_sure_to_remove_event": "Are you sure you want to remove the selected event?",
+ "are_you_sure_to_complete_event": "Are you sure you want to complete the selected event?",
+ "are_you_sure_to_incomplete_event": "Are you sure you want to incomplete the selected event?",
"more": "More",
"advanced_search": "Advanced search",
"profile": "Profile",
=== 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-02 11:34:41 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html 2014-07-07 11:46:45 +0000
@@ -25,6 +25,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-cookies.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-animate.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js"></script>
+
<script type="text/javascript" src="../dhis-web-commons/javascripts/moment/moment-with-langs.min.js"></script>
=== 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-04 21:04:49 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-07-07 11:46:45 +0000
@@ -331,7 +331,6 @@
}
promise = $http.get( url + '&pageSize=' + pgSize + '&page=' + pg ).then(function(response){
- //return EntityService.formatter(response.data);
return response.data;
});
return promise;
@@ -339,9 +338,6 @@
update: function(tei){
var url = '../api/trackedEntityInstances';
-
- console.log('the tei is: ', tei);
-
var promise = $http.put( url + '/' + tei.trackedEntityInstance , tei).then(function(response){
return response.data;
});
@@ -469,6 +465,12 @@
});
return promise;
},
+ delete: function(dhis2Event){
+ var promise = $http.delete('../api/events/' + dhis2Event.event).then(function(response){
+ return response.data;
+ });
+ return promise;
+ },
update: function(dhis2Event){
var promise = $http.put('../api/events/' + dhis2Event.event, dhis2Event).then(function(response){
return response.data;
@@ -951,6 +953,29 @@
});
});
}
+ },
+ reconstruct: function(dhis2Event, programStage){
+
+ var e = {dataValues: [],
+ event: dhis2Event.event,
+ program: dhis2Event.program,
+ programStage: dhis2Event.programStage,
+ orgUnit: dhis2Event.orgUnit,
+ trackedEntityInstance: dhis2Event.trackedEntityInstance,
+ status: dhis2Event.status
+ };
+
+ angular.forEach(programStage.programStageDataElements, function(prStDe){
+ if(dhis2Event[prStDe.dataElement.id]){
+ var val = {value: dhis2Event[prStDe.dataElement.id], dataElement: prStDe.dataElement.id};
+ if(dhis2Event.providedElsewhere[prStDe.dataElement.id]){
+ val.providedElsewhere = dhis2Event.providedElsewhere[prStDe.dataElement.id];
+ }
+ e.dataValues.push(val);
+ }
+ });
+
+ return e;
}
};
});
\ 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-04 14:36:11 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-07-07 11:46:45 +0000
@@ -638,131 +638,10 @@
-webkit-text-overflow: ellipsis;
}
-/*----------------------------------------------------------------------------*/
-/* Bootstrap modal style
-/*----------------------------------------------------------------------------*/
-.modal-open {
- overflow: hidden
-}
-.modal {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 1040;
- display: none;
- overflow: auto;
- overflow-y: scroll;
-}
-.modal.fade .modal-dialog {
- -webkit-transform: translate(0,-25%);
- -ms-transform: translate(0,-25%);
- transform: translate(0,-25%);
- -webkit-transition: -webkit-transform .3s ease-out;
- -moz-transition: -moz-transform .3s ease-out;
- -o-transition: -o-transform .3s ease-out;
- transition: transform .3s ease-out
-}
-.modal.in .modal-dialog {
- -webkit-transform: translate(0,0);
- -ms-transform: translate(0,0);
- transform: translate(0,0);
-}
-.modal-dialog {
- position: relative;
- z-index: 1050;
- width: auto;
- padding: 10px;
- margin-right: auto;
- margin-left: auto
-}
-.modal-content {
- position: relative;
- background-color: #fff;
- border: 1px solid #999;
- border: 1px solid rgba(0,0,0,0.2);
- border-radius: 6px;
- outline: 0;
- -webkit-box-shadow: 0 3px 9px rgba(0,0,0,0.5);
- box-shadow: 0 3px 9px rgba(0,0,0,0.5);
- background-clip: padding-box;
-}
-.modal-backdrop {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 1030;
- background-color: #000;
-}
-.modal-backdrop.fade {
- opacity: 0;
- filter: alpha(opacity=0)
-}
-.modal-backdrop.in {
- opacity: .5;
- filter: alpha(opacity=50)
-}
-.modal-header {
- min-height: 16.428571429px;
- padding: 0 15px;
- border-bottom: 1px solid #e5e5e5;
-}
-.modal-header .close {
- margin-top: -2px;
-}
-.modal-title {
- margin: 0;
- line-height: 1.428571429
-}
-.modal-body {
- position: relative;
- font-size: 14px;
-}
-.modal-footer {
- padding: 19px 20px 20px;
- text-align: right;
- border-top: 1px solid #e5e5e5
-}
-.modal-footer:before, .modal-footer:after {
- display: table;
- content: " "
-}
-.modal-footer:after {
- clear: both;
-}
-.modal-footer:before, .modal-footer:after {
- display: table;
- content: " "
-}
-.modal-footer:after {
- clear: both
-}
-.modal-footer .btn+ .btn {
- margin-bottom: 0;
- margin-left: 5px;
-}
-.modal-footer .btn-group .btn+ .btn {
- margin-left: -1px;
-}
-.modal-footer .btn-block+ .btn-block {
- margin-left: 0;
-}
-@media screen and (min-width: 768px) {
- .modal-dialog {
- width: 100%;
- height: 100%;
- padding-top: 30px;
- padding-bottom: 30px;
- }
- .modal-content {
- -webkit-box-shadow: 0 5px 15px rgba(0,0,0,0.5);
- box-shadow: 0 5px 15px rgba(0,0,0,0.5);
- }
-}
-
+.relationship-modal-window .modal-dialog {
+ width: 100%;
+ height: 100%;
+}
.expanded{
border: 1px solid #aaa;
padding: 6px 8px;
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/modal.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/modal.html 2014-03-17 15:59:31 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/modal.html 2014-07-07 11:46:45 +0000
@@ -5,6 +5,6 @@
<p>{{modalOptions.bodyText | translate}}</p>
</div>
<div class="modal-footer">
- <button data-ng-click="modalOptions.close()">{{modalOptions.closeButtonText | translate}}</button>
- <button data-ng-click="modalOptions.ok();">{{modalOptions.actionButtonText | translate}}</button>
+ <button class="btn btn-default" data-ng-click="modalOptions.close()">{{modalOptions.closeButtonText | translate}}</button>
+ <button class="btn btn-primary" data-ng-click="modalOptions.ok();">{{modalOptions.actionButtonText | translate}}</button>
</div>
\ No newline at end of file