{% extends "./layout/default" %}

{% block breadcrumbs %}
    {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, job) }}
{% endblock %}

{% block content %}


    <div class="row">
        <div class="col-lg-12">
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">{{ trans('csv.map_title') }}</h3>
                </div>
                <div class="box-body">
                    <p>
                        {{ trans('csv.map_text') }}
                    </p>
                </div>
            </div>

        </div>
    </div>
    <form action="{{ route('import.process-configuration', job.key) }}" method="post">
        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>

        {% for field in data %}
            <div class="row">
                <div class="col-lg-12">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">{{ trans('csv.column_'~field.name) }}</h3>
                        </div>
                        <div class="box-body no-padding">
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th style="width:50%;">{{ trans('csv.map_field_value') }}</th>
                                    <th>{{ trans('csv.map_field_mapped_to') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for option in field.values %}
                                    <tr>
                                        <td>
                                            <code>{{ option }}</code>
                                        </td>
                                        <td>
                                            {{ Form.select('mapping['~field.index~']['~option~']',
                                            field.options,
                                            job.configuration['column-mapping-config'][field.index][option], {class: 'form-control'}) }}
                                        </td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        {% endfor %}


        <div class="row">
            <div class="col-lg-12">
                <div class="box">
                    <div class="box-body">
                        <button type="submit" class="btn btn-success pull-right">
                            {{ trans('csv.map_submit') }} <i class="fa fa-arrow-right"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>

    </form>


{% endblock %}
