{% extends 'base2.html.twig' %}

{% block title %}{{ parent() }} - Ebook{% endblock %}

{% block body %}

    <div class="lista-ebook">
    <h1>Livros cadastrados</h1>

    <table class="table">
        <thead>
            <tr>
                <th>Id</th>
                <th>Nome</th>
                <th>Descricao</th>
                <th>Preco</th>
                <th>Imagem</th>
                <th>Arquivo</th>
                <th>actions</th>
            </tr>
        </thead>
        <tbody>
        {% for ebook in ebooks %}
            <tr>
                <td>{{ ebook.id }}</td>
                <td>{{ ebook.nome }}</td>
                <td>{{ ebook.descricao }}</td>
                <td>{{ ebook.preco }}</td>
                <td>{{ ebook.imagem }}</td>
                <td><a href="{{ asset('ebooks/pdf/' ~  ebook.arquivo ) }}">baixar</a></td>
                <td>
                    <a class="btn btn-info" href="{{ path('app_ebook_show', {'id': ebook.id}) }}">show</a>
                    <a class="btn btn-warning" href="{{ path('app_ebook_edit', {'id': ebook.id}) }}">editar</a>
                </td>
            </tr>
        {% else %}
            <tr>
                <td colspan="7">nenhum registro encontrado</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <a class="btn btn-primary" href="{{ path('app_ebook_new') }}">Novo livro</a>

    </div>
{% endblock %}
