{% load i18n %}

<div class="course-widgets">


    <div class="clearfix"></div>

    <div>
        <h5 class="hd-5 emphasized course-runs-heading">{% trans "COURSE RUNS" %}</h5>
        <a href="{% url 'publisher:publisher_course_runs_new' parent_course_id=object.id %}" class="btn btn-brand btn-small btn-courserun-add">
            {% trans "CREATE RUN" %}
        </a>
    </div>
    <div class="course-run-list">
        {% if course.course_runs %}
        {% for course_run in course.course_runs %}
            <div class="layout-1t2t layout-reversed course-run-item">
                <div class="layout-col layout-col-a created-by">
                    {% blocktrans with created_date=course_run.created.date created_time=course_run.created.time created_by=course_run.created_by %}
                        Created {{ created_date }} at {{ created_time }} by {{ created_by }}
                    {% endblocktrans %}
                </div>
                <div class="layout-col layout-col-b course-run-details">
                    <div class="courserun-details">
                        <a class="courserun-detail-link" href="{% url 'publisher:publisher_course_run_detail' pk=course_run.id %}">
                            {{ course_run.start.date }} - {{ course_run.get_pacing_type_display }}
                        </a>
                    </div>
                    <div class="studio-url">
                        <span class="studio-url-heading">{% trans "STUDIO URL" %} - </span>
                        {% if course_run.studio_url %}
                            <a class="studio-link" href="{{ course_run.studio_url }}" target="_blank">{{ course_run.lms_course_id }}</a>
                        {% else %}
                            {% trans "To be added by edX" %}
                        {% endif %}
                    </div>
                </div>
            </div>
        {% endfor %}
        {% else %}
        <div class="course-run-item">
            {% trans "No course runs exist for this course" %}
        </div>
        {% endif %}
    </div>

    <div class="approval-widget {% if not publisher_approval_widget_feature %}hidden{% endif %}">
      {% include 'publisher/_approval_widget.html' %}
    </div>
</div>

{% if add_warning_popup %}
    {% include 'publisher/course_detail/_edit_warning_popup.html' %}
{% endif %}
