ha enyém a bid akkor nem csilingel

This commit is contained in:
Adam 2024-11-30 20:41:25 +01:00
parent 8ef62db6fe
commit 7246d86e76
5 changed files with 23 additions and 9 deletions

View File

@ -46,8 +46,8 @@
if (publicProductBidBox)
{
var audio = new Audio('../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
audio.play();
//var audio = new Audio('../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
//audio.play();
refreshPublicBidBox(myObject);
}
if (publicInfo) {
@ -56,8 +56,7 @@
}
if (liveScreen)
{
var audio = new Audio('../../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
audio.play();
updateOnBid(myObject);
}
else {

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Nop.Core;
using Nop.Core.Domain.Catalog;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
using Nop.Plugin.Misc.AuctionPlugin.Models;
@ -10,7 +11,7 @@ using Nop.Web.Models.Catalog;
namespace Nop.Plugin.Misc.AuctionPlugin.Controllers;
public class AuctionController(AuctionService auctionService, ILogger logger, IProductService productService, MyProductModelFactory productModelFactory)
public class AuctionController(AuctionService auctionService, ILogger logger, IProductService productService, MyProductModelFactory productModelFactory, IWorkContext _workContext)
: BasePluginController
{
// GET
@ -60,7 +61,8 @@ public class AuctionController(AuctionService auctionService, ILogger logger, IP
var auctionDto = await auctionService.GetAuctionDtoWithAuctionBids(auctionId, true, 5); //A javascript-ben az első 6-ot vágod le, melyik a valid? - J.
var activeMapping = auctionDto?.ProductToAuctionDtos.MinBy(x => x.SortIndex);
var isAnyItemLive = activeMapping != null;
if (auctionDto == null)
var myUser = await _workContext.GetCurrentCustomerAsync();
if (auctionDto == null || myUser == null)
{
return new RedirectResult("/", false);
}
@ -109,7 +111,7 @@ public class AuctionController(AuctionService auctionService, ILogger logger, IP
model.LicitStep = nextStep;
model.BasePrice = basePrice;
model.CurrentPrice = currentPrice;
model.UserCustomerId = myUser.Id;
return View("~/Plugins/Misc.AuctionPlugin/Views/LiveScreen.cshtml", model);

View File

@ -25,6 +25,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
public decimal LicitStep { get; set; }
public decimal? CurrentPrice { get; set; }
public int UserCustomerId { get; set; }

View File

@ -132,7 +132,7 @@
var liveScreenPageViewModel = @Html.Raw(Json.Serialize(Model));
console.log("ViewModel:", liveScreenPageViewModel);
let myUserId = liveScreenPageViewModel.UserCustomerId;
// Extract and preprocess table data
var tableData = liveScreenPageViewModel.CurrentProductToAuction.AuctionBidDtos
.slice(0, 6) // Get the first 6 elements
@ -186,6 +186,10 @@
let auctionDto = data.auctionDto;
let productToAuction = auctionDto.productToAuctionDtos[0];
var liveScreenPageViewModel = @Html.Raw(Json.Serialize(Model));
console.log("ViewModel:", liveScreenPageViewModel);
let myUserId = liveScreenPageViewModel.UserCustomerId;
var liveScreenLicitStep = document.getElementById("liveScreenLicitStep");
if(liveScreenLicitStep) {
liveScreenLicitStep.textContent = data.nextStepAmount;
@ -194,6 +198,12 @@
if (liveScreenCurrentPrice) {
liveScreenCurrentPrice.textContent= HUFFormatter.format(productToAuction.currentPrice);
}
if (myUserId != productToAuction.winnerCustomerId) {
//ding
console.log(myUserId + ", " + productToAuction.winnerCustomerId);
var audio = new Audio('../../Plugins/Misc.AuctionPlugin/Content/ding.mp3');
audio.play();
}
console.log(productToAuction);
var table = document.getElementById("bidHistoryTable");
var row = table.insertRow(1);

View File

@ -58,7 +58,9 @@
</div>
<div id="publicProductBidBox" class="p-3 @bgClass text-white">
<strong>#@(Model.AuctionDto.ProductToAuctionDtos.FirstOrDefault().SortIndex)</strong>
<div class="col-3"><strong>#@(Model.AuctionDto.ProductToAuctionDtos.FirstOrDefault().SortIndex)</strong></div>
<div class="col-9"><a href="https://youtube.com/live/6yfnmyQE7Uw?feature=share">Youtube live</a></div>
<h4 id="bidBoxTitle">@title</h4>
<div class="d-flex justify-content-between">
<div class="m-auto">