mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
Revert "feat(warehouse) add warehouse propover."
This reverts commit 2aa26959e9.
This commit is contained in:
@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import { FormGroup, NumericInput, Intent } from '@blueprintjs/core';
|
import { FormGroup, NumericInput, Intent } from '@blueprintjs/core';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
import WarehouseListPopover from '../../containers/WarehouseListPopover';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Numeric input table cell.
|
* Numeric input table cell.
|
||||||
@@ -37,8 +36,7 @@ export default function NumericInputCell({
|
|||||||
onValueChange={handleValueChange}
|
onValueChange={handleValueChange}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
fill={true}
|
fill={true}
|
||||||
buttonPosition={'none'}
|
buttonPosition={"none"}
|
||||||
rightElement={<WarehouseListPopover />}
|
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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 (
|
|
||||||
<FormGroup
|
|
||||||
intent={error ? Intent.DANGER : null}
|
|
||||||
className={classNames(Classes.FILL)}
|
|
||||||
>
|
|
||||||
<Radio
|
|
||||||
value={value}
|
|
||||||
label={'Warehouse #1'}
|
|
||||||
onChange={onChange}
|
|
||||||
checked={initialValue}
|
|
||||||
minimal={true}
|
|
||||||
className="ml2"
|
|
||||||
{...radioProps}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default RadioEditableCell;
|
|
||||||
@@ -9,7 +9,6 @@ import NumericInputCell from './NumericInputCell';
|
|||||||
import CheckBoxFieldCell from './CheckBoxFieldCell';
|
import CheckBoxFieldCell from './CheckBoxFieldCell';
|
||||||
import SwitchFieldCell from './SwitchFieldCell';
|
import SwitchFieldCell from './SwitchFieldCell';
|
||||||
import TextAreaCell from './TextAreaCell';
|
import TextAreaCell from './TextAreaCell';
|
||||||
import RadioFieldCell from './RadioFieldCell';
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AccountsListFieldCell,
|
AccountsListFieldCell,
|
||||||
@@ -24,5 +23,4 @@ export {
|
|||||||
CheckBoxFieldCell,
|
CheckBoxFieldCell,
|
||||||
SwitchFieldCell,
|
SwitchFieldCell,
|
||||||
TextAreaCell,
|
TextAreaCell,
|
||||||
RadioFieldCell,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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 (
|
|
||||||
<WarehouseDataTableRoot
|
|
||||||
columns={columns}
|
|
||||||
data={DATA}
|
|
||||||
payload={{
|
|
||||||
errors: errors || [],
|
|
||||||
updateData: handleUpdateData,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
@@ -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',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -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 (
|
|
||||||
<Popover2
|
|
||||||
minimal={true}
|
|
||||||
content={<WarehousesList />}
|
|
||||||
interactionKind={PopoverInteractionKind.CLICK}
|
|
||||||
position={Position.BOTTOM_LEFT}
|
|
||||||
modifiers={{
|
|
||||||
offset: { offset: '0, 4' },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<PopoverLink>→</PopoverLink>
|
|
||||||
</Popover2>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const PopoverLink = styled.button`
|
|
||||||
border: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
background: transparent;
|
|
||||||
margin-top: 18px;
|
|
||||||
padding-right: 0px;
|
|
||||||
color: #0052cc;
|
|
||||||
|
|
||||||
&:hover,
|
|
||||||
&:active {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
Reference in New Issue
Block a user