Add meal v2 flow and user timezone support

Introduces a new add_meal_v2 blueprint with barcode scanning, item search, and improved meal logging UI. Adds user timezone support: login form now captures timezone, User model and database schema updated, and timezone is set on login. Refactors templates and forms to support these changes, and removes the old login template.
This commit is contained in:
2025-08-14 06:08:17 +02:00
parent 7ff345d3a2
commit d78f48710e
14 changed files with 503 additions and 43 deletions

View File

@@ -52,7 +52,7 @@
</a>
<!-- Center Button (highlighted) -->
<a href="{{ url_for('add_meal.step1', meal_type=0) }}"
<a id="set_link_date" href="{{ url_for('add_meal.step1', meal_type=0) }}"
class="btn btn-success flex-fill mx-2 fw-bold rounded-pill">
Add Item
</a>
@@ -64,4 +64,21 @@
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
function formatToday() {
const today = new Date();
const yyyy = today.getFullYear();
const mm = String(today.getMonth() + 1).padStart(2, '0');
const dd = String(today.getDate()).padStart(2, '0');
return `${yyyy}-${mm}-${dd}`;
}
const link = document.getElementById('set_link_date');
const todayString = formatToday();
// Set href on page load
link.href = `/select_date?date=${todayString}`;
</script>
{% endblock %}