{% extends 'timepiece/contract/base.html' %}
{% load timepiece_tags %}
{% load url from future %}

{% block title %}Current Contracts{% endblock %}

{% block content %}
    <div class="row-fluid">
        <div class="span12">
            <h2 class="page-title">Current Contracts</h2>

            <table class='table table-bordered table-striped table-condensed'>
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Start Date</th>
                        <th>End Date</th>
                        <th>Contract Hours</th>
                        <th>Hours Worked</th>
                        <th>Contract Type</th>
                    </tr>
                </thead>
                <tbody>
                    {% for contract in contracts %}
                        <tr>
                            <td><a href="{% url 'view_contract' contract.id %}">{{ contract.name }}</a></td>
                            <td class="nowrap">{{ contract.start_date|date:'M j, Y' }}</td>
                            <td class="nowrap">{{ contract.end_date|date:'M j, Y' }}</td>
                            <td class="nowrap hours">
                                {{ contract.contracted_hours|floatformat:2 }}
                                {% if contract.pending_hours %}
                                    <span class="pending_hours">(+{{ contract.pending_hours|floatformat:2 }})</span>
                                {%  endif %}
                            </td>
                            <td class="nowrap hours">{{ contract.hours_worked|floatformat:2 }} ({% widthratio contract.hours_worked contract.contracted_hours 100 %}%)</td>
                            <td class="nowrap">{{ contract.get_type_display }}</td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}
