
<form action="/commander" method="post" >
<table class="table">
    <thead>
    <tr id="panierLien">
        <th>Id commande</th>
        <th>Détails</th>
        <th>Nom/Prenom</th>
        <th>Email</th>
        <th>Adesse</th>
        <th>Total</th>
    </tr>


    <%  console.log('resultdeOUF');  console.log(locals.result) ;%>
    <% locals.result.forEach(function(commande) { %>
    <tr>
        
        <td><%=  commande.numCommande[0] %></td>
        <td ><a id="deplier<%= commande['numCommande'][0].replace('0.','') %>" onclick="deplierCommande('<%= commande['numCommande'][0].replace('0.','') %>')"  style="cursor:pointer;">Afficher détails</a>
            <div id="commandes<%= commande.numCommande[0].replace('0.','') %>" hidden>
                <table class="table">
                    <thead>
                        <tr id="panierLien">
                            <th>Produits</th>
                            <th>Quantités</th>
                            <th>Prix</th>
                        </tr> 
                   
                        <% 

                            for(var i = 0; i < commande.nom.length; i++) { %>
                                <tr>  
                                <td>
                                    <%= commande.nom[i] %>
                                </td>  
                                <td>
                                    <%= commande.quantite[i] %>
                                </td> 
                                <td>
                                    <%= commande.prix[i] %>
                                </td> 
                            </tr>  
                        <% } %>  
                       
                                     
                  
                   
                </thead>
                </table>
             </div>
        </td>
        <td><%=  commande.nomPersonne %>/<%=  commande.prenomPersonne %></td>
        <td><%=  commande.email %></td>
        <td><%=  commande.adresse %></td>
        <td><%=  commande.total %></td>

        

     

    </tr>
    <% }) %>
    </thead>
    <tbody id="panier">
    </tbody>
</table>
<script src="../js/gestion.js"></script>

