dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39967
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20230: event-capture: program validation rule - WIP
------------------------------------------------------------
revno: 20230
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-09-18 16:40:16 +0200
message:
event-capture: program validation rule - WIP
modified:
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/scripts/controllers.js
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/views/defaultForm.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/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2015-09-18 09:14:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2015-09-18 14:40:16 +0000
@@ -8,6 +8,8 @@
event_details=Event details
no_registered_event=There are no registered events.
event_registration_error=Error in event registration
+validation_error=Validation Error
+validation_warning=Validation Warning
help=Help
click_for_action=Click for more actions
details=Details
=== 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-09-18 10:31:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-09-18 14:40:16 +0000
@@ -886,6 +886,7 @@
};
//listen for rule effect changes
+ $scope.warningMessages = [];
$scope.$on('ruleeffectsupdated', function(event, args) {
if($rootScope.ruleeffects[args.event]) {
//Establish which event was affected:
@@ -898,9 +899,8 @@
}
});
}
-
- angular.forEach($rootScope.ruleeffects[args.event], function(effect) {
- if( effect.dataElement ) {
+ angular.forEach($rootScope.ruleeffects[args.event], function(effect) {
+ if( effect.dataElement && effect.ineffect ) {
//in the data entry controller we only care about the "hidefield" actions
if(effect.action === "HIDEFIELD") {
if(effect.dataElement) {
@@ -925,6 +925,23 @@
$log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
}
}
+ if(effect.action === "SHOWERROR" && effect.dataElement.id){
+ var dialogOptions = {
+ headerText: 'validation_error',
+ bodyText: effect.content
+ };
+ DialogService.showDialog({}, dialogOptions);
+
+ $scope.currentEvent[effect.dataElement.id] = $scope.currentEventOriginialValue[effect.dataElement.id];
+ }
+ if(effect.action === "SHOWWARNING"){
+ $scope.warningMessages[effect.dataElement.id] = effect.content + '<br>';
+ var dialogOptions = {
+ headerText: 'validation_warning',
+ bodyText: effect.content
+ };
+ DialogService.showDialog({}, dialogOptions);
+ }
}
});
}
@@ -959,7 +976,7 @@
}
};
- $scope.saveDatavalue = function(){
+ $scope.saveDatavalue = function(){
$scope.executeRules();
};
/*$scope.getInputNotifcationClass = function(id, custom, event){
=== 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 2015-09-16 14:48:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css 2015-09-18 14:40:16 +0000
@@ -256,16 +256,8 @@
padding-left: 5px
}
-input[type=number], input[type=text], input[type=password], input[type=email], textarea
-{
- border: 1px solid #aaa;
- padding: 5px 0 !important;
- //border-radius: 4px;
-}
-
select {
- padding: 3px 0 !important;
- //border-radius: 4px;
+ padding: 1px !important;
}
.clear {
@@ -352,4 +344,22 @@
.div-bottom {
position: absolute;
bottom: 0;
+}
+
+.form-control-ui-select {
+ width:100%;
+ height:34px;
+ line-height:1.0;
+ padding: 20px 6px;
+ border-radius: 4px;
+}
+
+.select2-container .select2-choice {
+ padding: 5px !important;
+ color: #555 !important;
+}
+
+.form-control{
+ color: black;
+ padding: 5px !important;
}
\ 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 2015-09-08 09:15:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-09-18 14:40:16 +0000
@@ -71,7 +71,7 @@
</tr>
<tr ng-repeat="eventGridColumn in eventGridColumns" ng-if="eventGridColumn.id !== 'comment' && eventGridColumn.id !== 'uid' && eventGridColumn.id !== 'event_date' && !isHidden(eventGridColumn.id)">
<td >
- {{eventGridColumn.name}} - {{eventGridColumn.valueType}}<span ng-if="eventGridColumn.compulsory" class="required">*</span>
+ {{eventGridColumn.name}}<span ng-if="eventGridColumn.compulsory" class="required">*</span>
</td>
<td >
<ng-form name="innerForm">
@@ -82,9 +82,9 @@
ng-required={{eventGridColumn.compulsory}}
name="foo"
input-field-id={{eventGridColumn.id}}
- on-select={{saveDatavalue()}}
+ on-select="saveDatavalue()"
style="width:100%;">
- <ui-select-match allow-clear="true" style="width:100%; height:34px; line-height:1.0; padding: 2px 6px; margin-top:5px" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
+ <ui-select-match allow-clear="true" class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
<ui-select-choices repeat="option.name as option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
<span ng-bind-html="option.name | highlight: $select.search"></span>
</ui-select-choices>
@@ -241,7 +241,7 @@
</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>
+ </div>
</ng-form>
</td>
</tr>
@@ -345,9 +345,9 @@
ng-required={{prStDes[de.dataElement.id].compulsory}}
name="foo"
input-field-id={{de.dataElement.id}}
- on-select={{saveDatavalue()}}
+ on-select="saveDatavalue()"
style="width:100%;">
- <ui-select-match allow-clear="true"style="width:100%; height:34px; line-height:1.0; padding: 2px 6px; margin-top:5px" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
+ <ui-select-match allow-clear="true" class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
<ui-select-choices repeat="option.name as option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
<span ng-bind-html="option.name | highlight: $select.search"></span>
</ui-select-choices>