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

                {% if organisation_permission >= 3 %}
                    <a href="{% url 'new_organisation' %}">New Organisation</a>
                {% endif %}
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <td>Organisation Name</td>
                            <td>Organisation Website</td>
                            <td>Organisation Email</td>
                        </tr>
                    </thead>
                    {% for organisation in organisation_results %}
                        <tr>
                            <td><a href="{% url 'organisation_information' organisation.organisation_id %}">{{ organisation.organisation_name }}</td>
                            <td>{{ organisation.organisation_website }}</td>
                            <td>{{ organisation.organisation_email }}</td>
                        </tr>
                    {% endfor %}
                </table>
            </form>
        </div>
    </div>
{% endblock %}
