<%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Administration.Modules.CurrenciesControl"
    CodeBehind="Currencies.ascx.cs" %>
<%@ Register TagPrefix="nopCommerce" TagName="DecimalTextBox" Src="DecimalTextBox.ascx" %>
<div class="section-header">
    <div class="title">
        <img src="Common/ico-configuration.png" alt="Configuration" />
        Currencies
    </div>
    <div class="options">
        <asp:Button runat="server" Text="Get live rates" CssClass="adminButtonBlue" ID="btnGetLiveRates"
            ValidationGroup="GetLiveRates" OnClick="btnGetLiveRates_Click" ToolTip="Get live currency rates (primary exchange rate currency must be set to euro)" />
        <input type="button" onclick="location.href='CurrencyAdd.aspx'" value="Add new" id="btnAddNew"
            class="adminButtonBlue" title="Add a new currency" />
    </div>
</div>
<asp:UpdatePanel ID="UpdatePanelCurrencies" runat="server">
    <ContentTemplate>
        <asp:GridView ID="gvCurrencies" runat="server" AutoGenerateColumns="False" Width="100%">
            <Columns>
                <asp:BoundField DataField="CurrencyID" HeaderText="CurrencyID" Visible="False"></asp:BoundField>
                <asp:TemplateField HeaderText="Name" ItemStyle-Width="20%">
                    <ItemTemplate>
                        <a href="CurrencyDetails.aspx?CurrencyID=<%#Eval("CurrencyID")%>" title="Edit currency">
                            <%#Server.HtmlEncode(Eval("Name").ToString())%>
                        </a>
                        <asp:HiddenField runat="server" ID="hfCurrencyID" Value='<%#Eval("CurrencyID")%>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="CurrencyCode" HeaderText="Currency code" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                <asp:BoundField DataField="DisplayLocale" HeaderText="Display locale" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                <asp:BoundField DataField="Rate" HeaderText="Rate" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                <asp:BoundField DataField="Published" HeaderText="Published" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                <asp:BoundField DataField="DisplayOrder" HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                <asp:TemplateField HeaderText="Primary exchange rate currency" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-Width="14%" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:RadioButton runat="server" ID="rdbIsPrimaryExchangeRateCurrency" Checked='<%#Eval("IsPrimaryExchangeRateCurrency")%>'
                            OnCheckedChanged="rdbIsPrimaryExchangeRateCurrency_CheckedChanged" AutoPostBack="true"
                            ToolTip="Set as primary exchange rate currency" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Primary store currency" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-Width="14%" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:RadioButton runat="server" ID="rdbIsPrimaryStoreCurrency" Checked='<%#Eval("IsPrimaryStoreCurrency")%>'
                            OnCheckedChanged="rdbIsPrimaryStoreCurrency_CheckedChanged" AutoPostBack="true"
                            ToolTip="Set as primary store currency" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="7%"
                    ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <a href="CurrencyDetails.aspx?CurrencyID=<%#Eval("CurrencyID")%>" title="Edit currency">
                            Edit</a>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="up1" runat="server">
    <ProgressTemplate>
        <div class="progress">
            <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/UpdateProgress.gif" />
            Updating .....
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>
<p>
</p>
<h4>
    Live currency rates</h4>
<p>
</p>
<asp:GridView ID="gvLiveRates" runat="server" AutoGenerateColumns="False" Width="400px"
    OnRowCommand="gvLiveRates_RowCommand" OnRowDataBound="gvLiveRates_RowDataBound">
    <Columns>
        <asp:TemplateField HeaderText="Currency code" HeaderStyle-HorizontalAlign="Center"
            ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:Label runat="server" ID="lblCurrencyCode" Text='<%# Eval("CurrencyCode") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Rate" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="100px"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" Width="50px" Value='<%# Eval("Rate") %>'
                    ID="txtRate" RequiredErrorMessage="Rate is required" MinimumValue="0" MaximumValue="99999"
                    ValidationGroup="ApplyLiveRateGrid" RangeErrorMessage="The value must be from 0 to 99999">
                </nopCommerce:DecimalTextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Apply rate" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="100px"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:Button ID="btnApplyRate" runat="server" CssClass="adminButton" Text="Apply rate"
                    ValidationGroup="ApplyLiveRateGrid" CommandName="ApplyLiveRate" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
