Fix: správná cesta k archivním CSV souborům

This commit is contained in:
2026-01-02 09:54:57 +01:00
parent 82eedb0660
commit 79d4258709
2 changed files with 103 additions and 45 deletions

View File

@@ -1,55 +1,58 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="cs"> <html lang="cs">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Přehled Financí 2024</title> <title>Přehled Financí 2024</title>
<link rel="stylesheet" href="styly.css"> <link rel="stylesheet" href="styly.css">
</head> </head>
<body> <body>
<h2 class="archive-title">Přehled Financí za rok 2024</h2> <h2 class="archive-title">Přehled Financí za rok 2024</h2>
<div class="export-button-container"> <div class="export-button-container">
<a href="finance_2024.csv" download="finance_2024.csv" class="btn btn-primary">📂 Stáhnout CSV</a> <a href="archives/finance_2024.csv" download="finance_2024.csv" class="btn btn-primary">📂 Stáhnout CSV</a>
</div> </div>
</div> </div>
<!-- Obalíme tabulku do kontejneru pro centrování --> <!-- Obalíme tabulku do kontejneru pro centrování -->
<div class="archive-table-container"> <div class="archive-table-container">
<table id="finance-table" class="table table-striped mb-3 archive-table"> <table id="finance-table" class="table table-striped mb-3 archive-table">
<thead> <thead>
<tr> <tr>
<th>Datum</th> <th>Datum</th>
<th>Popis</th> <th>Popis</th>
<th>Částka</th> <th>Částka</th>
<th>Měna</th> <th>Měna</th>
<th>Typ</th> <th>Typ</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
<script> <script>
fetch('finance_2024.csv') fetch('archives/finance_2024.csv')
.then(response => response.text()) .then(response => response.text())
.then(data => { .then(data => {
let rows = data.split("\n").slice(1); let rows = data.split("\n").slice(1);
let tableBody = document.querySelector("#finance-table tbody"); let tableBody = document.querySelector("#finance-table tbody");
rows.forEach(row => { rows.forEach(row => {
let columns = row.split(","); let columns = row.split(",");
if (columns.length >= 5) { if (columns.length >= 5) {
let tr = document.createElement("tr"); let tr = document.createElement("tr");
columns.forEach(column => { columns.forEach(column => {
let td = document.createElement("td"); let td = document.createElement("td");
td.textContent = column.trim(); td.textContent = column.trim();
tr.appendChild(td); tr.appendChild(td);
}); });
tableBody.appendChild(tr); tableBody.appendChild(tr);
} }
}); });
}) })
.catch(error => console.error("Chyba při načítání CSV:", error)); .catch(error => console.error("Chyba při načítání CSV:", error));
</script> </script>
</body> </body>
</html> </html>

55
2025.html Normal file
View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<title>Přehled Financí 2025</title>
<link rel="stylesheet" href="styly.css">
</head>
<body>
<h2 class="archive-title">Přehled Financí za rok 2025</h2>
<div class="export-button-container">
<a href="archives/finance_2025.csv" download="finance_2025.csv" class="btn btn-primary">📂 Stáhnout CSV</a>
</div>
<div class="archive-table-container">
<table id="finance-table" class="table table-striped mb-3 archive-table">
<thead>
<tr>
<th>Datum</th>
<th>Popis</th>
<th>Částka</th>
<th>Měna</th>
<th>Typ</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<script>
fetch('archives/finance_2025.csv')
.then(response => response.text())
.then(data => {
let rows = data.split("\n").slice(1);
let tableBody = document.querySelector("#finance-table tbody");
rows.forEach(row => {
let columns = row.split(",");
if (columns.length >= 5) {
let tr = document.createElement("tr");
columns.forEach(column => {
let td = document.createElement("td");
td.textContent = column.trim();
tr.appendChild(td);
});
tableBody.appendChild(tr);
}
});
})
.catch(error => console.error("Chyba při načítání CSV:", error));
</script>
</body>
</html>