{% extends "balafon/_bs_section.html" %}
{% load i18n balafon_utils %}

{% block section_title %}
  {% if all_actions and entity %}
    {{title}} - <a href="{% url 'crm_view_entity' entity.id %}">{{entity.name}}</a>
  {% else %}
    {% if all_actions and contact %}
      {{title}} - <a href="{% url 'crm_view_contact' contact.id %}">{{contact.fullname}}</a>
    {% else %}
      {% trans "Actions" %}
  {% endif %}{% endif %}
{% endblock %}

{% block section_data %}
<div class="row"><div class="col-md-12">
{% if actions %}
  {% include "Crm/_actions_table.html" %}
  {% include "coop_cms/_pagination.html" %}
{% endif %}
</div></div>
{% endblock %}

{% block section_menu_name %}<span class="glyphicon glyphicon-plus"></span> {% trans "Add" %}{% endblock %}

{% block section_buttons %}
  {% if contact %}
    <li><a class="colorbox-form" href="{% url 'crm_create_action' 0 contact.id %}">
      {% trans "action" %}</a></li>
  {% else %}
    {% if entity %}
      <li><a class="colorbox-form" href="{% url 'crm_create_action' entity.id 0 %}">
        {% trans "action" %}
      </a></li>
    {% else %} 
      <li><a class="colorbox-form" href="{% url 'crm_create_action' 0 0 %}">
        {% trans "action" %}
      </a></li>
    {% endif %}
  {% endif %}

  {% for action_type in addable_action_types %}
  {% include "Crm/_actions_set_menu.html" %}
  {% endfor %}

{% endblock %}
