mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-30 11:19:59 +00:00
Refactor food item model and add barcode scanner page
Renamed FoodItems to FoodItem and Units to Unit in models.py, updated related imports and usage throughout the codebase. Added a barcode scanner test page using ZXing in the admin section. Improved food_items.html to display nutritional information in a table. Registered the admin blueprint in app.py and cleaned up blueprint registration in __init__.py. Updated seed.py to use the new FoodItem model.
This commit is contained in:
@@ -1,5 +1,40 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
Food Nutritional Info
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Hallo
|
||||
<div class="container mt-5">
|
||||
<h1 class="mb-4">Food Nutritional Information (per 100g)</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover align-middle">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Energy (kcal)</th>
|
||||
<th>Fats (g)</th>
|
||||
<th>Saturated Fats (g)</th>
|
||||
<th>Sugars (g)</th>
|
||||
<th>Carbs (g)</th>
|
||||
<th>Protein (g)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for food in items %}
|
||||
<tr>
|
||||
<td>{{ food.name }}</td>
|
||||
<td>{{ food.energy_100g }}</td>
|
||||
<td>{{ food.fats_100g }}</td>
|
||||
<td>{{ food.saturated_fats_100g }}</td>
|
||||
<td>{{ food.sugar_100g }}</td>
|
||||
<td>{{ food.carbs_100g }}</td>
|
||||
<td>{{ food.protein_100g }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock%}
|
||||
Reference in New Issue
Block a user