feat: add manual Paperless ID synchronization for email attachments and update default barcode margins to 7mm.
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
This commit is contained in:
@@ -43,8 +43,8 @@ export const emailsApi = {
|
||||
triggerFetch: () =>
|
||||
api.post<{ message: string }>('/api/emails/fetch').then((r) => r.data),
|
||||
|
||||
checkAttachments: () =>
|
||||
api.post<{ updatedCount: number }>('/api/emails/check-attachments').then((r) => r.data),
|
||||
checkAttachments: (includeProcessed = false) =>
|
||||
api.post<{ updatedCount: number; idsUpdated: number }>('/api/emails/check-attachments', { includeProcessed }).then((r) => r.data),
|
||||
|
||||
updateStatus: (id: number, status: number) =>
|
||||
api.patch<{ message?: string }>(`/api/emails/${id}/status`, { status }).then((r) => r.data),
|
||||
|
||||
@@ -116,8 +116,8 @@ export default function BarcodePositioner({
|
||||
py += containerRef.current.scrollTop;
|
||||
}
|
||||
|
||||
// Constraints: 6mm margin from edge
|
||||
const margin = 6 * scale;
|
||||
// Constraints: 7mm margin from edge
|
||||
const margin = 7 * scale;
|
||||
px = Math.max(margin, Math.min(px, cr.width - barcodeW - margin));
|
||||
const pageHeightPx = PAGE_HEIGHT_MM * scale;
|
||||
py = Math.max(margin, Math.min(py, pageHeightPx - barcodeH - margin));
|
||||
|
||||
@@ -65,8 +65,8 @@ export default function MailImportWizard({ visible, onClose, email, attachments
|
||||
initialData.forEach(d => {
|
||||
initialDates[d.virtualId] = mailDate;
|
||||
initialBarcodes[d.virtualId] = {
|
||||
x: 6,
|
||||
y: 6,
|
||||
x: 7,
|
||||
y: 7,
|
||||
datum: mailDate.format('YYYY-MM-DD'),
|
||||
jahr: mailDate.format('YYYY'),
|
||||
isNeu: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Table, Card, Typography, Button, Space, Tag, message, Input, Select } from 'antd';
|
||||
import { ReloadOutlined, DownloadOutlined, CheckCircleOutlined, SearchOutlined } from '@ant-design/icons';
|
||||
import { Table, Card, Typography, Button, Space, Tag, message, Input, Select, Dropdown } from 'antd';
|
||||
import { ReloadOutlined, DownloadOutlined, CheckCircleOutlined, SearchOutlined, DownOutlined } from '@ant-design/icons';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import dayjs from 'dayjs';
|
||||
import { emailsApi, type EmailItem } from '../api/emails';
|
||||
@@ -141,26 +141,51 @@ export default function MailpostfachPage() {
|
||||
Aktualisieren
|
||||
</Button>
|
||||
{hasPermission(Permission.MANAGE_ALL) && (
|
||||
<Button
|
||||
icon={<CheckCircleOutlined />}
|
||||
<Dropdown.Button
|
||||
icon={<DownOutlined />}
|
||||
loading={checking}
|
||||
onClick={async () => {
|
||||
setChecking(true);
|
||||
try {
|
||||
const result = await emailsApi.checkAttachments();
|
||||
message.success(`${result.updatedCount} E-Mail(s) wurden als verarbeitet markiert.`);
|
||||
if (result.updatedCount > 0) {
|
||||
await loadData();
|
||||
}
|
||||
const result = await emailsApi.checkAttachments(false);
|
||||
const parts = [];
|
||||
if (result.updatedCount > 0) parts.push(`${result.updatedCount} E-Mail(s) als verarbeitet markiert`);
|
||||
if (result.idsUpdated > 0) parts.push(`${result.idsUpdated} Paperless-ID(s) ergänzt`);
|
||||
message.success(parts.length > 0 ? parts.join(', ') + '.' : 'Keine Änderungen.');
|
||||
if (result.updatedCount > 0 || result.idsUpdated > 0) await loadData();
|
||||
} catch {
|
||||
message.error('Prüfung fehlgeschlagen.');
|
||||
} finally {
|
||||
setChecking(false);
|
||||
}
|
||||
}}
|
||||
loading={checking}
|
||||
menu={{
|
||||
items: [
|
||||
{
|
||||
key: 'includeProcessed',
|
||||
icon: <CheckCircleOutlined />,
|
||||
label: 'Bereits verarbeitete Anhänge prüfen',
|
||||
async onClick() {
|
||||
setChecking(true);
|
||||
try {
|
||||
const result = await emailsApi.checkAttachments(true);
|
||||
const parts = [];
|
||||
if (result.updatedCount > 0) parts.push(`${result.updatedCount} E-Mail(s) aktualisiert`);
|
||||
if (result.idsUpdated > 0) parts.push(`${result.idsUpdated} Paperless-ID(s) ergänzt`);
|
||||
message.success(parts.length > 0 ? parts.join(', ') + '.' : 'Keine Änderungen.');
|
||||
if (result.updatedCount > 0 || result.idsUpdated > 0) await loadData();
|
||||
} catch {
|
||||
message.error('Prüfung fehlgeschlagen.');
|
||||
} finally {
|
||||
setChecking(false);
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
}}
|
||||
>
|
||||
Anhänge prüfen
|
||||
</Button>
|
||||
<CheckCircleOutlined /> Anhänge prüfen
|
||||
</Dropdown.Button>
|
||||
)}
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user