feat(financial statment): inventory valuation.

This commit is contained in:
elforjani3
2021-03-29 19:24:34 +02:00
parent 5f573c095e
commit f21b98eac3
10 changed files with 581 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
import React from 'react';
import { useIntl } from 'react-intl';
import FinancialSheet from 'components/FinancialSheet';
import { DataTable } from 'components';
import { useInventoryValuationContext } from './InventoryValuationProvider';
import { useInventoryValuationTableColumns } from './components';
/**
* inventory valuation data table.
*/
export default function InventoryValuationTable({
//#ownProps
companyName,
}) {
const { formatMessage } = useIntl();
// inventory valuation context.
const {
inventoryValuation: { tableRows },
isLoading,
} = useInventoryValuationContext();
// inventory valuation table columns.
const columns = useInventoryValuationTableColumns();
const rowClassNames = (row) => {
const { original } = row;
const rowTypes = Array.isArray(original.rowType)
? original.rowType
: [original.rowType];
return {
...rowTypes.reduce((acc, rowType) => {
acc[`row_type--${rowType}`] = rowType;
return acc;
}, {}),
};
};
return (
<FinancialSheet
companyName={companyName}
name="inventory-valuation"
sheetType={formatMessage({ id: 'inventory_valuation' })}
asDate={new Date()}
loading={isLoading}
>
<DataTable
className="bigcapital-datatable--financial-report"
columns={columns}
data={tableRows}
expandable={true}
expandToggleColumn={1}
expandColumnSpace={1}
sticky={true}
rowClassNames={rowClassNames}
/>
</FinancialSheet>
);
}