Compare commits
4 Commits
6de242f629
...
e6cfe35cc2
| Author | SHA1 | Date |
|---|---|---|
|
|
e6cfe35cc2 | |
|
|
da016005ed | |
|
|
1b6ad7e33d | |
|
|
59a530ea55 |
|
|
@ -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 = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,15 @@ public class AuctionPluginAdminController : BasePluginController
|
|||
[HttpPost]
|
||||
public async Task<IActionResult> GetAuctionViewModel(AuctionViewModel viewModel)
|
||||
{
|
||||
viewModel.AuctionDto = new Domains.Dtos.AuctionDto();
|
||||
viewModel.AuctionDto.AuctionName = viewModel.AuctionName;
|
||||
viewModel.AuctionDto.AuctionType = viewModel.AuctionType;
|
||||
viewModel.AuctionDto.Closed = viewModel.Closed;
|
||||
viewModel.AuctionDto.StartDateUtc = viewModel.StartDateUtc;
|
||||
viewModel.AuctionDto.EndDateUtc = viewModel.EndDateUtc;
|
||||
var objOfAuctionDomain = viewModel.AuctionDto.CreateMainEntity();
|
||||
|
||||
|
||||
await _auctionService.InsertAuctionAsync(objOfAuctionDomain);
|
||||
|
||||
//if (viewModel.IsActive == true)
|
||||
|
|
@ -171,8 +179,42 @@ 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.");
|
||||
}
|
||||
|
||||
public async Task<IActionResult> GetAuctionById(int id)
|
||||
{
|
||||
var auction = await _auctionService.GetAuctionByIdAsync(id);
|
||||
if (auction == null)
|
||||
return NotFound();
|
||||
|
||||
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]
|
||||
public async Task<IActionResult> SaveAuction(Auction auction)
|
||||
{
|
||||
var dbAuction = await _auctionService.GetAuctionByIdAsync(auction.Id);
|
||||
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(dbAuction);
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Models
|
|||
public string AuctionName { get; set; }
|
||||
public AuctionType AuctionType { get; set; }
|
||||
|
||||
public int? CategoryId { get; set; }
|
||||
|
||||
public DateTime StartDateUtc { get; set; }
|
||||
public DateTime? EndDateUtc { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,50 +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">
|
||||
|
||||
</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-xs-12">
|
||||
|
||||
@Html.EditorFor(model => model.AuctionType, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<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)
|
||||
@Html.EditorFor(model => model.StartDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-12" style="text-align:center;">
|
||||
|
||||
@Html.LabelFor(model => model.EndDateUtc)
|
||||
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
||||
@Html.EditorFor(model => model.EndDateUtc, new { HtmlAttributes = new { @class = "form-control text-box single-line" } })
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-12" style="text-align:center;">
|
||||
|
||||
@Html.LabelFor(model => model.CategoryId)
|
||||
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
@* <nop-editor asp-for="@Model.StartDateUtc" asp-template="DateTimePicker" /> *@
|
||||
@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">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<div class="content-header clearfix">
|
||||
<div class="pull-right">
|
||||
<a href="../GetAnnouncementViewModel" class="btn bg-blue">
|
||||
<a href="../AuctionPluginAdmin/GetAuctionViewModel" class="btn bg-blue">
|
||||
<i class="fa fa-floppy-o"></i>
|
||||
Add
|
||||
</a>
|
||||
|
|
@ -43,10 +43,21 @@
|
|||
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
|
||||
{
|
||||
Title = "Actions",
|
||||
Render = new RenderCustom("renderEditButton"),
|
||||
Width = "100"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -59,3 +70,75 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="editAuctionModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Edit Auction</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="editAuctionForm">
|
||||
<input type="hidden" name="Id" />
|
||||
<div class="form-group">
|
||||
<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>Ends</label>
|
||||
<input name="EndDateUtc" type="datetime-local" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Closed</label>
|
||||
<input name="Closed" type="checkbox" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="saveAuction()">Save</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function renderEditButton(data, type, row) {
|
||||
return `<button class="btn btn-primary btn-sm" onclick="openEditModal(${data})">
|
||||
<i class="fa fa-edit"></i> Edit
|
||||
</button>`;
|
||||
}
|
||||
|
||||
function openEditModal(auctionId) {
|
||||
// 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);
|
||||
$('#editAuctionModal input[name="Closed"]').prop('checked', data.closed);
|
||||
|
||||
$('#editAuctionModal').modal('show');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function saveAuction() {
|
||||
var formData = $('#editAuctionForm').serialize();
|
||||
console.log(formData);
|
||||
$.post('/Admin/AuctionPluginAdmin/SaveAuction', formData, function () {
|
||||
location.reload(); // Reload the grid after saving
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ public static class AuctionDefaults
|
|||
public static string AnnouncementListRouteName => "Plugin.Misc.AuctionPlugin.AnnouncementList";
|
||||
public static string AuctionRouteName => "Plugin.Misc.AuctionPlugin.Auction";
|
||||
public static string AuctionListRouteName => "Plugin.Misc.AuctionPlugin.AuctionList";
|
||||
public static string GetAuctionByIdRouteName => "Plugin.Misc.AuctionPlugin.GetAuctionById";
|
||||
public static string SaveAuctionRouteName => "Plugin.Misc.AuctionPlugin.SaveAuction";
|
||||
public static string TestPageRouteName => "Plugin.Misc.AuctionPlugin.TestPage";
|
||||
public static string BidNotificationRouteName => "Plugin.Misc.AuctionPlugin.BidNotification";
|
||||
public static string RefreshAuctionWidgetRouteName => "Plugin.Misc.AuctionPlugin.RefreshAuctionWidget";
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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}`);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class AuctionDto : IAuctionDto
|
|||
mainEntity.Id = Id;
|
||||
mainEntity.AuctionName = AuctionName;
|
||||
mainEntity.AuctionType = AuctionType;
|
||||
mainEntity.CategoryId = 0;
|
||||
mainEntity.StartDateUtc = StartDateUtc;
|
||||
mainEntity.EndDateUtc = EndDateUtc;
|
||||
mainEntity.Closed = Closed;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,14 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
|||
pattern: "Admin/AuctionPlugin/AuctionList",
|
||||
defaults: new { controller = "AuctionPluginAdmin", action = "AuctionList" });
|
||||
|
||||
endpointRouteBuilder.MapControllerRoute(name: AuctionDefaults.GetAuctionByIdRouteName,
|
||||
pattern: "Admin/AuctionPlugin/GetAuctionById/{auctionId}",
|
||||
defaults: new { controller = "AuctionPluginAdmin", action = "GetAuctionById" });
|
||||
|
||||
endpointRouteBuilder.MapControllerRoute(name: AuctionDefaults.SaveAuctionRouteName,
|
||||
pattern: "Admin/AuctionPlugin/SaveAuction",
|
||||
defaults: new { controller = "AuctionPluginAdmin", action = "SaveAuction" });
|
||||
|
||||
endpointRouteBuilder.MapControllerRoute(name: AuctionDefaults.TestPageRouteName,
|
||||
pattern: "Admin/Auction/TestPage",
|
||||
defaults: new { controller = "AuctionPluginAdmin", action = "TestPage" });
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue