<div class="card">
    <div class="card-header">
        <h3 class="card-title">Dernières commandes</h3>

        <div class="card-tools">
            <button type="button" class="btn btn-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
            <button type="button" class="btn btn-tool" data-widget="remove"><i class="fa fa-times"></i></button>
        </div>
    </div>
    <div class="card-body">
        <div class="table-responsive">
            <table class="table no-margin">
                <thead>
                    <tr>
                        <th>Nom</th>
                        <th>Localisation</th>
                        <th>Date</th>
                        <th class="text-right">Montant</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    @if (count($lastOrders))
                        @foreach ($lastOrders as $order)
                            <tr>
                                <td>
                                    @if ($order->customer)
                                        <a href="{{ route('Admin.Shop.Customers.edit', ['id' => $order->customer->id]) }}"
                                            class="alert-link green">
                                            {{ $order->customer->first_name }}
                                            {{ $order->customer->last_name }}
                                        </a>
                                    @else
                                        <span class="text-muted">Client supprimé</span>
                                    @endif
                                </td>
                                <td>
                                    @if ($order->customer)
                                        {{ $order->customer->city }} ({{ substr($order->customer->zipcode, 0, 2) }})
                                    @endif
                                </td>
                                <td>{{ Carbon\Carbon::parse($order->created_at)->format('d/m/Y H:i') }}</td>
                                <td class="text-right font-weight-bold">
                                    {{ $order->total_shipped }} €
                                </td>
                                <td class="text-right">
                                    <a href="{{ route('Admin.Shop.Orders.edit', ['id' => $order->id]) }}">
                                        <button class="btn btn-sm btn-success"><i class="fa fa-eye"></i></button>
                                    </a>
                                </td>
                            </tr>
                        @endforeach
                    @endif
                </tbody>
            </table>
        </div>
    </div>
    <div class="card-header clearfix">
        <!--
        <a href="{{ route('Admin.Shop.Orders.create') }}" class="btn btn-sm btn-info btn-flat pull-left">
            Nouvelle commande
        </a>
        -->
        <a href="{{ route('Admin.Shop.Orders.index') }}" class="btn btn-sm btn-default btn-flat pull-right">
            Voir toutes les commandes
        </a>
    </div>
</div>
