mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
Merge branch 'main' into fix/can-add-signature-space-for-empty-recipients
This commit is contained in:
@ -18,13 +18,16 @@ import {
|
|||||||
UserPlusIcon,
|
UserPlusIcon,
|
||||||
XMarkIcon,
|
XMarkIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { DocumentStatus, Document as PrismaDocument } from "@prisma/client";
|
import { DocumentStatus, Document as PrismaDocument, Recipient } from "@prisma/client";
|
||||||
import { FormProvider, useFieldArray, useForm, useWatch } from "react-hook-form";
|
import { FormProvider, useFieldArray, useForm, useWatch } from "react-hook-form";
|
||||||
|
import { toast } from "react-hot-toast";
|
||||||
|
|
||||||
export type FormValues = {
|
export type FormValues = {
|
||||||
signers: { id: number; email: string; name: string }[];
|
signers: Array<Pick<Recipient, 'id' | 'email' | 'name' | 'sendStatus' | 'readStatus' | 'signingStatus'>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type FormSigner = FormValues["signers"][number];
|
||||||
|
|
||||||
const RecipientsPage: NextPageWithLayout = (props: any) => {
|
const RecipientsPage: NextPageWithLayout = (props: any) => {
|
||||||
const title: string = `"` + props?.document?.title + `"` + "Recipients | Documenso";
|
const title: string = `"` + props?.document?.title + `"` + "Recipients | Documenso";
|
||||||
const breadcrumbItems = [
|
const breadcrumbItems = [
|
||||||
@ -63,7 +66,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
});
|
});
|
||||||
const formValues = useWatch({ control, name: "signers" });
|
const formValues = useWatch({ control, name: "signers" });
|
||||||
const cancelButtonRef = useRef(null);
|
const cancelButtonRef = useRef(null);
|
||||||
const hasEmailError = (formValue: any): boolean => {
|
const hasEmailError = (formValue: FormSigner): boolean => {
|
||||||
const index = formValues.findIndex((e) => e.id === formValue.id);
|
const index = formValues.findIndex((e) => e.id === formValue.id);
|
||||||
return !!errors?.signers?.[index]?.email;
|
return !!errors?.signers?.[index]?.email;
|
||||||
};
|
};
|
||||||
@ -108,12 +111,14 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
icon={PaperAirplaneIcon}
|
icon={PaperAirplaneIcon}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpen(true);
|
formValues.some((r) => r.email && hasEmailError(r))
|
||||||
|
? toast.error("Please enter a valid email address.", { id: "invalid email" })
|
||||||
|
: setOpen(true);
|
||||||
}}
|
}}
|
||||||
disabled={
|
disabled={
|
||||||
(formValues.length || 0) === 0 ||
|
(formValues.length || 0) === 0 ||
|
||||||
!formValues.some(
|
!formValues.some(
|
||||||
(r: any) => r.email && !hasEmailError(r) && r.sendStatus === "NOT_SENT"
|
(r) => r.email && !hasEmailError(r) && r.sendStatus === "NOT_SENT"
|
||||||
) ||
|
) ||
|
||||||
loading
|
loading
|
||||||
}>
|
}>
|
||||||
@ -138,7 +143,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
trigger();
|
trigger();
|
||||||
}}>
|
}}>
|
||||||
<ul role="list" className="divide-y divide-gray-200">
|
<ul role="list" className="divide-y divide-gray-200">
|
||||||
{fields.map((item: any, index: number) => (
|
{fields.map((item, index) => (
|
||||||
<li
|
<li
|
||||||
key={index}
|
key={index}
|
||||||
className="group w-full border-0 px-2 py-3 hover:bg-green-50 sm:py-4">
|
className="group w-full border-0 px-2 py-3 hover:bg-green-50 sm:py-4">
|
||||||
@ -175,7 +180,6 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="block w-full border-0 bg-inherit p-0 text-gray-900 placeholder-gray-500 outline-none disabled:bg-neutral-100 sm:text-sm"
|
className="block w-full border-0 bg-inherit p-0 text-gray-900 placeholder-gray-500 outline-none disabled:bg-neutral-100 sm:text-sm"
|
||||||
placeholder="john.dorian@loremipsum.com"
|
|
||||||
/>
|
/>
|
||||||
{errors?.signers?.[index] ? (
|
{errors?.signers?.[index] ? (
|
||||||
<p className="mt-2 text-sm text-red-600" id="email-error">
|
<p className="mt-2 text-sm text-red-600" id="email-error">
|
||||||
@ -213,7 +217,6 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="block w-full border-0 bg-inherit p-0 text-gray-900 placeholder-gray-500 outline-none disabled:bg-neutral-100 sm:text-sm"
|
className="block w-full border-0 bg-inherit p-0 text-gray-900 placeholder-gray-500 outline-none disabled:bg-neutral-100 sm:text-sm"
|
||||||
placeholder="John Dorian"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
name: documenso
|
||||||
services:
|
services:
|
||||||
database:
|
database:
|
||||||
image: postgres:15
|
image: postgres:15
|
||||||
|
container_name: database
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=documenso
|
- POSTGRES_USER=documenso
|
||||||
- POSTGRES_PASSWORD=password
|
- POSTGRES_PASSWORD=password
|
||||||
@ -10,6 +12,7 @@ services:
|
|||||||
|
|
||||||
inbucket:
|
inbucket:
|
||||||
image: inbucket/inbucket
|
image: inbucket/inbucket
|
||||||
|
container_name: mailserver
|
||||||
ports:
|
ports:
|
||||||
- 9000:9000
|
- 9000:9000
|
||||||
- 2500:2500
|
- 2500:2500
|
||||||
|
|||||||
@ -11,8 +11,8 @@ export const signingRequestTemplate = (
|
|||||||
user: any
|
user: any
|
||||||
) => {
|
) => {
|
||||||
const customContent = `
|
const customContent = `
|
||||||
<p style="margin: 30px;">
|
<p style="margin: 30px 0px; text-align: center">
|
||||||
<a href="${ctaLink}" style="background-color: #37f095; color: white; border-color: transparent; border-width: 1px; border-radius: 0.375rem; font-size: 18px; padding-left: 16px; padding-right: 16px; padding-top: 10px; padding-bottom: 10px; text-decoration: none; margin-top: 4px; margin-bottom: 4px;">
|
<a href="${ctaLink}" style="background-color: #37f095; white-space: nowrap; color: white; border-color: transparent; border-width: 1px; border-radius: 0.375rem; font-size: 18px; padding-left: 16px; padding-right: 16px; padding-top: 10px; padding-bottom: 10px; text-decoration: none; margin-top: 4px; margin-bottom: 4px;">
|
||||||
${ctaLabel}
|
${ctaLabel}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user