{% load i18n util %}

<div class="editable always auto-toggled filter-form"
     data-edit-target="advanced_search:fac"
     data-edit-enter-action="submit"
     data-sort-container=".results"
     data-sort-row=".row">
  <div class="row">
    <div class="col-xs-12 col-sm-6 col-md-6">
      <!-- LEFT COLUMN -->
      <div class="row">
        <div class="col-xs-4 col-sm-5 col-md-4">{% trans "Name" %}</div>
        <div class="col-xs-8 col-sm-7 col-md-8">
          <div data-edit-type="string"
               data-edit-value="{{ request.GET.name_search }}"
               data-edit-reset-value=""
               data-edit-name="name_search"></div>
        </div>
      </div>

      {% include "site/advanced-search-location.html" %}
    </div>
    <div class="col-xs-12 col-sm-6 col-md-6">
      <!-- RIGHT COLUMN -->
      <div class="row">
        <div class="col-xs-4 col-sm-5 col-md-4">{% trans "Organization" %}</div>
        <div class="col-xs-8 col-sm-7 col-md-8">
          <div data-edit-type="autocomplete"
               data-edit-autocomplete="org"

               {% if request.GET.org__name__contains %}
               data-edit-name="org__name__contains"
               data-edit-value="{{ request.GET.org__name__contains }}"
               data-edit-autocomplete-text="{{ request.GET.org__name__contains }}"
               {% else %}
               data-edit-name="org"
               data-edit-value="{{ request.GET.org }}"
               data-edit-autocomplete-text="{{ request.GET.org|autocomplete_preload_org_single }}"
               {% endif %}

               data-edit-autocomplete-allow-nonexistent="yes"
               data-edit-reset-value="">
          </div>
        </div>
      </div>

      <div class="row">
        <div class="col-xs-4 col-sm-5 col-md-4">{% trans "CLLI" %}</div>
        <div class="col-xs-8 col-sm-7 col-md-8">
          <div data-edit-type="string"
               data-edit-value="{{ request.GET.clli__startswith }}"
               data-edit-reset-value=""
               data-edit-name="clli__startswith"></div>
        </div>
      </div>

      <div class="row">
        <div class="col-xs-4 col-sm-5 col-md-4">{% trans "NPA-NXX" %}</div>
        <div class="col-xs-8 col-sm-7 col-md-8">
          <div data-edit-type="string"
               data-edit-value="{{ request.GET.npanxx__startswith }}"
               data-edit-reset-value=""
               data-edit-name="npanxx__startswith"></div>
        </div>
      </div>

      <div class="row">
        <div class="col-xs-4 col-sm-5 col-md-4">{% trans "Property" %}</div>
        <div class="col-xs-8 col-sm-7 col-md-8">
          <div data-edit-type="select"
               data-edit-data="enum/property"
               data-edit-value="{{ request.GET.property|default:"" }}"
               data-edit-reset-value=""
               data-edit-data-all-entry=":{% trans "Does not matter" %}"
               data-edit-name="property"></div>
        </div>
      </div>


      <div class="row">
        <div class="col-xs-4 col-sm-5 col-md-4">{% trans "Diverse Serving Substations" %}</div>
        <div class="col-xs-8 col-sm-7 col-md-8">
          <div data-edit-type="select"
               data-edit-data="enum/bool_choice_str"
               data-edit-value="{{ request.GET.diverse_serving_substations }}"
               data-edit-reset-value=""
               data-edit-data-all-entry=":{% trans "Does not matter" %}"
               data-edit-name="diverse_serving_substations"></div>
        </div>
      </div>

      <div class="row">
        <div class="col-xs-4 col-sm-5 col-md-4">{% trans "Available Voltage Services" %}</div>
        <div class="col-xs-8 col-sm-7 col-md-8">
          <div data-edit-type="select"
               data-edit-data="enum/available_voltage"
               data-edit-value="{{ request.GET.available_voltage_services__contains }}"
               data-edit-reset-value=""
               data-edit-data-all-entry=":{% trans "Does not matter" %}"
               data-edit-name="available_voltage_services__contains"></div>
        </div>
      </div>



      {% include "site/advanced-search-net-present.html" %}

      {% include "site/advanced-search-org-present.html" %}

    </div>
  </div>
  <div class="right">
    <a class="btn btn-default" data-edit-action="reset">{% trans "Reset" %}</a>
    <a class="btn btn-default" data-edit-action="submit">{% trans "Search" %}</a>
  </div>

  <div class="right marg-top-30">
    <a class="btn btn-default btn-xs hidden" data-export-format="json-pretty" data-export-tag="fac"><span class="glyphicon glyphicon-download"></span> JSON</a>
    <a class="btn btn-default btn-xs hidden" data-export-format="csv" data-export-tag="fac"><span class="glyphicon glyphicon-download"></span> CSV</a>
  </div>

  <div class="editable-templates">
    <div id="advanced-search-fac-item" class="row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <a href="/fac/$id" data-edit-name="name" class="name"></a>
        <div class="org_name" data-edit-name="org_name"></div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div class="clli" data-edit-name="clli"></div>
        <div class="npanxx" data-edit-name="npanxx"></div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div class="city" data-edit-name="city"></div>
        <div class="country" data-edit-name="country"></div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div class="state" data-edit-name="state"></div>
        <div class="zipcode" data-edit-name="zipcode"></div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div class="net_count" data-edit-name="net_count"></div>
      </div>
    </div>
  </div>

  <div class="headers marg-top-15">
    <div class="row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <div data-sort-target=".name" data-sort-initial="asc">{% trans "Name" %}</div>
        <div data-sort-target=".org_name">{% trans "Management" %}</div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div data-sort-target=".clli">{% trans "CLLI" %}</div>
        <div data-sort-target=".npanxx" class="ambiguous">{% trans "NPA-NXX" %}</div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div data-sort-target=".city">{% trans "City" %}</div>
        <div data-sort-target=".country">{% trans "Country" %}</div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div data-sort-target=".state">{% trans "State" %}</div>
        <div data-sort-target=".zipcode" class="ambiguous">{% trans "Postal Code" %}</div>
      </div>
      <div class="col-xs-2 col-sm-2 col-md-2">
        <div data-sort-target=".net_count" class="numeric">{% trans "Networks" %}</div>
      </div>

    </div>
  </div>

  <div class="results-empty center" style="display:none;">
    {% trans "No search results." %}
  </div>


  <div class="results">

  </div>

  <div class="results-cutoff center marg-top-15" style="display:none;">
    {% blocktrans %}...More than {{ row_limit }} entries matched your query, refine your request...{% endblocktrans %}
  </div>


</div>
