diff --git a/paperless-frontend/src/pages/InboxDetailPage.tsx b/paperless-frontend/src/pages/InboxDetailPage.tsx index 89289a9..da7a6ff 100644 --- a/paperless-frontend/src/pages/InboxDetailPage.tsx +++ b/paperless-frontend/src/pages/InboxDetailPage.tsx @@ -538,6 +538,7 @@ interface DownloadSegmentsDialogProps { } function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: DownloadSegmentsDialogProps) { + const navigate = useNavigate(); const [filenames, setFilenames] = useState([]); const [downloading, setDownloading] = useState(null); @@ -575,17 +576,39 @@ function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls, const downloadAll = async () => { setDownloading('all'); + let success = false; try { for (let i = 0; i < documents.length; i++) { const blob = await inboxApi.downloadSegmentBlob(fileId, documents[i].pages); triggerDownload(blob, filenames[i] || fileName); if (i < documents.length - 1) await new Promise((r) => setTimeout(r, 300)); } + success = true; } catch { message.error('Download fehlgeschlagen'); } finally { setDownloading(null); } + if (success) { + Modal.confirm({ + title: 'Dokument löschen?', + content: 'Das Dokument wurde heruntergeladen. Soll es jetzt aus der Eingangsbox entfernt werden?', + okText: 'Ja, löschen', + okButtonProps: { danger: true }, + cancelText: 'Nein, behalten', + onOk: async () => { + try { + await inboxApi.remove(fileId); + navigate('/inbox'); + } catch { + message.error('Löschen fehlgeschlagen'); + } finally { + onClose(); + } + }, + onCancel: onClose, + }); + } }; return ( @@ -654,6 +677,7 @@ interface SendEmailDialogProps { } function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: SendEmailDialogProps) { + const navigate = useNavigate(); const [form] = Form.useForm(); const [submitting, setSubmitting] = useState(false); const [filenames, setFilenames] = useState([]); @@ -712,7 +736,24 @@ function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose setRecipientHistory(updated); userSettingsApi.update({ emailRecipientHistory: updated }).catch(() => {}); message.success('E-Mail wurde gesendet'); - onClose(); + Modal.confirm({ + title: 'Dokument löschen?', + content: 'Die E-Mail wurde gesendet. Soll das Dokument jetzt aus der Eingangsbox entfernt werden?', + okText: 'Ja, löschen', + okButtonProps: { danger: true }, + cancelText: 'Nein, behalten', + onOk: async () => { + try { + await inboxApi.remove(fileId); + navigate('/inbox'); + } catch { + message.error('Löschen fehlgeschlagen'); + } finally { + onClose(); + } + }, + onCancel: onClose, + }); } catch (err: any) { if (err?.errorFields) return; message.error('E-Mail konnte nicht gesendet werden'); diff --git a/paperless-frontend/src/pages/InboxPage.tsx b/paperless-frontend/src/pages/InboxPage.tsx index 25fbd88..943c1ca 100644 --- a/paperless-frontend/src/pages/InboxPage.tsx +++ b/paperless-frontend/src/pages/InboxPage.tsx @@ -209,6 +209,11 @@ export default function InboxPage() { load(); }, [load]); + useEffect(() => { + const id = setInterval(load, 30_000); + return () => clearInterval(id); + }, [load]); + const handleRescan = async () => { setRescanning(true); const hide = message.loading('Rescan läuft – das kann je nach Anzahl der Dokumente dauern …', 0); @@ -324,7 +329,7 @@ export default function InboxPage() { icon={} onClick={() => navigate(`/inbox/${encodeURIComponent(record.id)}`)} > - Vorschau + Weiterverarbeiten