{% extends 'layouts/app.twig' %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}

{% set title %}{% block title %}{{ __('schedule.import.title') }}{% endblock %}{% endset %}

{% block content %}
    <div class="container">
        <h1>
            {% block content_title %}{{ title }}{% endblock %}

            {% if is_index|default(false) %}
                {{ m.button(m.icon('plus-lg'), url('/admin/schedule/edit'), 'secondary') }}
            {% endif %}
        </h1>

        {% include 'layouts/parts/messages.twig' %}

        <div class="row">
            {% block row_content %}
                <div class="col-md-12">
                    <p>{{ __('schedule.import.text') }}</p>

                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>{{ __('schedule.name') }}</th>
                                <th>{{ __('schedule.url') }}</th>
                                <th></th>
                            </tr>
                            </thead>

                            <tbody>
                            {% for schedule in schedules %}
                                <tr>
                                    <td>{{ schedule.name }}</td>
                                    <td>{{ schedule.url }}</td>
                                    <td>
                                        <div class="btn-group">
                                            <a
                                                href="{{ url('/admin/schedule/load/' ~ schedule.id) }}"
                                                class="btn btn-sm btn-secondary">
                                                {{ __('form.import') }}
                                            </a>
                                            <a
                                                href="{{ url('/admin/schedule/edit/' ~ schedule.id) }}"
                                                class="btn btn-sm btn-secondary">
                                                {{ __('form.edit') }}
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            {% endblock %}
        </div>
    </div>
{% endblock %}