mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
BIG-359:
This commit is contained in:
@@ -50,7 +50,7 @@ export default function ItemFormFormik({
|
|||||||
// Handles the form submit.
|
// Handles the form submit.
|
||||||
const handleFormSubmit = (values, form) => {
|
const handleFormSubmit = (values, form) => {
|
||||||
const { setSubmitting, resetForm, setErrors } = form;
|
const { setSubmitting, resetForm, setErrors } = form;
|
||||||
const formValues = { ...values };
|
const formValues = { ...values, type: values.type.toString() };
|
||||||
|
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ export default function ItemFormFormik({
|
|||||||
validationSchema={isNewMode ? CreateItemFormSchema : EditItemFormSchema}
|
validationSchema={isNewMode ? CreateItemFormSchema : EditItemFormSchema}
|
||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
onSubmit={handleFormSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
>
|
>
|
||||||
<Form>
|
<Form>
|
||||||
<div class={classNames(CLASSES.PAGE_FORM_BODY)}>
|
<div class={classNames(CLASSES.PAGE_FORM_BODY)}>
|
||||||
<ItemFormPrimarySection />
|
<ItemFormPrimarySection />
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ import {
|
|||||||
Radio,
|
Radio,
|
||||||
Position,
|
Position,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
|
import {
|
||||||
|
FormattedMessage as T,
|
||||||
|
FormattedHTMLMessage,
|
||||||
|
FCheckbox,
|
||||||
|
FFormGroup,
|
||||||
|
} from 'components';
|
||||||
import { ErrorMessage, FastField } from 'formik';
|
import { ErrorMessage, FastField } from 'formik';
|
||||||
import {
|
import {
|
||||||
CategoriesSelectList,
|
CategoriesSelectList,
|
||||||
@@ -29,7 +34,7 @@ import { categoriesFieldShouldUpdate } from './utils';
|
|||||||
export default function ItemFormPrimarySection() {
|
export default function ItemFormPrimarySection() {
|
||||||
// Item form context.
|
// Item form context.
|
||||||
const { isNewMode, item, itemsCategories } = useItemFormContext();
|
const { isNewMode, item, itemsCategories } = useItemFormContext();
|
||||||
|
console.log(item.type, 'XXX');
|
||||||
const nameFieldRef = useRef(null);
|
const nameFieldRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -53,7 +58,34 @@ export default function ItemFormPrimarySection() {
|
|||||||
return (
|
return (
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_HEADER_PRIMARY)}>
|
<div className={classNames(CLASSES.PAGE_FORM_HEADER_PRIMARY)}>
|
||||||
{/*----------- Item type ----------*/}
|
{/*----------- Item type ----------*/}
|
||||||
<FastField name={'type'}>
|
<FFormGroup
|
||||||
|
name={'type'}
|
||||||
|
label={<T id={'item_type'} />}
|
||||||
|
labelInfo={
|
||||||
|
<span>
|
||||||
|
<FieldRequiredHint />
|
||||||
|
<Hint
|
||||||
|
content={itemTypeHintContent}
|
||||||
|
position={Position.BOTTOM_LEFT}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
inline={true}
|
||||||
|
>
|
||||||
|
<FCheckbox
|
||||||
|
inline={true}
|
||||||
|
name="type"
|
||||||
|
label={<T id={'service'} />}
|
||||||
|
value="service"
|
||||||
|
/>
|
||||||
|
<FCheckbox
|
||||||
|
inline={true}
|
||||||
|
name="type"
|
||||||
|
label={<T id={'inventory'} />}
|
||||||
|
value="inventory"
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
{/* <FastField name={'type'}>
|
||||||
{({ form, field: { value }, meta: { touched, error } }) => (
|
{({ form, field: { value }, meta: { touched, error } }) => (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
medium={true}
|
medium={true}
|
||||||
@@ -85,7 +117,7 @@ export default function ItemFormPrimarySection() {
|
|||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
</FastField>
|
</FastField> */}
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs={7}>
|
<Col xs={7}>
|
||||||
|
|||||||
Reference in New Issue
Block a user