{% extends 'base.html' %}

{% block menuapp %}

{% include 'lyrics/_menu-lyrics.html' %}

{% endblock menuapp %}

{% block content %}
<div class="container-xl">
    <div class="app-card app-card-notification shadow-sm mb-4">
        <div class="app-card-header px-4 py-3">
            <div class="row g-3 align-items-center">
                <div class="col-12 col-lg-auto text-center text-lg-start">
                    {% if artista.foto %}
                    <p><img src="{{ artista.foto.url }}" alt="{{ artista.nombre}}" style="width:200px;height:200px;"></p>
                    {% else %}
                    <p>No hay imágen disponible</p>
                    {% endif %}
                </div>
                <div class="col-12 col-lg-auto text-center text-lg-start">
                    <h4>{{ artista.nombre }}</h4>

                    <ul class="notification-meta list-inline mb-0">
                        <li class="list-inline-item">{{ artista.nombre }}</li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="app-card-body p-4">

            {% if albumes %}
                <table class="table app-table-hover mb-0 text-left">
                    <thead>
                        <tr>
                            <th class="cell">Título</th>
                            <th class="cell">Artista</th>
                            <th class="cell">Year</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for album in albumes %}
                        <tr>
                            <td class="cell"><a href="{% url 'lyrics:detalle_album' album_id=album.id %}">{{ album.name }}</a></td>
                            <td class="cell">{{ album.artist }}</td>
                            <td class="cell">{{ album.year }}</td>
                        </tr>
                        {% endfor %}	
                    </tbody>
                </table>
            {% else %}
                <p>No se han encontrado albums para este artista</p>
            {% endif %}
        </div>
    </div>

    <div class="row g-3 mb-4 align-items-center justify-content-between">
        <div class="col-auto">
            <a class="btn app-btn-secondary" href="{% url 'lyrics:lista_albumes' %}">Volver al inicio</a>
        </div>

        <div class="col-auto">
            <a class="btn app-btn-primary" href="{% url 'lyrics:nuevo_album' %}">Añadir album</a> <!-- Faltaría poner el id del artista-->
        </div>
    </div>
</div>
{% endblock %}

