Compare commits

..

No commits in common. "7f8347d0ade2326e6a592bb9c9388046ea4720ed" and "7851e8a8eef40e847e7332efd832b6c070ceda52" have entirely different histories.

7 changed files with 31 additions and 53 deletions

View File

@ -92,7 +92,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Controllers
model.Body = singleAnnouncement.Body; model.Body = singleAnnouncement.Body;
model.IsActive = singleAnnouncement.IsActive; model.IsActive = singleAnnouncement.IsActive;
return View("~/Plugins/Misc.AuctionPlugin/Areas/Admin/Views/Announcement.cshtml", model); return View("~/Plugins/Widget.LiveAnnouncement/Views/LiveAnnouncementView/Announcement.cshtml", model);
} }
@ -107,7 +107,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Controllers
public IActionResult AnnouncementList() public IActionResult AnnouncementList()
{ {
var model = new AnnouncementViewModel(); var model = new AnnouncementViewModel();
return View("~/Plugins/Misc.AuctionPlugin/Areas/Admin/Views/AnnouncementList.cshtml", model); return View("~/Plugins/Misc.Auction/Areas/Admin/Views/AnnouncementList.cshtml", model);
} }
//[HttpPost] //[HttpPost]

View File

@ -10,7 +10,7 @@ public static class AuctionDefaults
/// <summary> /// <summary>
/// Gets the system name /// Gets the system name
/// </summary> /// </summary>
public static string SystemName => "AuctionPlugin"; public static string SystemName => "Misc.AuctionPlugin";
/// <summary> /// <summary>
/// Gets the user agent used to request third-party services /// Gets the user agent used to request third-party services

View File

@ -99,7 +99,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin
{ {
ArgumentNullException.ThrowIfNull(widgetZone); ArgumentNullException.ThrowIfNull(widgetZone);
if (widgetZone.Equals(PublicWidgetZones.ProductPriceTop)) if (widgetZone.Equals(PublicWidgetZones.ProductDetailsOverviewTop))
{ {
return typeof(AuctionPublicViewComponent); return typeof(AuctionPublicViewComponent);
} }
@ -116,11 +116,11 @@ namespace Nop.Plugin.Misc.AuctionPlugin
{ {
return Task.FromResult<IList<string>>(new List<string> return Task.FromResult<IList<string>>(new List<string>
{ {
PublicWidgetZones.ProductPriceTop, PublicWidgetZones.ProductDetailsOverviewTop,
PublicWidgetZones.ProductDetailsBottom, PublicWidgetZones.OrderSummaryBillingAddress,
//AdminWidgetZones.OrderBillingAddressDetailsBottom, AdminWidgetZones.OrderBillingAddressDetailsBottom,
//AdminWidgetZones.OrderShippingAddressDetailsBottom AdminWidgetZones.OrderShippingAddressDetailsBottom
}); });
} }

View File

@ -3,7 +3,6 @@ using Nop.Core;
using Nop.Plugin.Misc.AuctionPlugin; using Nop.Plugin.Misc.AuctionPlugin;
using Nop.Services.Cms; using Nop.Services.Cms;
using Nop.Services.Common; using Nop.Services.Common;
using Nop.Services.Logging;
using Nop.Web.Framework.Components; using Nop.Web.Framework.Components;
using Nop.Web.Framework.Infrastructure; using Nop.Web.Framework.Infrastructure;
using Nop.Web.Models.Catalog; using Nop.Web.Models.Catalog;
@ -21,7 +20,6 @@ public class AuctionPublicViewComponent : NopViewComponent
protected readonly IWidgetPluginManager _widgetPluginManager; protected readonly IWidgetPluginManager _widgetPluginManager;
protected readonly IWorkContext _workContext; protected readonly IWorkContext _workContext;
protected readonly AuctionSettings _auctionSettings; protected readonly AuctionSettings _auctionSettings;
protected readonly ILogger _logger;
#endregion #endregion
@ -31,15 +29,13 @@ public class AuctionPublicViewComponent : NopViewComponent
IGenericAttributeService genericAttributeService, IGenericAttributeService genericAttributeService,
IWidgetPluginManager widgetPluginManager, IWidgetPluginManager widgetPluginManager,
IWorkContext workContext, IWorkContext workContext,
AuctionSettings auctionSettings, AuctionSettings auctionSettings)
ILogger logger)
{ {
_addressService = addressService; _addressService = addressService;
_genericAttributeService = genericAttributeService; _genericAttributeService = genericAttributeService;
_widgetPluginManager = widgetPluginManager; _widgetPluginManager = widgetPluginManager;
_workContext = workContext; _workContext = workContext;
_auctionSettings = auctionSettings; _auctionSettings = auctionSettings;
_logger = logger;
} }
#endregion #endregion
@ -57,41 +53,25 @@ public class AuctionPublicViewComponent : NopViewComponent
/// </returns> /// </returns>
public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData) public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData)
{ {
await _logger.InformationAsync("WidgetViewComponent called");
//ensure that what3words widget is active and enabled //ensure that what3words widget is active and enabled
var customer = await _workContext.GetCurrentCustomerAsync(); var customer = await _workContext.GetCurrentCustomerAsync();
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);
await _logger.InformationAsync("WidgetViewComponent widget active"); if (!_auctionSettings.Enabled)
return Content(string.Empty);
//if (!_auctionSettings.Enabled)
// return Content(string.Empty);
var productDetailsModel = additionalData as ProductDetailsModel; var productDetailsModel = additionalData as ProductDetailsModel;
await _logger.InformationAsync($"WidgetViewComponent product: {productDetailsModel.Name}"); if (productDetailsModel is null)
//if (productDetailsModel is null)
//{
// await _logger.InformationAsync("WidgetViewComponent productdetailsmodel is null");
// return Content(string.Empty);
//}
if (!widgetZone.Equals(PublicWidgetZones.ProductPriceTop))
{
await _logger.InformationAsync($"WidgetViewComponent is NOT in ProductDetailsTop now {widgetZone}");
return Content(string.Empty); return Content(string.Empty);
}
await _logger.InformationAsync("WidgetViewComponent called II"); var productId = 0;
if (widgetZone.Equals(PublicWidgetZones.ProductDetailsTop))
productId = productDetailsModel.Id;
return View("~/Plugins/Misc.AuctionPlugin/Views/PublicProductBidBox.cshtml", productDetailsModel.Id.ToString()); return View("~/Plugins/Widgets.What3words/Views/PublicProductBidBox.cshtml", productId.ToString());
} }
#endregion #endregion

View File

@ -49,16 +49,16 @@ public class AuctionViewComponent : NopViewComponent
/// </returns> /// </returns>
public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData) public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData)
{ {
await _logger.InformationAsync("Auction widget called");
//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();
//if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName, customer)) if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName, customer))
// return Content(string.Empty); return Content(string.Empty);
//if (!_auctionSettings.Enabled) if (!_auctionSettings.Enabled)
// return Content(string.Empty); return Content(string.Empty);
if (string.IsNullOrEmpty(_auctionSettings.SomeText)) if (string.IsNullOrEmpty(_auctionSettings.SomeText))
{ {
@ -74,7 +74,7 @@ public class AuctionViewComponent : NopViewComponent
//} //}
var model = new AuctionPublicInfoModel(); var model = new AuctionPublicInfoModel();
if (widgetZone.Equals(PublicWidgetZones.ProductDetailsBottom)) if (!widgetZone.Equals(PublicWidgetZones.ProductDetailsTop))
{ {
model.Message = $"Auction plugin is active, setting = {_auctionSettings.SomeText}, productId = {((ProductDetailsModel)additionalData).Name}"; model.Message = $"Auction plugin is active, setting = {_auctionSettings.SomeText}, productId = {((ProductDetailsModel)additionalData).Name}";
@ -87,7 +87,7 @@ public class AuctionViewComponent : NopViewComponent
} }
return View("~/Plugins/Misc.AuctionPlugin/Views/PublicInfo.cshtml", model); return View("~/Plugins/Widgets.AuctionPlugin/Views/PublicInfo.cshtml", model);
} }

View File

@ -1,9 +1,8 @@
@model AuctionPublicInfoModel @model AuctionPublicInfoModel
<div class="bg-dark"> <div>
<h3>Auction viewcomponent</h3> <label for="w3w">@T("Plugins.Widgets.AuctionPLugin.Label"):</label>
<label for="w3w">@T("Plugins.Misc.AuctionPLugin.Label"):</label>
<div class=""> <div class="">
<p>General widget info: @Model.Message</p> <p>@Model.Message</p>
</div> </div>
</div> </div>

View File

@ -1,12 +1,11 @@
@model string @model string
<div class="bg-dark"> <li class="custom-value">
<h3>Auction Public Viewcomponent</h3>
<span class="label"> <span class="label">
@T("Plugins.Misc.AuctionPlugin.BidBox.Field.Label"): @T("Plugins.Misc.AuctionPlugin.BidBox.Field.Label"):
</span> </span>
<span class="value"> <span class="value">
@(Model) @(Model)
</span> </span>
</div> </li>