Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-17 02:07:22 +00:00
co-authored by renee-png
parent 5aa748c12c
commit abc4df115d
+19 -1
View File
@@ -62,9 +62,27 @@ export function CaseStatusTab({ caseId, caseLabel }: { caseId: string; caseLabel
if (error) toast.error(error.message); else { toast.success("Deleted"); load(); }
};
const exportPdf = () => {
if (items.length === 0) { toast.error("No status updates to export"); return; }
downloadStatusReport({
title: "Case Status Report",
subtitle: caseLabel,
entries: items.map((u) => ({
title: u.title,
body: u.body,
created_at: u.created_at,
author_name: u.user?.full_name,
author_email: u.user?.email,
})),
}, `status-report-${(caseLabel || caseId).replace(/[^a-z0-9]+/gi, "-")}.pdf`);
};
return (
<div className="space-y-4">
<div className="flex justify-end">
<div className="flex justify-end gap-2">
<Button variant="outline" onClick={exportPdf} disabled={items.length === 0}>
<FileDown className="h-4 w-4 mr-2" /> Export PDF
</Button>
<Button onClick={() => setShowForm((s) => !s)}>
<Plus className="h-4 w-4 mr-2" /> {showForm ? "Cancel" : "Add status update"}
</Button>