This commit is contained in:
Timur Ercan
2023-02-24 16:43:42 +01:00
parent df669d26e4
commit b1519e147a
2 changed files with 30 additions and 21 deletions

View File

@ -34,6 +34,12 @@ export default function PDFSigner(props: any) {
function onDialogClose(dialogResult: any) {
// todo handle signature removed from field
// todo remove free field if dialogresult is empty (or the id )
if (!dialogResult && dialogField.type === "FREE_SIGNATURE") {
onDeleteHandler(dialogField.id);
return;
}
const signature = {
fieldId: dialogField.id,
type: dialogResult.type,
@ -194,7 +200,6 @@ export default function PDFSigner(props: any) {
}
try {
const deleted = toast.promise(
fetch("/api/documents/" + 0 + "/fields/" + field.id, {
method: "DELETE",
headers: {
@ -217,9 +222,7 @@ export default function PDFSigner(props: any) {
style: {
minWidth: "200px",
},
}
);
return deleted;
};
} catch (error) {}
}
@ -239,9 +242,9 @@ export default function PDFSigner(props: any) {
return res.json();
}),
{
loading: "Saving...",
success: "Saved.",
error: "Could not save :/",
loading: "Adding...",
success: "Added.",
error: "Could not add :/",
},
{
id: "saving field",

View File

@ -102,7 +102,10 @@ export default function SignatureDialog(props: any) {
<div className="float-right">
<Button
color="secondary"
onClick={() => props.setOpen(false)}
onClick={() => {
props.onClose();
props.setOpen(false);
}}
>
Cancel
</Button>
@ -153,7 +156,10 @@ export default function SignatureDialog(props: any) {
<div className="mt-10 float-right">
<Button
color="secondary"
onClick={() => props.setOpen(false)}
onClick={() => {
props.onClose();
props.setOpen(false);
}}
>
Cancel
</Button>