Bidbox heneralizations, livescreen bidbox, refractoring, minor improvements (reset auction button not working!!!)

This commit is contained in:
Adam 2025-01-05 14:23:43 +01:00
parent 1b6ad7e33d
commit da016005ed
17 changed files with 183 additions and 128 deletions

View File

@ -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 = [];

View File

@ -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();
}

View File

@ -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; }
}
}

View File

@ -16,7 +16,7 @@
<option value="@auction.Id">@auction.AuctionName</option>
}
</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>
</div>
@ -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);

View File

@ -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 @@
<div class="panel-body">
<div class="row">
<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)
</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 class="col-md-1">
&nbsp;
</div>
</div>
<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)
</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 class="col-md-1">
&nbsp;
</div>
</div>
<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)
</div>
<div class="col-md-8">
<div class="col-xs-12">
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
@Html.EditorFor(model => model.StartDateUtc)
</div>
<div class="col-md-1">
&nbsp;
@Html.EditorFor(model => model.StartDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
</div>
</div>
<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)
</div>
<div class="col-md-8">
<div class="col-xs-12">
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
@Html.EditorFor(model => model.EndDateUtc)
</div>
<div class="col-md-1">
&nbsp;
@Html.EditorFor(model => model.EndDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
</div>
</div>
<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)
</div>
<div class="col-md-8">
<div class="col-xs-12">
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
@Html.EditorFor(model => model.CategoryId)
</div>
<div class="col-md-1">
&nbsp;
@Html.EditorFor(model => model.CategoryId, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
</div>
</div>
<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)
</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 class="col-md-1">
&nbsp;
</div>
</div>
</div>
</div>

View File

@ -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 @@
<label>Name</label>
<input name="AuctionName" class="form-control" />
</div>
<div class="form-group">
<label>Category Id</label>
<input name="CategoryId" class="form-control" />
</div>
<div class="form-group">
<label>Starts</label>
<input name="StartDateUtc" type="datetime-local" class="form-control" />
</div>
<div class="form-group">
<label>Starts</label>
<label>Ends</label>
<input name="EndDateUtc" type="datetime-local" class="form-control" />
</div>
<div class="form-group">
@ -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);

View File

@ -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"

View File

@ -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}`);

View File

@ -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(
`<div class="item bidToast"><p>${bidNotification.currentPrice}</p><p>${bidNotification.productName
}</p></div>`,
"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(
`<div class="item bidToast"><p>${bidNotification.currentPrice}</p><p>${bidNotification.productName
}</p></div>`,
"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) {

View File

@ -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; }

View File

@ -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; }
}
}

View File

@ -636,7 +636,7 @@ public class AuctionService(
=> 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);
if (auction == null)
@ -652,6 +652,7 @@ public class AuctionService(
StartingPrice = startingPrice,
CurrentPrice = bidPrice,
ProductAmount = 1,
SortIndex = sortIndex,
AuctionStatus = AuctionStatus.None,
AuctionId = auctionId
};

View File

@ -68,7 +68,7 @@ public interface IAuctionService
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>> GetProductToAuctionByAuctionIdAndProductIdAsync(int auctionId, int productId, bool activeProductOnly);

View File

@ -21,7 +21,7 @@
{
<div class="row py-3">
<!-- 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">
<img src="@Model.ActiveProductDetails.DefaultPictureModel.FullSizeImageUrl" class="card-img-top img-fluid" alt="Auction Item Image">
</div>
@ -46,7 +46,7 @@
</div>
</div>
<!-- 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-header border-0 bg-transparent">
<div class="row">
@ -105,10 +105,13 @@
</div>
</div>
</div>
<div class="row" style="height:300px;">
<div class="col-12 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" />
<div class="col-3 text-center">
<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>

View File

@ -5,8 +5,6 @@
<script asp-location="Footer">
$(document).ready(function () {
let currencyCode = @Html.Raw(Model.WorkingCurrencyCode.ToJson());
let currencyRate = @Html.Raw(Model.WorkingCurrencyRate.ToJson());

View File

@ -81,8 +81,8 @@
</div>
<h4 id="bidBoxTitle@(Model.ProductToAuctionId)">@title</h4>
<div class="d-flex justify-content-between">
<div class="m-auto">
<div class="row justify-content-between">
@*<div class="col-xs-12 col-md-6 col-lg-4">
<strong>Base Price:</strong>
@{
if (Model.WorkingCurrency.CurrencyCode == "EUR")
@ -97,8 +97,8 @@
}
}
</div>
<div class="m-auto">
</div>*@
<div class="col-xs-12 col-md-6 col-lg-4">
<strong>Bid Step:</strong>
@{
if (Model.WorkingCurrency.CurrencyCode == "EUR")
@ -114,7 +114,7 @@
}
</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)>
@{
if (Model.WorkingCurrency.CurrencyCode == "EUR")
@ -223,12 +223,14 @@
document.getElementById("bidPriceContainer" + bidBoxPageViewModel.ProductToAuctionId).value = bidBoxPageViewModel.NextBidPrice;
setOnClicks(bidBoxPageViewModel.ProductToAuctionId, bidBoxPageViewModel);
//var status = bidBoxPageViewModel.productToAuctionDto.auctionStatus;
//setButtons(status);
//setButtons(status);
});
function setOnClicks(ptaId, viewModel) {
console.log("Setting onclick methods");
$("#signalRBidButton" + ptaId).on("click", function () {
event.preventDefault();
var storedBidPrice = document.getElementById("bidPriceContainer" + ptaId).value;
sendBidMessage(ptaId,
viewModel.AuctionId,
@ -249,7 +251,7 @@
$("#signalRCloseItemButton" + ptaId).on("click", function () {
this.disabled = true;
/*event.preventDefault();*/
event.preventDefault();
sendAuctionStatusChange(ptaId, AuctionStatus.Sold);
@ -258,7 +260,7 @@
$("#signalRFirstWarningButton" + ptaId).on("click", function () {
this.disabled = true;
//event.preventDefault();
event.preventDefault();
sendAuctionStatusChange(ptaId, AuctionStatus.FirstWarning);
@ -267,7 +269,7 @@
$("#signalRSecondWarningButton" + ptaId).on("click", function () {
this.disabled = true;
//event.preventDefault();
event.preventDefault();
sendAuctionStatusChange(ptaId, AuctionStatus.SecondWarning);
@ -276,7 +278,7 @@
$("#signalRPauseItemButton" + ptaId).on("click", function () {
this.disabled = true;
//event.preventDefault();
event.preventDefault();
sendAuctionStatusChange(ptaId, AuctionStatus.Pause);
@ -285,7 +287,7 @@
$("#signalRRevertBidButton" + ptaId).on("click", function () {
this.disabled = true;
//event.preventDefault();
event.preventDefault();
if (!bidBoxPageViewModel) {
console.log("we need viewmodel data");
@ -305,7 +307,7 @@
$("#signalRResetItemButton" + ptaId).on("click", function () {
this.disabled = true;
//event.preventDefault();
event.preventDefault();
sendAuctionStatusChange(AuctionStatus.None);

View File

@ -28,3 +28,4 @@
@using Nop.Plugin.Misc.AuctionPlugin.Models
@using Nop.Plugin.Misc.AuctionPlugin.Services
@using Nop.Core.Domain.Directory;
@using Nop.Web.Components