@model Nop.Web.Models.ShoppingCart.WishlistModel
@using Nop.Core.Domain.Orders
@using Nop.Web.Models.Checkout
@{
    Layout = "~/Views/Shared/_ColumnsOne.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Wishlist").Text);
}
<div class="wishlist-page">
    <div class="page-title">
        <h1>
            @if (Model.IsEditable)
            {
                @T("Wishlist")
            }
            else
            {
                @string.Format(T("Wishlist.WishlistOf").Text, Model.CustomerFullname);
            }
        </h1>
    </div>
    <div class="clear">
    </div>
    <div class="body">
        <div class="wishlist-content">
            @if (Model.Items.Count > 0)
            {
                if (Model.Warnings.Count > 0)
                {
                <div class="warning-box">
                    <div class="warning-text">
                        @for (int i = 0; i < Model.Warnings.Count; i++)
                        {
                            @Model.Warnings[i]
                       if (i != Model.Warnings.Count - 1)
                       {
                            <br />
                       }
                        }
                    </div>
                </div>
                }
                using (Html.BeginRouteForm("Wishlist", FormMethod.Post))
                {
                <table class="cart">
                    @if (Model.IsEditable)
                    {
                        <col width="1" />
                        <col width="1" />
                    }
                    @if (Model.ShowSku)
                    {
                        <col width="1" />
                    }
                    @if (Model.ShowProductImages)
                    {
                        <col width="1" />
                    }
                    <col />
                    <col width="1" />
                    <col width="1" />
                    <col width="1" />
                    <thead>
                        <tr class="cart-header-row">
                            @if (Model.IsEditable)
                            {
                                <th>
                                    @T("ShoppingCart.Remove")
                                </th>                         
                                <th>
                                    <span class="nobr">
                                        @T("ShoppingCart.AddToCart")
                                    </span>
                                </th>
                            }
                            @if (Model.ShowSku)
                            {
                                <th>
                                    @T("ShoppingCart.SKU")
                                </th>
                            }
                            @if (Model.ShowProductImages)
                            {
                                <th class="picture">
                                </th>
                            }
                            <th>
                                @T("ShoppingCart.Product(s)")
                            </th>
                            <th>
                                @T("ShoppingCart.UnitPrice")
                            </th>
                            <th>
                                @T("ShoppingCart.Quantity")
                            </th>
                            <th class="end">
                                @T("ShoppingCart.ItemTotal")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.Items)
                        {
                            <tr class="cart-item-row">
                                @if (Model.IsEditable)
                                {
                                    <td>
                                        <input id="removefromcart" type="checkbox" name="removefromcart" value="@(item.Id)" />
                                    </td>
                                    <td>
                                        <input id="addtocart" type="checkbox" name="addtocart" value="@(item.Id)" />
                                    </td>
                                }
                                @if (Model.ShowSku)
                                {
                                    <td style="white-space: nowrap;">
                                        @item.Sku
                                    </td>
                                }
                                @if (Model.ShowProductImages)
                                {
                                    <td class="productpicture">
                                        <img style="border-width: 0px;" alt="@item.Picture.AlternateText" src="@item.Picture.ImageUrl" title="@item.Picture.Title" />
                                    </td>
                                }
                                <td class="product">
                                    <a href="@Url.RouteUrl("Product", new { productId = item.ProductId, SeName = item.ProductSeName })" title="View details">@item.ProductName</a>
                                    @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                    {
                                        <br />
                                        @Html.Raw(item.AttributeInfo)
                                    }
                                    @if (!String.IsNullOrEmpty(item.RecurringInfo))
                                    {
                                        <br />
                                        @Html.Raw(item.RecurringInfo)
                                    }
                                    @if (item.Warnings.Count > 0)
                                    {
                                        <div class="warning-box">
                                            <div class="warning-text">
                                                @for (int i = 0; i < item.Warnings.Count; i++)
                                                {
                                                    @item.Warnings[i]
                                               if (i != item.Warnings.Count - 1)
                                               {
                                                    <br />
                                               }
                                                }
                                            </div>
                                        </div>
                                    }
                                </td>
                                <td style="white-space: nowrap;">
                                    <span class="productPrice">@item.UnitPrice</span>
                                </td>
                                <td style="white-space: nowrap;">
                                    @if (Model.IsEditable)
                                    {
                                        <input name="itemquantity@(item.Id)" type="text" value="@(item.Quantity)" id="itemquantity@(item.Id)" class="shoppingcartquantitytext" size="4" />
                                    }
                                    else
                                    {
                                        <span>@item.Quantity</span>
                                    }
                                </td>
                                <td style="white-space: nowrap;" class="end">
                                    <span class="productPrice">@item.SubTotal</span>
                                    @if (!String.IsNullOrEmpty(item.Discount))
                                    {
                                        <br />
                                        @T("ShoppingCart.ItemYouSave")<text>:</text>
                                        <text>&nbsp; &nbsp;</text>@item.Discount
                                    }
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>                
                <div class="clear">
                </div>                        
                <div>
                    @if (Model.IsEditable)
                    {
                        <div class="common-buttons">
                            <input type="submit" name="updatecart" value="@T("Wishlist.UpdateCart")" id="updatecart" class="updatewishlistbutton" />
                            <input type="submit" name="addtocartbutton" value="@T("ShoppingCart.AddToCart")" id="addtocartbutton" class="updatewishlistbutton" />
                            @if (Model.EmailWishlistEnabled)
                            {
                                <input type="button" name="emailafriend" value="@T("Wishlist.EmailAFriend")" id="emailafriend"  class="updatewishlistbutton" onclick="setLocation('@Url.RouteUrl("EmailWishlist")')" />
                            }
                        </div>
                    }
                </div>        
                }
            }
            else
            {
                @T("Wishlist.CartIsEmpty")
            }
        </div>
        @if (Model.IsEditable && Model.Items.Count > 0)
        {
            <div class="shareinfo">
                <p>
                    <span class="sharelabel">@T("Wishlist.YourWishlistURL"):</span>
                </p>
                <p>
                    <a href="@Url.RouteUrl("Wishlist", new { customerGuid = Model.CustomerGuid })" class="sharelink">@Url.RouteUrl("Wishlist", new { customerGuid = Model.CustomerGuid }, "http")</a>
                </p>
            </div>
        }
    </div>
</div>
