{% 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 album %}
                    <div class="col-12 col-lg-auto text-center text-lg-start">						        
                        {% if album.cover_image %}
                        <p><img src="{{ album.cover_image.url }}" alt="{{ album.name }}" style="width:200px;height:200px;"></p>
                        {% else %}
                        <p>No hay imágen disponible</p>
                        {% endif %}
                    </div><!--//col-->    

                    <h4 class="notification-title mb-1">{{ album.name }}</h4>
                    

                    <ul class="notification-meta list-inline mb-0">
                        <li class="list-inline-item"><a href="{% url 'lyrics:detalle_album' album_id=album.id %}">{{ album.name }}</a></li>
                        <li class="list-inline-item">|</li>
                        <li class="list-inline-item">{{ album.artist }}</li>
                        <li class="list-inline-item">|</li>
                        <li class="list-inline-item">{{ album.year }}</li>
                    </ul>
                    {% endif %}
                </div><!--//col-->
            </tr>
            </div><!--//row-->
        </div><!--//app-card-header-->
        <div class="app-card-body p-4">

            {% if songs %}
                <table class="table app-table-hover mb-0 text-left">
                    <thead>
                        <tr>
                            <th>Pista</th>
                            <th>Título</th>
                            <th>Autor</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for song in songs %}
                        <tr>
                            <td class="cell">{{ song.pista }}</td>
                            <td class="cell"><a href="{% url 'lyrics:detalle_song'  song_id=song.id %}">{{ song.title }}</a></td>
                            <td class="cell">{{ song.artist }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            {% else %}
                <p>No songs found matching your query.</p>
            {% endif %}
        </div>

        <div class="col-auto">
            <div class="page-utilities">
                <div class="row g-4 justify-content-start justify-content-md-end align-items-center">
                    <div class="col-auto">
			    <a class="btn app-btn-primary" href="{% url 'lyrics:nuevo_song' %}?album_id={{ album.id}}">Añadir canción</a>
                    </div>
                </div><!--//row-->
            </div><!--//table-utilities-->
        </div><!--//col-auto-->
    </div><!--//app-card-->
{% endblock %}
