import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Divider, } from "@mui/material"; import React from "react"; import { InboxEntry } from "../api/InboxApi"; import { Movement } from "../api/MovementsApi"; import { MovementSelect } from "../widgets/forms/MovementSelect"; import { InboxEntryWidget } from "../widgets/InboxEntryWidget"; export function AttachMultipleInboxEntriesDialog(p: { open: boolean; entries: InboxEntry[]; movements: Movement[][]; onClose: () => void; onSelected: (mapping: (Movement | undefined)[]) => void; }): React.ReactElement { const [mapping, setMapping] = React.useState<(Movement | undefined)[]>( p.movements.map(() => undefined) ); const handleSubmit = () => { p.onSelected(mapping); }; return ( Attach multiple entries to movements {p.entries.map((entry, num) => { return (
{p.movements[num].length > 0 ? ( { setMapping((m) => { const n = [...m]; n[num] = v; return n; }); }} /> ) : ( <>No movement found )}
); })}
); }