diff --git a/src/accounts/account.module.ts b/src/accounts/account.module.ts index 26a3370..7127f44 100644 --- a/src/accounts/account.module.ts +++ b/src/accounts/account.module.ts @@ -12,6 +12,7 @@ import { ToastrModule } from 'ngx-toastr'; import { AccountService } from './account.service'; import { AccountBalancesService } from './accountBalances.service'; +import { AccountListComponent } from './accountList.component'; import { AccountDeleteModalComponent } from './accountDeleteModal.component'; import { AccountEditModalComponent } from './accountEditModal.component'; import { AccountFormComponent } from './accountForm.component'; @@ -31,11 +32,13 @@ import { AccountFormComponent } from './accountForm.component'; AccountBalancesService, ], declarations: [ + AccountListComponent, AccountDeleteModalComponent, AccountEditModalComponent, AccountFormComponent ], entryComponents: [ + AccountListComponent, AccountDeleteModalComponent, AccountEditModalComponent, AccountFormComponent diff --git a/src/accounts/accountList.component.ts b/src/accounts/accountList.component.ts index d1f3df7..a5c350b 100644 --- a/src/accounts/accountList.component.ts +++ b/src/accounts/accountList.component.ts @@ -1,3 +1,5 @@ +import { CurrencyPipe } from '@angular/common'; +import { Component, Inject } from '@angular/core'; import { Observable } from 'rxjs/Rx'; import { Logger } from '@nsalaun/ng-logger'; @@ -10,6 +12,80 @@ import { AccountService } from './account.service'; import { AccountBalancesService } from './accountBalances.service'; import { AccountDeleteModalComponent } from './accountDeleteModal.component'; import { AccountEditModalComponent } from './accountEditModal.component'; + +@Component({ + selector: 'account-list', + template: ` +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nom du compteSolde courantSolde pointéDécouvert autoriséActions
+ +
+ {{ account.name }} + + + {{ account.balances?.current | currency:"EUR" }} + + + + {{ account.balances?.pointed | currency:"EUR" }} + + {{ account.authorized_overdraft | currency:"EUR" }} +
+ + + + + + + + + + +
+
+
+ `, +}) export class AccountListComponent { static $inject = [ 'AccountService', diff --git a/src/accounts/index.ts b/src/accounts/index.ts index 5e35fae..0811f3f 100644 --- a/src/accounts/index.ts +++ b/src/accounts/index.ts @@ -20,44 +20,20 @@ var angular = require('angular'); //declare var angular: angular.IAngularStatic; -import { downgradeInjectable } from '@angular/upgrade/static'; +import { + downgradeInjectable, + downgradeComponent +} from '@angular/upgrade/static'; -var ngResource = require('angular-resource'), - ngMessages = require('angular-messages'), - ngUiNotification = require('angular-ui-notification'), - ngStrap = require('angular-strap'); - -import { Logger } from '@nsalaun/ng-logger'; -import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; -import { ToastrService } from 'ngx-toastr'; - -var accountsTmpl = require('./accounts.html'); - -import { AccountBalancesService } from './accountBalances.service'; import { AccountService } from './account.service'; import { AccountListComponent } from './accountList.component'; -export default angular.module('accountant.accounts', [ - ngResource, - ngMessages, - ngUiNotification, - ngStrap, -]) - - .factory('ToastrService', downgradeInjectable(ToastrService)) - - .factory('Logger', downgradeInjectable(Logger)) - - .factory('NgbModal', downgradeInjectable(NgbModal)) - - .factory('AccountBalancesService', downgradeInjectable(AccountBalancesService)) +export default angular.module('accountant.accounts', []) .factory('AccountService', downgradeInjectable(AccountService)) - .component('accountList', { - controller: AccountListComponent, - controllerAs: 'accountsCtrl', - templateUrl: accountsTmpl - }) + .directive('accountList', downgradeComponent({ + component: AccountListComponent + })) .name;