{% extends '@!PrestaShop/Admin/Product/CatalogPage/Lists/products_table.html.twig' %}
{% import '@PrestaShop/Admin/macros.html.twig' as ps %}
{% block product_catalog_form_table_header %}
	<tr class="column-headers">
          <th scope="col"></th>
          <th scope="col" class="text-center" style="width: 9%">
            {{ ps.sortable_column_header("ID"|trans({}, 'Admin.Global'), 'id_product', orderBy, sortOrder) }}
          </th>
          <th scope="col">
            {{ "Image"|trans({}, 'Admin.Global') }}
          </th>
          <th scope="col">
            {{ ps.sortable_column_header("Name"|trans({}, 'Admin.Global'), 'name', orderBy, sortOrder) }}
          </th>
          <th scope="col" style="width: 9%">
            {{ ps.sortable_column_header("Reference"|trans({}, 'Admin.Global'), 'reference', orderBy, sortOrder) }}
          </th>
          <th scope="col">
            {{ ps.sortable_column_header("Category"|trans({}, 'Admin.Catalog.Feature'), 'name_category', orderBy, sortOrder) }}
          </th>
          <th scope="col" class="text-center" style="width: 9%">
            {{ ps.sortable_column_header("Price (tax excl.)"|trans({}, 'Admin.Catalog.Feature'), 'price', orderBy, sortOrder) }}
          </th>
          <th scope="col" class="text-center" style="width: 9%">
            {{ "Price (tax incl.)"|trans({}, 'Admin.Catalog.Feature') }}
          </th>

          {% if configuration('PS_STOCK_MANAGEMENT') %}
          <th scope="col" class="text-center" style="width: 9%">
            {{ ps.sortable_column_header("Quantity"|trans({}, 'Admin.Catalog.Feature'), 'sav_quantity', orderBy, sortOrder) }}
          </th>
          {% else %}
            <th></th>
          {% endif %}

          <th scope="col" class="text-center">
            {{ ps.sortable_column_header("Status"|trans({}, 'Admin.Global'), 'active', orderBy, sortOrder) }}
          </th>
          <th scope="col">
            {{ ps.sortable_column_header("Seller"|trans({}, 'Modules.Agilemultisellerpro.Admin'), 'seller_name', orderBy, sortOrder) }}
          </th>
          {% if has_category_filter == true %}
            <th scope="col">
              {{ ps.sortable_column_header("Position"|trans({}, 'Admin.Global'), 'position', orderBy, sortOrder) }}
            </th>
          {% endif %}
          <th scope="col" class="text-right" style="width: 3rem; padding-right: 2rem">
              {{ "Actions"|trans({}, 'Admin.Global') }}
          </th>
    </tr>
{% endblock %}

{% block product_catalog_form_table_filters %}
        {% set filters_disabled = activate_drag_and_drop %}
        <tr class="column-filters">
          <td class="text-center" style="vertical-align: middle;">
            {% block product_catalog_filter_select_all %}
              <div class="md-checkbox md-checkbox-inline">
                <label>
                  <input
                    type="checkbox"
                    id="bulk_action_select_all"
                    onclick="$('#product_catalog_list').find('table td.checkbox-column input:checkbox').prop('checked', $(this).prop('checked')); updateBulkMenu();"
                    value=""
                  >
                  <i class="md-checkbox-control"></i>
                </label>
              </div>
            {% endblock %}
          </td>
          <td>
            {% include '@PrestaShop/Admin/Helpers/range_inputs.html.twig' with {
              'input_name': "filter_column_id_product",
              'min': '0',
              'max': '1000000',
              'minLabel': "Min"|trans({}, 'Admin.Global'),
              'maxLabel': "Max"|trans({}, 'Admin.Global'),
              'value': filter_column_id_product,
              'disabled': filters_disabled,
            } %}
          </td>
          <td>&nbsp;</td>
          <td>
            <input
              type="text"
              class="form-control"
              placeholder="{{ "Search name"|trans({}, 'Admin.Catalog.Help') }}"
              name="filter_column_name"
              value="{{ filter_column_name }}"
              aria-label="{{ "%inputId% input"|trans({'%inputId%': 'filter_column_name'}, 'Admin.Global') }}"
              {% if filters_disabled %}disabled{% endif %}
            />
          </td>
          <td>
            <input
              type="text"
              class="form-control"
              placeholder="{{ "Search ref."|trans({}, 'Admin.Catalog.Help') }}"
              name="filter_column_reference"
              value="{{ filter_column_reference }}"
              aria-label="{{ "%inputId% input"|trans({'%inputId%': 'filter_column_reference'}, 'Admin.Global') }}"
              {% if filters_disabled %}disabled{% endif %}
            />
          </td>
          <td>
            <input
              type="text"
              class="form-control"
              placeholder="{{ "Search category"|trans({}, 'Admin.Catalog.Help') }}"
              name="filter_column_name_category"
              value="{{ filter_column_name_category }}"
              aria-label="{{ "%inputId% input"|trans({'%inputId%': 'filter_column_name_category'}, 'Admin.Global') }}"
              {% if filters_disabled %}disabled{% endif %}
            />
          </td>
          <td class="text-center">
            {% include '@PrestaShop/Admin/Helpers/range_inputs.html.twig' with {
              'input_name': "filter_column_price",
              'min': '0',
              'max': '1000000',
              'minLabel': "Min"|trans({}, 'Admin.Global'),
              'maxLabel': "Max"|trans({}, 'Admin.Global'),
              'value': filter_column_price,
              'disabled': filters_disabled,
            } %}
          </td>
          <td class="text-center"></td>
          {% if configuration('PS_STOCK_MANAGEMENT') %}
          <td class="text-center">
            {% include '@PrestaShop/Admin/Helpers/range_inputs.html.twig' with {
              'input_name': "filter_column_sav_quantity",
              'min': '-1000000',
              'max': '1000000',
              'minLabel': "Min"|trans({}, 'Admin.Global'),
              'maxLabel': "Max"|trans({}, 'Admin.Global'),
              'value': filter_column_sav_quantity,
              'disabled': filters_disabled,
            } %}
          </td>
          {% else %}
            <td></td>
          {% endif %}

          <td id="product_filter_column_active" class="text-center">
            <div class="form-select">
              <select class="custom-select"  name="filter_column_active"{% if filters_disabled %} disabled{% endif %} aria-label="{{ "%inputId% select"|trans({'%inputId%': 'filter_column_active'}, 'Admin.Global') }}"
                >
                <option value=""></option>
                <option value="1" {% if (filter_column_active is defined) and filter_column_active == '1' %}selected="selected"{% endif %}>Active</option>
                <option value="0" {% if (filter_column_active is defined) and filter_column_active == '0' %}selected="selected"{% endif %}>Inactive</option>
              </select>
            </div>
          </td>

          <td id="product_filter_column_active" class="text-center">
            <div class="form-select">
              <select class="custom-select"  name="filter_column_id_seller"{% if filters_disabled %} disabled{% endif %} aria-label="{{ "%inputId% select"|trans({'%inputId%': 'filter_column_id_seller'}, 'Admin.Global') }}"
                >
                <option value="0"></option>
                {{ renderhook('adminCatalogSellersList', {}) }}
              </select>
            </div>
          </td>

          {% if has_category_filter == true %}
            <td>
              {% if not(activate_drag_and_drop) %}
                <input type="button" class="btn btn-outline-secondary" name="products_filter_position_asc" value="{{ "Reorder"|trans({}, 'Admin.Actions') }}" onclick="productOrderPrioritiesTable();" />
                {% else %}
                <input type="button" id="bulk_edition_save_keep" class="btn" onclick="bulkProductAction(this, 'edition');" value="{{ "Save & refresh"|trans({}, 'Admin.Actions')|raw }}" />
              {% endif %}
            </td>
          {% endif %}
          <td class="text-right" style="width: 5rem">
            <button
              type="submit"
              class="btn btn-primary"
              name="products_filter_submit"
              title="{{ "Search"|trans({}, 'Admin.Actions') }}"
            >
              <i class="material-icons">search</i>
              {{ "Search"|trans({}, 'Admin.Actions') }}
            </button>
            <button
              type="reset"
              class="btn btn-link"
              name="products_filter_reset"
              onclick="productColumnFilterReset($(this).closest('tr.column-filters'))"
              title="{{ "Reset"|trans({}, 'Admin.Actions') }}"
            >
              <i class="material-icons">clear</i>
              {{ "Reset"|trans({}, 'Admin.Actions') }}
            </button>
          </td>
        </tr>
{% endblock %}