Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
5fb761984e
commit
bdf249acda
@@ -50,6 +50,7 @@ function PleadingNewPage() {
|
||||
// Attorney signature (loaded from profile)
|
||||
const [includeSignature, setIncludeSignature] = useState(true);
|
||||
const [sigBlock, setSigBlock] = useState("");
|
||||
const [sigTyped, setSigTyped] = useState("");
|
||||
const [sigImagePath, setSigImagePath] = useState<string>("");
|
||||
const [sigImageBytes, setSigImageBytes] = useState<Uint8Array | null>(null);
|
||||
const [sigImageDataUrl, setSigImageDataUrl] = useState<string>("");
|
||||
@@ -66,6 +67,7 @@ function PleadingNewPage() {
|
||||
if (!data) return;
|
||||
const d = data as any;
|
||||
setSigBlock(d.signature_block ?? "");
|
||||
setSigTyped(d.signature_typed ?? "");
|
||||
setSigImagePath(d.signature_image_path ?? "");
|
||||
if (d.signature_image_path) {
|
||||
try {
|
||||
@@ -76,7 +78,6 @@ function PleadingNewPage() {
|
||||
const blob = await res.blob();
|
||||
const buf = new Uint8Array(await blob.arrayBuffer());
|
||||
setSigImageBytes(buf);
|
||||
// Build a data URL for the PDF generator
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => setSigImageDataUrl(String(reader.result || ""));
|
||||
reader.readAsDataURL(blob);
|
||||
@@ -91,9 +92,10 @@ function PleadingNewPage() {
|
||||
|
||||
const buildSignature = (): PleadingSignature | undefined => {
|
||||
if (!includeSignature) return undefined;
|
||||
if (!sigBlock.trim() && !sigImageBytes) return undefined;
|
||||
if (!sigBlock.trim() && !sigImageBytes && !sigTyped.trim()) return undefined;
|
||||
return {
|
||||
block: sigBlock,
|
||||
typed: sigTyped || undefined,
|
||||
imageBytes: sigImageBytes ?? undefined,
|
||||
imageDataUrl: sigImageDataUrl || undefined,
|
||||
imageType: sigImageType,
|
||||
|
||||
Reference in New Issue
Block a user