Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Expense Details drawer #323

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ export default function ExpenseDrawerFooter() {
<ExpenseTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine
title={<T id={'expense.details.subtotal'} />}
value={<FormatNumber value={expense.total_amount} />}
value={
<FormatNumber
value={expense.total_amount}
currency={expense.currency_code}
/>
}
borderStyle={TotalLineBorderStyle.SingleDark}
/>
<TotalLine
title={<T id={'expense.details.total'} />}
value={<FormatNumber value={expense.formatted_amount} />}
value={
<FormatNumber
value={expense.formatted_amount}
currency={expense.currency_code}
/>
}
borderStyle={TotalLineBorderStyle.DoubleDark}
textStyle={TotalLineTextStyle.Bold}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ import { TableStyle } from '@/constants';
* Expense details table.
*/
export default function ExpenseDrawerTable() {
// Expense readonly entries columns.
const columns = useExpenseReadEntriesColumns();

// Expense drawer context.
const { expense } = useExpenseDrawerContext();

// Expense readonly entries columns.
const columns = useExpenseReadEntriesColumns({
currency: expense.currency_code,
});

return (
<CommercialDocEntriesTable
columns={columns}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getColumnWidth } from '@/utils';
/**
* Retrieve expense readonly details entries table columns.
*/
export const useExpenseReadEntriesColumns = () => {
export const useExpenseReadEntriesColumns = ({ currency }) => {
// Expense drawer context.
const {
expense: { categories },
Expand Down Expand Up @@ -38,6 +38,7 @@ export const useExpenseReadEntriesColumns = () => {
Header: intl.get('amount'),
accessor: 'amount',
Cell: FormatNumberCell,
formatNumber: { currency },
width: getColumnWidth(categories, 'amount', {
minWidth: 60,
magicSpacing: 5,
Expand All @@ -47,6 +48,6 @@ export const useExpenseReadEntriesColumns = () => {
align: 'right',
},
],
[],
[currency],
);
};