import type { FetchMyDelegationsResponse } from "../../api/delegations"; import { Button } from "../../components/ui/button"; import { PDF_FILE_ACCEPT, splitPdfFiles } from "../../lib/pdfFiles"; export type InvoiceUploadCardProps = { selectedFiles: File[]; setSelectedFiles: (files: File[]) => void; isUploading: boolean; uploadProgressLabel: string; onUpload: () => void; showProxyOwnerSelector: boolean; proxyDelegationsQuery: { data?: FetchMyDelegationsResponse }; uploadOwnerEmployeeId: string; setUploadOwnerEmployeeId: (id: string) => void; }; export function InvoiceUploadCard({ selectedFiles, setSelectedFiles, isUploading, uploadProgressLabel, onUpload, showProxyOwnerSelector, proxyDelegationsQuery, uploadOwnerEmployeeId, setUploadOwnerEmployeeId, }: InvoiceUploadCardProps) { const selectedLabel = selectedFiles.length === 0 ? "选择文件" : selectedFiles.length === 1 ? selectedFiles[0].name : `已选择 ${selectedFiles.length} 个文件`; return (

添加发票

{showProxyOwnerSelector ? ( ) : null}
{ setSelectedFiles(splitPdfFiles(event.target.files).accepted); event.target.value = ""; }} type="file" />
{selectedFiles.length ? (
{selectedFiles.slice(0, 4).map((file) => (
{file.name} · {Math.ceil(file.size / 1024)} KB
))} {selectedFiles.length > 4 ?
另有 {selectedFiles.length - 4} 个文件
: null}
) : null}
); }