<commit_before>{% import "macros/form.html" as Form %}
{% import "macros/element.html" as Element %}

{% if data and data.count and data.count > 0 %}
  <h1 class="govuk-heading-xl">
    {{ _('Legal Adviser Search Results') }}
  </h1>
  <p id="larp-results" class="govuk-body">
    {% trans count=data.results|length %}Showing {{ count }} results around{% endtrans %}
    <strong class="govuk-!-font-weight-bold">{{ data.origin.postcode }}</strong>
    {% if category_name %}
      {{ _('for') }}
        <strong class="govuk-!-font-weight-bold">{{ category_name|lower }}</strong>.
    {% endif %}
  </p>

  {% if postcode_info.is_scottish_postcode
    or postcode_info.is_ni_postcode
    or postcode_info.is_mann_postcode
    or postcode_info.is_jersey_postcode
    or postcode_info.is_guernsey_postcode
    %}
    <div class="govuk-warning-text">
      <span class="govuk-warning-text__icon" aria-hidden="true">!</span>
      <strong class="govuk-warning-text__text">
        <span class="govuk-warning-text__assistive">Warning </span>
        {% if postcode_info.is_scottish_postcode %}
          {% trans
            link=Element.link_same_window('https://www.mygov.scot/legal-aid/', _('mygov.scot'), True)
          %}Legal Aid is different in Scotland. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_ni_postcode %}
          {% trans
            link=Element.link_same_window('https://www.nidirect.gov.uk/articles/legal-aid-schemes', _('nidirect.gov.uk'), True)
          %}Legal Aid is different in Northern Ireland. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_mann_postcode %}
          {% trans
            link=Element.link_same_window('https://www.gov.im/categories/benefits-and-financial-support/legal-aid/', _('gov.im'), True)
          %}Legal Aid is different on the Isle of Man. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_jersey_postcode  %}
          {% trans
            link=Element.link_same_window('https://www.legalaid.je/', _('legalaid.je'), True)
          %}Legal Aid is different in Jersey. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_guernsey_postcode %}
          {% trans
            link=Element.link_same_window('https://www.gov.gg/legalaid', _('gov.gg'), True)
          %}Legal Aid is different in Guernsey. Visit {{ link }} for more information.{% endtrans %}
        {% endif %}
      </strong>
    </div>
  {% endif %}

  <section class="find-legal-adviser govuk-!-margin-bottom-7">

    <div class="search-results-container">
      {% if data.origin %}
        <div id="resultsMap" class="map" data-lat="{{ data.origin.point.coordinates[1] }}" data-lon="{{ data.origin.point.coordinates[0] }}"></div>
      {% else %}
        <div id="resultsMap" class="map"></div>
      {% endif %}
      <div class="search-results">
        <div class="search-results-list" data-current-page="{{ data.current_page }}">
          <ul class="org-list">
            {% for item in data.results %}
              <li class="org-list-item vcard" data-lat="{{ item.location.point.coordinates[1] }}" data-lon="{{ item.location.point.coordinates[0] }}" data-id="{{ loop.index }}">
                <header class="org-summary">
                  <h3 class="org-title">
                    <span class="marker">{{ loop.index }}</span>
                    <span class="fn org">{{ item.organisation.name }}</span>
                  </h3>
                  <div class="distance">
                    <span class="sr-only">{{ _('Distance') }}</span>
                    {% if data.origin %}
                      {% trans miles=item.distance|round(2) %}{{ miles }} miles{% endtrans %}
                    {% endif %}
                  </div>
                </header>
                <div class="org-details">
                  <p class="govuk-body-s">
                    <span class="sr-only">{{ _('Address') }}:</span>
                    <span class="adr">
                      <span class="street-address">{{ item.location.address }}</span>
                      <span class="city">{{ item.location.city }}</span>
                      <span class="postal-code">{{ item.location.postcode }}</span>
                    </span>
                  </p>
                  <p class="govuk-body-s">
                    <span>{{ _('Helpline') }}:</span>
                    <span class="tel">{{ item.telephone }}</span>
                  </p>
                  {% if item.organisation.website %}
                    <p class="govuk-body-s">
                      <span>{{ _('Website') }}:</span>
                      {{ Element.link_same_window(item.organisation.website|human_to_url, item.organisation.website|url_to_human, is_external=True, **{'class': 'url'}) }}
                    </p>
                  {% endif %}
                  {% if item.categories|length %}
                    <h4 class="govuk-heading-s govuk-!-font-size-16 govuk-!-margin-bottom-2">{{ _('Categories of law') }}</h4>
                    <ul class="govuk-list govuk-list--bullet govuk-!-font-size-14" role="list">
                      {% for cat in item.categories if cat %}
                        <li class="govuk-!-margin-0" role="listitem">{{ cat }}</li>
                      {% endfor %}
                    </ul>
                  {% endif %}
                </div>
              </li>
            {% endfor %}
          </ul>
        </div>
      </div>
    </div>
  </section>

  <p class="govuk-body">
    <a class="govuk-link" href="https://www.gov.uk/done/check-if-civil-legal-advice-can-help-you" aria-labelledby="aria-satisfaction-survey">
      {% trans %}What did you think of this service?{% endtrans %}</a> {% trans %}(takes 30 seconds){% endtrans %}
  </p>

  {% set find_legal_advisor_subtitle = _('Search again') %}

{% else %}

  {% if 'count' in data and data.count == 0 %}
    {% call Element.alert('error', title=_('No results')) %}
      <div class="govuk-error-summary__body">
      <ul class="govuk-list govuk-error-summary__list">
        <li>
          <a href="#postcode">{% trans %}We couldn’t find any results for your search.
        We are constantly updating our records so please try again later.{% endtrans %}</a>
        </li>
      </ul>
    </div>
    {% endcall %}

    {% set postcode_error = true %}

    {% set find_legal_advisor_subtitle = _('Try again') %}
  {% endif %}

  {% if form.postcode and form.postcode.errors %}
    <h2> Error error error </h2>
  {% endif %}
<commit_msg>Error summaries<commit_after>{% import "macros/form.html" as Form %}
{% import "macros/element.html" as Element %}

{% if data and data.count and data.count > 0 %}
  <h1 class="govuk-heading-xl">
    {{ _('Legal Adviser Search Results') }}
  </h1>
  <p id="larp-results" class="govuk-body">
    {% trans count=data.results|length %}Showing {{ count }} results around{% endtrans %}
    <strong class="govuk-!-font-weight-bold">{{ data.origin.postcode }}</strong>
    {% if category_name %}
      {{ _('for') }}
        <strong class="govuk-!-font-weight-bold">{{ category_name|lower }}</strong>.
    {% endif %}
  </p>

  {% if postcode_info.is_scottish_postcode
    or postcode_info.is_ni_postcode
    or postcode_info.is_mann_postcode
    or postcode_info.is_jersey_postcode
    or postcode_info.is_guernsey_postcode
    %}
    <div class="govuk-warning-text">
      <span class="govuk-warning-text__icon" aria-hidden="true">!</span>
      <strong class="govuk-warning-text__text">
        <span class="govuk-warning-text__assistive">Warning </span>
        {% if postcode_info.is_scottish_postcode %}
          {% trans
            link=Element.link_same_window('https://www.mygov.scot/legal-aid/', _('mygov.scot'), True)
          %}Legal Aid is different in Scotland. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_ni_postcode %}
          {% trans
            link=Element.link_same_window('https://www.nidirect.gov.uk/articles/legal-aid-schemes', _('nidirect.gov.uk'), True)
          %}Legal Aid is different in Northern Ireland. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_mann_postcode %}
          {% trans
            link=Element.link_same_window('https://www.gov.im/categories/benefits-and-financial-support/legal-aid/', _('gov.im'), True)
          %}Legal Aid is different on the Isle of Man. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_jersey_postcode  %}
          {% trans
            link=Element.link_same_window('https://www.legalaid.je/', _('legalaid.je'), True)
          %}Legal Aid is different in Jersey. Visit {{ link }} for more information.{% endtrans %}
        {% elif postcode_info.is_guernsey_postcode %}
          {% trans
            link=Element.link_same_window('https://www.gov.gg/legalaid', _('gov.gg'), True)
          %}Legal Aid is different in Guernsey. Visit {{ link }} for more information.{% endtrans %}
        {% endif %}
      </strong>
    </div>
  {% endif %}

  <section class="find-legal-adviser govuk-!-margin-bottom-7">

    <div class="search-results-container">
      {% if data.origin %}
        <div id="resultsMap" class="map" data-lat="{{ data.origin.point.coordinates[1] }}" data-lon="{{ data.origin.point.coordinates[0] }}"></div>
      {% else %}
        <div id="resultsMap" class="map"></div>
      {% endif %}
      <div class="search-results">
        <div class="search-results-list" data-current-page="{{ data.current_page }}">
          <ul class="org-list">
            {% for item in data.results %}
              <li class="org-list-item vcard" data-lat="{{ item.location.point.coordinates[1] }}" data-lon="{{ item.location.point.coordinates[0] }}" data-id="{{ loop.index }}">
                <header class="org-summary">
                  <h3 class="org-title">
                    <span class="marker">{{ loop.index }}</span>
                    <span class="fn org">{{ item.organisation.name }}</span>
                  </h3>
                  <div class="distance">
                    <span class="sr-only">{{ _('Distance') }}</span>
                    {% if data.origin %}
                      {% trans miles=item.distance|round(2) %}{{ miles }} miles{% endtrans %}
                    {% endif %}
                  </div>
                </header>
                <div class="org-details">
                  <p class="govuk-body-s">
                    <span class="sr-only">{{ _('Address') }}:</span>
                    <span class="adr">
                      <span class="street-address">{{ item.location.address }}</span>
                      <span class="city">{{ item.location.city }}</span>
                      <span class="postal-code">{{ item.location.postcode }}</span>
                    </span>
                  </p>
                  <p class="govuk-body-s">
                    <span>{{ _('Helpline') }}:</span>
                    <span class="tel">{{ item.telephone }}</span>
                  </p>
                  {% if item.organisation.website %}
                    <p class="govuk-body-s">
                      <span>{{ _('Website') }}:</span>
                      {{ Element.link_same_window(item.organisation.website|human_to_url, item.organisation.website|url_to_human, is_external=True, **{'class': 'url'}) }}
                    </p>
                  {% endif %}
                  {% if item.categories|length %}
                    <h4 class="govuk-heading-s govuk-!-font-size-16 govuk-!-margin-bottom-2">{{ _('Categories of law') }}</h4>
                    <ul class="govuk-list govuk-list--bullet govuk-!-font-size-14" role="list">
                      {% for cat in item.categories if cat %}
                        <li class="govuk-!-margin-0" role="listitem">{{ cat }}</li>
                      {% endfor %}
                    </ul>
                  {% endif %}
                </div>
              </li>
            {% endfor %}
          </ul>
        </div>
      </div>
    </div>
  </section>

  <p class="govuk-body">
    <a class="govuk-link" href="https://www.gov.uk/done/check-if-civil-legal-advice-can-help-you" aria-labelledby="aria-satisfaction-survey">
      {% trans %}What did you think of this service?{% endtrans %}</a> {% trans %}(takes 30 seconds){% endtrans %}
  </p>

  {% set find_legal_advisor_subtitle = _('Search again') %}

{% else %}

  {% if 'count' in data and data.count == 0 %}
    {% call Element.alert('error', title=_('No results')) %}
      <div class="govuk-error-summary__body">
        <ul class="govuk-list govuk-error-summary__list">
          <li>
            <a href="#postcode">{% trans %}We couldn’t find any results for your search.
          We are constantly updating our records so please try again later.{% endtrans %}</a>
          </li>
        </ul>
      </div>
    {% endcall %}

    {% set postcode_error = true %}

    {% set find_legal_advisor_subtitle = _('Try again') %}
  {% endif %}

  {% if form.postcode and form.postcode.errors %}
    {% call Element.alert('error') %}
      <div class="govuk-error-summary__body">
        <ul class="govuk-list govuk-error-summary__list">
          <li>
            <a href="#postcode">{{ form.postcode.errors[0] }}</a>
          </li>
        </ul>
      </div>
    {% endcall %}
  {% endif %}

{'fraction_non_alphanumeric': 0.17047739629105535, 'fraction_numerical': 0.0035004096224026215, 'mean_word_length': 2.0615595075239397, 'pattern_counts': {'":': 0, '<': 185, '<?xml version=': 0, '>': 187, 'https://': 12, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '415421', 'n_tokens_mistral': 4383, 'n_tokens_neox': 4004, 'n_words': 832}