

{% macro admin_counter_widget(label, value, icon=None, icon_color="blue") -%}
  <div class="widget">
    <div class="widget-body">
      {% if icon %}
      <div class="widget-icon {{ icon_color }} pull-left">
        <i class="fa fa-{{ icon }}"></i>
      </div>
      {% endif %}
      <div class="widget-content pull-left">
        <div class="title">{{ value }}</div>
        <div class="comment">{{ label }}</div>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>
{%- endmacro %}


{% macro admin_widget(title, icon=None, actions=None, height=None, padding=True, searchform=False) -%}
  {{ html_tag("div", class_="widget " + kwargs.pop("class_", ""), **kwargs) }}
    <div class="widget-title">
      {% if icon %}<i class="fa fa-{{ icon }}"></i> {% endif %}{{ title }}
      {% if searchform %}
        <input type="text" placeholder="Search" class="form-control input-sm pull-right">
      {% endif %}
      {% if actions %}
        {% for label, url in actions %}
          <a href="{{ url }}" class="btn btn-sm btn-info pull-right">{{ label }}</a>
        {% endfor %}
      {% endif %}
    </div>
    <div class="widget-body{% if height %} {{ height }}{% endif %}{% if not padding %} no-padding{% endif %}">
      {{ caller() }}
    </div>
  </div>
{%- endmacro %}


{% macro admin_table_widget(title) -%}
  {% set c = caller %}
  {% call admin_widget(title, padding=False, **kwargs) %}
    <div class="table-responsive">
      <table class="table">
        {{ c() }}
      </table>
    </div>
  {% endcall %}
{%- endmacro %}