Add Daily Balance service.

This commit is contained in:
Alexis Lahouze 2017-07-27 01:00:33 +02:00
parent c0b236ff6c
commit d8adfd91c5
4 changed files with 32 additions and 0 deletions

View File

@ -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,

View File

@ -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<DailyBalance> {
return this.restangular.one('account', id).one('daily_balances').getList();
}
}

View File

@ -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;
}

View File

@ -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
}))