import {Modal, ModalField} from '@components';
import {FC} from 'react';
import {useFormState} from './hooks';

type Props = {
  visible: boolean;
  onClose: () => void;
  onFetch: () => void;
};

const AddModal: FC<Props> = function (props) {
  const [{control, isLoading}, {onSubmit}] = useFormState(props);

  return (
    <Modal
      {...props}
      title='新增盘点'
      onSubmit={onSubmit}
      isLoading={isLoading}
      width='580px'
      height='440px'
    >
      <ModalField control={control} label='盘点标题' name='inventoryTitle' />
    </Modal>
  );
};

export default AddModal;
