{% extends "./template.html" %}
{% block content %}
    <div class="card mt-4">
        <div class="card-header">
            <h2>Search Customers</h2>
        </div>
        <div class="card-body">
            <form action={% url 'search_customer' %} method="post" class="search_customer">
                {% csrf_token %}
                <div class="form-row mb-4">
                    {{ search_customer_form.search_customer }}
                    <input type="submit" class="btn btn-primary form-control w-25">
                </div>

                {% if customer_permission >= 3 %}
                    <a href="{% url 'new_customer' 0 %}">New Customer</a>
                {% endif %}
                <table class="table table-striped table-hover">
                    <thead>
                        <tr class="header">
                            <td width="30%">Customer Name</td>
                            <td>Organisation</td>
                        </tr>
                    </thead>
                    {% for customer in customer_results %}
                        <tr>
                            <td><a href="{% url 'customer_information' customer.customer_id %}">{{ customer.customer_first_name }} {{ customer.customer_last_name }}</td>
                            <td>{{ customer.organisation_id }}</td>
                        </tr>
                    {% endfor %}
                </table>
            </form>
        </div>
    </div>


{% endblock %}

