From da016005ed1b08822a9f4bbfa9fc8de548460cfb Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 5 Jan 2025 14:23:43 +0100 Subject: [PATCH] Bidbox heneralizations, livescreen bidbox, refractoring, minor improvements (reset auction button not working!!!) --- .../Components/AuctionAdminViewComponent.cs | 1 + .../AuctionPluginAdminController.cs | 13 ++- .../Models/ProductAssignToAuctionViewModel.cs | 1 + .../AdminProductAuctionSettingsBox.cshtml | 7 +- .../Areas/Admin/Views/Auction.cshtml | 63 +++++------- .../Areas/Admin/Views/AuctionList.cshtml | 14 ++- .../AuctionPlugin.cs | 2 +- .../Content/Js/Auction.js | 63 +++++++++--- .../Content/Js/MgMessageHandler.js | 97 ++++++++++--------- .../Domains/Entities/AuctionBid.cs | 2 - .../Models/AssignAuctionRequestModel.cs | 1 + .../Services/AuctionService.cs | 3 +- .../Services/IAuctionService.cs | 2 +- .../Views/LiveScreen.cshtml | 13 ++- .../Views/PublicInfo.cshtml | 2 - .../Views/PublicProductBidBox.cshtml | 26 ++--- .../Views/_ViewImports.cshtml | 1 + 17 files changed, 183 insertions(+), 128 deletions(-) diff --git a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Components/AuctionAdminViewComponent.cs b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Components/AuctionAdminViewComponent.cs index 74e5029..26ce3fb 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Components/AuctionAdminViewComponent.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Components/AuctionAdminViewComponent.cs @@ -106,6 +106,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Components viewModel.ProductId = productId; viewModel.StartingPrice = productModel.OldPrice; viewModel.BidPrice = productModel.OldPrice; + viewModel.SortIndex = 0; //viewModel.InAuctions = await _auctionService.GetAllAuctionsAsync() viewModel.InAuctions = []; diff --git a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AuctionPluginAdminController.cs b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AuctionPluginAdminController.cs index 744702a..5e01329 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AuctionPluginAdminController.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AuctionPluginAdminController.cs @@ -179,7 +179,7 @@ public class AuctionPluginAdminController : BasePluginController return BadRequest(); var result = await _auctionService.AssignProductToAuctionAsync(Convert.ToInt32(model.ProductId), - Convert.ToDecimal(model.StartingPrice), Convert.ToDecimal(model.BidPrice), Convert.ToInt32(model.AuctionId)); + Convert.ToDecimal(model.StartingPrice), Convert.ToDecimal(model.BidPrice), Convert.ToInt32(model.AuctionId), model.SortIndex); return result != null ? Ok("Baaaazdmeeeeeeeeg") : StatusCode(500, "Error assigning product to auction."); } @@ -190,13 +190,16 @@ public class AuctionPluginAdminController : BasePluginController if (auction == null) return NotFound(); - return Json(new + var result = Json(new { id = auction.Id, + categoryId = auction.CategoryId, auctionName = auction.AuctionName, startDateUtc = auction.StartDateUtc, + endtDateUtc = auction.EndDateUtc, closed = auction.Closed }); + return result; } [HttpPost] @@ -206,9 +209,11 @@ public class AuctionPluginAdminController : BasePluginController if (auction != null) { dbAuction.AuctionName = auction.AuctionName; - + dbAuction.CategoryId = auction.CategoryId; + dbAuction.StartDateUtc = auction.StartDateUtc; + dbAuction.EndDateUtc = auction.EndDateUtc; dbAuction.Closed = auction.Closed; - await _auctionService.UpdateAuctionAsync(auction); + await _auctionService.UpdateAuctionAsync(dbAuction); } return Ok(); } diff --git a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Models/ProductAssignToAuctionViewModel.cs b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Models/ProductAssignToAuctionViewModel.cs index 833116b..f1c3984 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Models/ProductAssignToAuctionViewModel.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Models/ProductAssignToAuctionViewModel.cs @@ -15,5 +15,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Models public decimal StartingPrice { get; set; } public decimal BidPrice { get; set; } public decimal BidAmount { get; set; } + public int SortIndex { get; set; } } } diff --git a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AdminProductAuctionSettingsBox.cshtml b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AdminProductAuctionSettingsBox.cshtml index e39beb8..7ed0622 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AdminProductAuctionSettingsBox.cshtml +++ b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/AdminProductAuctionSettingsBox.cshtml @@ -16,7 +16,7 @@ } - + @@ -34,7 +34,7 @@ // var bidPrice = $("#bidPrice").val()toFixed(2); var bidPrice = $("#bidPrice").val(); var auctionId = $("#auctionDropdown").val(); - + var sortIndex = $("#sortIndex").val(); if (!auctionId) { alert("Please select an auction."); return; @@ -45,7 +45,8 @@ ProductId: productId, StartingPrice: startingPrice, BidPrice: bidPrice, - AuctionId: auctionId + AuctionId: auctionId, + SortIndex: sortIndex }; addAntiForgeryToken(postData); diff --git a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/Auction.cshtml b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/Auction.cshtml index 6c5553b..e40e06a 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/Auction.cshtml +++ b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Views/Auction.cshtml @@ -8,6 +8,8 @@ Layout = "_AdminLayout"; //page title Model.PageTitle = "Auctions page"; + Model.StartDateUtc = DateTime.UtcNow; + Model.EndDateUtc = DateTime.UtcNow.AddDays(3); ViewBag.Title = Model.PageTitle; } @@ -35,93 +37,80 @@
-
+
@Html.LabelFor(model => model.AuctionName)
-
+
- @Html.EditorFor(model => model.AuctionName) + @Html.EditorFor(model => model.AuctionName, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
-
-   -
+
-
+
@Html.LabelFor(model => model.AuctionType)
-
+
- @Html.EditorFor(model => model.AuctionType) + @Html.EditorFor(model => model.AuctionType, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
-
-   -
+
-
+
@Html.LabelFor(model => model.StartDateUtc)
-
+
@* *@ - @Html.EditorFor(model => model.StartDateUtc) -
-
-   + @Html.EditorFor(model => model.StartDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
+
-
+
@Html.LabelFor(model => model.EndDateUtc)
-
+
@* *@ - @Html.EditorFor(model => model.EndDateUtc) -
-
-   + @Html.EditorFor(model => model.EndDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
+
-
+
@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" } })
+
-
+
@Html.LabelFor(model => model.Closed)
-
+
- @Html.EditorFor(model => model.Closed) + @Html.EditorFor(model => model.Closed, new { HtmlAttributes = new { @class = "" } })
- -
-   -
+
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 @@ {
-
+
Auction Item Image
@@ -46,7 +46,7 @@
-
+
@@ -105,10 +105,13 @@
- +
-
- +
+ +
+
+ @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 @@