{% extends 'activity/activity-layout.html.twig' %}
{% set mediaType = activity.mediaType|default('audio') %}
{% set fileType = 'audio' %}
{% set length = activity.length|default(0)|convert_minute_and_second %}
{% do script(['libs/es-ckeditor/ckeditor.js', 'libs/ltc-sdk-client.js', cloud_sdk_url('uploader'), 'audioactivity/js/create/index.js']) %}
{% block  activity_step %}
  <div class="tab-pane js-course-tasks-pane active js-step2-view">
    <form class="form-horizontal" id="step2-form" data-media-id="{{ activity.mediaId|default(null) }}">
      <div class="form-group">
        <div class="col-sm-2 control-label">
          <label for="title" class="control-label-required">{{ 'course.plan_task.activity_manage.title_name'|trans }}</label>
        </div>
        <div class="col-sm-10">
          <input id="title" class="form-control" type="text" name="title" value="{{ activity.title|default('') }}" >
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-2 control-label">
          <label for="media" class="control-label-required">{{ 'course.plan_task.activity_manage.audio'|trans }}</label>
        </div>
        <div class="col-sm-10">
          {% include 'file-chooser/file-choose.html.twig'with {
            courseId: activity.fromCourseId,
            mediaType: mediaType,
            fileType:'audio',
            file: activity.ext.file|default(null),
            placeholder: 'course.plan_task.activity_manage.audio'|trans
          } %}
        </div>
      </div>
      <div class="form-group for-video-type" id="lesson-length-form-group">
        <div class="col-sm-2 control-label for-video-type">
          <label for="second" class="control-label-required">{{ 'course.plan_task.activity_manage.audio.time'|trans }}</label>
        </div>
        <div class="col-sm-10">
          <input class="form-control width-150 js-length mrs" id="minute" type="text" name="minute" value="{{ length.minute|default(null) }}">{{ 'site.date.minute'|trans }}
          <input class="form-control width-150 js-length mhs" id="second" type="text" name="second" value="{{ length.second|default(null) }}" >{{ 'site.date.second'|trans }}
          <input type="hidden" id="length" name="length" value="{{ activity.length|default(null) }}">
        </div>
      </div>
      <div class="form-group" >
        <div class="col-sm-2 control-label">
          <label for="content">{{ 'ltc.course.plan_task.activity_manage.audio.audio_content'|trans }}</label>
        </div>
        <div class="col-sm-10 controls radios">
          {{ radios('hasText', {'0':'site.data.empty'|trans, '1':'ltc.course.plan_task.activity_manage.audio.text'|trans}, activity.ext.hasText|default(0)) }}
        </div>
      </div>
      <div class="col-sm-10 col-sm-offset-2 js-content" {% if activity.ext.hasText|default(0) == 0 %}style="display: none;"{% endif %}>
        <p>({{'ltc.course.plan_task.activity_manage.audio.text_hint'|trans}})</p>
        <textarea class="form-control" id="audio-content-field" name="content" 
        data-display="{{'ltc.course.plan_task.activity_manage.audio.text_info'|trans}}" 
        data-image-upload-url="{{ path('editor_upload', {token:upload_token('default')}) }}">{{ activity.content|default('') }}</textarea>
      </div>
    </form>
  </div>
{% endblock %}