mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
feat: updating the dialog and page of document
This commit is contained in:
@ -34,7 +34,7 @@ export const DeleteDocumentDialog = ({ document }: DeleteDocumentDialogProps) =>
|
|||||||
|
|
||||||
const handleDeleteDocument = async () => {
|
const handleDeleteDocument = async () => {
|
||||||
try {
|
try {
|
||||||
await deleteDocument({ id: 1, userId: 1 });
|
await deleteDocument({ id: document.id, userId: document.userId });
|
||||||
toast({
|
toast({
|
||||||
title: 'Document deleted',
|
title: 'Document deleted',
|
||||||
description: 'The Document has been deleted successfully.',
|
description: 'The Document has been deleted successfully.',
|
||||||
@ -68,22 +68,21 @@ export const DeleteDocumentDialog = ({ document }: DeleteDocumentDialogProps) =>
|
|||||||
variant="neutral"
|
variant="neutral"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<AlertTitle>Delete Account</AlertTitle>
|
<AlertTitle>Delete Document</AlertTitle>
|
||||||
<AlertDescription className="mr-2">
|
<AlertDescription className="mr-2">
|
||||||
Delete the users account and all its contents. This action is irreversible and will
|
Delete the document. This action is irreversible so proceed with caution.
|
||||||
cancel their subscription, so proceed with caution.
|
|
||||||
</AlertDescription>
|
</AlertDescription>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0">
|
||||||
<Dialog>
|
<Dialog>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button variant="destructive">Delete Account</Button>
|
<Button variant="destructive">Delete Document</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogHeader className="space-y-4">
|
<DialogHeader className="space-y-4">
|
||||||
<DialogTitle>Delete Account</DialogTitle>
|
<DialogTitle>Delete Document</DialogTitle>
|
||||||
|
|
||||||
<Alert variant="destructive">
|
<Alert variant="destructive">
|
||||||
<AlertDescription className="selection:bg-red-100">
|
<AlertDescription className="selection:bg-red-100">
|
||||||
@ -93,7 +92,7 @@ export const DeleteDocumentDialog = ({ document }: DeleteDocumentDialogProps) =>
|
|||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<DialogDescription>To confirm, please the reason</DialogDescription>
|
<DialogDescription>To confirm, please enter the reason</DialogDescription>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
className="mt-2"
|
className="mt-2"
|
||||||
@ -109,7 +108,7 @@ export const DeleteDocumentDialog = ({ document }: DeleteDocumentDialogProps) =>
|
|||||||
loading={isDeletingDocument}
|
loading={isDeletingDocument}
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
>
|
>
|
||||||
{isDeletingDocument ? 'Deleting account...' : 'Delete Account'}
|
{isDeletingDocument ? 'Deleting document...' : 'Delete Document'}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { DocumentStatus } from '~/components/formatter/document-status';
|
|||||||
import { LocaleDate } from '~/components/formatter/locale-date';
|
import { LocaleDate } from '~/components/formatter/locale-date';
|
||||||
|
|
||||||
import { AdminActions } from './admin-actions';
|
import { AdminActions } from './admin-actions';
|
||||||
|
import { DeleteDocumentDialog } from './delete-document-dialog';
|
||||||
import { RecipientItem } from './recipient-item';
|
import { RecipientItem } from './recipient-item';
|
||||||
|
|
||||||
type AdminDocumentDetailsPageProps = {
|
type AdminDocumentDetailsPageProps = {
|
||||||
@ -81,6 +82,10 @@ export default async function AdminDocumentDetailsPage({ params }: AdminDocument
|
|||||||
))}
|
))}
|
||||||
</Accordion>
|
</Accordion>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr className="my-4" />
|
||||||
|
|
||||||
|
{document && <DeleteDocumentDialog document={document} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user