{% extends edc_listboard_template %}
{% load edc_dashboard_extras %}

{% block listboard_panel_title %}
  {% if patient_group %}
    SUBJECTS IN GROUP <B>{{ patient_group.name }}</B>
  {% else %}
    <span class="text">&nbsp;&nbsp;{{ listboard_panel_title }}</span>
  {% endif %}
{% endblock listboard_panel_title %}


{% block listboard_search_btn_group %}
  <a id="home_button" title="Home" class="btn btn-sm btn-primary" role="button" href="{% url 'subjects_home_url' %}"><i class="fa-solid fa-reply fa-1x fa-fw" aria-hidden="true"></i> Home</a>
  {% if patient_group %}
    <a id="patient_group" title="Go to all patient logs for group {{ patient_group.name }}" class="btn btn-sm btn-default" role="button" href="{% url "intecomm_screening_admin:intecomm_screening_patientlog_changelist"  %}?q={{ patient_group.group_identifier }}">Patient Logs</a>
    <a id="group_appointment" title="Back to group" class="btn btn-sm btn-default" role="button" disabled >Appointment</a>
    <a id="group_meeting" title="Back to group" class="btn btn-sm btn-default" role="button" disabled >Meeting</a>
  {% endif %}
{% endblock listboard_search_btn_group %}
{% block listboard_table_header %}

    <!-- begin results header -->
    <th>#</th>
    <th></th>
    <th>Subject</th>
    <th>Age/MF</th>
    {% if country == "uganda" %}<th>Filing</th>{% else %}<th>Name</th>{% endif %}
    <th>Patient log</th>
    <th>Group</th>
    <th>Consented</th>
    <th>Modified</th>
    <!-- end results header -->

{% endblock listboard_table_header %}

{% block listboard_table_columns %}
  <td>{{ result.subject_identifier }}</td>
    <td>
      {% if result.gender == MALE %}
        <i class="fas fa-male fa-lg"></i>
      {% else %}
        <i class="fas fa-female fa-lg"></i>
      {% endif %}
      {{result.age_in_years}}{{ result.gender }}
    </td>
  <td>{% if country == "uganda" %}{{result.filing_identifier}}{% else %}{% if perms.edc_registration.display_firstname %}{{ result.familiar_name }}{% else %}******{% endif %} {% if perms.edc_registration.display_lastname %}{{ result.initials }}{% else %}{{result.filing_identifier}}{% endif %}{% endif %}
  <td><a id="btn-patientlog-{{result.patient_log_identifier}}" class="btn btn-default btn-sm" role="button" data-toggle="tooltip" title="Go to Patient Log" href="{% url "intecomm_screening_admin:intecomm_screening_patientlog_changelist" %}?q={{ result.patient_log_identifier }}"><i class="fas fa-person-circle-plus fa-lg fa-fw"></i></a> {{ result.patient_log_identifier }}</td>
  <td><A data-toggle="tooltip" title="Click to show subjects in this group" href="{{ subject_listboard_url }}?q={{ result.group_identifier }}">{{ result.group_identifier }}</A></td>

  </td>
  <td>{{ result.consent_datetime|date:"SHORT_DATE_FORMAT" }}</td>
  <td>{{ result.modified|date:"SHORT_DATETIME_FORMAT" }}</td>
{% endblock listboard_table_columns %}
