Fix text and table row styles.

This commit is contained in:
Alexis Lahouze 2017-08-27 18:36:41 +02:00
parent 34ade59d4c
commit 9b6ae093a4

View File

@ -17,9 +17,9 @@ import { AccountEditModalComponent } from './accountEditModal.component';
selector: 'tr[account-row]', selector: 'tr[account-row]',
host: { host: {
"[id]": "account.id", "[id]": "account.id",
"class": "lighten-4", "class": "lighten-5",
"[class.orange]": "warning", "[class.orange]": "account.authorized_overdraft < 0 && accountBalances?.current < 0",
"[class.red]": "danger" "[class.red]": "accountBalances?.current < account.authorized_overdraft",
}, },
template: ` template: `
<td> <td>
@ -27,13 +27,17 @@ import { AccountEditModalComponent } from './accountEditModal.component';
</td> </td>
<td> <td>
<span (ngClass)="valueClass(account, accountBalances?.current)"> <span class="text-lighten-2"
[class.orange-text]="account.authorized_overdraft < 0 && accountBalances?.current < 0"
[class.red-text]="accountBalances?.current < account.authorized_overdraft">
{{ accountBalances?.current | currency:"EUR":true }} {{ accountBalances?.current | currency:"EUR":true }}
</span> </span>
</td> </td>
<td> <td>
<span (ngClass)="valueClass(account, accountBalances?.pointed)"> <span class="text-lighten-2"
[class.orange-text]="account.authorized_overdraft < 0 && accountBalances?.pointed < 0"
[class.red-text]="accountBalances?.pointed < account.authorized_overdraft">
{{ accountBalances?.pointed | currency:"EUR":true }} {{ accountBalances?.pointed | currency:"EUR":true }}
</span> </span>
</td> </td>
@ -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() { confirmDelete() {
const modal = this.ngbModal.open(AccountDeleteModalComponent); const modal = this.ngbModal.open(AccountDeleteModalComponent);