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


{% macro upload_file_form(form, endpoint) %}

    {% set title = 'Import from file' %}
    {% set modal_id = 'modal-import-file' %}

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

        <form action="{{ endpoint }}"
              method="POST"
              enctype=multipart/form-data
              id="form-edit-file-{{ id }}">

            {{ form.hidden_tag() }}

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

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

        </form>

    {% endcall %}

{% endmacro %}


{% macro map_columns_form(form, endpoint) %}

    <form method="post">

            {{ form.hidden_tag() }}

            {% for field in form.mapping.entries %}
                <div class="row mb-3">
                    {{ forms.field_row(field, field.label) }}
                </div>
            {% endfor %}
            <div>
                {{ form.submit() }}
            </div>
        </form>

{% endmacro %}