@model OrderViewModel
@{
    ViewData["Title"] = "My Order History";
}
@{
    ViewData["Title"] = "Order Detail";
}

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

            <article class="esh-orders-detail-items row">
                <section class="esh-orders-detail-item col-xs-3">@Model.OrderNumber</section>
                <section class="esh-orders-detail-item col-xs-3">@Model.OrderDate</section>
                <section class="esh-orders-detail-item col-xs-2">$@Model.Total.ToString("N2")</section>
                <section class="esh-orders-detail-item col-xs-3">@Model.Status</section>
            </article>
        </section>

        <section class="esh-orders-detail-section">
            <article class="esh-orders-detail-titles row">
                <section class="esh-orders-detail-title col-xs-12">Shipping Address</section>
            </article>

            <article class="esh-orders-detail-items row">
                <section class="esh-orders-detail-item col-xs-12">@Model.ShippingAddress.Street</section>
            </article>

            <article class="esh-orders-detail-items row">
                <section class="esh-orders-detail-item col-xs-12">@Model.ShippingAddress.City</section>
            </article>

            <article class="esh-orders-detail-items row">
                <section class="esh-orders-detail-item col-xs-12">@Model.ShippingAddress.Country</section>
            </article>
        </section>

        <section class="esh-orders-detail-section">
            <article class="esh-orders-detail-titles row">
                <section class="esh-orders-detail-title col-xs-12">ORDER DETAILS</section>
            </article>

            @for (int i = 0; i < Model.OrderItems.Count; i++)
            {
                var item = Model.OrderItems[i];
                <article class="esh-orders-detail-items esh-orders-detail-items--border row">
                    <section class="esh-orders-detail-item col-md-4 hidden-md-down">
                        <img class="esh-orders-detail-image" src="@item.PictureUrl">
                    </section>
                    <section class="esh-orders-detail-item esh-orders-detail-item--middle col-xs-3">@item.ProductName</section>
                    <section class="esh-orders-detail-item esh-orders-detail-item--middle col-xs-1">$ @item.UnitPrice.ToString("N2")</section>
                    <section class="esh-orders-detail-item esh-orders-detail-item--middle col-xs-1">@item.Units</section>
                    <section class="esh-orders-detail-item esh-orders-detail-item--middle col-xs-2">$ @Math.Round(item.Units * item.UnitPrice, 2).ToString("N2")</section>
                </article>
            }
        </section>

        <section class="esh-orders-detail-section esh-orders-detail-section--right">
            <article class="esh-orders-detail-titles esh-basket-titles--clean row">
                <section class="esh-orders-detail-title col-xs-9"></section>
                <section class="esh-orders-detail-title col-xs-2">TOTAL</section>
            </article>

            <article class="esh-orders-detail-items row">
                <section class="esh-orders-detail-item col-xs-9"></section>
                <section class="esh-orders-detail-item esh-orders-detail-item--mark col-xs-2">$ @Model.Total.ToString("N2")</section>
            </article>
        </section>
    </div>
</div>
