{% csrf_token %}
<div class="card mt-4">
    <div class="card-header">
        <h4>Bug Search</h4>
    </div>
    <div class="card-body">
        <div class="form-row">
            <div class="form-group col-md-2">
                <label for="id_list_of_bug_client">List of bug clients</label>
                {{ bug_search_form.list_of_bug_client }}
            </div>
            <div class="form-group col-md-8">
                <label for="id_search">Search</label>
                {{ bug_search_form.search }}
            </div>
            <div class="form-group col-md-2">
                <label for="bug_search_submit">.</label>
                <input type="submit" value="Search" id="bug_search_submit" class="btn btn-primary form-control">
            </div>
        </div>
        {% if bug_results %}
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <td>Select</td>
                        <td>Bug ID</td>
                        <td>Bug Description</td>
                        <td>Bug Status</td>
                    </tr>
                </thead>
                {% for row in bug_results %}
                    <tr>
                        <td id="id_{{ row.id }}_{{ bug_client_id }}"><a href="javascript:void(0)" onclick="add_bug({{ location_id }},'{{ destination }}',{{ row.id }}, {{ bug_client_id }})">Add Bug</a></td>
                        <td>{{ row.id }}</td>
                        <td>{{ row.summary|escape|safe }}</td>
                        <td>{{ row.status }}</td>
                    </tr>
                {% endfor %}
            </table>
        {% else %}
            <p>Sorry, there are no bugs found.</p>
        {% endif %}
    </div>
</div>

