Ordering of accounts.
This commit is contained in:
parent
57b4846948
commit
5a1f2a9f30
@ -123,27 +123,6 @@ angular.module('accountant.accounts', [
|
|||||||
account = angular.merge(account, $data);
|
account = angular.merge(account, $data);
|
||||||
|
|
||||||
return account.$save().then(function(data) {
|
return account.$save().then(function(data) {
|
||||||
// Sort accounts by name.
|
|
||||||
$scope.accounts.sort(function(a, b) {
|
|
||||||
if(a.id && b.id) {
|
|
||||||
if(a.name < b.name) {
|
|
||||||
return -1;
|
|
||||||
} else if(a.name > b.name) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return a.id - b.id;
|
|
||||||
}
|
|
||||||
} else if (!a.id && !b.id) {
|
|
||||||
return 0;
|
|
||||||
} else if (!a.id) {
|
|
||||||
return -1;
|
|
||||||
} else if (!b.id) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
Notification.success('Account #' + data.id + ' saved.');
|
Notification.success('Account #' + data.id + ' saved.');
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
<tr id="{{ account.id }}"
|
<tr id="{{ account.id }}"
|
||||||
class="form-inline" ng-class="rowClass(account)"
|
class="form-inline" ng-class="rowClass(account)"
|
||||||
ng-repeat="account in accounts" ng-init="account.getSolds()">
|
ng-repeat="account in accounts | orderBy:'name'" ng-init="account.getSolds()">
|
||||||
<td>
|
<td>
|
||||||
<span editable-text="account.name"
|
<span editable-text="account.name"
|
||||||
e-placeholder="Nom du compte"
|
e-placeholder="Nom du compte"
|
||||||
|
Loading…
Reference in New Issue
Block a user