mirror of
https://github.com/documenso/documenso.git
synced 2025-11-17 02:01:33 +10:00
chore: let user activily modify next signer
This commit is contained in:
@ -13,6 +13,7 @@ import type { Field } from '@documenso/prisma/client';
|
|||||||
import { RecipientRole } from '@documenso/prisma/client';
|
import { RecipientRole } from '@documenso/prisma/client';
|
||||||
import { cn } from '@documenso/ui/lib/utils';
|
import { cn } from '@documenso/ui/lib/utils';
|
||||||
import { Button } from '@documenso/ui/primitives/button';
|
import { Button } from '@documenso/ui/primitives/button';
|
||||||
|
import { Checkbox } from '@documenso/ui/primitives/checkbox';
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogClose,
|
DialogClose,
|
||||||
@ -45,6 +46,7 @@ export type SignDialogProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
|
modifyNextSigner: z.boolean().default(false),
|
||||||
nextSigner: z
|
nextSigner: z
|
||||||
.object({
|
.object({
|
||||||
email: z.string().email({ message: 'Please enter a valid email address' }).optional(),
|
email: z.string().email({ message: 'Please enter a valid email address' }).optional(),
|
||||||
@ -232,8 +234,10 @@ export function SignDialog({
|
|||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
{step === 1 && (
|
{step === 1 && (
|
||||||
<div className="text-foreground text-xl font-semibold">
|
<div className="text-foreground text-base font-semibold">
|
||||||
<Trans>Modify Next Signer</Trans>
|
<Trans>
|
||||||
|
Modify Next Signer <span className="text-muted-foreground">(Optional)</span>
|
||||||
|
</Trans>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -251,35 +255,54 @@ export function SignDialog({
|
|||||||
<form onSubmit={form.handleSubmit(onFormSubmit)} className="flex flex-col gap-y-4">
|
<form onSubmit={form.handleSubmit(onFormSubmit)} className="flex flex-col gap-y-4">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="nextSigner.email"
|
name="modifyNextSigner"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem className="flex flex-row items-center space-x-2 space-y-0">
|
||||||
<FormLabel>
|
|
||||||
<Trans>Next Signer Email</Trans>
|
|
||||||
</FormLabel>
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input type="email" {...field} />
|
<Checkbox checked={field.value} onCheckedChange={field.onChange} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormLabel className="font-normal">
|
||||||
|
<Trans>Modify next signer details</Trans>
|
||||||
|
</FormLabel>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormField
|
{form.watch('modifyNextSigner') && (
|
||||||
control={form.control}
|
<>
|
||||||
name="nextSigner.name"
|
<FormField
|
||||||
render={({ field }) => (
|
control={form.control}
|
||||||
<FormItem>
|
name="nextSigner.email"
|
||||||
<FormLabel>
|
render={({ field }) => (
|
||||||
<Trans>Next Signer Name</Trans>
|
<FormItem>
|
||||||
</FormLabel>
|
<FormLabel>
|
||||||
<FormControl>
|
<Trans>Next Signer Email</Trans>
|
||||||
<Input {...field} />
|
</FormLabel>
|
||||||
</FormControl>
|
<FormControl>
|
||||||
<FormMessage />
|
<Input type="email" {...field} />
|
||||||
</FormItem>
|
</FormControl>
|
||||||
)}
|
<FormMessage />
|
||||||
/>
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="nextSigner.name"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>
|
||||||
|
<Trans>Next Signer Name</Trans>
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user