@using MrCMS.Helpers
@model MrCMS.Web.Apps.Ecommerce.Entities.Discounts.Discount

@{
    Layout = "~/Areas/Admin/Views/Shared/_LayoutPopup.cshtml";
    var discountTypeOptions = ViewData["discount-type-options"] as List<SelectListItem>;
    Html.IncludeScript("~/Apps/Ecommerce/Areas/Admin/Content/Scripts/custom/discount.js");
    var requestUrl = HttpContext.Current.Request.Url;
    var url = string.Format("{0}{1}{2}", requestUrl.Scheme, Uri.SchemeDelimiter, requestUrl.Authority);
}
@using (Html.BeginForm("Add", "Discount", FormMethod.Post))
{
    <fieldset>
        <legend>
            Add Discount
            <span class="btn-group  display-inline  pull-right">
                <input type="submit" class="btn-primary btn" value="Add Discount" />
            </span>
        </legend>
        <div class="form-group">
            @Html.LabelFor(x => x.Name)
            @Html.TextBoxFor(x => x.Name, new { @class = "form-control" })
            @Html.ValidationMessageFor(x => x.Name)
        </div>
        <div class="form-group">
            @Html.LabelFor(x => x.ValidFrom)
            @Html.TextBoxFor(x => x.ValidFrom, new { @class = "form-control date-time-picker" })
            @Html.ValidationMessageFor(x => x.ValidFrom)
        </div>
        <div class="form-group">
            @Html.LabelFor(x => x.ValidUntil)
            @Html.TextBoxFor(x => x.ValidUntil, new { @class = "form-control date-time-picker" })
            @Html.ValidationMessageFor(x => x.ValidUntil)
        </div>
        <div class="form-group">
            @Html.InlineCheckboxFor(discount => discount.RequiresCode, checkboxAttributes: new {@checked = "checked"})
        </div>
        <div class="form-group" data-code-field>
            @Html.LabelFor(x => x.Code)
            @Html.TextBoxFor(x => x.Code, new { @class = "form-control" })
            @Html.ValidationMessageFor(x => x.Code)
        </div>
        <div class="form-group">
            @Html.InlineCheckboxFor(x => x.CanBeAppliedFromUrl, checkboxAttributes: new {@checked = "checked"})
        </div>
        <div class="form-group from-url-group" data-applied-by-url>
            @Html.LabelFor(x => x.SuccessMessage)
            @Html.TextBoxFor(x => x.SuccessMessage, new {@class = "form-control"})
            @Html.ValidationMessageFor(x => x.SuccessMessage)
        </div>
        <div class="form-group from-url-group" data-applied-by-url>
            @Html.LabelFor(x => x.AppliedNotYetValidMessage)
            @Html.TextBoxFor(x => x.AppliedNotYetValidMessage, new { @class = "form-control" })
            @Html.ValidationMessageFor(x => x.AppliedNotYetValidMessage)
        </div>
        <div class="form-group from-url-group" data-applied-by-url>
            @Html.LabelFor(x => x.RedirectUrl)
            @Html.TextBoxFor(x => x.RedirectUrl, new { @class = "form-control" })
            @Html.ValidationMessageFor(x => x.RedirectUrl)
        </div>
</fieldset>
}