Cleanup account frontend.

This commit is contained in:
Alexis Lahouze 2015-07-15 18:28:56 +02:00
parent 0b0ca57042
commit e18009b0dd
2 changed files with 33 additions and 5 deletions

View File

@ -29,8 +29,8 @@ accountantApp
.controller( .controller(
"AccountController", [ "AccountController", [
"$scope", "$rootScope", "$window", "$routeParams", "Accounts", "$scope", "$rootScope", "$routeParams", "Accounts",
function($scope, $rootScope, $window, $routeParams, Accounts) { function($scope, $rootScope, $routeParams, Accounts) {
$scope.accountClass = function(account) { $scope.accountClass = function(account) {
if(account == $scope.selectedAccount) { if(account == $scope.selectedAccount) {
@ -56,7 +56,7 @@ accountantApp
$scope.createAccount = function(account) { $scope.createAccount = function(account) {
account.$save(function(account) { account.$save(function(account) {
// Reset new account. // Reset new account.
$scope.resetAccount(account); $scope.cancelEditAccount(account);
$scope.$emit("accountCreatedEvent", account); $scope.$emit("accountCreatedEvent", account);
}); });
@ -84,7 +84,7 @@ accountantApp
* Start account edition. * Start account edition.
*/ */
$scope.editAccount = function(account) { $scope.editAccount = function(account) {
account.editing = true; account.edit = true;
}; };
/* /*

View File

@ -60,7 +60,7 @@
</td> </td>
</tr> </tr>
<tr id="account_[[account.id]]" class="form-inline" ng-repeat="account in accounts"> <tr id="account_[[account.id]]" class="form-inline" ng-if="!account.edit" ng-repeat-start="account in accounts">
<td><a href="account/[[ account.id ]]/entries">[[ account.name ]]</a></td> <td><a href="account/[[ account.id ]]/entries">[[ account.name ]]</a></td>
<td>[[ account.current ]]</td> <td>[[ account.current ]]</td>
<td>[[ account.pointed ]]</td> <td>[[ account.pointed ]]</td>
@ -84,6 +84,34 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr id="account_[[account.id]]" class="form-inline" ng-if="account.edit" ng-repeat-end>
<td>
<input type="text" class="form-control" ng-model="account.name" />
</td>
<td>[[ account.current ]]</td>
<td>[[ account.pointed ]]</td>
<td>
<input type="text" class="form-control"
ng-model="account.authorized_overdraft" />
</td>
<td>
<div class="btn-group">
<button class="btn btn-xs btn-success"
ng-click="saveAccount(account)">
<span class="fa fa-floppy-o"></span>
</button>
<button class="btn btn-xs btn-default"
ng-click="cancelEditAccount(account)">
<span class="fa fa-times"></span>
</button>
</div>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>