Commit 354e2701 authored by Antoine's avatar Antoine
Browse files

Display outstanding balance in the menu of the client.

parent f299c6d6
......@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { get } from '../../store';
import { displayLabel } from '../../helpers';
import { displayLabel, translate as $t } from '../../helpers';
import ColoredAmount from './colored-amount';
......@@ -13,16 +13,27 @@ const AccountListItem = connect((state, props) => {
return { account };
})(props => {
let { account, accountId } = props;
let { balance, formatCurrency } = account;
let { balance, outstandingSum, formatCurrency } = account;
let newPathname = props.location.pathname.replace(props.currentAccountId, accountId);
// Outstanding balance.
let maybeOutstandingSum =
outstandingSum !== 0 ? (
<React.Fragment>
&ensp;
{`(${$t('client.menu.outstanding_balance')}`}
<ColoredAmount amount={outstandingSum} formatCurrency={formatCurrency} />
{')'}
</React.Fragment>
) : null;
return (
<li key={`account-details-account-list-item-${accountId}`}>
<NavLink to={newPathname} activeClassName="active">
<span>{displayLabel(account)}</span>
&ensp;
<ColoredAmount amount={balance} formatCurrency={formatCurrency} />
{maybeOutstandingSum}
</NavLink>
</li>
);
......
......@@ -163,7 +163,8 @@
"budget": "Budget",
"about": "About",
"different_currencies": "Different currencies",
"total": "Total"
"total": "Total",
"outstanding_balance": "Ongoing: "
},
"operations": {
"amount": "Amount",
......
......@@ -163,7 +163,8 @@
"budget": "Budget",
"about": "À propos",
"different_currencies": "Devises différentes",
"total": "Total"
"total": "Total",
"outstanding_balance": "Encours : "
},
"operations": {
"amount": "Montant",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment