ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/Setting/CustomerUser.TabAddressFormFields.cshtml
@model CustomerUserSettingsModel
<script>
    $(document).ready(function () {
        $("#@Html.FieldIdFor(model => model.AddressSettings.CountryEnabled)").click(toggleAddressCountryFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.CompanyEnabled)").click(toggleAddressRequiredFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.VatNumberEnabled)").click(toggleAddressRequiredFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.StreetAddressEnabled)").click(toggleAddressRequiredFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.StreetAddress2Enabled)").click(toggleAddressRequiredFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.ZipPostalCodeEnabled)").click(toggleAddressRequiredFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.CityEnabled)").click(toggleAddressRequiredFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.PhoneEnabled)").click(toggleAddressRequiredFormField);
        $("#@Html.FieldIdFor(model => model.AddressSettings.FaxEnabled)").click(toggleAddressRequiredFormField);

        toggleAddressCountryFormField();
        toggleAddressRequiredFormField();
    });

    function toggleAddressCountryFormField() {
        if ($('#@Html.FieldIdFor(model => model.AddressSettings.CountryEnabled)').is(':checked')) {
            $('#pnlAddressStateProvinceEnabled').show();
        }
        else {
            $('#pnlAddressStateProvinceEnabled').hide();
        }
    }

    function toggleAddressRequiredFormField() {
        if ($('#@Html.FieldIdFor(model => model.AddressSettings.CompanyEnabled)').is(':checked')) {
            $('#pnlAddressCompanyRequired').show();
        }
        else {
            $('#pnlAddressCompanyRequired').hide();
        }
        if ($('#@Html.FieldIdFor(model => model.AddressSettings.VatNumberEnabled)').is(':checked')) {
            $('#pnlAddressVatNumberRequired').show();
        }
        else {
            $('#pnlAddressVatNumberRequired').hide();
        }

        if ($('#@Html.FieldIdFor(model => model.AddressSettings.StreetAddressEnabled)').is(':checked')) {
            $('#pnlAddressStreetAddressRequired').show();
        }
        else {
            $('#pnlAddressStreetAddressRequired').hide();
        }

        if ($('#@Html.FieldIdFor(model => model.AddressSettings.StreetAddress2Enabled)').is(':checked')) {
            $('#pnlAddressStreetAddress2Required').show();
        }
        else {
            $('#pnlAddressStreetAddress2Required').hide();
        }

        if ($('#@Html.FieldIdFor(model => model.AddressSettings.ZipPostalCodeEnabled)').is(':checked')) {
            $('#pnlAddressZipPostalCodeRequired').show();
        }
        else {
            $('#pnlAddressZipPostalCodeRequired').hide();
        }

        if ($('#@Html.FieldIdFor(model => model.AddressSettings.CityEnabled)').is(':checked')) {
            $('#pnlAddressCityRequired').show();
        }
        else {
            $('#pnlAddressCityRequired').hide();
        }

        if ($('#@Html.FieldIdFor(model => model.AddressSettings.PhoneEnabled)').is(':checked')) {
            $('#pnlAddressPhoneRequired').show();
        }
        else {
            $('#pnlAddressPhoneRequired').hide();
        }

        if ($('#@Html.FieldIdFor(model => model.AddressSettings.FaxEnabled)').is(':checked')) {
            $('#pnlAddressFaxRequired').show();
        }
        else {
            $('#pnlAddressFaxRequired').hide();
        }
    }
</script>
<div class="form-horizontal">
    <div class="form-body">
        <div class="form-group">
            <div class="note note-info">
                @T("Admin.Configuration.Settings.CustomerUser.AddressFormFields.Description")
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.CompanyEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.CompanyEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.CompanyEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressCompanyRequired">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.CompanyRequired" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.CompanyRequired" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.CompanyRequired"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.VatNumberEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.VatNumberEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.VatNumberEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressVatNumberRequired">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.VatNumberRequired" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.VatNumberRequired" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.VatNumberRequired"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.StreetAddressEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.StreetAddressEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.StreetAddressEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressStreetAddressRequired">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.StreetAddressRequired" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.StreetAddressRequired" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.StreetAddressRequired"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.StreetAddress2Enabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.StreetAddress2Enabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.StreetAddress2Enabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressStreetAddress2Required">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.StreetAddress2Required" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.StreetAddress2Required" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.StreetAddress2Required"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.ZipPostalCodeEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.ZipPostalCodeEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.ZipPostalCodeEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressZipPostalCodeRequired">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.ZipPostalCodeRequired" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.ZipPostalCodeRequired" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.ZipPostalCodeRequired"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.CityEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.CityEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.CityEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressCityRequired">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.CityRequired" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.CityRequired" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.CityRequired"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.CountryEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.CountryEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.CountryEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressStateProvinceEnabled">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.StateProvinceEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.StateProvinceEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.StateProvinceEnabled"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.PhoneEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.PhoneEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.PhoneEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressPhoneRequired">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.PhoneRequired" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.PhoneRequired" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.PhoneRequired"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.FaxEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.FaxEnabled" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.FaxEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAddressFaxRequired">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="AddressSettings.FaxRequired" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AddressSettings.FaxRequired" />
                     <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AddressSettings.FaxRequired"></span>
            </div>
        </div>
    </div>
</div>
<partial name="../AddressAttribute/ListBlock.cshtml" />
