<div class="panel panel-default">
  <div class="panel-body">
    {{ render(controller('AppBundle:Classroom/Classroom:dashboard',{classroom:classroom, nav:nav, member:member})) }}
    {% if courses is empty %}
      <ul class="media-list">
        <li class="mvl tac color-gray">{{'course.content_empty'|trans}}</li>
      </ul>
    {% else %}
      <div class="class-content">
        <div class="class-about">
          <p>
            {{classroom.description|cdn|raw}}
          </p>
        </div>
        <ul class="class-course">
          {% for course in courses %}
          <li class="course-item">
            <a class="course-priture" href="{{path('course_show',{id:course.id})}}" target="_blank">
              <img src="{{ filepath(course.middlePicture, 'course.png') }}" >
            </a>
            <div class="course-body">
              <h4 class="title">
                <a href="{{path('course_show',{id:course.id})}}" target="_blank">{{course.title}}</a>
              </h4>
              <div class="metas">
                <span class="period">{{'course.lesson_num'|trans({'%lessonNum%':course.lessonNum})}}</span>
                <span class="price">
                {% if courseMembers[course.id] and not member and setting('classroom.discount_buy') %}
                {{'course.member_buyed'|trans}}
                {% else %}
                  {% if member and not 'auditor' in member.role %}
                    {% if courseMembers[course.id] and courseMembers[course.id].learnedNum == 0 %}
                    {{'course.member_learn_status.none'|trans}}
                    {% elseif courseMembers[course.id] and courseMembers[course.id].learnedNum == course.lessonNum %}
                    <span class="color-success">{{'course.member_learn_status.learned'|trans}}</span>
                    {% elseif courseMembers[course.id] and courseMembers[course.id].learnedNum < course.lessonNum %}
                    <span class="text-info">{{'course.member_learn_status.learning'|trans}}</span>
                    {% else %}
                    {{'course.member_learn_status.none'|trans}}
                    {% endif %} 


                  {% elseif courseMembers[course.id] and member and 'auditor' in member.role  and setting('classroom.discount_buy') %}
                  {{'course.member_buyed'|trans}}
                  {% else %}
                      {% if setting('coin.coin_enabled') and setting('coin. price_type') == 'Coin' %}

                        {% if course.price * setting('coin.cash_rate') > 0 %}
                        {{course.price * setting('coin.cash_rate') }} {{setting('coin.coin_name')}} 
                        {% else %}{{'course.price.free'|trans}}{% endif %}

                      {% else %}

                        {% if course.price > 0 %}
                           {{ course.price }}{{'site.currency.CNY'|trans}}
                        {% else %}{{'course.price.free'|trans}}{% endif %}

                      {% endif %}

                  {% endif %}

                {% endif %}
                </span>
              </div>
              <div class="metas">
                <span class="class-teacher">
                  <i class="es-icon es-icon-groupadd"></i>
                  {% set teacher = teachers[course.id]|default(null) %}
                    {% if teacher %}
                    {% for user in teacher%}
                    {% if loop.index <= 3%}
                      <a class="teacher-nickname mrl" href="{{ path('user_show', {id:user.id}) }}" target="_blank">{{ user.nickname }}</a>
                    {% endif %}
                    {% endfor %}
                    {% endif %}
                </span>
                {% if setting('course.show_student_num_enabled', '1') == 1  %}
                <span class="class-student"><i class="es-icon es-icon-groupadd"></i>{{course.studentNum}}</span>
                {% endif %}
                <span class="stars-{{ (course.rating)|number_format }} pull-right hidden-xs">&nbsp;</span>
              </div>
            </div>
          </li>
          {% endfor %}
        </ul>
      </div>
    {% endif %}
  </div>
</div>