Cleanup, sort accounts after saving.
This commit is contained in:
parent
25f43228dd
commit
4bd8bb3819
@ -92,6 +92,17 @@ accountantApp
|
||||
}
|
||||
|
||||
return promise.then(function(data) {
|
||||
// Sort accounts by name.
|
||||
$scope.accounts.sort(function(a, b) {
|
||||
if(a.name < b.name) {
|
||||
return -1;
|
||||
} else if(a.name > b.name) {
|
||||
return 1;
|
||||
} else {
|
||||
return a.id - b.id;
|
||||
}
|
||||
});
|
||||
|
||||
notificationService.success("Account #" + data.id + " saved.");
|
||||
|
||||
return data;
|
||||
@ -103,7 +114,6 @@ accountantApp
|
||||
*/
|
||||
$scope.deleteAccount = function(account, $index) {
|
||||
var id = account.id;
|
||||
var index = $index;
|
||||
|
||||
bootbox.confirm(
|
||||
"Voulez-vous supprimer le compte \"" + account.name + "\" ?",
|
||||
@ -113,7 +123,7 @@ accountantApp
|
||||
notificationService.success("Account #" + id + " deleted.");
|
||||
|
||||
// Remove account from array.
|
||||
$scope.accounts.splice(index, 1);
|
||||
$scope.accounts.splice($index, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user