(untested) bugfix for import category loading
This commit is contained in:
@@ -383,21 +383,7 @@ transactionControllers.controller('ImportCtrl', [ '$scope', '$resource', '$locat
|
|||||||
$location.path('importList');
|
$location.path('importList');
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.initPage = function () {
|
$scope.reloadCategories = function () {
|
||||||
var userinfo = $resource('/user').get();
|
|
||||||
userinfo.$promise.then(function(data) {
|
|
||||||
$scope.userid = userinfo.name;
|
|
||||||
|
|
||||||
userinfo = $resource('/api/users/search/findByUsername', { username: $scope.userid }).get();
|
|
||||||
userinfo.$promise.then(function(data) {
|
|
||||||
$scope.userinfo = userinfo;
|
|
||||||
});
|
|
||||||
|
|
||||||
var accountInfo = $resource('/api/accounts/search/findByUserName', { username: $scope.userid }).get();
|
|
||||||
accountInfo.$promise.then(function(data) {
|
|
||||||
$scope.accounts = accountInfo._embedded.accounts;
|
|
||||||
$scope.account = $scope.accounts[0];
|
|
||||||
|
|
||||||
var categories = $resource('/api/categories/search/listForAccount', { accountId: $scope.account.id }).get();
|
var categories = $resource('/api/categories/search/listForAccount', { accountId: $scope.account.id }).get();
|
||||||
categories.$promise.then(function(data) {
|
categories.$promise.then(function(data) {
|
||||||
$scope.categories = categories._embedded.categories;
|
$scope.categories = categories._embedded.categories;
|
||||||
@@ -415,6 +401,23 @@ transactionControllers.controller('ImportCtrl', [ '$scope', '$resource', '$locat
|
|||||||
$scope.importForm.$setUntouched();
|
$scope.importForm.$setUntouched();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.initPage = function () {
|
||||||
|
var userinfo = $resource('/user').get();
|
||||||
|
userinfo.$promise.then(function(data) {
|
||||||
|
$scope.userid = userinfo.name;
|
||||||
|
|
||||||
|
userinfo = $resource('/api/users/search/findByUsername', { username: $scope.userid }).get();
|
||||||
|
userinfo.$promise.then(function(data) {
|
||||||
|
$scope.userinfo = userinfo;
|
||||||
|
});
|
||||||
|
|
||||||
|
var accountInfo = $resource('/api/accounts/search/findByUserName', { username: $scope.userid }).get();
|
||||||
|
accountInfo.$promise.then(function(data) {
|
||||||
|
$scope.accounts = accountInfo._embedded.accounts;
|
||||||
|
$scope.account = $scope.accounts[0];
|
||||||
|
$scope.reloadCategories();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<div ng-show="accounts.length > 1" style="margin: 2ex; text-align: center; font-size: 120%;">
|
<div ng-show="accounts.length > 1" style="margin: 2ex; text-align: center; font-size: 120%;">
|
||||||
<select
|
<select
|
||||||
ng-model='account'
|
ng-model='account'
|
||||||
|
ng-change='reloadCategories()'
|
||||||
ng-options="account.name for account in accounts track by account.id"></select>
|
ng-options="account.name for account in accounts track by account.id"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user