Add Export to CSV or Excel.

This commit is contained in:
Jens Luedicke
2025-06-28 12:54:48 +02:00
parent dc4229e468
commit b9aa7ad413
6 changed files with 202 additions and 11 deletions

48
templates/export.html Normal file
View File

@@ -0,0 +1,48 @@
{% extends "layout.html" %}
{% block content %}
<div class="timetrack-container">
<h2>Export Time Entries</h2>
<div class="export-options">
<div class="export-section">
<h3>Date Range</h3>
<form action="{{ url_for('download_export') }}" method="get">
<div class="form-group">
<label for="start_date">Start Date:</label>
<input type="date" id="start_date" name="start_date" required>
</div>
<div class="form-group">
<label for="end_date">End Date:</label>
<input type="date" id="end_date" name="end_date" required>
</div>
<div class="form-group">
<label for="format">Export Format:</label>
<select id="format" name="format">
<option value="csv">CSV</option>
<option value="excel">Excel</option>
</select>
</div>
<button type="submit" class="btn">Generate Export</button>
</form>
</div>
<div class="export-section">
<h3>Quick Export</h3>
<div class="quick-export-buttons">
<a href="{{ url_for('download_export', period='today', format='csv') }}" class="btn">Today (CSV)</a>
<a href="{{ url_for('download_export', period='today', format='excel') }}" class="btn">Today (Excel)</a>
<a href="{{ url_for('download_export', period='week', format='csv') }}" class="btn">This Week (CSV)</a>
<a href="{{ url_for('download_export', period='week', format='excel') }}" class="btn">This Week (Excel)</a>
<a href="{{ url_for('download_export', period='month', format='csv') }}" class="btn">This Month (CSV)</a>
<a href="{{ url_for('download_export', period='month', format='excel') }}" class="btn">This Month (Excel)</a>
<a href="{{ url_for('download_export', period='all', format='csv') }}" class="btn">All Time (CSV)</a>
<a href="{{ url_for('download_export', period='all', format='excel') }}" class="btn">All Time (Excel)</a>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -3,6 +3,9 @@
{% block content %}
<div class="timetrack-container">
<h2>Complete Time Entry History</h2>
<div class="export-button-container">
<a href="{{ url_for('export') }}" class="btn">Export Data</a>
</div>
<div class="history-section">
{% if entries %}

View File

@@ -12,6 +12,7 @@
<ul>
<li><a href="{{ url_for('home') }}">Home</a></li>
<li><a href="{{ url_for('history') }}">Complete History</a></li>
<li><a href="{{ url_for('export') }}">Export Data</a></li>
<li><a href="{{ url_for('config') }}" {% if title == 'Configuration' %}class="active"{% endif %}>Configuration</a></li>
<li><a href="{{ url_for('about') }}">About</a></li>
</ul>