import {ModalField, ModalSelect} from '@components';
import {FC} from 'react';
import {useField, useFormValues, useOptions} from './hooks';

type Props = {
  id: string,
};

const GoodsModalInfo: FC<Props> = function({id}) {
  const [{control}] = useField();
  const {storageOptions, departmentOptions} = useOptions();
  useFormValues(id);

  return (
    <>
      <ModalField
        name='goodsItemNumber'
        label='品号'
        control={control}
      />
      <ModalField
        name='goodsName'
        label='品名'
        control={control}
      />
      <ModalField
        name='goodsType'
        label='类型'
        control={control}
      />
      <ModalField
        name='goodsMinAccommodate'
        label='库位最小盒'
        type='number'
        control={control}
      />
      <ModalField
        name='goodsAccommodateNum'
        label='收容数'
        type='number'
        control={control}
      />
      <ModalField
        name='goodsMaxAccommodate'
        label='库位最大容纳'
        type='number'
        control={control}
      />
      <ModalField
        name='goodsSupplier'
        label='供应商/客户'
        control={control}
      />
      <ModalSelect
        name='goodsStorageLocation'
        label='库位'
        control={control}
        data={storageOptions}
      />
      <ModalField
        name='goodsInputType'
        label='投入方式'
        control={control}
      />
      <ModalSelect
        name='goodsUserDepartment'
        label='使用部门'
        control={control}
        data={departmentOptions}
      />
      <ModalField
        name='goodsLowReserves'
        label='低储量'
        type='number'
        control={control}
      />
      <ModalField
        name='goodsHighReserves'
        type='number'
        label='高储量'
        control={control}
      />
      <ModalField
        name='goodsGrade'
        label='等级'
        control={control}
      />
      <ModalField
        name='goosdPackingType'
        label='包装类别'
        control={control}
      />
      <ModalField
        name='goodsUnit'
        label='单位'
        control={control}
      />
    </>
  );
};

export default GoodsModalInfo;
