You're the winner!

This commit is contained in:
Loretta 2024-11-29 16:11:17 +01:00
parent b76e7ec569
commit a342bc57ad
2 changed files with 28 additions and 16 deletions

View File

@ -63,7 +63,7 @@
'" class="bg-success p-1 text-white text-center" style="position: absolute; width: calc(100% - 1rem); height: 50px; z-index: 1;"><p class="m-0"><i class="fa-solid fa-gavel"> ' +
'LIVE RIGTH NOW' +
'</i></p><span>' +
productToAuctionDto.sortIndex +
"No.: " + productToAuctionDto.sortIndex +
'</span></div>');
} else {
console.log("isActive: " + isActive);

View File

@ -13,7 +13,15 @@
{
var bgClass = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "bg-success" : "bg-primary";
var bidButtonActive = Model.IsItemActive && (Model.FirstProductToAuction.WinnerCustomerId != Model.CustomerId || Model.IsAdmin);
var title = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "Your bid is leading" : "Place a bid!";
var auctionStatus = Model.FirstProductToAuction.AuctionStatus;
var lastBidIsMine = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId;
var title = auctionStatus switch
{
AuctionStatus.Sold => lastBidIsMine ? "You're the winner!" : "Sold",
AuctionStatus.NotSold => "Finished",
_ => lastBidIsMine ? "Your bid is leading" : "Place a bid!"
};
<div class="d-flex justify-content-between" id="otherAuctionItems">
<a href="@(string.IsNullOrEmpty(Model.LastProductUrl) ? "#" : Model.LastProductUrl)" @(string.IsNullOrEmpty(Model.LastProductUrl) ? "disabled" : string.Empty)>
@ -289,13 +297,16 @@
// data.AuctionDto.
// }
var widgetPriceElement = document.getElementById("price-value-" + bidBoxPageViewModel.ProductId);
var budButtonElement = document.getElementById("signalRBidButton");
var bidButtonElement = document.getElementById("signalRBidButton");
var licitStepElement = document.getElementById("licitStepText");
var bidBox = document.getElementById("publicProductBidBox");
var bidBoxTitle = document.getElementById("bidBoxTitle");
console.log(data);
var productAuctionMappingId = data.auctionDto.productToAuctionDtos[0].id;
var winnerId = data.auctionDto.productToAuctionDtos[0].winnerCustomerId;
let auctionDto = data.auctionDto;
let productToAuction = auctionDto.productToAuctionDtos[0];
var productAuctionMappingId = productToAuction.id;
var winnerId = productToAuction.winnerCustomerId;
var isMyBid;
if (winnerId == bidBoxPageViewModel.CustomerId) {
@ -325,34 +336,35 @@
widgetPriceElement.textContent = HUFFormatter.format(data.currentPrice); // Update the price
licitStepElement.textContent = HUFFormatter.format(data.nextStepAmount);
bidBoxPageViewModel.NextBidPrice = Number(data.nextBidPrice);
budButtonElement.disabled = false;
bidButtonElement.disabled = false;
var list;
if (isMyBid) {
console.log("This is my bid");
var list = bidBox.classList;
list = bidBox.classList;
list.add("bg-success");
list.remove("bg-primary");
budButtonElement.textContent = "Good job";
bidBoxTitle.textContent = "Your bid is leading!"
bidButtonElement.textContent = "Good job";
bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? "You're the winner!" : "Your bid is leading!";
if (bidBoxPageViewModel.IsAdmin) {
console.log("I AM WEASEL!!! " + bidBoxPageViewModel.IsAdmin);
budButtonElement.disabled = false;
bidButtonElement.disabled = false;
}
else {
console.log("I AM NOT WEASEL!!! " + bidBoxPageViewModel.IsAdmin);
budButtonElement.disabled = true;
bidButtonElement.disabled = true;
}
}
else {
var list = bidBox.classList;
list = bidBox.classList;
list.add("bg-primary");
list.remove("bg-success");
bidBoxTitle.textContent = "Place a bid!"
budButtonElement.textContent = "Bid " + HUFFormatter.format(bidBoxPageViewModel.NextBidPrice);
bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? "Sold" : "Place a bid!";
bidButtonElement.textContent = "Bid " + HUFFormatter.format(bidBoxPageViewModel.NextBidPrice);
}
console.log(`WidgetPrice updated to: ${data.currentPrice}, next bid is ${bidBoxPageViewModel.NextBidPrice}`);
//budButtonElement.disabled = false;
//bidButtonElement.disabled = false;
}
@ -392,7 +404,7 @@
bidBoxTitle.textContent = "First warning!";
}
else if (itemStatus == AuctionStatus.SecondWarning) {
bidBoxTitle.textContent = "Secnod warning! Hurry up!";
bidBoxTitle.textContent = "Second warning! Hurry up!";
}
setButtons(itemStatus);