{% extends 'admin-v2/layout.html.twig' %}

{% set menu = 'admin_v2_open_course' %}

{% set script_controller = 'course/manage' %}
{%
    set script_arguments = {
    tagMatchUrl: path('tag_match')
}
%}
{% block main %}
    {% include 'admin-v2/teach/open-course/course-search-form.html.twig' with {actionUrl:path('admin_v2_open_course'),showStatusSelect:1} %}

    {% if not setting('cloud_sms.sms_enabled',0) or (setting('cloud_sms.sms_enabled',0) and setting('cloud_sms.sms_live_play_one_day') == 'off' and setting('cloud_sms.sms_live_play_one_hour') == 'off') %}
        <div class="alert alert-warning">{{ 'admin.open_manage.manage.open_cloud_sms_tips'|trans }}&nbsp;&nbsp;{% if 'ROLE_SUPER_ADMIN' in app.user.roles%}{{ 'admin.open_manage.manage.open_cloud_sms'|trans({'%cloudSmsUrl%': path('admin_v2_edu_cloud_sms_overview')})|raw }}{% endif %}</div>
    {% endif %}

    <table class="table table-striped table-hover" id="course-table" style="word-break:break-all;">
        <thead>
        <tr>
            {% if setting('magic.enable_org','0') %}
                <th><input type="checkbox"  data-role="batch-select"></th>
            {% endif %}
            <th>{{ 'admin.open_manage.manage.number_th'|trans }}</th>
            <th width="40%">{{ 'admin.open_manage.manage.name_th'|trans }}</th>
            <th>{{ 'admin.open_manage.manage.status_th'|trans }}</th>
            {% include 'org/parts/table-thead-tr.html.twig' %}
            <th>{{ 'admin.open_manage.manage.creator_th'|trans }}</th>
            <th>{{ 'admin.open_manage.manage.operater_th'|trans }}</th>
        </tr>
        </thead>
        <tbody>
        {% for course in courses %}
            {% set user = users[course.userId]|default(null) %}
            {% set category = categories[course.categoryId]|default(null) %}
            {% include 'admin-v2/teach/open-course/tr.html.twig' %}
        {% else %}
            <tr><td colspan="20"><div class="empty">{{ 'admin.open_manage.empty'|trans }}</div></td></tr>
        {% endfor %}
        </tbody>
    </table>
    {% include 'org/batch-update-org-btn.html.twig' with {module:'openCourse', formId:'course-table'} %}
    {{ admin_macro.paginator(paginator) }}

{% endblock %}
