Compare commits
No commits in common. "29adf2772ad7c25c56c6b96d0c562ff9c9b3aaf5" and "25a9b8723a7c987316e5e285dcf99f3b7bd78a92" have entirely different histories.
29adf2772a
...
25a9b8723a
|
|
@ -33,7 +33,6 @@ public static class AuctionDefaults
|
|||
public static string BidNotificationRouteName => "Plugin.Misc.AuctionPlugin.BidNotification";
|
||||
public static string RefreshAuctionWidgetRouteName => "Plugin.Misc.AuctionPlugin.RefreshAuctionWidget";
|
||||
public static string AssignProductToAuction => "Plugin.Misc.AuctionPlugin.AssignProductToAuction";
|
||||
public static string LiveScreenRouteName => "Plugin.Misc.AuctionPlugin.LiveScreenRouteName";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of autosuggest component
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Nop.Data;
|
|||
using Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Components;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Components;
|
||||
|
||||
|
||||
//using Nop.Plugin.Misc.AuctionPlugin.Components;
|
||||
using Nop.Services.Catalog;
|
||||
using Nop.Services.Cms;
|
||||
|
|
@ -111,7 +112,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin
|
|||
return typeof(AuctionAdminViewComponent);
|
||||
}
|
||||
|
||||
if (widgetZone.Equals(PublicWidgetZones.BodyStartHtmlTagAfter))
|
||||
if (widgetZone.Equals(PublicWidgetZones.HeaderAfter))
|
||||
{
|
||||
return typeof(LiveAnnouncementViewComponent);
|
||||
}
|
||||
|
|
@ -129,8 +130,8 @@ namespace Nop.Plugin.Misc.AuctionPlugin
|
|||
return Task.FromResult<IList<string>>(new List<string>
|
||||
{
|
||||
PublicWidgetZones.ProductDetailsOverviewTop,
|
||||
PublicWidgetZones.ProductBoxAddinfoBefore,
|
||||
PublicWidgetZones.BodyStartHtmlTagAfter,
|
||||
PublicWidgetZones.ProductDetailsBottom,
|
||||
PublicWidgetZones.HeaderAfter,
|
||||
AdminWidgetZones.ProductDetailsButtons
|
||||
|
||||
//AdminWidgetZones.OrderBillingAddressDetailsBottom,
|
||||
|
|
|
|||
|
|
@ -135,21 +135,15 @@ public class AuctionPublicViewComponent : NopViewComponent
|
|||
|
||||
}
|
||||
|
||||
List<ProductToAuctionMapping> productToAuctionId = await _auctionService.GetProductToAuctionByAuctionIdAndProductIdAsync(auctionId, productDetailsModel.Id);
|
||||
|
||||
AuctionStatus status = productToAuctionId.FirstOrDefault().AuctionStatus;
|
||||
bool isActive = status.HasFlag(AuctionStatus.Active);
|
||||
bool isFirstWarning = status.HasFlag(AuctionStatus.FirstWarning);
|
||||
|
||||
var productToAuctionId = await _auctionService.GetProductToAuctionByAuctionIdAndProductIdAsync(auctionId, productDetailsModel.Id);
|
||||
|
||||
productBidBoxViewModel.IsAdmin = await _customerService.IsAdminAsync(customer);
|
||||
productBidBoxViewModel.IsGuest = await _customerService.IsGuestAsync(customer);
|
||||
productBidBoxViewModel.AuctionClosed = auction.Closed;
|
||||
productBidBoxViewModel.IsItemActive = isActive;
|
||||
productBidBoxViewModel.AuctionClosed = auction.Closed;
|
||||
productBidBoxViewModel.WidgetZone = widgetZone;
|
||||
productBidBoxViewModel.BasePrice = productDetailsModel.ProductPrice.OldPriceValue;
|
||||
productBidBoxViewModel.CurrentPrice = productDetailsModel.ProductPrice.PriceValue;
|
||||
productBidBoxViewModel.ProductToAuctionId = productToAuctionId.FirstOrDefault().Id;
|
||||
productBidBoxViewModel.ProductToAuctionsId = productToAuctionId.FirstOrDefault().Id;
|
||||
productBidBoxViewModel.AuctionId = auctionId;
|
||||
productBidBoxViewModel.CustomerId = customer.Id;
|
||||
productBidBoxViewModel.ProductId = productDetailsModel.Id;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Nop.Core;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Models;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||
using Nop.Services.Cms;
|
||||
using Nop.Services.Logging;
|
||||
using Nop.Web.Framework.Components;
|
||||
|
|
@ -18,7 +16,6 @@ public class AuctionViewComponent : NopViewComponent
|
|||
protected readonly ILogger _logger;
|
||||
protected readonly IWidgetPluginManager _widgetPluginManager;
|
||||
protected readonly IWorkContext _workContext;
|
||||
AuctionService _auctionService;
|
||||
protected readonly AuctionSettings _auctionSettings;
|
||||
|
||||
#endregion
|
||||
|
|
@ -28,13 +25,11 @@ public class AuctionViewComponent : NopViewComponent
|
|||
public AuctionViewComponent(ILogger logger,
|
||||
IWidgetPluginManager widgetPluginManager,
|
||||
IWorkContext workContext,
|
||||
AuctionService auctionService,
|
||||
AuctionSettings auctionSettings)
|
||||
{
|
||||
_logger = logger;
|
||||
_widgetPluginManager = widgetPluginManager;
|
||||
_workContext = workContext;
|
||||
_auctionService = auctionService;
|
||||
_auctionSettings = auctionSettings;
|
||||
}
|
||||
|
||||
|
|
@ -78,28 +73,19 @@ public class AuctionViewComponent : NopViewComponent
|
|||
//}
|
||||
var model = new AuctionPublicInfoModel();
|
||||
|
||||
if (!widgetZone.Equals(PublicWidgetZones.ProductBoxAddinfoBefore))
|
||||
if (widgetZone.Equals(PublicWidgetZones.ProductDetailsBottom))
|
||||
{
|
||||
return Content(string.Empty);
|
||||
|
||||
model.Message = $"Auction plugin is active, setting = {_auctionSettings.SomeText}, productId = {((ProductDetailsModel)additionalData).Name}";
|
||||
|
||||
}
|
||||
|
||||
var productId = ((ProductOverviewModel)additionalData).Id;
|
||||
model.ProductId = productId;
|
||||
var productToAuctionMapping = (await _auctionService.GetProductToAuctionsByProductIdAsync(productId)).FirstOrDefault();
|
||||
|
||||
if (productToAuctionMapping == null)
|
||||
else
|
||||
{
|
||||
return Content(string.Empty);
|
||||
|
||||
model.Message = _auctionSettings.SomeText;
|
||||
|
||||
}
|
||||
|
||||
model.ProductToAuctionMappingId = productToAuctionMapping.Id;
|
||||
var auction = await _auctionService.GetAuctionDtoByProductToAuctionIdAsync(productToAuctionMapping.Id);
|
||||
model.StartDate = auction.StartDateUtc;
|
||||
AuctionStatus status = productToAuctionMapping.AuctionStatus;
|
||||
model.IsActive = status.HasFlag(AuctionStatus.Active);
|
||||
|
||||
bool isFirstWarning = status.HasFlag(AuctionStatus.FirstWarning);
|
||||
|
||||
return View("~/Plugins/Misc.AuctionPlugin/Views/PublicInfo.cshtml", model);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Components
|
|||
|
||||
await _logger.InformationAsync("SignalR Widget: widget active");
|
||||
|
||||
if (!widgetZone.Equals(PublicWidgetZones.BodyStartHtmlTagAfter))
|
||||
if (!widgetZone.Equals(PublicWidgetZones.HeaderAfter))
|
||||
{
|
||||
return Content(string.Empty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using AyCode.Core.Extensions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Nop.Data;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Models;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Models;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||
|
|
@ -70,10 +69,4 @@ public class AuctionController : BasePluginController
|
|||
|
||||
return ViewComponent("AuctionPublic", new { widgetZone = request.WidgetZone, additionalData = detailsModel });
|
||||
}
|
||||
|
||||
public async Task<IActionResult> LiveScreen()
|
||||
{
|
||||
var model = new LiveScreenViewModel();
|
||||
return View("~/Plugins/Misc.AuctionPlugin/Views/LiveScreen.cshtml", model);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
||||
{
|
||||
public class AuctionUpdateNotificationMessage : AuctionBidDto
|
||||
{
|
||||
public int AuctionId { get; set; }
|
||||
//public string BidPrice { get; set; }
|
||||
//public int ProductId { get; set; }
|
||||
//public int CustomerId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -53,10 +53,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
|||
endpointRouteBuilder.MapControllerRoute(name: AuctionDefaults.AssignProductToAuction,
|
||||
pattern: "Admin/Auction/AssignProductToAuction",
|
||||
defaults: new { controller = "AuctionPluginAdmin", action = "AssignProductToAuction" });
|
||||
|
||||
endpointRouteBuilder.MapControllerRoute(name: AuctionDefaults.LiveScreenRouteName,
|
||||
pattern: "Auction/LiveScreen",
|
||||
defaults: new { controller = "Auction", action = "LiveScreen" });
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,8 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
|||
{
|
||||
public record AuctionPublicInfoModel : BaseNopModel
|
||||
{
|
||||
|
||||
public int ProductId { get; set; }
|
||||
|
||||
public int ProductToAuctionMappingId { get; set; }
|
||||
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
[NopResourceDisplayName("Message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
using Nop.Web.Framework.Models;
|
||||
using Nop.Web.Framework.Mvc.ModelBinding;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
||||
{
|
||||
public record LiveScreenViewModel : BaseNopModel
|
||||
{
|
||||
|
||||
public int ProductId { get; set; }
|
||||
|
||||
public int ProductToAuctionMappingId { get; set; }
|
||||
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -10,12 +10,11 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
|||
{
|
||||
public record ProductBidBoxViewModel: BaseNopModel
|
||||
{
|
||||
public int ProductToAuctionId { get; set; }
|
||||
public int ProductToAuctionsId { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
public bool IsGuest { get; set; }
|
||||
public int AuctionId { get; set; }
|
||||
public bool AuctionClosed { get; set; }
|
||||
public bool IsItemActive { get; set; }
|
||||
public int ProductId { get; set; }
|
||||
public int CustomerId { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,8 @@
|
|||
<None Remove="Views\AdminProductAuctionSettingsBox.cshtml" />
|
||||
<None Remove="Views\Announcement.cshtml" />
|
||||
<None Remove="Views\AnnouncementList.cshtml" />
|
||||
<None Remove="Views\Auction\LiveScreenRoot.cshtml" />
|
||||
<None Remove="Views\Auction\_ViewImports.cshtml" />
|
||||
<None Remove="Views\Configure.cshtml" />
|
||||
<None Remove="Views\LiveAnnouncement.cshtml" />
|
||||
<None Remove="Views\LiveScreen.cshtml" />
|
||||
<None Remove="Views\PublicInfo - Copy.cshtml" />
|
||||
<None Remove="Views\PublicInfo.cshtml" />
|
||||
<None Remove="Views\PublicProductBidBox.cshtml" />
|
||||
<None Remove="Views\_ViewImports.cshtml" />
|
||||
|
|
@ -65,21 +61,9 @@
|
|||
<Content Include="Areas\Admin\Views\Configure.cshtml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Views\Auction\LiveScreenRoot.cshtml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Views\Auction\_ViewImports.cshtml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Views\LiveAnnouncement.cshtml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Views\LiveScreen.cshtml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Views\Auction\_LiveScreenLayout.cshtml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Views\PublicInfo.cshtml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
@{
|
||||
Layout = "_LiveScreenLayout.cshtml";
|
||||
}
|
||||
@await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.BodyStartHtmlTagAfter })
|
||||
@{
|
||||
await Html.RenderPartialAsync("_Notifications");
|
||||
}
|
||||
@{
|
||||
await Html.RenderPartialAsync("_JavaScriptDisabledWarning");
|
||||
}
|
||||
|
||||
<div class="master-wrapper-page">
|
||||
|
||||
|
||||
<section>
|
||||
<div class="container-fluid">
|
||||
@RenderBody()
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.BodyEndHtmlTagBefore })
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
@using Nop.Core.Configuration
|
||||
@using Nop.Core.Domain.Catalog
|
||||
@using Nop.Core.Domain.Common
|
||||
@using Nop.Core.Domain.Seo
|
||||
@using Nop.Services.Security
|
||||
@using Nop.Core.Events
|
||||
@inject CatalogSettings catalogSettings
|
||||
@inject CommonSettings commonSettings
|
||||
@inject IEventPublisher eventPublisher
|
||||
@inject IPermissionService permissionService
|
||||
@inject SeoSettings seoSettings
|
||||
@inject AppSettings appSettings
|
||||
@{
|
||||
if (catalogSettings.DisplayAllPicturesOnCatalogPages)
|
||||
{
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/lib_npm/swiper/swiper-bundle.min.js");
|
||||
}
|
||||
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/Themes/CypherClean/Content/scripts/bootstrap.bundle.min.js");
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/Themes/CypherClean/Content/scripts/tether.min.js");
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/js/public.countryselect.js");
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/js/public.ajaxcart.js");
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/js/public.common.js");
|
||||
//when jQuery migrate script logging is active you will see the log in the browser console
|
||||
if (commonSettings.JqueryMigrateScriptLoggingActive)
|
||||
{
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/lib_npm/jquery-migrate/jquery-migrate.js");
|
||||
}
|
||||
else
|
||||
{
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/lib_npm/jquery-migrate/jquery-migrate.min.js");
|
||||
}
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/lib_npm/jquery-ui-dist/jquery-ui.min.js");
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/lib_npm/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js");
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/lib_npm/jquery-validation/jquery.validate.min.js");
|
||||
NopHtml.AppendScriptParts(ResourceLocation.Footer, "~/lib_npm/jquery/jquery.min.js");
|
||||
|
||||
//custom tag(s);
|
||||
if (!string.IsNullOrEmpty(seoSettings.CustomHeadTags))
|
||||
{
|
||||
NopHtml.AppendHeadCustomParts(seoSettings.CustomHeadTags);
|
||||
}
|
||||
//event
|
||||
await eventPublisher.PublishAsync(new PageRenderingEvent(NopHtml));
|
||||
var title = await NopHtml.GenerateTitleAsync();
|
||||
var description = await @NopHtml.GenerateMetaDescriptionAsync();
|
||||
var keywords = await NopHtml.GenerateMetaKeywordsAsync();
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="@CultureInfo.CurrentUICulture.TwoLetterISOLanguageName" dir="@Html.GetUIDirection(!await Html.ShouldUseRtlThemeAsync())" class="@NopHtml.GeneratePageCssClasses()">
|
||||
<head>
|
||||
<title>@title</title>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
<meta name="description" content="@description" />
|
||||
<meta name="keywords" content="@keywords" />
|
||||
<meta name="generator" content="nopCommerce" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
@NopHtml.GenerateHeadCustom()
|
||||
@*This is used so that themes can inject content into the header*@
|
||||
@await Html.PartialAsync("Head")
|
||||
|
||||
@NopHtml.GenerateCssFiles()
|
||||
|
||||
@await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.HeadHtmlTag })
|
||||
@NopHtml.GenerateScripts(ResourceLocation.Head)
|
||||
@NopHtml.GenerateCanonicalUrls()
|
||||
@await Component.InvokeAsync(typeof(NewsRssHeaderLinkViewComponent))
|
||||
@await Component.InvokeAsync(typeof(BlogRssHeaderLinkViewComponent))
|
||||
@*Insert favicon and app icons head code*@
|
||||
@await Component.InvokeAsync(typeof(FaviconViewComponent))
|
||||
@NopHtml.GenerateScripts(ResourceLocation.Head)
|
||||
@NopHtml.GenerateInlineScripts(ResourceLocation.Head)
|
||||
<script src="https://kit.fontawesome.com/12c469cb8f.js" crossorigin="anonymous"></script>
|
||||
<!--Powered by nopCommerce - https://www.nopCommerce.com-->
|
||||
@Html.Raw(commonSettings.HeaderCustomHtml)
|
||||
</head>
|
||||
<body>
|
||||
<nop-antiforgery-token />
|
||||
@RenderBody()
|
||||
@NopHtml.GenerateScripts(ResourceLocation.Footer)
|
||||
@NopHtml.GenerateInlineScripts(ResourceLocation.Footer)
|
||||
@Html.Raw(commonSettings.FooterCustomHtml)
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
@inherits Nop.Web.Framework.Mvc.Razor.NopRazorPage<TModel>
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@addTagHelper *, Nop.Web.Framework
|
||||
|
||||
@inject INopHtmlHelper NopHtml
|
||||
|
||||
@using System.Globalization;
|
||||
@using System.Text.Encodings.Web
|
||||
@using Microsoft.AspNetCore.Mvc.ViewFeatures
|
||||
@using System.Text.Encodings.Web
|
||||
@using Newtonsoft.Json
|
||||
@using Nop.Core
|
||||
@using Nop.Core.Infrastructure
|
||||
@using Nop.Core.Domain.Catalog
|
||||
@using Nop.Core.Domain.Seo;
|
||||
@using Nop.Services.Events
|
||||
@using Nop.Web.Components
|
||||
@using Nop.Web.Framework
|
||||
@using Nop.Web.Framework.Events
|
||||
@using Nop.Web.Framework.Infrastructure
|
||||
@using Nop.Web.Extensions
|
||||
@using Nop.Web.Framework.Extensions
|
||||
@using Nop.Web.Framework.Models
|
||||
@using Nop.Web.Framework.Models.DataTables
|
||||
@using Nop.Web.Framework.Security.Captcha
|
||||
@using Nop.Web.Framework.Security.Honeypot
|
||||
@using Nop.Web.Framework.Themes
|
||||
@using Nop.Web.Framework.UI
|
||||
@using Nop.Web.Areas.Admin.Models.Catalog
|
||||
@using Nop.Plugin.Misc.AuctionPlugin
|
||||
@using Nop.Plugin.Misc.AuctionPlugin.Models
|
||||
@using Nop.Plugin.Misc.AuctionPlugin.Services
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
@model LiveScreenViewModel
|
||||
@using Nop.Core.Infrastructure
|
||||
@using Nop.Web.Framework
|
||||
|
||||
@{
|
||||
var defaultGridPageSize = EngineContext.Current.Resolve<Nop.Core.Domain.Common.AdminAreaSettings>().DefaultGridPageSize;
|
||||
var gridPageSizes = EngineContext.Current.Resolve<Nop.Core.Domain.Common.AdminAreaSettings>().GridPageSizes;
|
||||
Layout = "Auction/LiveScreenRoot.cshtml";
|
||||
//page title
|
||||
|
||||
}
|
||||
<div>
|
||||
|
||||
<h1>Live screen</h1>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,44 +1,9 @@
|
|||
@model AuctionPublicInfoModel
|
||||
|
||||
|
||||
|
||||
<script asp-location="Footer">
|
||||
var pageViewModel;
|
||||
|
||||
$(document).ready(function () {
|
||||
// Deserialize the server-side model
|
||||
pageViewModel = @Html.Raw(Json.Serialize(Model));
|
||||
console.log("Page View Model:", pageViewModel);
|
||||
console.log(pageViewModel.ProductId);
|
||||
console.log(pageViewModel.ProductToAuctionMappingId);
|
||||
// Get the element with data-productid
|
||||
var productItem = $('.product-item[data-productid="' + pageViewModel.ProductId + '"]');
|
||||
|
||||
// Check if element exists
|
||||
if (productItem.length > 0 && pageViewModel.ProductToAuctionMappingId > 0) {
|
||||
console.log("Product item found:", productItem);
|
||||
// Add a new div as the first child
|
||||
if (pageViewModel.IsActive) {
|
||||
productItem.prepend('<div class="bg-success p-1 text-white fs-6 text-center" style="position: absolute; width: calc(100% - 1rem); height: 40px; z-index: 1;"><i class="fa-solid fa-gavel"> '
|
||||
+ 'LIVE RIGTH NOW' +
|
||||
'</i></div>');
|
||||
}
|
||||
else {
|
||||
productItem.prepend('<div class="bg-primary p-1 text-white fs-6 text-center" style="position: absolute; width: calc(100% - 1rem); height: 40px; z-index: 1;"><i class="fa-solid fa-gavel"> '
|
||||
+ pageViewModel.StartDate +
|
||||
'</i></div>');
|
||||
}
|
||||
|
||||
} else {
|
||||
console.error("Product item not found with productId:", pageViewModel.ProductId);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function refreshPublicInfo@(Model.ProductId)(data) {
|
||||
|
||||
console.log('function called: refreshPublicInfo'+@(Model.ProductId))
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="bg-dark">
|
||||
<h3>Auction viewcomponent</h3>
|
||||
<label for="w3w">@T("Plugins.Misc.AuctionPLugin.Label"):</label>
|
||||
<div class="">
|
||||
<p>General widget info: @Model.Message</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
@model ProductBidBoxViewModel
|
||||
@* @inject IJsonHelper JsonHelper; *@
|
||||
@inject IJsonHelper JsonHelper;
|
||||
|
||||
@* @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(myObj) as String) *@
|
||||
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<strong>Bid Step:</strong>
|
||||
<span id="licitStepText" class="value">@String.Format("{0:c}", Model.LicitStep)</span>
|
||||
<span class="value">@String.Format("{0:c}", Model.LicitStep)</span>
|
||||
</div>
|
||||
<div>
|
||||
<button id="signalRBidButton" class="btn btn-success" style="text-transform: uppercase;" type="button">
|
||||
|
|
@ -75,38 +75,28 @@
|
|||
}
|
||||
|
||||
<script>
|
||||
var bidBoxPageViewModel;
|
||||
var pageViewModel = undefined;
|
||||
$(document).ready(function () {
|
||||
|
||||
$(window).load(function () {
|
||||
try {
|
||||
|
||||
bidBoxPageViewModel = @Html.Raw(Json.Serialize(Model));
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e); // Logs the error
|
||||
}
|
||||
console.log("bidBoxPageViewModel " + bidBoxPageViewModel);
|
||||
console.log(bidBoxPageViewModel.WidgetZone);
|
||||
pageViewModel = @Html.Raw(Json.Serialize(Model));
|
||||
console.log(pageViewModel);
|
||||
console.log(pageViewModel.WidgetZone);
|
||||
console.log(typeof sendMessageToServer);
|
||||
|
||||
$("#signalRBidButton").on("click", function () {
|
||||
|
||||
document.getElementById("signalRBidButton").disabled = true;
|
||||
event.preventDefault();
|
||||
if (!bidBoxPageViewModel) {
|
||||
console.log("we need viewmodel data");
|
||||
bidBoxPageViewModel = @Html.Raw(Json.Serialize(Model));
|
||||
}
|
||||
|
||||
var bidMessage = {
|
||||
ProductAuctionMappingId: bidBoxPageViewModel.ProductToAuctionId,
|
||||
AuctionId: bidBoxPageViewModel.AuctionId,
|
||||
BidPrice: bidBoxPageViewModel.BidPrice,
|
||||
ProductId: bidBoxPageViewModel.ProductId,
|
||||
CustomerId: bidBoxPageViewModel.CustomerId
|
||||
ProductAuctionMappingId: pageViewModel.ProductToAuctions,
|
||||
AuctionId: pageViewModel.AuctionId,
|
||||
BidPrice: pageViewModel.BidPrice,
|
||||
ProductId: pageViewModel.ProductId,
|
||||
CustomerId: pageViewModel.CustomerId
|
||||
};
|
||||
var content = JSON.stringify(bidMessage);
|
||||
console.log("WTF " + content);
|
||||
sendMessageToServer("BidRequestMessage", bidBoxPageViewModel.CustomerId, content);
|
||||
sendMessageToServer("BidRequestMessage", pageViewModel.CustomerId, content);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
|
@ -117,12 +107,12 @@
|
|||
event.preventDefault();
|
||||
|
||||
var openItemMessage = {
|
||||
ProductAuctionMappingId: bidBoxPageViewModel.ProductToAuctionId,
|
||||
AdminId: bidBoxPageViewModel.CustomerId
|
||||
ProductAuctionMappingId: pageViewModel.ProductToAuctions,
|
||||
AdminId: pageViewModel.CustomerId
|
||||
};
|
||||
var content = JSON.stringify(openItemMessage);
|
||||
console.log(content);
|
||||
sendMessageToServer("OpenItemRequestMessage", bidBoxPageViewModel.CustomerId, content);
|
||||
sendMessageToServer("OpenItemRequestMessage", pageViewModel.CustomerId, content);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
|
@ -132,12 +122,12 @@
|
|||
event.preventDefault();
|
||||
|
||||
var itemFirstWarningMessage = {
|
||||
ProductAuctionMappingId: bidBoxPageViewModel.ProductToAuctionId,
|
||||
AdminId: bidBoxPageViewModel.CustomerId
|
||||
ProductAuctionMappingId: pageViewModel.ProductToAuctions,
|
||||
AdminId: pageViewModel.CustomerId
|
||||
};
|
||||
var content = JSON.stringify(itemFirstWarningMessage);
|
||||
console.log(content);
|
||||
sendMessageToServer("FirstWarningMessage", bidBoxPageViewModel.CustomerId, content);
|
||||
sendMessageToServer("FirstWarningMessage", pageViewModel.CustomerId, content);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
|
@ -146,28 +136,21 @@
|
|||
|
||||
function refreshPublicBidBox(data) {
|
||||
|
||||
let HUFFormatter = new Intl.NumberFormat('hu-HU', {
|
||||
style: 'currency',
|
||||
currency: 'HUF',
|
||||
});
|
||||
|
||||
var widgetPriceElement = document.getElementById("price-value-" + bidBoxPageViewModel.ProductId);
|
||||
var widgetPriceElement = document.getElementById("price-value-" + pageViewModel.ProductId);
|
||||
var budButtonElement = document.getElementById("signalRBidButton");
|
||||
var licitStepElement = document.getElementById("licitStepText");
|
||||
|
||||
if (widgetPriceElement) {
|
||||
widgetPriceElement.textContent = HUFFormatter.format(data.bidPrice); // Update the price
|
||||
licitStepElement.textContent = HUFFormatter.format(data.nextStepAmount);
|
||||
bidBoxPageViewModel.BidPrice = Number(data.bidPrice) + Number(data.nextStepAmount);
|
||||
widgetPriceElement.textContent = data.bidPrice; // Update the price
|
||||
|
||||
budButtonElement.textContent = "Bid " + HUFFormatter.format(bidBoxPageViewModel.BidPrice);
|
||||
pageViewModel.BidPrice = Number(data.bidPrice) + Number(data.nextStepAmount);
|
||||
budButtonElement.textContent = pageViewModel.BidPrice.toFixed(2);
|
||||
|
||||
|
||||
// if (bidBoxPageViewModel.CustomerId == data.CustomerId) {
|
||||
// if (pageViewModel.CustomerId == data.CustomerId) {
|
||||
|
||||
// }
|
||||
|
||||
console.log(`WidgetPrice updated to: ${data.bidPrice}, next bid is ${bidBoxPageViewModel.BidPrice}`);
|
||||
console.log(`WidgetPrice updated to: ${data.bidPrice}`);
|
||||
budButtonElement.disabled = false;
|
||||
} else {
|
||||
console.warn("Element with ID 'WidgetPrice' not found in the DOM.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue