{% extends 'base.html' %}

{% block header %}
  <h1> ICD-10 to Trial Conditions Validation: {{ nct_id }} </h1>
{% endblock %}

{% block content %}

<section class="summary">
  <h3>Trial Summary</h3>

  <div class="text_summary">
    <ul>
      <li>NCT: {{ summary_dats["summary"][0][0] }}</li>
      <li>Brief Title: {{ summary_dats["summary"][0][1] }}</li>
      <li>Long Title: {{ summary_dats["summary"][0][2] }}</li>
      <li>Brief Description: {{ summary_dats["summary"][0][3] }}</li>
      <li>Long Description: {{ summary_dats["summary"][0][4] }}</li>
    </ul>
  </div>
  <div class="keywords">
    <h4>Keywords</h4>
    <ul>
      {% for keyword in  summary_dats["keywords"] %}
        <li>
          {{ keyword[1] }}
        </li>
        {% endfor %}
    </ul>
  </div>
  <div class="conditions">
    <h4>Raw Conditions </h4>
    <ul>
      {% for condition in  summary_dats["conditions"] %}
        <li>
          {{ condition[3] }}
        </li>
        {% endfor %}
    </ul>
  </div>
</section>

<section class="proposed_conditions">
  <h3>Proposed Conditions</h3>
  <form method="post">
    <table>
      <tr>
      <th>Approve</th>
      <th>Condition (MeSH normalized)</th>
      <th>Identifier</th>
      <th>Source</th>
      <th>Description</th>
      <th>Source</th>
      </tr>
      {% for condition in condition_list %}

      <tr>
        <td> <input type="checkbox" id="{{ condition[0] }}" name="{{condition[0]}}" value="accepted" {% if condition[8] == "accepted" %}checked{% endif %}> </td>
        <td> {{condition[2]}} </td>
        <td> {{condition[3]}} </td>
        <td> {{condition[5]}} </td>
        <td> {{condition[6]}} </td>
        <td> {{condition[7]}} </td>
      </tr> 

      {% endfor %}
    </table>
    <input type="submit" name="submission" value="Submit approvals">
    <br/>
    <input type="submit" name="marked_unmatched" value="Mark unmmatched">
  </form>
</section>

<section class="submit_alternate">
  <h3>Submit Alternate Conditions</h3>
  <!--For each listed condition, provide a spot to enter a ICT10 code-->
  <form method="post">
    <label for="alternate_sub">Please enter the proposed code that appears to be the best match:</label>
    <input name="alt_sub" id="alternate_sub">
    <br/>
    <label for="condition">
      Please give a name to the condition you used to match this<br/>
      Condition:
    </label> 
    <input name="condition", id="condition">
    <br/>
    <input type="submit" name="alternate_submission" value="Submit alternate ICD-10 code">
  </form>
</section>

<section class="approved">
  <!--TODO:This will list the already approved values-->
</section>

{% endblock %}