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