diff --git a/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js b/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js index 224448b8a..ba5480962 100644 --- a/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js +++ b/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js @@ -7,9 +7,10 @@ import { DataTable, FinancialSheet } from 'components'; import { useBalanceSheetContext } from './BalanceSheetProvider'; import { defaultExpanderReducer, tableRowTypesToClassnames } from 'utils'; -import { TableStyle } from 'common'; import { useBalanceSheetColumns } from './components'; +import { TableStyle } from 'common'; + /** * Balance sheet table. */ diff --git a/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetails.js b/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetails.js index 0c25f6de0..b9d7cb670 100644 --- a/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetails.js +++ b/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetails.js @@ -1,13 +1,11 @@ import React, { useEffect, useState } from 'react'; import moment from 'moment'; -import 'style/pages/FinancialStatements/InventoryItemDetails.scss'; import { FinancialStatement } from 'components'; import DashboardPageContent from 'components/Dashboard/DashboardPageContent'; import InventoryItemDetailsActionsBar from './InventoryItemDetailsActionsBar'; import InventoryItemDetailsHeader from './InventoryItemDetailsHeader'; -import InventoryItemDetailsTable from './InventoryItemDetailsTable'; import withInventoryItemDetailsActions from './withInventoryItemDetailsActions'; import withCurrentOrganization from '../../../containers/Organization/withCurrentOrganization'; @@ -18,6 +16,7 @@ import { } from './components'; import { compose } from 'utils'; +import { InventoryItemDetailsBody } from './InventoryItemDetailsBody'; /** * inventory item details. @@ -64,19 +63,11 @@ function InventoryItemDetails({ -
- -
-
- -
+ +
diff --git a/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsBody.js b/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsBody.js new file mode 100644 index 000000000..bf2a19d43 --- /dev/null +++ b/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsBody.js @@ -0,0 +1,36 @@ +import React from 'react'; +import * as R from 'ramda'; + +import { useInventoryItemDetailsContext } from './InventoryItemDetailsProvider'; +import { InventoryItemDetailsTable } from './InventoryItemDetailsTable'; + +import { FinancialReportBody } from '../FinancialReportPage'; +import { FinancialSheetSkeleton } from '../../../components/FinancialSheet'; +import withCurrentOrganization from 'containers/Organization/withCurrentOrganization'; + +/** + * Inventory item details body. + * @returns {JSX.Element} + */ +function InventoryItemDetailsBodyJSX({ + // #withCurrentOrganization + organizationName, +}) { + const { isInventoryItemDetailsLoading } = useInventoryItemDetailsContext(); + + return ( + + {isInventoryItemDetailsLoading ? ( + + ) : ( + + )} + + ); +} + +export const InventoryItemDetailsBody = R.compose( + withCurrentOrganization(({ organization }) => ({ + organizationName: organization.name, + })), +)(InventoryItemDetailsBodyJSX); diff --git a/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.js b/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.js index 4c3963e2c..9265c2907 100644 --- a/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.js +++ b/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.js @@ -1,16 +1,19 @@ import React, { useMemo } from 'react'; import intl from 'react-intl-universal'; +import styled from 'styled-components'; import { DataTable, FinancialSheet } from 'components'; import { useInventoryItemDetailsColumns } from './components'; import { useInventoryItemDetailsContext } from './InventoryItemDetailsProvider'; -import { defaultExpanderReducer } from 'utils'; +import { defaultExpanderReducer, tableRowTypesToClassnames } from 'utils'; + +import { TableStyle } from 'common'; /** * Inventory item detail table. */ -export default function InventoryItemDetailsTable({ +export function InventoryItemDetailsTable({ // #ownProps companyName, }) { @@ -27,30 +30,84 @@ export default function InventoryItemDetailsTable({ [tableRows], ); - const rowClassNames = (row) => { - return [`row-type--${row.original.row_types}`]; - }; - return ( - ); } + +const InventoryItemDetailsDataTable = styled(DataTable)` + .table { + .tbody { + .tr .td { + padding-top: 0.2rem; + padding-bottom: 0.2rem; + border-top-color: transparent; + border-bottom-color: transparent; + + &.date { + > div { + display: flex; + } + + span.force-width { + position: relative; + } + } + } + + .tr:not(.no-results) .td { + border-left: 1px solid #ececec; + } + + .tr:last-child .td { + border-bottom: 1px solid #ddd; + } + + .tr.row-type { + &--ITEM { + .td { + &.transaction_type { + border-left-color: transparent; + } + } + + &:not(:first-child).is-expanded .td { + border-top: 1px solid #ddd; + } + } + + &--ITEM, + &--OPENING_ENTRY, + &--CLOSING_ENTRY { + font-weight: 500; + } + + &--ITEM { + &.is-expanded { + .td.value .cell-inner { + display: none; + } + } + } + } + } + } +`; diff --git a/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js b/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js index c769ec361..191670ea5 100644 --- a/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js +++ b/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js @@ -1,12 +1,10 @@ import React, { useEffect, useState, useCallback } from 'react'; import moment from 'moment'; -import 'style/pages/FinancialStatements/SalesAndPurchasesSheet.scss'; - import { InventoryValuationProvider } from './InventoryValuationProvider'; import InventoryValuationActionsBar from './InventoryValuationActionsBar'; import InventoryValuationHeader from './InventoryValuationHeader'; -import InventoryValuationTable from './InventoryValuationTable'; +import { InventoryValuationBody } from './InventoryValuationBody'; import DashboardPageContent from 'components/Dashboard/DashboardPageContent'; import { InventoryValuationLoadingBar } from './components'; @@ -64,15 +62,11 @@ function InventoryValuation({ -
- -
- -
-
+ +
); diff --git a/src/containers/FinancialStatements/InventoryValuation/InventoryValuationBody.js b/src/containers/FinancialStatements/InventoryValuation/InventoryValuationBody.js new file mode 100644 index 000000000..ec0bfc45e --- /dev/null +++ b/src/containers/FinancialStatements/InventoryValuation/InventoryValuationBody.js @@ -0,0 +1,32 @@ +import React from 'react'; +import * as R from 'ramda'; + +import InventoryValuationTable from './InventoryValuationTable'; +import { useInventoryValuationContext } from './InventoryValuationProvider'; + +import { FinancialReportBody } from '../FinancialReportPage'; +import { FinancialSheetSkeleton } from '../../../components/FinancialSheet'; +import withCurrentOrganization from 'containers/Organization/withCurrentOrganization'; + +function InventoryValuationBodyJSX({ + // #withCurrentOrganization + organizationName, +}) { + const { isLoading } = useInventoryValuationContext(); + + return ( + + {isLoading ? ( + + ) : ( + + )} + + ); +} + +export const InventoryValuationBody = R.compose( + withCurrentOrganization(({ organization }) => ({ + organizationName: organization.name, + })), +)(InventoryValuationBodyJSX); diff --git a/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.js b/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.js index 96fe37fa2..f43813906 100644 --- a/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.js +++ b/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.js @@ -1,11 +1,14 @@ import React from 'react'; -import intl, { init } from 'react-intl-universal'; +import intl from 'react-intl-universal'; import { DataTable, FinancialSheet } from 'components'; import { useInventoryValuationContext } from './InventoryValuationProvider'; import { useInventoryValuationTableColumns } from './components'; +import { tableRowTypesToClassnames } from 'utils'; +import { TableStyle } from 'common'; + /** * inventory valuation data table. */ @@ -22,37 +25,22 @@ export default function InventoryValuationTable({ // 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 (