{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load manager_extras %}


{% block title %}{% trans "Edit meal item" %}{% endblock %}


{% block header %}
<script type="text/javascript">
$(document).ready(function() {
    // Init the autocompleter
    init_ingredient_autocompleter();
});
</script>
{% endblock %}




{% block content %}

<h2>{% trans "Edit meal item" %}</h2>

<form action="{% url wger.nutrition.views.edit_meal_item plan.id meal.id meal_item.id%}{% if js_active %}?js=on{% endif %}"
      method="post"
      class="ym-form">
{% csrf_token %}
{{ form.non_field_errors }}
<table>
    {% yaml_form_field form.amount_gramm %}
    {% if js_active %}
        <input type="hidden" id="id_ingredient" name="ingredient" value="{{ingredient}}">
    {% else %}
        {% yaml_form_field form.amount_gramm %}
        {% yaml_form_field form.ingredient %}
    {% endif %}
    <tr>
        <td style="text-align:right;">
            {% trans "Ingredient name" %}
        </td>
        <td>
            <div class="ym-fbox-text">
            <input type="text"
                   id="id_ingredient_searchfield"
                   name="ingredient_searchfield"
                   value="{{ingredient_searchfield}}">
            </div>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="{% trans 'Save' %}" id="form-save">
        </td>
    </tr>
</table>
</form>



{% endblock %}
