Bidbox heneralizations, livescreen bidbox, refractoring, minor improvements (reset auction button not working!!!)
This commit is contained in:
parent
1b6ad7e33d
commit
da016005ed
|
|
@ -106,6 +106,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Components
|
||||||
viewModel.ProductId = productId;
|
viewModel.ProductId = productId;
|
||||||
viewModel.StartingPrice = productModel.OldPrice;
|
viewModel.StartingPrice = productModel.OldPrice;
|
||||||
viewModel.BidPrice = productModel.OldPrice;
|
viewModel.BidPrice = productModel.OldPrice;
|
||||||
|
viewModel.SortIndex = 0;
|
||||||
//viewModel.InAuctions = await _auctionService.GetAllAuctionsAsync()
|
//viewModel.InAuctions = await _auctionService.GetAllAuctionsAsync()
|
||||||
viewModel.InAuctions = [];
|
viewModel.InAuctions = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ public class AuctionPluginAdminController : BasePluginController
|
||||||
return BadRequest();
|
return BadRequest();
|
||||||
|
|
||||||
var result = await _auctionService.AssignProductToAuctionAsync(Convert.ToInt32(model.ProductId),
|
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.");
|
return result != null ? Ok("Baaaazdmeeeeeeeeg") : StatusCode(500, "Error assigning product to auction.");
|
||||||
}
|
}
|
||||||
|
|
@ -190,13 +190,16 @@ public class AuctionPluginAdminController : BasePluginController
|
||||||
if (auction == null)
|
if (auction == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
||||||
return Json(new
|
var result = Json(new
|
||||||
{
|
{
|
||||||
id = auction.Id,
|
id = auction.Id,
|
||||||
|
categoryId = auction.CategoryId,
|
||||||
auctionName = auction.AuctionName,
|
auctionName = auction.AuctionName,
|
||||||
startDateUtc = auction.StartDateUtc,
|
startDateUtc = auction.StartDateUtc,
|
||||||
|
endtDateUtc = auction.EndDateUtc,
|
||||||
closed = auction.Closed
|
closed = auction.Closed
|
||||||
});
|
});
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|
@ -206,9 +209,11 @@ public class AuctionPluginAdminController : BasePluginController
|
||||||
if (auction != null)
|
if (auction != null)
|
||||||
{
|
{
|
||||||
dbAuction.AuctionName = auction.AuctionName;
|
dbAuction.AuctionName = auction.AuctionName;
|
||||||
|
dbAuction.CategoryId = auction.CategoryId;
|
||||||
|
dbAuction.StartDateUtc = auction.StartDateUtc;
|
||||||
|
dbAuction.EndDateUtc = auction.EndDateUtc;
|
||||||
dbAuction.Closed = auction.Closed;
|
dbAuction.Closed = auction.Closed;
|
||||||
await _auctionService.UpdateAuctionAsync(auction);
|
await _auctionService.UpdateAuctionAsync(dbAuction);
|
||||||
}
|
}
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Models
|
||||||
public decimal StartingPrice { get; set; }
|
public decimal StartingPrice { get; set; }
|
||||||
public decimal BidPrice { get; set; }
|
public decimal BidPrice { get; set; }
|
||||||
public decimal BidAmount { get; set; }
|
public decimal BidAmount { get; set; }
|
||||||
|
public int SortIndex { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<option value="@auction.Id">@auction.AuctionName</option>
|
<option value="@auction.Id">@auction.AuctionName</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
|
<input id="sortIndex" type="text" value="@Model.SortIndex" />
|
||||||
<button id="assignAuctionButton" class="btn btn-primary mt-2">@T("Plugins.Misc.AuctionPlugin.Admin.AssignToAuctionButton")</button>
|
<button id="assignAuctionButton" class="btn btn-primary mt-2">@T("Plugins.Misc.AuctionPlugin.Admin.AssignToAuctionButton")</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
// var bidPrice = $("#bidPrice").val()toFixed(2);
|
// var bidPrice = $("#bidPrice").val()toFixed(2);
|
||||||
var bidPrice = $("#bidPrice").val();
|
var bidPrice = $("#bidPrice").val();
|
||||||
var auctionId = $("#auctionDropdown").val();
|
var auctionId = $("#auctionDropdown").val();
|
||||||
|
var sortIndex = $("#sortIndex").val();
|
||||||
if (!auctionId) {
|
if (!auctionId) {
|
||||||
alert("Please select an auction.");
|
alert("Please select an auction.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -45,7 +45,8 @@
|
||||||
ProductId: productId,
|
ProductId: productId,
|
||||||
StartingPrice: startingPrice,
|
StartingPrice: startingPrice,
|
||||||
BidPrice: bidPrice,
|
BidPrice: bidPrice,
|
||||||
AuctionId: auctionId
|
AuctionId: auctionId,
|
||||||
|
SortIndex: sortIndex
|
||||||
|
|
||||||
};
|
};
|
||||||
addAntiForgeryToken(postData);
|
addAntiForgeryToken(postData);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
Layout = "_AdminLayout";
|
Layout = "_AdminLayout";
|
||||||
//page title
|
//page title
|
||||||
Model.PageTitle = "Auctions page";
|
Model.PageTitle = "Auctions page";
|
||||||
|
Model.StartDateUtc = DateTime.UtcNow;
|
||||||
|
Model.EndDateUtc = DateTime.UtcNow.AddDays(3);
|
||||||
ViewBag.Title = Model.PageTitle;
|
ViewBag.Title = Model.PageTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,93 +37,80 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-3" style="text-align:center;">
|
<div class="col-xs-12" style="text-align:center;">
|
||||||
|
|
||||||
@Html.LabelFor(model => model.AuctionName)
|
@Html.LabelFor(model => model.AuctionName)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-xs-12">
|
||||||
|
|
||||||
@Html.EditorFor(model => model.AuctionName)
|
@Html.EditorFor(model => model.AuctionName, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-1">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-3" style="text-align:center;">
|
<div class="col-xs-12" style="text-align:center;">
|
||||||
|
|
||||||
@Html.LabelFor(model => model.AuctionType)
|
@Html.LabelFor(model => model.AuctionType)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-xs-12">
|
||||||
|
|
||||||
@Html.EditorFor(model => model.AuctionType)
|
@Html.EditorFor(model => model.AuctionType, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-1">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-3" style="text-align:center;">
|
<div class="col-xs-12" style="text-align:center;">
|
||||||
|
|
||||||
@Html.LabelFor(model => model.StartDateUtc)
|
@Html.LabelFor(model => model.StartDateUtc)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-xs-12">
|
||||||
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
||||||
@Html.EditorFor(model => model.StartDateUtc)
|
@Html.EditorFor(model => model.StartDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-3" style="text-align:center;">
|
<div class="col-xs-12" style="text-align:center;">
|
||||||
|
|
||||||
@Html.LabelFor(model => model.EndDateUtc)
|
@Html.LabelFor(model => model.EndDateUtc)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-xs-12">
|
||||||
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
||||||
@Html.EditorFor(model => model.EndDateUtc)
|
@Html.EditorFor(model => model.EndDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-3" style="text-align:center;">
|
<div class="col-xs-12" style="text-align:center;">
|
||||||
|
|
||||||
@Html.LabelFor(model => model.CategoryId)
|
@Html.LabelFor(model => model.CategoryId)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-xs-12">
|
||||||
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
||||||
@Html.EditorFor(model => model.CategoryId)
|
@Html.EditorFor(model => model.CategoryId, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-3" style="text-align:center;">
|
<div class="col-xs-12" style="text-align:center;">
|
||||||
|
|
||||||
@Html.LabelFor(model => model.Closed)
|
@Html.LabelFor(model => model.Closed)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-xs-12">
|
||||||
|
|
||||||
@Html.EditorFor(model => model.Closed)
|
@Html.EditorFor(model => model.Closed, new { HtmlAttributes = new { @class = "" } })
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-1">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,16 @@
|
||||||
{
|
{
|
||||||
Title = "Starts",
|
Title = "Starts",
|
||||||
Width = "300"
|
Width = "300"
|
||||||
|
},
|
||||||
|
new ColumnProperty(nameof(Auction.EndDateUtc))
|
||||||
|
{
|
||||||
|
Title = "Ends",
|
||||||
|
Width = "300"
|
||||||
},
|
},
|
||||||
new ColumnProperty(nameof(Auction.Closed))
|
new ColumnProperty(nameof(Auction.Closed))
|
||||||
{
|
{
|
||||||
Title = "Closed",
|
Title = "Closed",
|
||||||
Width = "300"
|
Width = "100"
|
||||||
},
|
},
|
||||||
new ColumnProperty(nameof(Auction.Id)) // Assuming Auction.Id exists
|
new ColumnProperty(nameof(Auction.Id)) // Assuming Auction.Id exists
|
||||||
{
|
{
|
||||||
|
|
@ -80,12 +85,16 @@
|
||||||
<label>Name</label>
|
<label>Name</label>
|
||||||
<input name="AuctionName" class="form-control" />
|
<input name="AuctionName" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Category Id</label>
|
||||||
|
<input name="CategoryId" class="form-control" />
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Starts</label>
|
<label>Starts</label>
|
||||||
<input name="StartDateUtc" type="datetime-local" class="form-control" />
|
<input name="StartDateUtc" type="datetime-local" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Starts</label>
|
<label>Ends</label>
|
||||||
<input name="EndDateUtc" type="datetime-local" class="form-control" />
|
<input name="EndDateUtc" type="datetime-local" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
@ -113,6 +122,7 @@
|
||||||
// Fetch auction data via AJAX
|
// Fetch auction data via AJAX
|
||||||
$.get(`/Admin/AuctionPluginAdmin/GetAuctionById/${auctionId}`, function (data) {
|
$.get(`/Admin/AuctionPluginAdmin/GetAuctionById/${auctionId}`, function (data) {
|
||||||
$('#editAuctionModal input[name="Id"]').val(data.id);
|
$('#editAuctionModal input[name="Id"]').val(data.id);
|
||||||
|
$('#editAuctionModal input[name="CategoryId"]').val(data.categoryId);
|
||||||
$('#editAuctionModal input[name="AuctionName"]').val(data.auctionName);
|
$('#editAuctionModal input[name="AuctionName"]').val(data.auctionName);
|
||||||
$('#editAuctionModal input[name="StartDateUtc"]').val(data.startDateUtc);
|
$('#editAuctionModal input[name="StartDateUtc"]').val(data.startDateUtc);
|
||||||
$('#editAuctionModal input[name="EndDateUtc"]').val(data.endDateUtc);
|
$('#editAuctionModal input[name="EndDateUtc"]').val(data.endDateUtc);
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin
|
||||||
|
|
||||||
liveAnnouncementPluginNode.ChildNodes.Add(new SiteMapNode()
|
liveAnnouncementPluginNode.ChildNodes.Add(new SiteMapNode()
|
||||||
{
|
{
|
||||||
Title = await _localizationService.GetResourceAsync("Plugins.Configure"),
|
Title = await _localizationService.GetResourceAsync("Admin.Auction.Configure"),
|
||||||
Visible = true,
|
Visible = true,
|
||||||
IconClass = "fa-dot-circle-o",
|
IconClass = "fa-dot-circle-o",
|
||||||
Url = "~/Admin/AuctionPlugin/Configure"
|
Url = "~/Admin/AuctionPlugin/Configure"
|
||||||
|
|
|
||||||
|
|
@ -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
|
//now we are refreshing any widget that has this ptaId
|
||||||
|
|
||||||
var auctionDto = bidNotification.auctionDto;
|
var auctionDto = bidNotification.auctionDto;
|
||||||
var productToAuction = auctionDto.productToAuctionDtos[0];
|
|
||||||
/*var productAuctionMappingId = ptaId;*/
|
/*var productAuctionMappingId = ptaId;*/
|
||||||
var winnerId = productToAuction.winnerCustomerId;
|
var winnerId = thisPta.winnerCustomerId;
|
||||||
var isMyBid;
|
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;
|
var currency = window.WorkingCurrency;
|
||||||
console.log(currency);
|
console.log(currency);
|
||||||
|
|
||||||
|
|
@ -66,6 +70,12 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
|
||||||
var licitStepElement = document.getElementById("licitStepText" + ptaId);
|
var licitStepElement = document.getElementById("licitStepText" + ptaId);
|
||||||
var bidBox = document.getElementById("publicProductBidBox" + ptaId);
|
var bidBox = document.getElementById("publicProductBidBox" + ptaId);
|
||||||
var bidBoxTitle = document.getElementById("bidBoxTitle" + 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);
|
console.log(bidNotification);
|
||||||
|
|
||||||
if (winnerId == window.CustomerId) {
|
if (winnerId == window.CustomerId) {
|
||||||
|
|
@ -76,7 +86,7 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
|
||||||
console.log("ProductToAuctionId: " + ptaId);
|
console.log("ProductToAuctionId: " + ptaId);
|
||||||
|
|
||||||
//TODO: TESZT STATUS!!! - JTEST.
|
//TODO: TESZT STATUS!!! - JTEST.
|
||||||
var status = productToAuction.auctionStatus;
|
var status = thisPta.auctionStatus;
|
||||||
//var status = AuctionStatus.TEST;
|
//var status = AuctionStatus.TEST;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -88,32 +98,57 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
|
||||||
if (widgetPriceElement || widgetPriceElementInList) {
|
if (widgetPriceElement || widgetPriceElementInList) {
|
||||||
|
|
||||||
if (widgetPriceElement) {
|
if (widgetPriceElement) {
|
||||||
|
console.log("PRICE: " + bidNotification.currentPrice);
|
||||||
/*if (productAuctionMappingId == ptaId) {*/
|
/*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") {
|
if (currency.CurrencyCode == "EUR") {
|
||||||
|
console.log("EUR");
|
||||||
widgetPriceElement.textContent = EURFormatter.format(bidNotification.currentPrice * window.WorkingCurrency.Rate); // Update the price
|
widgetPriceElement.textContent = EURFormatter.format(bidNotification.currentPrice * window.WorkingCurrency.Rate); // Update the price
|
||||||
//licitStepElement.textContent = EURFormatter.format(bidNotification.nextStepAmount * window.WorkingCurrency.Rate);
|
//licitStepElement.textContent = EURFormatter.format(bidNotification.nextStepAmount * window.WorkingCurrency.Rate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
widgetPriceElement.textContent = HUFFormatter.format(bidNotification.currentPrice); // Update the price
|
widgetPriceElement.textContent = HUFFormatter.format(bidNotification.currentPrice); // Update the price
|
||||||
|
//widgetPriceElement.setAttribute("id", "hugrabug");
|
||||||
//licitStepElement.textContent = HUFFormatter.format(bidNotification.nextStepAmount);
|
//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) {*/
|
/*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") {
|
if (currency.CurrencyCode == "EUR") {
|
||||||
|
console.log("EUR");
|
||||||
//widgetPriceElement.textContent = EURFormatter.format(bidNotification.currentPrice * window.WorkingCurrency.Rate); // Update the price
|
//widgetPriceElement.textContent = EURFormatter.format(bidNotification.currentPrice * window.WorkingCurrency.Rate); // Update the price
|
||||||
licitStepElement.textContent = EURFormatter.format(bidNotification.nextStepAmount * window.WorkingCurrency.Rate);
|
licitStepElement.textContent = EURFormatter.format(bidNotification.nextStepAmount * window.WorkingCurrency.Rate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log("HUF");
|
||||||
//widgetPriceElement.textContent = HUFFormatter.format(bidNotification.currentPrice); // Update the price
|
//widgetPriceElement.textContent = HUFFormatter.format(bidNotification.currentPrice); // Update the price
|
||||||
licitStepElement.textContent = HUFFormatter.format(bidNotification.nextStepAmount);
|
licitStepElement.textContent = HUFFormatter.format(bidNotification.nextStepAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
storedBidPricePlaceholder.value = Number(bidNotification.nextBidPrice);
|
storedBidPricePlaceholder.value = Number(bidNotification.nextBidPrice);
|
||||||
setBidButtonDisabled(bidButtonElement, !productToAuction.isActiveItem, updateBidButtonDisabledState);
|
setBidButtonDisabled(bidButtonElement, !thisPta.isActiveItem, updateBidButtonDisabledState);
|
||||||
|
|
||||||
var list;
|
var list;
|
||||||
if (isMyBid) {
|
if (isMyBid) {
|
||||||
|
|
@ -123,11 +158,11 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
|
||||||
list.remove("bg-primary");
|
list.remove("bg-primary");
|
||||||
|
|
||||||
bidButtonElement.textContent = window.LocalizationStrings.GoodJob;
|
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) {
|
if (window.IsAdmin) {
|
||||||
console.log("I AM WEASEL!!! " + window.IsAdmin);
|
console.log("I AM WEASEL!!! " + window.IsAdmin);
|
||||||
setBidButtonDisabled(bidButtonElement, !productToAuction.isActiveItem, updateBidButtonDisabledState);
|
setBidButtonDisabled(bidButtonElement, !thisPta.isActiveItem, updateBidButtonDisabledState);
|
||||||
} else {
|
} else {
|
||||||
console.log("I AM NOT WEASEL!!! " + window.IsAdmin);
|
console.log("I AM NOT WEASEL!!! " + window.IsAdmin);
|
||||||
setBidButtonDisabled(bidButtonElement, true, updateBidButtonDisabledState);
|
setBidButtonDisabled(bidButtonElement, true, updateBidButtonDisabledState);
|
||||||
|
|
@ -136,18 +171,18 @@ window.refreshPublicBidBox = function (bidNotification, updateBidButtonDisabledS
|
||||||
list = bidBox.classList;
|
list = bidBox.classList;
|
||||||
list.add("bg-primary");
|
list.add("bg-primary");
|
||||||
list.remove("bg-success");
|
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") {
|
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);
|
//bidButtonElement.textContent = EURFormatter.format(storedBidPricePlaceholder.value);
|
||||||
} else {
|
} 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.textContent = HUFFormatter.format(storedBidPricePlaceholder.value);
|
||||||
}
|
}
|
||||||
bidButtonElement.disabled = false;
|
bidButtonElement.disabled = false;
|
||||||
}
|
}
|
||||||
|
//console.log(widgetPriceElement.textContent);
|
||||||
console.log(`WidgetPrice updated to: ${bidNotification.currentPrice}`);
|
console.log(`WidgetPrice updated to: ${bidNotification.currentPrice}`);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,19 @@
|
||||||
console.log(bidNotification);
|
console.log(bidNotification);
|
||||||
|
|
||||||
var auctionDto = bidNotification.auctionDto;
|
var auctionDto = bidNotification.auctionDto;
|
||||||
var productToAuctionDto = auctionDto.productToAuctionDtos[0];
|
|
||||||
|
var productToAuctionList = auctionDto.productToAuctionDtos;
|
||||||
|
|
||||||
|
productToAuctionList.forEach(productToAuction => {
|
||||||
|
|
||||||
|
/*var productToAuctionDto = auctionDto.productToAuctionDtos[0];*/
|
||||||
|
|
||||||
//var productAuctionMappingId = productToAuctionDto.id;
|
//var productAuctionMappingId = productToAuctionDto.id;
|
||||||
//console.log(productAuctionMappingId);
|
//console.log(productAuctionMappingId);
|
||||||
|
|
||||||
var publicProductBidBox = document.getElementById("publicProductBidBox" + productToAuctionDto.id);
|
var publicProductBidBox = document.getElementById("publicProductBidBox" + productToAuction.id);
|
||||||
var liveScreen = document.getElementById("auctionProductLiveScreenBox");
|
var liveScreen = document.getElementById("auctionProductLiveScreenBox");
|
||||||
var publicInfo = document.getElementById("publicInfoOverlay" + productToAuctionDto.productId);
|
var publicInfo = document.getElementById("publicInfoOverlay" + productToAuction.productId);
|
||||||
|
|
||||||
if (publicProductBidBox) {
|
if (publicProductBidBox) {
|
||||||
//var audio = new Audio('../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
|
//var audio = new Audio('../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
|
||||||
|
|
@ -53,10 +58,10 @@
|
||||||
|
|
||||||
console.log("isMyRequest: " + isMyRequest + "; lastRequestId: " + lastRequestId + "; messageWrapper.RequestId: " + messageWrapper.requestId);
|
console.log("isMyRequest: " + isMyRequest + "; lastRequestId: " + lastRequestId + "; messageWrapper.RequestId: " + messageWrapper.requestId);
|
||||||
|
|
||||||
refreshPublicBidBox(bidNotification, isMyRequest, productToAuctionDto.id);
|
refreshPublicBidBox(bidNotification, isMyRequest, productToAuction.id, productToAuction);
|
||||||
}
|
}
|
||||||
if (publicInfo) {
|
if (publicInfo) {
|
||||||
var functionName = "refreshPublicInfo" + productToAuctionDto.productId;
|
var functionName = "refreshPublicInfo" + productToAuction.productId;
|
||||||
window[functionName](auctionDto);
|
window[functionName](auctionDto);
|
||||||
}
|
}
|
||||||
if (liveScreen) {
|
if (liveScreen) {
|
||||||
|
|
@ -85,6 +90,10 @@
|
||||||
});
|
});
|
||||||
$('.toast-success').css("background-color", "#4caf50");
|
$('.toast-success').css("background-color", "#4caf50");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
ProductToAuctionStatusNotification: function(messageWrapper) {
|
ProductToAuctionStatusNotification: function(messageWrapper) {
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
||||||
public bool IsWinner { get; set; }
|
public bool IsWinner { get; set; }
|
||||||
public decimal BidPrice { get; set; }
|
public decimal BidPrice { get; set; }
|
||||||
|
|
||||||
public int AuctionId { get; set; }
|
|
||||||
|
|
||||||
[SkipValuesOnUpdate]
|
[SkipValuesOnUpdate]
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
||||||
public string StartingPrice { get; set; }
|
public string StartingPrice { get; set; }
|
||||||
public string BidPrice { get; set; }
|
public string BidPrice { get; set; }
|
||||||
public string AuctionId { get; set; }
|
public string AuctionId { get; set; }
|
||||||
|
public int SortIndex { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -636,7 +636,7 @@ public class AuctionService(
|
||||||
=> ctx.GetProductToAuctionByAuctionIdAndProductIdAsync(auctionId, productId, activeProductOnly);
|
=> ctx.GetProductToAuctionByAuctionIdAndProductIdAsync(auctionId, productId, activeProductOnly);
|
||||||
|
|
||||||
|
|
||||||
public async Task<ProductToAuctionMapping> AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId)
|
public async Task<ProductToAuctionMapping> AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId, int sortIndex)
|
||||||
{
|
{
|
||||||
var auction = await GetAuctionDtoByIdAsync(auctionId, false, false);
|
var auction = await GetAuctionDtoByIdAsync(auctionId, false, false);
|
||||||
if (auction == null)
|
if (auction == null)
|
||||||
|
|
@ -652,6 +652,7 @@ public class AuctionService(
|
||||||
StartingPrice = startingPrice,
|
StartingPrice = startingPrice,
|
||||||
CurrentPrice = bidPrice,
|
CurrentPrice = bidPrice,
|
||||||
ProductAmount = 1,
|
ProductAmount = 1,
|
||||||
|
SortIndex = sortIndex,
|
||||||
AuctionStatus = AuctionStatus.None,
|
AuctionStatus = AuctionStatus.None,
|
||||||
AuctionId = auctionId
|
AuctionId = auctionId
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public interface IAuctionService
|
||||||
|
|
||||||
Task<AuctionBidDto> GetAuctionBidDtoByIdAsync(int auctionBidId);
|
Task<AuctionBidDto> GetAuctionBidDtoByIdAsync(int auctionBidId);
|
||||||
|
|
||||||
Task<ProductToAuctionMapping> AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId);
|
Task<ProductToAuctionMapping> AssignProductToAuctionAsync(int productId, decimal startingPrice, decimal bidPrice, int auctionId, int sortIndex);
|
||||||
Task<List<ProductToAuctionMapping>> GetProductToAuctionsByProductIdAsync(int productId);
|
Task<List<ProductToAuctionMapping>> GetProductToAuctionsByProductIdAsync(int productId);
|
||||||
|
|
||||||
Task<List<ProductToAuctionMapping>> GetProductToAuctionByAuctionIdAndProductIdAsync(int auctionId, int productId, bool activeProductOnly);
|
Task<List<ProductToAuctionMapping>> GetProductToAuctionByAuctionIdAndProductIdAsync(int auctionId, int productId, bool activeProductOnly);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
{
|
{
|
||||||
<div class="row py-3">
|
<div class="row py-3">
|
||||||
<!-- Item Image -->
|
<!-- Item Image -->
|
||||||
<div class="col-lg-4 col-md-6 mb-4" style="height: calc(100vh - 300px);">
|
<div class="col-lg-3 col-md-4 mb-4" style="height: calc(100vh - 300px);">
|
||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<img src="@Model.ActiveProductDetails.DefaultPictureModel.FullSizeImageUrl" class="card-img-top img-fluid" alt="Auction Item Image">
|
<img src="@Model.ActiveProductDetails.DefaultPictureModel.FullSizeImageUrl" class="card-img-top img-fluid" alt="Auction Item Image">
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Item Details -->
|
<!-- Item Details -->
|
||||||
<div class="col-lg-8 col-md-6" style="height: calc(100vh - 300px);">
|
<div class="col-lg-9 col-md-8" style="height: calc(100vh - 300px);">
|
||||||
<div class="card border-0 bg-transparent h-100">
|
<div class="card border-0 bg-transparent h-100">
|
||||||
<div class="card-header border-0 bg-transparent">
|
<div class="card-header border-0 bg-transparent">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -107,8 +107,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="height:300px;">
|
<div class="row" style="height:300px;">
|
||||||
<div class="col-12 text-center">
|
<div class="col-3 text-center">
|
||||||
<img style="height: 250px; !important" src="../../Plugins/Misc.AuctionPlugin/Content/Images/logo.png" class="img-fluid rounded mx-auto p-5 d-block" />
|
<img src="../../Plugins/Misc.AuctionPlugin/Content/Images/logo.png" class="img-fluid rounded mx-auto p-5 d-block" />
|
||||||
|
</div>
|
||||||
|
<div class="col-9 text-center">
|
||||||
|
@await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.ProductBoxAddinfoAfter, additionalData = Model.ActiveProductDetails })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
<script asp-location="Footer">
|
<script asp-location="Footer">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
let currencyCode = @Html.Raw(Model.WorkingCurrencyCode.ToJson());
|
let currencyCode = @Html.Raw(Model.WorkingCurrencyCode.ToJson());
|
||||||
let currencyRate = @Html.Raw(Model.WorkingCurrencyRate.ToJson());
|
let currencyRate = @Html.Raw(Model.WorkingCurrencyRate.ToJson());
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4 id="bidBoxTitle@(Model.ProductToAuctionId)">@title</h4>
|
<h4 id="bidBoxTitle@(Model.ProductToAuctionId)">@title</h4>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="row justify-content-between">
|
||||||
<div class="m-auto">
|
@*<div class="col-xs-12 col-md-6 col-lg-4">
|
||||||
<strong>Base Price:</strong>
|
<strong>Base Price:</strong>
|
||||||
@{
|
@{
|
||||||
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
||||||
|
|
@ -97,8 +97,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>*@
|
||||||
<div class="m-auto">
|
<div class="col-xs-12 col-md-6 col-lg-4">
|
||||||
<strong>Bid Step:</strong>
|
<strong>Bid Step:</strong>
|
||||||
@{
|
@{
|
||||||
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
||||||
|
|
@ -114,7 +114,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="m-auto">
|
<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)>
|
<button id="signalRBidButton@(Model.ProductToAuctionId)" class="btn btn-success float-end" style="text-transform: uppercase;" type="button" @(!bidButtonActive ? "disabled" : string.Empty)>
|
||||||
@{
|
@{
|
||||||
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
||||||
|
|
@ -227,8 +227,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
function setOnClicks(ptaId, viewModel) {
|
function setOnClicks(ptaId, viewModel) {
|
||||||
|
|
||||||
console.log("Setting onclick methods");
|
console.log("Setting onclick methods");
|
||||||
$("#signalRBidButton" + ptaId).on("click", function () {
|
$("#signalRBidButton" + ptaId).on("click", function () {
|
||||||
|
event.preventDefault();
|
||||||
var storedBidPrice = document.getElementById("bidPriceContainer" + ptaId).value;
|
var storedBidPrice = document.getElementById("bidPriceContainer" + ptaId).value;
|
||||||
sendBidMessage(ptaId,
|
sendBidMessage(ptaId,
|
||||||
viewModel.AuctionId,
|
viewModel.AuctionId,
|
||||||
|
|
@ -249,7 +251,7 @@
|
||||||
$("#signalRCloseItemButton" + ptaId).on("click", function () {
|
$("#signalRCloseItemButton" + ptaId).on("click", function () {
|
||||||
|
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
/*event.preventDefault();*/
|
event.preventDefault();
|
||||||
|
|
||||||
sendAuctionStatusChange(ptaId, AuctionStatus.Sold);
|
sendAuctionStatusChange(ptaId, AuctionStatus.Sold);
|
||||||
|
|
||||||
|
|
@ -258,7 +260,7 @@
|
||||||
$("#signalRFirstWarningButton" + ptaId).on("click", function () {
|
$("#signalRFirstWarningButton" + ptaId).on("click", function () {
|
||||||
|
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
//event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
sendAuctionStatusChange(ptaId, AuctionStatus.FirstWarning);
|
sendAuctionStatusChange(ptaId, AuctionStatus.FirstWarning);
|
||||||
|
|
||||||
|
|
@ -267,7 +269,7 @@
|
||||||
$("#signalRSecondWarningButton" + ptaId).on("click", function () {
|
$("#signalRSecondWarningButton" + ptaId).on("click", function () {
|
||||||
|
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
//event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
sendAuctionStatusChange(ptaId, AuctionStatus.SecondWarning);
|
sendAuctionStatusChange(ptaId, AuctionStatus.SecondWarning);
|
||||||
|
|
||||||
|
|
@ -276,7 +278,7 @@
|
||||||
$("#signalRPauseItemButton" + ptaId).on("click", function () {
|
$("#signalRPauseItemButton" + ptaId).on("click", function () {
|
||||||
|
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
//event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
sendAuctionStatusChange(ptaId, AuctionStatus.Pause);
|
sendAuctionStatusChange(ptaId, AuctionStatus.Pause);
|
||||||
|
|
||||||
|
|
@ -285,7 +287,7 @@
|
||||||
$("#signalRRevertBidButton" + ptaId).on("click", function () {
|
$("#signalRRevertBidButton" + ptaId).on("click", function () {
|
||||||
|
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
//event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (!bidBoxPageViewModel) {
|
if (!bidBoxPageViewModel) {
|
||||||
console.log("we need viewmodel data");
|
console.log("we need viewmodel data");
|
||||||
|
|
@ -305,7 +307,7 @@
|
||||||
$("#signalRResetItemButton" + ptaId).on("click", function () {
|
$("#signalRResetItemButton" + ptaId).on("click", function () {
|
||||||
|
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
//event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
sendAuctionStatusChange(AuctionStatus.None);
|
sendAuctionStatusChange(AuctionStatus.None);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,4 @@
|
||||||
@using Nop.Plugin.Misc.AuctionPlugin.Models
|
@using Nop.Plugin.Misc.AuctionPlugin.Models
|
||||||
@using Nop.Plugin.Misc.AuctionPlugin.Services
|
@using Nop.Plugin.Misc.AuctionPlugin.Services
|
||||||
@using Nop.Core.Domain.Directory;
|
@using Nop.Core.Domain.Directory;
|
||||||
|
@using Nop.Web.Components
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue