🐛🚧
This commit is contained in:
@@ -34,6 +34,12 @@ export default function PDFSigner(props: any) {
|
|||||||
|
|
||||||
function onDialogClose(dialogResult: any) {
|
function onDialogClose(dialogResult: any) {
|
||||||
// todo handle signature removed from field
|
// 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 = {
|
const signature = {
|
||||||
fieldId: dialogField.id,
|
fieldId: dialogField.id,
|
||||||
type: dialogResult.type,
|
type: dialogResult.type,
|
||||||
@@ -194,19 +200,18 @@ export default function PDFSigner(props: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const deleted = toast.promise(
|
fetch("/api/documents/" + 0 + "/fields/" + field.id, {
|
||||||
fetch("/api/documents/" + 0 + "/fields/" + field.id, {
|
method: "DELETE",
|
||||||
method: "DELETE",
|
headers: {
|
||||||
headers: {
|
"Content-Type": "application/json",
|
||||||
"Content-Type": "application/json",
|
},
|
||||||
},
|
body: JSON.stringify(field),
|
||||||
body: JSON.stringify(field),
|
}).then((res) => {
|
||||||
}).then((res) => {
|
if (!res.ok) {
|
||||||
if (!res.ok) {
|
throw new Error(res.status.toString());
|
||||||
throw new Error(res.status.toString());
|
}
|
||||||
}
|
return res;
|
||||||
return res;
|
}),
|
||||||
}),
|
|
||||||
{
|
{
|
||||||
loading: "Deleting...",
|
loading: "Deleting...",
|
||||||
success: "Deleted.",
|
success: "Deleted.",
|
||||||
@@ -217,9 +222,7 @@ export default function PDFSigner(props: any) {
|
|||||||
style: {
|
style: {
|
||||||
minWidth: "200px",
|
minWidth: "200px",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
);
|
|
||||||
return deleted;
|
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,9 +242,9 @@ export default function PDFSigner(props: any) {
|
|||||||
return res.json();
|
return res.json();
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
loading: "Saving...",
|
loading: "Adding...",
|
||||||
success: "Saved.",
|
success: "Added.",
|
||||||
error: "Could not save :/",
|
error: "Could not add :/",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "saving field",
|
id: "saving field",
|
||||||
|
|||||||
@@ -102,7 +102,10 @@ export default function SignatureDialog(props: any) {
|
|||||||
<div className="float-right">
|
<div className="float-right">
|
||||||
<Button
|
<Button
|
||||||
color="secondary"
|
color="secondary"
|
||||||
onClick={() => props.setOpen(false)}
|
onClick={() => {
|
||||||
|
props.onClose();
|
||||||
|
props.setOpen(false);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
@@ -153,7 +156,10 @@ export default function SignatureDialog(props: any) {
|
|||||||
<div className="mt-10 float-right">
|
<div className="mt-10 float-right">
|
||||||
<Button
|
<Button
|
||||||
color="secondary"
|
color="secondary"
|
||||||
onClick={() => props.setOpen(false)}
|
onClick={() => {
|
||||||
|
props.onClose();
|
||||||
|
props.setOpen(false);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user