{% load timepiece_tags %}

{# FIXME: Some of those permissions don't exist #}
{% if perms.entries.can_clock_in or perms.entries.view_entry_summary or perms.entries.view_payroll_summary or perms.contracts.change_entrygroup or user.is_staff %}
    <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Management <b class="caret"></b></a>
        <ul class="dropdown-menu">
            {% if perms.entries.view_entry_summary %}  {# FIXME: permission doesn't exist #}
                <li><a href="{% url 'report_billable_hours' %}">Billable Hours</a></li>
                <li><a href="{% url 'report_hourly' %}">Hourly</a></li>
            {% endif %}
            {% if perms.entries.view_payroll_summary %}
                <li><a href="{% url 'report_payroll_summary' %}">Payroll Summary</a></li>
                <li><a href="{% url 'report_productivity' %}">Productivity</a></li>
                <li><a href="{% url 'report_estimation_accuracy' %}">Estimation Accuracy</a></li>
                {% if user.is_staff or perms.contracts.change_entrygroup or perms.entries.can_clock_in %}
                    <li class="divider"></li>
                {% endif %}
            {% endif %}
            {% if user.is_staff %}
                <li><a href="{% url 'admin:index' %}">Admin</a></li>
            {% endif %}
            {% if perms.contracts.change_entrygroup %}
                <li><a href="{% url 'list_outstanding_invoices' %}">Invoices</a></li>
            {% endif %}
            {% if perms.entries.can_clock_in %}
                <li><a href="{% url 'view_schedule' %}">Weekly Schedule</a></li>
            {% endif %}
        </ul>
    </li>
{% endif %}
