@model IEnumerable<WebVentaCoche.Models.Order>

@{
    ViewData["Title"] = "Lista de Órdenes";
}

<div class="container mt-5">
    <h2 class="text-center mb-4">Lista de Órdenes</h2>
    <table class="table table-striped table-hover">
        <thead>
            <tr>
                <th>ID</th>
                <th>Fecha del Pedido</th>
                <th>Cliente</th>
                <th>Estado</th>
                <th>Total</th>
                <th>Acciones</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var order in Model)
            {
                <tr>
                    <td>@order.Id</td>
                    <td>@order.OrderDate.ToString("dd/MM/yyyy")</td>
                    <td>@order.User.Name @order.User.Surname</td>
                    <td>@order.Status</td>
                    <td>@order.TotalAmount.ToString("C")</td>
                    <td>
                        <a href="@Url.Action("Details", "Order", new { id = order.Id })" class="btn btn-info btn-sm">Detalles</a>
                        <a href="@Url.Action("Edit", "Order", new { id = order.Id })" class="btn btn-warning btn-sm">Editar</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
