diff --git a/apps/web/components/signup.tsx b/apps/web/components/signup.tsx
index 5f05a245a..96e356777 100644
--- a/apps/web/components/signup.tsx
+++ b/apps/web/components/signup.tsx
@@ -14,12 +14,12 @@ type FormValues = {
};
export default function Signup(props: { source: string }) {
- const methods = useForm({});
+ const form = useForm({});
const {
register,
trigger,
formState: { errors, isSubmitting },
- } = methods;
+ } = form;
const handleErrors = async (resp: Response) => {
if (!resp.ok) {
@@ -52,7 +52,7 @@ export default function Signup(props: { source: string }) {
)
.catch((err) => {
toast.dismiss();
- methods.setError("apiError", { message: err.message });
+ form.setError("apiError", { message: err.message });
});
};
@@ -123,11 +123,11 @@ export default function Signup(props: { source: string }) {
{renderApiError()}
{renderFormValidation()}
-
+
-
- {signers.map((item: any, index: number) => (
- -
-
-
-
-
- {
- const updatedSigners = [...signers];
- updatedSigners[index].name = e.target.value;
- setSigners(updatedSigners);
- }}
- onBlur={() => {
- item.documentId = props.document.id;
- createOrUpdateRecipient(item);
- }}
- onKeyDown={(event: any) => {
- if (event.key === "Enter")
- createOrUpdateRecipient(item);
- }}
- className="block w-full border-0 p-0 text-gray-900 placeholder-gray-500 sm:text-sm outline-none bg-inherit"
- placeholder="John Dorian"
- />
-
-
-
- {item.sendStatus === "NOT_SENT" ? (
-
+
+
+
+ {
+ if (!errors?.signers?.[index])
+ createOrUpdateRecipient({
+ ...formValues[index],
+ documentId: props.document.id,
+ });
+ }}
+ onKeyDown={(event: any) => {
+ if (
+ event.key === "Enter" &&
+ !errors?.signers?.[index]
+ )
+ createOrUpdateRecipient({
+ ...formValues[index],
+ documentId: props.document.id,
+ });
+ }}
+ className="block w-full border-0 p-0 text-gray-900 placeholder-gray-500 sm:text-sm outline-none bg-inherit"
+ placeholder="John Dorian"
+ />
+
+
+
+ {item.sendStatus === "NOT_SENT" ? (
+
+ Not Sent
+
+ ) : (
+ ""
+ )}
+ {item.sendStatus === "SENT" &&
+ item.readStatus !== "OPENED" ? (
+
+
+ {" "}
+ Sent
+
+
+ ) : (
+ ""
+ )}
+ {item.readStatus === "OPENED" &&
+ item.signingStatus === "NOT_SIGNED" ? (
+
+
+
+
+ Seen
+
+
+ ) : (
+ ""
+ )}
+ {item.signingStatus === "SIGNED" ? (
+
+
+
+ Signed
+
+
+ ) : (
+ ""
+ )}
+
+
+
+ {
+ if (confirm("Resend this signing request?")) {
+ setLoading(true);
+ sendSigningRequests(props.document, [
+ item.id,
+ ]).finally(() => {
+ setLoading(false);
+ });
+ }
+ }}
+ >
+ Resend
+
+ {
+ const removedItem = { ...fields }[index];
+ remove(index);
+ deleteRecipient(item)?.catch((err) => {
+ append(removedItem);
+ });
+ }}
+ className="group-hover:text-neon-dark group-hover:disabled:text-gray-400"
+ />
+
-
-
- {
- if (confirm("Resend this signing request?")) {
- setLoading(true);
- sendSigningRequests(props.document, [
- item.id,
- ]).finally(() => {
- setLoading(false);
- });
- }
- }}
- >
- Resend
-
- {
- const signersWithoutIndex = [...signers];
- const removedItem = signersWithoutIndex.splice(
- index,
- 1
- );
- setSigners(signersWithoutIndex);
- deleteRecipient(item)?.catch((err) => {
- setSigners(signersWithoutIndex.concat(removedItem));
- });
- }}
- className="group-hover:text-neon-dark group-hover:disabled:text-gray-400"
- />
-
-
-
- ))}
-
-
+
+ ))}
+
+
+
+
@@ -357,7 +408,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
{`"${props.document.title}" will be sent to ${
- signers.filter(
+ formValues.filter(
(s: any) => s.email && s.sendStatus != "SENT"
).length
} recipients.`}
diff --git a/packages/lib/query/getDocument.ts b/packages/lib/query/getDocument.ts
index 9e61ae8ea..db658794c 100644
--- a/packages/lib/query/getDocument.ts
+++ b/packages/lib/query/getDocument.ts
@@ -18,7 +18,11 @@ export const getDocument = async (
userId: user.id,
},
include: {
- Recipient: true,
+ Recipient: {
+ orderBy: {
+ id: "asc",
+ },
+ },
Field: { include: { Recipient: true, Signature: true } },
},
});