diff --git a/accountant/frontend/static/js/accounts.js b/accountant/frontend/static/js/accounts.js index 5e63943..f6c695e 100644 --- a/accountant/frontend/static/js/accounts.js +++ b/accountant/frontend/static/js/accounts.js @@ -19,25 +19,36 @@ accountantApp -.factory("Account", ["$resource", function($resource) { +.factory('Account', ['$resource', function($resource) { var Account = $resource( - "/api/account/:id", { - id: "@id" + '/api/account/:id', { + id: '@id' } ); Account.prototype.getSolds = function() { - var Solds = $resource("/api/account/:id/solds", {id: this.id}); + var Solds = $resource('/api/account/:id/solds', {id: this.id}); this.solds = Solds.get(); }; + Account.prototype.getBalance = function(begin, end) { + var Balance = $resource( + '/api/account/:id/balance', { + id: this.id, + begin: begin.format('YYYY-MM-DD'), + end: end.format('YYYY-MM-DD') + }); + + this.balance = Balance.get(); + }; + return Account; }]) .controller( - "AccountController", [ - "$scope", "Account", "Notification", + 'AccountController', [ + '$scope', 'Account', 'Notification', function($scope, Account, Notification) { /* @@ -50,9 +61,9 @@ accountantApp } if(account.current