mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
fix: (*): fix currency code.
This commit is contained in:
@@ -28,6 +28,7 @@ function ItemsEntriesTable({
|
||||
errors,
|
||||
onUpdateData,
|
||||
linesNumber,
|
||||
currencyCode,
|
||||
itemType, // sellable or purchasable
|
||||
}) {
|
||||
const [rows, setRows] = React.useState(initialEntries);
|
||||
@@ -35,13 +36,14 @@ function ItemsEntriesTable({
|
||||
const [cellsLoading, setCellsLoading] = React.useState(null);
|
||||
|
||||
// Fetches the item details.
|
||||
const { data: item, isFetching: isItemFetching, isSuccess: isItemSuccess } = useItem(
|
||||
rowItem && rowItem.itemId,
|
||||
{
|
||||
enabled: !!(rowItem && rowItem.itemId),
|
||||
},
|
||||
);
|
||||
|
||||
const {
|
||||
data: item,
|
||||
isFetching: isItemFetching,
|
||||
isSuccess: isItemSuccess,
|
||||
} = useItem(rowItem && rowItem.itemId, {
|
||||
enabled: !!(rowItem && rowItem.itemId),
|
||||
});
|
||||
|
||||
// Once the item start loading give the table cells loading state.
|
||||
useEffect(() => {
|
||||
if (rowItem && isItemFetching) {
|
||||
@@ -141,6 +143,7 @@ function ItemsEntriesTable({
|
||||
updateData: handleUpdateData,
|
||||
removeRow: handleRemoveRow,
|
||||
autoFocus: ['item_id', 0],
|
||||
currencyCode,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
MoneyFieldCell,
|
||||
ItemsListCell,
|
||||
PercentFieldCell,
|
||||
NumericInputCell
|
||||
NumericInputCell,
|
||||
} from 'components/DataTableCells';
|
||||
|
||||
/**
|
||||
@@ -62,27 +62,27 @@ export function ActionsCellRenderer({
|
||||
*/
|
||||
export function QuantityTotalFooterCell({ rows }) {
|
||||
const quantity = safeSumBy(rows, 'original.quantity');
|
||||
return <span>{ quantity }</span>;
|
||||
return <span>{quantity}</span>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total footer cell.
|
||||
*/
|
||||
export function TotalFooterCell({ rows }) {
|
||||
export function TotalFooterCell({ payload: { currencyCode }, rows }) {
|
||||
const total = safeSumBy(rows, 'original.total');
|
||||
return <span>{ formattedAmount(total, 'USD') }</span>;
|
||||
return <span>{formattedAmount(total, currencyCode)}</span>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total accessor.
|
||||
*/
|
||||
export function TotalCell({ value }) {
|
||||
return <span>{ formattedAmount(value, 'USD', { noZero: true }) }</span>;
|
||||
export function TotalCell({ payload: { currencyCode }, value }) {
|
||||
return <span>{formattedAmount(value, currencyCode, { noZero: true })}</span>;
|
||||
}
|
||||
|
||||
// Index table cell.
|
||||
export function IndexTableCell({ row: { index } }){
|
||||
return (<span>{index + 1}</span>);
|
||||
export function IndexTableCell({ row: { index } }) {
|
||||
return <span>{index + 1}</span>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,4 +167,3 @@ export function useEditableItemsEntriesColumns() {
|
||||
[formatMessage],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user