{% extends "nopaque.html.j2" %}

{% block page_content %}
<div class="col s12 m4">
  <h3>{{ corpus.title }}</h3>
  <p>Fill out the following form to add a corpus file in verticalized text format (.vrt).</p>
  <a class="waves-effect waves-light btn" href="{{ url_for('corpora.corpus', corpus_id=corpus.id) }}"><i class="material-icons left">arrow_back</i>Back to corpus</a>
</div>

<div class="col s12 m8">
  <form method="POST" enctype="multipart/form-data">
  <div class="card">
      <div class="card-content">
        <span class="card-title">Required metadata</span>
        {{ add_corpus_file_form.hidden_tag() }}
        <div class="row">
          <div class="col s12 m4">
            <div class="input-field">
              <i class="material-icons prefix">person</i>
              {{ add_corpus_file_form.author(data_length='255') }}
              {{ add_corpus_file_form.author.label }}
              {% for error in add_corpus_file_form.author.errors %}
                <span class="helper-text red-text">{{ error }}</span>
              {% endfor %}
            </div>
          </div>
          <div class="col s12 m4">
            <div class="input-field">
              <i class="material-icons prefix">title</i>
              {{ add_corpus_file_form.title(data_length='255') }}
              {{ add_corpus_file_form.title.label }}
              {% for error in add_corpus_file_form.title.errors %}
                <span class="helper-text red-text">{{ error }}</span>
              {% endfor %}
            </div>
          </div>
          <div class="col s12 m4">
            <div class="input-field">
              <i class="material-icons prefix">access_time</i>
              {{ add_corpus_file_form.publishing_year() }}
              {{ add_corpus_file_form.publishing_year.label }}
              {% for error in add_corpus_file_form.publishing_year.errors %}
                <span class="helper-text red-text">{{ error }}</span>
              {% endfor %}
            </div>
          </div>
          <div class="col s12">
            <div class="file-field input-field">
              <div class="btn">
                <span>{{ add_corpus_file_form.file.label.text }}</span>
                {{ add_corpus_file_form.file(accept='.vrt') }}
              </div>
              <div class="file-path-wrapper">
                <input class="file-path validate" type="text">
              </div>
              {% for error in add_corpus_file_form.file.errors %}
                <span class="helper-text red-text">{{ error }}</span>
              {% endfor %}
            </div>
          </div>
        </div>
      </div>
      <div class="card-action right-align">
        {{ macros.submit_button(add_corpus_file_form.submit) }}
      </div>
    </div>
    <br>
    <ul class="collapsible hoverable">
      <li>
        <div class="collapsible-header"><i class="material-icons">add</i>Add additional metadata</div>
        <div class="collapsible-body">
          <span>
            <div class="row">
              <div class="col s12">
                {% for field in add_corpus_file_form if not (field.name == "file"
                  or field.name == "author"
                  or field.name == "submit"
                  or field.name == "csrf_token"
                  or field.name == "title"
                  or field.name == "publishing_year") %}
                  {{ macros.render_field(field)}}
                {% endfor %}
              </div>
            </div>
          </span>
        </div>
      </li>
    </ul>
    <br>
    <ul class="collapsible hoverable">
      <li>
        <div class="collapsible-header"><i class="material-icons">add</i>Add metadata with BibTex</div>
        <div class="collapsible-body">
          <span>
            <div class="row">
              <div class="col s12">

              </div>
            </div>
          </span>
        </div>
      </li>
    </ul>
  </form>
</div>
{% endblock %}
