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

{% block title %}  Détail Panier  {% endblock %}

{% block content %}
    <div class="breadcrumb">
        <div class="breadcrumb-inner">
            <ul class="list-inline list-unstyled">
                <li><a href="{{ path('frontend_home_index') }}">Accueil</a></li>
                <li><a href="{{ path('frontend_panier_index') }}">Mes Réservations</a></li>
            </ul>
        </div>
        <!-- /.breadcrumb-inner -->
    </div>

    <div class="body-content outer-top-xs">
        <div class="row ">
            <div class="shopping-cart">
                <div class="shopping-cart-table ">
                    <div class="table-responsive">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th class="cart-romove item">Document</th>
                                    <th class="cart-description item">Image</th>
                                    <th class="cart-description item">Date Réservation</th>
                                    <th class="cart-product-name item">Nom d'Article / Service</th>
                                    <th class="cart-qty item">Quantité / Date RDV</th>
                                    <th class="cart-sub-total item">Prix</th>
                                    <th class="cart-total last-item">Avance</th>
                                    <th class="cart-total last-item">État</th>
                                </tr>
                            </thead>
                            <!-- /thead -->
                            <tbody>
                                {% for key, reservation in reservations %}
                                    
                                    {% if reservation.getType() == 'ReservationArticle' %}
                                        {% set article = reservation.getArticle() %}
                                        <tr>
                                            <td class="romove-item">
                                                <a href="{{ path('frontend_reservation_export_pdf_article', {id:reservation.id} ) }}" title="télécharger la réservation en PDF" class="icon">
                                                    <i class="fa-solid fa-file-pdf fa-2xl"></i>
                                                </a>
                                            </td>
                                            <td class="cart-image">
                                                <a class="entry-thumbnail" href="{{ path('frontend_article_detail', {id:article.getId()}) }}">
                                                    <img src="{{ asset('uploads/images/articles/' ~ article.getImageDefault()) }}" alt="{{ article.getTitre() }}"> 
                                                </a>
                                            </td>
                                            <td class="cart-product-quantity">
                                                <div class="quant-input">
                                                    {{ reservation.getDateAdd()|date("d/m/Y H:i")   }}
                                                </div>
                                            </td>
                                            <td class="cart-product-name-info">
                                                <h4 class='cart-product-description'>
                                                    <a href="{{ path('frontend_article_detail', {id:article.getId()}) }}">
                                                        {{ article.getTitre() }}
                                                    </a>
                                                </h4>
                                            </td>
                                            <td class="cart-product-quantity">
                                                <div class="quant-input">
                                                    {{ reservation.getQuantite()  }}
                                                </div>
                                            </td>
                                            <td class="cart-product-sub-total">
                                                <span class="cart-sub-total-price">{{ reservation.getPrix() }} DT</span>
                                            </td>
                                            <td class="cart-product-grand-total">
                                                <span class="cart-grand-total-price">{{ reservation.getAvance() }} DT</span>
                                            </td>
                                            <td class="cart-product-grand-total">
                                                <span class="cart-grand-total-price">
                                                    <i class="fa-solid fa-clipboard fa-2xl"></i>
                                                </span>
                                            </td>
                                        </tr>
                                    {% elseif  reservation.getType() == 'ReservationService' %}
                                        {% set service = reservation.getService() %}
                                        <tr>
                                            <td class="romove-item">
                                                <a href="{{ path('frontend_reservation_export_pdf_service', {id:reservation.id} ) }}" title="télécharger la réservation en PDF" class="icon">
                                                    <i class="fa-solid fa-file-pdf fa-2xl"></i>
                                                </a>
                                            </td>
                                            <td class="cart-image">
                                                <a class="entry-thumbnail" href="{{ path('frontend_service_detail', {id:service.getId()}) }}">
                                                    <img src="{{ asset('uploads/images/services/' ~ service.getImageDefault()) }}" alt="{{ service.getTitre() }}"> 
                                                </a>
                                            </td>
                                            <td class="cart-product-quantity">
                                                <div class="quant-input">
                                                    {{ reservation.getDateAdd()|date("d/m/Y H:i")   }}
                                                </div>
                                            </td>
                                            <td class="cart-product-name-info">
                                                <h4 class='cart-product-description'>
                                                    <a href="{{ path('frontend_service_detail', {id:service.getId()}) }}">
                                                        {{ service.getTitre() }}
                                                    </a>
                                                </h4>
                                            </td>
                                            <td class="cart-product-quantity">
                                                <div class="quant-input">
                                                    {{ reservation.getDateRdv()|date("d/m/Y H:i")  }}
                                                </div>
                                            </td>
                                            <td class="cart-product-sub-total">
                                                <span class="cart-sub-total-price">{{ reservation.getPrix() }} DT</span>
                                            </td>
                                            <td class="cart-product-grand-total">
                                                <span class="cart-grand-total-price">{{ reservation.getAvance() }} DT</span>
                                            </td>
                                            <td class="cart-product-grand-total">
                                                <span class="cart-grand-total-price">
                                                    <i class="fa-solid fa-clipboard fa-2xl"></i>
                                                </span>
                                            </td>
                                        </tr>
                                    {% endif %}
                                {% endfor %}
                            </tbody>
                        </table>
                        <!-- /table -->
                    </div>
                </div>
                
                
                
                <!-- /.cart-shopping-total -->			
            </div>
            <!-- /.shopping-cart -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /.body-content -->
{% endblock %}
