From 9b6ae093a49e7e0dfc467bd12c168781bed60c59 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 27 Aug 2017 18:36:41 +0200 Subject: [PATCH] Fix text and table row styles. --- src/accounts/accountRow.component.ts | 40 +++++++--------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/src/accounts/accountRow.component.ts b/src/accounts/accountRow.component.ts index fa9b30c..003af6f 100644 --- a/src/accounts/accountRow.component.ts +++ b/src/accounts/accountRow.component.ts @@ -17,9 +17,9 @@ import { AccountEditModalComponent } from './accountEditModal.component'; selector: 'tr[account-row]', host: { "[id]": "account.id", - "class": "lighten-4", - "[class.orange]": "warning", - "[class.red]": "danger" + "class": "lighten-5", + "[class.orange]": "account.authorized_overdraft < 0 && accountBalances?.current < 0", + "[class.red]": "accountBalances?.current < account.authorized_overdraft", }, template: ` @@ -27,13 +27,17 @@ import { AccountEditModalComponent } from './accountEditModal.component'; - + {{ accountBalances?.current | currency:"EUR":true }} - + {{ accountBalances?.pointed | currency:"EUR":true }} @@ -89,32 +93,6 @@ export class AccountRowComponent implements OnInit { }) } - get warning() { - return this.account && this.accountBalances - && this.account.authorized_overdraft < this.accountBalances.current - && this.accountBalances.current < 0; - }; - - get error() { - return this.account && this.accountBalances - && this.accountBalances.current < this.account.authorized_overdraft; - }; - - /* - * Return the class for a value compared to account authorized overdraft. - */ - valueClass(value: number) { - if (!value) { - return; - } - - if (value < this.account.authorized_overdraft) { - return 'text-danger'; - } else if (value < 0) { - return 'text-warning'; - } - }; - confirmDelete() { const modal = this.ngbModal.open(AccountDeleteModalComponent);