dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40167
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20353: evet-capture: program attribute category option - WIP
------------------------------------------------------------
revno: 20353
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-24 17:28:23 +0200
message:
evet-capture: program attribute category option - WIP
modified:
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/views/eventList.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-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/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-09-24 14:38:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-09-24 15:28:23 +0000
@@ -232,12 +232,32 @@
$scope.selectedCategories = categories;
TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
$scope.allProgramRules = rules;
- $scope.loadEvents();
+ if($scope.selectedCategories.length === 0){
+ $scope.loadEvents();
+ }
});
});
});
}
};
+
+ $scope.getCategoryOptions = function(){
+ $scope.eventFetched = false;
+ var optionsReady = false;
+ $scope.selectedOptions = [];
+ for(var i=0; i<$scope.selectedCategories.length; i++){
+ if($scope.selectedCategories[i].selectedOption && $scope.selectedCategories[i].selectedOption.id){
+ optionsReady = true;
+ $scope.selectedOptions.push($scope.selectedCategories[i].selectedOption);
+ }
+ else{
+ optionsReady = false;
+ }
+ }
+ if(optionsReady){
+ $scope.loadEvents();
+ }
+ };
//get events for the selected program (and org unit)
$scope.loadEvents = function(){
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html 2015-09-24 14:38:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html 2015-09-24 15:28:23 +0000
@@ -1,5 +1,5 @@
<div ng-if="selectedProgramStage && !eventRegistration && !editingEventInFull" class="small-vertical-spacing">
- <i ng-if="!eventFetched" class="fa fa-spinner fa-spin fa-2x"></i>
+ <i ng-if="!eventFetched && selectedOptions.length === selectedCategories.length" class="fa fa-spinner fa-spin fa-2x"></i>
<div ng-if="eventFetched" ng-switch="dhis2Events.length">
<div ng-switch-when="undefined">
<h4>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html 2015-09-24 14:38:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html 2015-09-24 15:28:23 +0000
@@ -47,10 +47,10 @@
<div class="col-sm-8">
<select class="form-control"
name="option"
- ng-model="category.selectiedOption"
- ng-select="getAttributeCategoryOptions()">
+ ng-model="category.selectedOption"
+ ng-options="option as option.name for option in category.categoryOptions"
+ ng-change="getCategoryOptions()">
<option value="">{{pleaseSelectLabel}}</option>
- <option ng-repeat="option in category.categoryOptions" value={{section.id}}>{{option.name}}</option>
</select>
</div>
</div>