mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: optimize customer form performance.
feat: optimize item category form performance.
This commit is contained in:
@@ -1,35 +1,26 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
FormGroup,
|
||||
Intent,
|
||||
InputGroup,
|
||||
ControlGroup,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormGroup, InputGroup, ControlGroup } from '@blueprintjs/core';
|
||||
import { FastField, ErrorMessage } from 'formik';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { ErrorMessage } from 'components';
|
||||
import { inputIntent } from 'utils';
|
||||
|
||||
export default function CustomerFormAfterPrimarySection({
|
||||
setFieldValue,
|
||||
getFieldProps,
|
||||
errors,
|
||||
values,
|
||||
touched,
|
||||
}) {
|
||||
export default function CustomerFormAfterPrimarySection({}) {
|
||||
return (
|
||||
<div class="customer-form__after-primary-section-content">
|
||||
{/*------------ Customer email -----------*/}
|
||||
<FormGroup
|
||||
intent={errors.email && touched.email && Intent.DANGER}
|
||||
helperText={<ErrorMessage name={'email'} {...{ errors, touched }} />}
|
||||
className={'form-group--email'}
|
||||
label={<T id={'customer_email'} />}
|
||||
inline={true}
|
||||
>
|
||||
<InputGroup
|
||||
intent={errors.email && touched.email && Intent.DANGER}
|
||||
{...getFieldProps('email')}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FastField name={'email'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name={'email'} />}
|
||||
className={'form-group--email'}
|
||||
label={<T id={'customer_email'} />}
|
||||
inline={true}
|
||||
>
|
||||
<InputGroup {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
{/*------------ Phone number -----------*/}
|
||||
<FormGroup
|
||||
@@ -38,33 +29,41 @@ export default function CustomerFormAfterPrimarySection({
|
||||
inline={true}
|
||||
>
|
||||
<ControlGroup>
|
||||
<InputGroup
|
||||
intent={errors.work_phone && touched.work_phone && Intent.DANGER}
|
||||
{...getFieldProps('work_phone')}
|
||||
placeholder={'Work'}
|
||||
/>
|
||||
|
||||
<InputGroup
|
||||
intent={errors.personal_phone && touched.personal_phone && Intent.DANGER}
|
||||
{...getFieldProps('personal_phone')}
|
||||
placeholder={'Mobile'}
|
||||
/>
|
||||
<FastField name={'work_phone'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={'Work'}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
</FastField>
|
||||
<FastField name={'personal_phone'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={'Mobile'}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
</FastField>
|
||||
</ControlGroup>
|
||||
</FormGroup>
|
||||
|
||||
{/*------------ Customer website -----------*/}
|
||||
<FormGroup
|
||||
intent={errors.website && touched.website && Intent.DANGER}
|
||||
helperText={<ErrorMessage name={'website'} {...{ errors, touched }} />}
|
||||
className={'form-group--website'}
|
||||
label={<T id={'website'} />}
|
||||
inline={true}
|
||||
>
|
||||
<InputGroup
|
||||
intent={errors.website && touched.website && Intent.DANGER}
|
||||
{...getFieldProps('website')}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FastField name={'website'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name={'website'} />}
|
||||
className={'form-group--website'}
|
||||
label={<T id={'website'} />}
|
||||
inline={true}
|
||||
>
|
||||
<InputGroup {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user