Initial setup - gitea

This commit is contained in:
Vladimir K
2023-07-23 17:10:20 +03:00
parent f9c957506c
commit 232a59569c
12 changed files with 370 additions and 127 deletions

View File

@@ -0,0 +1,26 @@
function downloadCSVFile() {
const data = [...document.querySelectorAll(".k-grid-content table[role='grid'] tbody tr")]
.map(row => [...row.querySelectorAll("td, th")]
.map(col => col.innerText)
.reduce((a, b) =>
`${a},${b}`)).reduce((a, b) => `${a}\r\n${b}`);
let fileName = document.querySelector('.filter-text span').innerHTML
.replace('за период c ', 'receipts_')
.replace(' по ', '_')
.replaceAll('.', '-');
fileName = fileName + '.csv'
const csv_file = new Blob([data], {type: "text/csv"});
const download_link = document.createElement("a");
download_link.download = fileName;
download_link.href = window.URL.createObjectURL(csv_file);
download_link.style.display = "none";
document.body.appendChild(download_link);
download_link.click();
return fileName;
}