=== 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-05-19 11:33:07 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-05-20 15:56:10 +0000 @@ -26,7 +26,8 @@ "next": "Next", "last": "Last", "dashboard": "Go to Dashboard", - "edit": "Edit Entity", + "edit": "Edit", + "edit_profile": "Edit profile", "association": "Manage Associations", "change_location": "Manage Location", "details_history": "Details/History", @@ -35,6 +36,7 @@ "add_new": "Add new", "new_event": "New event", "create_new_event": "Create new event", + "create_new_event_repeatable": "Create new event from a repeatable stage", "close_search": "Close search", "search_attributes": "Search attributes", "available_search_attributes": "Available search attributes", @@ -78,6 +80,7 @@ "registration_error": "Error in registration", "category": "Category", "entity_type": "Entity type", + "save": "Save", "save_and_add_new": "Save and add new", "save_and_go_back": "Save and go back", "save_and_continue": "Save and continue", === 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-05-20 13:24:54 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2014-05-20 15:56:10 +0000 @@ -507,6 +507,7 @@ //attributes for profile $scope.attributes = {}; + $scope.editProfile = false; angular.forEach(storage.get('ATTRIBUTES'), function(attribute){ $scope.attributes[attribute.id] = attribute; @@ -522,7 +523,23 @@ $scope.trackedEntity = te; } }); + + $scope.entityAttributes = angular.copy($scope.selectedEntity.attributes); }); + + $scope.showEdit = function(){ + $scope.editProfile = !$scope.editProfile; + }; + + $scope.save = function(){ + + $scope.editProfile = !$scope.editProfile; + }; + + $scope.cancel = function(){ + $scope.selectedEntity.attributes = $scope.entityAttributes; + $scope.editProfile = !$scope.editProfile; + }; }) //Controller for the enrollment section @@ -540,6 +557,7 @@ //programs for enrollment $scope.enrollments = []; $scope.programs = []; + $scope.showEnrollmentDiv = false; $scope.selectedOrgUnit = storage.get('SELECTED_OU'); @@ -601,6 +619,10 @@ } }; + $scope.showEnrollment = function(){ + console.log('Enrollment', $scope.selectedEntity, ' ', $scope.selectedProgram); + }; + $scope.enroll = function(){ console.log('Enrollment', $scope.selectedEntity, ' ', $scope.selectedProgram); }; @@ -622,9 +644,14 @@ //listen for the selected items $scope.$on('dataentry', function(event, args) { + + var today = moment(); + today = Date.parse(today); + today = $filter('date')(today, 'yyyy-MM-dd'); $scope.currentEvent = null; - + $scope.allowEventCreation = false; + $scope.repeatableStages = []; $scope.dhis2Events = []; $scope.selectedEntity = args.selectedEntity; @@ -642,7 +669,7 @@ console.log('need to create new ones: ', $scope.selectedEnrollment); - if($scope.selectedEnrollment.status == 'ACTIVE'){ + if($scope.selectedEnrollment.status === 'ACTIVE'){ //create events for the selected enrollment var program = storage.get($scope.selectedProgramId); var programStages = []; @@ -650,43 +677,47 @@ angular.forEach(program.programStages, function(ps){ ps = storage.get(ps.id); programStages.push(ps); + + var eventDate = moment(moment().add('d', ps.minDaysFromStart), 'YYYY-MM-DD')._d; + eventDate = Date.parse(eventDate); + eventDate = $filter('date')(eventDate, 'yyyy-MM-dd'); var dhis2Event = {programStage: ps.id, orgUnit: $scope.selectedOrgUnitId, - eventDate: moment(), + eventDate: eventDate, name: ps.name, status: 'ACTIVE'}; - var today = moment(); - - dhis2Event.statusColor = 'stage-on-time'; - - if( moment().add('d', ps.minDaysFromStart).isBefore(today)){ - dhis2Event.statusColor = 'stage-overdue'; - } - - $scope.dhis2Events.push(dhis2Event); + $scope.dhis2Events.push(dhis2Event); + }); } } angular.forEach($scope.dhis2Events, function(dhis2Event){ - - dhis2Event.name = storage.get(dhis2Event.programStage).name; + + var ps = storage.get(dhis2Event.programStage); + //check if a stage is repeatable + if(ps.repeatable){ + $scope.allowEventCreation = true; + if($scope.repeatableStages.indexOf(ps) == -1){ + $scope.repeatableStages.push(ps); + } + } + + dhis2Event.name = ps.name; dhis2Event.eventDate = moment(dhis2Event.eventDate, 'YYYY-MM-DD')._d; dhis2Event.eventDate = Date.parse(dhis2Event.eventDate); dhis2Event.eventDate = $filter('date')(dhis2Event.eventDate, 'yyyy-MM-dd'); - if(dhis2Event.status == 'COMPLETED'){ + if(dhis2Event.status === 'COMPLETED'){ dhis2Event.statusColor = 'stage-completed'; } else{ - var date = moment(dhis2Event.eventDate, 'yyyy-MM-dd'); - if(moment().isAfter(date)){ + dhis2Event.statusColor = 'stage-on-time'; + + if(moment(today).isAfter(dhis2Event.eventDate)){ dhis2Event.statusColor = 'stage-overdue'; - } - else{ - dhis2Event.statusColor = 'stage-on-time'; - } + } } if(dhis2Event.orgUnit){ @@ -706,8 +737,8 @@ } }); - $scope.createNewEvent = function(){ - console.log('need to create new event'); + $scope.createNewEvent = function(){ + console.log('need to create new event: ', $scope.repeatableStages); }; $scope.showDataEntry = function(event){ === 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-05-16 13:58:07 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-05-20 15:56:10 +0000 @@ -583,6 +583,10 @@ margin-bottom: 10px; } +.widget-content-container{ + padding: 20px 10px; +} + /*----------------------------------------------------------------------------*/ /* Bootstrap modal style /*----------------------------------------------------------------------------*/ === modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html' --- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html 2014-05-13 09:54:48 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html 2014-05-20 15:56:10 +0000 @@ -1,8 +1,8 @@
{{dataentryWidget.title| translate}} - - | {{'create_new_event'| translate}} + + | {{'create_new_event'| translate}} === modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html' --- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html 2014-05-19 14:00:19 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html 2014-05-20 15:56:10 +0000 @@ -22,7 +22,7 @@ === modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/profile.html' --- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/profile.html 2014-05-19 14:00:19 +0000 +++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/profile.html 2014-05-20 15:56:10 +0000 @@ -1,6 +1,10 @@ +
- {{trackedEntity.name || 'entity' | translate}} {{profileWidget.title| translate}} + {{trackedEntity.name|| 'entity' | translate}} {{profileWidget.title| translate}} + + | {{'edit'| translate}} + @@ -13,13 +17,13 @@
- +
- +
- @@ -31,16 +35,32 @@ ng-model="attribute.value" typeahead="option for option in attributes[attribute.attribute].optionSet.options | filter:$viewValue | limitTo:20" typeahead-open-on-focus - /> + ng-disabled="!editProfile"/>
- +
- +
+ +
+
+ + +
+
+
\ No newline at end of file