diff --git a/apps/web/components/editor/field.tsx b/apps/web/components/editor/field.tsx index 259a8ac0b..69dfa6ff3 100644 --- a/apps/web/components/editor/field.tsx +++ b/apps/web/components/editor/field.tsx @@ -16,7 +16,7 @@ type FieldPropsType = { positionX: number; positionY: number; id: string; - recipient: string; + Recipient: { name: ""; email: "" }; }; onPositionChanged: any; onDelete: any; @@ -53,13 +53,22 @@ export default function Field(props: FieldPropsType) { >
+
{/* todo icons */} {field.type} -
{props.field.recipient}
+ {field.type === "SIGNATURE" ? ( +
+ {`${props.field.Recipient?.name} <${props.field.Recipient?.email}>`} +
+ ) : ( + "" + )}
import("./pdf-viewer"), { ssr: false, }); export default function PDFEditor(props: any) { - const [selectedRecipient, setSelectedRecipient] = useState(""); + const [selectedRecipient, setSelectedRecipient]: any = useState( + props?.document?.Recipient[0] + ); + const noRecipients = props?.document?.Recipient?.length === 0; const [fields, setFields] = useState(props.document.Field); const router = useRouter(); @@ -43,48 +50,134 @@ export default function PDFEditor(props: any) { return ( <> - - - - - + + + {props?.document?.Recipient?.map((recipient: any) => ( + + classNames( + active ? "text-white bg-indigo-600" : "text-gray-900", + "relative cursor-default select-none py-2 pl-3 pr-9" + ) + } + value={recipient} + > + {({ selected, active }) => ( + <> +
+ + + {`${selectedRecipient?.name} <${selectedRecipient?.email}>`} + +
+ + {selected ? ( + + + ) : null} + + )} +
+ ))} +
+
+
+ )} + + + + + {
+