diff --git a/src/accounts/account.module.ts b/src/accounts/account.module.ts index bde0c86..cd1917a 100644 --- a/src/accounts/account.module.ts +++ b/src/accounts/account.module.ts @@ -17,6 +17,7 @@ import { AccountDeleteModalComponent } from './accountDeleteModal.component'; import { AccountEditModalComponent } from './accountEditModal.component'; import { AccountFormComponent } from './accountForm.component'; import { AccountRowComponent } from './accountRow.component'; +import { DailyBalanceService } from './dailyBalance.service'; @NgModule({ imports: [ @@ -31,6 +32,7 @@ import { AccountRowComponent } from './accountRow.component'; providers: [ AccountService, AccountBalancesService, + DailyBalanceService, ], declarations: [ AccountListComponent, diff --git a/src/accounts/dailyBalance.service.ts b/src/accounts/dailyBalance.service.ts new file mode 100644 index 0000000..1751613 --- /dev/null +++ b/src/accounts/dailyBalance.service.ts @@ -0,0 +1,19 @@ +// vim: set tw=80 ts=2 sw=2 sts=2: + +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs/Rx'; + +import { Restangular } from "ngx-restangular"; + +import { DailyBalance } from './dailyBalance'; + +@Injectable() +export class DailyBalanceService { + constructor( + private restangular: Restangular + ) {} + + query(id: number): Observable { + return this.restangular.one('account', id).one('daily_balances').getList(); + } +} diff --git a/src/accounts/dailyBalance.ts b/src/accounts/dailyBalance.ts new file mode 100644 index 0000000..68c3669 --- /dev/null +++ b/src/accounts/dailyBalance.ts @@ -0,0 +1,8 @@ +// vim: set tw=80 ts=2 sw=2 sts=2 : + +export class DailyBalance { + operation_date: string; + balance: number; + expenses: number; + revenues: number; +} diff --git a/src/accounts/index.ts b/src/accounts/index.ts index d1d67cb..553182b 100644 --- a/src/accounts/index.ts +++ b/src/accounts/index.ts @@ -29,6 +29,7 @@ import uiRouter from '@uirouter/angularjs'; import { AccountService } from './account.service'; import { AccountListComponent } from './accountList.component'; +import { DailyBalanceService } from './dailyBalance.service'; export default angular.module('accountant.accounts', [ uiRouter @@ -49,6 +50,8 @@ export default angular.module('accountant.accounts', [ .factory('AccountService', downgradeInjectable(AccountService)) + .factory('DailyBalanceService', downgradeInjectable(DailyBalanceService)) + .directive('accountList', downgradeComponent({ component: AccountListComponent }))