{% 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.roles_title') }}</h3>
                </div>
                <div class="box-body">
                    <p>
                        {{ trans('csv.roles_text') }}
                    </p>
                </div>
            </div>

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

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

                        <table class="table">
                            <thead>
                            <tr>
                                <th style="width:20%;">{{ trans('csv.roles_column_name') }}</th>
                                <th style="width:40%;">{{ trans('csv.roles_column_example') }}</th>
                                <th style="width:30%;">{{ trans('csv.roles_column_role') }}</th>
                                <th style="width:10%;">{{ trans('csv.roles_do_map_value') }}</th>
                            </tr>
                            </thead>
                            {% for i in 0..(data.total -1) %}

                                <tr>
                                    <td>
                                        {% if data.headers[i] == '' %}
                                            {{ trans('csv.roles_column') }} #{{ loop.index }}
                                        {% else %}
                                            {{ data.headers[i] }}
                                        {% endif %}
                                    </td>
                                    <td>
                                        {% if data.examples[i]|length == 0 %}
                                            <em>{{ trans('csv.roles_no_example_data') }}</em>
                                        {% else %}
                                            {% for example in data.examples[i] %}
                                                <code>{{ example }}</code><br/>
                                            {% endfor %}
                                        {% endif %}

                                    <td>
                                        {{ Form.select(('role['~loop.index0~']'),
                                        data.roles,
                                        job.configuration['column-roles'][loop.index0],
                                        {class: 'form-control'}) }}
                                    </td>
                                    <td>
                                        {{ Form.checkbox(('map['~loop.index0~']'),1,
                                        job.configuration['column-do-mapping'][loop.index0]

                                        ) }}
                                    </td>

                                </tr>
                            {% endfor %}


                        </table>


                    </div>
                </div>
            </div>
        </div>

        <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.roles_submit') }} <i class="fa fa-arrow-right"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>


{% endblock %}
