@using Microsoft.eShopOnContainers.WebMVC.ViewModels

@model IEnumerable<Microsoft.eShopOnContainers.WebMVC.ViewModels.Order>

@{
     ViewData["Title"] = "My Orders";
     var headerList = new List<Header>() {
          new Header() { Controller = "Catalog", Text = "Back to catalog" } };
}

<div class="esh-orders">
    <partial name="_Header" model="headerList"/>

    <div class="container">
        <article class="esh-orders-titles row">
            <section class="esh-orders-title col-2">Order number</section>
            <section class="esh-orders-title col-4">Date</section>
            <section class="esh-orders-title col-2">Total</section>
            <section class="esh-orders-title col-2">Status</section>
            <section class="esh-orders-title col-2"></section>
        </article>

        @foreach (var item in Model)
        {
            <article class="esh-orders-items row">
                <section class="esh-orders-item col-2">@Html.DisplayFor(modelItem => item.OrderNumber)</section>
                <section class="esh-orders-item col-4">@Html.DisplayFor(modelItem => item.Date)</section>
                <section class="esh-orders-item col-2">$ @Html.DisplayFor(modelItem => item.Total)</section>
                <section class="esh-orders-item col-2">@Html.DisplayFor(modelItem => item.Status)</section>
                <section class="esh-orders-item col-2">
                    <form asp-action="OrderProcess" id="orderForm+@item.OrderNumber" method="post">
                        <input type="hidden" name="orderId" value="@item.OrderNumber" />
                        <select name="actionCode" asp-items="@item.ActionCodeSelectList"
                                disabled=@(item.Status != "paid")
                                onchange="document.getElementById('orderForm+@item.OrderNumber').submit()">
                            <option value="">&nbsp;&nbsp;Select Action</option>
                            <option value="">------------------</option>
                        </select>
                    </form>
                </section>
            </article>
        }
    </div>
</div>