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

{% block title %} Réservation {% endblock %}

{% block content %}

<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-gray-800">Liste Valide</h1>
    <ol class="breadcrumb float-sm-right">
        <li class="breadcrumb-item active">Réservation</li>
        <li class="breadcrumb-item">Liste Valider</li>
    </ol>
</div>



<!-- Begin Page Content -->
<div class="container-fluid">
    
    {% include 'backend_admin/basic/notice.html.twig' %}

    <!-- DataTales Example offset-1-->
    <div class="card shadow mb-4">
       
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary">Liste des Réservations Valider</h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="dataTablesSociete" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Date Validation</th>
                            <th>Client</th>
                            <th>Article / Service</th>
                            <th>Quantité / RDV</th>
                            <th>Montant</th>
                            <th>Avance <br> (payer en site)</th>
                            <th>Reste <br> (payer en société)</th>
                            <th>Valider par</th>
                            
                        </tr>
                    </thead>
                    <tbody>
                    {% for reservationValidation in reservationValidations %}
                        {% if reservationValidation.getType() == "ReservationArticleValidation" %}
                            {% set reservationArticle = reservationValidation.getReservationArticle() %}
                            <tr>
                                <td>{{ reservationValidation.getDateAdd()|date("d/m/Y H:i") }}</td>
                                <td>{{ reservationArticle.getClient().getFullName() }}</td>
                                <td>{{ reservationArticle.getArticle().getTitre() }}</td>
                                <td>{{ reservationArticle.getQuantite() }}</td>
                                <td>{{ reservationArticle.getPrix() }} DT</td>
                                <td>{{ reservationArticle.getAvance() }} DT</td>
                                <td>{{ (reservationArticle.getPrix() * reservationArticle.getQuantite()) - reservationArticle.getAvance() }} DT</td>
                                <td>{{ reservationValidation.getPartenaire().getPartenaire().getFullName() }}</td>
                            </tr>
                        {% elseif reservationValidation.getType() == "ReservationServiceValidation"  %}
                            {% set reservationService = reservationValidation.getReservationService() %}
                            <tr>
                                <td>{{ reservationValidation.getDateAdd()|date("d/m/Y H:i") }}</td>
                                <td>{{ reservationService.getClient().getFullName() }}</td>
                                <td>{{ reservationService.getService().getTitre() }}</td>
                                <td>{{ reservationService.getDateRdv()|date("d/m/Y H:i") }}</td>
                                <td>{{ reservationService.getPrix() }} DT</td>
                                <td>{{ reservationService.getAvance() }} DT</td>
                                <td>{{ reservationService.getPrix() - reservationService.getAvance() }} DT</td>
                                <td>{{ reservationValidation.getPartenaire().getPartenaire().getFullName() }}</td>
                            </tr>
                        {% endif %}
                    {% endfor %}                        
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>


{% endblock %}
