mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
🎨 🧹📝 remove todos, document typing
This commit is contained in:
@ -39,8 +39,7 @@ export default function PDFSigner(props: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClose(dialogResult: any) {
|
function onDialogClose(dialogResult: any) {
|
||||||
// todo handle signature removed from field
|
// todo handle signature removed from field, remove free field if dialogresult is empty (or the id )
|
||||||
// todo remove free field if dialogresult is empty (or the id )
|
|
||||||
if (!dialogResult && dialogField.type === "FREE_SIGNATURE") {
|
if (!dialogResult && dialogField.type === "FREE_SIGNATURE") {
|
||||||
onDeleteHandler(dialogField.id);
|
onDeleteHandler(dialogField.id);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import {
|
|||||||
} from "@documenso/lib/server";
|
} from "@documenso/lib/server";
|
||||||
import prisma from "@documenso/prisma";
|
import prisma from "@documenso/prisma";
|
||||||
import { NextApiRequest, NextApiResponse } from "next";
|
import { NextApiRequest, NextApiResponse } from "next";
|
||||||
import short from "short-uuid";
|
|
||||||
import { Document as PrismaDocument, FieldType } from "@prisma/client";
|
import { Document as PrismaDocument, FieldType } from "@prisma/client";
|
||||||
import { getDocument } from "@documenso/lib/query";
|
import { getDocument } from "@documenso/lib/query";
|
||||||
|
|
||||||
@ -79,7 +78,6 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
positionX: +body.positionX,
|
positionX: +body.positionX,
|
||||||
positionY: +body.positionY,
|
positionY: +body.positionY,
|
||||||
customText: body.customText,
|
customText: body.customText,
|
||||||
// todo refactor only one type of recipientId
|
|
||||||
recipientId: body.Recipient.id,
|
recipientId: body.Recipient.id,
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
|
|||||||
@ -58,8 +58,6 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
return res.status(200).send(recipients.length);
|
return res.status(200).send(recipients.length);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo check if recipient has an account and show them in their inbox or something
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defaultHandler({
|
export default defaultHandler({
|
||||||
|
|||||||
@ -37,7 +37,6 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
|
|
||||||
if (!document) res.status(404).end(`No document found.`);
|
if (!document) res.status(404).end(`No document found.`);
|
||||||
|
|
||||||
// todo rename .document to documentImageAsBase64 or sth. like that
|
|
||||||
let documentWithInserts = document.document;
|
let documentWithInserts = document.document;
|
||||||
for (const signature of signaturesFromBody) {
|
for (const signature of signaturesFromBody) {
|
||||||
if (!signature.signatureImage && !signature.typedSignature) {
|
if (!signature.signatureImage && !signature.typedSignature) {
|
||||||
|
|||||||
@ -120,9 +120,6 @@ export async function getServerSideProps(context: any) {
|
|||||||
context.res
|
context.res
|
||||||
);
|
);
|
||||||
|
|
||||||
// todo optimize querys
|
|
||||||
// todo no intersection groups
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
document: JSON.parse(JSON.stringify({ ...document, document: "" })),
|
document: JSON.parse(JSON.stringify({ ...document, document: "" })),
|
||||||
|
|||||||
@ -67,8 +67,6 @@ const SignPage: NextPageWithLayout = (props: any) => {
|
|||||||
export async function getServerSideProps(context: any) {
|
export async function getServerSideProps(context: any) {
|
||||||
const recipientToken: string = context.query["token"];
|
const recipientToken: string = context.query["token"];
|
||||||
|
|
||||||
// todo redirect to sigend of all already signed
|
|
||||||
|
|
||||||
await prisma.recipient.updateMany({
|
await prisma.recipient.updateMany({
|
||||||
where: {
|
where: {
|
||||||
token: recipientToken,
|
token: recipientToken,
|
||||||
@ -87,7 +85,7 @@ export async function getServerSideProps(context: any) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Document was already signed
|
// Document is already signed
|
||||||
if (recipient.Document.status === DocumentStatus.COMPLETED) {
|
if (recipient.Document.status === DocumentStatus.COMPLETED) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
@ -97,8 +95,7 @@ export async function getServerSideProps(context: any) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up unsigned free place fields from UI from previous page visits
|
// Clean up potential unsigned free place fields from UI from previous page visits
|
||||||
// todo refactor free sign fields to be client side only
|
|
||||||
await prisma.field.deleteMany({
|
await prisma.field.deleteMany({
|
||||||
where: {
|
where: {
|
||||||
type: { in: [FieldType.FREE_SIGNATURE] },
|
type: { in: [FieldType.FREE_SIGNATURE] },
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import { sendMail } from "./sendMail";
|
import { sendMail } from "./sendMail";
|
||||||
import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
|
import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
|
||||||
import { signingCompleteTemplate } from "@documenso/lib/mail";
|
import { signingCompleteTemplate } from "@documenso/lib/mail";
|
||||||
|
import { Document as PrismaDocument } from "@prisma/client";
|
||||||
|
|
||||||
export const sendSigningDoneMail = async (
|
export const sendSigningDoneMail = async (
|
||||||
recipient: any,
|
recipient: any,
|
||||||
document: any,
|
document: PrismaDocument,
|
||||||
user: any
|
user: any
|
||||||
) => {
|
) => {
|
||||||
await sendMail(
|
await sendMail(
|
||||||
|
|||||||
@ -26,8 +26,8 @@ export async function insertTextInPDF(
|
|||||||
const textHeight = customFont.heightAtSize(textSize);
|
const textHeight = customFont.heightAtSize(textSize);
|
||||||
|
|
||||||
pdfPage.drawText(text, {
|
pdfPage.drawText(text, {
|
||||||
x: positionX, // todo adjust for exact field size
|
x: positionX,
|
||||||
y: pdfPage.getHeight() - positionY - textHeight / 2, // todo adjust for exact field size
|
y: pdfPage.getHeight() - positionY - textHeight / 2,
|
||||||
size: textSize,
|
size: textSize,
|
||||||
font: useHandwritingFont ? customFont : helveticaFont,
|
font: useHandwritingFont ? customFont : helveticaFont,
|
||||||
color: rgb(0, 0, 0),
|
color: rgb(0, 0, 0),
|
||||||
|
|||||||
Reference in New Issue
Block a user