diff --git a/src/components/DataTableCells/NumericInputCell.js b/src/components/DataTableCells/NumericInputCell.js index 5e6c5d245..eaf933fb8 100644 --- a/src/components/DataTableCells/NumericInputCell.js +++ b/src/components/DataTableCells/NumericInputCell.js @@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'; import { FormGroup, NumericInput, Intent } from '@blueprintjs/core'; import classNames from 'classnames'; import { CLASSES } from 'common/classes'; -import WarehouseListPopover from '../../containers/WarehouseListPopover'; /** * Numeric input table cell. @@ -37,8 +36,7 @@ export default function NumericInputCell({ onValueChange={handleValueChange} onBlur={onBlur} fill={true} - buttonPosition={'none'} - rightElement={} + buttonPosition={"none"} /> ); diff --git a/src/components/DataTableCells/RadioFieldCell.js b/src/components/DataTableCells/RadioFieldCell.js deleted file mode 100644 index 7471fb56c..000000000 --- a/src/components/DataTableCells/RadioFieldCell.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import classNames from 'classnames'; -import { FormGroup, Intent, Classes, Radio } from '@blueprintjs/core'; - -const RadioEditableCell = ({ - row: { index, original }, - column: { id, radioProps }, - cell: { value: initialValue }, - payload, -}) => { - const [value, setValue] = React.useState(initialValue); - - const onChange = (e) => { - const newValue = e.target.checked; - debugger; - setValue(newValue); - payload.updateData(index, id, newValue); - }; - - React.useEffect(() => { - setValue(initialValue); - }, [initialValue]); - - const error = payload.errors?.[index]?.[id]; - - return ( - - - - ); -}; - -export default RadioEditableCell; diff --git a/src/components/DataTableCells/index.js b/src/components/DataTableCells/index.js index 4e0a42835..fed349eed 100644 --- a/src/components/DataTableCells/index.js +++ b/src/components/DataTableCells/index.js @@ -9,7 +9,6 @@ import NumericInputCell from './NumericInputCell'; import CheckBoxFieldCell from './CheckBoxFieldCell'; import SwitchFieldCell from './SwitchFieldCell'; import TextAreaCell from './TextAreaCell'; -import RadioFieldCell from './RadioFieldCell'; export { AccountsListFieldCell, @@ -24,5 +23,4 @@ export { CheckBoxFieldCell, SwitchFieldCell, TextAreaCell, - RadioFieldCell, }; diff --git a/src/containers/WarehouseListPopover/WarehousesList.js b/src/containers/WarehouseListPopover/WarehousesList.js deleted file mode 100644 index 15c85743c..000000000 --- a/src/containers/WarehouseListPopover/WarehousesList.js +++ /dev/null @@ -1,75 +0,0 @@ -import React from 'react'; -import styled from 'styled-components'; - -import { CLASSES } from 'common/classes'; -import { TableStyle } from '../../common'; -import { DataTableEditable, DataTable } from 'components'; -import { compose, saveInvoke, updateTableCell } from 'utils'; -import { useWarehouseEntriesColumns } from './components'; - -export default function IntegrateWarehousesTable({ - // #ownProps - initialWarehouse, - selectedWarehouseId, - onUpdateData, - entries, - errors, -}) { - const [rows, setRows] = React.useState(initialWarehouse); - - // warehouses entries columns. - const columns = useWarehouseEntriesColumns(); - - // Handle update data. - const handleUpdateData = React.useCallback( - (rowIndex, columnId, value) => { - const newRows = compose(updateTableCell(rowIndex, columnId, value))( - entries, - ); - onUpdateData(newRows); - }, - [onUpdateData, entries], - ); - - const DATA = [ - { - warehouse_name: true, - quantity: '9,444', - availiable_for_sale: 0, - }, - { - warehouse_name: false, - quantity: '19,444', - availiable_for_sale: 0, - }, - ]; - - return ( - - ); -} - -const WarehouseDataTableRoot = styled(DataTable)` - width: 600px; - - .table { - border: 1px solid #000000; - .thead .th { - background: transparent; - color: #222222; - border-bottom: 1px solid #000000; - padding: 0.5rem; - } - .tbody .tr .td { - padding: 0.2rem 0.2rem; - border-bottom: 1px solid #cecbcb; - } - } -`; diff --git a/src/containers/WarehouseListPopover/components.js b/src/containers/WarehouseListPopover/components.js deleted file mode 100644 index 1429a87e6..000000000 --- a/src/containers/WarehouseListPopover/components.js +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react'; - -import { RadioFieldCell } from 'components/DataTableCells'; - -/** - * Retrieve warehouse entries columns. - */ -export function useWarehouseEntriesColumns() { - return React.useMemo( - () => [ - { - Header: 'Warehouse Name', - accessor: 'warehouse_name', - Cell: RadioFieldCell, - width: 120, - disableSortBy: true, - className: 'name', - }, - { - id: 'quantity', - Header: 'Quantity on Hand', - accessor: 'quantity', - disableSortBy: true, - align: 'right', - width: '100', - }, - { - id: 'availiable_for_sale', - Header: 'Availiable for Sale', - accessor: 'availiable_for_sale', - disableSortBy: true, - align: 'right', - width: '100', - }, - ], - [], - ); -} diff --git a/src/containers/WarehouseListPopover/index.js b/src/containers/WarehouseListPopover/index.js deleted file mode 100644 index d2026f8ec..000000000 --- a/src/containers/WarehouseListPopover/index.js +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react'; -import styled from 'styled-components'; -import { PopoverInteractionKind, Position, Button } from '@blueprintjs/core'; -import { Popover2 } from '@blueprintjs/popover2'; -import WarehousesList from './WarehousesList'; -import { Icon, FormattedMessage as T, ButtonLink } from 'components'; - -export default function IntegrateWarehouseTable() { - return ( - } - interactionKind={PopoverInteractionKind.CLICK} - position={Position.BOTTOM_LEFT} - modifiers={{ - offset: { offset: '0, 4' }, - }} - > - - - ); -} - -const PopoverLink = styled.button` - border: 0; - cursor: pointer; - background: transparent; - margin-top: 18px; - padding-right: 0px; - color: #0052cc; - - &:hover, - &:active { - text-decoration: underline; - } -`;