{% load i18n %}
<table>
    <tr>
      <td style="white-space: nowrap;">Log</td><td><span class="nowrap">{{ patient_log_identifier }}</span></td>
    </tr>
    <tr>
      <td style="white-space: nowrap;">Filing</td><td><span class="nowrap">{{ filing_identifier }}</span></td>
    </tr>
    <tr>
      <td style="white-space: nowrap;">Stable</td>
      <td style="{% if stable != "Yes"%}background-color: red{% endif %}">{{ stable }}</td>
    </tr>

  {#  screening #}
  {% if screening_identifier %}
    <tr>
      <td style="color:darkgreen;white-space: nowrap;">Screened </td>
      <td style="white-space: nowrap;"><a title="Go to screening form" href="{{ subject_screening_url }}"><span class="nowrap">{{ screening_identifier }}</span></a></td>
    </tr>
  {% elif not screening_identifier and willing_to_screen == YES %}
    <tr>
      <td style="white-space: nowrap;"><a title="click to screen" href="{{ subject_screening_url }}">Screen</a></td>
      <td style="background-color: orange"><a title="click to screen" style="color: black" href="{{ subject_screening_url }}">PENDING</a></td>
    </tr>
  {% elif not screening_identifier and willing_to_screen == TBD %}
    <tr>
      <td style="background-color: orange">Screen</td>
      <td style="color:darkred;white-space: nowrap;" colspan="2">TBD</td>
    </tr>
  {% elif not screening_identifier and willing_to_screen == NO  %}
    <tr>
      <td style="white-space: nowrap;">Screen</td>
      <td style="color:darkred;white-space: nowrap;" colspan="2">Unwilling</td>
    </tr>
  {% else%}
    <tr>
      <td style="white-space: nowrap;">Screen</td>
      <td style="color:darkred;white-space: nowrap;" colspan="2">Error! Contact Admin</td>
    </tr>
  {% endif  %}

  {#  consent and refusal #}
  {% if screening_identifier and eligible %}
    {% if subject_consent %}
      <tr>
        <td style="color:darkgreen;white-space: nowrap;">Consented</td>
        <td style="white-space: nowrap;">
          <a title="Go to consent form" href="{{ subject_consent_url }}"><span class="nowrap">{{ subject_identifier }}</span></a>
        </td>
      </tr>
    {% elif consent_refusal %}
      <tr>
        <td style="color:darkred;white-space: nowrap;">Refused</td>
        <td style="white-space: nowrap;">
          <a title="Go to refusal form" href="{{ consent_refusal_url }}"><span class="nowrap">Refusal form</span></a>
        </td>
      </tr>
    {% else %}
      <tr>
        <td style="white-space: nowrap;">
          <a title="click to consent" href="{{ subject_consent_url }}">Consent</a>
          or
          <a title="click to refuse to consent" href="{{ consent_refusal_url }}">Refuse</a>
        </td>
        <td style="background-color: orange">PENDING</td>
      </tr>
    {% endif  %}
  {% elif screening_identifier and not eligible %}
      <tr>
        <td colspan="2">INELIGIBLE</td>
      </tr>
  {% endif  %}

  {% if group_identifier %}
    <tr>
      <td style="white-space: nowrap;">Group</td><td>{{ group_identifier }}</td>
    </tr>
  {% endif %}
</table>
