diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-25 23:09:49 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-25 23:09:49 +0300 |
commit | 062f10a25d43b875d187cf582b2ecf96d075ec26 (patch) | |
tree | c6b43379325ba22a051827e6a461a8f8fed98402 /src/containers/TransferForm.tsx | |
parent | 77ac1549e2ab5ac68a1a7464ada9be7e2a2aad92 (diff) | |
download | commercel-ui-062f10a25d43b875d187cf582b2ecf96d075ec26.tar.gz |
refactor: move services to separate folder
Diffstat (limited to 'src/containers/TransferForm.tsx')
-rw-r--r-- | src/containers/TransferForm.tsx | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/containers/TransferForm.tsx b/src/containers/TransferForm.tsx deleted file mode 100644 index 801150e..0000000 --- a/src/containers/TransferForm.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import { Form, FormikProps } from 'formik'; -import moment from 'moment'; -import Input from '../components/Input'; -import Select from '../components/Select'; -import hooks from '../hooks/useAPIClient'; - - -const mapper = (item: any) => ({ key: item._id, label: item.name }); - - -const TransferForm: React.FC<FormikProps> = ({ setFieldValue, values }) => { - const { data: contractors } = hooks.contractors.useList(); - - if (!values.date) setFieldValue('date', moment().format('YYYY-MM-DD')); - if (!values.contractorId && contractors?.length) setFieldValue('contractorId', contractors[0]._id); - - return ( - <Form id="form"> - <div className="grid grid-cols-2"> - <Select - name="contractorId" - label="Контрагент" - options={contractors?.map(mapper)} - required - /> - <Input name="date" type="date" label="Дата" required /> - </div> - <div className="grid grid-cols-2"> - <Select - name="operation" - label="Операция" - options={[ - { key: 'in', label: 'Приход' }, - { key: 'out', label: 'Расход' }, - ]} - /> - <Input name="amount" type="number" label="Сумма" required /> - </div> - </Form> - ); -}; - -export default TransferForm; |