{% csrf_token %}
{% if new_customers_results and task_permissions > 1 %}
    {% if task_results.task_status in 'Backlog,Blocked,In Progress,Test/Review' %}
        <div class="form-group">
            <select id="add_customer_select" name="add_customer_select" onchange="enable_disable_add_customer()" >
                <option value="---------" selected>---------</option>
                {% for row in new_customers_results %}
                    {% if not row.customer_id == None %}
                        <option value="{{ row.customer_id }}">{{ row.customer_first_name }} {{ row.customer_last_name }}</option>
                    {% endif %}
                {% endfor %}
            </select>
            <input type="submit" name="add_customer_submit" id="add_customer_submit" value="Add Customers to Task" disabled="disabled" class="btn btn-primary">
        </div>
    {% endif %}
{% endif %}
{% if task_customers_results %}

    <table class="table table-striped table-hover">
        <thead>
            <tr class="header">
                <td>Customer Name</td>
                <td>Customer Description</td>
                <td>Customer Email</td>
                {% if task_permissions >= 3 %}
                    <td>Remove Customer</td>
                {% endif %}
            </tr>
        </thead>
        {% for row in task_customers_results %}
            <tr>
                <td>{{ row.customer_id.customer_first_name }} {{ row.customer_id.customer_last_name }}</td>
                <td>{{ row.customer_description }}</td>
                <td>{{ row.customer_id.customer_email }}</td>
                {% if task_permissions >= 3 %}
                    <td><a href="javascript:void(0)" onclick="remove_customer({{ row.task_customer_id }})">Remove</a></td>
                {% endif %}
            </tr>
        {% endfor %}
    </table>

{% else %}
    <br/>There are currently no customers associated to this task.
{% endif %}