------------------------------------------------------------ revno: 19255 committer: Abyot Asalefew Gizaw <aby...@gmail.com> branch nick: dhis2 timestamp: Tue 2015-06-02 14:25:03 +0200 message: tracker and event capture - improved validation and messaging modified: dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/event-capture.appcache 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/index.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js 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/event-capture.js dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 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/ec-custom-form.html 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-tracker-capture/components/dashboard/dashboard.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 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/controllers.js 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/services.js dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.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-apps/src/main/webapp/dhis-web-event-capture/event-capture.appcache' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/event-capture.appcache 2015-05-22 10:23:04 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/event-capture.appcache 2015-06-02 12:25:03 +0000 @@ -35,7 +35,7 @@ ../dhis-web-commons/javascripts/angular/angular-route.js ../dhis-web-commons/javascripts/angular/angular-cookies.js ../dhis-web-commons/javascripts/angular/angular-animate.js -../dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js +../dhis-web-commons/javascripts/angular/ui-bootstrap.js ../dhis-web-commons/javascripts/moment/moment-with-langs.min.js === 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 2015-05-22 10:23:04 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2015-06-02 12:25:03 +0000 @@ -137,4 +137,5 @@ warning=Warning unsaved_data_exists_proceed=Unsaved data exists. Do you want to proceed? proceed=Proceed -lacking_required_authority_to_add_update_event=Lacking required authority to add/update event. \ No newline at end of file +lacking_required_authority_to_add_update_event=Lacking required authority to add/update event. +select_or_search=Select or search from the list \ No newline at end of file === 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 2015-05-22 10:23:04 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html 2015-06-02 12:25:03 +0000 @@ -1,5 +1,6 @@ <!DOCTYPE html> -<html manifest="cacheManifest.action" ng-app="eventCapture"> +<html ng-app="eventCapture"> +<!--<html manifest="cacheManifest.action" ng-app="eventCapture">--> <head> <title>Event Capture</title> @@ -34,16 +35,18 @@ <link type="text/css" rel="stylesheet" href="../dhis-web-commons/javascripts/jQuery/ui/css/redmond/jquery-ui.css"> <link type="text/css" rel="stylesheet" href="../dhis-web-commons/javascripts/jQuery/calendars/css/ui-redmond.calendars.picker.css"> - <script type="text/javascript" src="../dhis-web-commons/bootstrap/js/bootstrap.min.js"></script> + <script type="text/javascript" src="../dhis-web-commons/bootstrap/js/bootstrap.min.js"></script> + <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-resource.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-route.js"></script> <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/angular-sanitize.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-messages.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/angular/ui-bootstrap.js"></script> + <script type="text/javascript" src="../dhis-web-commons/javascripts/moment/moment-with-langs.min.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/underscore.min.js"></script> @@ -68,7 +71,7 @@ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script> - <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script> + <!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>--> <script type="text/javascript" src="../dhis-web-commons/ouwt/ouwt.js"></script> <script type="text/javascript" src="scripts/event-capture.js"></script> @@ -79,7 +82,7 @@ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js"></script> - + <script type="text/javascript" src="scripts/app.js"></script> <script type="text/javascript" src="scripts/services.js"></script> <script type="text/javascript" src="scripts/directives.js"></script> @@ -96,8 +99,9 @@ <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/widgets.css"/> <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css"> <link type="text/css" rel="stylesheet" media="print" href="../dhis-web-commons/css/print.css"> + <!--<link type="text/css" rel="stylesheet" media="screen" href="styles/light-blue.css">--> - <link type="text/css" rel="stylesheet" href="styles/style.css"> + <link type="text/css" rel="stylesheet" href="styles/style.css"> </head> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js 2015-05-22 10:23:04 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js 2015-06-02 12:25:03 +0000 @@ -7,6 +7,7 @@ 'ngRoute', 'ngCookies', 'ngMessages', + 'ngSanitize', 'eventCaptureDirectives', 'eventCaptureControllers', 'eventCaptureServices', === 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 2015-05-22 10:23:04 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-06-02 12:25:03 +0000 @@ -160,20 +160,8 @@ $scope.filterTypes['event_date'] = 'date'; $scope.filterText['event_date']= {}; - //var errorMessages = {}; - //errorMessages['eventDate'] = $translate('required'); angular.forEach($scope.selectedProgramStage.programStageDataElements, function(prStDe){ $scope.prStDes[prStDe.dataElement.id] = prStDe; - - /*errorMessages[prStDe.dataElement.id] = ""; - if(prStDe.compulsory){ - var msg = $translate('required'); - if(prStDe.dataElement.type === 'int'){ - msg = $translate(prStDe.dataElement.numberType)+ ' ' + $translate('required'); - } - errorMessages[prStDe.dataElement.id] = msg; - }*/ - $scope.newDhis2Event[prStDe.dataElement.id] = ''; //generate grid headers using program stage data elements @@ -875,9 +863,15 @@ }); $scope.interacted = function(field) { - if(field){ - return $scope.outerForm.submitted || field.$dirty; - } - return false; + var status = false; + if(field){ + status = $scope.outerForm.submitted || field.$dirty; + } + return status; + }; + + $scope.clearSelectedOption = function($event, id) { + $event.stopPropagation(); + $scope.currentEvent[id] = undefined; }; }); \ 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 2015-04-30 11:28:47 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-06-02 12:25:03 +0000 @@ -390,7 +390,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,optionSetValue,numberType,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,optionSetValue,numberType,textType,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/scripts/services.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2015-05-07 08:21:29 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2015-06-02 12:25:03 +0000 @@ -64,6 +64,7 @@ .service('CurrentSelection', function(){ this.ouLevels = null; + this.location = null; this.setOuLevels = function(ouLevels){ this.ouLevels = ouLevels; @@ -71,6 +72,13 @@ this.getOuLevels = function(){ return this.ouLevels; }; + + this.setLocation = function(location){ + this.location = location; + }; + this.getLocation = function(){ + return this.location; + }; }) /* Factory to fetch optionSets */ @@ -118,6 +126,7 @@ for(var i=0; i<options.length; i++){ if( key === options[i].code){ return options[i].name; + //return options[i]; } } } === 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 2015-05-22 10:23:04 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-06-02 12:25:03 +0000 @@ -31,7 +31,7 @@ ng-model="currentEvent.eventDate" ng-disabled="editingEventInFull" ng-required="true" - ng-model-options="{ updateOn: 'blur' }" + d2-date-validator name="eventDate" input-field-id='eventDate' @@ -46,7 +46,7 @@ <td> <input type="number" ng-model="currentEvent.coordinate.latitude" - ng-model-options="{ updateOn: 'blur' }" + name="latitude" d2-coordinate-validator ng-required="false" @@ -62,7 +62,7 @@ <td> <input type="number" ng-model="currentEvent.coordinate.longitude" - ng-model-options="{ updateOn: 'blur' }" + name="longitude" d2-coordinate-validator ng-required="false" @@ -82,15 +82,14 @@ <input type="text" class="typeahead" placeholder=" " - ng-model="currentEvent[eventGridColumn.id]" - ng-model-options="{ updateOn: 'blur' }" + ng-model="currentEvent[eventGridColumn.id]" typeahead="option.name as option.name for option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" - typeahead-open-on-focus + typeahead-focus-first="false" typeahead-editable=false ng-required={{eventGridColumn.compulsory}} name="foo" input-field-id={{eventGridColumn.id}} - style="width:99%;"/> + style="width:98%;"/> </span> <span ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length < 7"> <label> @@ -116,20 +115,29 @@ <input type="number" d2-number-validator number-type={{prStDes[eventGridColumn.id].dataElement.numberType}} - ng-model="currentEvent[eventGridColumn.id]" - ng-model-options="{ updateOn: 'blur' }" + ng-model="currentEvent[eventGridColumn.id]" ng-required={{eventGridColumn.compulsory}} name="foo" input-field-id={{eventGridColumn.id}} style="width:99%;"/> </div> - <div ng-switch-when="string"> - <input type="text" - ng-model="currentEvent[eventGridColumn.id]" - ng-required={{eventGridColumn.compulsory}} - name="foo" - input-field-id={{eventGridColumn.id}} - style="width:99%;"/> + <div ng-switch-when="string"> + <span ng-if="eventGridColumn.textType==='longText'"> + <textarea rows="3" + ng-model="currentEvent[eventGridColumn.id]" + ng-required={{eventGridColumn.compulsory}} + name="foo" + input-field-id={{eventGridColumn.id}} + style="width:99%;"/> + </span> + <span ng-if="eventGridColumn.textType!=='longText'"> + <input type="text" + ng-model="currentEvent[eventGridColumn.id]" + ng-required={{eventGridColumn.compulsory}} + name="foo" + input-field-id={{eventGridColumn.id}} + style="width:99%;"/> + </span> </div> <div ng-switch-when="bool"> <select ng-model="currentEvent[eventGridColumn.id]" @@ -147,7 +155,7 @@ placeholder="{{dhis2CalendarFormat.keyDateFormat}}" d2-date max-date="prStDes[eventGridColumn.id].allowFutureDate ? '' : 0" - ng-model-options="{ updateOn: 'blur' }" + d2-date-validator ng-model="currentEvent[eventGridColumn.id]" ng-required={{eventGridColumn.compulsory}} @@ -162,10 +170,9 @@ name="foo" input-field-id={{eventGridColumn.id}} /> </div> - </div> - <!--<span ng-show="innerForm.foo.$invalid && innerForm.foo.$dirty || currentEvent[eventGridColumn.id] && innerForm.foo.$invalid || outerForm.submitted && innerForm.foo.$invalid" class="required">{{getErrorMessage(eventGridColumn.id)}}</span> --> + </div> <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"> - </div> + </div> </ng-form> </td> </tr> @@ -195,7 +202,7 @@ ng-model="currentEvent.eventDate" ng-disabled="editingEventInFull" ng-required="true" - ng-model-options="{ updateOn: 'blur' }" + d2-date-validator name="eventDate" input-field-id='eventDate' @@ -211,7 +218,7 @@ <td> <input type="number" ng-model="currentEvent.coordinate.latitude" - ng-model-options="{ updateOn: 'blur' }" + name="latitude" d2-coordinate-validator ng-required="false" @@ -227,7 +234,7 @@ <td> <input type="number" ng-model="currentEvent.coordinate.longitude" - ng-model-options="{ updateOn: 'blur' }" + name="longitude" d2-coordinate-validator ng-required="false" @@ -263,7 +270,7 @@ d2-number-validator number-type={{prStDes[de.dataElement.id].dataElement.numberType}} ng-model="currentEvent[de.dataElement.id]" - ng-model-options="{ updateOn: 'blur' }" + ng-required={{prStDes[de.dataElement.id].compulsory}} name="foo" input-field-id={{de.dataElement.id}} @@ -271,20 +278,19 @@ </div> <div ng-switch-when="string"> <div class="container-fluid" ng-if="prStDes[de.dataElement.id].dataElement.optionSet"> - <span ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options.length > 8"> + <div class="overflow-visible" ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options.length > 8"> <input type="text" class="typeahead" placeholder=" " - ng-model="currentEvent[de.dataElement.id]" - ng-model-options="{ updateOn: 'blur' }" + ng-model="currentEvent[de.dataElement.id]" typeahead="option.name as option.name for option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" - typeahead-open-on-focus - typeahead-editable="false" + typeahead-focus-first="false" + typeahead-editable=false ng-required={{prStDes[de.dataElement.id].compulsory}} name="foo" input-field-id={{de.dataElement.id}} - style="width:99%;"/> - </span> + style="width:98%;"/> + </div> <span ng-if="selectedProgram.dataEntryMethod && prStDes[de.dataElement.id].dataElement.optionSet.options.length < 7"> <label> <input type="radio" @@ -307,7 +313,7 @@ <div ng-if="!prStDes[de.dataElement.id].dataElement.optionSet"> <input type="text" ng-model="currentEvent[de.dataElement.id]" - ng-model-options="{ updateOn: 'blur' }" + ng-required={{prStDes[de.dataElement.id].compulsory}} name="foo" input-field-id={{de.dataElement.id}} @@ -316,7 +322,7 @@ </div> <div ng-switch-when="bool"> <select ng-model="currentEvent[de.dataElement.id]" - ng-model-options="{ updateOn: 'blur' }" + ng-required={{prStDes[de.dataElement.id].compulsory}} name="foo" input-field-id={{de.dataElement.id}} @@ -331,7 +337,7 @@ placeholder="{{dhis2CalendarFormat.keyDateFormat}}" d2-date max-date="prStDes[de.dataElement.id].allowFutureDate ? '' : 0" - ng-model-options="{ updateOn: 'blur' }" + d2-date-validator ng-model="currentEvent[de.dataElement.id]" ng-required={{prStDes[de.dataElement.id].compulsory}} === modified 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 2015-05-22 10:23:04 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html 2015-06-02 12:25:03 +0000 @@ -19,7 +19,7 @@ ng-model="currentEvent.eventDate" ng-disabled="editingEventInFull" ng-required="true" - ng-model-options="{ updateOn: 'blur' }" + d2-date-validator name="eventDate" input-field-id='eventDate' @@ -34,7 +34,7 @@ <td> <input type="number" ng-model="currentEvent.coordinate.latitude" - ng-model-options="{ updateOn: 'blur' }" + name="latitude" d2-coordinate-validator ng-required="false" @@ -50,7 +50,7 @@ <td> <input type="number" ng-model="currentEvent.coordinate.longitude" - ng-model-options="{ updateOn: 'blur' }" + name="longitude" d2-coordinate-validator ng-required="false" === 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 2015-04-30 11:28:47 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html 2015-06-02 12:25:03 +0000 @@ -127,10 +127,9 @@ <ng-form name="innerFormGrid"> <div ng-switch="eventGridColumn.type"> <div ng-switch-when="int"> - <input type="text" + <input type="number" program-stage-data-element={{prStDes[eventGridColumn.id]}} - d2-validation - d2-number-validation + d2-number-validator number-type={{prStDes[eventGridColumn.id].dataElement.numberType}} ng-model="currentEvent[eventGridColumn.id]" ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" @@ -144,7 +143,6 @@ <div ng-switch-when="string"> <div ng-if="eventGridColumn.id == 'uid'"> <input type="text" - d2-validation ng-model="currentEvent[eventGridColumn.id]" ng-disabled=true name="foo" @@ -161,7 +159,6 @@ typeahead="option.name as option.name for option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" typeahead-open-on-focus typeahead-editable="false" - d2-typeahead-validation ng-required={{eventGridColumn.compulsory}} ng-disabled="eventGridColumn.id == 'uid'" input-field-id={{eventGridColumn.id}} @@ -176,7 +173,6 @@ <input type="radio" input-field-id={{eventGridColumn.id}} name="foo" - d2-validation ng-required={{eventGridColumn.compulsory}} ng-model="currentEvent[eventGridColumn.id]" ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" @@ -186,7 +182,6 @@ <input type="radio" input-field-id={{eventGridColumn.id}} name={{eventGridColumn.id}} - d2-validation ng-required={{eventGridColumn.compulsory}} ng-model="currentEvent[eventGridColumn.id]" ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" @@ -198,7 +193,6 @@ </div> <div ng-if="!optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id]"> <input type="text" - d2-validation ng-model="currentEvent[eventGridColumn.id]" ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" ng-required={{eventGridColumn.compulsory}} @@ -213,8 +207,7 @@ </div> </div> <div ng-switch-when="bool"> - <select d2-validation - ng-model="currentEvent[eventGridColumn.id]" + <select ng-model="currentEvent[eventGridColumn.id]" ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" ng-required={{eventGridColumn.compulsory}} input-field-id={{eventGridColumn.id}} @@ -232,7 +225,7 @@ placeholder="{{dhis2CalendarFormat.keyDateFormat}}" d2-date max-date="prStDes[eventGridColumn.id].allowFutureDate ? '' : 0" - d2-validation + d2-date-validator ng-model="currentEvent[eventGridColumn.id]" blur-or-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" ng-required={{eventGridColumn.compulsory}} @@ -256,8 +249,9 @@ ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]" /> </div> - </div> - <span ng-show="currentEvent[eventGridColumn.id] && innerFormGrid.foo.$invalid || outerForm.submitted && innerFormGrid.foo.$invalid" class="required">{{getErrorMessage(eventGridColumn.id)}}</span> + </div> + <div ng-messages="innerFormGrid.foo.$error" ng-if="interacted(innerFormGrid.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"> + </div> </ng-form> </div> <!-- Visible when event is under editing in grid --> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2015-04-20 11:38:15 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2015-06-02 12:25:03 +0000 @@ -17,8 +17,8 @@ <div class="pull-right"> <div class="btn-group" dropdown is-open="status.isopen"> - <button type="button" class="btn btn-default dropdown-toggle"> - <i class="fa fa-cog" title="{{'settings'| translate}}"></i> + <button type="button" title="{{'settings'| translate}}" class="btn btn-default dropdown-toggle" dropdown-toggle> + <i class="fa fa-cog"></i> </button> <ul class="dropdown-menu pull-right" role="menu"> <li><a href ng-click="showHideWidgets()">{{'show_hide_widgets'| translate}}</a></li> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-05-27 14:22:12 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-06-02 12:25:03 +0000 @@ -20,7 +20,7 @@ CustomFormService, PeriodService) { //Data entry form - $scope.dataEntryOuterForm = {}; + $scope.outerForm = {}; $scope.displayCustomForm = false; $scope.currentElement = {}; $scope.schedulingEnabled = false; @@ -49,7 +49,7 @@ $scope.showEventColors = false; //listen for the selected items - $scope.$on('dashboardWidgets', function() { + $scope.$on('dashboardWidgets', function() { $scope.showDataEntryDiv = false; $scope.showEventCreationDiv = false; $scope.currentEvent = null; @@ -112,7 +112,6 @@ var eventStage = $scope.stagesById[dhis2Event.programStage]; if(angular.isObject(eventStage)){ - dhis2Event.name = eventStage.name; dhis2Event.reportDateDescription = eventStage.reportDateDescription; dhis2Event.dueDate = DateUtils.formatFromApiToUser(dhis2Event.dueDate); @@ -125,7 +124,7 @@ } dhis2Event.statusColor = EventUtils.getEventStatusColor(dhis2Event); - dhis2Event = processEvent(dhis2Event, eventStage); + dhis2Event = EventUtils.processEvent(dhis2Event, eventStage, $scope.optionSets, $scope.prStDes); $scope.eventsByStage[dhis2Event.programStage].push(dhis2Event); if($scope.currentStage && $scope.currentStage.id === dhis2Event.programStage){ @@ -267,56 +266,6 @@ $scope.currentPeriod[$scope.currentEvent.programStage] = period; }; - var processEvent = function(event, stage){ - - event.providedElsewhere = []; - - angular.forEach(event.dataValues, function(dataValue){ - - var prStDe = $scope.prStDes[dataValue.dataElement]; - - if( prStDe ){ - var val = dataValue.value; - if(prStDe.dataElement){ - if(val && prStDe.dataElement.optionSetValue && $scope.optionSets[prStDe.dataElement.optionSet.id].options ){ - val = OptionSetService.getName($scope.optionSets[prStDe.dataElement.optionSet.id].options, val); - } - if(val && prStDe.dataElement.type === 'date'){ - val = DateUtils.formatFromApiToUser(val); - } - if(prStDe.dataElement.type === 'trueOnly'){ - if(val === 'true'){ - val = true; - } - else{ - val = ''; - } - } - } - event[dataValue.dataElement] = val; - if(dataValue.providedElsewhere){ - event.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere; - } - } - - }); - - if(stage.captureCoordinates){ - event.coordinate = {latitude: event.coordinate.latitude ? event.coordinate.latitude : '', - longitude: event.coordinate.longitude ? event.coordinate.longitude : ''}; - } - - event.allowProvidedElsewhereExists = false; - for(var i=0; i<stage.programStageDataElements.length; i++){ - if(stage.programStageDataElements[i].allowProvidedElsewhere){ - event.allowProvidedElsewhereExists = true; - break; - } - } - - return event; - }; - function updateCurrentEventInStage(){ var index = -1; @@ -330,16 +279,23 @@ } }; - $scope.saveDatavalue = function(prStDe){ - + $scope.saveDatavalue = function(prStDe, field){ + + //console.log('the field: ', field); + $scope.currentElement = {}; + //check for input validity - $scope.dataEntryOuterForm.submitted = true; - if( $scope.dataEntryOuterForm.$invalid ){ + //$scope.outerForm.submitted = true; + $scope.updateSuccess = false; + if( field.$invalid ){ + //console.log('form is invalid...'); + $scope.currentElement = {id: prStDe.dataElement.id, saved: false}; return false; } - + //input is valid var value = $scope.currentEvent[prStDe.dataElement.id]; + //var value = inputField.$viewValue; if($scope.currentEventOriginal[prStDe.dataElement.id] !== value){ @@ -354,8 +310,6 @@ } } - $scope.updateSuccess = false; - $scope.currentElement = {id: prStDe.dataElement.id, saved: false}; var ev = { event: $scope.currentEvent.event, @@ -866,7 +820,7 @@ $scope.showMap = function(event){ var modalInstance = $modal.open({ - templateUrl: '../dhis-web-commons/coordinatecapture/map.html', + templateUrl: '../dhis-web-commons/angular-forms/map.html', controller: 'MapController', windowClass: 'modal-full-window', resolve: { @@ -886,6 +840,14 @@ }); }; + $scope.interacted = function(field) { + var status = false; + if(field){ + status = $scope.outerForm.submitted || field.$dirty; + } + return status; + }; + }) .controller('EventCreationController', === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2015-05-18 17:05:23 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2015-06-02 12:25:03 +0000 @@ -76,8 +76,7 @@ <div ng-if="currentEvent"> <!-- event dates/scheduling begin --> - <!--<div class="row" ng-if="!currentStage.periodType">--> - <div class="row"> + <div class="row" ng-if="!currentStage.periodType"> <div class="col-md-6"> {{currentEvent.reportDateDescription}} <input type="text" @@ -120,12 +119,12 @@ class="form-control" ng-class="{'input-success': latitudeSaved}" name="latitude" - min="-90" - max="90" + d2-coordinate-validator ng-blur="saveCoordinate('LAT')" ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed" ng-required="false"/> - <span ng-show="outerForm.latitude.$invalid" class="required">{{'value_must_be_between'| translate}} [-90 ... 90]</span> + <div ng-messages="outerForm.latitude.$error" ng-if="interacted(outerForm.latitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"> + </div> </div> <div class="col-md-6"> {{'longitude'| translate}}<span><a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a></span> @@ -134,19 +133,19 @@ class="form-control" ng-class="{'input-success': longitudeSaved}" name="longitude" - min="-180" - max="180" + d2-coordinate-validator ng-blur="saveCoordinate('LNG')" ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed" ng-required="false"/> - <span ng-show="outerForm.longitude.$invalid" class="required">{{'value_must_be_between'| translate}}[-180 ... 180]</span> + <div ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"> + </div> </div> </div> <!-- coordinates begin --> <!-- data entry form begins --> <div ng-if="currentEvent.eventDate"> - <div class="clear vertical-spacing" ng-if="displayCustomForm" ng-include="'../dhis-web-commons/customform/custom-form.html'"></div> + <div class="clear vertical-spacing" ng-if="displayCustomForm" ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div> <div class="clear vertical-spacing" ng-if="!displayCustomForm" ng-include="'components/dataentry/default-form.html'"></div> </div> <!-- data entry form ends --> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-05-27 14:22:12 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-06-02 12:25:03 +0000 @@ -1,4 +1,4 @@ -<form name="dataEntryOuterForm" novalidate> +<form name="outerForm" novalidate> <table class="table-borderless table-striped" ng-if='currentEvent && !currentStage.programStageSections.length'> <thead> <tr class="col-md-12"> @@ -22,20 +22,21 @@ </a> </td> <td class="col-md-5"> - <ng-form name="dataEntryInnerForm"> + <ng-form name="innerForm"> <div ng-if="prStDe.dataElement.optionSetValue"> <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDe.dataElement.optionSet.id].options.length >= 7"> <input type="text" ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' ng-model="currentEvent[prStDe.dataElement.id]" + class="typeahead" + placeholder=" " ng-required={{prStDe.compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - typeahead="option.name as option.name for option in optionSets[prStDe.dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" - typeahead-open-on-focus + typeahead="option.name as option.name for option in optionSets[prStDe.dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" + typeahead-focus-first="false" typeahead-editable="false" - ng-blur="saveDatavalue(prStDe)" + ng-blur="saveDatavalue(prStDe, innerForm.foo)" name="foo"/> - <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid || !currentEvent[prStDe.dataElement.id] && currentElement.id === prStDe.dataElement.id" class="error">{{'invalid'| translate}}</span> </div> <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDe.dataElement.optionSet.id].options.length < 7"> <label> @@ -45,7 +46,7 @@ ng-required={{prStDe.compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" ng-model="currentEvent[prStDe.dataElement.id]" - ng-change="saveDatavalue(prStDe)" + ng-change="saveDatavalue(prStDe, innerForm.foo)" value=""> {{'no_value' | translate}}<br> </label><br> <span ng-repeat="option in optionSets[prStDe.dataElement.optionSet.id].options"> @@ -56,7 +57,7 @@ ng-required={{prStDe.compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" ng-model="currentEvent[prStDe.dataElement.id]" - ng-change="saveDatavalue(prStDe)" + ng-change="saveDatavalue(prStDe, innerForm.foo)" value={{option.name}}> {{option.name}} </label><br> </span> @@ -64,47 +65,61 @@ </div> <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.type"> <div ng-switch-when="int"> - <input type="text" + <input type="number" + string-to-number + number-type={{prStDe.dataElement.numberType}} ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' - ng-model="currentEvent[prStDe.dataElement.id]" + ng-model="currentEvent[prStDe.dataElement.id]" + d2-number-validator ng-required={{prStDe.compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - ng-blur="saveDatavalue(prStDe)" + ng-blur="saveDatavalue(prStDe, innerForm.foo)" 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='getInputNotifcationClass(prStDe.dataElement.id,false)' - ng-model="currentEvent[prStDe.dataElement.id]" - ng-required={{prStDe.compulsory}} - ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - ng-blur="saveDatavalue(prStDe)" - name="foo"/> + <div ng-switch-when="string"> + <span ng-if="eventGridColumn.textType==='longText'"> + <textarea rows="3" + ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' + ng-model="currentEvent[prStDe.dataElement.id]" + ng-required={{prStDe.compulsory}} + ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" + ng-blur="saveDatavalue(prStDe, innerForm.foo)" + name="foo"/> + </span> + <span ng-if="eventGridColumn.textType!=='longText'"> + <input type="text" + ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' + ng-model="currentEvent[prStDe.dataElement.id]" + ng-required={{prStDe.compulsory}} + ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" + ng-blur="saveDatavalue(prStDe, innerForm.foo)" + name="foo"/> + </span> </div> <div ng-switch-when="bool"> <select ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' ng-model="currentEvent[prStDe.dataElement.id]" ng-required={{prStDe.compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - ng-change="saveDatavalue(prStDe)" + ng-change="saveDatavalue(prStDe, innerForm.foo)" name="foo"> <option value="">{{'please_select'| translate}}</option> <option value="false">{{'no'| translate}}</option> <option value="true">{{'yes'| translate}}</option> </select> - </div> <div ng-switch-when="date"> <input type="text" placeholder="{{dhis2CalendarFormat.keyDateFormat}}" d2-date + d2-date-validator max-date="prStDe.allowFutureDate ? '' : 0" ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' ng-model="currentEvent[prStDe.dataElement.id]" + ng-required={{prStDe.compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - blur-or-change="saveDatavalue(prStDe)" + blur-or-change="saveDatavalue(prStDe, innerForm.foo)" name="foo"/> </div> <div ng-switch-when="trueOnly"> @@ -113,12 +128,14 @@ ng-model="currentEvent[prStDe.dataElement.id]" ng-required={{prStDe.compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - ng-change="saveDatavalue(prStDe)" + ng-change="saveDatavalue(prStDe, innerForm.foo)" name="foo"/> </div> </div> + <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"> + </div> </ng-form> - <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'required'| translate}}</span> + </td> <td class="col-md-2" ng-if="allowProvidedElsewhereExists"> <div class="align-center" ng-show="prStDe.allowProvidedElsewhere"> @@ -158,17 +175,19 @@ </a> </td> <td class="col-md-5"> - <ng-form name="dataEntryInnerForm"> + <ng-form name="innerForm"> <div ng-switch="prStDes[de.dataElement.id].dataElement.type"> <div ng-switch-when="int"> - <input type="text" + <input type="number" + d2-number-validator + number-type={{prStDe.dataElement.numberType}} ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)' ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" + ng-required={{prStDes[de.dataElement.id].compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - ng-blur="saveDatavalue(prStDes[de.dataElement.id])" + ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)" name="foo"/> - <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'number_required'| translate}}</span> </div> <div ng-switch-when="string"> <div ng-if="prStDes[de.dataElement.id].dataElement.optionSet"> @@ -176,14 +195,14 @@ <input type="text" ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)' ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" + ng-required={{prStDes[de.dataElement.id].compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" typeahead="option.name as option.name for option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" - typeahead-open-on-focus + typeahead-focus-first="false" typeahead-editable="false" ng-blur="saveDatavalue(prStDes[de.dataElement.id])" name="foo"/> - <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid || !currentEvent[prStDes[de.dataElement.id].dataElement.id] && currentElement.id === prStDes[de.dataElement.id].dataElement.id" class="error">{{'invalid'| translate}}</span> </div> <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options.length < 7"> <label> @@ -237,9 +256,11 @@ <input type="text" placeholder="{{dhis2CalendarFormat.keyDateFormat}}" d2-date + d2-date-validator max-date="prStDes[de.dataElement.id].allowFutureDate ? '' : 0" ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)' ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" + ng-required={{prStDes[de.dataElement.id].compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" blur-or-change="saveDatavalue(prStDes[de.dataElement.id])" @@ -251,12 +272,13 @@ ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" ng-required={{prStDes[de.dataElement.id].compulsory}} ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" - ng-change="saveDatavalue(prStDes[de.dataElement.id])" + ng-change="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)" name="foo"/> </div> + </div> + <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"> </div> - </ng-form> - <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'required'| translate}}</span> + </ng-form> </td> <td class="col-md-2" ng-if="allowProvidedElsewhereExists"> <div class="align-center" ng-show="prStDes[de.dataElement.id].allowProvidedElsewhere"> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html 2015-04-17 13:14:21 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html 2015-06-02 12:25:03 +0000 @@ -1,5 +1,5 @@ <h3 ng-if="widget !== 'PROFILE'">{{'profile'| translate}}</h3> -<table class="table-borderless table-striped"> +<table class="dhis2-list-table-striped dhis2-table-hover"> <tr ng-repeat="attribute in attributes"> <td> {{attribute.name}}<span ng-if="attribute.mandatory || attribute.unique" class="required">*</span> @@ -9,10 +9,12 @@ <span ng-if="attribute.optionSetValue"> <input type="text" name="foo" - class="form-control" - ng-model="selectedTei[attribute.id]" + class="form-control typeahead" + ng-model="selectedTei[attribute.id]" + placeholder=" " typeahead="option.name as option.name for option in optionSets[attributesById[attribute.id].optionSet.id].options | filter:$viewValue | limitTo:20" - typeahead-open-on-focus + typeahead-focus-first="false" + typeahead-editable=false ng-disabled="editingDisabled" ng-required="attribute.mandatory || attribute.unique"/> </span> <span ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType"> @@ -22,6 +24,7 @@ name="foo" class="form-control" d2-date + d2-date-validator max-date="attribute.allowFutureDate ? '' : 0" ng-model="selectedTei[attribute.id]" ng-disabled="editingDisabled" @@ -47,7 +50,7 @@ </select> </span> <span ng-switch-when="number"> - <input type="text" + <input type="number" name="foo" class="form-control" ng-model="selectedTei[attribute.id]" @@ -70,9 +73,10 @@ ng-disabled="editingDisabled" ng-required="attribute.mandatory || attribute.unique"/> </span> - </span> - </ng-form> - <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span> + </span> + <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"> + </div> + </ng-form> </td> </tr> </table> \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2015-04-24 12:19:02 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2015-06-02 12:25:03 +0000 @@ -201,6 +201,14 @@ }, 100); }; + $scope.interacted = function(field) { + var status = false; + if(field){ + status = $scope.outerForm.submitted || field.$dirty; + } + return status; + }; + var goToDashboard = function(destination, teiId){ //reset form $scope.selectedTei = {}; === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html 2015-03-26 12:26:37 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html 2015-06-02 12:25:03 +0000 @@ -6,7 +6,7 @@ <!-- Entity type begins --> <div ng-if="!selectedProgram && registrationMode === 'REGISTRATION'"> <h3>{{'category'| translate}}</h3> - <table class="table-borderless table-striped"> + <table class="dhis2-list-table-striped dhis2-table-hover"> <tr> <td> {{'entity_type'| translate}} @@ -22,7 +22,7 @@ <!-- Entity type ends --> <!--custom registration form begins --> - <div class="row col-sm-12 vertical-spacing" ng-if="customFormExists"> + <div class="vertical-spacing" ng-if="customFormExists"> <!-- enrollment and incidence dates begin --> <div ng-if="selectedProgram && !customForm.hasProgramDate && registrationMode !== 'PROFILE'"> @@ -30,13 +30,13 @@ </div> <!-- enrollment and incidence dates end --> - <div ng-include="'../dhis-web-commons/customform/custom-form.html'"></div> + <div ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div> </div> <!-- custom registration form ends--> <!-- default registration form begins --> - <div class="row col-sm-12 vertical-spacing" ng-if="!customFormExists"> + <div class="vertical-spacing" ng-if="!customFormExists"> <div ng-if="selectedProgram && registrationMode !== 'PROFILE'" ng-include="'components/registration/enrollment-dates-form.html'"></div> <div ng-include="'components/registration/default-registration-form.html'"></div> </div> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html 2015-04-17 13:28:51 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html 2015-06-02 12:25:03 +0000 @@ -32,7 +32,7 @@ name="foo" class="form-control" ng-model="attribute.value" - typeahead="option.name as option.name for option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:20" + typeahead="option.name as option.name for option in optionSets[attribute.optionSet.id].options| filter:$viewValue | limitTo:20" typeahead-open-on-focus ng-required="attribute.mandatory"/> </div> @@ -42,7 +42,7 @@ name="foo" class="form-control" ng-model="attribute.value" - typeahead="option.name as option.name for option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:20" + typeahead="option.name as option.name for option in optionSets[attribute.optionSet.id].options| filter:$viewValue | limitTo:20" typeahead-open-on-focus typeahead-editable=false ng-required="attribute.mandatory"/> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html 2015-03-26 14:59:40 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html 2015-06-02 12:25:03 +0000 @@ -20,8 +20,8 @@ <div ng-show="relationshipWidget.expand" class="panel-body dashboard-widget-container"> <div ng-show="selectedTei && !selectedTei.relationships || selectedTei.relationships.length < 1" class="alert alert-warning">{{'no_relationship'| translate}}</div> <div ng-show="!selectedTei" class="alert alert-danger">{{'relationship_not_possible'| translate}}</div> - - <div ng-if="relatedTeis"> + + <div ng-if="relatedTeis.length > 0"> <table class="table table-striped dhis2-table-hover table-bordered"> <tr> <th> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-04-21 07:42:41 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-06-02 12:25:03 +0000 @@ -33,6 +33,20 @@ required=Required number_required=Number required date_required=Date required +number=Number +value_must_be_number=Value must be number +value_must_be_posInt=Value must be positive integer +value_must_be_negInt=Value must be negative integer +value_must_be_zeroPositiveInt=Value must be zero or positive integer +value_must_be_int=Value must be integer +posInt=Positive Integer +negInt=Negative Integer +zeroPositiveInt=Zero or Positive Integer +latitude_required=Value must be between [-90 ... 90] +longitude_required=Value must be between [-180 ... 180] +future_date_not_allowed=Future date is not allowed +option_required=Value must be selected from drop-down +bool_required=Value must be a boolean filter=Filter search=Search _search=search === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 2015-05-08 19:23:53 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 2015-06-02 12:25:03 +0000 @@ -37,7 +37,7 @@ <link type="text/css" rel="stylesheet" href="../dhis-web-commons/javascripts/jQuery/calendars/css/ui-redmond.calendars.picker.css"> <script type="text/javascript" src="../dhis-web-commons/select2/select2.min.js"></script> - <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/select2/select2.css"> + <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/select2/select2.css"> <script type="text/javascript" src="../dhis-web-commons/bootstrap/js/bootstrap.min.js"></script> <link type="text/css" rel="stylesheet" href="../dhis-web-commons/bootstrap/css/bootstrap.min.css"> @@ -51,10 +51,9 @@ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-route.js"></script> <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/angular-messages.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-sanitize.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/angular/ui-bootstrap.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/moment/moment-with-langs.min.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/underscore.min.js"></script> @@ -88,9 +87,10 @@ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate.min.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js"></script> + <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js"></script> - <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js"></script> + <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.angular.controllers.js"></script> <script type="text/javascript" src="scripts/app.js"></script> <script type="text/javascript" src="scripts/services.js"></script> === 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 2015-01-28 19:03:29 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js 2015-06-02 12:25:03 +0000 @@ -7,6 +7,7 @@ 'ngRoute', 'ngCookies', 'ngSanitize', + 'ngMessages', 'trackerCaptureServices', 'trackerCaptureFilters', 'trackerCaptureDirectives', @@ -55,6 +56,7 @@ }); $translateProvider.preferredLanguage('en'); + $translateProvider.useSanitizeValueStrategy('escaped'); $translateProvider.useLoader('i18nLoader'); }); === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-04-17 13:25:22 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-06-02 12:25:03 +0000 @@ -11,7 +11,6 @@ $scope, $modal, $location, - $translate, $filter, $timeout, Paginator, @@ -265,7 +264,7 @@ $scope.doSearch = true; if(!$scope.sortColumn.id){ - $scope.sortGrid({id: 'created', name: $translate('registration_date'), valueType: 'date', displayInListNoProgram: false, showFilter: false, show: false}); + $scope.sortGrid({id: 'created', name: 'registration_date', valueType: 'date', displayInListNoProgram: false, showFilter: false, show: false}); } }); }; === 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 2015-04-17 07:19:16 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2015-06-02 12:25:03 +0000 @@ -13,4 +13,18 @@ }, templateUrl: 'components/dataentry/event-paging.html' }; +}) + +.directive('stringToNumber', function() { + return { + require: 'ngModel', + link: function(scope, element, attrs, ngModel) { + ngModel.$parsers.push(function(value) { + return '' + value; + }); + ngModel.$formatters.push(function(value) { + return parseFloat(value, 10); + }); + } + } }); \ 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 2015-05-18 17:05:23 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-06-02 12:25:03 +0000 @@ -1028,7 +1028,7 @@ return { getEventReport: function(orgUnit, ouMode, program, startDate, endDate, programStatus, eventStatus, pager){ - var url = '../api/events/eventRows.json?' + 'orgUnit=' + orgUnit + '&ouMode='+ ouMode + '&program=' + program; + var url = '../api/events/eventRows.json?' + 'orgUnit=' + orgUnit + '&ouMode='+ ouMode + '&program=' + program + '&addAttributes=true'; if( programStatus ){ url = url + '&programStatus=' + programStatus; @@ -1340,8 +1340,8 @@ var columns = attributes ? angular.copy(attributes) : []; //also add extra columns which are not part of attributes (orgunit for example) - columns.push({id: 'orgUnitName', name: $translate('registering_unit'), valueType: 'string', displayInListNoProgram: false}); - columns.push({id: 'created', name: $translate('registration_date'), valueType: 'date', displayInListNoProgram: false}); + columns.push({id: 'orgUnitName', name: $translate.instant('registering_unit'), valueType: 'string', displayInListNoProgram: false}); + columns.push({id: 'created', name: $translate.instant('registration_date'), valueType: 'date', displayInListNoProgram: false}); //generate grid column for the selected program/attributes angular.forEach(columns, function(column){ @@ -1596,6 +1596,58 @@ } return e; + }, + processEvent: function(event, stage, optionSets, prStDes){ + event.providedElsewhere = {}; + angular.forEach(event.dataValues, function(dataValue){ + + var prStDe = prStDes[dataValue.dataElement]; + + if( prStDe ){ + var val = dataValue.value; + if(prStDe.dataElement){ + if(val && prStDe.dataElement.type === 'int' ){ + if( dhis2.validation.isNumber(val) ){ + //val = parseInt(val); + val = new Number(val); + } + } + if(val && prStDe.dataElement.optionSetValue && optionSets[prStDe.dataElement.optionSet.id].options ){ + val = OptionSetService.getName(optionSets[prStDe.dataElement.optionSet.id].options, val); + } + if(val && prStDe.dataElement.type === 'date'){ + val = DateUtils.formatFromApiToUser(val); + } + if(prStDe.dataElement.type === 'trueOnly'){ + if(val === 'true'){ + val = true; + } + else{ + val = ''; + } + } + } + event[dataValue.dataElement] = val; + if(dataValue.providedElsewhere){ + event.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere; + } + } + + }); + + if(stage.captureCoordinates){ + event.coordinate = {latitude: event.coordinate.latitude ? event.coordinate.latitude : '', + longitude: event.coordinate.longitude ? event.coordinate.longitude : ''}; + } + + event.allowProvidedElsewhereExists = false; + for(var i=0; i<stage.programStageDataElements.length; i++){ + if(stage.programStageDataElements[i].allowProvidedElsewhere){ + event.allowProvidedElsewhereExists = true; + break; + } + } + return event; } }; }); === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-05-27 14:22:12 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-06-02 12:25:03 +0000 @@ -407,7 +407,7 @@ return $.ajax( { url: '../api/programStages.json', type: 'GET', - data: 'filter=id:eq:' + id +'&fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,formName,description,type,optionSetValue,optionSet[id]]]' + data: 'filter=id:eq:' + id +'&fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,formName,type,numberType,textType,optionSetValue,optionSet[id]]]' }).done( function( response ){ _.each( _.values( response.programStages ), function( programStage ) { dhis2.tc.store.set( 'programStages', programStage ); === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-04-24 12:56:49 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-06-02 12:25:03 +0000 @@ -178,7 +178,7 @@ } .input-error { - background-color: #fffe8c; + background-color: #ff8a8a; } .input-success { @@ -795,6 +795,7 @@ } .dropdown-menu { margin: -5px 0 0 0; + z-index: 2000 !important; } .btn-link { @@ -1003,7 +1004,7 @@ .map_context_menu{ background-color:white; border:1px solid gray; - z-index: 1000; + z-index: 2000; } .map_context_menu_item{ padding:3px 6px; @@ -1077,4 +1078,4 @@ div.event-paging span.seperator { display:none; -} \ No newline at end of file +} === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html 2015-04-17 13:14:21 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html 2015-06-02 12:25:03 +0000 @@ -42,7 +42,7 @@ <td> <div ng-if="attribute.optionSetValue"> <select multiple ui-select2 ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;"> - <option ng-repeat="option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:100" value="{{option.code}}">{{option.name}}</option> + <option ng-repeat="option in optionSets[attribute.optionSet.id].options| filter:$viewValue | limitTo:100" value="{{option.code}}">{{option.name}}</option> </select> </div> <div ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType"> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html 2015-04-20 11:38:15 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html 2015-06-02 12:25:03 +0000 @@ -77,7 +77,7 @@ </span> <div class="pull-right hideInPrint"> <div class="btn-group" dropdown is-open="status.isopen"> - <button type="button" class="btn btn-default dropdown-toggle" ng-disabled="trackedEntityList.rows.length <= 0"> + <button type="button" class="btn btn-default dropdown-toggle" dropdown-toggle ng-disabled="trackedEntityList.rows.length <= 0"> <i class="fa fa-cog" title="{{'settings'| translate}}"></i> </button> <ul class="dropdown-menu pull-right" role="menu"> === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html 2015-04-14 09:56:06 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html 2015-06-02 12:25:03 +0000 @@ -20,7 +20,7 @@ <!-- sort icon begins --> <span ng-hide="gridColumn.showFilter" class="bold pointer" title="{{'sort'| translate}}"> <span ng-class="{true: 'red'} [sortColumn.id === gridColumn.id]"><i class="fa fa-sort"></i></span> - {{gridColumn.name}} + {{gridColumn.name | translate}} </span> <!-- sort icon ends --> </th>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp