Add Daily Balance service.
This commit is contained in:
parent
c0b236ff6c
commit
d8adfd91c5
@ -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,
|
||||
|
19
src/accounts/dailyBalance.service.ts
Normal file
19
src/accounts/dailyBalance.service.ts
Normal 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();
|
||||
}
|
||||
}
|
8
src/accounts/dailyBalance.ts
Normal file
8
src/accounts/dailyBalance.ts
Normal 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;
|
||||
}
|
@ -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
|
||||
}))
|
||||
|
Loading…
Reference in New Issue
Block a user