{% load colour_table_row %}

<div class="card border-info">
    <div class="card-header">Status</div>
    <div class="card-body">
        <br/>
        {% if processing or queued %}
            <div class="row">
                <div class="col-lg-4"><strong>Last run on instrument:</strong>
                </div>
                <div class="col-lg-8">  <a href="{% url 'runs:summary' instrument_name=last_instrument_run.instrument.name run_number=last_instrument_run.run_number run_version=last_instrument_run.run_version %}">{{ last_instrument_run.title }}</a>
                    <strong class="text-{% colour_table_row last_instrument_run.status.value_verbose %}">({{ last_instrument_run.status.value_verbose }})</strong>
                </div>
            </div>
            {% if processing %}
                <div class="row">
                    <div class="col-lg-4"><strong>Currently processing:</strong>
                    </div>
                    <div class="col-lg-8">
                        <ul class="list-inline comma-seperated-list">
                        {% for job in processing %}
                            <li class="list-inline-item"><a href="{% url 'runs:summary' instrument_name=last_instrument_run.instrument.name run_number=job.run_number run_version=job.run_version %}">{{ job.title }}</a>
                            </li>
                        {% endfor %}
                        </ul>
                    </div>
                </div>
            {% endif %}
            {% if queued %}
                <div class="row">
                    <div class="col-lg-4"><strong>Currently queued:</strong>
                    </div>
                    <div class="col-lg-8">
                        <ul class="list-inline comma-seperated-list">
                        {% for job in queued %}
                            <li class="list-inline-item"><a href="{% url 'runs:summary' instrument_name=last_instrument_run.instrument.name run_number=job.run_number run_version=job.run_version %}">{{ job.title }}</a>
                            </li>
                        {% endfor %}
                        </ul>
                    </div>
                </div>
            {% endif %}
        {% else %}
            <div class="text-center">
                <strong>Last run on instrument: </strong>
                <a href="{% url 'runs:summary' instrument_name=last_instrument_run.instrument.name run_number=last_instrument_run.run_number run_version=last_instrument_run.run_version %}">{{ last_instrument_run.title }}</a>
                <strong class="text-{% colour_table_row last_instrument_run.status.value_verbose %}">
                    ({{ last_instrument_run.status.value_verbose }})
                </strong>
            </div>
            <div class="text-center">
                All reduction jobs complete.
                <br/>
                <br/>
            </div>
        {% endif %}
    </div>
</div>
