Initial commit.

This commit is contained in:
2025-06-27 15:14:57 +02:00
committed by Jens Luedicke
commit a8d1f33874
13 changed files with 1007 additions and 0 deletions

9
templates/about.html Normal file
View File

@@ -0,0 +1,9 @@
{% extends "layout.html" %}
{% block content %}
<section class="about">
<h1>About Us</h1>
<p>This is a simple Flask web application created as a demonstration.</p>
<p>Learn more about our team and mission here.</p>
</section>
{% endblock %}

60
templates/config.html Normal file
View File

@@ -0,0 +1,60 @@
{% extends "layout.html" %}
{% block content %}
<div class="config-container">
<h1>Work Configuration</h1>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }}">{{ message }}</div>
{% endfor %}
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('config') }}" class="config-form">
<div class="form-group">
<label for="work_hours_per_day">Work Hours Per Day:</label>
<input type="number" id="work_hours_per_day" name="work_hours_per_day"
value="{{ config.work_hours_per_day }}" step="0.5" min="0.5" max="24" required>
<small>Standard number of work hours in a day</small>
</div>
<div class="form-section">
<h3>Primary Break</h3>
<div class="form-group">
<label for="mandatory_break_minutes">Mandatory Break Duration (minutes):</label>
<input type="number" id="mandatory_break_minutes" name="mandatory_break_minutes"
value="{{ config.mandatory_break_minutes }}" step="1" min="0" max="240" required>
<small>Required break time in minutes</small>
</div>
<div class="form-group">
<label for="break_threshold_hours">Break Threshold (hours):</label>
<input type="number" id="break_threshold_hours" name="break_threshold_hours"
value="{{ config.break_threshold_hours }}" step="0.5" min="0" max="24" required>
<small>Work hours after which a break becomes mandatory</small>
</div>
</div>
<div class="form-section">
<h3>Additional Break</h3>
<div class="form-group">
<label for="additional_break_minutes">Additional Break Duration (minutes):</label>
<input type="number" id="additional_break_minutes" name="additional_break_minutes"
value="{{ config.additional_break_minutes }}" step="1" min="0" max="240" required>
<small>Duration of additional break in minutes</small>
</div>
<div class="form-group">
<label for="additional_break_threshold_hours">Additional Break Threshold (hours):</label>
<input type="number" id="additional_break_threshold_hours" name="additional_break_threshold_hours"
value="{{ config.additional_break_threshold_hours }}" step="0.5" min="0" max="24" required>
<small>Work hours after which an additional break becomes necessary</small>
</div>
</div>
<button type="submit" class="btn btn-primary">Save Configuration</button>
</form>
</div>
{% endblock %}

22
templates/contact.html Normal file
View File

@@ -0,0 +1,22 @@
{% extends "layout.html" %}
{% block content %}
<section class="contact">
<h1>Contact Us</h1>
<form method="POST" action="{{ url_for('contact') }}">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="message">Message:</label>
<textarea id="message" name="message" rows="5" required></textarea>
</div>
<button type="submit">Send Message</button>
</form>
</section>
{% endblock %}

94
templates/index.html Normal file
View File

@@ -0,0 +1,94 @@
{% extends "layout.html" %}
{% block content %}
<div class="hero">
<h1>Welcome to TimeTrack</h1>
<p>Track your work hours easily and efficiently</p>
</div>
<div class="timetrack-container">
<h2>Time Tracking</h2>
<div class="timer-section">
{% if active_entry %}
<div class="active-timer">
<h3>Currently Working</h3>
<p>Started at: {{ active_entry.arrival_time.strftime('%Y-%m-%d %H:%M:%S') }}</p>
<div id="timer"
data-start="{{ active_entry.arrival_time.timestamp() }}"
data-breaks="{{ active_entry.total_break_duration }}"
data-paused="{{ 'true' if active_entry.is_paused else 'false' }}">00:00:00</div>
{% if active_entry.is_paused %}
<p class="break-info">On break since {{ active_entry.pause_start_time.strftime('%H:%M:%S') }}</p>
{% endif %}
{% if active_entry.total_break_duration > 0 %}
<p class="break-total">Total break time: {{ '%d:%02d:%02d'|format(active_entry.total_break_duration//3600, (active_entry.total_break_duration%3600)//60, active_entry.total_break_duration%60) }}</p>
{% endif %}
<div class="button-group">
<button id="pause-btn" class="{% if active_entry.is_paused %}resume-btn{% else %}pause-btn{% endif %}" data-id="{{ active_entry.id }}">
{% if active_entry.is_paused %}Resume work{% else %}Pause{% endif %}
</button>
<button id="leave-btn" class="leave-btn" data-id="{{ active_entry.id }}">Leave</button>
</div>
</div>
{% else %}
<div class="inactive-timer">
<h3>Not Currently Working</h3>
<button id="arrive-btn" class="arrive-btn">Arrive</button>
</div>
{% endif %}
</div>
<div class="history-section">
<h3>Time Entry History</h3>
{% if history %}
<table class="time-history">
<thead>
<tr>
<th>Date</th>
<th>Arrival</th>
<th>Departure</th>
<th>Work Duration</th>
<th>Break Duration</th>
</tr>
</thead>
<tbody>
{% for entry in history %}
<tr>
<td>{{ entry.arrival_time.strftime('%Y-%m-%d') }}</td>
<td>{{ entry.arrival_time.strftime('%H:%M:%S') }}</td>
<td>{{ entry.departure_time.strftime('%H:%M:%S') }}</td>
<td>{{ '%d:%02d:%02d'|format(entry.duration//3600, (entry.duration%3600)//60, entry.duration%60) }}</td>
<td>{{ '%d:%02d:%02d'|format(entry.total_break_duration//3600, (entry.total_break_duration%3600)//60, entry.total_break_duration%60) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No time entries recorded yet.</p>
{% endif %}
</div>
</div>
<div class="features">
<div class="feature">
<h3>Easy Time Tracking</h3>
<p>Simply click "Arrive" when you start working and "Leave" when you're done.</p>
</div>
<div class="feature">
<h3>Break Management</h3>
<p>Use the Pause button when taking breaks. Your break time is tracked separately.</p>
</div>
<div class="feature">
<h3>Detailed History</h3>
<p>View your complete work history with precise timestamps and durations.</p>
</div>
<div class="feature">
<h3>Simple Interface</h3>
<p>No complicated setup or configuration needed. Start tracking right away!</p>
</div>
</div>
{% endblock %}

32
templates/layout.html Normal file
View File

@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TimeTrack - {{ title }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="{{ url_for('home') }}">Home</a></li>
<li><a href="{{ url_for('about') }}">About</a></li>
<li><a href="{{ url_for('contact') }}">Contact</a></li>
<!-- Add this to your navigation menu -->
<li><a href="{{ url_for('config') }}" {% if title == 'Configuration' %}class="active"{% endif %}>Configuration</a></li>
</ul>
</nav>
</header>
<main>
{% block content %}{% endblock %}
</main>
<footer>
<p>&copy; 2023 TimeTrack</p>
</footer>
<script src="{{ url_for('static', filename='js/script.js') }}"></script>
</body>
</html>

51
templates/timetrack.html Normal file
View File

@@ -0,0 +1,51 @@
{% extends "layout.html" %}
{% block content %}
<div class="timetrack-container">
<h1>Time Tracking</h1>
<div class="timer-section">
{% if active_entry %}
<div class="active-timer">
<h2>Currently Working</h2>
<p>Started at: {{ active_entry.arrival_time.strftime('%Y-%m-%d %H:%M:%S') }}</p>
<div id="timer" data-start="{{ active_entry.arrival_time.timestamp() }}">00:00:00</div>
<button id="leave-btn" class="leave-btn" data-id="{{ active_entry.id }}">Leave</button>
</div>
{% else %}
<div class="inactive-timer">
<h2>Not Currently Working</h2>
<button id="arrive-btn" class="arrive-btn">Arrive</button>
</div>
{% endif %}
</div>
<div class="history-section">
<h2>Time Entry History</h2>
{% if history %}
<table class="time-history">
<thead>
<tr>
<th>Date</th>
<th>Arrival</th>
<th>Departure</th>
<th>Duration</th>
</tr>
</thead>
<tbody>
{% for entry in history %}
<tr>
<td>{{ entry.arrival_time.strftime('%Y-%m-%d') }}</td>
<td>{{ entry.arrival_time.strftime('%H:%M:%S') }}</td>
<td>{{ entry.departure_time.strftime('%H:%M:%S') }}</td>
<td>{{ '%d:%02d:%02d'|format(entry.duration//3600, (entry.duration%3600)//60, entry.duration%60) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No time entries recorded yet.</p>
{% endif %}
</div>
</div>
{% endblock %}