{% extends "base_generic.html" %}

{% load staticfiles %}

{% block title %}{{ title }}{% endblock %}

{% block heading %}{{ title }}{% endblock %}

{% block content %}

  <div class="row">
    <div class="large-12 columns">
      {% if list_id %}
      <h3>List '{{list_id}}' of entities in collection '{{coll_id}}'</h3>
      {% else %}
      <h3>List of entities in collection '{{coll_id}}'</h3>
      {% endif %}
    </div>
  </div>

  <div class="row">
    <div class="small-12 columns">
      <form method="POST" action="">
        {% csrf_token %}
        <div class="row">
          <div class="small-12 medium-5 columns">
            <div class="row">
              <div class="view_label small-12 medium-3 columns">
                <p>Search</p>
              </div>
              <div class="small-12 medium-9 columns end">
                <input type="text" name="search_for" value="{{search_for}}" />
              </div>
            </div>
          </div>
          <!--
          -->
          {% with field=list_choices %}
          {% include field.field_render_edit %}
          {% endwith %}
          <div class="small-12 medium-2 columns text-right">
            <div class="row">
              <div class="small-12 columns right">
                <input type="submit" name="view" value="View" />
                <!--
                <button type="submit" name="search" value="Search">
                <img src="{% static 'images/icons/search_32.png' %}"/>
                </button>
                -->
              </div>
            </div>
          </div>
        </div>
        <!-- - - - - -  row data here - - - - - -->
        <div class="row">
          <div class="small-12 columns">
            <table width="100%">
              <thead>
                <tr>
                {% for field in fields %}
                  {% include field.field_render_head %}
                {% endfor %}
                <th>&nbsp;</th>
                </tr>
              </thead>
              <tbody>
              {% for entity in entities %}
                <tr class="select_row">
                {% for field in entity.fields %}
                  {% include field.field_render_item %}
                {% endfor %}
                <td class="select_row">
                   <input type="checkbox" name="entity_select" 
                          value="{{entity.type_id}}/{{entity.entity_id}}" />
                </td>
                </tr>
              {% endfor %}
              </tbody>
            </table>
          </div>
        </div>

        <div class="row">
          <div class="small-12 columns">
            <input type="submit" name="new"             value="New" />
            <input type="submit" name="copy"            value="Copy" />
            <input type="submit" name="edit"            value="Edit" />
            <input type="submit" name="delete"          value="Delete" />
          </div>
          <div class="small-3 columns">
            <input type="submit" name="close"           value="Close" />
          </div>
          <div class="small-9 columns text-right">
            <!-- list_id:{{list_id}}, list_id_url:{{list_id_url}} -->
            <input type="submit" name="default_view"    value="Set default" {{default_view_enable}} />
            <input type="submit" name="customize"       value="Customize" />
          </div>
          <input type="hidden" name="continuation_url"    value="{{continuation_url}}"/>
        </div>
      </form>
    </div>
  </div>

{% endblock %}
