dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43957
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22299: tracker-capture: when registration form is empty on submit, notify user through dialog window.
------------------------------------------------------------
revno: 22299
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-03-14 15:35:45 +0100
message:
tracker-capture: when registration form is empty on submit, notify user through dialog window.
modified:
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
--
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-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 2016-03-14 14:00:44 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2016-03-14 14:35:45 +0000
@@ -6,6 +6,7 @@
$location,
$timeout,
$modal,
+ $translate,
AttributesFactory,
DHIS2EventFactory,
TEService,
@@ -257,13 +258,17 @@
//get tei attributes and their values
//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.formEmpty = result.formEmpty;
$scope.tei = result.tei;
if($scope.formEmpty){//registration form is empty
- return false;
+ var dialogOptions = {
+ headerText: 'error',
+ bodyText: $translate.instant('form_is_empty_fill_at_least_one')
+ };
+ DialogService.showDialog({}, dialogOptions);
+ return;
}
performRegistration(destination);
};
@@ -272,8 +277,7 @@
var flag = {debug: true, verbose: false};
//repopulate attributes with updated values
- $scope.selectedTei.attributes = [];
-
+ $scope.selectedTei.attributes = [];
angular.forEach($scope.attributes, function(metaAttribute){
var newAttributeInArray = {attribute:metaAttribute.id,
code:metaAttribute.code,
@@ -312,7 +316,6 @@
$scope.warningMessages = effectResult.warningMessages;
});
-
$scope.interacted = function(field) {
var status = false;
if(field){
@@ -321,8 +324,7 @@
return status;
};
- $scope.getTrackerAssociate = function(selectedAttribute, existingAssociateUid){
-
+ $scope.getTrackerAssociate = function(selectedAttribute, existingAssociateUid){
var modalInstance = $modal.open({
templateUrl: 'components/teiadd/tei-add.html',
controller: 'TEIAddController',
@@ -354,13 +356,13 @@
}
}
});
-
modalInstance.result.then(function (res) {
if(res && res.id){
$scope.selectedTei[selectedAttribute.id] = res.id;
}
});
};
+
$scope.cancelRegistrationWarning = function(cancelFunction){
var modalOptions = {
=== 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 2016-02-15 10:16:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html 2016-03-14 14:35:45 +0000
@@ -41,10 +41,6 @@
</div>
<!-- default registration form ends -->
- <div class="hideInPrint" 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="cancelRegistrationWarning(cancel)">{{'cancel'| translate}}</button>