feat(warehouse) add warehouse propover.

This commit is contained in:
elforjani13
2022-01-30 18:04:56 +02:00
committed by a.bouhuolia
parent 86710b3ba8
commit 8c594b991c
6 changed files with 198 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ 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.
@@ -36,7 +37,8 @@ export default function NumericInputCell({
onValueChange={handleValueChange}
onBlur={onBlur}
fill={true}
buttonPosition={"none"}
buttonPosition={'none'}
rightElement={<WarehouseListPopover />}
/>
</FormGroup>
);

View File

@@ -0,0 +1,44 @@
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;

View File

@@ -9,6 +9,7 @@ import NumericInputCell from './NumericInputCell';
import CheckBoxFieldCell from './CheckBoxFieldCell';
import SwitchFieldCell from './SwitchFieldCell';
import TextAreaCell from './TextAreaCell';
import RadioFieldCell from './RadioFieldCell';
export {
AccountsListFieldCell,
@@ -23,4 +24,5 @@ export {
CheckBoxFieldCell,
SwitchFieldCell,
TextAreaCell,
RadioFieldCell,
};