blob: bb8d9abb6cfcb16c2f85a5fc1df7c545894b4856 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import React from 'react';
import { Form, Field } from 'formik';
import Input from '../components/Input';
import Select from '../components/Select';
import hooks from '../hooks/useAPIClient';
const WaybillForm: React.FC = () => {
const { data: contractors } = hooks.contractors.useList();
const { data: products } = hooks.products.useList();
return (
<Form id="form">
<div className="max-w-lg">
<Select
name="contractorId"
label="Контрагент"
options={contractors?.map(c => ({ key: c._id, label: c.name }))}
/>
<Select
name="productId"
label="Товар"
options={products?.map(p => ({ key: p._id, label: p.name }))}
/>
<Select
name="operation"
label="Операция"
options={[
{ key: 'in', label: 'Приход' },
{ key: 'out', label: 'Расход' },
]}
/>
<Input name="quantity" type="number" label="Количество" />
</div>
</Form>
);
};
export default WaybillForm;
|