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



{% block navbar %}
            <li><a href="/openrem/ct">CT</a></li>
            <li><a href="/openrem/rf">Fluoroscopy</a></li>
            <li><a href="/openrem/mg">Mammography</a></li>
{% endblock %}

{% block adminnav %}
            <li class="dropdown active"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-blank fa-fw"></i>Admin <b class="caret"></b></a>
{% endblock %}



{% block mainblock %}		

    {% if messages %}
        {% for message in messages %}
            <div class="alert alert-{% if message.level == 40 %}danger{% elif message.level == 25 %}success{% endif %} fade in">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                {% if message.level == 40 %}
                    <strong>Warning!</strong>
                {% endif %}
                {{ message }}
            </div>
        {% endfor %}
    {% endif %}

{% if admin.adminperm %}

      <div class="col-md-8 col-md-offset-2">
        <h2>Uploading patient size data to OpenREM</h2>

        <div class="row">
            <p>
                From the select boxes below, choose the column title that
                corresponds to each of the height, weight and ID fields.
                In the last select box, specify if the ID field is the
                accession number or the study instance UID.
            </p>
        </div>



		<!-- Upload form. Note enctype attribute! -->
		<form action="/openrem/admin/sizeprocess/{{ csvid }}/" method="post" enctype="multipart/form-data">
			{% csrf_token %}
            <div class="row">
            <div class="form-group">
            <table>
                <th>{{ form.height_field.label_tag }}</th>
                <th>{{ form.weight_field.label_tag }}</th>
                <th>{{ form.id_field.label_tag }}</th>
                <th>{{ form.id_type.label_tag }}</th>
                <tr>
                    <td>
                        {{ form.height_field.errors }}
                        {{ form.height_field }}
                    </td>
                    <td>
                        {{ form.weight_field.errors }}
                        {{ form.weight_field }}
                    </td>
                    <td>
                        {{ form.id_field.errors }}
                        {{ form.id_field }}
                    </td>
                    <td>
                        {{ form.id_type.errors }}
                        {{ form.id_type }}
                    </td>
                </tr>
            </table>
            </div>
            </div>
            <div class="row">
              <div class="col-md-offset-7">
			  <button type="submit" class="btn btn-default">Process the data</button>
              </div>
            </div>
        </form>
      </div> <!-- class="col-md-8 col-md-offset-2" -->
		
      <div class="row"></div>

{% else %}

      <div class="row col-md-offset-2">
        <h3>Uploading patient size data to OpenREM</h3>
      </div>

      <div class="row">
      <div class="col-md-8 col-md-offset-2">
      <p>
        This function can only be accessed if you are logged in to OpenREM with admin
        permissions.
      </p>
      </div>
      </div>
      
{% endif %}


{% endblock %}	
