{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load url from future %}

{% block title %}{% trans "Applications" %}{% endblock %}

{% block page_header %}
    <link rel="stylesheet" href="{% static 'muranodashboard/css/catalog.css' %}">
    <link rel="stylesheet" href="{% static 'muranodashboard/css/font-awesome.min.css' %}">
    {% include "horizon/common/_page_header.html" with title=_("Applications") %}
{% endblock page_header %}

{% block js %}
    {% include "horizon/_scripts.html" %}
{% endblock %}

{% block main %}
    <div class="table_wrapper">
        <h3 class="quota-heading">Recent Activity</h3>
        {% if latest_list|length > 0 %}
            <div class="app-row app-list row">
                {% for app in latest_list %}
                    {% include 'catalog/app_tile.html' %}
                {% endfor %}
            </div>
        {% else %}

            <div class="alert alert-block alert-info fade in">
                <p>{% trans "No recent activity to report at this time." %}</p>
            </div>
        {% endif %}

        <div class="table_header catalog">

            <div class="table_actions clearfix">
                <h3 class="heading_switcher">App Category: <div class="header dropdown">
                <a href="#" class="btn btn-small dropdown-toggle" data-toggle="dropdown">
                    {{ current_category }}  <b class="caret"></b></a>
                  <ul class="dropdown-menu row_actions clearfix">
                      {% for category in categories %}
                        <li class="clearfix"><a tabindex="-1" href="
                        {% url 'horizon:murano:catalog:index' %}?category={{ category|urlencode }}" class="btn btn-small">
                            {{ category }}</a></li>
                      {% endfor %}
                  </ul>
                </h3>

                {% include 'catalog/env_switcher.html' %}

                <div class="table_search client">
                    <form class="search" method="GET" action="{% url 'horizon:murano:catalog:index' %}">
                        <input class="span3 example" value="{{ search }}" type="text" name="search" placeholder="Filter">
                        <button type="submit" class="btn btn-small btn-search" id="apps__action_filter">Filter</button>
                    </form>
                </div>
            </div>

        </div>

        {% if object_list|length > 0 %}
            <div class="app-row app-list row">
                {% for app in object_list %}
                    {% include 'catalog/app_tile.html' %}
                {% endfor %}
            </div>
        {% else %}
            <div class="alert alert-block alert-info fade in">
                <p>{% trans "There are no applications matching your search criteria." %}</p>
            </div>
        {% endif %}

        <div class="btn-toolbar centering">
          <div class="btn-group">
              {% if view.has_prev_page %}
                  <a class="btn btn-default" href="{{ view.prev_page_url }}">Previous Page</a>
              {% endif %}
              {% if view.has_next_page %}
                  <a class="btn btn-default" href="{{ view.next_page_url }}">Next Page</a>
              {% endif %}
          </div>
        </div>

    </div>
{% endblock %}
