98 lines
2.8 KiB
Plaintext
98 lines
2.8 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>BerichtExporter</title>
|
|
<style>
|
|
body {
|
|
font-family: 'Roboto', sans-serif;
|
|
font-size: 16px;
|
|
color: #fff;
|
|
background-color: #0d131e;
|
|
}
|
|
|
|
.selector {
|
|
margin-top: 10px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
select::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
.selector select {
|
|
height: 30px;
|
|
font-size: 16px;
|
|
border-radius: 15px;
|
|
background-color: #172336;
|
|
color: #fff;
|
|
border: none;
|
|
overflow-y: scroll;
|
|
}
|
|
|
|
.selector button {
|
|
font-size: 16px;
|
|
height: 30px;
|
|
margin-left: 10px;
|
|
border-radius: 15px;
|
|
background-color: #172336;
|
|
color: #fff;
|
|
border: none;
|
|
}
|
|
.selector button:hover {
|
|
scale: 1.1;
|
|
cursor: pointer;
|
|
}
|
|
|
|
#export-textarea {
|
|
font-size: 16px;
|
|
width: 90%;
|
|
resize: none;
|
|
overflow-y: hidden;
|
|
background-color: #172336;
|
|
color: #fff;
|
|
border-radius: 15px;
|
|
border: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>BerichtExporter</h1>
|
|
<div class="selector">
|
|
<select id="week-list">
|
|
<% options.forEach((element, index) => { %>
|
|
<option value="<%= index %>"><%= element %></option>
|
|
<% }); %>
|
|
</select>
|
|
<button id="export-button" onclick="exportReport()">Export</button>
|
|
</div>
|
|
<textarea id="export-textarea"></textarea>
|
|
|
|
<script>
|
|
const exportTextarea = document.getElementById('export-textarea');
|
|
const weekList = document.getElementById('week-list');
|
|
|
|
function exportReport() {
|
|
const week = weekList.value;
|
|
|
|
fetch('/getreport?week=' + week)
|
|
.then(response => {
|
|
if (response.ok) {
|
|
return response.text();
|
|
} else {
|
|
exportTextarea.value = 'Error while fetching report';
|
|
throw new Error('Error while fetching report');
|
|
}
|
|
}).then(text => {
|
|
exportTextarea.value = text;
|
|
exportTextarea.style.height = "auto";
|
|
exportTextarea.style.height = exportTextarea.scrollHeight + "px";
|
|
}).catch(error => {
|
|
exportTextarea.value = 'Error while fetching report';
|
|
console.error(error);
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |