@using System.Drawing
@using MrCMS.Web.Apps.Ecommerce.Helpers
@using MrCMS.Web.Apps.Ecommerce.Models
@model ProductCardModel

<div class="product-con">
    <div class="product-image">
        @if (Model.ETag != null && !string.IsNullOrEmpty(Model.ETag.Image))
        {
            <a href="/@Model.Url" class="e-tag-image">
                @RenderImage(Model.ETag.Image, attributes: new { @class = "img-responsive" })
            </a>
        }
        <a href="/@Model.Url">@RenderImage(Model.Image, new Size { Width = 200, Height = 175 }, attributes: new { @class = "img-responsive" })</a>
    </div>
    <div class="product-info margin-top-10">
        @if (Model.VariantId.HasValue)
        {
            <div class="padding-bottom-10">
                @using (Html.BeginForm("Add", "AddToCart", FormMethod.Post))
                {
                    @Html.Hidden("ProductVariant.Id", Model.VariantId)
                    @Html.Hidden("quantity", 1)
                    <button class="btn btn-primary" style="margin-left: 0;">Add to basket</button>
                }
            </div>
        }
        <div class="product-name">
            <a href="/@Model.Url">@Model.Name</a>
        </div>
        <div class="product-price">
            <span class="current-price">
                @Model.Price.ToCurrencyFormat()
            </span>
            @if (Model.PreviousPrice.HasValue)
            {
                <span class="old-price">
                    <span class="inner">
                        @Model.PreviousPriceText : @Model.PreviousPrice.ToCurrencyFormat()
                    </span>
                </span>
                <span></span>
            }
        </div>
    </div>
</div>
