Files
Django_TasksApp/main/food/templates/food/inventory_external.html
T
2026-10-07 14:33:21 +02:00

4 lines
1.4 KiB
HTML

{% extends 'planner/base.html' %}{% load static %}
{% block title %}Search products · Tasknest{% endblock %}
{% block content %}<link rel="stylesheet" href="{% static 'food/food.css' %}"><div class="food-form-page"><a href="{% url 'food:inventory-add' %}">← Add item</a><h1>Search Open Food Facts</h1><form method="post" class="food-search">{% csrf_token %}<label for="inventory-external-query">Product name</label><input id="inventory-external-query" name="q" type="search" value="{{ query }}" required><button class="button" type="submit">Search</button></form>{% if notice %}<p role="status">{{ notice }}</p>{% endif %}<ul class="food-product-list">{% for item in results %}<li><form method="post" action="{% url 'food:inventory-lookup' %}">{% csrf_token %}<input type="hidden" name="barcode" value="{{ item.barcode }}"><button type="submit" class="food-result-button">{% if item.image_url %}<img src="{{ item.image_url }}" alt="" loading="lazy">{% endif %}<span><strong>{{ item.product_name }}</strong>{% if item.brand %}<small>{{ item.brand }}</small>{% endif %}</span></button></form></li>{% empty %}{% if request.method == 'POST' and not notice %}<li>No products found. <a href="{% url 'food:inventory-manual' %}">Create one manually</a>.</li>{% endif %}{% endfor %}</ul><p class="food-attribution">Product data from <a href="https://world.openfoodfacts.org/" rel="noopener noreferrer">Open Food Facts</a>.</p></div>{% endblock %}