@using System.Linq
@using MrCMS.Web.Apps.Ecommerce.Entities.GiftCards
@using MrCMS.Web.Apps.Ecommerce.Helpers
@model MrCMS.Web.Apps.Ecommerce.Models.CartModel

<div class="row margin-bottom-10">
    <div class="col-sm-12 line-height-30">
        <label>
            @Resource("Gift Cards")
        </label>
        <div class="input-group">
            <input class="form-control" type="text" data-gift-card-code id="gift-card-code" placeholder="@Resource("Enter gift card code")" />
            <span class="input-group-btn">
                <button id="apply-gift-card-code" data-apply-gift-card-code="gift-card-code" class="btn btn-default btn-block">@Resource("Apply Gift Card")</button>
            </span>
        </div>
    </div>
</div>
<div data-gift-card-message="gift-card-code">

</div>
@if (Model.AppliedGiftCards.Any())
{
    foreach (GiftCard card in Model.AppliedGiftCards)
    {
        <div class="row margin-bottom-10">
            <div class="col-xs-8 col-sm-6">
                Code - @card.Code
                <a href="#" data-remove-gift-card="@card.Code">&times;</a>
            </div>
            <div class="col-xs-4 col-sm-6 text-right">
                @card.AvailableAmount.ToCurrencyFormat()
            </div>
        </div>
    }
}
