mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
fix: logo style.
fix: page forms style. feat: auto-fill items entries from item details. fix: hiding dashboard copyright bar.
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import * as Yup from 'yup';
|
||||
import { useFormik } from 'formik';
|
||||
import { Row, Col, ErrorMessage } from 'components';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import {
|
||||
Button,
|
||||
Classes,
|
||||
FormGroup,
|
||||
InputGroup,
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import { Button, Classes } from '@blueprintjs/core';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { saveInvoke } from 'utils';
|
||||
import ReferenceNumberFormContent from './ReferenceNumberFormContent';
|
||||
|
||||
/**
|
||||
* Reference number form.
|
||||
@@ -21,6 +17,7 @@ export default function ReferenceNumberForm({
|
||||
initialNumber,
|
||||
}) {
|
||||
const validationSchema = Yup.object().shape({
|
||||
// mode: Yup.string(),
|
||||
number_prefix: Yup.string(),
|
||||
next_number: Yup.number(),
|
||||
});
|
||||
@@ -33,85 +30,44 @@ export default function ReferenceNumberForm({
|
||||
[initialPrefix, initialNumber],
|
||||
);
|
||||
|
||||
const {
|
||||
errors,
|
||||
touched,
|
||||
handleSubmit,
|
||||
isSubmitting,
|
||||
getFieldProps,
|
||||
} = useFormik({
|
||||
enableReinitialize: true,
|
||||
initialValues: {
|
||||
...initialValues,
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, { setSubmitting, setErrors }) => {
|
||||
onSubmit(values, { setSubmitting, setErrors });
|
||||
},
|
||||
});
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className={Classes.DIALOG_BODY}>
|
||||
<p className="paragraph">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce
|
||||
tincidunt porta quam,
|
||||
</p>
|
||||
<Row>
|
||||
{/* ------------- Prefix ------------- */}
|
||||
<Col xs={6}>
|
||||
<FormGroup
|
||||
label={<T id={'prefix'} />}
|
||||
className={'form-group--'}
|
||||
intent={errors.number_prefix && touched.number_prefix && Intent.DANGER}
|
||||
helperText={
|
||||
<ErrorMessage name={'prefix'} {...{ errors, touched }} />
|
||||
}
|
||||
>
|
||||
<InputGroup
|
||||
intent={errors.number_prefix && touched.number_prefix && Intent.DANGER}
|
||||
{...getFieldProps('number_prefix')}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
const handleSubmit = (values) => {
|
||||
debugger;
|
||||
saveInvoke(onSubmit, values);
|
||||
};
|
||||
|
||||
{/* ------------- Next number ------------- */}
|
||||
<Col xs={6}>
|
||||
<FormGroup
|
||||
label={<T id={'next_number'} />}
|
||||
className={'form-group--'}
|
||||
intent={
|
||||
errors.next_number && touched.next_number && Intent.DANGER
|
||||
}
|
||||
helperText={
|
||||
<ErrorMessage name={'next_number'} {...{ errors, touched }} />
|
||||
}
|
||||
>
|
||||
<InputGroup
|
||||
intent={
|
||||
errors.next_number && touched.next_number && Intent.DANGER
|
||||
}
|
||||
{...getFieldProps('next_number')}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
<div className={Classes.DIALOG_FOOTER}>
|
||||
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
||||
<Button onClick={onClose}>
|
||||
<T id={'cancel'} />
|
||||
</Button>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
<T id={'submit'} />
|
||||
</Button>
|
||||
return (
|
||||
<Formik
|
||||
initialValues={initialValues}
|
||||
validationSchema={validationSchema}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
{({ isSubmitting }) => (
|
||||
<Form>
|
||||
<div className={Classes.DIALOG_BODY}>
|
||||
<p className="paragraph">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce
|
||||
tincidunt porta quam,
|
||||
</p>
|
||||
|
||||
<ReferenceNumberFormContent />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div className={Classes.DIALOG_FOOTER}>
|
||||
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
||||
<Button onClick={onClose}>
|
||||
<T id={'cancel'} />
|
||||
</Button>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
<T id={'submit'} />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
)}
|
||||
</Formik>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import React from 'react';
|
||||
import { FastField } from 'formik';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormGroup, InputGroup, Radio } from '@blueprintjs/core';
|
||||
import { Row, Col, ErrorMessage } from 'components';
|
||||
import { inputIntent } from 'utils';
|
||||
|
||||
/**
|
||||
* Reference number form content.
|
||||
*/
|
||||
export default function ReferenceNumberFormContent() {
|
||||
return (
|
||||
<>
|
||||
<FastField name={'mode'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<Radio
|
||||
label="Auto-incrementing invoice number."
|
||||
value="auto-increment"
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
<Row>
|
||||
{/* ------------- Prefix ------------- */}
|
||||
<Col xs={6}>
|
||||
<FastField name={'prefix'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'prefix'} />}
|
||||
className={'form-group--'}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name={'prefix'} />}
|
||||
>
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
{...field}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</Col>
|
||||
|
||||
{/* ------------- Next number ------------- */}
|
||||
<Col xs={6}>
|
||||
<FastField name={'next_number'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'next_number'} />}
|
||||
className={'form-group--'}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name={'next_number'} />}
|
||||
>
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
{...field}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<FastField name={'mode'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<Radio label="Manual entring for this transaction." value="manual" {...field} />
|
||||
)}
|
||||
</FastField>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user