upload stuff

This commit is contained in:
seb
2026-09-20 07:18:43 +02:00
parent 4011ebfc61
commit 5594c59d88
9 changed files with 249 additions and 344 deletions

View File

@@ -92,9 +92,18 @@ function EventLog({ messages, streaming }) {
);
}
export default function ManifestPdfDialog({ open, filename, data, onClose, onAbort }) {
export default function ManifestPdfDialog({
open,
filename,
data,
unmatchedSupplierName,
onCreateSupplier,
onClose,
onAbort,
}) {
if (!open) return null;
const { streaming = false, messages = [], result = null, error = null, aborted = false } = data ?? {};
const hasResult = Boolean(result);
@@ -177,6 +186,28 @@ export default function ManifestPdfDialog({ open, filename, data, onClose, onAbo
Daten erfolgreich in das Formular übernommen.
</Alert>
)}
{/* Unmatched supplier alert */}
{hasResult && !streaming && !error && !aborted && unmatchedSupplierName && (
<Alert
severity="warning"
sx={{ mt: 1.5, alignItems: 'center' }}
action={
onCreateSupplier ? (
<Button
color="inherit"
size="small"
variant="outlined"
onClick={() => onCreateSupplier(unmatchedSupplierName)}
>
Lieferant anlegen
</Button>
) : null
}
>
Lieferant „{unmatchedSupplierName}“ wurde im Dokument erkannt, existiert aber noch nicht in den Stammdaten.
</Alert>
)}
</DialogContent>
<DialogActions sx={{ p: 1.5, px: 2 }}>
@@ -191,11 +222,28 @@ export default function ManifestPdfDialog({ open, filename, data, onClose, onAbo
Abbrechen
</Button>
) : (
<Button onClick={onClose} variant="contained" size="small">
Schließen
</Button>
<>
{unmatchedSupplierName && onCreateSupplier ? (
<Button
onClick={() => onCreateSupplier(unmatchedSupplierName)}
variant="contained"
color="primary"
size="small"
>
Lieferant „{unmatchedSupplierName}“ anlegen
</Button>
) : null}
<Button
onClick={onClose}
variant={unmatchedSupplierName && onCreateSupplier ? 'outlined' : 'contained'}
size="small"
>
Schließen
</Button>
</>
)}
</DialogActions>
</Dialog>
);
}

View File

@@ -1,9 +1,11 @@
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
export default function withNavigate(Wrapped) {
function NavigateWrapper(props) {
const navigate = useNavigate();
return <Wrapped {...props} navigate={navigate} />;
const location = useLocation();
return <Wrapped {...props} navigate={navigate} location={location} />;
}
return NavigateWrapper;
}