This commit is contained in:
Loretta 2025-08-28 13:33:38 +02:00
commit 40a0a63903
5 changed files with 145 additions and 116 deletions

View File

@ -187,7 +187,7 @@ public class AuctionPluginAdminController : BasePluginController
public async Task<IActionResult> GetAuctionById(int id)
{
var auction = await _auctionService.GetAuctionByIdAsync(id);
var auction = await _auctionService.GetAuctionDtoByIdAsync(id, true, false);
if (auction == null)
return NotFound();

View File

@ -66,6 +66,7 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
console.log(currency);
var bidButtonElement = document.getElementById("signalRBidButton" + ptaId);
var bidButtonElementText = document.getElementById("signalRBidButtonText" + ptaId);
var storedBidPricePlaceholder = document.getElementById("bidPriceContainer" + ptaId);
var licitStepElement = document.getElementById("licitStepText" + ptaId);
var bidBox = document.getElementById("publicProductBidBox" + ptaId);
@ -154,10 +155,10 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
if (isMyBid) {
console.log("This is my bid");
list = bidBox.classList;
list.add("bg-success");
list.remove("bg-primary");
//list.add("bg-success");
//list.remove("bg-primary");
bidButtonElement.textContent = window.LocalizationStrings.GoodJob;
bidButtonElementText.textContent = window.LocalizationStrings.GoodJob;
bidBoxTitle.textContent = thisPta.auctionStatus == AuctionStatus.Sold ? window.LocalizationStrings.YouWin : window.LocalizationStrings.YourBidLeading;
if (window.IsAdmin) {
@ -169,15 +170,15 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
}
} else {
list = bidBox.classList;
list.add("bg-primary");
list.remove("bg-success");
//list.add("bg-primary");
//list.remove("bg-success");
bidBoxTitle.textContent = thisPta.auctionStatus == AuctionStatus.Sold ? window.LocalizationStrings.Sold : window.LocalizationStrings.PlaceABid;
if (currency.CurrencyCode == "EUR") {
bidButtonElement.textContent = window.LocalizationStrings.BidButtonPrefix + EURFormatter.format(bidNotification.nextBidPrice * window.WorkingCurrency.Rate);
bidButtonElementText.textContent = EURFormatter.format(bidNotification.nextBidPrice * window.WorkingCurrency.Rate);
//bidButtonElement.textContent = EURFormatter.format(storedBidPricePlaceholder.value);
} else {
bidButtonElement.textContent = window.LocalizationStrings.BidButtonPrefix + HUFFormatter.format(bidNotification.nextBidPrice);
bidButtonElementText.textContent = HUFFormatter.format(bidNotification.nextBidPrice);
//bidButtonElement.textContent = HUFFormatter.format(storedBidPricePlaceholder.value);
}
bidButtonElement.disabled = false;

View File

@ -25,6 +25,8 @@
window.HUFFormatter = new Intl.NumberFormat("hu-HU", {
style: "currency",
currency: "HUF",
minimumFractionDigits: 0,
maximumFractionDigits: 0,
});
window.EURFormatter = new Intl.NumberFormat("eu-EU", {
style: "currency",

View File

@ -9,6 +9,8 @@ public class AuctionDto : IAuctionDto
{
public int Id { get; set; }
public int? CategoryId { get; set; }
[NopResourceDisplayName("Name")]
public string AuctionName { get; set; }
@ -28,6 +30,7 @@ public class AuctionDto : IAuctionDto
if (auction == null) return;
Id = auction.Id;
CategoryId = auction.CategoryId;
AuctionName = auction.AuctionName;
AuctionType = auction.AuctionType;
StartDateUtc = auction.StartDateUtc;
@ -42,7 +45,7 @@ public class AuctionDto : IAuctionDto
mainEntity.Id = Id;
mainEntity.AuctionName = AuctionName;
mainEntity.AuctionType = AuctionType;
mainEntity.CategoryId = 0;
mainEntity.CategoryId = CategoryId;
mainEntity.StartDateUtc = StartDateUtc;
mainEntity.EndDateUtc = EndDateUtc;
mainEntity.Closed = Closed;

View File

@ -10,6 +10,22 @@
.old-product-price {
text-decoration: unset !important;
}
.old-price {
text-decoration: unset !important;
}
.bg-bidbox {
background-color: rgba(0,0,0,0.2);
}
.bg-bidbox-success {
background-color: rgba(170, 160, 129, 0.35);
}
.btn-autoheight {
height: auto !important;
}
</style>
@{
@ -18,7 +34,7 @@
if (Model.FirstProductToAuction != null)
{
var bgClass = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "bg-success" : "bg-primary";
var bgClass = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "bg-bidbox-success" : "bg-bidbox";
var bidButtonActive = Model.IsItemActive && (Model.FirstProductToAuction.WinnerCustomerId != Model.CustomerId || Model.IsAdmin);
var auctionStatus = Model.FirstProductToAuction.AuctionStatus;
var lastBidIsMine = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId;
@ -34,55 +50,56 @@
if (Model.WidgetZone.Equals(PublicWidgetZones.ProductDetailsOverviewTop))
{
<div class="d-flex justify-content-between" id="otherAuctionItems">
<a href="@(string.IsNullOrEmpty(Model.LastProductUrl) ? "#" : Model.LastProductUrl)" @(string.IsNullOrEmpty(Model.LastProductUrl) ? "disabled" : string.Empty)>
<div class="card mb-3" style="max-width: 540px;">
<div class="row g-0">
@*<div class="col-md-4">
<div class="d-flex justify-content-between" id="otherAuctionItems">
<a href="@(string.IsNullOrEmpty(Model.LastProductUrl) ? "#" : Model.LastProductUrl)" @(string.IsNullOrEmpty(Model.LastProductUrl) ? "disabled" : string.Empty)>
<div class="card mb-3" style="max-width: 540px;">
<div class="row g-0">
@*<div class="col-md-4">
<img src="@(string.IsNullOrEmpty(Model.LastProductImageUrl) ? "https://placehold.co/400" : Model.LastProductImageUrl)" class="img-fluid rounded-start" alt="...">
</div>
<div class="col-md-8">*@
<div class="col-12">
<div class="card-body">
<h5 class="card-title">@(string.IsNullOrEmpty(Model.LastProductUrl) ? @T("Plugins.Misc.AuctionPlugin.StartOfList") : @T("Plugins.Misc.AuctionPlugin.BackToLast"))</h5>
<p class="card-text">@(string.IsNullOrEmpty(Model.LastProductName) ? "---" : Model.LastProductName)</p>
</div>
</div>
<div class="col-12">
<div class="card-body">
<h5 class="card-title">@(string.IsNullOrEmpty(Model.LastProductUrl) ? @T("Plugins.Misc.AuctionPlugin.StartOfList") : @T("Plugins.Misc.AuctionPlugin.BackToLast"))</h5>
<p class="card-text">@(string.IsNullOrEmpty(Model.LastProductName) ? "---" : Model.LastProductName)</p>
</div>
</div>
</a>
</div>
</div>
</a>
<a href="@(string.IsNullOrEmpty(Model.NextProductUrl) ? "#" : Model.NextProductUrl)" @(string.IsNullOrEmpty(Model.NextProductUrl) ? "disabled" : string.Empty)>
<div class="card mb-3" style="max-width: 540px;">
<div class="row g-0">
@*<div class="col-md-4">
<a href="@(string.IsNullOrEmpty(Model.NextProductUrl) ? "#" : Model.NextProductUrl)" @(string.IsNullOrEmpty(Model.NextProductUrl) ? "disabled" : string.Empty)>
<div class="card mb-3" style="max-width: 540px;">
<div class="row g-0">
@*<div class="col-md-4">
<img src="@(string.IsNullOrEmpty(Model.NextProductImageUrl) ? "https://placehold.co/400" : Model.NextProductImageUrl)" class="img-fluid rounded-start" alt="...">
</div>
<div class="col-md-8">*@
<div class="col-12">
<div class="card-body">
<h5 class="card-title">@(string.IsNullOrEmpty(Model.NextProductUrl) ? @T("Plugins.Misc.AuctionPlugin.EndOfList") : @T("Plugins.Misc.AuctionPlugin.ComingUp"))</h5>
<p class="card-text">@(string.IsNullOrEmpty(Model.NextProductName) ? "---" : Model.NextProductName)</p>
</div>
</div>
<div class="col-12">
<div class="card-body">
<h5 class="card-title">@(string.IsNullOrEmpty(Model.NextProductUrl) ? @T("Plugins.Misc.AuctionPlugin.EndOfList") : @T("Plugins.Misc.AuctionPlugin.ComingUp"))</h5>
<p class="card-text">@(string.IsNullOrEmpty(Model.NextProductName) ? "---" : Model.NextProductName)</p>
</div>
</div>
</a>
</div>
</div>
</a>
</div>
}
<div id="publicProductBidBox@(Model.ProductToAuctionId)" class="p-3 @bgClass text-white">
<input id="bidPriceContainer@(Model.ProductToAuctionId)" value="@Model.NextBidPrice" hidden/>
<div class="row">
<div class="col-3"><strong>#@Model.AuctionDto.ProductToAuctionDtos.FirstOrDefault()!.SortIndex</strong></div>
<div class="col-9"><a target="_blank" class="btn btn-secondary btn-sm float-end" href="https://youtube.com/live/6yfnmyQE7Uw?feature=share"><i class="fa-brands fa-youtube"></i> Youtube live</a></div>
</div>
<div id="publicProductBidBox@(Model.ProductToAuctionId)" class="p-2 @bgClass">
@*<div id="publicProductBidBox@(Model.ProductToAuctionId)" class="p-3 text-white">*@
<input id="bidPriceContainer@(Model.ProductToAuctionId)" value="@Model.NextBidPrice" hidden />
<div class="row">
<div class="col-12"><strong>Item number: @Model.AuctionDto.ProductToAuctionDtos.FirstOrDefault()!.SortIndex</strong></div>
@*<div class="col-9"><a target="_blank" class="btn btn-secondary btn-sm float-end" href="https://youtube.com/live/6yfnmyQE7Uw?feature=share"><i class="fa-brands fa-youtube"></i> Youtube live</a></div>*@
</div>
<h4 id="bidBoxTitle@(Model.ProductToAuctionId)">@title</h4>
<div class="row justify-content-between">
@*<div class="col-xs-12 col-md-6 col-lg-4">
<p id="bidBoxTitle@(Model.ProductToAuctionId)">@title</p>
<div class="row justify-content-between m-0">
@*<div class="col-xs-12 col-md-6 col-lg-4">
<strong>Base Price:</strong>
@{
if (Model.WorkingCurrency.CurrencyCode == "EUR")
@ -98,95 +115,101 @@
}
</div>*@
<div class="col-xs-12 col-md-6 col-lg-4">
<strong>Bid Step:</strong>
@{
if (Model.WorkingCurrency.CurrencyCode == "EUR")
{
<span id="licitStepText@(Model.ProductToAuctionId)" class="value">@($"{Model.LicitStepInWorkingCurrency.ToString("C", new CultureInfo("de-DE"))}")</span>
}
else
{
// <span id="licitStepText" class="value">@($"{Model.LicitStep:c}")</span>
<span id="licitStepText@(Model.ProductToAuctionId)" class="value">@($"{Model.LicitStep.ToString("C", new CultureInfo("hu-HU"))}")</span>
}
}
</div>
<div class="col-xs-12 col-md-6 col-lg-4">
<button id="signalRBidButton@(Model.ProductToAuctionId)" class="btn btn-success float-end" style="text-transform: uppercase;" type="button" @(!bidButtonActive ? "disabled" : string.Empty)>
@{
<div class="col-xs-12 col-md-6">
<div class="text-center">
<i class="fa-solid fa-stairs align-middle"></i>
@{
if (Model.WorkingCurrency.CurrencyCode == "EUR")
{
@T("Plugins.Misc.AuctionPlugin.BidButtonPrefix") @($"{Model.NextBidPriceInWorkingCurrency.ToString("C", new CultureInfo("de-DE"))}")
<span id="licitStepText@(Model.ProductToAuctionId)" class="value align-middle">@($"{Model.LicitStepInWorkingCurrency.ToString("C", new CultureInfo("de-DE"))}")</span>
}
else
{
// <span id="licitStepText" class="value">@($"{Model.LicitStep:c}")</span>
@T("Plugins.Misc.AuctionPlugin.BidButtonPrefix") @($"{Model.NextBidPrice.ToString("C", new CultureInfo("hu-HU"))}")
<span id="licitStepText@(Model.ProductToAuctionId)" class="value align-middle">@($"{Model.LicitStep.ToString("C0", new CultureInfo("hu-HU"))}")</span>
}
}
</div>
</div>
<div class="col-xs-12 col-md-6 text-center">
<button id="signalRBidButton@(Model.ProductToAuctionId)" class="btn btn-success btn-autoheight" style="text-transform: uppercase;" type="button" @(!bidButtonActive ? "disabled" : string.Empty)>
<i class="fa-solid fa-hand"></i>
<span id="signalRBidButtonText@(Model.ProductToAuctionId)">
@{
if (Model.WorkingCurrency.CurrencyCode == "EUR")
{
@($"{Model.NextBidPriceInWorkingCurrency.ToString("C", new CultureInfo("de-DE"))}")
}
else
{
// <span id="licitStepText" class="value">@($"{Model.LicitStep:c}")</span>
@($"{Model.NextBidPrice.ToString("C0", new CultureInfo("hu-HU"))}")
}
}
</button>
@* <button id="bidButton" class="btn btn-success">
</span>
</button>
@* <button id="bidButton" class="btn btn-success">
Bid @String.Format("{0:c}", Model.NextBidPrice)
</button> *@
</div>
</div>
</div>
</div>
@* <button id="testButton" class="btn btn-success">
@* <button id="testButton" class="btn btn-success">
TestButton
</button> *@
<div id="bidFeedback" class="mt-3"></div>
</div>
<div id="bidFeedback" class="mt-3"></div>
</div>
if (Model.IsAdmin)
{
<div id="publicProductBidBoxAdmin@(Model.ProductToAuctionId)" class="p-3 bg-secondary text-white">
<h4>Manage auction!</h4>
<div id="bidBoxAdminButtons@(Model.ProductToAuctionId)" class="d-flex justify-content-between mb-3">
<hr/>
<div id="publicProductBidBoxAdmin@(Model.ProductToAuctionId)" class="p-2 bg-secondary text-white">
@*<h4>Manage auction!</h4>*@
<div id="bidBoxAdminButtons@(Model.ProductToAuctionId)" class="d-flex justify-content-between mb-3">
<div>
<button id="signalROpenItemButton@(Model.ProductToAuctionId)" class="btn btn-primary" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus == AuctionStatus.None || Model.AuctionStatus == AuctionStatus.Pause ? string.Empty : "disabled hidden")>
Open item
</button>
<button id="signalRPauseItemButton@(Model.ProductToAuctionId)" class="btn btn-warning" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus == AuctionStatus.Active || Model.AuctionStatus == AuctionStatus.FirstWarning || Model.AuctionStatus == AuctionStatus.SecondWarning ? string.Empty : "disabled hidden")>
Pause auction
</button>
<button id="signalRRevertBidButton@(Model.ProductToAuctionId)" class="btn btn-warning" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.Pause ? "disabled hidden" : string.Empty)>
Revert bid
</button>
<button id="signalRResetItemButton@(Model.ProductToAuctionId)" class="btn btn-danger" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.Pause ? "disabled hidden" : string.Empty)>
Reset auction
</button>
</div>
<div>
<button id="signalRFirstWarningButton@(Model.ProductToAuctionId)" class="btn btn-warning" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.Active ? "disabled hidden" : string.Empty)>
First warning
</button>
<button id="signalRSecondWarningButton@(Model.ProductToAuctionId)" class="btn btn-danger" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.FirstWarning ? "disabled hidden" : string.Empty)>
Second warning
</button>
<button id="signalRCloseItemButton@(Model.ProductToAuctionId)" class="btn btn-success" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.SecondWarning ? "disabled hidden" : string.Empty)>
Finished
</button>
</div>
</div>
<div>
<button id="signalROpenItemButton@(Model.ProductToAuctionId)" class="btn btn-primary" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus == AuctionStatus.None || Model.AuctionStatus == AuctionStatus.Pause ? string.Empty : "disabled hidden")>
<i class="fa-solid fa-lock-open"></i>
</button>
<button id="signalRPauseItemButton@(Model.ProductToAuctionId)" class="btn btn-warning" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus == AuctionStatus.Active || Model.AuctionStatus == AuctionStatus.FirstWarning || Model.AuctionStatus == AuctionStatus.SecondWarning ? string.Empty : "disabled hidden")>
<i class="fa-solid fa-circle-pause"></i>
</button>
<button id="signalRRevertBidButton@(Model.ProductToAuctionId)" class="btn btn-warning" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.Pause ? "disabled hidden" : string.Empty)>
<i class="fa-solid fa-clock-rotate-left"></i>
</button>
<button id="signalRResetItemButton@(Model.ProductToAuctionId)" class="btn btn-danger" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.Pause ? "disabled hidden" : string.Empty)>
Reset auction
</button>
</div>
<div>
<button id="signalRFirstWarningButton@(Model.ProductToAuctionId)" class="btn btn-warning" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.Active ? "disabled hidden" : string.Empty)>
First warning
</button>
<button id="signalRSecondWarningButton@(Model.ProductToAuctionId)" class="btn btn-danger" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.FirstWarning ? "disabled hidden" : string.Empty)>
Second warning
</button>
<button id="signalRCloseItemButton@(Model.ProductToAuctionId)" class="btn btn-success" style="text-transform: uppercase;" type="button" @(Model.AuctionStatus != AuctionStatus.SecondWarning ? "disabled hidden" : string.Empty)>
Finished
</button>
</div>
</div>
</div>
}
else
{
@ -196,13 +219,13 @@
}
else
{
<div id="publicProductBidBoxGuest@(Model.ProductToAuctionId)" class="p-3 bg-primary text-white">
<h4>This item is under auction!</h4>
<div id="bidBoxGuestMessage@(Model.ProductToAuctionId)" class="d-flex justify-content-between mb-3">
<div id="publicProductBidBoxGuest@(Model.ProductToAuctionId)" class="p-3 bg-primary text-white">
<h4>This item is under auction!</h4>
<div id="bidBoxGuestMessage@(Model.ProductToAuctionId)" class="d-flex justify-content-between mb-3">
<p>@T("Plugins.Misc.AuctionPlugin.PleaseLogInOrRegister")</p>
</div>
</div>
<p>@T("Plugins.Misc.AuctionPlugin.PleaseLogInOrRegister")</p>
</div>
</div>
}
}
@ -309,7 +332,7 @@
this.disabled = true;
event.preventDefault();
sendAuctionStatusChange(AuctionStatus.None);
sendAuctionStatusChange(ptaId, AuctionStatus.None);
return false;
});