{% extends "base.html" %} {% block content %}

Edit Recipe

{% if current_user.role in ('admin', 'moderator') %} {% endif %} {{ 'Back to Flagged' if request.args.get('return_to') == 'flagged' else 'Back to Recipe' }}
{# ═══ FLAGGED RECIPE PANEL ═══ #} {% if recipe.is_flagged %} {% if flag_data and flag_data.get('unmatched_ingredients') %}
Flagged: {{ flag_data.get('unmatched_ingredients', [])|length }} Unmatched Ingredient(s)

{{ flag_data.get('message', '') }}

{% for item in flag_data.get('unmatched_ingredients', []) %} {% endfor %}
AI-Extracted NameQtyUnitModifiersPkg SizeStatusAction
{{ item.raw_name }} {{ item.quantity or '—' }} {{ item.raw_unit or '—' }}{% if item.matched_unit and item.matched_unit != item.raw_unit %}
→ {{ item.matched_unit }}{% endif %}
{{ item.modifiers or '—' }} {{ item.package_size or '—' }} {% if item.pending_ingredient_id %}Pending #{{ item.pending_ingredient_id }}{% else %}No Match{% endif %}
{% if flag_data.get('unit_warnings') %}
Unit warnings: {{ flag_data.unit_warnings | join('; ') }}
{% endif %} {% if current_user.role in ('admin', 'moderator') %}
{% endif %}
{% elif flag_data and flag_data.get('message') %}
Flagged: {{ flag_data.get('message', '') }} {% if current_user.role in ('admin', 'moderator') %}
{% endif %}
{% else %}
Flagged: {{ recipe.flag_notes or 'This recipe has been flagged for review.' }} {% if current_user.role in ('admin', 'moderator') %}
{% endif %}
{% endif %} {% endif %}
Edit your recipe details below. All changes save when you click Update.
Ingredients
Qty *
Unit
Ingredient *
{% if ingredients %} {% set ns = namespace(current_group=none) %} {% for ing in ingredients %} {% if ing.group_label and ing.group_label != ns.current_group %} {% set ns.current_group = ing.group_label %}
section
{% endif %} {% set pkg_parts = (ing.package_size or '').split(' ', 1) %} {% set pkg_qty_val = pkg_parts[0] if pkg_parts|length > 1 else '' %} {% set pkg_unit_val = pkg_parts[1] if pkg_parts|length > 1 else '' %} {# Build modifier IDs and names from junction table #} {% set _mod_ids = [] %} {% set _mod_names = [] %} {% for ml in ing.modifier_links %} {% if ml.modifier %} {% if _mod_ids.append(ml.modifier_id|string) %}{% endif %} {% if _mod_names.append(ml.modifier.name) %}{% endif %} {% endif %} {% endfor %} {% set mod_ids_csv = _mod_ids|join(',') %} {% set mod_names_display = _mod_names|join(', ') %} {% set has_mods = ing.ingredient_id in ingredients_with_modifiers or _mod_ids|length > 0 %}
{% endfor %} {% else %}
{% endif %}
Instructions
Cancel
{# ═══ MEDIA DRAWER ═══ #}
Media & Attachments

Photos

{% for p in photos %}
Recipe photo {% if recipe.image_filename == p.filename %}Cover{% endif %}
{% if current_user.role in ('admin','moderator') and recipe.image_filename != p.filename %}{% endif %}
{% endfor %}
{% if not photos %}
No photos yet — upload some below.
{% endif %}
🖼️
Drop photos here or click to browse
JPG, PNG, WEBP, GIF — max {{ max_upload_mb|default(16) }} MB each
Uploading…

PDF Attachment

{% if recipe.pdf_filename %}
{{ recipe.pdf_filename }}
View
{% else %}
No PDF attached.
{% endif %}
{# ═══ DELETE RECIPE MODAL ═══ #} {% if current_user.role in ('admin', 'moderator') %} {% endif %} {# ═══ MODIFIER MODAL — dynamic body ═══ #} {% endblock %}