{% extends "base.html" %}
{% load compress static hc_extras %}

{% block title %}{{ num_down|num_down_title }}{% endblock %}

{% block content %}

{% if checks %}
<div class="row">
    <div id="my-checks-tags" class="col-sm-9">
        {% for tag, status in tags %}
            <div class="btn btn-xs {{ status }} {% if tag in selected_tags %}checked{% endif%}">{{ tag }}</div>
        {% endfor %}
    </div>
    <div class="col-sm-3">
        <input
            id="search"
            type="text"
            placeholder="Filter by check name&hellip;"
            class="form-control hidden-xs"
            value="{{ search }}" />
    </div>
</div>
{% endif %}

<div class="row">
    <div class="col-sm-12">
    {% if checks %}
        {% include "front/my_checks_desktop.html" %}
    {% else %}
    <div class="alert alert-info">The project <strong>{{ project }}</strong> does not have any checks yet.</div>
    {% endif %}
    </div>
</div>

{% if rw %}
<div id="my-checks-bottom-actions" class="row">
    <div class="col-sm-12">
        {% if num_available > 0 %}
            <form method="post" action="{% url 'hc-add-check' project.code %}" class="text-center">
                {% csrf_token %}
                <input type="submit" class="btn btn-primary btn-lg" value="Add Check">
            </form>
            {% if num_available <= 10 %}
            <div class="add-check-note">
                ({{ checks|length }} in use, {{ num_available }} available)
            </div>
            {% endif %}
        {% else %}
            <div class="alert alert-info">
                <strong>Check limit reached.</strong>
                To add more checks in this project, please
                {% if request.user == project.owner %}
                <a href="{% url 'hc-billing' %}">upgrade your account!</a>
                {% else %}
                ask <strong>{{ project.owner.email }}</strong> to upgrade their account!
                {% endif %}
            </div>
        {% endif %}
    </div>
</div>
{% endif %}

{% include "front/update_name_modal.html" %}
{% include "front/update_timeout_modal.html" %}

<div id="ping-details-modal" class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div id="ping-details-body">Loading</div>
            <div class="modal-footer">
                <a
                    id="ping-details-log"
                    href="#"
                    class="btn btn-default">
                    Show Log
                </a>
                <button
                    type="button"
                    class="btn btn-default"
                    data-dismiss="modal">
                    Got It!
                </button>
            </div>
        </div>
    </div>
</div>

{% endblock %}

{% block scripts %}
{% compress js %}
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/bootstrap-select.min.js' %}"></script>
<script src="{% static 'js/selectize.min.js' %}"></script>
<script src="{% static 'js/nouislider.min.js' %}"></script>
<script src="{% static 'js/clipboard.min.js' %}"></script>
<script src="{% static 'js/update-timeout-modal.js' %}"></script>
<script src="{% static 'js/adaptive-setinterval.js' %}"></script>
<script src="{% static 'js/checks.js' %}"></script>
{% endcompress %}
{% endblock %}
