=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css 2016-02-03 10:35:50 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css 2016-02-03 15:55:33 +0000 @@ -466,3 +466,50 @@ width: 20px !important; text-align: center; } + +.radio-display-none { + display: none; +} + +.fa-stack > .fa.fa-stack-1x.fa-circle.radio-save-success { + color: #b9ffb9 !important; +} + +.fa-stack > .fa.fa-stack-1x.fa-circle.radio-save-error { + color: #ff8a8a !important; +} + +.fa-stack > .fa.fa-stack-1x.fa-circle.radio-white { + color: #FFFFFF !important; +} + +.fa-stack > .radio-default{ + color: #FFFFFF; +} + +.error-text { + color: red; +} + +.warning-text { + color: #C7C728; +} + +.custom-radio-group { + margin-left: -8px; +} + +.custom-radio-container{ + display: inline-block; +} + +.custom-radio-text { + display: inline-block; + margin-left: -5px; +} + +.custom-radio-error{ + margin-left: 5px; + width:100px; + text-align: center; +} \ No newline at end of file === 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 2016-02-03 10:35:50 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2016-02-03 15:55:33 +0000 @@ -145,37 +145,15 @@ class="form-control"> -
- - - +
+ +
- @@ -430,38 +405,14 @@
- - - - - + +
- - +
@@ -272,7 +272,7 @@
@@ -527,7 +527,7 @@
- - +
@@ -611,7 +611,7 @@
=== 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 2016-01-11 11:26:33 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2016-02-03 15:55:33 +0000 @@ -418,186 +418,4 @@ } ] }; -}) -.directive('dhis2RadioButton', function (){ - return { - restrict: 'E', - templateUrl: 'views/dhis2-radio-button.html', - scope: { - required: '=dhRequired', - value: '=dhValue', - disabled: '=dhDisabled', - name: '@dhName', - customOnClick: '&dhClick', - currentElement: '=dhCurrentElement', - event: '=dhEvent', - id: '=dhId' - }, - controller: [ - '$scope', - '$element', - '$attrs', - '$q', - 'CommonUtils', - function($scope, $element, $attrs, $q, CommonUtils){ - - $scope.status = ""; - $scope.clickedButton = ""; - - $scope.valueClicked = function (buttonValue){ - - $scope.clickedButton = buttonValue; - - var originalValue = $scope.value; - var tempValue = buttonValue; - if($scope.value === buttonValue){ - tempValue = ""; - } - - if(angular.isDefined($scope.customOnClick)){ - var promise = $scope.customOnClick({value: tempValue}); - if(angular.isDefined(promise) && angular.isDefined(promise.then)){ - promise.then(function(status){ - if(angular.isUndefined(status) || status !== "notSaved"){ - $scope.status = "saved"; - } - $scope.value = tempValue; - }, function(){ - $scope.status = "error"; - $scope.value = originalValue; - }); - } - else if(angular.isDefined(promise)){ - if(promise === false){ - $scope.value = originalValue; - } - else { - $scope.value = tempValue; - } - } - else{ - $scope.value = tempValue; - } - } - else{ - $scope.value = tempValue; - } - }; - - $scope.getDisabledValue = function(inValue){ - return CommonUtils.displayBooleanAsYesNo(inValue); - }; - - $scope.getDisabledIcon = function(inValue){ - if(inValue === true || inValue === "true"){ - return "fa fa-check"; - } - else if(inValue === false || inValue === "false"){ - return "fa fa-times"; - } - return ''; - } - - }], - link: function (scope, element, attrs) { - - scope.radioButtonColor = function(buttonValue){ - - if(scope.value !== ""){ - if(scope.status === "saved"){ - if(angular.isUndefined(scope.currentElement) || (scope.currentElement.id === scope.id && scope.currentElement.event === scope.event)){ - if(scope.clickedButton === buttonValue){ - return 'radio-save-success'; - } - } - //different solution with text chosen - /*else if(scope.status === "error"){ - if(scope.clickedButton === buttonValue){ - return 'radio-save-error'; - } - }*/ - } - } - return 'radio-white'; - }; - - scope.errorStatus = function(){ - - if(scope.status === 'error'){ - if(angular.isUndefined(scope.currentElement) || (scope.currentElement.id === scope.id && scope.currentElement.event === scope.event)){ - return true; - } - } - return false; - }; - - scope.radioButtonImage = function(buttonValue){ - - if(angular.isDefined(scope.value)){ - if(scope.value === buttonValue && buttonValue === "true"){ - return 'fa fa-stack-1x fa-check'; - } - else if(scope.value === buttonValue && buttonValue === "false"){ - return 'fa fa-stack-1x fa-times'; - } - } - return 'fa fa-stack-1x'; - }; - } - }; -}) - -.directive('dhis2Deselect', function ($document) { - return { - restrict: 'A', - scope: { - onDeselected: '&dhOnDeselected', - id: '@dhId', - preSelected: '=dhPreSelected' - }, - controller: [ - '$scope', - '$element', - '$attrs', - '$q', - function($scope, $element, $attrs, $q){ - - $scope.documentEventListenerSet = false; - $scope.elementClicked = false; - - $element.on('click', function(event) { - - $scope.elementClicked = true; - if($scope.documentEventListenerSet === false){ - $document.on('click', $scope.documentClick); - $scope.documentEventListenerSet = true; - } - }); - - $scope.documentClick = function(event){ - - var modalPresent = $(".modal-backdrop").length > 0; - var calendarPresent = $(".calendars-popup").length > 0; - var calendarPresentInEvent = $(event.target).parents(".calendars-popup").length > 0; - - if($scope.elementClicked === false && - modalPresent === false && - calendarPresent === false && - calendarPresentInEvent === false){ - $scope.onDeselected({id:$scope.id}); - $scope.$apply(); - $document.off('click', $scope.documentClick); - $scope.documentEventListenerSet = false; - } - $scope.elementClicked = false; - }; - - if(angular.isDefined($scope.preSelected) && $scope.preSelected === true){ - $document.on('click', $scope.documentClick); - $scope.documentEventListenerSet = true; - } - - }], - link: function (scope, element, attrs) {} - }; }); === removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dhis2-radio-button.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dhis2-radio-button.html 2016-01-14 17:33:09 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dhis2-radio-button.html 1970-01-01 00:00:00 +0000 @@ -1,66 +0,0 @@ - - - -
- - - - - - - - {{'Yes' | translate }} - - -    - - - - - - - - {{'No' | translate }} - - -
{{'save failed' | translate}}
- - -
- - -
-
-
- - {{getDisabledValue(value) | translate}} -
- === added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/radio-button.html' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/radio-button.html 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/radio-button.html 2016-02-03 15:55:33 +0000 @@ -0,0 +1,65 @@ + + + +
+ + + + + + + + {{'Yes' | translate }} + + +    + + + + + + + + {{'No' | translate }} + + +
{{'save failed' | translate}}
+ + +
+ + +
+
+
+ + {{getDisabledValue(value) | translate}} +
\ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js 2016-02-03 10:04:07 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js 2016-02-03 15:55:33 +0000 @@ -383,63 +383,244 @@ }) .directive('d2Audit', function () { - return { - restrict: 'E', - template: '', - scope:{ - dataElementId: '@dataelementId', - dataElementName: '@dataelementName', - currentEvent:'@', - type:'@', - selectedTeiId:'@', - isAuditIconPresent:'=?' - }, - controller:function($scope, $modal) { - if (!$scope.dataElementId) { - return; - } - - $scope.showAuditIcon = function() { - if ($scope.currentEvent && $scope.currentEvent !== 'SINGLE_EVENT') { - $scope.isAuditIconPresent = true; - return true; - } - if ($scope.type === "attribute" && $scope.selectedTeiId) { - $scope.isAuditIconPresent = true; - return true; - } - $scope.isAuditIconPresent = false; - return false; - } - - $scope.showAuditHistory = function() { - - $modal.open({ - templateUrl: "../dhis-web-commons/angular-forms/audit-history.html", - controller: "AuditHistoryController", - resolve: { - dataElementId: function () { - return $scope.dataElementId; - }, - dataElementName: function () { - return $scope.dataElementName; - }, - dataType: function() { - return $scope.type; - }, - currentEvent: function() { - return $scope.currentEvent; - }, - selectedTeiId: function() { - return $scope.selectedTeiId; - } - } - }) - - } - - } - }; - }); - - + return { + restrict: 'E', + template: '', + scope:{ + dataElementId: '@dataelementId', + dataElementName: '@dataelementName', + currentEvent:'@', + type:'@', + selectedTeiId:'@', + isAuditIconPresent:'=?' + }, + controller:function($scope, $modal) { + if (!$scope.dataElementId) { + return; + } + + $scope.showAuditIcon = function() { + if ($scope.currentEvent && $scope.currentEvent !== 'SINGLE_EVENT') { + $scope.isAuditIconPresent = true; + return true; + } + if ($scope.type === "attribute" && $scope.selectedTeiId) { + $scope.isAuditIconPresent = true; + return true; + } + $scope.isAuditIconPresent = false; + return false; + } + + $scope.showAuditHistory = function() { + + $modal.open({ + templateUrl: "../dhis-web-commons/angular-forms/audit-history.html", + controller: "AuditHistoryController", + resolve: { + dataElementId: function () { + return $scope.dataElementId; + }, + dataElementName: function () { + return $scope.dataElementName; + }, + dataType: function() { + return $scope.type; + }, + currentEvent: function() { + return $scope.currentEvent; + }, + selectedTeiId: function() { + return $scope.selectedTeiId; + } + } + }) + + } + + } + }; +}) + +.directive('d2RadioButton', function (){ + return { + restrict: 'E', + templateUrl: '../dhis-web-commons/angular-forms/radio-button.html', + scope: { + required: '=dhRequired', + value: '=dhValue', + disabled: '=dhDisabled', + name: '@dhName', + customOnClick: '&dhClick', + currentElement: '=dhCurrentElement', + event: '=dhEvent', + id: '=dhId' + }, + controller: [ + '$scope', + '$element', + '$attrs', + '$q', + 'CommonUtils', + function($scope, $element, $attrs, $q, CommonUtils){ + + $scope.status = ""; + $scope.clickedButton = ""; + + $scope.valueClicked = function (buttonValue){ + + $scope.clickedButton = buttonValue; + + var originalValue = $scope.value; + var tempValue = buttonValue; + if($scope.value === buttonValue){ + tempValue = ""; + } + + if(angular.isDefined($scope.customOnClick)){ + var promise = $scope.customOnClick({value: tempValue}); + if(angular.isDefined(promise) && angular.isDefined(promise.then)){ + promise.then(function(status){ + if(angular.isUndefined(status) || status !== "notSaved"){ + $scope.status = "saved"; + } + $scope.value = tempValue; + }, function(){ + $scope.status = "error"; + $scope.value = originalValue; + }); + } + else if(angular.isDefined(promise)){ + if(promise === false){ + $scope.value = originalValue; + } + else { + $scope.value = tempValue; + } + } + else{ + $scope.value = tempValue; + } + } + else{ + $scope.value = tempValue; + } + }; + + $scope.getDisabledValue = function(inValue){ + return CommonUtils.displayBooleanAsYesNo(inValue); + }; + + $scope.getDisabledIcon = function(inValue){ + if(inValue === true || inValue === "true"){ + return "fa fa-check"; + } + else if(inValue === false || inValue === "false"){ + return "fa fa-times"; + } + return ''; + } + + }], + link: function (scope, element, attrs) { + + scope.radioButtonColor = function(buttonValue){ + + if(scope.value !== ""){ + if(scope.status === "saved"){ + if(angular.isUndefined(scope.currentElement) || (scope.currentElement.id === scope.id && scope.currentElement.event === scope.event)){ + if(scope.clickedButton === buttonValue){ + return 'radio-save-success'; + } + } + //different solution with text chosen + /*else if(scope.status === "error"){ + if(scope.clickedButton === buttonValue){ + return 'radio-save-error'; + } + }*/ + } + } + return 'radio-white'; + }; + + scope.errorStatus = function(){ + + if(scope.status === 'error'){ + if(angular.isUndefined(scope.currentElement) || (scope.currentElement.id === scope.id && scope.currentElement.event === scope.event)){ + return true; + } + } + return false; + }; + + scope.radioButtonImage = function(buttonValue){ + + if(angular.isDefined(scope.value)){ + if(scope.value === buttonValue && buttonValue === "true"){ + return 'fa fa-stack-1x fa-check'; + } + else if(scope.value === buttonValue && buttonValue === "false"){ + return 'fa fa-stack-1x fa-times'; + } + } + return 'fa fa-stack-1x'; + }; + } + }; +}) + +.directive('dhis2Deselect', function ($document) { + return { + restrict: 'A', + scope: { + onDeselected: '&dhOnDeselected', + id: '@dhId', + preSelected: '=dhPreSelected' + }, + controller: [ + '$scope', + '$element', + '$attrs', + '$q', + function($scope, $element, $attrs, $q){ + + $scope.documentEventListenerSet = false; + $scope.elementClicked = false; + + $element.on('click', function(event) { + + $scope.elementClicked = true; + if($scope.documentEventListenerSet === false){ + $document.on('click', $scope.documentClick); + $scope.documentEventListenerSet = true; + } + }); + + $scope.documentClick = function(event){ + + var modalPresent = $(".modal-backdrop").length > 0; + var calendarPresent = $(".calendars-popup").length > 0; + var calendarPresentInEvent = $(event.target).parents(".calendars-popup").length > 0; + + if($scope.elementClicked === false && + modalPresent === false && + calendarPresent === false && + calendarPresentInEvent === false){ + $scope.onDeselected({id:$scope.id}); + $scope.$apply(); + $document.off('click', $scope.documentClick); + $scope.documentEventListenerSet = false; + } + $scope.elementClicked = false; + }; + + if(angular.isDefined($scope.preSelected) && $scope.preSelected === true){ + $document.on('click', $scope.documentClick); + $scope.documentEventListenerSet = true; + } + + }], + link: function (scope, element, attrs) {} + }; +}); \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2016-02-03 10:35:50 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2016-02-03 15:55:33 +0000 @@ -442,11 +442,21 @@ commonInputFieldProperty + '>
'; } else if (prStDe.dataElement.valueType === "BOOLEAN") { - newInputField = '' + + newInputField = ''; + /*newInputField = '' + '' + '' + '' + - ''; + '';*/ } else if (prStDe.dataElement.valueType === "DATE") { var maxDate = prStDe.allowFutureDate ? '' : 0; @@ -474,7 +484,7 @@ else if (prStDe.dataElement.valueType === "FILE_RESOURCE") { newInputField = '\n\ \n\ - {{fileNames[currentEvent.event][' + fieldId + '].length > 20 ? fileNames[currentEvent.event][' + fieldId + '].substring(0,20).concat(\'...\') : fileNames[currentEvent.event][' + fieldId + ']}}\n\ + {{fileNames[currentEvent.event][' + fieldId + '].length > 20 ? fileNames[currentEvent.event][' + fieldId + '].substring(0,20).concat(\'...\') : fileNames[currentEvent.event][' + fieldId + ']}}\n\ \n\ \n\ \n\