mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
@ -135,7 +135,7 @@ export default function PDFSigner(props: any) {
|
||||
<PDFViewer
|
||||
style={{
|
||||
cursor:
|
||||
signatureFields === 0
|
||||
signatureFields.length === 0
|
||||
? `url("https://place-hold.it/110x64/37f095/ffffff&text=Signature") 55 32, auto`
|
||||
: "",
|
||||
}}
|
||||
@ -145,7 +145,8 @@ export default function PDFSigner(props: any) {
|
||||
pdfUrl={`${NEXT_PUBLIC_WEBAPP_URL}/api/documents/${router.query.id}?token=${router.query.token}`}
|
||||
onClick={onClick}
|
||||
onMouseDown={function onMouseDown(e: any, page: number) {
|
||||
if (signatureFields === 0) addFreeSignature(e, page, props.recipient);
|
||||
if (signatureFields.length === 0)
|
||||
addFreeSignature(e, page, props.recipient);
|
||||
}}
|
||||
onMouseUp={() => {}}
|
||||
onDelete={onDeleteHandler}
|
||||
|
||||
@ -83,7 +83,7 @@ export default function PDFViewer(props) {
|
||||
></SignableField>
|
||||
) : (
|
||||
<EditableField
|
||||
hidden={item.Signature}
|
||||
hidden={item.Signature || item.inserted}
|
||||
key={item.id}
|
||||
field={item}
|
||||
className="absolute"
|
||||
|
||||
@ -75,6 +75,7 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||
documentId: +documentId,
|
||||
type: body.type,
|
||||
page: +body.page,
|
||||
inserted: false,
|
||||
positionX: +body.positionX,
|
||||
positionY: +body.positionY,
|
||||
customText: body.customText,
|
||||
|
||||
@ -82,13 +82,26 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||
documentWithInserts = await insertTextInPDF(
|
||||
documentWithInserts,
|
||||
field.type === FieldType.DATE
|
||||
? new Date().toDateString()
|
||||
? new Intl.DateTimeFormat("en-US", {
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
year: "numeric",
|
||||
}).format(new Date())
|
||||
: field.customText || "",
|
||||
field.positionX,
|
||||
field.positionY,
|
||||
field.page,
|
||||
false
|
||||
);
|
||||
|
||||
await prisma.field.update({
|
||||
where: {
|
||||
id: field.id,
|
||||
},
|
||||
data: {
|
||||
inserted: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
await prisma.document.update({
|
||||
|
||||
Reference in New Issue
Block a user