{% extends "layouts/base.html" %}

{% block container %}
  <div class="row">
    <div class="col-md-8">
      {% for case in cases %}
        <div class="panel panel-default">
          <div class="panel-heading">
            <a href="{{ url_for('public.case', case_id=case.case_id) }}">
              {{ case.name }}
            </a>
            <span class="label label-info">
              {{ case.variant_mode }}
            </span>
            
            <a class="pull-right" href="{{ url_for('variants.variants', case_id=case.case_id) }}">
              Variants
            </a>
          </div>
          <ul class="list-group">
            {% for individual in case.individuals %}
              <li class="list-group-item">
                <a href="{{ url_for('public.individual', ind_id=individual.ind_id) }}">
                  {{ individual.name }}
                </a>
                {% if individual.is_affected %}
                  <span class="badge">
                    <span class="glyphicon glyphicon-exclamation-sign"></span>
                  </span>
                {% endif %}
              </li>
            {% else %}
              <li class="list-group-item">No individuals.</li>
            {% endfor %}
          </ul>
        </div>
      {% endfor %}
    </div>

    {% if config['STORE_ENABLED'] %}
      <div class="col-md-4">
        <div class="panel panel-default">
          <div class="panel-heading">Gene lists</div>
          <ul class="list-group">
            {% for gene_list in gene_lists %}
              <li class="list-group-item">
                <a href="{{ url_for('public.gene_list', list_id=gene_list.list_id) }}" title="{{ gene_list.list_id }}">{{ gene_list.list_id }}</a>

                <form class="badge" action="{{ url_for('public.delete_genelist', list_id=gene_list.list_id) }}" method="POST" accept-charset="utf-8">
                  <button class="no-style" type="submit">
                    <span class="glyphicon glyphicon-remove"></span>
                  </button>
                </form>
              </li>
            {% else %}
              <li class="list-group-item">No gene lists added.</li>
            {% endfor %}
          </ul>

          <div class="panel-heading">Upload a new gene list</div>
          <div class="panel-body">
            <form action="{{ url_for('public.gene_list') }}" method="POST" enctype="multipart/form-data">
              <div class="form-group">
                <input class="form-control" name="list_id" placeholder="gene list id"></input>
              </div>
              <div class="form-group row">
                <div class="col-md-8">
                  <input class="form-control" type="file" name="file" required></input>
                </div>
                <div class="col-md-4">
                  <button class="btn btn-default form-control" type="submit">Upload</button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    {% endif %}
  </div>
{% endblock %}
