<html lang="fr">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>

<table>
    <thead>
    <tr>
        <th>ID_Commande</th>
        <th>ID_CLIENT</th>
        <th>CLIENT</th>
        <th>Date_Precommande</th>
        <th>Designation</th>
        <th>Magasin</th>
        <th>Code_Lot</th>
        <th>Producteur</th>
        <th>Qualité</th>
        <th>Couleur</th>
        <th>Taille</th>
        <th>NBTigesparBacs</th>
        <th>QteBacs</th>
        <th>PrixMini</th>
        <th>Remise1_x</th>
        <th>Remise2_y</th>
        <th>commentaire</th>
        <th>Age</th>
    </tr>
    </thead>
    <tbody>

    @foreach($commandes as $commande)

        @foreach($commande->cart as $cart)

            <?php $cart['produit']->date_arrivage = \Illuminate\Support\Carbon::parse($cart['produit']->date_arrivage); ?>
            <tr>
                <td>{{ $commande->numero or $commande->id }}</td>
                <td>{{$commande->client->code}}</td>
                <td>{{$commande->client->name.' '.$commande->client->prenom}}</td>
                <td>{{ $commande->created_at }}</td>
                <td>{{ $cart['produit']->nom_produit }}</td>
                <td>{{ $cart['produit']->entreprise }}</td>
                <td>{{ $cart['produit']->lot }}</td>
                <td>{{ $cart['produit']->producteur }}</td>
                <td>{{ $cart['produit']->qualite }}</td>
                <td>{{ $cart['produit']->couleur }}</td>
                <td>{{ $cart['produit']->taille }}</td>
                <td>{{ $cart['produit']->nbre_tiges }}</td>
                <td>{{ $cart['qty'] }} </td>
                <td>{{ $cart['produit']->prix_vente }} </td>
                <td>@if($commande->remise1 > 0) 3 @endif</td>
                <td>@if($commande->remise2 > 0) 5 @endif </td>
                <td>{{ $commande->commentaire }} + {{$commande->adresse_livraison }}</td>
                <td>{{ $cart['produit']->date_arrivage->diffInDays($commande->created_at) }} J</td>
            </tr>
        @endforeach
    @endforeach

        </tbody>
    </table>


</body>
</html>