{% extends request.resolver_match.app.base_template_name|default:'viewflow/base_page.html' %}
{% load i18n viewflow %}


{% block content %}
  <div class="mdc-layout-grid vf-page__grid">
    <div class="mdc-layout-grid__inner vf-page__grid-inner">
      <div class="mdc-layout-grid__cell {% block detail-cell-span %}mdc-layout-grid__cell--span-10-desktop mdc-layout-grid__cell--span-8-tablet mdc-layout-grid__cell--span-4-phone{% endblock %}">
        <div class="mdc-card vf-card">
          <section class="vf-card__header">
            <h1 class="vf-card__title">{% trans "Assign selected tasks" %}</h1>
            <h2 class="vf-card__breadcrumbs">
              <a href="{% reverse viewset 'queue' %}">{% trans 'Queue' %}</a>
              <a>{% trans 'Assign' %}</a>
            </h2>
          </section>
          <vf-form>
            <form class="vf-form" method="POST" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
              {% csrf_token %}
              {{ form }}
              <section class="vf-card__form">
                <table class="vf-list__table">
                  <thead>
                    <tr>
                      <th class="vf-list__table-header vf-list__table-header-text">#</th>
                      <th class="vf-list__table-header vf-list__table-header-text">{% trans "Task" %}</th>
                      <th class="vf-list__table-header vf-list__table-header-text">{% trans "Brief" %}</th>
                      <th class="vf-list__table-header vf-list__table-header-text">{% trans "Process brief" %}</th>
                      <th class="vf-list__table-header vf-list__table-header-text">{% trans "Created" %}</th>
                    </tr>
                  </thead>
                  <tbody>
                    {% for task in view.get_queryset %}
                      <tr>
                        <td>#{{ task.process_id }}/{{ task.id }}</td>
                        <td>{{ task.flow_task }}</td>
                        <td>{{ task.brief }}</td>
                        <td>{{ task.process.brief }}</td>
                        <td>{{ task.created|timesince }}</td>
                      </tr>
                    {% endfor %}
                  </tbody>
                </table>
              </section>
              <section class="mdc-card__actions vf-card__actions">
                <a class="mdc-button mdc-card__action mdc-card__action--button" name="_confirm" style="margin-right: auto;" onclick="window.history.back(-1);setTimeout(()=>Turbo.visit('.'), 100)"><i class="material-icons">arrow_back</i>&nbsp;&nbsp;{% trans "Back" %}  </a>
                <input class="mdc-button mdc-card__action mdc-card__action--button mdc-button--raised" type="submit" name="_confirm" value="{% trans "confirm" %}">
              </section>
            </form>
          </vf-form>
        </div>
      </div>
    </div>
  </div>
{% endblock content %}
