radio buttons

This commit is contained in:
2016-04-15 16:09:27 +02:00
parent f628531c09
commit 0c1ecc6670
2 changed files with 22 additions and 1 deletions
@@ -33,6 +33,16 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
}
});
// HIER GEHT'S WEITER
// URL des aktuell selektierten Account ermitteln, dann /accounts/id/users abrufen, Liste für Rediobuttons bereitstellen
// var users = $resource('/categories/search/listForAccount', { accountId: $scope.accounts[0].id }).get();
// categories.$promise.then(function(data) {
// $scope.categories = categories._embedded.categories;
//
// $scope.refreshList();
// });
}
$scope.initList = function() {
@@ -49,6 +59,10 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
var categories = $resource('/categories/search/listForAccount', { accountId: $scope.accounts[0].id }).get();
categories.$promise.then(function(data) {
$scope.categories = categories._embedded.categories;
//$scope.categories.push({id: -1, name: '────────────────', position: 9999, disabled: true});
$scope.categories.push({id: -1, name: 'private Entnahme', position: 10000, _links: { self: {href: 'withdrawal'}}});
$scope.refreshList();
});
});
@@ -6,7 +6,7 @@
<div>
Betrag: <input name="amount" ng-model='transaction.amount' type='text' required ng-pattern="/^[+-]?(?:\d+(?:[\.,]\d{0,2})?|[\.,]\d{1,2})$/" />
</div>
<span ng-show="form.amount.$error.pattern"">The value is not a valid value!</span>
<span ng-show="form.amount.$error.pattern">The value is not valid!</span>
<div>
Kategorie: <select ng-model='transaction.category' size='1'
ng-options="category.name for category in categories track by category._links.self.href">
@@ -18,6 +18,13 @@
<div>
Notiz: <input ng-model='transaction.description' type='text' size='20' />
</div>
<div>
Auslage: <label><input name='expenseBy' type='radio' checked='checked' />Keine</label>
<label ng-repeat="user in users"><input name='expenseBy' type='radio' />{{user.name}}</label>
<input name='expenseBy' id='expenseBy{{id}}' type='radio' value='{{id}}' /><label for="expenseBy{{id}}">{{name}}</label>
</div>
<div>
<input type="submit" ng-disabled="form.amount.$error.pattern" />
</div>