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.

11.2 KB
Raw Blame
@model VendorModel
@inject SeoSettings seoSettings
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_TwoColumns";
    pagebuilder.AddTitleParts(!string.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
    pagebuilder.AddMetaDescriptionParts(Model.MetaDescription);
    pagebuilder.AddMetaKeywordParts(Model.MetaKeywords);

    var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var vendorUrl = Url.RouteUrl("Vendor", new { Model.SeName }, Url.ActionContext.HttpContext.Request.Scheme);
        pagebuilder.AddCanonicalUrlParts(vendorUrl);
    }
}

<div class="page vendor-page">
    <div class="card mt-3">
        <div class="col-12 card-body">
            <div class="row">
                <div class="col-xl-2 col-lg-3 col-md-4">
                    <img class="img-fluid" alt="@Model.PictureModel.AlternateText" src="@Model.PictureModel.ImageUrl">
                </div>
                <div class="col-xl-10 col-lg-9 col-md-8 align-items-center d-flex">
                    <div>
                        @*Rendered server-side rather than through catalog.Model: this is
                            the page H1, and the vendor name does not change when the
                            listing below is refiltered*@
                        <h1 class="h2 generalTitle w-100">
                            @Model.Name
                        </h1>
                        @await Component.InvokeAsync("Widget", new { widgetZone = "vendordetails_top", additionalData = Model.Id })
                        @*rendering review section*@
                        @if (Model.VendorReviewOverview.AllowCustomerReviews)
                        {
                            <div>
                                <partial name="Partials/VendorReviewOverview" model="Model.VendorReviewOverview"/>
                            </div>
                        }
                    </div>
                </div>
            </div>
            <div class="row">
                @*
                    The reviews and contact tabs are optional, and declaring a
                    view-model that was never registered warns - so the names are
                    added only when their tab is actually rendered.
                *@
                @{
                    var tabsIsland = "catalog"
                        + (Model.VendorReviewOverview.AllowCustomerReviews ? " vendorreviews" : "")
                        + (Model.AllowCustomersToContactVendors ? " contactvendor" : "");
                }
                <div vue-island="@tabsIsland" class="col-12">
                    <gn-tabs class="mt-3" content-class="mt-3" align="center">
                        @if (!string.IsNullOrEmpty(Model.Description))
                        {
                            <gn-tab id="description-tab" title="@Loc["vendor.Description"]" active="true">
                                <article class="text-xs-center generalMarginSupporter vendor-description" v-html="catalog.Model.Description"></article>
                            </gn-tab>
                        }
                        @if (Model.Address != null)
                        {
                            <gn-tab id="address-tab" title="@Loc["Vendor.Address"]">
                                <ul class="info px-0 mb-0">
                                    @if (Model.Address.CompanyEnabled && !string.IsNullOrEmpty(Model.Address.Company))
                                    {
                                        <li class="company">
                                            <label class="col-form-label">@Loc["Address.Fields.Company"]:</label>
                                            @Model.Address.Company
                                        </li>
                                    }
                                    @if (Model.Address.StreetAddressEnabled && !string.IsNullOrEmpty(Model.Address.Address1))
                                    {
                                        <li class="address1">
                                            <label class="col-form-label w-100">@Loc["Address.Fields.Address1"]:</label>
                                            @Model.Address.Address1
                                        </li>
                                    }
                                    @if (Model.Address.StreetAddress2Enabled && !string.IsNullOrEmpty(Model.Address.Address2))
                                    {
                                        <li class="address2">
                                            <label class="col-form-label">@Loc["Address.Fields.Address2"]:</label>
                                            @Model.Address.Address2
                                        </li>
                                    }
                                    @if (Model.Address.CityEnabled || Model.Address.StateProvinceEnabled || Model.Address.ZipPostalCodeEnabled)
                                    {
                                        var cityStateZip = "";
                                        if (Model.Address.CityEnabled && !string.IsNullOrEmpty(Model.Address.City))
                                        {
                                            cityStateZip = Model.Address.City;
                                            if (Model.Address.StateProvinceEnabled || Model.Address.ZipPostalCodeEnabled)
                                            {
                                                cityStateZip += ",";
                                            }
                                        }

                                        if (Model.Address.StateProvinceEnabled)
                                        {
                                            if (!string.IsNullOrEmpty(cityStateZip))
                                            {
                                                cityStateZip += " ";
                                            }

                                            cityStateZip += Model.Address.StateProvinceName;
                                        }

                                        if (Model.Address.ZipPostalCodeEnabled)
                                        {
                                            if (!string.IsNullOrEmpty(cityStateZip))
                                            {
                                                cityStateZip += " ";
                                            }

                                            cityStateZip += Model.Address.ZipPostalCode;
                                        }

                                        if (!string.IsNullOrEmpty(cityStateZip))
                                        {
                                            <li class="city-state-zip">
                                                @cityStateZip
                                            </li>
                                        }
                                    }
                                    @if (Model.Address.CountryEnabled && !string.IsNullOrEmpty(Model.Address.CountryName))
                                    {
                                        <li class="country">
                                            @Model.Address.CountryName
                                        </li>
                                    }
                                    @if (Model.Address.PhoneEnabled && !string.IsNullOrEmpty(Model.Address.PhoneNumber))
                                    {
                                        <li class="phone">
                                            <label class="col-form-label">@Loc["Address.Fields.PhoneNumber"]:</label>
                                            @Model.Address.PhoneNumber
                                        </li>
                                    }
                                    @if (Model.Address.FaxEnabled && !string.IsNullOrEmpty(Model.Address.FaxNumber))
                                    {
                                        <li class="fax">
                                            <label class="col-form-label">@Loc["Address.Fields.FaxNumber"]:</label>
                                            @Model.Address.FaxNumber
                                        </li>
                                    }
                                </ul>
                            </gn-tab>
                        }
                        @if (Model.VendorReviewOverview.AllowCustomerReviews)
                        {
                            <gn-tab id="review-tab" title="@Loc["vendor.Reviews"]">
                                @await Component.InvokeAsync("VendorReviews", new { vendorId = Model.Id })
                            </gn-tab>
                        }
                        @if (Model.AllowCustomersToContactVendors)
                        {
                            <gn-tab id="contact-tab" title="@Loc["ContactVendor"]" on-click="contactvendor.getCaptcha()">
                                @await Component.InvokeAsync("VendorContact", new { vendorId = Model.Id })
                            </gn-tab>
                        }
                    </gn-tabs>
                </div>
            </div>
        </div>
    </div>
    <div id="catalog-products" vue-island="catalog">
        @await Component.InvokeAsync("Widget", new { widgetZone = "productsearch_page_before_results" })
        <partial name="Partials/Selectors"/>
        <template v-if="catalog.Model.Products.length > 0">
            <template v-if="catalog.Model.PagingFilteringContext.ViewMode == 'grid'">
                <div class="col-12 product-grid px-0">
                    <div class="row">
                        <template v-for="product in catalog.Model.Products">
                            <div class="col-lg-4 col-sm-6 col-6 product-container mb-2">
                                <partial name="Partials/Client/CatalogProductGridView"/>
                            </div>
                        </template>
                    </div>
                </div>
            </template>
            <template v-else>
                <div class="product-list">
                    <div class="col-12">
                        <div class="row">
                            <template v-for="product in catalog.Model.Products">
                                <partial name="Partials/Client/CatalogProductListView"/>
                            </template>
                        </div>
                    </div>
                </div>
            </template>
            <partial name="Partials/Pagination"/>
        </template>
        <template v-else>
            <div class="alert alert-info my-3">
                @Loc["search.noresultstext"]
            </div>
        </template>
    </div>
</div>
@if (Model.RenderCaptcha)
{
    <div id="captcha-container">
        <div class="captcha-box" id="captcha-box">
            <captcha/>
        </div>
    </div>
}
@await Component.InvokeAsync("Widget", new { widgetZone = "vendordetails_bottom", additionalData = Model.Id })

@section filters
{
    @*Rendering filtering*@
    @if (Model.PagingFilteringContext.SpecificationFilter.Enabled)
    {
        <partial name="Partials/Filtering" model="Model.PagingFilteringContext.SpecificationFilter"/>
    }
}

<partial name="Partials/ModelScript" model="Model"/>