mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-30 19:29:59 +00:00
Implemented routes and forms for adding and viewing food items by barcode, including templates for displaying and entering nutritional information. Enhanced the scan workflow to redirect to food item details or entry form. Added admin ability to delete food items. Improved UI for login and scan pages. Updated FoodItem model and form fields for consistency and accuracy.
47 lines
1.6 KiB
HTML
47 lines
1.6 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}
|
|
Food Nutritional Info
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<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>
|
|
<th>Actions</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>
|
|
<td>
|
|
<form method="POST" action="{{ url_for('admin.delete_food', id=food.id) }}"
|
|
onsubmit="return confirm('Are you sure you want to delete this item?');">
|
|
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock%} |