currency convert and format
This commit is contained in:
parent
7246d86e76
commit
919e5e699f
|
|
@ -13,6 +13,8 @@ using Nop.Web.Framework.Infrastructure;
|
||||||
using Nop.Web.Models.Catalog;
|
using Nop.Web.Models.Catalog;
|
||||||
using Nop.Web.Framework.Mvc.Routing;
|
using Nop.Web.Framework.Mvc.Routing;
|
||||||
using Nop.Services.Catalog;
|
using Nop.Services.Catalog;
|
||||||
|
using Nop.Web.Framework;
|
||||||
|
using Nop.Services.Directory;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Components;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Components;
|
||||||
|
|
||||||
|
|
@ -24,6 +26,8 @@ public class AuctionPublicViewComponent : NopViewComponent
|
||||||
//private readonly IGenericAttributeService _genericAttributeService;
|
//private readonly IGenericAttributeService _genericAttributeService;
|
||||||
private readonly IWidgetPluginManager _widgetPluginManager;
|
private readonly IWidgetPluginManager _widgetPluginManager;
|
||||||
private readonly IWorkContext _workContext;
|
private readonly IWorkContext _workContext;
|
||||||
|
private readonly IStoreContext _storeContext;
|
||||||
|
private readonly ICurrencyService _currencyService;
|
||||||
private readonly AuctionService _auctionService;
|
private readonly AuctionService _auctionService;
|
||||||
//private readonly AuctionSettings _auctionSettings;
|
//private readonly AuctionSettings _auctionSettings;
|
||||||
private readonly ICustomerService _customerService;
|
private readonly ICustomerService _customerService;
|
||||||
|
|
@ -41,6 +45,8 @@ public class AuctionPublicViewComponent : NopViewComponent
|
||||||
//IGenericAttributeService genericAttributeService,
|
//IGenericAttributeService genericAttributeService,
|
||||||
IWidgetPluginManager widgetPluginManager,
|
IWidgetPluginManager widgetPluginManager,
|
||||||
IWorkContext workContext,
|
IWorkContext workContext,
|
||||||
|
IStoreContext storeContext,
|
||||||
|
ICurrencyService currencyService,
|
||||||
AuctionService auctionService,
|
AuctionService auctionService,
|
||||||
//AuctionSettings auctionSettings,
|
//AuctionSettings auctionSettings,
|
||||||
ICustomerService customerService,
|
ICustomerService customerService,
|
||||||
|
|
@ -53,6 +59,8 @@ public class AuctionPublicViewComponent : NopViewComponent
|
||||||
//_genericAttributeService = genericAttributeService;
|
//_genericAttributeService = genericAttributeService;
|
||||||
_widgetPluginManager = widgetPluginManager;
|
_widgetPluginManager = widgetPluginManager;
|
||||||
_workContext = workContext;
|
_workContext = workContext;
|
||||||
|
_storeContext = storeContext;
|
||||||
|
_currencyService = currencyService;
|
||||||
_auctionService = auctionService;
|
_auctionService = auctionService;
|
||||||
//_auctionSettings = auctionSettings;
|
//_auctionSettings = auctionSettings;
|
||||||
_customerService = customerService;
|
_customerService = customerService;
|
||||||
|
|
@ -83,7 +91,11 @@ public class AuctionPublicViewComponent : NopViewComponent
|
||||||
|
|
||||||
//ensure that widget is active and enabled
|
//ensure that widget is active and enabled
|
||||||
var customer = await _workContext.GetCurrentCustomerAsync();
|
var customer = await _workContext.GetCurrentCustomerAsync();
|
||||||
await _logger.InformationAsync($"WidgetViewComponent customer: {customer.Email}");
|
var currency = await _workContext.GetWorkingCurrencyAsync();
|
||||||
|
var store = await _storeContext.GetCurrentStoreAsync();
|
||||||
|
//var allCurrencies = await _currencyService.GetAllCurrenciesAsync();
|
||||||
|
//var baseCurrency = allCurrencies.Where(x => x.Rate == 1);
|
||||||
|
await _logger.InformationAsync($"WidgetViewComponent customer: {customer.Email}");
|
||||||
|
|
||||||
if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName, customer))
|
if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName, customer))
|
||||||
return Content(string.Empty);
|
return Content(string.Empty);
|
||||||
|
|
@ -185,11 +197,14 @@ public class AuctionPublicViewComponent : NopViewComponent
|
||||||
productBidBoxViewModel.AuctionClosed = auctionDto.Closed;
|
productBidBoxViewModel.AuctionClosed = auctionDto.Closed;
|
||||||
productBidBoxViewModel.AuctionStatus = status;
|
productBidBoxViewModel.AuctionStatus = status;
|
||||||
productBidBoxViewModel.WidgetZone = widgetZone;
|
productBidBoxViewModel.WidgetZone = widgetZone;
|
||||||
|
//comes in WORKINGCURRENCY
|
||||||
productBidBoxViewModel.BasePrice = productDetailsModel.ProductPrice.OldPriceValue;
|
productBidBoxViewModel.BasePrice = productDetailsModel.ProductPrice.OldPriceValue;
|
||||||
productBidBoxViewModel.CurrentPrice = productDetailsModel.ProductPrice.PriceValue;
|
//comes in WORKINGCURRENCY
|
||||||
|
productBidBoxViewModel.CurrentPrice = productDetailsModel.ProductPrice.PriceValue;
|
||||||
//productBidBoxViewModel.ProductToAuctionId = productToAuctionId.FirstOrDefault().Id;
|
//productBidBoxViewModel.ProductToAuctionId = productToAuctionId.FirstOrDefault().Id;
|
||||||
//productBidBoxViewModel.AuctionId = auctionId;
|
//productBidBoxViewModel.AuctionId = auctionId;
|
||||||
productBidBoxViewModel.CustomerId = customer.Id;
|
productBidBoxViewModel.CustomerId = customer.Id;
|
||||||
|
productBidBoxViewModel.WorkingCurrency = currency;
|
||||||
productBidBoxViewModel.ProductId = productDetailsModel.Id;
|
productBidBoxViewModel.ProductId = productDetailsModel.Id;
|
||||||
//productBidBoxViewModel.NextProductUrl = Url.RouteUrl("Product", productDetailsModel.SeName);
|
//productBidBoxViewModel.NextProductUrl = Url.RouteUrl("Product", productDetailsModel.SeName);
|
||||||
productBidBoxViewModel.NextProductUrl = nextUrl;
|
productBidBoxViewModel.NextProductUrl = nextUrl;
|
||||||
|
|
@ -198,8 +213,31 @@ public class AuctionPublicViewComponent : NopViewComponent
|
||||||
productBidBoxViewModel.NextProductImageUrl = nextImageUrl;
|
productBidBoxViewModel.NextProductImageUrl = nextImageUrl;
|
||||||
productBidBoxViewModel.LastProductName = lastProductName;
|
productBidBoxViewModel.LastProductName = lastProductName;
|
||||||
productBidBoxViewModel.NextProductName = nextProductName;
|
productBidBoxViewModel.NextProductName = nextProductName;
|
||||||
|
//comes in HUF
|
||||||
productBidBoxViewModel.LicitStep = AuctionService.GetStepAmount(productToAuction.CurrentPrice); //add calculation
|
productBidBoxViewModel.LicitStep = AuctionService.GetStepAmount(productToAuction.CurrentPrice); //add calculation
|
||||||
|
//comes IN HUF
|
||||||
|
productBidBoxViewModel.LicitStepInWorkingCurrency = AuctionService.GetStepAmount(productToAuction.CurrentPrice) * currency.Rate;
|
||||||
|
//comes in HUF
|
||||||
productBidBoxViewModel.NextBidPrice = AuctionService.GetNextBidPrice(productToAuction.CurrentPrice, productBidBoxViewModel.LicitStep);
|
productBidBoxViewModel.NextBidPrice = AuctionService.GetNextBidPrice(productToAuction.CurrentPrice, productBidBoxViewModel.LicitStep);
|
||||||
|
productBidBoxViewModel.NextBidPriceInWorkingCurrency = productBidBoxViewModel.NextBidPrice * currency.Rate;
|
||||||
|
if(productBidBoxViewModel.BasePrice != null)
|
||||||
|
{
|
||||||
|
//comes in WORKINGCURRENCY
|
||||||
|
|
||||||
|
|
||||||
|
productBidBoxViewModel.BasePriceInWorkingCurrency = productBidBoxViewModel.BasePrice;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//basprice null, we use the baseprice in PTA that comes in HUF
|
||||||
|
productBidBoxViewModel.BasePrice = productToAuction.StartingPrice * currency.Rate;
|
||||||
|
productBidBoxViewModel.BasePriceInWorkingCurrency = productBidBoxViewModel.BasePrice;
|
||||||
|
|
||||||
|
}
|
||||||
|
productBidBoxViewModel.CurrentPriceInWorkingCurrency = productBidBoxViewModel.CurrentPrice;
|
||||||
|
|
||||||
|
|
||||||
return View("~/Plugins/Misc.AuctionPlugin/Views/PublicProductBidBox.cshtml", productBidBoxViewModel);
|
return View("~/Plugins/Misc.AuctionPlugin/Views/PublicProductBidBox.cshtml", productBidBoxViewModel);
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class AuctionViewComponent : NopViewComponent
|
||||||
|
|
||||||
//ensure that a widget is active and enabled
|
//ensure that a widget is active and enabled
|
||||||
var customer = await _workContext.GetCurrentCustomerAsync();
|
var customer = await _workContext.GetCurrentCustomerAsync();
|
||||||
|
var currency = await _workContext.GetWorkingCurrencyAsync();
|
||||||
//if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName, customer))
|
//if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName, customer))
|
||||||
// return Content(string.Empty);
|
// return Content(string.Empty);
|
||||||
|
|
||||||
|
|
@ -98,7 +98,8 @@ public class AuctionViewComponent : NopViewComponent
|
||||||
auctionDto.ProductToAuctionDtos.AddRange(productToAuctionDtoMappings);
|
auctionDto.ProductToAuctionDtos.AddRange(productToAuctionDtoMappings);
|
||||||
|
|
||||||
var model = new AuctionPublicInfoModel(auctionDto);
|
var model = new AuctionPublicInfoModel(auctionDto);
|
||||||
|
model.WorkingCurrencyCode = currency.CurrencyCode;
|
||||||
|
model.WorkingCurrencyRate = currency.Rate;
|
||||||
//model.ProductToAuctionMappingId = productToAuctionMapping.Id;
|
//model.ProductToAuctionMappingId = productToAuctionMapping.Id;
|
||||||
//var auction = await _auctionService.GetAuctionDtoByProductToAuctionIdAsync(productToAuctionMapping.Id);
|
//var auction = await _auctionService.GetAuctionDtoByProductToAuctionIdAsync(productToAuctionMapping.Id);
|
||||||
//model.StartDate = auction.StartDateUtc;
|
//model.StartDate = auction.StartDateUtc;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
style: "currency",
|
style: "currency",
|
||||||
currency: "HUF",
|
currency: "HUF",
|
||||||
});
|
});
|
||||||
|
window.EURFormatter = new Intl.NumberFormat("eu-EU", {
|
||||||
|
style: "currency",
|
||||||
|
currency: "EUR",
|
||||||
|
});
|
||||||
|
|
||||||
// SignalR connection setup
|
// SignalR connection setup
|
||||||
var connection = new signalR.HubConnectionBuilder()
|
var connection = new signalR.HubConnectionBuilder()
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ using Nop.Plugin.Misc.AuctionPlugin.Hubs;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Services;
|
using Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||||
using Nop.Services.Catalog;
|
using Nop.Services.Catalog;
|
||||||
using Nop.Services.Configuration;
|
using Nop.Services.Configuration;
|
||||||
|
using Nop.Services.Directory;
|
||||||
using Nop.Services.Localization;
|
using Nop.Services.Localization;
|
||||||
using Nop.Services.Orders;
|
using Nop.Services.Orders;
|
||||||
using Nop.Web.Framework;
|
using Nop.Web.Framework;
|
||||||
|
|
@ -73,6 +74,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
||||||
services.AddScoped<IOrderProcessingService, OrderProcessingService>();
|
services.AddScoped<IOrderProcessingService, OrderProcessingService>();
|
||||||
services.AddScoped<IShoppingCartService, ShoppingCartService>();
|
services.AddScoped<IShoppingCartService, ShoppingCartService>();
|
||||||
services.AddScoped<IStoreContext, WebStoreContext>();
|
services.AddScoped<IStoreContext, WebStoreContext>();
|
||||||
|
services.AddScoped<ICurrencyService, CurrencyService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Nop.Core.Domain.Directory;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
||||||
using Nop.Web.Framework.Models;
|
using Nop.Web.Framework.Models;
|
||||||
|
|
||||||
|
|
@ -19,6 +20,9 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
||||||
public DateTime StartDate => AuctionDto?.StartDateUtc ?? DateTime.MinValue;
|
public DateTime StartDate => AuctionDto?.StartDateUtc ?? DateTime.MinValue;
|
||||||
public bool IsActive => FirstProductToAuction?.IsActiveItem ?? false;
|
public bool IsActive => FirstProductToAuction?.IsActiveItem ?? false;
|
||||||
|
|
||||||
|
public string WorkingCurrencyCode { get; set; }
|
||||||
|
public decimal WorkingCurrencyRate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public AuctionPublicInfoModel()
|
public AuctionPublicInfoModel()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using ExCSS;
|
using ExCSS;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Nop.Core.Domain.Directory;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||||
using Nop.Web.Framework.Models;
|
using Nop.Web.Framework.Models;
|
||||||
|
|
@ -41,12 +42,15 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
||||||
|
|
||||||
public int CustomerId { get; set; }
|
public int CustomerId { get; set; }
|
||||||
|
|
||||||
|
public Currency WorkingCurrency { get; set; }
|
||||||
|
|
||||||
public string WidgetZone { get; set; }
|
public string WidgetZone { get; set; }
|
||||||
|
|
||||||
|
|
||||||
#region debug fields to be removed
|
#region debug fields to be removed
|
||||||
|
|
||||||
public decimal? BasePrice { get; set; }
|
public decimal? BasePrice { get; set; }
|
||||||
|
public decimal? BasePriceInWorkingCurrency { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -55,6 +59,10 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Models
|
||||||
public decimal? CurrentPrice { get; set; }
|
public decimal? CurrentPrice { get; set; }
|
||||||
public decimal NextBidPrice { get; set; }
|
public decimal NextBidPrice { get; set; }
|
||||||
|
|
||||||
|
public decimal LicitStepInWorkingCurrency { get; set; }
|
||||||
|
public decimal? CurrentPriceInWorkingCurrency { get; set; }
|
||||||
|
public decimal NextBidPriceInWorkingCurrency { get; set; }
|
||||||
|
|
||||||
#endregion visible
|
#endregion visible
|
||||||
|
|
||||||
public ProductBidBoxViewModel() { }
|
public ProductBidBoxViewModel() { }
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,9 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="announcementPage">
|
<div class="announcementPage">
|
||||||
|
<style>
|
||||||
|
.old-product-price {
|
||||||
|
text-decoration: unset !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
|
|
||||||
|
|
||||||
<script asp-location="Footer">
|
<script asp-location="Footer">
|
||||||
|
|
||||||
|
let currencyCode = @Html.Raw(Model.WorkingCurrencyCode.ToJson());
|
||||||
|
let currencyRate = @Html.Raw(Model.WorkingCurrencyRate.ToJson());
|
||||||
|
console.log(currencyCode);
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
console.log("PublicInfo ready enter; ProductId: " + @Model.ProductId);
|
console.log("PublicInfo ready enter; ProductId: " + @Model.ProductId);
|
||||||
|
|
@ -45,7 +50,13 @@
|
||||||
//console.log("widgetPriceElements:", widgetPriceElements);
|
//console.log("widgetPriceElements:", widgetPriceElements);
|
||||||
|
|
||||||
if (widgetPriceElements && widgetPriceElements.length > 0) {
|
if (widgetPriceElements && widgetPriceElements.length > 0) {
|
||||||
widgetPriceElements[0].textContent = HUFFormatter.format(productToAuctionDto.currentPrice); // Update the price
|
if(currencyCode == "EUR") {
|
||||||
|
widgetPriceElements[0].textContent = EURFormatter.format(productToAuctionDto.currentPrice * currencyRate);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
widgetPriceElements[0].textContent = HUFFormatter.format(productToAuctionDto.currentPrice); // Update the price
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let myDate = auctionDto.startDateUtc;
|
let myDate = auctionDto.startDateUtc;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,29 @@
|
||||||
@using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums
|
@using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums
|
||||||
@using Nop.Web.Framework.TagHelpers.Shared
|
@using Nop.Web.Framework.TagHelpers.Shared
|
||||||
|
@using System.Globalization
|
||||||
@model ProductBidBoxViewModel
|
@model ProductBidBoxViewModel
|
||||||
@* @inject IJsonHelper JsonHelper; *@
|
@* @inject IJsonHelper JsonHelper; *@
|
||||||
|
|
||||||
@* @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(myObj) as String) *@
|
@* @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(myObj) as String) *@
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.old-product-price {
|
||||||
|
text-decoration: unset !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
if (!Model.IsGuest)
|
if (!Model.IsGuest)
|
||||||
{
|
{
|
||||||
if (Model.FirstProductToAuction != null)
|
if (Model.FirstProductToAuction != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var bgClass = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "bg-success" : "bg-primary";
|
var bgClass = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId ? "bg-success" : "bg-primary";
|
||||||
var bidButtonActive = Model.IsItemActive && (Model.FirstProductToAuction.WinnerCustomerId != Model.CustomerId || Model.IsAdmin);
|
var bidButtonActive = Model.IsItemActive && (Model.FirstProductToAuction.WinnerCustomerId != Model.CustomerId || Model.IsAdmin);
|
||||||
var auctionStatus = Model.FirstProductToAuction.AuctionStatus;
|
var auctionStatus = Model.FirstProductToAuction.AuctionStatus;
|
||||||
var lastBidIsMine = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId;
|
var lastBidIsMine = Model.FirstProductToAuction.WinnerCustomerId == Model.CustomerId;
|
||||||
|
|
||||||
|
|
||||||
var title = auctionStatus switch
|
var title = auctionStatus switch
|
||||||
{
|
{
|
||||||
AuctionStatus.Sold => lastBidIsMine ? @T("Plugins.Misc.AuctionPlugin.YouWin") : @T("Plugins.Misc.AuctionPlugin.Sold"),
|
AuctionStatus.Sold => lastBidIsMine ? @T("Plugins.Misc.AuctionPlugin.YouWin") : @T("Plugins.Misc.AuctionPlugin.Sold"),
|
||||||
|
|
@ -58,25 +66,65 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="publicProductBidBox" class="p-3 @bgClass text-white">
|
<div id="publicProductBidBox" class="p-3 @bgClass text-white">
|
||||||
<div class="col-3"><strong>#@(Model.AuctionDto.ProductToAuctionDtos.FirstOrDefault().SortIndex)</strong></div>
|
<div class="row">
|
||||||
<div class="col-9"><a href="https://youtube.com/live/6yfnmyQE7Uw?feature=share">Youtube live</a></div>
|
<div class="col-3"><strong>#@(Model.AuctionDto.ProductToAuctionDtos.FirstOrDefault().SortIndex)</strong></div>
|
||||||
|
<div class="col-9"><a target="_blank" class="btn btn-secondary btn-sm float-end" href="https://youtube.com/live/6yfnmyQE7Uw?feature=share"><i class="fa-brands fa-youtube"></i> Youtube live</a></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h4 id="bidBoxTitle">@title</h4>
|
<h4 id="bidBoxTitle">@title</h4>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="m-auto">
|
<div class="m-auto">
|
||||||
<strong>Base Price:</strong>
|
<strong>Base Price:</strong>
|
||||||
<span class="value">
|
@{
|
||||||
@($"{Model.BasePrice:c}")
|
if(Model.WorkingCurrency.CurrencyCode == "EUR")
|
||||||
@* @(decimal?.Round(Model.BasePrice, 2, MidpointRounding.AwayFromZero)) *@
|
{
|
||||||
</span>
|
|
||||||
|
<span class="value">@($"{((decimal)Model.BasePriceInWorkingCurrency).ToString("C", new CultureInfo("de-DE"))}")</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="value">@($"{((decimal)Model.BasePrice).ToString("C", new CultureInfo("hu-HU"))}")</span>
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="m-auto">
|
<div class="m-auto">
|
||||||
<strong>Bid Step:</strong>
|
<strong>Bid Step:</strong>
|
||||||
<span id="licitStepText" class="value">@($"{Model.LicitStep:c}")</span>
|
@{
|
||||||
|
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
||||||
|
{
|
||||||
|
<span id="licitStepText" class="value">@($"{Model.LicitStepInWorkingCurrency.ToString("C", new CultureInfo("de-DE"))}")</span>
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// <span id="licitStepText" class="value">@($"{Model.LicitStep:c}")</span>
|
||||||
|
<span id="licitStepText" class="value">@($"{Model.LicitStep.ToString("C", new CultureInfo("hu-HU"))}")</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="m-auto">
|
<div class="m-auto">
|
||||||
<button id="signalRBidButton" class="btn btn-success" style="text-transform: uppercase;" type="button" @(!bidButtonActive ? "disabled" : string.Empty)>
|
<button id="signalRBidButton" class="btn btn-success float-end" style="text-transform: uppercase;" type="button" @(!bidButtonActive ? "disabled" : string.Empty)>
|
||||||
@T("Plugins.Misc.AuctionPlugin.BidButtonPrefix") @($"{Model.NextBidPrice:c}")
|
@{
|
||||||
|
if (Model.WorkingCurrency.CurrencyCode == "EUR")
|
||||||
|
{
|
||||||
|
@T("Plugins.Misc.AuctionPlugin.BidButtonPrefix") @($"{Model.NextBidPriceInWorkingCurrency.ToString("C", new CultureInfo("de-DE"))}")
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// <span id="licitStepText" class="value">@($"{Model.LicitStep:c}")</span>
|
||||||
|
|
||||||
|
@T("Plugins.Misc.AuctionPlugin.BidButtonPrefix") @($"{Model.NextBidPrice.ToString("C", new CultureInfo("hu-HU"))}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
@* <button id="bidButton" class="btn btn-success">
|
@* <button id="bidButton" class="btn btn-success">
|
||||||
|
|
||||||
|
|
@ -300,6 +348,8 @@
|
||||||
// data.AuctionDto.
|
// data.AuctionDto.
|
||||||
// }
|
// }
|
||||||
var widgetPriceElement = document.getElementById("price-value-" + bidBoxPageViewModel.ProductId);
|
var widgetPriceElement = document.getElementById("price-value-" + bidBoxPageViewModel.ProductId);
|
||||||
|
var currency = bidBoxPageViewModel.WorkingCurrency;
|
||||||
|
console.log(currency);
|
||||||
var bidButtonElement = document.getElementById("signalRBidButton");
|
var bidButtonElement = document.getElementById("signalRBidButton");
|
||||||
var licitStepElement = document.getElementById("licitStepText");
|
var licitStepElement = document.getElementById("licitStepText");
|
||||||
var bidBox = document.getElementById("publicProductBidBox");
|
var bidBox = document.getElementById("publicProductBidBox");
|
||||||
|
|
@ -335,9 +385,14 @@
|
||||||
|
|
||||||
if (productAuctionMappingId == bidBoxPageViewModel.ProductToAuctionId) {
|
if (productAuctionMappingId == bidBoxPageViewModel.ProductToAuctionId) {
|
||||||
console.log("THIS IS FOR US! SORRY FOR SHOUTING");
|
console.log("THIS IS FOR US! SORRY FOR SHOUTING");
|
||||||
|
if(bidBoxPageViewModel.WorkingCurrency.CurrencyCode == "EUR") {
|
||||||
widgetPriceElement.textContent = HUFFormatter.format(data.currentPrice); // Update the price
|
widgetPriceElement.textContent = EURFormatter.format(data.currentPrice * bidBoxPageViewModel.WorkingCurrency.Rate); // Update the price
|
||||||
licitStepElement.textContent = HUFFormatter.format(data.nextStepAmount);
|
licitStepElement.textContent = EURFormatter.format(data.nextStepAmount * bidBoxPageViewModel.WorkingCurrency.Rate);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
widgetPriceElement.textContent = HUFFormatter.format(data.currentPrice); // Update the price
|
||||||
|
licitStepElement.textContent = HUFFormatter.format(data.nextStepAmount);
|
||||||
|
}
|
||||||
bidBoxPageViewModel.NextBidPrice = Number(data.nextBidPrice);
|
bidBoxPageViewModel.NextBidPrice = Number(data.nextBidPrice);
|
||||||
bidButtonElement.disabled = false;
|
bidButtonElement.disabled = false;
|
||||||
var list;
|
var list;
|
||||||
|
|
@ -362,7 +417,14 @@
|
||||||
list.add("bg-primary");
|
list.add("bg-primary");
|
||||||
list.remove("bg-success");
|
list.remove("bg-success");
|
||||||
bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? "@(T("Plugins.Misc.AuctionPlugin.Sold"))" : "@(T("Plugins.Misc.AuctionPlugin.PlaceABid"))";
|
bidBoxTitle.textContent = productToAuction.auctionStatus == AuctionStatus.Sold ? "@(T("Plugins.Misc.AuctionPlugin.Sold"))" : "@(T("Plugins.Misc.AuctionPlugin.PlaceABid"))";
|
||||||
bidButtonElement.textContent = "@(T("Plugins.Misc.AuctionPlugin.BidButtonPrefix")) " + HUFFormatter.format(bidBoxPageViewModel.NextBidPrice);
|
if(bidBoxPageViewModel.WorkingCurrency.CurrencyCode == "EUR") {
|
||||||
|
bidButtonElement.textContent = "@(T("Plugins.Misc.AuctionPlugin.BidButtonPrefix")) " + EURFormatter.format(bidBoxPageViewModel.NextBidPriceInWorkingCurrency);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bidButtonElement.textContent = "@(T("Plugins.Misc.AuctionPlugin.BidButtonPrefix")) " + HUFFormatter.format(bidBoxPageViewModel.NextBidPrice);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,3 +27,4 @@
|
||||||
@using Nop.Plugin.Misc.AuctionPlugin
|
@using Nop.Plugin.Misc.AuctionPlugin
|
||||||
@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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue