refactor: simplify MailImportWizard success view and adjust InboxDetailPage dropdown styling
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
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import {
|
||||
Modal, Steps, Button, Table, Radio, Select, Input, DatePicker,
|
||||
Space, Row, Col, Typography, message, Spin, Result, Alert, Tag
|
||||
Space, Row, Col, Typography, message, Spin, Alert, Tag
|
||||
} from 'antd';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import { emailImportApi, type AttachmentImportData } from '../api/email-import';
|
||||
@@ -637,49 +637,25 @@ export default function MailImportWizard({ visible, onClose, email, attachments
|
||||
};
|
||||
|
||||
// --- Step 3: Abschluss Render ---
|
||||
const renderStep3 = () => {
|
||||
if (importSuccess) {
|
||||
return (
|
||||
<Result
|
||||
status="success"
|
||||
title="Import Erfolgreich!"
|
||||
subTitle="Die Dokumente wurden erfolgreich nach Paperless importiert und die Belegnummern verbucht."
|
||||
extra={[
|
||||
<Button type="primary" key="close" onClick={onClose}>
|
||||
Schließen
|
||||
</Button>,
|
||||
...importData.filter(i => i.type !== 'IGNORE').map(item => (
|
||||
<Button key={`print-${item.virtualId}`} icon={<PrinterOutlined />} onClick={() => printDocument(item.virtualId, item.attachmentId)}>
|
||||
Drucken: {item.fileName}
|
||||
</Button>
|
||||
))
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
// Summary view before import
|
||||
const renderDocumentList = (showPrint: boolean) => {
|
||||
const mainDocs = importData.filter(i => i.type === 'MAIN');
|
||||
const attachmentsToImport = importData.filter(i => i.type === 'ATTACHMENT');
|
||||
|
||||
return (
|
||||
<div>
|
||||
<>
|
||||
{mainDocs.length === 0 && (
|
||||
<Alert type="warning" message="Keine Hauptdokumente zum Importieren ausgewählt." style={{ marginBottom: 16 }} />
|
||||
)}
|
||||
|
||||
{mainDocs.map(main => {
|
||||
const mainAttachments = attachmentsToImport.filter(a => a.parentVirtualId === main.virtualId);
|
||||
const num = belegnummern[main.virtualId] || '000000';
|
||||
const yr = barcodes[main.virtualId]?.jahr || dayjs(email.Date).format('YYYY');
|
||||
const datum = eingangsdaten[main.virtualId];
|
||||
const belegnr = `${yr}-${String(num).padStart(6, '0')}`;
|
||||
|
||||
return (
|
||||
<div key={main.virtualId} style={{ marginBottom: 24, padding: 16, border: '1px solid #f0f0f0', borderRadius: 8 }}>
|
||||
<Text strong style={{ fontSize: 16, marginBottom: 12, display: 'block' }}>{main.fileName}</Text>
|
||||
<Row gutter={24} align="middle">
|
||||
<Col span={20}>
|
||||
<Col span={showPrint ? 20 : 24}>
|
||||
<Space size={24}>
|
||||
<Text type="secondary">
|
||||
Eingangsdatum: <Text strong>{datum?.format('DD.MM.YYYY') ?? '—'}</Text>
|
||||
@@ -701,16 +677,17 @@ export default function MailImportWizard({ visible, onClose, email, attachments
|
||||
</div>
|
||||
)}
|
||||
</Col>
|
||||
<Col span={4} style={{ textAlign: 'right' }}>
|
||||
<Button icon={<PrinterOutlined />} onClick={() => printDocument(main.virtualId, main.attachmentId)}>
|
||||
Drucken
|
||||
</Button>
|
||||
</Col>
|
||||
{showPrint && (
|
||||
<Col span={4} style={{ textAlign: 'right' }}>
|
||||
<Button icon={<PrinterOutlined />} onClick={() => printDocument(main.virtualId, main.attachmentId)}>
|
||||
Drucken
|
||||
</Button>
|
||||
</Col>
|
||||
)}
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
{attachmentsToImport.filter(a => !mainDocs.find(m => m.virtualId === a.parentVirtualId)).map(orphan => (
|
||||
<div key={orphan.virtualId} style={{ marginBottom: 12 }}>
|
||||
<Alert
|
||||
@@ -720,10 +697,27 @@ export default function MailImportWizard({ visible, onClose, email, attachments
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderStep3 = () => {
|
||||
if (importSuccess) {
|
||||
return (
|
||||
<div>
|
||||
<Alert
|
||||
type="success"
|
||||
message="Import erfolgreich!"
|
||||
description="Die Dokumente wurden nach Paperless importiert und die Belegnummern verbucht."
|
||||
style={{ marginBottom: 24 }}
|
||||
/>
|
||||
{renderDocumentList(true)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return renderDocumentList(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title="Paperless Import-Wizard"
|
||||
@@ -731,7 +725,9 @@ export default function MailImportWizard({ visible, onClose, email, attachments
|
||||
onCancel={onClose}
|
||||
width={1000}
|
||||
footer={
|
||||
importSuccess ? null : (
|
||||
importSuccess ? (
|
||||
<Button type="primary" onClick={onClose}>Schließen</Button>
|
||||
) : (
|
||||
<Space>
|
||||
{currentStep > 0 && <Button onClick={handleBack}>Zurück</Button>}
|
||||
{currentStep < 2 && <Button type="primary" onClick={nextStep} loading={loading}>Weiter</Button>}
|
||||
|
||||
@@ -1119,7 +1119,7 @@ export default function InboxDetailPage() {
|
||||
<SourceTag source={file.source} />
|
||||
</Space>
|
||||
<Dropdown.Button
|
||||
style={{ marginLeft: 'auto' }}
|
||||
style={{ marginLeft: 'auto', width: 'auto' }}
|
||||
type="primary"
|
||||
icon={<DownOutlined />}
|
||||
onClick={() => { if (canProcess) setWizardOpen(true); }}
|
||||
|
||||
Reference in New Issue
Block a user