import {ModalBtnGroup, ModalField, ModalSelect} from '@components';
import {Space} from 'antd';
import {FC} from 'react';
import {useFormInfoValue, useFormInstance} from './hooks';

const stateOptions = [
  {value: '1', label: '启用'},
  {value: '0', label: '禁用'},
];

type Props = {
  id: string;
  isLoading?: boolean;
  onClose: () => void;
};

const StoreModalInfo: FC<Props> = function({id, isLoading, onClose}) {
  const control = useFormInstance();
  useFormInfoValue(id);

  return (
    <Space direction='vertical'>
      <ModalField
        name='storageLocationCode'
        width='300px'
        label='库位编号'
        control={control}
      />
      <ModalField
        name='storageLocationName'
        width='300px'
        label='库位名称'
        control={control}
      />
      <ModalField
        name='storageLocationType'
        width='300px'
        label='库位类型'
        control={control}
      />
      <ModalField
        name='storageWarehouseWhere'
        width='300px'
        label='所在仓库'
        control={control}
      />
      <ModalSelect
        name='storageIsNotDisable'
        width='300px'
        label='状态'
        control={control}
        data={stateOptions}
      />
      <ModalBtnGroup isLoading={isLoading} onClose={onClose} />
    </Space>
  );
};

export default StoreModalInfo;
