@model CustomerUserSettingsModel
@using Telerik.Web.Mvc.UI;
@using Nop.Core.Domain.Customers;
@using Nop.Core.Domain.Security;
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
            @T("Admin.Configuration.Settings.CustomerUser")
        </div>
        <div class="options">
            <button type="submit" name="save" value="save" class="t-button">@T("Admin.Common.Save")</button>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {

            $("#@Html.FieldIdFor(model => model.CustomerSettings.AllowCustomersToUploadAvatars)").click(toggleAvatar);
            $("#@Html.FieldIdFor(model => model.CustomerSettings.UsernamesEnabled)").click(toggleUsername);

            toggleAvatar();
            toggleUsername();
        });

        function toggleAvatar() {
            if (getE('@Html.FieldIdFor(model => model.CustomerSettings.AllowCustomersToUploadAvatars)').checked) {
                $('#pnlDefaultAvatarEnabled').show();
            }
            else {
                $('#pnlDefaultAvatarEnabled').hide();
            }
        }

        function toggleUsername() {
            if (getE('@Html.FieldIdFor(model => model.CustomerSettings.UsernamesEnabled)').checked) {
                $('#pnlAllowUsersToChangeUsernames').show();
            }
            else {
                $('#pnlAllowUsersToChangeUsernames').hide();
            }
        }
        
    </script>
    
    @Html.ValidationSummary(false)

    
    @Html.Telerik().TabStrip().Name("customersettings-edit").Items(x =>
{
    x.Add().Text(T("Admin.Configuration.Settings.CustomerUser.CustomerSettings").Text).Content(TabCustomerSettings().ToHtmlString()).Selected(true);
    x.Add().Text(T("Admin.Configuration.Settings.CustomerUser.DateTimeSettings").Text).Content(TabDateTimeSettings().ToHtmlString());
})
}
@helper TabCustomerSettings()
    {
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.UsernamesEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.UsernamesEnabled)
                @Html.ValidationMessageFor(model => model.CustomerSettings.UsernamesEnabled)
            </td>
        </tr>
        <tr id="pnlAllowUsersToChangeUsernames">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.AllowUsersToChangeUsernames):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.AllowUsersToChangeUsernames)
                @Html.ValidationMessageFor(model => model.CustomerSettings.AllowUsersToChangeUsernames)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.UserRegistrationType):
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.CustomerSettings.UserRegistrationType, ((UserRegistrationType)Model.CustomerSettings.UserRegistrationType).ToSelectList())
                @Html.ValidationMessageFor(model => model.CustomerSettings.UserRegistrationType)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.AllowCustomersToUploadAvatars):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.AllowCustomersToUploadAvatars)
                @Html.ValidationMessageFor(model => model.CustomerSettings.AllowCustomersToUploadAvatars)
            </td>
        </tr>
        <tr id="pnlDefaultAvatarEnabled">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.DefaultAvatarEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.DefaultAvatarEnabled)
                @Html.ValidationMessageFor(model => model.CustomerSettings.DefaultAvatarEnabled)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.ShowCustomersLocation):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.ShowCustomersLocation)
                @Html.ValidationMessageFor(model => model.CustomerSettings.ShowCustomersLocation)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.ShowCustomersJoinDate):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.ShowCustomersJoinDate)
                @Html.ValidationMessageFor(model => model.CustomerSettings.ShowCustomersJoinDate)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.AllowViewingProfiles):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.AllowViewingProfiles)
                @Html.ValidationMessageFor(model => model.CustomerSettings.AllowViewingProfiles)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.NotifyNewCustomerRegistration):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.NotifyNewCustomerRegistration)
                @Html.ValidationMessageFor(model => model.CustomerSettings.NotifyNewCustomerRegistration)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.HideDownloadableProductsTab):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.HideDownloadableProductsTab)
                @Html.ValidationMessageFor(model => model.CustomerSettings.HideDownloadableProductsTab)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.CustomerNameFormat):
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.CustomerSettings.CustomerNameFormat, ((CustomerNameFormat)Model.CustomerSettings.CustomerNameFormat).ToSelectList())
                @Html.ValidationMessageFor(model => model.CustomerSettings.CustomerNameFormat)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.HideNewsletterBlock):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.HideNewsletterBlock)
                @Html.ValidationMessageFor(model => model.CustomerSettings.HideNewsletterBlock)
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <hr />
                <b>Form fields:</b>
                <br />
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.GenderEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.GenderEnabled)
                @Html.ValidationMessageFor(model => model.CustomerSettings.GenderEnabled)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.DateOfBirthEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.DateOfBirthEnabled)
                @Html.ValidationMessageFor(model => model.CustomerSettings.DateOfBirthEnabled)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.CompanyEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.CompanyEnabled)
                @Html.ValidationMessageFor(model => model.CustomerSettings.CompanyEnabled)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CustomerSettings.NewsletterEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CustomerSettings.NewsletterEnabled)
                @Html.ValidationMessageFor(model => model.CustomerSettings.NewsletterEnabled)
            </td>
        </tr>
    </table>
}
@helper TabDateTimeSettings()
    {
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.DateTimeSettings.AllowCustomersToSetTimeZone):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DateTimeSettings.AllowCustomersToSetTimeZone)
                @Html.ValidationMessageFor(model => model.DateTimeSettings.AllowCustomersToSetTimeZone)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.DateTimeSettings.DefaultStoreTimeZoneId):
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.DateTimeSettings.DefaultStoreTimeZoneId, Model.DateTimeSettings.AvailableTimeZones)
                @Html.ValidationMessageFor(model => model.DateTimeSettings.DefaultStoreTimeZoneId)
            </td>
        </tr>
    </table>
}
