{% load i18n %}

{% if studio_count > 0 %}
    <p>{% trans "The following courses are ready for a Studio URL." %}</p>
        <div class="studio-instance-success depth depth-0">
          <p class="copy-meta"></p>
        </div>
        <div class="alert alert-error alert-slim studio-instance-error hidden">
            <div class="alert-message">
                <p class="copy"></p>
            </div>
        </div>
    <div class="table-view">
        <table class="data-table-studio display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th role="button">
                        {% trans "Course Name" %}
                    </th>
                    <th role="button">
                        {% trans "Organization" %}
                    </th>
                    <th role="button">
                        {% trans "Start Date" %}
                    </th>
                    <th role="button">
                        {% trans "Course Number" %}
                    </th>
                    <th id="column-title" role="button">
                        {% trans "Studio Course Run Key" %}
                    </th>
                </tr>
            </thead>
            <tbody>
                {% for course_run in studio_request_courses %}
                    <tr>
                        {% url 'publisher:publisher_course_run_detail' course_run.id as run_page_url %}
                            <td id="course-title-{{ course_run.title }}">
                                <a href="{{ run_page_url }}" id="course-title">{{ course_run.title }}</a>
                            </td>
                            <td>
                                {{ course_run.course.organization_name }}
                            </td>
                            <td id="course-start">
                                 {{ course_run.start|date:"Y-m-d" }}
                            </td>
                            <td>
                                {{ course_run.number }}
                            </td>
                            <td class="form-group">
                                <input type="text" class="field-input input-text small" aria-labelledby="course-title-{{ course_run.title }} column-title" />
                                <button data-update-course-key-url="{% url 'publisher:api:update_course_run' course_run.id %}" class="btn-inline btn-add-course-key">{% trans "Add" %}</button>
                            </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>

{% else %}
    <div class="empty-courserun-text">{% trans "No courses are currently ready for a Studio URL." %}</div>
{% endif %}
