+
@Html.LabelFor(model => model.CategoryId)
-
+
@* *@
- @Html.EditorFor(model => model.CategoryId)
-
-
-
+ @Html.EditorFor(model => model.CategoryId, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
+
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AuctionList.cshtml b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AuctionList.cshtml
index 976815d..bc826d2 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AuctionList.cshtml
+++ b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AuctionList.cshtml
@@ -43,10 +43,15 @@
Title = "Starts",
Width = "300"
},
+ new ColumnProperty(nameof(Auction.EndDateUtc))
+ {
+ Title = "Ends",
+ Width = "300"
+ },
new ColumnProperty(nameof(Auction.Closed))
{
Title = "Closed",
- Width = "300"
+ Width = "100"
},
new ColumnProperty(nameof(Auction.Id)) // Assuming Auction.Id exists
{
@@ -80,12 +85,16 @@
@@ -113,6 +122,7 @@
// Fetch auction data via AJAX
$.get(`/Admin/AuctionPluginAdmin/GetAuctionById/${auctionId}`, function (data) {
$('#editAuctionModal input[name="Id"]').val(data.id);
+ $('#editAuctionModal input[name="CategoryId"]').val(data.categoryId);
$('#editAuctionModal input[name="AuctionName"]').val(data.auctionName);
$('#editAuctionModal input[name="StartDateUtc"]').val(data.startDateUtc);
$('#editAuctionModal input[name="EndDateUtc"]').val(data.endDateUtc);
diff --git a/Nop.Plugin.Misc.AuctionPlugin/AuctionPlugin.cs b/Nop.Plugin.Misc.AuctionPlugin/AuctionPlugin.cs
index 691f91e..7a85020 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/AuctionPlugin.cs
+++ b/Nop.Plugin.Misc.AuctionPlugin/AuctionPlugin.cs
@@ -159,7 +159,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin
liveAnnouncementPluginNode.ChildNodes.Add(new SiteMapNode()
{
- Title = await _localizationService.GetResourceAsync("Plugins.Configure"),
+ Title = await _localizationService.GetResourceAsync("Admin.Auction.Configure"),
Visible = true,
IconClass = "fa-dot-circle-o",
Url = "~/Admin/AuctionPlugin/Configure"
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Content/Js/Auction.js b/Nop.Plugin.Misc.AuctionPlugin/Content/Js/Auction.js
index 7c55a34..ff0266b 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Content/Js/Auction.js
+++ b/Nop.Plugin.Misc.AuctionPlugin/Content/Js/Auction.js
@@ -45,19 +45,23 @@ window.sendAuctionStatusChange = function (ptaId, auctionStatus) {
}
-window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledState, ptaId) {
+window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledState, ptaId, thisPta) {
//now we are refreshing any widget that has this ptaId
var auctionDto = bidNotification.auctionDto;
- var productToAuction = auctionDto.productToAuctionDtos[0];
+
/*var productAuctionMappingId = ptaId;*/
- var winnerId = productToAuction.winnerCustomerId;
+ var winnerId = thisPta.winnerCustomerId;
var isMyBid;
+ console.log("productId: " + thisPta.productId);
+ var widgetPriceElement = document.getElementById("price-value-" + thisPta.productId);
+ //var widgetPriceElement = $("#price-value-" + productToAuction.productId);
- var widgetPriceElement = document.getElementById("price-value-" + productToAuction.ProductId);
- var widgetPriceElementInList = $('.product-item[data-productid="' + productToAuction.ProductId + '"]');
+
+ var widgetPriceElementInList = $('.product-item[data-productid="' + thisPta.productId + '"]');
+ console.log("WidgetPriceElement" + widgetPriceElement);
var currency = window.WorkingCurrency;
console.log(currency);
@@ -66,6 +70,12 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
var licitStepElement = document.getElementById("licitStepText" + ptaId);
var bidBox = document.getElementById("publicProductBidBox" + ptaId);
var bidBoxTitle = document.getElementById("bidBoxTitle" + ptaId);
+ console.log("signalRBidButton" + ptaId);
+ console.log(bidButtonElement);
+ console.log(storedBidPricePlaceholder);
+ console.log(licitStepElement);
+ console.log(bidBox);
+ console.log(bidBoxTitle);
console.log(bidNotification);
if (winnerId == window.CustomerId) {
@@ -76,7 +86,7 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
console.log("ProductToAuctionId: " + ptaId);
//TODO: TESZT STATUS!!! - JTEST.
- var status = productToAuction.auctionStatus;
+ var status = thisPta.auctionStatus;
//var status = AuctionStatus.TEST;
@@ -88,32 +98,57 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
if (widgetPriceElement || widgetPriceElementInList) {
if (widgetPriceElement) {
+ console.log("PRICE: " + bidNotification.currentPrice);
/*if (productAuctionMappingId == ptaId) {*/
console.log("THIS IS FOR US! SORRY FOR SHOUTING");
if (currency.CurrencyCode == "EUR") {
+ console.log("EUR");
widgetPriceElement.textContent = EURFormatter.format(bidNotification.currentPrice * window.WorkingCurrency.Rate); // Update the price
//licitStepElement.textContent = EURFormatter.format(bidNotification.nextStepAmount * window.WorkingCurrency.Rate);
}
else {
+
widgetPriceElement.textContent = HUFFormatter.format(bidNotification.currentPrice); // Update the price
+ //widgetPriceElement.setAttribute("id", "hugrabug");
//licitStepElement.textContent = HUFFormatter.format(bidNotification.nextStepAmount);
}
/*}*/
}
+ else if (widgetPriceElementInList) {
+ console.log("PRICE: " + bidNotification.currentPrice);
+ var widgetPriceElements = widgetPriceElementInList.find('.actual-price');
+ /*if (productAuctionMappingId == ptaId) {*/
+ console.log("THIS IS FOR US! SORRY FOR SHOUTING");
+ if (widgetPriceElements && widgetPriceElements.length > 0) {
+ if (currency.CurrencyCode == "EUR") {
+ console.log("EUR");
+ widgetPriceElements[0].textContent = EURFormatter.format(bidNotification.currentPrice * window.WorkingCurrency.Rate); // Update the price
+ //licitStepElement.textContent = EURFormatter.format(bidNotification.nextStepAmount * window.WorkingCurrency.Rate);
+ }
+ else {
+
+ widgetPriceElements[0].textContent = HUFFormatter.format(bidNotification.currentPrice); // Update the price
+ //licitStepElement.textContent = HUFFormatter.format(bidNotification.nextStepAmount);
+ }
+ }
+ /*}*/
+ }
/*if (productAuctionMappingId == ptaId) {*/
- console.log("THIS IS FOR US! SORRY FOR SHOUTING");
+ /*console.log("THIS IS FOR US! SORRY FOR SHOUTING");*/
if (currency.CurrencyCode == "EUR") {
+ console.log("EUR");
//widgetPriceElement.textContent = EURFormatter.format(bidNotification.currentPrice * window.WorkingCurrency.Rate); // Update the price
licitStepElement.textContent = EURFormatter.format(bidNotification.nextStepAmount * window.WorkingCurrency.Rate);
}
else {
+ console.log("HUF");
//widgetPriceElement.textContent = HUFFormatter.format(bidNotification.currentPrice); // Update the price
licitStepElement.textContent = HUFFormatter.format(bidNotification.nextStepAmount);
}
storedBidPricePlaceholder.value = Number(bidNotification.nextBidPrice);
- setBidButtonDisabled(bidButtonElement, !productToAuction.isActiveItem, updateBidButtonDisabledState);
+ setBidButtonDisabled(bidButtonElement, !thisPta.isActiveItem, updateBidButtonDisabledState);
var list;
if (isMyBid) {
@@ -123,11 +158,11 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
list.remove("bg-primary");
bidButtonElement.textContent = window.LocalizationStrings.GoodJob;
- bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? window.LocalizationStrings.YouWin : window.LocalizationStrings.YourBidLeading;
+ bidBoxTitle.textContent = thisPta.auctionStatus == AuctionStatus.Sold ? window.LocalizationStrings.YouWin : window.LocalizationStrings.YourBidLeading;
if (window.IsAdmin) {
console.log("I AM WEASEL!!! " + window.IsAdmin);
- setBidButtonDisabled(bidButtonElement, !productToAuction.isActiveItem, updateBidButtonDisabledState);
+ setBidButtonDisabled(bidButtonElement, !thisPta.isActiveItem, updateBidButtonDisabledState);
} else {
console.log("I AM NOT WEASEL!!! " + window.IsAdmin);
setBidButtonDisabled(bidButtonElement, true, updateBidButtonDisabledState);
@@ -136,18 +171,18 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
list = bidBox.classList;
list.add("bg-primary");
list.remove("bg-success");
- bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? window.LocalizationStrings.Sold : window.LocalizationStrings.PlaceABid;
+ bidBoxTitle.textContent = thisPta.auctionStatus == AuctionStatus.Sold ? window.LocalizationStrings.Sold : window.LocalizationStrings.PlaceABid;
if (currency.CurrencyCode == "EUR") {
- bidButtonElement.textContent = window.LocalizationStrings.BidButtonPrefix + EURFormatter.format(bidBoxPageViewModel.NextBidPriceInWorkingCurrency);
+ bidButtonElement.textContent = window.LocalizationStrings.BidButtonPrefix + EURFormatter.format(bidNotification.nextBidPrice * window.WorkingCurrency.Rate);
//bidButtonElement.textContent = EURFormatter.format(storedBidPricePlaceholder.value);
} else {
- bidButtonElement.textContent = window.LocalizationStrings.BidButtonPrefix + HUFFormatter.format(bidBoxPageViewModel.NextBidPrice);
+ bidButtonElement.textContent = window.LocalizationStrings.BidButtonPrefix + HUFFormatter.format(bidNotification.nextBidPrice);
//bidButtonElement.textContent = HUFFormatter.format(storedBidPricePlaceholder.value);
}
bidButtonElement.disabled = false;
}
-
+ //console.log(widgetPriceElement.textContent);
console.log(`WidgetPrice updated to: ${bidNotification.currentPrice}`);
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Content/Js/MgMessageHandler.js b/Nop.Plugin.Misc.AuctionPlugin/Content/Js/MgMessageHandler.js
index 693050f..c4e5bad 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Content/Js/MgMessageHandler.js
+++ b/Nop.Plugin.Misc.AuctionPlugin/Content/Js/MgMessageHandler.js
@@ -35,56 +35,65 @@
console.log(bidNotification);
var auctionDto = bidNotification.auctionDto;
- var productToAuctionDto = auctionDto.productToAuctionDtos[0];
- //var productAuctionMappingId = productToAuctionDto.id;
- //console.log(productAuctionMappingId);
+ var productToAuctionList = auctionDto.productToAuctionDtos;
- var publicProductBidBox = document.getElementById("publicProductBidBox" + productToAuctionDto.id);
- var liveScreen = document.getElementById("auctionProductLiveScreenBox");
- var publicInfo = document.getElementById("publicInfoOverlay" + productToAuctionDto.productId);
+ productToAuctionList.forEach(productToAuction => {
- if (publicProductBidBox) {
- //var audio = new Audio('../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
- //audio.play();
+ /*var productToAuctionDto = auctionDto.productToAuctionDtos[0];*/
- var lastRequestId = window.getRequestId();
- var isMyRequest = messageWrapper.requestId == lastRequestId;
-
- console.log("isMyRequest: " + isMyRequest + "; lastRequestId: " + lastRequestId + "; messageWrapper.RequestId: " + messageWrapper.requestId);
+ //var productAuctionMappingId = productToAuctionDto.id;
+ //console.log(productAuctionMappingId);
- refreshPublicBidBox(bidNotification, isMyRequest, productToAuctionDto.id);
- }
- if (publicInfo) {
- var functionName = "refreshPublicInfo" + productToAuctionDto.productId;
- window[functionName](auctionDto);
- }
- if (liveScreen) {
+ var publicProductBidBox = document.getElementById("publicProductBidBox" + productToAuction.id);
+ var liveScreen = document.getElementById("auctionProductLiveScreenBox");
+ var publicInfo = document.getElementById("publicInfoOverlay" + productToAuction.productId);
- updateOnBid(bidNotification);
- } else if (!messageWrapper.hideToaster) {
- toastr.success(
- `
${bidNotification.currentPrice}
${bidNotification.productName
- }
`,
- "New bid arrived",
- {
- "closeButton": true,
- "positionClass": "toast-bottom-left",
- "newestOnTop": true,
- "progressBar": true,
- "preventDuplicates": false,
- "onclick": null,
- "showDuration": "30000",
- "hideDuration": "1000",
- "timeOut": "5000",
- "extendedTimeOut": "1000",
- "showEasing": "swing",
- "hideEasing": "linear",
- "showMethod": animation,
- "hideMethod": "fadeOut"
- });
- $('.toast-success').css("background-color", "#4caf50");
- }
+ if (publicProductBidBox) {
+ //var audio = new Audio('../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
+ //audio.play();
+
+ var lastRequestId = window.getRequestId();
+ var isMyRequest = messageWrapper.requestId == lastRequestId;
+
+ console.log("isMyRequest: " + isMyRequest + "; lastRequestId: " + lastRequestId + "; messageWrapper.RequestId: " + messageWrapper.requestId);
+
+ refreshPublicBidBox(bidNotification, isMyRequest, productToAuction.id, productToAuction);
+ }
+ if (publicInfo) {
+ var functionName = "refreshPublicInfo" + productToAuction.productId;
+ window[functionName](auctionDto);
+ }
+ if (liveScreen) {
+
+ updateOnBid(bidNotification);
+ } else if (!messageWrapper.hideToaster) {
+ toastr.success(
+ `
${bidNotification.currentPrice}
${bidNotification.productName
+ }
`,
+ "New bid arrived",
+ {
+ "closeButton": true,
+ "positionClass": "toast-bottom-left",
+ "newestOnTop": true,
+ "progressBar": true,
+ "preventDuplicates": false,
+ "onclick": null,
+ "showDuration": "30000",
+ "hideDuration": "1000",
+ "timeOut": "5000",
+ "extendedTimeOut": "1000",
+ "showEasing": "swing",
+ "hideEasing": "linear",
+ "showMethod": animation,
+ "hideMethod": "fadeOut"
+ });
+ $('.toast-success').css("background-color", "#4caf50");
+ }
+
+
+ });
+
},
ProductToAuctionStatusNotification: function(messageWrapper) {
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/AuctionBid.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/AuctionBid.cs
index 2205d7b..df8d419 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/AuctionBid.cs
+++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/AuctionBid.cs
@@ -18,8 +18,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
public bool IsWinner { get; set; }
public decimal BidPrice { get; set; }
- public int AuctionId { get; set; }
-
[SkipValuesOnUpdate]
public DateTime Created { get; set; }
public DateTime Modified { get; set; }
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Models/AssignAuctionRequestModel.cs b/Nop.Plugin.Misc.AuctionPlugin/Models/AssignAuctionRequestModel.cs
index 8337603..c1485e5 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Models/AssignAuctionRequestModel.cs
+++ b/Nop.Plugin.Misc.AuctionPlugin/Models/AssignAuctionRequestModel.cs
@@ -17,6 +17,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
public string StartingPrice { get; set; }
public string BidPrice { get; set; }
public string AuctionId { get; set; }
+ public int SortIndex { get; set; }
}
}
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs b/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs
index a096e81..9da28f1 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs
+++ b/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs
@@ -636,7 +636,7 @@ public class AuctionService(
=> ctx.GetProductToAuctionByAuctionIdAndProductIdAsync(auctionId, productId, activeProductOnly);
- public async Task
AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId)
+ public async Task AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId, int sortIndex)
{
var auction = await GetAuctionDtoByIdAsync(auctionId, false, false);
if (auction == null)
@@ -652,6 +652,7 @@ public class AuctionService(
StartingPrice = startingPrice,
CurrentPrice = bidPrice,
ProductAmount = 1,
+ SortIndex = sortIndex,
AuctionStatus = AuctionStatus.None,
AuctionId = auctionId
};
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs b/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs
index 0e75c90..9a85d8a 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs
+++ b/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs
@@ -68,7 +68,7 @@ public interface IAuctionService
Task GetAuctionBidDtoByIdAsync(int auctionBidId);
- Task AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId);
+ Task AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId, int sortIndex);
Task> GetProductToAuctionsByProductIdAsync(int productId);
Task> GetProductToAuctionByAuctionIdAndProductIdAsync(int auctionId, int productId, bool activeProductOnly);
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Views/LiveScreen.cshtml b/Nop.Plugin.Misc.AuctionPlugin/Views/LiveScreen.cshtml
index 12f7dec..2cadf64 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Views/LiveScreen.cshtml
+++ b/Nop.Plugin.Misc.AuctionPlugin/Views/LiveScreen.cshtml
@@ -21,7 +21,7 @@
{
-
-
+
-
+
-
-

+
+

+
+
+ @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.ProductBoxAddinfoAfter, additionalData = Model.ActiveProductDetails })
diff --git a/Nop.Plugin.Misc.AuctionPlugin/Views/PublicInfo.cshtml b/Nop.Plugin.Misc.AuctionPlugin/Views/PublicInfo.cshtml
index be024c1..c7c33a0 100644
--- a/Nop.Plugin.Misc.AuctionPlugin/Views/PublicInfo.cshtml
+++ b/Nop.Plugin.Misc.AuctionPlugin/Views/PublicInfo.cshtml
@@ -5,8 +5,6 @@