mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
🧹🚧DOC-97 DOC-19
This commit is contained in:
@ -1,10 +1,7 @@
|
|||||||
import { ResizableBox, ResizeCallbackData } from "react-resizable";
|
import React, { useState } from "react";
|
||||||
import React, { SyntheticEvent, useEffect, useState } from "react";
|
|
||||||
import Draggable from "react-draggable";
|
import Draggable from "react-draggable";
|
||||||
import { CircleStackIcon, TrashIcon } from "@heroicons/react/24/solid";
|
|
||||||
import Logo from "../logo";
|
import Logo from "../logo";
|
||||||
import { IconButton } from "@documenso/ui";
|
import { IconButton } from "@documenso/ui";
|
||||||
import toast from "react-hot-toast";
|
|
||||||
import { XCircleIcon } from "@heroicons/react/20/solid";
|
import { XCircleIcon } from "@heroicons/react/20/solid";
|
||||||
const stc = require("string-to-color");
|
const stc = require("string-to-color");
|
||||||
|
|
||||||
@ -20,6 +17,7 @@ type FieldPropsType = {
|
|||||||
};
|
};
|
||||||
onPositionChanged: any;
|
onPositionChanged: any;
|
||||||
onDelete: any;
|
onDelete: any;
|
||||||
|
hidden: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function EditableField(props: FieldPropsType) {
|
export default function EditableField(props: FieldPropsType) {
|
||||||
@ -52,6 +50,7 @@ export default function EditableField(props: FieldPropsType) {
|
|||||||
cancel="strong"
|
cancel="strong"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
hidden={props.hidden}
|
||||||
ref={nodeRef}
|
ref={nodeRef}
|
||||||
className="cursor-move opacity-80 p-2 m-auto w-auto flex-row-reverse text-lg font-bold text-center absolute top-0 left-0 select-none"
|
className="cursor-move opacity-80 p-2 m-auto w-auto flex-row-reverse text-lg font-bold text-center absolute top-0 left-0 select-none"
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@ -37,7 +37,6 @@ export default function PDFEditor(props: any) {
|
|||||||
function onDeleteHandler(id: any) {
|
function onDeleteHandler(id: any) {
|
||||||
const field = fields.find((e) => e.id == id);
|
const field = fields.find((e) => e.id == id);
|
||||||
const fieldIndex = fields.map((item) => item.id).indexOf(id);
|
const fieldIndex = fields.map((item) => item.id).indexOf(id);
|
||||||
console.log(fieldIndex);
|
|
||||||
if (fieldIndex > -1) {
|
if (fieldIndex > -1) {
|
||||||
const fieldWithoutRemoved = [...fields];
|
const fieldWithoutRemoved = [...fields];
|
||||||
const removedField = fieldWithoutRemoved.splice(fieldIndex, 1);
|
const removedField = fieldWithoutRemoved.splice(fieldIndex, 1);
|
||||||
|
|||||||
@ -71,6 +71,7 @@ export default function PDFViewer(props) {
|
|||||||
></ReadOnlyField>
|
></ReadOnlyField>
|
||||||
) : (
|
) : (
|
||||||
<EditableField
|
<EditableField
|
||||||
|
hidden={item.Signature}
|
||||||
key={item.id}
|
key={item.id}
|
||||||
field={item}
|
field={item}
|
||||||
className="absolute"
|
className="absolute"
|
||||||
|
|||||||
@ -7,18 +7,14 @@ import {
|
|||||||
CheckIcon,
|
CheckIcon,
|
||||||
DocumentPlusIcon,
|
DocumentPlusIcon,
|
||||||
EnvelopeIcon,
|
EnvelopeIcon,
|
||||||
EyeIcon,
|
|
||||||
PlusIcon,
|
PlusIcon,
|
||||||
SunIcon,
|
|
||||||
TrashIcon,
|
TrashIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import Link from "next/link";
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { uploadDocument } from "@documenso/features";
|
import { uploadDocument } from "@documenso/features";
|
||||||
import { DocumentStatus } from "@prisma/client";
|
import { DocumentStatus } from "@prisma/client";
|
||||||
import { Tooltip as ReactTooltip } from "react-tooltip";
|
import { Tooltip as ReactTooltip } from "react-tooltip";
|
||||||
import { getDocumentsForUserFromToken } from "@documenso/lib/query";
|
import { Button, IconButton } from "@documenso/ui";
|
||||||
import { Button } from "@documenso/ui";
|
|
||||||
|
|
||||||
const DocumentsPage: NextPageWithLayout = (props: any) => {
|
const DocumentsPage: NextPageWithLayout = (props: any) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -44,7 +40,7 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
function showDocument(documentId: number) {
|
function showDocument(documentId: number) {
|
||||||
router.push(`/documents/${documentId}`);
|
router.push(`/documents/${documentId}/recipients`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -227,11 +223,11 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
|
|||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||||
<Link href={"/documents/" + document.id}>
|
<div>
|
||||||
<TrashIcon
|
<IconButton
|
||||||
|
icon={TrashIcon}
|
||||||
className="flex-shrink-0 -ml-1 mr-3 h-6 w-6 inline text-neon"
|
className="flex-shrink-0 -ml-1 mr-3 h-6 w-6 inline text-neon"
|
||||||
aria-hidden="true"
|
onClick={(event: any) => {
|
||||||
onClick={(event) => {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (
|
if (
|
||||||
@ -259,9 +255,9 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
></IconButton>
|
||||||
<span className="sr-only">, {document.name}</span>
|
<span className="sr-only">, {document.name}</span>
|
||||||
</Link>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import { DocumentStatus } from "@prisma/client";
|
|||||||
import {
|
import {
|
||||||
InformationCircleIcon,
|
InformationCircleIcon,
|
||||||
PaperAirplaneIcon,
|
PaperAirplaneIcon,
|
||||||
UserPlusIcon,
|
|
||||||
UsersIcon,
|
UsersIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { getDocument } from "@documenso/lib/query";
|
import { getDocument } from "@documenso/lib/query";
|
||||||
@ -126,7 +125,7 @@ export async function getServerSideProps(context: any) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
document: document,
|
document: JSON.parse(JSON.stringify(document)),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -69,7 +69,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
className="mr-2"
|
className="mr-2"
|
||||||
href={breadcrumbItems[1].href}
|
href={breadcrumbItems[1].href}
|
||||||
>
|
>
|
||||||
Customize Document
|
Edit Document
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="min-w-[125px]"
|
className="min-w-[125px]"
|
||||||
@ -431,7 +431,7 @@ export async function getServerSideProps(context: any) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
document: document,
|
document: JSON.parse(JSON.stringify(document)),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export const getDocument = async (
|
|||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
Recipient: true,
|
Recipient: true,
|
||||||
Field: { include: { Recipient: true } },
|
Field: { include: { Recipient: true, Signature: true } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user