You're the winner!
This commit is contained in:
parent
b76e7ec569
commit
a342bc57ad
|
|
@ -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"> ' +
|
'" 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' +
|
'LIVE RIGTH NOW' +
|
||||||
'</i></p><span>' +
|
'</i></p><span>' +
|
||||||
productToAuctionDto.sortIndex +
|
"No.: " + productToAuctionDto.sortIndex +
|
||||||
'</span></div>');
|
'</span></div>');
|
||||||
} else {
|
} else {
|
||||||
console.log("isActive: " + isActive);
|
console.log("isActive: " + isActive);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,15 @@
|
||||||
{
|
{
|
||||||
var bgClass = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "bg-success" : "bg-primary";
|
var bgClass = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "bg-success" : "bg-primary";
|
||||||
var bidButtonActive = Model.IsItemActive && (Model.FirstProductToAuction.WinnerCustomerId != Model.CustomerId || Model.IsAdmin);
|
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">
|
<div class="d-flex justify-content-between" id="otherAuctionItems">
|
||||||
<a href="@(string.IsNullOrEmpty(Model.LastProductUrl) ? "#" : Model.LastProductUrl)" @(string.IsNullOrEmpty(Model.LastProductUrl) ? "disabled" : string.Empty)>
|
<a href="@(string.IsNullOrEmpty(Model.LastProductUrl) ? "#" : Model.LastProductUrl)" @(string.IsNullOrEmpty(Model.LastProductUrl) ? "disabled" : string.Empty)>
|
||||||
|
|
@ -289,13 +297,16 @@
|
||||||
// data.AuctionDto.
|
// data.AuctionDto.
|
||||||
// }
|
// }
|
||||||
var widgetPriceElement = document.getElementById("price-value-" + bidBoxPageViewModel.ProductId);
|
var widgetPriceElement = document.getElementById("price-value-" + bidBoxPageViewModel.ProductId);
|
||||||
var budButtonElement = document.getElementById("signalRBidButton");
|
var bidButtonElement = document.getElementById("signalRBidButton");
|
||||||
var licitStepElement = document.getElementById("licitStepText");
|
var licitStepElement = document.getElementById("licitStepText");
|
||||||
var bidBox = document.getElementById("publicProductBidBox");
|
var bidBox = document.getElementById("publicProductBidBox");
|
||||||
var bidBoxTitle = document.getElementById("bidBoxTitle");
|
var bidBoxTitle = document.getElementById("bidBoxTitle");
|
||||||
console.log(data);
|
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;
|
var isMyBid;
|
||||||
|
|
||||||
if (winnerId == bidBoxPageViewModel.CustomerId) {
|
if (winnerId == bidBoxPageViewModel.CustomerId) {
|
||||||
|
|
@ -325,34 +336,35 @@
|
||||||
widgetPriceElement.textContent = HUFFormatter.format(data.currentPrice); // Update the price
|
widgetPriceElement.textContent = HUFFormatter.format(data.currentPrice); // Update the price
|
||||||
licitStepElement.textContent = HUFFormatter.format(data.nextStepAmount);
|
licitStepElement.textContent = HUFFormatter.format(data.nextStepAmount);
|
||||||
bidBoxPageViewModel.NextBidPrice = Number(data.nextBidPrice);
|
bidBoxPageViewModel.NextBidPrice = Number(data.nextBidPrice);
|
||||||
budButtonElement.disabled = false;
|
bidButtonElement.disabled = false;
|
||||||
|
var list;
|
||||||
if (isMyBid) {
|
if (isMyBid) {
|
||||||
console.log("This is my bid");
|
console.log("This is my bid");
|
||||||
var list = bidBox.classList;
|
list = bidBox.classList;
|
||||||
list.add("bg-success");
|
list.add("bg-success");
|
||||||
list.remove("bg-primary");
|
list.remove("bg-primary");
|
||||||
budButtonElement.textContent = "Good job";
|
bidButtonElement.textContent = "Good job";
|
||||||
bidBoxTitle.textContent = "Your bid is leading!"
|
bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? "You're the winner!" : "Your bid is leading!";
|
||||||
if (bidBoxPageViewModel.IsAdmin) {
|
if (bidBoxPageViewModel.IsAdmin) {
|
||||||
console.log("I AM WEASEL!!! " + bidBoxPageViewModel.IsAdmin);
|
console.log("I AM WEASEL!!! " + bidBoxPageViewModel.IsAdmin);
|
||||||
budButtonElement.disabled = false;
|
bidButtonElement.disabled = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("I AM NOT WEASEL!!! " + bidBoxPageViewModel.IsAdmin);
|
console.log("I AM NOT WEASEL!!! " + bidBoxPageViewModel.IsAdmin);
|
||||||
budButtonElement.disabled = true;
|
bidButtonElement.disabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var list = bidBox.classList;
|
list = bidBox.classList;
|
||||||
list.add("bg-primary");
|
list.add("bg-primary");
|
||||||
list.remove("bg-success");
|
list.remove("bg-success");
|
||||||
bidBoxTitle.textContent = "Place a bid!"
|
bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? "Sold" : "Place a bid!";
|
||||||
budButtonElement.textContent = "Bid " + HUFFormatter.format(bidBoxPageViewModel.NextBidPrice);
|
bidButtonElement.textContent = "Bid " + HUFFormatter.format(bidBoxPageViewModel.NextBidPrice);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`WidgetPrice updated to: ${data.currentPrice}, next bid is ${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!";
|
bidBoxTitle.textContent = "First warning!";
|
||||||
}
|
}
|
||||||
else if (itemStatus == AuctionStatus.SecondWarning) {
|
else if (itemStatus == AuctionStatus.SecondWarning) {
|
||||||
bidBoxTitle.textContent = "Secnod warning! Hurry up!";
|
bidBoxTitle.textContent = "Second warning! Hurry up!";
|
||||||
}
|
}
|
||||||
|
|
||||||
setButtons(itemStatus);
|
setButtons(itemStatus);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue