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.

2.1 KB
Raw Blame
@inject StoreInformationSettings storeInformationSettings
@inject IContextAccessor contextAccessor

@if (storeInformationSettings.DisplayCookieInformation && !contextAccessor.WorkContext.CurrentCustomer.IsSystemAccount)
{
    if (contextAccessor.WorkContext.CurrentCustomer.GetUserFieldFromEntity<bool>(SystemCustomerFieldNames.CookieAccepted, contextAccessor.StoreContext.CurrentStore.Id))
        return;

    if (TempData["Grand.IgnoreCookieInformation"] != null && Convert.ToBoolean(TempData["Grand.IgnoreCookieInformation"]))
        return;

    <script type="application/json" data-grand-vm="cookieBar">@Json.Serialize(new {
                                                              route = Url.RouteUrl("CookieAccept"),
                                                              elements = new { barId = "cookie-bar-notification" },
                                                              res = new { warning = Loc["common.warning"].ToString() }
                                                          })</script>

    @*No inline display:none waiting for a script to reveal it - this partial is
        only rendered at all when the visitor has not decided yet, so its presence
        is the decision.*@
    <div id="cookie-bar-notification" class="cookie-bar-notification">
        <div class="card alert alert-info mx-3">
            <div class="d-inline-flex justify-content-center align-items-center flex-sm-nowrap flex-wrap w-100 mb-0">
                <p class="mb-0">@Loc["Cookie.Description2"]</p>
                <div class="btn-group ms-0 mx-sm-3 mt-sm-0 mt-2">
                    <button class="btn btn-outline-secondary cookielaw-button" id="cookie-ok" data-accept="true">@Loc["Cookie.Accept"]</button>
                    <button class="btn btn-outline-secondary cookielaw-button mx-1" id="cookie-refuse" data-accept="false">@Loc["Cookie.Refuse"]</button>
                    <a class="btn btn-info learn-more" href="@Url.RouteUrl("Page", new { SeName = "privacyinfo" })">@Loc["Cookie.LearnMore"]</a>
                </div>
            </div>
        </div>
    </div>
}