diff options
Diffstat (limited to 'src/services/waybills')
| -rw-r--r-- | src/services/waybills/WaybillForm.tsx | 7 | ||||
| -rw-r--r-- | src/services/waybills/WaybillPanel.tsx | 5 | ||||
| -rw-r--r-- | src/services/waybills/index.ts | 3 | 
3 files changed, 9 insertions, 6 deletions
| diff --git a/src/services/waybills/WaybillForm.tsx b/src/services/waybills/WaybillForm.tsx index c11ab9e..613989f 100644 --- a/src/services/waybills/WaybillForm.tsx +++ b/src/services/waybills/WaybillForm.tsx @@ -7,12 +7,13 @@ import Button from '../../components/Button';  import Select from '../../components/Select';  import Paper from '../../components/Paper';  import hooks from '../../hooks/useAPIClient'; +import { Product, Contractor, Waybill } from '../types'; -const mapper = (item: any) => ({ key: item._id, label: item.name }); +const mapper = (item: Product | Contractor) => ({ key: item._id, label: item.name }); -const WaybillForm: React.FC<FormikProps<any>> = ({ setFieldValue, values }) => { +const WaybillForm: React.FC<FormikProps<Waybill>> = ({ setFieldValue, values }) => {    const { data: products } = hooks.products.useList();    const { data: contractors } = hooks.contractors.useList(); @@ -51,7 +52,7 @@ const WaybillForm: React.FC<FormikProps<any>> = ({ setFieldValue, values }) => {          />          <Input name="date" type="date" label="Дата" />        </div> -      {values.records.map((record: any, index: number) => ( +      {values.records.map((record, index) => (          <Paper variant="outlined" className="my-4 md:mx-4" key={`${index}-${record.productId}`}>            <Select              name={`records.${index}.productId`} diff --git a/src/services/waybills/WaybillPanel.tsx b/src/services/waybills/WaybillPanel.tsx index 1d1701d..c501fc2 100644 --- a/src/services/waybills/WaybillPanel.tsx +++ b/src/services/waybills/WaybillPanel.tsx @@ -3,12 +3,13 @@ import { useHistory } from 'react-router-dom';  import Button from '../../components/Button';  import { patch, baseURL } from '../../requests';  import { PanelProps } from '../../lib/ServiceContext'; +import { Waybill } from '../types'; -const WaybillPanel: React.FC<PanelProps> = ({ item, mutate }) => { +const WaybillPanel: React.FC<PanelProps<Waybill>> = ({ item, mutate }) => {    const history = useHistory(); -  const handleChangeStatus = (status: any) => patch(`/waybills/${item._id}`, { status }) +  const handleChangeStatus = (status: Waybill['status']) => patch(`/waybills/${item._id}`, { status })      .then(() => {        history.push('/waybills');        mutate({ ...item, status }); diff --git a/src/services/waybills/index.ts b/src/services/waybills/index.ts index 8cd6c0c..a26318b 100644 --- a/src/services/waybills/index.ts +++ b/src/services/waybills/index.ts @@ -2,8 +2,9 @@ import Form from './WaybillForm';  import Panel from './WaybillPanel';  import { transformOperation, transformStatus } from '../transforms';  import { ServiceParams } from '../../lib/ServiceContext'; +import { Waybill } from '../types'; -const service: ServiceParams = { +const service: ServiceParams<Waybill> = {    route: 'waybills',    name: 'Накладные',    nameSingular: 'Накладная', | 
