ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/Product/ProductAttributeValidationRulesPopup.cshtml
@model ProductModel.ProductAttributeMappingModel
@using Grand.Domain.Catalog
@{
    Layout = Grand.Web.Areas.Admin.Extensions.Constants.Layout_AdminPopup;
    //page title
    ViewBag.Title = T("Admin.Catalog.Products.ProductAttributes.Attributes.ValidationRules").Text;

    var attributeControlType = (AttributeControlType)Model.AttributeControlTypeId;
}
<form asp-area="@Constants.AreaAdmin" asp-controller="Product" asp-action="ProductAttributeValidationRulesPopup" enctype="multipart/form-data" method="post"
      asp-route-ProductId="@Context.Request.Query["ProductId"]"
      asp-route-btnId="@Context.Request.Query["btnId"]"
      asp-route-formId="@Context.Request.Query["formId"]">
    
    <div class="row">
        <div class="col-md-12">
            <div class="x_panel light form-fit">
                <div class="x_title">
                    <div class="caption">
                        <i class="fa fa-cubes"></i>
                        @T("Admin.Catalog.Products.ProductAttributes.Attributes.ValidationRules")
                    </div>
                </div>
                <div class="x_content form">
                    <div class="form-horizontal">
                        <div class="form-body">
                            <div class="form-group" @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>
                                <admin-label asp-for="ValidationMinLength" class="col-sm-3 control-label" />
                                <div class="col-md-9 col-sm-9">
                                    <admin-input asp-for="ValidationMinLength" />
                                    <span asp-validation-for="ValidationMinLength"></span>
                                </div>
                            </div>
                            <div class="form-group" @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>
                                <admin-label asp-for="ValidationMaxLength" class="col-sm-3 control-label" />
                                <div class="col-md-9 col-sm-9">
                                    <admin-input asp-for="ValidationMaxLength" />
                                    <span asp-validation-for="ValidationMaxLength"></span>
                                </div>
                            </div>
                            <div class="form-group" @(attributeControlType != AttributeControlType.FileUpload ? Html.Raw("style='display: none;'") : null)>
                                <admin-label asp-for="ValidationFileAllowedExtensions" class="col-sm-3 control-label" />
                                <div class="col-md-9 col-sm-9">
                                    <admin-input asp-for="ValidationFileAllowedExtensions" />
                                    <span asp-validation-for="ValidationFileAllowedExtensions"></span>
                                </div>
                            </div>
                            <div class="form-group" @(attributeControlType != AttributeControlType.FileUpload ? Html.Raw("style='display: none;'") : null)>
                                <admin-label asp-for="ValidationFileMaximumSize" class="col-sm-3 control-label" />
                                <div class="col-md-9 col-sm-9">
                                    <admin-input asp-for="ValidationFileMaximumSize" />
                                    <span asp-validation-for="ValidationFileMaximumSize"></span>
                                </div>
                            </div>
                            <div class="form-group" @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>
                                <admin-label asp-for="DefaultValue" class="col-sm-3 control-label" />
                                <div class="col-md-9 col-sm-9">
                                    <admin-input asp-for="DefaultValue" />
                                    <span asp-validation-for="DefaultValue"></span>
                                </div>
                            </div>
                            <div class="form-actions">
                                <div class="row">
                                    <div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">
                                        <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @T("Admin.Common.Save") </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    @if (ViewBag.RefreshPage == true)
    {
        <script>
        try {
            window.opener.document.forms['@(Context.Request.Query["formId"])'].@(Context.Request.Query["btnId"]).click();
        } catch (e) {
        }
        window.close();
        </script>
    }
    @if (!Model.ValidationRulesAllowed)
    {
        <div class="note note-danger">>This attribute type cannot have validation rules</div>
    }
</form>
