Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

9.2 KB
Raw Blame
@model VendorSettingsModel
@{
    //page title
    ViewBag.Title = Loc["Admin.Settings.Vendor"];
}
<script>
    $(document).ready(function () {

        $("#@Html.IdFor(model => model.AddressSettings.CountryEnabled)").click(toggleVendorCountryFormField);
        $("#@Html.IdFor(model => model.AddressSettings.StateProvinceEnabled)").click(toggleVendorStateProvinceFormField);
        $("#@Html.IdFor(model => model.AddressSettings.CompanyEnabled)").click(toggleVendorRequiredFormField);
        $("#@Html.IdFor(model => model.AddressSettings.StreetAddressEnabled)").click(toggleVendorRequiredFormField);
        $("#@Html.IdFor(model => model.AddressSettings.StreetAddress2Enabled)").click(toggleVendorRequiredFormField);
        $("#@Html.IdFor(model => model.AddressSettings.ZipPostalCodeEnabled)").click(toggleVendorRequiredFormField);
        $("#@Html.IdFor(model => model.AddressSettings.CityEnabled)").click(toggleVendorRequiredFormField);
        $("#@Html.IdFor(model => model.AddressSettings.PhoneEnabled)").click(toggleVendorRequiredFormField);
        $("#@Html.IdFor(model => model.AddressSettings.FaxEnabled)").click(toggleVendorRequiredFormField);


        toggleVendorCountryFormField();
        toggleVendorStateProvinceFormField();
        toggleVendorRequiredFormField();
    });

    function toggleVendorCountryFormField() {
        if ($('#@Html.IdFor(model => model.AddressSettings.CountryEnabled)').is(':checked')) {
            $('#pnlVendorCountryRequired').show();
            $('#pnlVendorStateProvinceEnabled').show();
            toggleVendorStateProvinceFormField();
        } else {
            $('#pnlVendorCountryRequired').hide();
            $('#pnlVendorStateProvinceEnabled').hide();
            toggleVendorStateProvinceFormField();
        }
    }

    function toggleVendorStateProvinceFormField() {
        if ($('#@Html.IdFor(model => model.AddressSettings.CountryEnabled)').is(':checked') &&
            $('#@Html.IdFor(model => model.AddressSettings.StateProvinceEnabled)').is(':checked')) {
            $('#pnlVendorStateProvinceRequired').show();
        } else {
            $('#pnlVendorStateProvinceRequired').hide();
        }
    }

    function toggleVendorRequiredFormField() {
        if ($('#@Html.IdFor(model => model.AddressSettings.CompanyEnabled)').is(':checked')) {
            $('#pnlVendorCompanyRequired').show();
        } else {
            $('#pnlVendorCompanyRequired').hide();
        }

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

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

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

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

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

        if ($('#@Html.IdFor(model => model.AddressSettings.FaxEnabled)').is(':checked')) {
            $('#pnlVendorFaxRequired').show();
        } else {
            $('#pnlVendorFaxRequired').hide();
        }
    }
</script>
<form asp-area="@Constants.AreaAdmin" asp-controller="Setting" asp-action="Vendor" method="post">

    <div asp-validation-summary="All"></div>
    @* the store scope; the vendor block and what customers may do with vendors, then vendor
       reviews, then the address form a vendor fills in, a field that is on revealing whether it
       is required *@
    <admin-page sticky title="@Loc["Admin.Settings.Vendor"]" icon="bi-sliders">
        <page-actions>
            <button class="btn btn-primary" type="submit" name="save">
                <i class="bi bi-check-lg"></i> @Loc["Admin.Common.Save"]
            </button>
            <vc:admin-widget widget-zone="vendor_settings_buttons" additional-data="null"/>
        </page-actions>

        @await Component.InvokeAsync("StoreScope")

        <vc:admin-widget widget-zone="vendor_settings_top" additional-data="null"/>
        <admin-card>
            <div class="grand-fields grand-fields--2col">
                <admin-field asp-for="VendorsBlockItemsToDisplay" size="sm"/>
                <admin-field asp-for="DefaultVendorPageSizeOptions" size="md"/>
                <admin-field asp-for="ShowVendorOnProductDetailsPage"/>
                <admin-field asp-for="AllowCustomersToContactVendors"/>
                <admin-field asp-for="AllowCustomersToApplyForVendorAccount"/>
                <admin-field asp-for="AllowSearchByVendor"/>
                <admin-field asp-for="AllowVendorsToEditInfo"/>
                <admin-field asp-for="NotifyStoreOwnerAboutVendorInformationChange"/>
                <admin-field asp-for="TermsOfServiceEnabled"/>
            </div>
        </admin-card>
        <admin-card>
            <div class="grand-fields grand-fields--2col">
                <admin-field asp-for="VendorReviewsMustBeApproved"/>
                <admin-field asp-for="AllowAnonymousUsersToReviewVendor"/>
                <admin-field asp-for="VendorReviewPossibleOnlyAfterPurchasing"/>
                <admin-field asp-for="VendorReviewPossibleOnlyOnce"/>
                <admin-field asp-for="NotifyVendorAboutNewVendorReviews"/>
                <admin-field asp-for="DefaultAllowCustomerReview"/>
                <admin-field asp-for="DefaultVendorRatingValue" size="sm"/>
                <admin-field asp-for="NumberOfReview" size="sm"/>
            </div>
        </admin-card>
        <admin-card title="@Loc["Admin.Settings.Vendor.Address"]">
            <div class="grand-fields grand-fields--2col">
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.CompanyEnabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.CompanyRequired" id="pnlVendorCompanyRequired"/>
                    </div>
                </div>
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.StreetAddressEnabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.StreetAddressRequired" id="pnlVendorStreetAddressRequired"/>
                    </div>
                </div>
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.StreetAddress2Enabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.StreetAddress2Required" id="pnlVendorStreetAddress2Required"/>
                    </div>
                </div>
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.ZipPostalCodeEnabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.ZipPostalCodeRequired" id="pnlVendorZipPostalCodeRequired"/>
                    </div>
                </div>
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.CityEnabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.CityRequired" id="pnlVendorCityRequired"/>
                    </div>
                </div>
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.CountryEnabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.StateProvinceEnabled" id="pnlVendorStateProvinceEnabled"/>
                    </div>
                </div>
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.PhoneEnabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.PhoneRequired" id="pnlVendorPhoneRequired"/>
                    </div>
                </div>
                <div class="grand-reveal">
                    <admin-field asp-for="AddressSettings.FaxEnabled"/>
                    <div class="grand-reveal__body grand-fields grand-fields--2col">
                        <admin-field asp-for="AddressSettings.FaxRequired" id="pnlVendorFaxRequired"/>
                    </div>
                </div>
            </div>
        </admin-card>
        <vc:admin-widget widget-zone="vendor_settings_bottom" additional-data="null"/>
    </admin-page>
</form>