{% import 'macros/forms.html' as forms %}
{% import 'macros/modal.html' as modal %}


{% macro antibody_add_form(form, endpoint, method, id) %}

    {% if id == -1 %}
        {% set action = url_for(endpoint) %}
        {% set title = 'Add Antibody' %}
    {% else %}
        {% set action = url_for(endpoint, id_=id) %}
        {% set title = 'Edit Antibody' %}
    {% endif %}

    {% set modal_id = 'modal-edit-antibody-' ~ id %}
    {% set form_id = 'form-edit-antibody-' ~ id %}

    {% call modal.modal(id=modal_id, title=title) %}

        <form action="{{ action }}" method="get" id="{{ form_id }}">

            {{ form.hidden_tag() }}

            <div class="row mb-3">
                {{ forms.field_row(form.label, 'Name') }}
            </div>

            <div class="row mb-3">
                {{ forms.field_row(form.clone, 'Clone') }}
            </div>

            <div class="row mb-3">
                {{ forms.field_row(form.host, 'Host') }}
            </div>

            <div class="row mb-3">
                {{ forms.field_row(form.antigen, 'Antigen') }}
            </div>

            <div class="row mb-3">
                {{ forms.field_row(form.specification, 'Clonality') }}
            </div>

            <div class="row mb-3">
                {{ forms.field_row(form.storage_temp, 'Store at') }}
            </div>

            <div class="row mb-3">
                {{ forms.field_row(form.conjugate, 'Conjugate') }}
            </div>

            <div class="row mb-3">
                <div class="col-sm-10">
                    {{ form.submit() }}
                </div>
            </div>

        </form>

        <div id="{{ form_id }}-messages"></div>

        {{ forms.script_send_form(
            form=form,
            form_name=form_id,
            method=method,
            message_field=form_id ~ '-messages'
         ) }}

    {% endcall %}


{% endmacro %}