<!DOCTYPE html>
<html lang="it">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Articoli Venduti</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>

<body>
    <div class="container mt-4">
        <h1 class="mb-4">Articoli Venduti</h1>
        <a href="http://vps-88271abb.vps.ovh.net/apimacro/public/export-articles-sales-json" target="_blank">EXPORT</a>
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th>Id Articolo</th>
                    <th>Titolo</th>
                    <th>Data Pubbl</th>
                    <th>ISBN</th>
                    <th>Pagine</th>
                    <th>Misure</th>
                    <th>Rank 3 M</th>
                    <th>Rank 6 M</th>
                    <th>Rank 1 Y</th>
                    <th>Ult Ordi</th>
                    <th>Tot Venduti</th>
                    <th>Ult 3 Mese</th>
                    <th>Ult 6 Mesi</th>
                    <th>Ult Anno</th>

                </tr>
            </thead>
            <tbody>
                <!--<pre>{{ print_r($articoliVenduti, true) }}</pre>-->

                @if ($articoliVenduti->isEmpty())
                    <tr>
                        <td colspan="6" class="text-center">Nessun articolo trovato.</td>
                    </tr>
                @else
                    @foreach ($articoliVenduti as $articolo)
                        @if (isset($articolo->Ean13))
                            <tr>

                                <td>@if (isset($articolo->IdArticolo))
                                    <a href="/apimacro/public/view-info-articolo/{{$articolo->IdArticolo}}"
                                        target="_blank">{{ $articolo->IdArticolo }}</a>
                                @endif
                                </td>


                                <td>@if (isset($articolo->Titolo)){{ $articolo->Titolo }}@endif</td>

                                <td>@if (isset($articolo->DataPubblicazione)){{ \Carbon\Carbon::parse($articolo->DataPubblicazione)->format('d/m/Y') }}@endif
                                </td>


                                <td>@if (isset($articolo->Ean13)){{ $articolo->Ean13 }}@endif</td>

                                <td>@if (isset($articolo->Pagine)){{ $articolo->Pagine }}@endif</td>
                                <td>@if (isset($articolo->misure)){{ $articolo->misure }}@endif</td>

                                <td>@if (isset($articolo->rank3M))
                                    {{ $articolo->rank3M }}
                                @endif
                                </td>
                                <td>@if (isset($articolo->rank6M))
                                    {{ $articolo->rank6M }}
                                @endif
                                </td>

                                <td>@if (isset($articolo->rank1Y))
                                    {{ $articolo->rank1Y }}
                                @endif
                                </td>

                                <td>@if (isset($articolo->ultimoOrdine)){{ \Carbon\Carbon::parse($articolo->ultimoOrdine)->format('d/m/Y') }}@endif
                                </td>


                                <td>@if (isset($articolo->totVen))
                                    <a href="/apimacro/public/view-ordini-by-idarticolo/{{$articolo->IdArticolo}}"
                                        target="_blank">{{ $articolo->totVen }}</a>
                                @endif
                                </td>

                                <td>@if (isset($articolo->venduti3mesi))
                                    {{ $articolo->venduti3mesi }}
                                @endif
                                </td>
                                <td>@if (isset($articolo->venduti6mesi))
                                    {{ $articolo->venduti6mesi }}
                                @endif
                                <td>@if (isset($articolo->venduti1anno))
                                    {{ $articolo->venduti1anno }}
                                @endif
                                </td>
                            </tr>
                        @endif
                    @endforeach
                @endif
            </tbody>
        </table>
    </div>
</body>

</html>