tosanoob's picture
update a lot
0d37b12
import html2pdf from "html2pdf.js";
export default function AdminReport({ data }) {
function exportToPDF() {
const element = document.getElementById("report-admin-summary");
html2pdf().from(element).save("report.pdf");
};
return (
<div>
<button onClick={exportToPDF}> Lưu báo cáo </button>
<div id='report-admin-summary' style={{
color: 'black',
fontWeight: 'bold',
background: 'white',
alignItems: 'center',
textAlign: 'center'
}
}>
<h1>Báo cáo: {data.title}</h1>
<p>Ngày: {data.date}</p>
<ul>
{data.items.map((item, index) => (
<li key={index}>
{item.assignee} - {item.priority} - {item.summary} - {item.status}
</li>
))}
</ul>
</div>
</div>
);
}