dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40030
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20270: tracker-capture: error and warning actions for program rules are now implemented. This means prog...
------------------------------------------------------------
revno: 20270
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-21 17:01:55 +0200
message:
tracker-capture: error and warning actions for program rules are now implemented. This means program criteria is now obsolete.
removed:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/validation-message.html
added:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/warnings.html
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/index.html
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/indicators.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.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/dataentry/table-entry-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/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/controllers.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/home.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-21 08:48:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2015-09-21 15:01:55 +0000
@@ -9,7 +9,7 @@
no_registered_event=There are no registered events.
event_registration_error=Error in event registration
validation_error=Validation Error
-validation_warning=Validation Warning
+validation_warnings=Validation Warnings
help=Help
click_for_action=Click for more actions
details=Details
@@ -140,7 +140,7 @@
loading_tree=Loading orgunit tree
loading_metadata=Loading meta-data
future_date_not_allowed=Future date is not allowed
-warnings=Warnings
+validation_warnings
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.
=== 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-09-21 08:48:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html 2015-09-21 15:01:55 +0000
@@ -1,6 +1,5 @@
<!DOCTYPE html>
-<html ng-app="eventCapture">
-<!--<html manifest="cacheManifest.action" ng-app="eventCapture">-->
+<html manifest="cacheManifest.action" ng-app="eventCapture">
<head>
<title>Event Capture</title>
@@ -63,7 +62,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>
=== 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-21 08:48:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css 2015-09-21 15:01:55 +0000
@@ -324,7 +324,11 @@
font-size: 14pt;
color: #585D61;
border-bottom: 1px solid #e3e3e3;
- //text-align: center;
+}
+
+.warning-message-label {
+ height: 34px;
+ font-size: 14px;
}
.selectionGroup{
@@ -364,7 +368,6 @@
padding: 5px !important;
}
-.form-control-label {
- height: 34px;
- font-size: 14px;
+.bold {
+ font-weight: bold;
}
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html 2015-07-02 07:19:49 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-<div class="section-label">
- {{'indicators' | translate}}
-</div>
-<table class="dhis2-list-table-striped">
- <tr ng-repeat="pid in allProgramRules.programIndicators.rules">
- <td>
- {{pid.name}}
- </td>
- <td>
- <input type="text" class="form-control" value={{formatNumberResult(ruleeffects[currentEvent.event][pid.id].data)}} ng-disabled="true">
- </td>
- </tr>
-</table>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators.html 2015-09-21 08:48:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators.html 2015-09-21 15:01:55 +0000
@@ -1,13 +1,19 @@
-<div class="section-label">
- {{'indicators' | translate}}
+<div class="panel panel-info">
+ <div class="panel-heading bold">
+ {{'indicators'| translate}}
+ </div>
+ <div class="panel-body">
+ <table class="dhis2-list-table-striped">
+ <tr ng-repeat="pid in allProgramRules.programIndicators.rules">
+ <td>
+ {{pid.name}}
+ </td>
+ <td>
+ <input type="text" class="form-control" value={{formatNumberResult(ruleeffects[currentEvent.event][pid.id].data)}} ng-disabled="true">
+ </td>
+ </tr>
+ </table>
+ </div>
</div>
-<table class="dhis2-list-table-striped">
- <tr ng-repeat="pid in allProgramRules.programIndicators.rules">
- <td>
- {{pid.name}}
- </td>
- <td>
- <input type="text" class="form-control" value={{formatNumberResult(ruleeffects[currentEvent.event][pid.id].data)}} ng-disabled="true">
- </td>
- </tr>
-</table>
\ No newline at end of file
+
+
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.html 2015-09-21 08:48:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/warnings.html 2015-09-21 15:01:55 +0000
@@ -1,10 +1,14 @@
-<div class="section-label">
- {{'warnings' | translate}}
-</div>
-<table class="dhis2-list-table-striped">
- <tr ng-repeat="msg in warningMessages">
- <td class="form-control-label">
- {{msg}}
- </td>
- </tr>
-</table>
\ No newline at end of file
+<div class="panel panel-warning">
+ <div class="panel-heading bold">
+ {{'validation_warnings'| translate}}
+ </div>
+ <div class="panel-body">
+ <table class="dhis2-list-table-striped">
+ <tr ng-repeat="msg in warningMessages">
+ <td class="warning-message-label">
+ {{msg}}
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
\ No newline at end of file
=== 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-09-17 11:18:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-09-21 15:01:55 +0000
@@ -29,7 +29,7 @@
name="foo"
on-select="saveDatavalue(prStDe, innerForm.foo)"
style="width:100%;">
- <ui-select-match allow-clear="true" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} 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" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} 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[prStDe.dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
<span ng-bind-html="option.name | highlight: $select.search"></span>
</ui-select-choices>
@@ -250,7 +250,7 @@
name="foo"
on-select="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
style="width:100%;">
- <ui-select-match allow-clear="true" ng-class={{getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)}} 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" ng-class={{getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)}} 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>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html 2015-09-07 08:14:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html 2015-09-21 15:01:55 +0000
@@ -38,7 +38,7 @@
name="foo"
on-select="saveDatavalue(prStDe, innerForm.foo)"
style="width:100%;">
- <ui-select-match allow-clear="true" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} 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" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} 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[prStDe.dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
<span ng-bind-html="option.name | highlight: $select.search"></span>
</ui-select-choices>
=== 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-09-15 16:03:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html 2015-09-21 15:01:55 +0000
@@ -14,7 +14,7 @@
name="foo"
on-select="teiValueUpdated(selectedTei, attribute.id)"
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[attributesById[attribute.id].optionSet.id].options | filter: $select.search | limitTo:30">
<span ng-bind-html="option.name | highlight: $select.search"></span>
</ui-select-choices>
=== 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-09-14 15:16:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2015-09-21 15:01:55 +0000
@@ -5,7 +5,6 @@
$scope,
$location,
$timeout,
- $modal,
AttributesFactory,
DHIS2EventFactory,
TEService,
@@ -28,8 +27,6 @@
$scope.tei = {};
$scope.registrationMode = 'REGISTRATION';
$scope.hiddenFields = {};
- $scope.errorMessages = {};
- $scope.warningMessages = {};
$scope.attributesById = CurrentSelection.getAttributesById();
if(!$scope.attributesById){
@@ -67,14 +64,13 @@
//watch for selection of program
$scope.$watch('selectedProgram', function() {
$scope.trackedEntityForm = null;
- $scope.customForm = null;
-
- $scope.allProgramRules = [];
+ $scope.customForm = null;
+ $scope.allProgramRules = {constants: [], programIndicators: {}, programValidations: [], programVariables: [], programRules: []};
if( angular.isObject($scope.selectedProgram) && $scope.selectedProgram.id ){
- TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
- $scope.allProgramRules = rules;
- });
- }
+ TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
+ $scope.allProgramRules = rules;
+ });
+ }
if($scope.registrationMode === 'REGISTRATION'){
$scope.getAttributes($scope.registrationMode);
@@ -89,7 +85,8 @@
if($scope.registrationMode !== 'REGISTRATION'){
$scope.selectedTei = args.selectedTei;
- $scope.tei = angular.copy(args.selectedTei);
+ $scope.tei = angular.copy(args.selectedTei);
+ //$scope.teiOriginal = angular.copy(args.selectedTei);
}
if($scope.registrationMode === 'PROFILE'){
@@ -254,38 +251,14 @@
//but there could be a case where attributes are non-mandatory and
//registration form comes empty, in this case enforce at least one value
- var result = RegistrationService.processForm($scope.tei, $scope.selectedTei, $scope.attributesById, $scope.selectedProgram);
+ var result = RegistrationService.processForm($scope.tei, $scope.selectedTei, $scope.attributesById);
$scope.formEmpty = result.formEmpty;
$scope.tei = result.tei;
if($scope.formEmpty){//registration form is empty
return false;
- }
-
- if(!result.validation.valid){//validation exists
- var modalInstance = $modal.open({
- templateUrl: 'components/registration/validation-message.html',
- controller: 'ValidationMessageController',
- resolve: {
- validation: function () {
- return result.validation;
- }
- }
- });
-
- modalInstance.result.then(function (res) {
- if(!res) {//strict validation
- return false;
- }
- else{//not-strict validation
- performRegistration(destination);
- }
- }, function () {
- });
- }
- else{//no validation
- performRegistration(destination);
}
+ performRegistration(destination);
};
$scope.cancelRelativeRegistration = function(){
@@ -295,8 +268,8 @@
};
- var processRuleEffect = function(){
-
+ var processRuleEffect = function(){
+ $scope.warningMessages = [];
angular.forEach($rootScope.ruleeffects['registration'], function (effect) {
if (effect.trackedEntityAttribute) {
//in the data entry controller we only care about the "hidefield", showerror and showwarning actions
@@ -323,12 +296,14 @@
$log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have an attribute defined");
}
} else if (effect.action === "SHOWERROR") {
- if (effect.trackedEntityAttribute) {
-
+ if (effect.trackedEntityAttribute) {
if(effect.ineffect) {
- $scope.errorMessages[effect.trackedEntityAttribute.id] = effect.content;
- } else {
- $scope.errorMessages[effect.trackedEntityAttribute.id] = false;
+ var dialogOptions = {
+ headerText: 'validation_error',
+ bodyText: effect.content
+ };
+ DialogService.showDialog({}, dialogOptions);
+ $scope.selectedTei[effect.trackedEntityAttribute.id] = $scope.tei[effect.trackedEntityAttribute.id];
}
}
else {
@@ -337,9 +312,7 @@
} else if (effect.action === "SHOWWARNING") {
if (effect.trackedEntityAttribute) {
if(effect.ineffect) {
- $scope.warningMessages[effect.trackedEntityAttribute.id] = effect.content;
- } else {
- $scope.warningMessages[effect.trackedEntityAttribute.id] = false;
+ $scope.warningMessages.push(effect.content);
}
}
else {
@@ -368,8 +341,10 @@
$scope.selectedTei.attributes.push(newAttributeInArray);
});
- TrackerRulesExecutionService.executeRules($scope.allProgramRules, 'registration', null, null, $scope.selectedTei, $scope.selectedEnrollment, flag);
-
+
+ if($scope.selectedProgram && $scope.selectedProgram.id){
+ TrackerRulesExecutionService.executeRules($scope.allProgramRules, 'registration', null, null, $scope.selectedTei, $scope.selectedEnrollment, flag);
+ }
};
//check if field is hidden
@@ -396,20 +371,4 @@
}
return status;
};
-})
-
-.controller('ValidationMessageController',
- function ($scope,
- $modalInstance,
- validation) {
-
- $scope.validationResult = validation;
-
- $scope.proceed = function () {
- $modalInstance.close(true);
- };
-
- $scope.cancel = function () {
- $modalInstance.close(false);
- };
});
=== 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-09-14 15:36:30 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html 2015-09-21 15:01:55 +0000
@@ -1,72 +1,78 @@
-<div ng-class="{true: 'bordered-div'} [registrationMode === 'REGISTRATION']" ng-controller="RegistrationController">
+<div ng-controller="RegistrationController">
+ <div ng-class="{true: 'bordered-div col-sm-8'} [registrationMode === 'REGISTRATION']">
- <!--registration form starts -->
- <form name="outerForm" novalidate>
-
- <!-- Entity type begins -->
- <div ng-if="!selectedProgram && registrationMode === 'REGISTRATION'">
- <h3>{{'category'| translate}}</h3>
- <table class="dhis2-list-table-striped dhis2-table-hover">
- <tr>
- <td>
- {{'entity_type'| translate}}
- </td>
- <td>
- <select class="form-control" ng-model="trackedEntities.selected" ng-options="trackedEntity.name for trackedEntity in trackedEntities.available | orderBy: 'name'">
- </select>
- </td>
- </tr>
- </table>
- <hr>
- </div>
- <!-- Entity type ends -->
-
- <!--custom registration form begins -->
- <div class="vertical-spacing" ng-if="customFormExists">
-
- <!-- enrollment and incidence dates begin -->
- <div ng-if="selectedProgram && !customForm.hasProgramDate && registrationMode !== 'PROFILE'">
- <div ng-include="'components/registration/enrollment-dates-form.html'"></div>
- </div>
- <!-- enrollment and incidence dates end -->
-
- <div ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
-
- </div>
- <!-- custom registration form ends-->
-
- <!-- default registration form begins -->
- <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>
- <!-- default registration form ends -->
-
- <div ng-if="formEmpty && outerForm.submitted">
- <div class="alert alert-warning">{{'form_is_empty_fill_at_least_one'| translate}}</div>
- </div>
-
- <div ng-if="!editingDisabled && registrationMode === 'PROFILE'" class="vertical-spacing">
- <button type="button" class="btn btn-primary small-horizonal-spacing" ng-click="registerEntity(null)">{{'save'| translate}}</button>
- <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancel()">{{'cancel'| translate}}</button>
- </div>
-
- <div class="vertical-spacing" ng-if="registrationMode === 'ENROLLMENT'">
- <button type="button" class="btn btn-primary" ng-click="registerEntity(null)">{{'enroll'| translate}}</button>
- <button type="button" class="btn btn-default" ng-click="showNewEnrollment()">{{'cancel'| translate}}</button>
- </div>
-
- <div class="vertical-spacing" ng-if="registrationMode === 'REGISTRATION'">
- <button type="button" class="btn btn-primary" ng-click="registerEntity('DASHBOARD')">{{'save_and_continue'| translate}}</button>
- <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity('SELF')">{{'save_and_add_new'| translate}}</button>
- <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="showRegistration()">{{'cancel'| translate}}</button>
- </div>
-
- <div ng-if="registrationMode === 'RELATIONSHIP'" class="vertical-spacing">
- <button type="button" class="btn btn-primary small-horizonal-spacing" ng-click="registerEntity('RELATIONSHIP')">{{'save'| translate}}</button>
- <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancelRelativeRegistration()">{{'cancel'| translate}}</button>
- </div>
-
- </form>
- <!--registration form ends -->
-</div>
\ No newline at end of file
+ <!--registration form starts -->
+ <form name="outerForm" novalidate>
+
+ <!-- Entity type begins -->
+ <div ng-if="!selectedProgram && registrationMode === 'REGISTRATION'">
+ <h3>{{'category'| translate}}</h3>
+ <table class="dhis2-list-table-striped dhis2-table-hover">
+ <tr>
+ <td>
+ {{'entity_type'| translate}}
+ </td>
+ <td>
+ <select class="form-control" ng-model="trackedEntities.selected" ng-options="trackedEntity.name for trackedEntity in trackedEntities.available | orderBy: 'name'">
+ </select>
+ </td>
+ </tr>
+ </table>
+ <hr>
+ </div>
+ <!-- Entity type ends -->
+
+ <!--custom registration form begins -->
+ <div class="vertical-spacing" ng-if="customFormExists">
+
+ <!-- enrollment and incidence dates begin -->
+ <div ng-if="selectedProgram && !customForm.hasProgramDate && registrationMode !== 'PROFILE'">
+ <div ng-include="'components/registration/enrollment-dates-form.html'"></div>
+ </div>
+ <!-- enrollment and incidence dates end -->
+
+ <div ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
+
+ </div>
+ <!-- custom registration form ends-->
+
+ <!-- default registration form begins -->
+ <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>
+ <!-- default registration form ends -->
+
+ <div ng-if="formEmpty && outerForm.submitted">
+ <div class="alert alert-warning">{{'form_is_empty_fill_at_least_one'| translate}}</div>
+ </div>
+
+ <div ng-if="!editingDisabled && registrationMode === 'PROFILE'" class="vertical-spacing">
+ <button type="button" class="btn btn-primary small-horizonal-spacing" ng-click="registerEntity(null)">{{'save'| translate}}</button>
+ <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancel()">{{'cancel'| translate}}</button>
+ </div>
+
+ <div class="vertical-spacing" ng-if="registrationMode === 'ENROLLMENT'">
+ <button type="button" class="btn btn-primary" ng-click="registerEntity(null)">{{'enroll'| translate}}</button>
+ <button type="button" class="btn btn-default" ng-click="showNewEnrollment()">{{'cancel'| translate}}</button>
+ </div>
+
+ <div class="vertical-spacing" ng-if="registrationMode === 'REGISTRATION'">
+ <button type="button" class="btn btn-primary" ng-click="registerEntity('DASHBOARD')">{{'save_and_continue'| translate}}</button>
+ <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity('SELF')">{{'save_and_add_new'| translate}}</button>
+ <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="showRegistration()">{{'cancel'| translate}}</button>
+ </div>
+
+ <div ng-if="registrationMode === 'RELATIONSHIP'" class="vertical-spacing">
+ <button type="button" class="btn btn-primary small-horizonal-spacing" ng-click="registerEntity('RELATIONSHIP')">{{'save'| translate}}</button>
+ <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancelRelativeRegistration()">{{'cancel'| translate}}</button>
+ </div>
+
+ </form>
+ <!--registration form ends -->
+ </div>
+
+ <div ng-if="warningMessages.length > 0" ng-class="{true: 'bordered-div col-sm-4'} [registrationMode === 'REGISTRATION']">
+ <div ng-include="'views/warnings.html'"></div>
+ </div>
+</div>
=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/validation-message.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/validation-message.html 2015-08-24 09:55:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/validation-message.html 1970-01-01 00:00:00 +0000
@@ -1,18 +0,0 @@
-<div class="modal-header page">
- <h3>{{'validation_result' | translate}}</h3>
-</div>
-<div class="modal-body page">
- <table class="table table-striped table-bordered">
- <tr ng-repeat="message in validationResult.messages">
- <td>
- {{message.name}} {{'is_expected_to_be' | translate}} <strong>{{message.operator}} {{message.expected}}</strong> {{'but_found' | translate}} <strong>{{message.found}}</strong>
- </td>
- </tr>
- </table>
-
- <div class="alert alert-warning">{{'do_you_want_to_proceed' | translate}}</div>
-</div>
-<div class="modal-footer page">
- <button class="btn btn-primary" data-ng-click="proceed()">{{'yes'| translate}}</button>
- <button class="btn btn-default" data-ng-click="cancel()">{{'no'| translate}}</button>
-</div>
\ No newline at end of file
=== 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-09-17 11:21:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-09-21 15:01:55 +0000
@@ -271,6 +271,8 @@
relationship_error=Error in relationship assignment
error=Error
success=Success
+validation_error=Validation Error
+validation_warnings=Validation Warnings
dashboard_layout_saved=Dashboard layout saved as default.
dashboard_layout_not_saved=Error in saving dashboard layout saved as default.
event_orgunit_name=Organisation unit
=== 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-09-17 11:22:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html 2015-09-21 15:01:55 +0000
@@ -37,10 +37,6 @@
<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" href="../dhis-web-commons/javascripts/angular/plugins/select.css">
- <link type="text/css" rel="stylesheet" href="../dhis-web-commons/javascripts/angular/plugins/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">
@@ -132,6 +128,8 @@
<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" href="../dhis-web-commons/javascripts/angular/plugins/select.css">
+ <link type="text/css" rel="stylesheet" href="../dhis-web-commons/javascripts/angular/plugins/select2.css">
<link type="text/css" rel="stylesheet" href="styles/style.css">
<link type="text/css" rel="stylesheet" media="screen" href="styles/screen.css">
=== 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-09-17 15:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-09-21 15:01:55 +0000
@@ -29,7 +29,7 @@
//Selection
$scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];
- $scope.selectedOuMode = $scope.ouModes[0];
+ $scope.selectedOuMode = $scope.ouModes[0];
$scope.dashboardProgramId = ($location.search()).program;
$scope.selectedOrgUnitId = ($location.search()).ou;
$scope.treeLoaded = false;
@@ -64,6 +64,8 @@
if( angular.isObject($scope.selectedOrgUnit)){
+ $scope.searchingOrgUnit = $scope.selectedOrgUnit;
+
SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
$scope.trackedEntityList = null;
@@ -146,34 +148,18 @@
ProgramFactory.getProgramsByOu($scope.selectedOrgUnit, $scope.selectedProgram).then(function(response){
$scope.programs = response.programs;
$scope.selectedProgram = response.selectedProgram;
-
+ $scope.trackedEntityList = null;
+ $scope.selectedSearchMode = $scope.searchMode.listAll;
$scope.processAttributes();
- $scope.search($scope.searchMode.listAll);
+ //$scope.search($scope.searchMode.listAll);
});
}
};
$scope.getProgramAttributes = function(program){
$scope.selectedProgram = program;
-
- /*if($scope.selectedProgram){
- $location.path('/').search({program: $scope.selectedProgram.id});
- }
- else{
- $location.path('/').search({});
- }*/
-
- $scope.trackedEntityList = null;
-
- $scope.processAttributes();
-
- if($scope.showRegistrationDiv){
- $scope.doSearch = false;
- }
-
- if($scope.doSearch){
- $scope.search($scope.searchMode);
- }
+ $scope.trackedEntityList = null;
+ $scope.processAttributes();
};
$scope.processAttributes = function(){
@@ -182,6 +168,14 @@
$scope.attributes = $scope.generateAttributeFilters(atts);
var grid = TEIGridService.generateGridColumns($scope.attributes, $scope.selectedOuMode.name);
$scope.gridColumns = grid.columns;
+
+ if($scope.showRegistrationDiv){
+ $scope.doSearch = false;
+ }
+
+ if($scope.doSearch){
+ $scope.search($scope.searchMode);
+ }
});
};
@@ -331,10 +325,6 @@
$scope.trackedEntityList = null;
};
- $scope.showHideSearch = function(){
- $scope.showSearchDiv = !$scope.showSearchDiv;
- };
-
$scope.showRegistration = function(){
$scope.showRegistrationDiv = !$scope.showRegistrationDiv;
@@ -346,8 +336,8 @@
}, 200);
}
else{
- $scope.doSearch = true;
- $scope.getProgramAttributes($scope.selectedProgram);
+ $scope.doSearch = true;
+ $scope.showTrackedEntityDiv = true;
}
};
=== 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-09-17 15:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-09-21 15:01:55 +0000
@@ -480,39 +480,8 @@
return def.promise;
}
},
- processForm: function(existingTei, formTei, attributesById, program){
- var tei = angular.copy(existingTei);
- var enrollmentValidation = {valid: true, messages: [], attributes: []};
- if(program && program.validationCriterias){
- for(var key in program.validationCriterias){
- angular.forEach(program.validationCriterias[key], function(vc){
- var att = attributesById[key];
- var operator = '';
- if(vc.property && vc.value && att && att.valueType){
- if(att.valueType === 'NUMBER' && dhis2.validation.isNumber(vc.value)){
- vc.value = parseInt(vc.value);
- }
- if(vc.operator === 0){
- enrollmentValidation.valid = formTei[key] === vc.value;
- operator = $translate.instant('equals_to');
- }
- else if(vc.operator === 1){
- enrollmentValidation.valid = formTei[key] > vc.value;
- operator = $translate.instant('greater_than');
- }
- else{
- enrollmentValidation.valid = formTei[key] < vc.value;
- operator = $translate.instant('less_than');
- }
-
- if(!enrollmentValidation.valid){
- enrollmentValidation.messages.push({name: attributesById[key].name, operator: operator, expected: vc.value, found: formTei[key] ? formTei[key] : $translate.instant('empty')});
- }
- }
- });
- }
- }
-
+ processForm: function(existingTei, formTei, attributesById){
+ var tei = angular.copy(existingTei);
tei.attributes = [];
var formEmpty = true;
for(var k in attributesById){
@@ -523,7 +492,7 @@
}
delete tei[k];
}
- return {tei: tei, formEmpty: formEmpty, validation: enrollmentValidation};
+ return {tei: tei, formEmpty: formEmpty};
}
};
})
@@ -1132,7 +1101,6 @@
var pushDirectAddressedVariable = function(variableWithCurls) {
var variableName = $filter('trimvariablequalifiers')(variableWithCurls);
-;
var variableNameParts = variableName.split('.');
var newVariableObject;
=== 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-09-17 11:21:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-09-21 15:01:55 +0000
@@ -274,7 +274,7 @@
return $.ajax( {
url: '../api/programs/' + id + '.json',
type: 'GET',
- data: 'fields=id,name,type,version,dataEntryMethod,enrollmentDateLabel,incidentDateLabel,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,version,minDaysFromStart,standardInterval,periodType,generatedByEnrollmentDate,reportDateDescription,repeatable,autoGenerateEvent,openAfterEnrollment,reportDateToUse],dataEntryForm[name,style,htmlCode,format],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]],validationCriterias[id,name,operator,value,property]'
+ data: 'fields=id,name,type,version,dataEntryMethod,enrollmentDateLabel,incidentDateLabel,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,version,minDaysFromStart,standardInterval,periodType,generatedByEnrollmentDate,reportDateDescription,repeatable,autoGenerateEvent,openAfterEnrollment,reportDateToUse],dataEntryForm[name,style,htmlCode,format],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]]'
}).done( function( program ){
var ou = {};
if(program.organisationUnits){
@@ -290,22 +290,7 @@
ur[u.id] = u.name;
});
}
- program.userRoles = ur;
-
- var vc = {};
- if(program.validationCriterias){
- _.each(_.values( program.validationCriterias), function(c){
- if(vc[c.property]){
- vc[c.property].push(c);
- }
- else{
- vc[c.property] = [];
- vc[c.property].push(c);
- }
- });
- }
- program.validationCriterias = vc;
-
+ program.userRoles = ur;
dhis2.tc.store.set( 'programs', program );
});
};
=== 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-09-11 15:53:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-09-21 15:01:55 +0000
@@ -666,6 +666,17 @@
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
}
+.section-label{
+ font-size: 14pt;
+ color: #585D61;
+ border-bottom: 1px solid #e3e3e3;
+}
+
+.warning-message-label {
+ height: 34px;
+ font-size: 14px;
+}
+
.invalid-input {
border-style:solid;
border-color:red;
@@ -1137,4 +1148,17 @@
.inactive-tei{
color: #ff4000;
+}
+
+.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;
}
\ No newline at end of file
=== 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-09-17 15:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html 2015-09-21 15:01:55 +0000
@@ -76,10 +76,10 @@
<!--- search and registration menu begins -->
<div class="row vertical-spacing not-for-screen">
- <div class="col-md-4">
+ <div class="col-sm-6 col-md-4">
<h4>{{orgUnitLabel}}</h4>
</div>
- <div class="col-md-4">
+ <div class="col-sm-6 col-md-4">
<input type="text" class="form-control" ng-disabled='true' value="{{selectedOrgUnit.name}}">
</div>
</div>
@@ -108,11 +108,11 @@
<div id="searchDropDownParent" class="input-group col-md-4 hideInPrint">
<input type="text" placeholder="{{searchCriteriaLabel}}" ng-model="searchText" class="form-control expanded" d2-enter="search(searchMode.freeText)" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="showHideSearch()" ng-disabled="showRegistrationDiv" d2-set-focus={{doSearch}}>
<div class="input-group-btn">
- <button class="btn btn-default search-dropdown-button trim" type="button" title="{{advancedSearchLabel}}" data-toggle="dropdown" ng-click="showHideSearch()" ng-disabled="showRegistrationDiv"><i class="fa fa-caret-down"></i></button>
+ <button class="btn btn-default search-dropdown-button trim" type="button" title="{{advancedSearchLabel}}" data-toggle="dropdown" ng-disabled="showRegistrationDiv"><i class="fa fa-caret-down"></i></button>
<button class="btn btn-primary trim" type="button" title="{{searchLabel}}" ng-disabled="showRegistrationDiv" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>
<div id="searchDropDown" class="dropdown-menu dropdown-menu-right">
<form name="searchForm">
- <div ng-if="showSearchDiv" ng-include="'views/advanced-search.html'"></div>
+ <div ng-include="'views/advanced-search.html'"></div>
</form>
</div>
</div>
@@ -145,24 +145,20 @@
<!--- search and registration menu ends -->
<!--- Error display for search begins -->
- <div class="row" ng-if="emptySearchAttribute || !searchText && emptySearchText">
- <div class="col-md-8 vertical-spacing">
- <div class="alert alert-warning">{{'search_input_required'| translate}}</div>
- </div>
+ <div class="row col-sm-12 vertical-spacing" ng-if="emptySearchAttribute || !searchText && emptySearchText">
+ <div class="alert alert-warning">{{'search_input_required'| translate}}</div>
</div>
<!--- Error display for search ends -->
<!--registration form begins -->
- <div class="row" ng-if="showRegistrationDiv">
- <div class="col-md-8">
- <div ng-include="'components/registration/registration.html'"></div>
- </div>
+ <div class="row col-sm-12" ng-if="showRegistrationDiv">
+ <div ng-include="'components/registration/registration.html'"></div>
</div>
<!-- registration form ends -->
<!-- entity grid begins -->
<i ng-if="!teiFetched" class="fa fa-spinner fa-spin fa-2x"></i>
- <div class="row col-md-12" ng-include="'views/tei.html'"></div>
+ <div class="row col-sm-12" ng-if="!showRegistrationDiv" ng-include="'views/tei.html'"></div>
<!-- entity grid ends -->
</div>
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/warnings.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/warnings.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/warnings.html 2015-09-21 15:01:55 +0000
@@ -0,0 +1,14 @@
+<div class="panel panel-warning">
+ <div class="panel-heading bold">
+ {{'validation_warnings'| translate}}
+ </div>
+ <div class="panel-body">
+ <table class="dhis2-list-table-striped">
+ <tr ng-repeat="msg in warningMessages">
+ <td class="warning-message-label">
+ {{msg}}
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
\ No newline at end of file