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;
|
value: string;
|
||||||
templateId: number | null;
|
templateId: number | null;
|
||||||
templateName: string | null;
|
templateName: string | null;
|
||||||
|
dateinameTemplate: string | null;
|
||||||
splitBefore: boolean;
|
splitBefore: boolean;
|
||||||
actions: BarcodeActionType[];
|
actions: BarcodeActionType[];
|
||||||
}
|
}
|
||||||
@@ -113,6 +114,7 @@ export class BarcodeScannerService implements OnApplicationBootstrap {
|
|||||||
value: qr.value,
|
value: qr.value,
|
||||||
templateId: tpl?.Id ?? null,
|
templateId: tpl?.Id ?? null,
|
||||||
templateName: tpl?.Name ?? null,
|
templateName: tpl?.Name ?? null,
|
||||||
|
dateinameTemplate: tpl?.DateinameTemplate ?? null,
|
||||||
splitBefore: tpl?.SplitBefore ?? false,
|
splitBefore: tpl?.SplitBefore ?? false,
|
||||||
actions: tpl?.Actions ?? [],
|
actions: tpl?.Actions ?? [],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export interface InboxBarcode {
|
|||||||
value: string;
|
value: string;
|
||||||
templateId: number | null;
|
templateId: number | null;
|
||||||
templateName: string | null;
|
templateName: string | null;
|
||||||
|
dateinameTemplate: string | null;
|
||||||
splitBefore: boolean;
|
splitBefore: boolean;
|
||||||
actions: BarcodeActionType[];
|
actions: BarcodeActionType[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,12 +28,14 @@ const { Title } = Typography;
|
|||||||
interface DocumentSegment {
|
interface DocumentSegment {
|
||||||
index: number;
|
index: number;
|
||||||
pages: number[];
|
pages: number[];
|
||||||
|
belegname: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildDocuments(
|
function buildDocuments(
|
||||||
pageCount: number,
|
pageCount: number,
|
||||||
splitPages: number[],
|
splitPages: number[],
|
||||||
deletedPages: number[],
|
deletedPages: number[],
|
||||||
|
barcodes: import('../api/inbox').InboxBarcode[],
|
||||||
): DocumentSegment[] {
|
): DocumentSegment[] {
|
||||||
if (pageCount === 0) return [];
|
if (pageCount === 0) return [];
|
||||||
const deleted = new Set(deletedPages);
|
const deleted = new Set(deletedPages);
|
||||||
@@ -44,15 +46,25 @@ function buildDocuments(
|
|||||||
for (let n = 1; n <= pageCount; n++) {
|
for (let n = 1; n <= pageCount; n++) {
|
||||||
if (deleted.has(n)) continue;
|
if (deleted.has(n)) continue;
|
||||||
if (splits.has(n) && current.length > 0) {
|
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 = [];
|
||||||
}
|
}
|
||||||
current.push(n);
|
current.push(n);
|
||||||
}
|
}
|
||||||
if (current.length > 0) {
|
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 {
|
function thumbImageStyle(rotation: number, shortSidePx: number): React.CSSProperties {
|
||||||
@@ -559,7 +571,7 @@ export default function InboxDetailPage() {
|
|||||||
const splitPages = file.barcodes
|
const splitPages = file.barcodes
|
||||||
.filter((b) => b.splitBefore)
|
.filter((b) => b.splitBefore)
|
||||||
.map((b) => b.page);
|
.map((b) => b.page);
|
||||||
return buildDocuments(file.pageCount, splitPages, file.deletedPages);
|
return buildDocuments(file.pageCount, splitPages, file.deletedPages, file.barcodes);
|
||||||
}, [file]);
|
}, [file]);
|
||||||
|
|
||||||
const effectivePages = useMemo<number[]>(() => {
|
const effectivePages = useMemo<number[]>(() => {
|
||||||
@@ -925,13 +937,32 @@ export default function InboxDetailPage() {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={doc.index}
|
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)}
|
onClick={() => setSelectedPage(cover)}
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
padding: 2,
|
padding: 2,
|
||||||
border: active ? '2px solid #1677ff' : '2px solid transparent',
|
border: active ? '2px solid #1677ff' : '2px solid transparent',
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
flex: '0 0 auto',
|
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
width: 92,
|
width: 92,
|
||||||
height: 120,
|
height: 120,
|
||||||
@@ -976,6 +1007,7 @@ export default function InboxDetailPage() {
|
|||||||
{doc.pages.length}
|
{doc.pages.length}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1955,8 +1955,8 @@ function BarcodeTemplatesTab() {
|
|||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="DateinameTemplate"
|
name="DateinameTemplate"
|
||||||
label="Dateiname"
|
label="Belegname"
|
||||||
extra="Platzhalter z. B. {barcode}, {datum}, {barcode.gruppe}. Wird als Standard-Dateiname bei Export und E-Mail verwendet."
|
extra="Platzhalter z. B. {barcode}, {datum}, {barcode.gruppe}. Wird als Standard-Belegname bei Export und E-Mail verwendet."
|
||||||
>
|
>
|
||||||
<Input placeholder="{barcode}_{datum}" />
|
<Input placeholder="{barcode}_{datum}" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
Reference in New Issue
Block a user