feat: add dateinameTemplate support to barcode scanner and display document names in inbox detail view
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
This commit is contained in:
@@ -17,6 +17,7 @@ export interface MatchedBarcode {
|
||||
value: string;
|
||||
templateId: number | null;
|
||||
templateName: string | null;
|
||||
dateinameTemplate: string | null;
|
||||
splitBefore: boolean;
|
||||
actions: BarcodeActionType[];
|
||||
}
|
||||
@@ -113,6 +114,7 @@ export class BarcodeScannerService implements OnApplicationBootstrap {
|
||||
value: qr.value,
|
||||
templateId: tpl?.Id ?? null,
|
||||
templateName: tpl?.Name ?? null,
|
||||
dateinameTemplate: tpl?.DateinameTemplate ?? null,
|
||||
splitBefore: tpl?.SplitBefore ?? false,
|
||||
actions: tpl?.Actions ?? [],
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface InboxBarcode {
|
||||
value: string;
|
||||
templateId: number | null;
|
||||
templateName: string | null;
|
||||
dateinameTemplate: string | null;
|
||||
splitBefore: boolean;
|
||||
actions: BarcodeActionType[];
|
||||
}
|
||||
|
||||
@@ -28,12 +28,14 @@ const { Title } = Typography;
|
||||
interface DocumentSegment {
|
||||
index: number;
|
||||
pages: number[];
|
||||
belegname: string | null;
|
||||
}
|
||||
|
||||
function buildDocuments(
|
||||
pageCount: number,
|
||||
splitPages: number[],
|
||||
deletedPages: number[],
|
||||
barcodes: import('../api/inbox').InboxBarcode[],
|
||||
): DocumentSegment[] {
|
||||
if (pageCount === 0) return [];
|
||||
const deleted = new Set(deletedPages);
|
||||
@@ -44,15 +46,25 @@ function buildDocuments(
|
||||
for (let n = 1; n <= pageCount; n++) {
|
||||
if (deleted.has(n)) continue;
|
||||
if (splits.has(n) && current.length > 0) {
|
||||
docs.push({ index: docs.length, pages: current });
|
||||
docs.push({ index: docs.length, pages: current, belegname: null });
|
||||
current = [];
|
||||
}
|
||||
current.push(n);
|
||||
}
|
||||
if (current.length > 0) {
|
||||
docs.push({ index: docs.length, pages: current });
|
||||
docs.push({ index: docs.length, pages: current, belegname: null });
|
||||
}
|
||||
return docs;
|
||||
|
||||
// Belegname (DateinameTemplate) pro Segment bestimmen
|
||||
return docs.map((seg) => {
|
||||
let barcode: import('../api/inbox').InboxBarcode | undefined;
|
||||
if (seg.index === 0) {
|
||||
barcode = barcodes[0];
|
||||
} else {
|
||||
barcode = barcodes.find((b) => b.splitBefore && b.page === seg.pages[0]);
|
||||
}
|
||||
return { ...seg, belegname: barcode?.dateinameTemplate ?? null };
|
||||
});
|
||||
}
|
||||
|
||||
function thumbImageStyle(rotation: number, shortSidePx: number): React.CSSProperties {
|
||||
@@ -559,7 +571,7 @@ export default function InboxDetailPage() {
|
||||
const splitPages = file.barcodes
|
||||
.filter((b) => b.splitBefore)
|
||||
.map((b) => b.page);
|
||||
return buildDocuments(file.pageCount, splitPages, file.deletedPages);
|
||||
return buildDocuments(file.pageCount, splitPages, file.deletedPages, file.barcodes);
|
||||
}, [file]);
|
||||
|
||||
const effectivePages = useMemo<number[]>(() => {
|
||||
@@ -925,13 +937,32 @@ export default function InboxDetailPage() {
|
||||
return (
|
||||
<div
|
||||
key={doc.index}
|
||||
style={{ flex: '0 0 auto', display: 'flex', flexDirection: 'column', alignItems: 'center' }}
|
||||
>
|
||||
{doc.belegname && (
|
||||
<div
|
||||
title={doc.belegname}
|
||||
style={{
|
||||
fontSize: 10,
|
||||
color: '#555',
|
||||
maxWidth: 92,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
marginBottom: 3,
|
||||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
{doc.belegname}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
onClick={() => setSelectedPage(cover)}
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
padding: 2,
|
||||
border: active ? '2px solid #1677ff' : '2px solid transparent',
|
||||
borderRadius: 6,
|
||||
flex: '0 0 auto',
|
||||
position: 'relative',
|
||||
width: 92,
|
||||
height: 120,
|
||||
@@ -976,6 +1007,7 @@ export default function InboxDetailPage() {
|
||||
{doc.pages.length}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
|
||||
@@ -1955,8 +1955,8 @@ function BarcodeTemplatesTab() {
|
||||
|
||||
<Form.Item
|
||||
name="DateinameTemplate"
|
||||
label="Dateiname"
|
||||
extra="Platzhalter z. B. {barcode}, {datum}, {barcode.gruppe}. Wird als Standard-Dateiname bei Export und E-Mail verwendet."
|
||||
label="Belegname"
|
||||
extra="Platzhalter z. B. {barcode}, {datum}, {barcode.gruppe}. Wird als Standard-Belegname bei Export und E-Mail verwendet."
|
||||
>
|
||||
<Input placeholder="{barcode}_{datum}" />
|
||||
</Form.Item>
|
||||
|
||||
Reference in New Issue
Block a user