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>