@using Nop.Core;
@using Nop.Core.Domain.Seo;
@using Nop.Core.Infrastructure;
@using Nop.Web.Framework;
@using Nop.Web.Framework.UI;
@using Nop.Services.Configuration;
@model LiveAnnouncementViewModel

@{

    ISettingService _settingContext = EngineContext.Current.Resolve<ISettingService>();
    IStoreContext _storeContext = EngineContext.Current.Resolve<IStoreContext>();

    NopHtml.AddScriptParts(ResourceLocation.Head, "~/Plugins/Misc.AuctionPlugin/Content/Js/signalr.js");
    NopHtml.AddScriptParts(ResourceLocation.Footer, "https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/jquery.dataTables.js");
    // NopHtml.AddScriptParts(ResourceLocation.Footer, "https://cdn.datatables.net/scroller/2.4.3/js/dataTables.scroller.js");
    // NopHtml.AddScriptParts(ResourceLocation.Footer, "https://cdn.datatables.net/scroller/2.4.3/js/scroller.dataTables.js");
    NopHtml.AddScriptParts(ResourceLocation.Footer, "~/Plugins/Misc.AuctionPlugin/Content/Js/MgMessageHandler.js");
    NopHtml.AddScriptParts(ResourceLocation.Footer, "~/Plugins/Misc.AuctionPlugin/Content/Js/LiveAnnouncement.js");
    NopHtml.AddScriptParts(ResourceLocation.Footer, "~/Plugins/Misc.AuctionPlugin/Content/Js/Auction.js");
    NopHtml.AddCssFileParts("~/Plugins/Misc.AuctionPlugin/Content/Css/toastr.min.css");
    NopHtml.AddCssFileParts("https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/css/jquery.dataTables.css");
    NopHtml.AddScriptParts(ResourceLocation.Footer, "~/Plugins/Misc.AuctionPlugin/Content/Js/toastr.js");

}


<div class="announcementPage">
    <style>
        .old-product-price {
            text-decoration: unset !important;
        }
    </style>
</div>

<script>

    window.LocalizationStrings = {
        YourBidLeading: "@T("Plugins.Misc.AuctionPlugin.YourBidLeading")",
        PlaceABid: "@T("Plugins.Misc.AuctionPlugin.PlaceABid")",
        AuctionPaused: "@T("Plugins.Misc.AuctionPlugin.AuctionPaused")",
        FirstWarning: "@T("Plugins.Misc.AuctionPlugin.FirstWarning")",
        SecondWarning: "@T("Plugins.Misc.AuctionPlugin.SecondWarning")",
        YouWin: "@T("Plugins.Misc.AuctionPlugin.YouWin")",
        ItemClosed: "@T("Plugins.Misc.AuctionPlugin.ItemClosed")",
        GoodJob: "@T("Plugins.Misc.AuctionPlugin.GoodJob")",
        YouWin: "@T("Plugins.Misc.AuctionPlugin.YouWin")",
        YourBidLeading: "@T("Plugins.Misc.AuctionPlugin.YourBidLeading")",
        Sold: "@T("Plugins.Misc.AuctionPlugin.Sold")",
        BidButtonPrefix: "@T("Plugins.Misc.AuctionPlugin.BidButtonPrefix")"

    };

    var liveAnnouncementViewModel;

    $(window).load(function () {
        try {
            // Deserialize the Razor model into JavaScript
            liveAnnouncementViewModel = @Html.Raw(Json.Serialize(Model));
        } catch (e) {
            console.log(e); // Logs any error during deserialization
        }

        // Ensure liveAnnouncementViewModel is defined before accessing its properties
        if (liveAnnouncementViewModel) {
            console.log("liveAnnouncementViewModel.CustomerId: " + liveAnnouncementViewModel.CustomerId);

            // Set global variables
            window.CustomerId = liveAnnouncementViewModel.CustomerId;
            window.StoreId = liveAnnouncementViewModel.StoreId;
            window.WorkingCurrency = liveAnnouncementViewModel.WorkingCurrency;
            window.IsAdmin = liveAnnouncementViewModel.IsAdmin;
            window.IsGuest = liveAnnouncementViewModel.IsGuest;

            console.log("Window.CustomerId: " + window.CustomerId + ", " + "window.StoreId: " + window.StoreId + "window.isAdmin: " + window.IsAdmin);
        } else {
            console.log("liveAnnouncementViewModel is undefined or null.");
        }
    });
</script>