{% load i18n %}

{% if settings.JET_WIDGET_SELECTOR %}
  <div class="dashboard-tools">
    <form action="{% url "jet-dashboard:add_user_dashboard_module" %}" method="POST" id="add-dashboard-module-form">
      {% csrf_token %}
      <select class="add-dashboard" name="module">
        <option>{% trans "widgets" %}</option>
        <optgroup label="{% trans "available" %}">
          {% for module in available_children %}
            <option value="{{ forloop.counter0 }}" data-type="available_children">{{ module.title }}</option>
          {% endfor %}
        </optgroup>
        <optgroup label="{% trans "initials" %}">
          {% for module in children %}
            <option value="{{ forloop.counter0 }}" data-type="children">{{ module.title }}</option>
          {% endfor %}
        </optgroup>
      </select><a href="#" class="button add-dashboard-link" title="{% trans "Add" %}"><span class="add-dashboard-link-icon icon-add"></span><span class="add-dashboard-link-label">{% trans "Add" %}</span></a>
      <input type="hidden" name="app_label" value="{% if app_label %}{{ app_label }}{% endif %}">
      <input type="hidden" name="type" value="">
      <a href="#" class="button transparent reset-dashboard-link" title="{% trans "Reset widgets" %}"><span class="reset-dashboard-link-icon icon-reset"></span><span class="reset-dashboard-link-label">{% trans "Reset widgets" %}</span></a>
    </form>
    <form action="{% url "jet-dashboard:reset_dashboard" %}" method="POST" id="reset-dashboard-form">
      {% csrf_token %}
      <input type="hidden" name="app_label" value="{% if app_label %}{{ app_label }}{% endif %}">
    </form>
    <div class="dialog-confirm" id="reset-dashboard-dialog" title="{% trans "Reset widgets" %}">
      <p>{% trans "Are you sure want to reset widgets?" %}</p>
    </div>
  </div>
{% endif %}
