mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
// @ts-nocheck
|
|
import React from 'react';
|
|
import classNames from 'classnames';
|
|
import { FastField } from 'formik';
|
|
import { CLASSES } from '@/constants/classes';
|
|
import ItemsEntriesTable from '@/containers/Entries/ItemsEntriesTable';
|
|
import { useEstimateFormContext } from './EstimateFormProvider';
|
|
import { entriesFieldShouldUpdate } from './utils';
|
|
|
|
/**
|
|
* Estimate form items entries editor.
|
|
*/
|
|
export default function EstimateFormItemsEntriesField() {
|
|
const { items } = useEstimateFormContext();
|
|
|
|
return (
|
|
<div className={classNames(CLASSES.PAGE_FORM_BODY)}>
|
|
<FastField
|
|
name={'entries'}
|
|
items={items}
|
|
shouldUpdate={entriesFieldShouldUpdate}
|
|
>
|
|
{({
|
|
form: { values, setFieldValue },
|
|
field: { value },
|
|
meta: { error, touched },
|
|
}) => (
|
|
<ItemsEntriesTable
|
|
entries={value}
|
|
onUpdateData={(entries) => {
|
|
setFieldValue('entries', entries);
|
|
}}
|
|
items={items}
|
|
errors={error}
|
|
linesNumber={4}
|
|
currencyCode={values.currency_code}
|
|
/>
|
|
)}
|
|
</FastField>
|
|
</div>
|
|
);
|
|
}
|