ldc-crm/resources/ts/pages/statsExport.ts
2023-06-12 17:46:18 +02:00

22 lines
608 B
TypeScript

const statsCSV = document.getElementById("StatsCSV");
const statsPDF = document.getElementById("StatsPDF");
if (statsCSV) {
statsCSV.addEventListener("click", () => {
window.location = statsCSV.dataset["request"] as
| Location
| (string & Location);
});
}
if (statsPDF) {
statsPDF.addEventListener("click", () => {
const canvas = document.getElementById("chart") as HTMLCanvasElement;
//@ts-ignore
printJS({
printable: canvas.toDataURL(),
type: "image",
imageStyle: "width:100%",
});
});
}