{% extends 'VGMWOBundle::layout.html.twig' %}
{% block jumbotron_content %}
    <div class="jumbotron" style="padding-top: 10px; padding-bottom: 5px;"  id="jumbotron">
        <div class="container-fluid">
            <div class="col-md-12 text-center" style="padding-left: 0px;">
                <H3 style="margin: 0px;"><strong>Work Types</strong></H3>
            </div>
        </div>
    </div>
{% endblock %}
{% block content%}
    <div class="container" style="min-height: 500px;">
        <div class="table-responsive">
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th class="col-md-2">Work</th>
                    <th class="col-md-9">Description</th>
                    <th class="text-center col-md-1">Actions</th>
                </tr>
                </thead>
                <tbody>
                {% for entity in entities %}
                    <tr>
                        <!--/*<td><a href="{{ path('worktypes_show', { 'id': entity.id }) }}*/">{{ entity.id }}</a></td>-->
                        <td>{{ entity.worktype }}</td>
                        <td>{{ entity.description }}</td>
                        <td class="text-center">
                            <a href="{{ path('worktypes_show', { 'id': entity.id }) }}"><span class="glyphicon glyphicon-eye-open"></span></a>
                            <a href="{{ path('worktypes_edit', { 'id': entity.id }) }}"><span class="glyphicon glyphicon-pencil"></span></a>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
            <div class="container-fluid">
                <div class="col-md-3 text-muted text-left">
                    <strong>{{ cant_worktypes }}</strong> registered work types
                    {% if last_page > 1 %}
                        - page <strong>{{ current_page }}/{{ last_page }}</strong>
                    {% endif %}
                </div>
                <div class="col-md-6 text-center">
                    {% if last_page > 1 %}
                        {% if current_page > 1 %}
                            <a href="{{ path('worktypes', { 'page': 1 }) }}" >
                                <span class="glyphicon glyphicon-step-backward "
                                      alt="First page" title="First page"/>
                            </a>

                            <a href="{{ path('worktypes', { 'page': previous_page }) }}">
                                <span class="glyphicon glyphicon-backward" alt="Previous page" title="Previous page" />
                            </a>
                        {% endif %}

                        {% for page in 1..last_page %}
                            {% if page == current_page %}
                                {{ page }}
                            {% else %}
                                <a href="{{ path('worktypes', { 'page': page }) }}">{{ page }}</a>
                            {% endif %}
                        {% endfor %}

                        {% if last_page > current_page %}
                            <a href="{{ path('worktypes', { 'page': next_page }) }}">
                                <span class="glyphicon glyphicon-forward" alt="Next page" title="Next page" />
                            </a>

                            <a href="{{ path('worktypes', { 'page': last_page }) }}">
                                <span class="glyphicon glyphicon-step-forward" alt="Last page" title="Last page" />
                            </a>
                        {% endif %}
                    {% endif %}
                </div>
                <div class="col-md-3 text-right">
                    <a href="{{ path('worktypes_new') }}">
                        <span class="glyphicon glyphicon-plus-sign"></span>
                        Create
                    </a>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript">
        // Activates knockout.js
        //ko.applyBindings(baseViewModel, document.getElementById("menu-bar"));
    </script>
{% endblock %}