@model BrandModel
@using Microsoft.AspNetCore.Mvc.Razor;
<script>
        $(document).ready(function () {
            $("#@Html.IdFor(model => model.AllowCustomersToSelectPageSize)").click(togglePageSize);
            togglePageSize();
        });

        function togglePageSize() {
            if ($('#@Html.IdFor(model => model.AllowCustomersToSelectPageSize)').is(':checked')) {
                $('#pnlPageSize').hide();
                $('#pnlPageSizeOptions').show();
            } else {
                $('#pnlPageSize').show();
                $('#pnlPageSizeOptions').hide();
            }
        }
</script>

@{ Func<int, HelperResult>
          template = @<div class="form-body">
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].Name" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="@Model.Locales[item].Name" />
                    <span asp-validation-for="@Model.Locales[item].Name"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].Description" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="@Model.Locales[item].Description" asp-template="Editor" />
                    <span asp-validation-for="@Model.Locales[item].Description"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].BottomDescription" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="@Model.Locales[item].BottomDescription" asp-template="Editor" />
                    <span asp-validation-for="@Model.Locales[item].BottomDescription"></span>
                </div>
            </div>
            <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />
        </div>;
}

<div class="form-horizontal">
    <vc:admin-widget widget-zone="brand_details_info_top" additional-data="Model" />
    <localized-editor localized-template=@template name="brand-info-localized" language-ids=@Model.Locales.Select(c=>c.LanguageId).ToList()>
        <div class="form-body">
            <div class="form-group">
                <admin-label asp-for="Name" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="Name" />
                    <span asp-validation-for="Name"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="Description" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="Description" asp-template="Editor" />
                    <span asp-validation-for="Description"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="BottomDescription" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="BottomDescription" asp-template="Editor" />
                    <span asp-validation-for="BottomDescription"></span>
                </div>
            </div>
        </div>
    </localized-editor>
    <div class="form-group">
        <admin-label asp-for="CustomerGroups" />
        <div class="col-md-9 col-sm-9">
            <admin-input asp-for="CustomerGroups" />
            <span asp-validation-for="CustomerGroups"></span>
        </div>
    </div>
    <div class="form-group">
        <admin-label asp-for="Stores" />
        <div class="col-md-9 col-sm-9">
            <admin-input asp-for="Stores" />
            <span asp-validation-for="Stores"></span>
        </div>
    </div>
    <div class="form-body">
        <div class="form-group">
            <admin-label asp-for="BrandLayoutId" />
            <div class="col-md-9 col-sm-9">
                <admin-select asp-for="BrandLayoutId" asp-items="Model.AvailableBrandLayouts" />
                <span asp-validation-for="BrandLayoutId"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="PictureId" />
            <div class="col-md-9 col-sm-9">
                @{
                    ViewData["Reference"] = "Brand";
                    ViewData["ObjectId"] = Model.Id;
                }
                <admin-input asp-for="PictureId" />
                <span asp-validation-for="PictureId"></span>
                @if (!string.IsNullOrEmpty(Model.PictureId))
                {
                    <label class="control-label">
                        <a class='k-link editpicture' href="@Url.Action("PicturePopup", "Brand", new { area = Constants.AreaAdmin })/?brandId=@(Model.Id)">@Loc["Admin.Common.Picture.Attributes"]</a>
                    </label>
                    <script>
                        $(document).ready(function () {
                            $('.editpicture').magnificPopup({
                                type: 'ajax',
                                settings: { cache: false, async: false },
                                midClick: true,
                                callbacks: {
                                    parseAjax: function (mfpResponse) {
                                        mfpResponse.data = $('<div></div>').html(mfpResponse.data);
                                    },
                                    ajaxContentAdded: function () {
                                        $('.mfp-wrap').removeAttr('tabindex');
                                    }
                                }
                            });
                        });
                    </script>
                }
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="ShowOnHomePage" />
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="ShowOnHomePage" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="ShowOnHomePage"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="IncludeInMenu" />
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="IncludeInMenu" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="IncludeInMenu"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="AllowCustomersToSelectPageSize" />
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AllowCustomersToSelectPageSize" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AllowCustomersToSelectPageSize"></span>
            </div>
        </div>
        <div class="form-group" id="pnlPageSize">
            <admin-label asp-for="PageSize" />
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="PageSize" />
                <span asp-validation-for="PageSize"></span>
            </div>
        </div>
        <div class="form-group" id="pnlPageSizeOptions">
            <admin-label asp-for="PageSizeOptions" />
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="PageSizeOptions" />
                <span asp-validation-for="PageSizeOptions"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="DefaultSort" />
            <div class="col-md-9 col-sm-9">
                <admin-select asp-for="DefaultSort" asp-items="Model.AvailableSortOptions" />
                <span asp-validation-for="DefaultSort"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="Icon" />
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="Icon" />
                <span asp-validation-for="Icon"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="Published" />
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="Published" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="Published"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="DisplayOrder" />
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="DisplayOrder" />
                <span asp-validation-for="DisplayOrder"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="ExternalId" />
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="ExternalId" />
                <span asp-validation-for="ExternalId"></span>
            </div>
        </div>
    </div>
</div>
<vc:admin-widget widget-zone="brand_details_info_bottom" additional-data="Model" />