dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40536
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20574: tracker-capture: moved code form controllers to service
------------------------------------------------------------
revno: 20574
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-07 17:13:26 +0200
message:
tracker-capture: moved code form controllers to service
modified:
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/teiadd/tei-add-controller.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/services.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.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/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-10-07 09:14:45 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html 2015-10-07 15:13:26 +0000
@@ -7,7 +7,7 @@
<td>
<ng-form name="innerForm">
<span ng-if="attribute.optionSetValue">
- <ui-select ng-model="selectedTei[attribute.id]"
+ <ui-select ng-model="selectedTei[attribute.id]"
theme="select2"
ng-required="attribute.mandatory || attribute.unique"
ng-disabled="editingDisabled"
@@ -27,9 +27,12 @@
name="foo"
class="form-control"
d2-date
- d2-date-validator
+ d2-date-validator
max-date="attribute.allowFutureDate ? '' : 0"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
ng-disabled="editingDisabled"
blur-or-change="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -39,6 +42,9 @@
name="foo"
class="form-control"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
ng-disabled="editingDisabled"
ng-change="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -46,6 +52,9 @@
<span ng-switch-when="BOOLEAN">
<select name="foo"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
class="form-control"
ng-disabled="editingDisabled"
ng-change="teiValueUpdated(selectedTei, attribute.id)"
@@ -60,6 +69,11 @@
name="foo"
class="form-control"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
+ d2-number-validator
+ number-type={{attribute.valueType}}
ng-disabled="editingDisabled"
ng-blur="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -69,6 +83,9 @@
name="foo"
class="form-control"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
ng-disabled="editingDisabled"
ng-blur="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -78,6 +95,9 @@
name="foo"
class="form-control"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
ng-disabled="editingDisabled"
ng-blur="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique">
@@ -88,6 +108,10 @@
name="foo"
class="form-control-trimmed"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
+ ng-model-options="{ updateOn: 'blur' }"
ng-disabled="true"
ng-blur="teiValueUpdated(selectedTei, attribute.id)"
style="width:75%;"
@@ -104,6 +128,9 @@
name="foo"
class="form-control"
ng-model="selectedTei[attribute.id]"
+ ng-model-options="{ updateOn: 'blur' }"
+ d2-attribute-validator
+ attribute-data="attribute"
ng-disabled="editingDisabled"
ng-blur="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js 2015-10-06 10:52:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js 2015-10-07 15:13:26 +0000
@@ -292,7 +292,7 @@
$scope.selectedProgramForRelative = program;
AttributesFactory.getByProgram($scope.selectedProgramForRelative).then(function(atts){
$scope.attributes = atts;
- $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
+ $scope.attributes = AttributesFactory.generateAttributeFilters(atts);
$scope.gridColumns = $scope.generateGridColumns($scope.attributes);
});
@@ -319,17 +319,6 @@
$scope.pager.page = page;
$scope.search($scope.selectedSearchMode);
};
-
- $scope.generateAttributeFilters = function(attributes){
-
- angular.forEach(attributes, function(attribute){
- if(attribute.valueType === 'number' || attribute.valueType === 'date'){
- attribute.operator = $scope.defaultOperators[0];
- }
- });
-
- return attributes;
- };
//generate grid columns from teilist attributes
$scope.generateGridColumns = function(attributes){
=== 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-10-06 12:19:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-10-07 15:13:26 +0000
@@ -167,7 +167,7 @@
$scope.processAttributes = function(){
$scope.sortColumn = {};
AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
- $scope.attributes = $scope.generateAttributeFilters(atts);
+ $scope.attributes = AttributesFactory.generateAttributeFilters(atts);
var grid = TEIGridService.generateGridColumns($scope.attributes, $scope.selectedOuMode.name);
$scope.gridColumns = grid.columns;
@@ -315,16 +315,6 @@
$scope.search();
};
- $scope.generateAttributeFilters = function(attributes){
-
- angular.forEach(attributes, function(attribute){
- if(attribute.type === 'number' || attribute.type === 'date'){
- attribute.operator = $scope.defaultOperators[0];
- }
- });
- return attributes;
- };
-
$scope.clearEntities = function(){
$scope.trackedEntityList = null;
};
=== 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-10-06 13:41:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-10-07 15:13:26 +0000
@@ -712,7 +712,7 @@
})
/* Factory for getting tracked entity attributes */
-.factory('AttributesFactory', function($q, $rootScope, TCStorageService, orderByFilter, DateUtils, OptionSetService) {
+.factory('AttributesFactory', function($q, $rootScope, TCStorageService, orderByFilter, DateUtils, OptionSetService, OperatorFactory) {
return {
getAll: function(){
@@ -882,6 +882,14 @@
}
}
return val;
+ },
+ generateAttributeFilters: function(attributes){
+ angular.forEach(attributes, function(attribute){
+ if(attribute.type === 'number' || attribute.type === 'date'){
+ attribute.operator = OperatorFactory.defaultOperators[0];
+ }
+ });
+ return attributes;
}
};
})
=== 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-09-24 14:38:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html 2015-10-07 15:13:26 +0000
@@ -46,7 +46,7 @@
</select>
</div>
<div ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType">
- <div ng-switch-when="number">
+ <div ng-switch-when="NUMBER">
<div class="dataelement-filter">
<div class="filter-operator">
<select ng-model="attribute.operator" class="form-control-select2" ng-options="operator | translate for operator in defaultOperators">
@@ -65,7 +65,7 @@
</div>
</div>
</div>
- <div ng-switch-when="date">
+ <div ng-switch-when="DATE">
<div class="dataelement-filter">
<div class="filter-operator">
<select ng-model="attribute.operator" class="form-control-select2" ng-options="operator | translate for operator in defaultOperators">
@@ -84,7 +84,7 @@
</div>
</div>
</div>
- <div ng-switch-when="bool">
+ <div ng-switch-when="BOOLEAN">
<select ui-select2 multiple ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
<option ng-repeat="option in boolOperators" value="{{option}}">{{option| translate}}</option>
</select>