mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
🚧 associate senders
This commit is contained in:
@ -6,14 +6,13 @@ import { Button } from "@documenso/ui";
|
|||||||
import short from "short-uuid";
|
import short from "short-uuid";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { FieldType } from "@prisma/client";
|
import { FieldType } from "@prisma/client";
|
||||||
const stc = require("string-to-color");
|
|
||||||
|
|
||||||
const PDFViewer = dynamic(() => import("./pdf-viewer"), {
|
const PDFViewer = dynamic(() => import("./pdf-viewer"), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function PDFEditor(props: any) {
|
export default function PDFEditor(props: any) {
|
||||||
const [selectedValue, setSelectedValue] = useState("");
|
const [selectedRecipient, setSelectedRecipient] = useState("");
|
||||||
const [fields, setFields] = useState<any[]>(props.document.Field);
|
const [fields, setFields] = useState<any[]>(props.document.Field);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@ -44,21 +43,19 @@ export default function PDFEditor(props: any) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<label
|
||||||
|
htmlFor="location"
|
||||||
|
className="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
Location
|
||||||
|
</label>
|
||||||
<select
|
<select
|
||||||
className="mb-3 inline mt-1 w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
|
className="mt-1 block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
|
||||||
style={{ background: stc(selectedValue) }}
|
value={selectedRecipient}
|
||||||
value={selectedValue}
|
onChange={(e) => setSelectedRecipient(e.target.value)}
|
||||||
onChange={(e) => setSelectedValue(e.target.value)}
|
|
||||||
>
|
>
|
||||||
{props?.document?.Recipient?.map((item: any) => (
|
{props?.document?.Recipient?.map((item: any) => (
|
||||||
<option
|
<option key={item.email + short.generate().toString()}>
|
||||||
key={item.email + short.generate().toString()}
|
|
||||||
style={{
|
|
||||||
background: stc(
|
|
||||||
item.name ? `${item.name} <${item.email}>` : item.email
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item.name ? `${item.name} <${item.email}>` : item.email}
|
{item.name ? `${item.name} <${item.email}>` : item.email}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
@ -72,7 +69,7 @@ export default function PDFEditor(props: any) {
|
|||||||
type: FieldType.SIGNATURE,
|
type: FieldType.SIGNATURE,
|
||||||
positionX: 0,
|
positionX: 0,
|
||||||
positionY: 0,
|
positionY: 0,
|
||||||
recipient: selectedValue,
|
recipient: selectedRecipient,
|
||||||
};
|
};
|
||||||
|
|
||||||
upsertField(props?.document, signatureField).then((res) => {
|
upsertField(props?.document, signatureField).then((res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user