fix: danger intent fields.

This commit is contained in:
a.bouhuolia
2021-08-03 14:30:50 +02:00
parent 15bc34d866
commit aab56662a5
13 changed files with 124 additions and 48 deletions

View File

@@ -25,7 +25,12 @@ function DecrementAdjustmentFields() {
intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name="quantity_on_hand" />}
>
<InputGroup disabled={true} medium={'true'} {...field} />
<InputGroup
disabled={true}
medium={'true'}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup>
)}
</FastField>
@@ -66,6 +71,7 @@ function DecrementAdjustmentFields() {
),
);
}}
intent={inputIntent({ error, touched })}
/>
</FormGroup>
)}
@@ -104,6 +110,7 @@ function DecrementAdjustmentFields() {
),
);
}}
intent={inputIntent({ error, touched })}
/>
</FormGroup>
)}

View File

@@ -21,7 +21,12 @@ export default function IncrementAdjustmentFields() {
intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name="quantity_on_hand" />}
>
<InputGroup disabled={true} medium={'true'} {...field} />
<InputGroup
disabled={true}
medium={'true'}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup>
)}
</FastField>
@@ -63,6 +68,7 @@ export default function IncrementAdjustmentFields() {
),
);
}}
intent={inputIntent({ error, touched })}
/>
</FormGroup>
)}
@@ -87,6 +93,7 @@ export default function IncrementAdjustmentFields() {
onChange={(value) => {
setFieldValue('cost', value);
}}
intent={inputIntent({ error, touched })}
/>
</FormGroup>
)}
@@ -127,6 +134,7 @@ export default function IncrementAdjustmentFields() {
),
);
}}
intent={inputIntent({ error, touched })}
/>
</FormGroup>
)}

View File

@@ -3,20 +3,18 @@ import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
const Schema = Yup.object().shape({
date: Yup.date()
.required()
.label(intl.get('date')),
date: Yup.date().required().label(intl.get('date')),
type: Yup.string().required(),
adjustment_account_id: Yup.string().required(),
adjustment_account_id: Yup.string()
.required()
.label(intl.get('adjustment_account')),
item_id: Yup.number().required(),
reason: Yup.string()
.required()
.min(3)
.max(DATATYPES_LENGTH.TEXT)
.label(intl.get('reason')),
quantity_on_hand: Yup.number()
.required()
.label(intl.get('qty')),
quantity_on_hand: Yup.number().required().label(intl.get('qty')),
quantity: Yup.number().integer().min(1).required(),
cost: Yup.number().when(['type'], {
is: (type) => type === 'increment',

View File

@@ -38,7 +38,6 @@ export default function InventoryAdjustmentFormDialogFields() {
const { accounts } = useInventoryAdjContext();
// Intl context.
return (
<div className={Classes.DIALOG_BODY}>
@@ -65,6 +64,7 @@ export default function InventoryAdjustmentFormDialogFields() {
position: Position.BOTTOM,
minimal: true,
}}
intent={inputIntent({ error, touched })}
inputRef={(ref) => (dateFieldRef.current = ref)}
/>
</FormGroup>
@@ -103,6 +103,7 @@ export default function InventoryAdjustmentFormDialogFields() {
selectedItemProp={'value'}
textProp={'name'}
popoverProps={{ minimal: true }}
intent={inputIntent({ error, touched })}
/>
</FormGroup>
)}
@@ -129,6 +130,7 @@ export default function InventoryAdjustmentFormDialogFields() {
}
inputProps={{
placeholder: intl.get('select_adjustment_account'),
intent: inputIntent({ error, touched }),
}}
/>
</FormGroup>
@@ -144,7 +146,7 @@ export default function InventoryAdjustmentFormDialogFields() {
helperText={<ErrorMessage name="reference_no" />}
className={'form-group--reference-no'}
>
<InputGroup {...field} />
<InputGroup intent={inputIntent({ error, touched })} {...field} />
</FormGroup>
)}
</FastField>
@@ -159,7 +161,12 @@ export default function InventoryAdjustmentFormDialogFields() {
intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name={'reason'} />}
>
<TextArea growVertically={true} large={true} {...field} />
<TextArea
growVertically={true}
large={true}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup>
)}
</FastField>

View File

@@ -29,6 +29,7 @@ export default function ItemCategoryFormFields() {
<InputGroup
medium={true}
inputRef={(ref) => (categoryNameFieldRef.current = ref)}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup>
@@ -45,7 +46,12 @@ export default function ItemCategoryFormFields() {
helperText={<ErrorMessage name="description" />}
inline={true}
>
<TextArea growVertically={true} large={true} {...field} />
<TextArea
growVertically={true}
large={true}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup>
)}
</FastField>

View File

@@ -109,6 +109,7 @@ export default function ItemFormPrimarySection() {
<InputGroup
medium={true}
{...field}
intent={inputIntent({ error, touched })}
inputRef={(ref) => (nameFieldRef.current = ref)}
/>
</FormGroup>
@@ -125,7 +126,7 @@ export default function ItemFormPrimarySection() {
helperText={<ErrorMessage name={'code'} />}
inline={true}
>
<InputGroup medium={true} {...field} />
<InputGroup medium={true} intent={inputIntent({ error, touched })} {...field} />
</FormGroup>
)}
</FastField>

View File

@@ -11,7 +11,9 @@ import {
Classes,
Intent,
Switch,
Alignment,
} from '@blueprintjs/core';
import { Tooltip2 } from '@blueprintjs/popover2';
import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
@@ -19,6 +21,7 @@ import Icon from 'components/Icon';
import { If, DashboardActionViewsList } from 'components';
import { useItemsListContext } from './ItemsListProvider';
import { useRefreshItems } from 'hooks/query/items';
import withItems from 'containers/Items/withItems';
import withItemsActions from './withItemsActions';
@@ -43,7 +46,8 @@ function ItemsActionsBar({
// Items list context.
const { itemsViews } = useItemsListContext();
// React intl.
// Items refresh action.
const { refresh } = useRefreshItems();
// History context.
const history = useHistory();
@@ -69,6 +73,10 @@ function ItemsActionsBar({
setItemsTableState({ inactiveMode: checked });
};
const handleRefreshBtnClick = () => {
refresh();
};
return (
<DashboardActionsBar>
<NavbarGroup>
@@ -125,6 +133,14 @@ function ItemsActionsBar({
onChange={handleInactiveSwitchChange}
/>
</NavbarGroup>
<NavbarGroup align={Alignment.RIGHT}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="refresh-16" iconSize={14} />}
onClick={handleRefreshBtnClick}
/>
</NavbarGroup>
</DashboardActionsBar>
);
}