{% extends 'patient/lab_results_base.html' %}

{% set current_lab_results_page = 'table' %}

{% from 'macros/ordering.html' import render_sortable_column %}

{% block content %}
    {{ super() }}

    <form class="form lab-result-table" method="GET">
        <p>
            {{ form.result_codes(class='form-control') }}
        </p>

        <p>
            <button type="submit" class="btn btn-primary btn-xs">Update Columns</button>
        </p>
    </form>

    {% if table %}
        <table class="table table-condensed table-striped">
            <thead>
                <tr>
                    <th>{{ render_sortable_column(ordering, 'date', 'Date') }}</th>

                    {% for x, sort_key in result_columns %}
                        <th>{{ render_sortable_column(ordering, sort_key, x.short_name) }}</th>
                    {% endfor %}

                    <th>{{ render_sortable_column(ordering, 'source', 'Data Source') }}</th>
                </tr>
            </thead>

            <tbody>
                {% for x in table %}
                    <tr>
                        <td>{{ x.date | datetime_format("%d/%m/%Y %H:%M") | missing }}</td>

                        {% for value in x %}
                            <td>{{ value | missing }}</td>
                        {% endfor %}

                        <td>{{ x.facility.name }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>No matching lab results.</p>
    {% endif %}
{% endblock %}
{% extends 'patient/lab_results_base.html' %}

{% set current_lab_results_page = 'table' %}

{% from 'macros/ordering.html' import render_sortable_column %}

{% block content %}
    {{ super() }}

    <form class="form lab-result-table" method="GET">
        <p>
            {{ form.result_codes(class='form-control') }}
        </p>

        <p>
            <button type="submit" class="btn btn-primary btn-xs">Update Columns</button>
        </p>
    </form>

    {% if table %}
        <table class="table table-condensed table-striped">
            <thead>
                <tr>
                    <th>{{ render_sortable_column(ordering, 'date', 'Date') }}</th>

                    {% for x, sort_key in result_columns %}
                        <th>
                            {{ render_sortable_column(ordering, sort_key, x.short_name) }}

                            {% if x.units %}
                                <small>({{ x.units }})</small>
                            {% endif %}
                        </th>
                    {% endfor %}

                    <th>{{ render_sortable_column(ordering, 'source', 'Data Source') }}</th>
                </tr>
            </thead>

            <tbody>
                {% for x in table %}
                    <tr>
                        <td>{{ x.date | datetime_format("%d/%m/%Y %H:%M") | missing }}</td>

                        {% for value in x %}
                            <td>{{ value | missing }}</td>
                        {% endfor %}

                        <td>{{ x.facility.name }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>No matching lab results.</p>
    {% endif %}
{% endblock %}
Add units to lab result table
Add units to lab result table
