ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/SpecificationAttribute/_CreateOrUpdateOption.cshtml
@model SpecificationAttributeOptionModel
@inject IPageHeadBuilder pagebuilder
@{
    pagebuilder.AddScriptParts(ResourceLocation.Head, "~/scripts/farbtastic.js", excludeFromBundle: true);
    pagebuilder.AddCssFileParts(ResourceLocation.Head, "~/content/farbtastic/farbtastic.css", excludeFromBundle: true);
}
<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="SpecificationAttributeId" type="hidden" />
@{
    if (string.IsNullOrEmpty(Model.ColorSquaresRgb))
    {
        Model.ColorSquaresRgb = "#FFFFFF";
    }
}

@if (ViewBag.RefreshPage == true)
{
    <script>
        try {window.opener.document.forms['@(Context.Request.Query["formId"])'].@(Context.Request.Query["btnId"]).click();}
        catch (e){}
        window.close();
    </script>
}

<script>
$(document).ready(function() {
    $("#@Html.FieldIdFor(model => model.EnableColorSquaresRgb)").click(toggleEnableColorSquaresRgb);
    toggleEnableColorSquaresRgb();
});

function toggleEnableColorSquaresRgb() {
    if ($('#@Html.FieldIdFor(model => model.EnableColorSquaresRgb)').is(':checked')) {
        $('#pnlColorSquaresRgb').show();
    } else {
        $('#pnlColorSquaresRgb').hide();
    }
}
</script>
<vc:admin-widget widget-zone="specification_attribute_option_details_top" additional-data="null" />
@(await Html.LocalizedEditor<SpecificationAttributeOptionModel, SpecificationAttributeOptionLocalizedModel>("specificationattribute-localized",
    @<div class="form-horizontal">
        <div class="form-body">
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].Name" class="col-sm-3" />
                <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>
            <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />
        </div>
    </div>
,
    @<div class="form-horizontal">
        <div class="form-body">
            <div class="form-group">
                <admin-label asp-for="Name" class="col-sm-3" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="Name" />
                    <span asp-validation-for="Name"></span>
                </div>
            </div>
        </div>
    </div>
))
<div class="form-horizontal">
    <div class="form-body">
        <div class="form-body">
            <div class="form-group">
                <admin-label asp-for="SeName" />
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="SeName" />
                    <span asp-validation-for="SeName"></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="EnableColorSquaresRgb" class="col-sm-3" />
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="EnableColorSquaresRgb" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="EnableColorSquaresRgb"></span>
            </div>
        </div>
        <div class="form-group" id="pnlColorSquaresRgb">
            <admin-label asp-for="ColorSquaresRgb" class="col-sm-3" />
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="ColorSquaresRgb" />
                <div id="color-picker"></div>
                <script>
                    $(document).ready(function(){
                        $('#color-picker').farbtastic('#@Html.FieldIdFor(model => model.ColorSquaresRgb)');
                    });
                </script>
                <span asp-validation-for="ColorSquaresRgb"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="DisplayOrder" class="col-sm-3" />
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="DisplayOrder" />
                <span asp-validation-for="DisplayOrder"></span>
            </div>
        </div>
    </div>
</div>
<vc:admin-widget widget-zone="specification_attribute_option_details_bottom" additional-data="Model" />