{% 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 En Cours</h1>
    <ol class="breadcrumb float-sm-right">
        <li class="breadcrumb-item active">Réservation</li>
        <li class="breadcrumb-item">Liste En Cours</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 En Cours</h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="dataTablesSociete" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <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>Date Achat</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for reservation in reservations %}
                            {% if reservation.getType() == "ReservationArticle" %}
                                <tr>
                                    <td>{{ reservation.getClient().getFullName() }}</td>
                                    <td>{{ reservation.getArticle().getTitre() }}</td>
                                    <td>{{ reservation.getQuantite() }}</td>
                                    <td>{{ reservation.getPrix() }} DT</td>
                                    <td>{{ reservation.getAvance() }} DT</td>
                                    <td>{{ (reservation.getPrix() * reservation.getQuantite()) - reservation.getAvance() }} DT</td>
                                    <td>{{ reservation.getDateAdd()|date("d/m/Y H:i") }} </td>
                                </tr>
                            {% elseif reservation.getType() == "ReservationService"  %}
                                <tr>
                                    <td>{{ reservation.getClient().getFullName() }}</td>
                                    <td>{{ reservation.getService().getTitre() }}</td>
                                    <td>{{ reservation.getDateRdv()|date("d/m/Y H:i") }}</td>
                                    <td>{{ reservation.getPrix() }} DT</td>
                                    <td>{{ reservation.getAvance() }} DT</td>
                                    <td>{{ reservation.getPrix() - reservation.getAvance() }} DT</td>
                                    <td>{{ reservation.getDateAdd()|date("d/m/Y H:i") }} </td>
                                </tr>
                            {% endif %}
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>


{% endblock %}
