{% extends edc_listboard_template %}
{% load admin_urls %}
{% load edc_dashboard_extras %}
{% load mocca_dashboard_extras %}
             
{% block listboard_panel %}
    
    <a id="subjectscreening_add"
        title="{% if perms.mocca_screening.add_subjectscreening %}add screening{% else %}check your permissions{% endif %}"
        class="btn btn-sm btn-default" role="button" 
        {% if not perms.mocca_screening.add_subjectscreening %}disabled{% endif %}
        href="{% if perms.mocca_screening.add_subjectscreening %}{{ subject_screening_add_url }}?next={{ screening_listboard_url }}{% endif %}">
            <i class="fas fa-plus fa-sm"></i> Add Subject Screening
    </a>
    
{% endblock listboard_panel %}


{% block listboard_table_header %}
    <!-- begin results header -->
    <th>#</th>
    <th></th>
    <th>Screening ID</th>
    <th>Initials</th>
    <th>Age/Gender</th>
    <th>Conditions</th>
    <th>Study ID</th>
    <th>User</th>
    <th>Modified</th>
    <th>Host</th>
    <!-- end results header -->
{% endblock listboard_table_header %}


{% block listboard_table_button_column %}
    <td style="white-space: nowrap">
    <div class="btn-group">
    {% screening_button result %}
    {% eligibility_button result %}
    {% if result.eligible %}
        {% if result.consent %}
            {% dashboard_button result %}
        {% else %}
            {% refusal_button result %}{% if not result.refusal %}{% add_consent_button result %}{% endif %}
        {% endif %}
    {% endif %}
    </div>
    </td>
{% endblock listboard_table_button_column %}


{% block listboard_table_columns %}

    <td>{{ result.human_screening_identifier }} </td>
    <td nowrap>{{ result.initials }}</td>
    <td nowrap>{{ result.age_in_years }} yrs {{ result.gender }}</td>
    <td nowrap>{% if result.qualifying_condition == YES %}HIV/DIA/HYP{%endif%}</td>
    <td nowrap>{% if result.consent %}{{ result.consent.subject_identifier }}{% else %} -- {% endif %}</td>
    <td nowrap>{{ result.user_created }}</td>
    <td nowrap>{{ result.object.modified|date:"SHORT_DATETIME_FORMAT" }}</td>  
    <td nowrap>{{ result.hostname_created }}</td>

{% endblock listboard_table_columns %}
