feat: power signing mode

This commit is contained in:
Ephraim Atta-Duncan
2024-10-10 20:23:32 +00:00
parent f05b670d93
commit eb96f315b6
18 changed files with 213 additions and 52 deletions

View File

@ -0,0 +1,43 @@
import { DocumentStatus, RecipientRole, SigningStatus } from '@prisma/client';
import { prisma } from '@documenso/prisma';
type GetNextInboxDocumentOptions = {
email: string | undefined;
};
export const getNextInboxDocument = async ({ email }: GetNextInboxDocumentOptions) => {
if (!email) {
throw new Error('User is required');
}
return await prisma.document.findFirst({
where: {
Recipient: {
some: {
email,
signingStatus: SigningStatus.NOT_SIGNED,
role: {
not: RecipientRole.CC,
},
},
},
status: { not: DocumentStatus.DRAFT },
deletedAt: null,
},
select: {
createdAt: true,
title: true,
Recipient: {
where: {
email,
},
select: {
token: true,
},
},
documentMeta: true,
},
orderBy: [{ createdAt: 'asc' }],
});
};

View File

@ -220,6 +220,10 @@ msgstr "Fortsetzen"
msgid "Copied to clipboard"
msgstr "In die Zwischenablage kopiert"
#: packages/ui/components/document/next-inbox-item-button.tsx:70
msgid "Created {0}"
msgstr ""
#: packages/ui/primitives/document-flow/add-signature.tsx:360
msgid "Custom Text"
msgstr "Benutzerdefinierter Text"
@ -578,6 +582,10 @@ msgstr "Erweiterte Einstellungen anzeigen"
msgid "Sign"
msgstr "Unterschreiben"
#: packages/ui/components/document/next-inbox-item-button.tsx:58
msgid "Sign Next Document"
msgstr ""
#: packages/ui/primitives/document-flow/add-fields.tsx:742
#: packages/ui/primitives/document-flow/add-signature.tsx:323
#: packages/ui/primitives/document-flow/field-icon.tsx:52

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -952,7 +952,7 @@ msgstr "Webhook erstellen"
msgid "Create Webhook"
msgstr "Webhook erstellen"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:215
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:229
msgid "Create your account and start using state-of-the-art document signing."
msgstr "Erstellen Sie Ihr Konto und beginnen Sie mit dem modernen Dokumentensignieren."
@ -1199,7 +1199,7 @@ msgstr "Dokument"
msgid "Document All"
msgstr "Dokument Alle"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:134
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:135
msgid "Document Approved"
msgstr "Dokument genehmigt"
@ -1258,7 +1258,7 @@ msgstr "Dokumentmetrik"
msgid "Document moved"
msgstr "Dokument verschoben"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:158
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:159
msgid "Document no longer available to sign"
msgstr "Dokument steht nicht mehr zur Unterschrift zur Verfügung"
@ -1278,7 +1278,7 @@ msgstr "Dokument wieder versiegelt"
msgid "Document sent"
msgstr "Dokument gesendet"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:132
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:133
msgid "Document Signed"
msgstr "Dokument signiert"
@ -1302,7 +1302,7 @@ msgstr "Dokumenten-Upload deaktiviert aufgrund unbezahlter Rechnungen"
msgid "Document uploaded"
msgstr "Dokument hochgeladen"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:133
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:134
msgid "Document Viewed"
msgstr "Dokument angesehen"
@ -1528,11 +1528,11 @@ msgstr "Geben Sie hier Ihren Text ein"
msgid "Error"
msgstr "Fehler"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:142
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:143
msgid "Everyone has signed"
msgstr "Alle haben unterschrieben"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:166
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:167
msgid "Everyone has signed! You will receive an Email copy of the signed document."
msgstr "Alle haben unterschrieben! Sie werden eine E-Mail-Kopie des unterzeichneten Dokuments erhalten."
@ -1620,7 +1620,7 @@ msgstr "Zurück"
msgid "Go back home"
msgstr "Zurück nach Hause"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:226
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:240
#: apps/web/src/app/(signing)/sign/[token]/no-longer-available.tsx:57
msgid "Go Back Home"
msgstr "Zurück nach Hause"
@ -2016,7 +2016,7 @@ msgstr "Meine Vorlagen"
msgid "Name"
msgstr "Name"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:211
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:225
msgid "Need to sign documents?"
msgstr "Müssen Dokumente signieren?"
@ -2814,7 +2814,7 @@ msgstr "Unterschrift"
msgid "Signatures Collected"
msgstr "Gesammelte Unterschriften"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:200
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:205
msgid "Signatures will appear once the document has been completed"
msgstr "Unterschriften erscheinen, sobald das Dokument abgeschlossen ist"
@ -3319,7 +3319,7 @@ msgstr "This document could not be duplicated at this time. Please try again."
msgid "This document could not be re-sent at this time. Please try again."
msgstr "This document could not be re-sent at this time. Please try again."
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:180
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:181
msgid "This document has been cancelled by the owner and is no longer available for others to sign."
msgstr "This document has been cancelled by the owner and is no longer available for others to sign."
@ -3852,7 +3852,7 @@ msgstr "Angesehen"
msgid "Waiting"
msgstr "Warten"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:150
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:151
msgid "Waiting for others to sign"
msgstr "Warten auf andere, um zu unterschreiben"
@ -4346,7 +4346,7 @@ msgstr "Sie werden benachrichtigt und können Ihr Documenso öffentliches Profil
msgid "You will now be required to enter a code from your authenticator app when signing in."
msgstr "Sie müssen bei der Anmeldung jetzt einen Code von Ihrer Authenticator-App eingeben."
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:173
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:174
msgid "You will receive an Email copy of the signed document once everyone has signed."
msgstr "Sie erhalten eine E-Mail-Kopie des unterzeichneten Dokuments, sobald alle unterschrieben haben."

View File

@ -215,6 +215,10 @@ msgstr "Continue"
msgid "Copied to clipboard"
msgstr "Copied to clipboard"
#: packages/ui/components/document/next-inbox-item-button.tsx:70
msgid "Created {0}"
msgstr "Created {0}"
#: packages/ui/primitives/document-flow/add-signature.tsx:360
msgid "Custom Text"
msgstr "Custom Text"
@ -573,6 +577,10 @@ msgstr "Show advanced settings"
msgid "Sign"
msgstr "Sign"
#: packages/ui/components/document/next-inbox-item-button.tsx:58
msgid "Sign Next Document"
msgstr "Sign Next Document"
#: packages/ui/primitives/document-flow/add-fields.tsx:742
#: packages/ui/primitives/document-flow/add-signature.tsx:323
#: packages/ui/primitives/document-flow/field-icon.tsx:52

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -947,7 +947,7 @@ msgstr "Create webhook"
msgid "Create Webhook"
msgstr "Create Webhook"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:215
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:229
msgid "Create your account and start using state-of-the-art document signing."
msgstr "Create your account and start using state-of-the-art document signing."
@ -1194,7 +1194,7 @@ msgstr "Document"
msgid "Document All"
msgstr "Document All"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:134
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:135
msgid "Document Approved"
msgstr "Document Approved"
@ -1253,7 +1253,7 @@ msgstr "Document metrics"
msgid "Document moved"
msgstr "Document moved"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:158
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:159
msgid "Document no longer available to sign"
msgstr "Document no longer available to sign"
@ -1273,7 +1273,7 @@ msgstr "Document resealed"
msgid "Document sent"
msgstr "Document sent"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:132
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:133
msgid "Document Signed"
msgstr "Document Signed"
@ -1297,7 +1297,7 @@ msgstr "Document upload disabled due to unpaid invoices"
msgid "Document uploaded"
msgstr "Document uploaded"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:133
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:134
msgid "Document Viewed"
msgstr "Document Viewed"
@ -1523,11 +1523,11 @@ msgstr "Enter your text here"
msgid "Error"
msgstr "Error"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:142
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:143
msgid "Everyone has signed"
msgstr "Everyone has signed"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:166
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:167
msgid "Everyone has signed! You will receive an Email copy of the signed document."
msgstr "Everyone has signed! You will receive an Email copy of the signed document."
@ -1615,7 +1615,7 @@ msgstr "Go Back"
msgid "Go back home"
msgstr "Go back home"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:226
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:240
#: apps/web/src/app/(signing)/sign/[token]/no-longer-available.tsx:57
msgid "Go Back Home"
msgstr "Go Back Home"
@ -2011,7 +2011,7 @@ msgstr "My templates"
msgid "Name"
msgstr "Name"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:211
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:225
msgid "Need to sign documents?"
msgstr "Need to sign documents?"
@ -2809,7 +2809,7 @@ msgstr "Signature"
msgid "Signatures Collected"
msgstr "Signatures Collected"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:200
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:205
msgid "Signatures will appear once the document has been completed"
msgstr "Signatures will appear once the document has been completed"
@ -3314,7 +3314,7 @@ msgstr "This document could not be duplicated at this time. Please try again."
msgid "This document could not be re-sent at this time. Please try again."
msgstr "This document could not be re-sent at this time. Please try again."
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:180
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:181
msgid "This document has been cancelled by the owner and is no longer available for others to sign."
msgstr "This document has been cancelled by the owner and is no longer available for others to sign."
@ -3847,7 +3847,7 @@ msgstr "Viewed"
msgid "Waiting"
msgstr "Waiting"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:150
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:151
msgid "Waiting for others to sign"
msgstr "Waiting for others to sign"
@ -4341,7 +4341,7 @@ msgstr "You will get notified & be able to set up your documenso public profile
msgid "You will now be required to enter a code from your authenticator app when signing in."
msgstr "You will now be required to enter a code from your authenticator app when signing in."
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:173
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:174
msgid "You will receive an Email copy of the signed document once everyone has signed."
msgstr "You will receive an Email copy of the signed document once everyone has signed."

View File

@ -216,6 +216,10 @@ msgstr "Continuer"
msgid "Copied to clipboard"
msgstr "Copié dans le presse-papiers"
#: packages/ui/components/document/next-inbox-item-button.tsx:70
msgid "Created {0}"
msgstr ""
#: packages/ui/primitives/document-flow/add-signature.tsx:360
msgid "Custom Text"
msgstr "Texte personnalisé"
@ -574,6 +578,10 @@ msgstr "Afficher les paramètres avancés"
msgid "Sign"
msgstr "Signer"
#: packages/ui/components/document/next-inbox-item-button.tsx:58
msgid "Sign Next Document"
msgstr ""
#: packages/ui/primitives/document-flow/add-fields.tsx:742
#: packages/ui/primitives/document-flow/add-signature.tsx:323
#: packages/ui/primitives/document-flow/field-icon.tsx:52

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -952,7 +952,7 @@ msgstr "Créer un webhook"
msgid "Create Webhook"
msgstr "Créer un Webhook"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:215
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:229
msgid "Create your account and start using state-of-the-art document signing."
msgstr "Créez votre compte et commencez à utiliser la signature de documents à la pointe de la technologie."
@ -1199,7 +1199,7 @@ msgstr "Document"
msgid "Document All"
msgstr "Document Tout"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:134
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:135
msgid "Document Approved"
msgstr "Document Approuvé"
@ -1258,7 +1258,7 @@ msgstr "Métriques du document"
msgid "Document moved"
msgstr "Document déplacé"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:158
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:159
msgid "Document no longer available to sign"
msgstr "Document non disponible pour signature"
@ -1278,7 +1278,7 @@ msgstr "Document resealé"
msgid "Document sent"
msgstr "Document envoyé"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:132
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:133
msgid "Document Signed"
msgstr "Document signé"
@ -1302,7 +1302,7 @@ msgstr "Téléchargement du document désactivé en raison de factures impayées
msgid "Document uploaded"
msgstr "Document téléchargé"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:133
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:134
msgid "Document Viewed"
msgstr "Document consulté"
@ -1528,11 +1528,11 @@ msgstr "Entrez votre texte ici"
msgid "Error"
msgstr "Erreur"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:142
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:143
msgid "Everyone has signed"
msgstr "Tout le monde a signé"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:166
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:167
msgid "Everyone has signed! You will receive an Email copy of the signed document."
msgstr "Tout le monde a signé ! Vous recevrez une copie par email du document signé."
@ -1620,7 +1620,7 @@ msgstr "Retourner"
msgid "Go back home"
msgstr "Retourner à la maison"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:226
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:240
#: apps/web/src/app/(signing)/sign/[token]/no-longer-available.tsx:57
msgid "Go Back Home"
msgstr "Retourner à la maison"
@ -2016,7 +2016,7 @@ msgstr "Mes modèles"
msgid "Name"
msgstr "Nom"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:211
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:225
msgid "Need to sign documents?"
msgstr "Besoin de signer des documents ?"
@ -2814,7 +2814,7 @@ msgstr "Signature"
msgid "Signatures Collected"
msgstr "Signatures collectées"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:200
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:205
msgid "Signatures will appear once the document has been completed"
msgstr "Les signatures apparaîtront une fois le document complété"
@ -3319,7 +3319,7 @@ msgstr "Ce document n'a pas pu être dupliqué pour le moment. Veuillez réessay
msgid "This document could not be re-sent at this time. Please try again."
msgstr "Ce document n'a pas pu être renvoyé pour le moment. Veuillez réessayer."
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:180
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:181
msgid "This document has been cancelled by the owner and is no longer available for others to sign."
msgstr "Ce document a été annulé par le propriétaire et n'est plus disponible pour d'autres à signer."
@ -3852,7 +3852,7 @@ msgstr "Vu"
msgid "Waiting"
msgstr "En attente"
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:150
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:151
msgid "Waiting for others to sign"
msgstr "En attente que d'autres signent"
@ -4346,7 +4346,7 @@ msgstr "Vous serez notifié et pourrez configurer votre profil public Documenso
msgid "You will now be required to enter a code from your authenticator app when signing in."
msgstr "Vous devrez maintenant entrer un code de votre application d'authentification lors de la connexion."
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:173
#: apps/web/src/app/(signing)/sign/[token]/complete/page.tsx:174
msgid "You will receive an Email copy of the signed document once everyone has signed."
msgstr "Vous recevrez une copie par e-mail du document signé une fois que tout le monde aura signé."

View File

@ -0,0 +1,77 @@
'use client';
import type { HTMLAttributes } from 'react';
import Link from 'next/link';
import { Trans } from '@lingui/macro';
import { DateTime } from 'luxon';
import type { DocumentData, Prisma } from '@documenso/prisma/client';
import { SignatureIcon } from '@documenso/ui/icons/signature';
import { Button } from '@documenso/ui/primitives/button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@documenso/ui/primitives/tooltip';
type GetNextInboxDocumentResult = Prisma.DocumentGetPayload<{
select: {
createdAt: true;
title: true;
Recipient: {
select: {
token: true;
};
};
documentMeta: true;
};
}> | null;
export type NextInboxItemButtonProps = HTMLAttributes<HTMLButtonElement> & {
disabled?: boolean;
documentData?: DocumentData;
userEmail: string | undefined;
nextInboxDocument: GetNextInboxDocumentResult;
};
export const NextInboxItemButton = ({
className,
documentData,
nextInboxDocument,
userEmail,
disabled,
...props
}: NextInboxItemButtonProps) => {
const recipientToken = nextInboxDocument?.Recipient[0]?.token ?? null;
return (
<Tooltip>
<TooltipTrigger>
<Link href={'/sign/' + recipientToken}>
<Button
type="button"
variant="outline"
className={className}
disabled={disabled || !documentData || !userEmail}
{...props}
>
<SignatureIcon className="mr-2 h-5 w-5" />
<Trans>Sign Next Document</Trans>
</Button>
</Link>
</TooltipTrigger>
<TooltipContent className="flex flex-row items-start gap-x-2 p-4">
<div className="gap-y-2">
<p className="text-foreground text-base font-semibold">{nextInboxDocument?.title}</p>
{nextInboxDocument?.createdAt && (
<p className="text-muted-foreground text-sm">
<Trans>
Created {DateTime.fromJSDate(nextInboxDocument?.createdAt).toFormat('LLL yy')}
</Trans>
</p>
)}
</div>
</TooltipContent>
</Tooltip>
);
};