File size: 1,028 Bytes
0d37b12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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>
    );

}