{% extends "base.html.j2" %}
{% from "corpora/_breadcrumbs.html.j2" import breadcrumbs with context %}
{% import "materialize/wtf.html.j2" as wtf %}

{% block main_attribs %} class="service-scheme" data-service="corpus-analysis"{% endblock main_attribs %}

{% block page_content %}
<div class="container">
  <div class="row">
    <div class="col s12">
      <h1 id="title">{{ title }}</h1>
    </div>

    <div class="col s12 m4">
      <p>Fill out the following form to add a corpus file in verticalized text format (.vrt).</p>
    </div>

    <div class="col s12 m8">
      <form class="create-corpus-file-form" enctype="multipart/form-data" method="POST">
        <div class="card">
          <div class="card-content">
            {{ form.hidden_tag() }}
            <div class="row">
              <div class="col s12 m4">
                {{ wtf.render_field(form.author, material_icon='person') }}
              </div>
              <div class="col s12 m4">
                {{ wtf.render_field(form.title, material_icon='title') }}
              </div>
              <div class="col s12 m4">
                {{ wtf.render_field(form.publishing_year, material_icon='access_time') }}
              </div>
              <div class="col s12">
                {{ wtf.render_field(form.vrt, accept='.vrt', placeholder='Choose your .vrt file') }}
              </div>
            </div>
          </div>
          <div class="card-action right-align">
            <a class="waves-effect waves-light btn red" href="{{ url_for('.corpus', corpus_id=corpus.id) }}"><i class="material-icons left">close</i>Cancel</a>
            {{ wtf.render_field(form.submit, material_icon='send') }}
          </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">
              {% for field in form
                 if field.short_name not in ['author', 'csrf_token', 'vrt', 'publishing_year', 'submit', 'title'] %}
              {{ wtf.render_field(field, material_icon=field.label.text[0:1]) }}
              {% endfor %}
            </div>
          </li>
        </ul>
      </form>
    </div>
  </div>
</div>
{% endblock page_content %}
