{% macro insertButton(targetId, type) %}
  {{ include_javascript('javascripts/multidelete.js') }}
  {% set modalId = modalId is not empty ? modalId : 'MultiDeleteModal' ~ targetId %}
  <a 
    class="btn btn-sm btn-danger" 
    title="{{ _t('DELETE_ALL_SELECTED_ITEMS')|e('html_attr') }}"
    data-toggle="modal"
    role="button"
    href="#{{ modalId }}"	
    onclick="multiDeleteService.updateNbSelected('{{ modalId }}')">
    <i class="fa fa-trash"></i>
    {{ _t('DELETE_SELECTION') }}
  </a>
  <div class="modal fade multidelete" 
    id="{{ modalId }}" 
    tabindex="-1" 
    role="dialog" 
    aria-labelledby="{{ modalId }}Label" 
    aria-hidden="true">
    <div class="modal-dialog modal-lg">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h3 id="{{ modalId }}Label">{{ _t('DELETE_ALL_SELECTED_ITEMS') }}</h3>
        </div>
        <div class="modal-body">
          <div class="alert alert-info">
            <b>{{ _t('NUMBER_OF_ELEMENTS') }}&nbsp;:</b>
            <span class="nb-elem-selected"></span>
          </div>
          <button class="btn btn-sm btn-warning start-btn-delete-all" data-target="{{ targetId }}" data-type="{{ type }}">{{ _t('DELETE') }}</button>
          <br/><br/>
          <div class="multi-delete-results"></div>
        </div>
        <div class="modal-footer">
          <div class="progressbar progress">
            <div class="progress-bar" role="progressbar"
              style="width: 0%;"
              aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
            </div>
          </div>
        </div>
      </div>{# .modal-content #}
    </div>{# .modal-dialog #}
  </div>
{% endmacro insertButton %}

{% macro insertSelectLine(targetId, itemId, disabled = false, type = 'pages') %}
  <td>
    {% set id = "selectline_#{ targetId }_#{ itemId|e('html_attr') }" %}
    <label for="{{id}}">
      <input
        {% if disabled %}
          disabled
        {% else %}
          class="selectline"
          data-itemid="{{ itemId }}"
        {% endif %}
        type="checkbox"
        id="{{id}}" 
        name="{{id}}" 
        value="">
      <span></span>
    </label>
  </td>
{% endmacro insertSelectLine %}

{% macro insertSelectAll(targetId, selectAllType) %}
  {{ include_javascript('javascripts/multidelete.js') }}
  <th class="prevent-sorting not-export-this-col">
    <label class="check-all-container" for="checkbox_checkall_{{ selectAllType }}_{{ targetId }}">
      <input
        type="checkbox"
        id="checkbox_checkall_{{ selectAllType }}_{{ targetId }}" 
        name="checkbox_checkall_{{ selectAllType }}_{{targetId }}" 
        value="" onclick="checkAllFirstCol(this)">
      <span></span>
    </label>
  </th>
{% endmacro insertSelectAll %}