{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="float-end">
        <button type="button" data-bs-toggle="tooltip" title="{{ button_filter }}" onclick="$('#filter-seo').toggleClass('d-none');" class="btn btn-light d-lg-none"><i class="fa-solid fa-filter"></i></button>
        <a href="{{ add }}" data-bs-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa-solid fa-plus"></i></a>
        <button type="submit" form="form-seo-url" formaction="{{ delete }}" data-bs-toggle="tooltip" title="{{ button_delete }}" onclick="return confirm('{{ text_confirm }}');" class="btn btn-danger"><i class="fa-regular fa-trash-can"></i></button>
      </div>
      <h1>{{ heading_title }}</h1>
      <ol class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
          <li class="breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ol>
    </div>
  </div>
  <div class="container-fluid">
    <div class="row">
      <div id="filter-seo" class="col-lg-3 col-md-12 order-lg-last d-none d-lg-block mb-3">
        <div class="card">
          <div class="card-header"><i class="fa-solid fa-filter"></i> {{ text_filter }}</div>
          <div class="card-body">
            <form id="form-filter">
              <div class="mb-3">
                <label for="input-keyword" class="form-label">{{ entry_keyword }}</label> <input type="text" name="filter_keyword" value="{{ filter_keyword }}" placeholder="{{ entry_keyword }}" id="input-keyword" class="form-control"/>
              </div>
              <div class="mb-3">
                <label for="input-key" class="form-label">{{ entry_key }}</label> <input type="text" name="filter_key" value="{{ filter_key }}" placeholder="{{ entry_key }}" id="input-key" class="form-control"/>
              </div>
              <div class="mb-3">
                <label for="input-value" class="form-label">{{ entry_value }}</label> <input type="text" name="filter_value" value="{{ filter_value }}" placeholder="{{ entry_value }}" id="input-value" class="form-control"/>
              </div>
              <div class="mb-3">
                <label for="input-store" class="form-label">{{ entry_store }}</label> <select name="filter_store_id" id="input-store" class="form-select">
                  <option value=""></option>
                  <option value="0"{% if filter_store_id == '0' %} selected{% endif %}>{{ text_default }}</option>
                  {% for store in stores %}
                    <option value="{{ store.store_id }}"{% if store.store_id == filter_store_id %} selected{% endif %}>{{ store.name }}</option>
                  {% endfor %}
                </select>
              </div>
              <div class="mb-3">
                <label for="input-language" class="form-label">{{ entry_language }}</label> <select name="filter_language_id" id="input-language" class="form-select">
                  <option value=""></option>
                  {% for language in languages %}
                    <option value="{{ language.language_id }}"{% if language.language_id == filter_language_id %} selected{% endif %}>{{ language.name }}</option>
                  {% endfor %}
                </select>
              </div>
              <div class="text-end">
                <button type="button" id="button-filter" class="btn btn-light"><i class="fa-solid fa-filter"></i> {{ button_filter }}</button>
                <button type="reset" data-bs-toggle="tooltip" title="{{ button_reset }}" class="btn btn-outline-secondary"><i class="fa-solid fa-filter-circle-xmark"></i></button>
              </div>
            </form>
          </div>
        </div>
      </div>
      <div class="col-lg-9 col-md-12">
        <div class="card">
          <div class="card-header"><i class="fa-solid fa-list"></i> {{ text_list }}</div>
          <div id="seo-url" class="card-body">{{ list }}</div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
$('#seo-url').on('click', 'thead a, .pagination a', function(e) {
    e.preventDefault();

    $('#seo-url').load(this.href);
});

$('#button-filter').on('click', function() {
    var url = '';

    var filter_keyword = $('#input-keyword').val();

    if (filter_keyword) {
        url += '&filter_keyword=' + encodeURIComponent(filter_keyword);
    }

    var filter_key = $('#input-key').val();

    if (filter_key) {
        url += '&filter_key=' + encodeURIComponent(filter_key);
    }

    var filter_value = $('#input-value').val();

    if (filter_value) {
        url += '&filter_value=' + encodeURIComponent(filter_value);
    }

    var filter_store_id = $('#input-store').val();

    if (filter_store_id) {
        url += '&filter_store_id=' + filter_store_id;
    }

    var filter_language_id = $('#input-language').val();

    if (filter_language_id) {
        url += '&filter_language_id=' + filter_language_id;
    }

    window.history.pushState({}, null, 'index.php?route=design/seo_url&user_token={{ user_token }}' + url);

    $('#seo-url').load('index.php?route=design/seo_url.list&user_token={{ user_token }}' + url);
});
//--></script>
{{ footer }}
