=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-07-17 10:35:43 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-07-17 12:53:18 +0000 @@ -394,6 +394,15 @@ i18nManager.getI18nFormat() ); } } + else if ( event.getStatus() == EventStatus.SKIPPED ) + { + programStageInstance.setStatus( EventStatus.SKIPPED ); + } + + else if ( event.getStatus() == EventStatus.SCHEDULE ) + { + programStageInstance.setStatus( EventStatus.SCHEDULE ); + } programStageInstance.setDueDate( dueDate ); programStageInstance.setOrganisationUnit( organisationUnit ); === 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-17 10:35:43 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-07-17 12:53:18 +0000 @@ -227,17 +227,17 @@ $scope.showDummyEventDiv = false; $scope.showEventCreationDiv = false; - angular.forEach($scope.currentEvent.notes, function(note){ - note.storedDate = moment(note.storedDate).format('YYYY-MM-DD @ hh:mm A'); - }); - - if($scope.currentEvent.notes.length > 0 ){ - $scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate'); - } - - if($scope.currentEvent.eventDate){ - $scope.getDataEntryForm(); - } + if($scope.currentEvent.notes){ + angular.forEach($scope.currentEvent.notes, function(note){ + note.storedDate = moment(note.storedDate).format('YYYY-MM-DD @ hh:mm A'); + }); + + if($scope.currentEvent.notes.length > 0 ){ + $scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate'); + } + } + + $scope.getDataEntryForm(); } } }; @@ -251,7 +251,9 @@ $scope.currentEvent.providedElsewhere = []; $scope.currentEvent.dueDate = DateUtils.format($scope.currentEvent.dueDate); - $scope.currentEvent.eventDate = DateUtils.format($scope.currentEvent.eventDate); + if($scope.currentEvent.eventDate){ + $scope.currentEvent.eventDate = DateUtils.format($scope.currentEvent.eventDate); + } if(!angular.isUndefined( $scope.currentEvent.notes)){ $scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate'); @@ -554,6 +556,51 @@ }); }; + $scope.skipUnskipEvent = function(){ + var modalOptions; + var dhis2Event = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage); + + if($scope.currentEvent.status === 'SKIPPED'){//unskip event + modalOptions = { + closeButtonText: 'cancel', + actionButtonText: 'unskip', + headerText: 'unskip', + bodyText: 'are_you_sure_to_unskip_event' + }; + dhis2Event.status = 'ACTIVE'; + } + else{//skip event + modalOptions = { + closeButtonText: 'cancel', + actionButtonText: 'skip', + headerText: 'skip', + bodyText: 'are_you_sure_to_skip_event' + }; + dhis2Event.status = 'SKIPPED'; + } + + ModalService.showModal({}, modalOptions).then(function(result){ + + DHIS2EventFactory.update(dhis2Event).then(function(data){ + + if($scope.currentEvent.status === 'SKIPPED'){//activiate event + $scope.currentEvent.status = 'SCHEDULE'; + } + else{//complete event + $scope.currentEvent.status = 'SKIPPED'; + } + 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.deleteEvent = function(){ === 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-17 10:35:43 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-07-17 12:53:18 +0000 @@ -143,8 +143,8 @@
{{'complete'| translate}} {{'incomplete'| translate}} - {{'validate'| translate}} - {{'skipped'| translate}} + {{'validate'| translate}} + {{currentEvent.status === 'SKIPPED' ? 'unskip' : 'skip' | translate}} {{'delete'| translate}}
=== 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-17 10:35:43 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-07-17 12:53:18 +0000 @@ -69,6 +69,8 @@ "search_note": "Search notes", "add_your_note_here": "Add your note here", "skipped": "Skipped", + "skip": "Skip", + "unskip": "Schedule back", "complete": "Complete", "incomplete": "Incomplete", "validate": "Validate", @@ -196,6 +198,8 @@ "are_you_sure_to_delete_event": "Are you sure you want to delete 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?", + "are_you_sure_to_skip_event": "Are you sure you want to skip the selected event?", + "are_you_sure_to_unskip_event": "Are you sure you want to schedule back 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/scripts/services.js' --- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-07-17 10:35:43 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-07-17 12:53:18 +0000 @@ -1198,7 +1198,8 @@ programStage: dhis2Event.programStage, orgUnit: dhis2Event.orgUnit, trackedEntityInstance: dhis2Event.trackedEntityInstance, - status: dhis2Event.status + status: dhis2Event.status, + dueDate: dhis2Event.dueDate }; angular.forEach(programStage.programStageDataElements, function(prStDe){