=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2014-12-08 15:06:43 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2014-12-09 23:24:16 +0000 @@ -29,6 +29,7 @@ go_back=Go back form_invalid=Form is invalid. Please check for required fields. required=Required +value_must_be=Value must be int_required=Value must be a number string_required=Value must be a text date_required=Value must be a date @@ -113,3 +114,9 @@ update_event=Update Event missing_translation_file=Missing Translation File missing_translation_using_default=No translation file is found for the selected locale. Using default translation (English). +number=Number +posInt=Positive Integer +negInt=Negative Integer +zeroPostitiveInt=Zero or Positive Integer + + === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html 2014-12-08 15:06:43 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html 2014-12-09 23:24:16 +0000 @@ -33,8 +33,8 @@ - - + + === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-12-08 16:37:23 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-12-09 23:24:16 +0000 @@ -216,21 +216,18 @@ var val = dataValue.value; if(angular.isObject($scope.prStDes[dataValue.dataElement].dataElement)){ - //converting int string value to integer for proper sorting. + //converting int string value to number for proper sorting. if($scope.prStDes[dataValue.dataElement].dataElement.type === 'int'){ - if( !isNaN(parseInt(val)) ){ - val = parseInt(val); - } - else{ - val = ''; - } + if( dhis2.validation.isNumber(val) ){ + val = new Number(val); + } } if($scope.prStDes[dataValue.dataElement].dataElement.type === 'string'){ if($scope.prStDes[dataValue.dataElement].dataElement.optionSet && $scope.prStDes[dataValue.dataElement].dataElement.optionSet.id && $scope.optionSets[$scope.prStDes[dataValue.dataElement].dataElement.optionSet.id] && $scope.optionSets[$scope.prStDes[dataValue.dataElement].dataElement.optionSet.id].options ){ - val = OptionSetService.getNameOrCode($scope.optionSets[$scope.prStDes[dataValue.dataElement].dataElement.optionSet.id].options, val); + val = OptionSetService.getName($scope.optionSets[$scope.prStDes[dataValue.dataElement].dataElement.optionSet.id].options, val); } } if($scope.prStDes[dataValue.dataElement].dataElement.type === 'date'){ @@ -428,7 +425,7 @@ valueExists = true; if($scope.prStDes[dataElement].dataElement.type === 'string'){ if($scope.prStDes[dataElement].dataElement.optionSet){ - val = OptionSetService.getNameOrCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options,val); //$scope.optionSets[].options$scope.optionCodesByName[ '"' + val + '"']; + val = OptionSetService.getCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options,val); } } @@ -545,7 +542,7 @@ if(val && $scope.prStDes[dataElement].dataElement.type === 'string'){ if($scope.prStDes[dataElement].dataElement.optionSet){ - val = OptionSetService.getNameOrCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options,val); + val = OptionSetService.getCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options,val); } } if(val && $scope.prStDes[dataElement].dataElement.type === 'date'){ @@ -613,7 +610,7 @@ var oldValue = $scope.currentEventOrginialValue[dataElement]; //check for form validity - $scope.outerForm.submitted = true; + $scope.outerForm.submitted = true; if( $scope.outerForm.$invalid ){ $scope.currentElement.updated = false; currentEvent[dataElement] = oldValue; @@ -630,7 +627,7 @@ if($scope.prStDes[dataElement].dataElement.type === 'string'){ if($scope.prStDes[dataElement].dataElement.optionSet){ - newValue = OptionSetService.getNameOrCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options, newValue);//$scope.optionCodesByName[ '"' + newValue + '"']; + newValue = OptionSetService.getCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options, newValue);//$scope.optionCodesByName[ '"' + newValue + '"']; } } if($scope.prStDes[dataElement].dataElement.type === 'date'){ === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2014-12-03 17:48:48 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2014-12-09 23:24:16 +0000 @@ -2,5 +2,4 @@ /* Directives */ -var eventCaptureDirectives = angular.module('eventCaptureDirectives', []); - +var eventCaptureDirectives = angular.module('eventCaptureDirectives', []); \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-12-03 17:48:48 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-12-09 23:24:16 +0000 @@ -436,7 +436,7 @@ { return function() { return $.ajax( { - url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,sortOrder,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,name,type,formName,optionSet[id]]]', + url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,sortOrder,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,name,type,numberType,formName,optionSet[id]]]', type: 'GET' }).done( function( response ){ _.each( _.values( response.programStages ), function( programStage ) { === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-11-19 12:45:44 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-12-09 23:24:16 +0000 @@ -56,7 +56,7 @@ {{'longitude'| translate}} -
- - {{'int_required'| translate}} + {{'value_must_be'| translate}} - {{prStDes[eventGridColumn.id].dataElement.numberType | translate}}
-
- {{'date_required'| translate}}
- @@ -206,7 +216,7 @@ {{'latitude'| translate}} - -
- + style="width:99%;"/> + {{'value_must_be'| translate}} - {{prStDes[de.dataElement.id].dataElement.numberType | translate}}
{{'no_value' | translate}}
-
- {{'date_required'| translate}}
- === added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html 2014-12-09 23:24:16 +0000 @@ -0,0 +1,98 @@ + + + + + + + + + + + + + +
+ {{'form_id'| translate}} + + +
+ {{selectedProgramStage.reportDateDescription ? selectedProgramStage.reportDateDescription : 'incident_date'| translate }} + + + {{'date_required'| translate}} +
+ {{'lat_lng' | translate}} + + + + {{'int_required'| translate}} [-90 ... 90] + + + + {{'int_required'| translate}}[-180 ... 180] + + +
+
+
+
+

+ {{'comments'| translate}} +

+ +
+ + + + + + + + + +
+ {{'recorded_comments'| translate}} +
+

{{note.value}}

+

{{'created_by'| translate}}: {{note.storedBy}}

+

{{'date'| translate}}: {{note.storedDate}}

+
+
+
+ +
+ + + + + + + + + + {{'form_invalid' | translate}} +
+ \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html 2014-12-04 13:04:31 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html 2014-12-09 23:24:16 +0000 @@ -107,9 +107,6 @@ {{'no'| translate}} {{'yes'| translate}} - {{dhis2Event[eventGridColumn.id]}} @@ -124,21 +121,25 @@
- + ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"/> * + {{'value_must_be'| translate}} - {{prStDes[eventGridColumn.id].dataElement.numberType | translate}}
* + {{'option_required'| translate}}
- * + {{'bool_required'| translate}}
* + {{'date_required'| translate}}
- + === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js 2014-12-08 15:56:07 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js 2014-12-09 23:24:16 +0000 @@ -12,7 +12,6 @@ 'trackerCaptureDirectives', 'trackerCaptureControllers', 'd2Filters', - 'd2Directives', 'd2Services', 'd2Controllers', 'angularLocalStorage', === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2014-12-08 15:56:07 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2014-12-09 23:24:16 +0000 @@ -2,9 +2,9 @@ /* Directives */ -var trackerCaptureDirectives = angular.module('trackerCaptureDirectives', []); +var trackerCaptureDirectives = angular.module('trackerCaptureDirectives', []) -/*.directive('inputValidator', function() { +.directive('inputValidator', function() { return { require: 'ngModel', @@ -16,19 +16,34 @@ } }; }) -.directive('selectedOrgUnit', function(storage) { + +.directive('selectedOrgUnit', function($timeout, storage) { + return { restrict: 'A', - link: function(scope, element, attrs){ - + link: function(scope, element, attrs){ + + //once ou tree is loaded, start meta-data download + $(function() { + dhis2.ou.store.open().done( function() { + selection.load(); + $( "#orgUnitTree" ).one( "ouwtLoaded", function(event, ids, names) { + console.log('Finished loading orgunit tree'); + downloadMetaData(); + }); + }); + }); + //listen to user selection, and inform angular - selection.setListenerFunction( organisationUnitSelected, true ); - selection.responseReceived(); + selection.setListenerFunction( setSelectedOu, true ); - function organisationUnitSelected( orgUnits, orgUnitNames ) { - scope.selectedOrgUnit = {id: orgUnits[0], name: orgUnitNames[0]}; - scope.$apply(); - } + function setSelectedOu( ids, names ) { + var ou = {id: ids[0], name: names[0]}; + $timeout(function() { + scope.selectedOrgUnit = ou; + scope.$apply(); + }); + } } }; }) @@ -172,8 +187,12 @@ var rawDate = this.value; var convertedDate = DateUtils.format(this.value); + + console.log('raw date: ', rawDate); + console.log('cnv date: ', convertedDate); if(rawDate != convertedDate){ + console.log('It is invalid...'); scope.invalidDate = true; ctrl.$setViewValue(this.value); ctrl.$setValidity('foo', false); @@ -204,6 +223,22 @@ }; }) +.directive('d2TypeaheadValidation', function() { + + return { + require: 'ngModel', + restrict: 'A', + link: function (scope, element, attrs, ctrl) { + element.bind('blur', function () { + if(ctrl.$viewValue && !ctrl.$modelValue){ + ctrl.$setViewValue(); + ctrl.$render(); + } + }); + } + }; +}) + .directive('typeaheadOpenOnFocus', function ($compile) { return { require: ['typeahead', 'ngModel'], @@ -220,7 +255,15 @@ }; }) - +.directive('serversidePaginator', function factory() { + return { + restrict: 'E', + controller: function ($scope, Paginator) { + $scope.paginator = Paginator; + }, + templateUrl: '../dhis-web-commons/paging/serverside-pagination.html' + }; +}) .directive('d2Enter', function () { return function (scope, element, attrs) { @@ -233,4 +276,4 @@ } }); }; -})*/ \ No newline at end of file +}); \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-12-08 15:56:07 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-12-09 23:24:16 +0000 @@ -4,7 +4,6 @@ var trackerCaptureServices = angular.module('trackerCaptureServices', ['ngResource']) - .factory('StorageService', function(){ var store = new dhis2.storage.Store({ name: "dhis2tc", @@ -457,19 +456,16 @@ return def.promise(); }, showRequiredAttributes: function(requiredAttributes, teiAttributes, fromEnrollment, optionSets){ + + console.log('required attribtues: ', requiredAttributes); + console.log('tei attribtue: ', teiAttributes); //first reset teiAttributes for(var j=0; j ' + - '{{\'int_required\'| translate}}'; + '{{\'value_must_be\'| translate}} - {{ "' + programStageDataElements[deId].dataElement.numberType + '" | translate}}'; } if(programStageDataElements[deId].dataElement.type == "string"){ if(programStageDataElements[deId].dataElement.optionSet){ var optionSetId = programStageDataElements[deId].dataElement.optionSet.id; newInputField = ' ' + @@ -338,6 +346,7 @@ if(programStageDataElements[deId].dataElement.type == "bool"){ newInputField = ' ' + '{{\'required\'| translate}}'; === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js 2014-10-20 16:24:09 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js 2014-12-09 23:24:16 +0000 @@ -3256,8 +3256,12 @@ if (isEditable) { return inputValue; } else { - modelCtrl.$setValidity('editable', false); - return undefined; + /*modelCtrl.$setValidity('editable', false); + return undefined;*/ + if(inputValue){ //make sure empty values - though not part of the drop down - are accepted + modelCtrl.$setValidity('editable', false); + return undefined; + } } });