{% extends "views/platform-admin/_base_template.html" %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% from "components/components/button/macro.njk" import usaButton %}

{% block per_page_title %}
  Find services by name
{% endblock %}

{% block platform_admin_content %}

  <h1 class="font-body-2xl">
    Find services by name
  </h1>


  {% call form_wrapper(
      action=url_for('.find_services_by_name'),
      class='usa-search margin-bottom-4'
  ) %}
      {{ form.search(param_extensions={
        "label": {"text": "Find services by name, partial name, or service ID"}
      }) }}
      <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
      {{ usaButton({
        "text": "Search",
        "classes": "usa-button search-form__button"
      }) }}
  {% endcall %}

  {% call form_wrapper(id='search-form' ) %}
    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
  {% endcall %}

  {% if services_found %}
  <nav class="browse-list">
    <ul>
    {% for service in services_found %}
      <li class="browse-list-item">
        <a href="{{url_for('.service_dashboard', service_id=service.id)}}" class="usa-link">{{ service.name }}</a>
      </li>
    {% endfor %}
    </ul>
  </nav>
  {% elif services_found == [] %}
    <p class="browse-list-hint">No services found.</p>
  {% endif %}
{% endblock %}
