Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 19:14:42 +00:00
co-authored by renee-png
parent cd2cd06ce8
commit 34bb098ef1
4 changed files with 25 additions and 10 deletions
+3 -1
View File
@@ -544,9 +544,11 @@ export function CollectionDetail({
].join(",")),
].join("\n");
const blob = new Blob([rows], { type: "text/csv" });
const name = promptFilename(`Statement_${ho?.last_name || "homeowner"}`, "csv");
if (!name) return;
const a = document.createElement("a");
a.href = URL.createObjectURL(blob);
a.download = `Statement_${ho?.last_name || "homeowner"}.csv`;
a.download = `${name}.csv`;
a.click();
};
+11 -6
View File
@@ -91,6 +91,7 @@ import {
} from "docx";
import { toast } from "sonner";
import { supabase } from "@/integrations/supabase/client";
import { promptFilename } from "@/lib/prompt-filename";
// Paragraph extension with indent (px) + caption flag, persisted as inline styles
const PaddedParagraph = Paragraph.extend({
@@ -1026,19 +1027,21 @@ export function CustomFormBuilder() {
y += seg.caption ? 2 : 4;
}
const filenameBase = (renderTitle(ctx) || "Custom_Form").replace(/\s+/g, "_");
const defaultName = (renderTitle(ctx) || "Custom_Form").replace(/\s+/g, "_");
if (saveToCase && selectedCaseId) {
const blob = doc.output("blob");
await savePdfToDocuments({
blob,
caseId: selectedCaseId,
name: `${filenameBase}.pdf`,
name: `${defaultName}.pdf`,
mimeType: "application/pdf",
});
toast.success("Saved to case files");
setSaveToCaseOpen(false);
} else {
doc.save(`${filenameBase}.pdf`);
const name = promptFilename(defaultName, "pdf");
if (!name) return;
doc.save(`${name}.pdf`);
toast.success("PDF downloaded");
}
};
@@ -1236,22 +1239,24 @@ export function CustomFormBuilder() {
});
const blob = await Packer.toBlob(docx);
const filenameBase = (renderTitle(ctx) || "Custom_Form").replace(/\s+/g, "_");
const defaultName = (renderTitle(ctx) || "Custom_Form").replace(/\s+/g, "_");
if (saveToCase && selectedCaseId) {
await savePdfToDocuments({
blob,
caseId: selectedCaseId,
name: `${filenameBase}.docx`,
name: `${defaultName}.docx`,
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
toast.success("Saved to case files");
setSaveToCaseOpen(false);
} else {
const name = promptFilename(defaultName, "docx");
if (!name) return;
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `${filenameBase}.docx`;
a.download = `${name}.docx`;
a.click();
URL.revokeObjectURL(url);
toast.success("DOCX downloaded");