{% extends 'staff_charges/staff_charges_base.html' %}
{% load custom_tags_and_filters %}
{% block remote_work_title %}Project selection{% endblock %}
{% block staff_charges_content %}
    <div class="col-sm-12">
        <form action="{% url 'begin_staff_charge' %}" class="form-horizontal" method="post">
            {% csrf_token %}
            <div class="form-group">
                Customer: {{ customer }}
                <br>
                <input type="hidden" name="customer" value="{{ customer.id }}">
            </div>
            <div class="form-group">
                {% if customer.active_project_count == 1 and customer.active_projects.0.allow_staff_charges %}
                    Staff time will be billed to the customer's only project, &quot;{{ customer.active_projects.0 }}&quot;
                    <input type="hidden" name="project" value="{{ customer.active_projects.0.id }}">
                {% else %}
                    Which of the customer's projects would you like to bill?
                    <div class="radio">
                        {% for p in customer.active_projects %}
                            {% if p.allow_staff_charges %}
                                <label class="control-label">
                                    <input type="radio" name="project" value="{{ p.id }}" required>
                                    {% project_selection_display p %}
                                </label>
                                <br>
                            {% endif %}
                        {% endfor %}
                    </div>
                {% endif %}
            </div>
            <div class="form-group">{% button type="save" value="Begin billing staff time" icon="glyphicon-time" %}</div>
        </form>
    </div>
{% endblock %}
