{% extends 'base.html' %}
{% load wnsq_tags %}
{% load i18n %}
{% block content %}
    <div class="grid fluid">
        <div class="row">

            <div class="span4">
                <!-- next x measurements -->
                <div class="panel" style="background: white;">
                    <div class="panel-header">
                        {% trans 'upcoming measurements' %}
                    </div>
                    <div class="panel-content">
                        <ul>
                            {% for ns in next_samples %}
                                <li><a href="{% url 'sample_detail' ns.sample_id %}">{{ ns.sample }}</a></li>
                            {% empty %}
                                <li>{% trans 'Quiet day, huh?' %}</li>
                            {% endfor %}
                            <li>{{ active_samples }} {% trans 'active samples in total.' %}</li>
                        </ul>

                    </div>
                </div>
            </div>

            <div class="span5">
                <div class="panel" style="background: white;">
                    <div class="panel-header">
                        {% trans 'reference materials' %}
                    </div>
                    <div class="panel-content">
                        <ul>
                            {% for exp_ref in expiring_refgases %}
                                <li>
                                    <a href="{% url 'reference gas_detail' exp_ref.id %}">{{ exp_ref.name }}
                                        ({{ exp_ref.substance }})</a>
                                    {% if exp_ref.expires_in < 0 %}
                                        <span style="color: red;">
                                    ({{ exp_ref.expires_in }} {% trans 'days' %})
                                        </span>
                                    {% else %}
                                        ({{ exp_ref.expires_in }} {% trans 'days' %})
                                    {% endif %}
                                </li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>

            <div class="span3">
                <div class="panel" style='background: white;'>
                    <div class="panel-header">
                        {% trans 'lab performance' %}
                    </div>
                    <div class='panel-content'>
                        <ul>
                            <li><strong>r: </strong><span
                                    style="color:{% if r_ok %}green{% else %}red{% endif %};">
                            {% if r %}
                                {{ r|floatformat:4 }}
                            {% else %}
                                {% nothing %}
                            {% endif %}
                                </span>
                            </li>
                            <li><strong>A: </strong><span
                                    style="color:{% if A_ok %}green{% else %}red{% endif %};">
                            {% if A %}
                                {{ A|floatformat:4 }}
                            {% else %}
                                {% nothing %}
                            {% endif %}
                            </span>
                            </li>
                        </ul>
                        <a href="{% url 'labhistory' %}" class="button">{% trans 'Details' %}</a>
                    </div>
                </div>
            </div>

        </div>


        <div class="row">

            <div class="span4">
                <!-- key data -->
                <div class="panel" style="background: white;">
                    <div class="panel-header">
                        {% trans 'key data' %}
                    </div>
                    <div class="panel-content">
                        <ul>
                            <li>{{ active_panelists }} {% trans 'panel members' %}</li>
                            <li>{{ active_clients }}/{{ active_offices }} {% trans 'clients' %}/{% trans 'offices' %}</li>
                            <li>{{ active_projects }} {% trans 'projects' %}</li>
                            <li>{{ active_measurements }} {% trans 'measurements' %}</li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="span4">
                <div class="panel" style="background: white;">
                    <div class="panel-header">
                        {% trans 'calibration deadlines' %}
                    </div>
                    <div class="panel-content">
                        <ul>
                            {% for calib in expiring_calibs %}
                                <li>
                                    <a href="{% url 'calibration_detail' calib.id %}">{{ calib.created_for }}</a>
                                    {% if calib.expires_in < 0 %}
                                        <span style="color: red;">
                                    ({{ calib.expires_in }} {% trans 'days' %})
                                    </span>
                                    {% else %}
                                        ({{ calib.expires_in }} {% trans 'days' %})
                                    {% endif %}
                                </li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock content %}