{% extends 'ndr_core/admin_views/base.html' %}

{% block content %}
    <h2><i class="fa-regular fa-check-double"></i> Manage Corrections</h2>
    <div class="card-deck">
        <div class="card bg-light mb-3">
            <div class="card-body">
                <h5 class="card-title">Options</h5>
                <div class="list-group">
                    {% if correction_enabled %}
                        <a href="{% url 'ndr_core:set_correction_option' 'false' %}" class="list-group-item list-group-item-action py-2">
                            <i class="fa-regular fa-toggle-on"></i>
                            Disable Correction Feature
                        </a>
                    {% else %}
                        <a href="{% url 'ndr_core:set_correction_option' 'true' %}" class="list-group-item list-group-item-action py-2">
                            <i class="fa-regular fa-toggle-off"></i>
                            Enable Correction Feature
                        </a>
                    {% endif %}
                    <a href="{% url 'ndr_core:set_correction_option' 'true' %}" class="list-group-item list-group-item-action py-2">
                            <i class="fa-regular fa-file-export"></i>
                            Export All Corrections To TSV
                        </a>
                    <a href="{% url 'ndr_core:help_chapter' 'corrections' %}" class="list-group-item list-group-item-action py-2">
                        <i class="fa-regular fa-circle-info"></i>
                        Help
                    </a>
                </div>
                <p></p>
                <h5 class="card-title">Settings</h5>
                The correction Option is {% if correction_enabled %}<strong class="text-success">enabled</strong>{% else %}<strong class="text-danger">disabled</strong>{% endif %}.
            </div>
        </div>

        <div class="card bg-light mb-3">
            <div class="card-body">
                <h5 class="card-title">Open Suggestions</h5>
                <ul class="list-group">
                    {% for api in apis %}
                        <li class="list-group-item list-group-item-action d-flex py-2">
                            <p class="p-0 m-0 flex-grow-1">
                                <i class="fa-regular fa-code"></i> {{ api.api_label }} ({{ api.api_name }})
                            </p>

                            <p class="p-0 m-0">
                                <a href="{% url 'ndr_core:edit_api' api.id %}" class="btn btn-sm btn-secondary">
                                    <i class="fa-regular fa-pen-to-square"></i>
                                </a>
                                <a href="{% url 'ndr_core:delete_api' api.id %}" class="btn btn-sm btn-danger">
                                    <i class="fa-regular fa-delete-left"></i>
                                </a>
                            </p>
                        </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    </div>

    <div class="alert alert-info small" role="alert">
        <i class="fa-regular fa-circle-info"></i>
        Users can mark returned results if they think they need corrections.
    </div>

{% endblock %}