feat: add delete-after-action dialogs and auto-refresh in inbox
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s
- Show confirmation dialog to delete document after download or email send - Auto-refresh inbox list every 30 seconds - Rename "Vorschau" button to "Weiterverarbeiten" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -538,6 +538,7 @@ interface DownloadSegmentsDialogProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: DownloadSegmentsDialogProps) {
|
function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: DownloadSegmentsDialogProps) {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [filenames, setFilenames] = useState<string[]>([]);
|
const [filenames, setFilenames] = useState<string[]>([]);
|
||||||
const [downloading, setDownloading] = useState<number | 'all' | null>(null);
|
const [downloading, setDownloading] = useState<number | 'all' | null>(null);
|
||||||
|
|
||||||
@@ -575,17 +576,39 @@ function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls,
|
|||||||
|
|
||||||
const downloadAll = async () => {
|
const downloadAll = async () => {
|
||||||
setDownloading('all');
|
setDownloading('all');
|
||||||
|
let success = false;
|
||||||
try {
|
try {
|
||||||
for (let i = 0; i < documents.length; i++) {
|
for (let i = 0; i < documents.length; i++) {
|
||||||
const blob = await inboxApi.downloadSegmentBlob(fileId, documents[i].pages);
|
const blob = await inboxApi.downloadSegmentBlob(fileId, documents[i].pages);
|
||||||
triggerDownload(blob, filenames[i] || fileName);
|
triggerDownload(blob, filenames[i] || fileName);
|
||||||
if (i < documents.length - 1) await new Promise((r) => setTimeout(r, 300));
|
if (i < documents.length - 1) await new Promise((r) => setTimeout(r, 300));
|
||||||
}
|
}
|
||||||
|
success = true;
|
||||||
} catch {
|
} catch {
|
||||||
message.error('Download fehlgeschlagen');
|
message.error('Download fehlgeschlagen');
|
||||||
} finally {
|
} finally {
|
||||||
setDownloading(null);
|
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 (
|
return (
|
||||||
@@ -654,6 +677,7 @@ interface SendEmailDialogProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: SendEmailDialogProps) {
|
function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: SendEmailDialogProps) {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
const [filenames, setFilenames] = useState<string[]>([]);
|
const [filenames, setFilenames] = useState<string[]>([]);
|
||||||
@@ -712,7 +736,24 @@ function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose
|
|||||||
setRecipientHistory(updated);
|
setRecipientHistory(updated);
|
||||||
userSettingsApi.update({ emailRecipientHistory: updated }).catch(() => {});
|
userSettingsApi.update({ emailRecipientHistory: updated }).catch(() => {});
|
||||||
message.success('E-Mail wurde gesendet');
|
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) {
|
} catch (err: any) {
|
||||||
if (err?.errorFields) return;
|
if (err?.errorFields) return;
|
||||||
message.error('E-Mail konnte nicht gesendet werden');
|
message.error('E-Mail konnte nicht gesendet werden');
|
||||||
|
|||||||
@@ -209,6 +209,11 @@ export default function InboxPage() {
|
|||||||
load();
|
load();
|
||||||
}, [load]);
|
}, [load]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const id = setInterval(load, 30_000);
|
||||||
|
return () => clearInterval(id);
|
||||||
|
}, [load]);
|
||||||
|
|
||||||
const handleRescan = async () => {
|
const handleRescan = async () => {
|
||||||
setRescanning(true);
|
setRescanning(true);
|
||||||
const hide = message.loading('Rescan läuft – das kann je nach Anzahl der Dokumente dauern …', 0);
|
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={<EyeOutlined />}
|
icon={<EyeOutlined />}
|
||||||
onClick={() => navigate(`/inbox/${encodeURIComponent(record.id)}`)}
|
onClick={() => navigate(`/inbox/${encodeURIComponent(record.id)}`)}
|
||||||
>
|
>
|
||||||
Vorschau
|
Weiterverarbeiten
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
|
|||||||
Reference in New Issue
Block a user