{% load i18n %}
{% if preview_count == 0 %}
    <div class="empty-courserun-text">{% trans "No course runs currently have an About page preview available for course team review." %}</div>
{% else %}
    <p>
        {% trans "About page previews for the following course runs are available for course team review. After the course team approves the preview, the edX publisher will publish the About page for the course run on edx.org. The course team will receive an email message when the About page has been published." %}
    </p>
    <div class="table-view">
        <table class="data-table-preview display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th role="button">
                        {% trans "Course Name" %}
                    </th>
                    <th role="button">
                        {% trans "Organization" %}
                    </th>
                    <th role="button">
                        {% trans "Status" %}
                    </th>
                    <th>
                        {% trans "Course start date" %}
                    </th>
                </tr>
            </thead>
            <tbody>
                {% for course_run in preview_course_runs %}
                    <tr>
                        <td id="course-title-{{ course_run.title }}">
                            <a href="{% url 'publisher:publisher_course_run_detail' course_run.id %}">{{ course_run.title }}</a>
                            <br>
                            <a target="_blank" href="{{ course_run.preview_url }}">{{ course_run.preview_url }}</a>
                        </td>
                        <td>
                        {{ course_run.course.organization_name }}
                        </td>
                        <td>
                            {% if course_run.course_run_state.preview_accepted %}
                                {% trans "Approved since " %}
                            {% elif course_run.preview_declined and not course_run.preview_url %}
                                {% trans "Declined since " %}
                            {% elif not course_run.preview_url %}
                                {% trans "Preview Requested since " %}
                            {% else %}
                                {% trans "In Review since " %}
                            {% endif %}
                            {{ course_run.owner_role_modified }}
                        </td>
                        <td data-order="{{ course_run.start|date:"Y-m-d" }}">
                            {{ course_run.start }}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
{% endif %}
