import { Button, Dropdown, MenuProps } from 'antd'
import { EXPORT_WORD_ENUM, exportWordHandler } from './exportWordTemplates'

// 待完善

const items: MenuProps['items'] = [
  {
    key: EXPORT_WORD_ENUM.BORROW,
    label: <span className='Y2xia'>借用藏品点交凭证文件</span>
  },
  {
    key: EXPORT_WORD_ENUM.HALL_PUT_BACK,
    label: <span className='Y2xia'>藏品馆内提退凭单</span>
  },
  {
    key: EXPORT_WORD_ENUM.SUB_PUT_BACK,
    label: <span className='Y2xia'>分库藏品提退出入库记录单</span>
  },
  {
    key: EXPORT_WORD_ENUM.SUB_PUT_IN,
    label: <span className='Y2xia'>分库藏品入库记录单</span>
  },
  {
    key: EXPORT_WORD_ENUM.VOUCHER,
    label: <span className='Y2xia'>入馆凭证</span>
  },
  {
    key: EXPORT_WORD_ENUM.FORM_FOR_DIGITAL,
    label: <span className='Y2xia'>藏品图片及相关数字化信息使用申请单</span>
  }
]

// 查看详情的导出页面

export const EXbtnFu = (data?: any) => {
  const handleExport: MenuProps['onClick'] = async ({ key }) => {
    const k = Number(key) as EXPORT_WORD_ENUM
    exportWordHandler(k, data)
  }

  return (
    <Dropdown menu={{ items, onClick: handleExport }} placement='top' arrow>
      <Button type='primary'>导出</Button>
    </Dropdown>
  )
}
