<%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Administration.Modules.ProductVariantAttributesControl"
    CodeBehind="ProductVariantAttributes.ascx.cs" %>
<%@ Register TagPrefix="nopCommerce" TagName="SelectDiscountsControl" Src="SelectDiscountsControl.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="NumericTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="DecimalTextBox" Src="DecimalTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="ToolTipLabel" Src="ToolTipLabelControl.ascx" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:GridView ID="gvProductVariantAttributes" runat="server" AutoGenerateColumns="false"
    DataKeyNames="ProductVariantAttributeID" OnRowDeleting="gvProductVariantAttributes_RowDeleting"
    OnRowDataBound="gvProductVariantAttributes_RowDataBound" OnRowCommand="gvProductVariantAttributes_RowCommand"
    Width="100%">
    <Columns>
        <asp:TemplateField HeaderText="Attribute" ItemStyle-Width="25%">
            <ItemTemplate>
                <asp:DropDownList ID="ddlProductAttribute" runat="server" />
                <asp:HiddenField ID="hfProductVariantAttributeID" runat="server" Value='<%# Eval("ProductVariantAttributeID") %>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Is Required" ItemStyle-Width="10%">
            <ItemTemplate>
                <asp:CheckBox ID="cbIsRequired" runat="server" Checked='<%# Eval("IsRequired") %>'
                    ToolTip="Is this attribute required" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Control type" ItemStyle-Width="20%">
            <ItemTemplate>
                <asp:DropDownList ID="ddlAttributeControlType" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
            ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtDisplayOrder"
                    Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="Display order is required"
                    RangeErrorMessage="The value must be from -99999 to 99999" ValidationGroup="ProductVariantAttribute"
                    MinimumValue="-99999" MaximumValue="99999"></nopCommerce:NumericTextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Values" ItemStyle-Width="15%">
            <ItemTemplate>
                <a href="ProductVariantAttributeValues.aspx?ProductVariantAttributeID=<%#Eval("ProductVariantAttributeID")%>"
                    title="View / Edit attribute values">View/Edit value (Total:
                    <%#((ProductVariantAttributeValueCollection)Eval("ProductVariantAttributeValues")).Count%>)
                </a>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Update" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:Button ID="btnUpdate" runat="server" CssClass="adminButton" Text="Update" ValidationGroup="ProductVariantAttribute"
                    CommandName="UpdateProductVariantAttribute" ToolTip="Update product attribute" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:Button ID="btnDeleteProductVariantAttribute" runat="server" CssClass="adminButton"
                    Text="Delete" CausesValidation="false" CommandName="Delete" ToolTip="Delete product attribute" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<p>
    <strong>Add a new attribute </strong>
</p>
<table class="adminContent">
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblAttribute" Text="Select attribute:"
                ToolTip="Select a product attribute to add to this product variant. To manage product attribute types, go to Catalog : Attributes : Product Attributes."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:DropDownList class="text" ID="ddlNewProductAttributes" AutoPostBack="False"
                CssClass="adminInput" runat="server">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblAttributeRequired" Text="Required:"
                ToolTip="When an attribute is required, the customer must choose an appropriate attribute value before they can add the product to their shopping cart."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:CheckBox ID="cbNewProductVariantAttributeIsRequired" runat="server" Checked="true" />
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblAttributeControlType" Text="Control Type:"
                ToolTip="Choose how to display your attribute values." ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:DropDownList class="text" ID="ddlAttributeControlType" AutoPostBack="False"
                CssClass="adminInput" runat="server">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblAttributeDisplayOrder" Text="Display order:"
                ToolTip="The product attribute display order. 1 represents the first item in the list."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtNewProductVariantAttributeDisplayOrder"
                Value="1" RequiredErrorMessage="Display order is required" RangeErrorMessage="The value must be from -99999 to 99999"
                MinimumValue="-99999" MaximumValue="99999" ValidationGroup="NewProductVariantAttribute">
            </nopCommerce:NumericTextBox>
        </td>
    </tr>
    <tr>
        <td colspan="2" align="left">
            <asp:Button runat="server" ID="btnNewProductVariantAttribute" CssClass="adminButton"
                Text="Add attribute" ValidationGroup="NewProductVariantAttribute" OnClick="btnNewProductVariantAttribute_Click"
                ToolTip="Add product attribute" />
        </td>
    </tr>
</table>
