diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml index 92adda0..88cc570 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml @@ -12,951 +12,951 @@ @using static Nop.Services.Common.NopLinksDefaults @{ - //page title - ViewBag.PageTitle = T("Admin.Orders").Text; - //active menu item (system name) - NopHtml.SetActiveMenuItemSystemName("Orders"); + //page title + ViewBag.PageTitle = T("Admin.Orders").Text; + //active menu item (system name) + NopHtml.SetActiveMenuItemSystemName("Orders"); } @{ - const string hideSearchBlockAttributeName = "OrdersPage.HideSearchBlock"; - var hideSearchBlock = await genericAttributeService.GetAttributeAsync(await workContext.GetCurrentCustomerAsync(), hideSearchBlockAttributeName); + const string hideSearchBlockAttributeName = "OrdersPage.HideSearchBlock"; + var hideSearchBlock = await genericAttributeService.GetAttributeAsync(await workContext.GetCurrentCustomerAsync(), hideSearchBlockAttributeName); } @if (Model.LicenseCheckModel.BlockPages != true) { -
-
-

- @T("Admin.Orders") -

-
- -
- - - -
- -
- - - -
- @await Component.InvokeAsync(typeof(AdminWidgetViewComponent), new { widgetZone = AdminWidgetZones.OrderListButtons, additionalData = Model }) -
-
- -
-
-
-
- + $('#search-product-clear').show(); + return false; + } + }); -
- -
- + //remove button + $('#search-product-clear').click(function() { + $('#@Html.IdFor(model => model.ProductId)').val('0'); + $('#search-product-friendly-name').text(''); + $('#search-product-clear').hide(); + return false; + }); + }); + +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ @if (Model.BillingPhoneEnabled) + { +
+
+ +
+
+ +
+
+ } +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+ + + + +
+
+
+
+
+
+
+ +
+
+
+ + - @{ - var gridModel = new DataTablesModel - { - Name = "orders-grid", - UrlRead = new DataUrl("OrderList", "CustomOrder", null), - SearchButtonId = "search-orders", - Length = Model.PageSize, - LengthMenu = Model.AvailablePageSizes, - FooterCallback = !Model.IsLoggedInAsVendor ? "ordersfootercallback" : null, - FooterColumns = !Model.IsLoggedInAsVendor ? 10 : 0, - Filters = new List - { - new FilterParameter(nameof(Model.StartDate), typeof(DateTime?)), - new FilterParameter(nameof(Model.EndDate), typeof(DateTime?)), - new FilterParameter(nameof(Model.OrderStatusIds)), - new FilterParameter(nameof(Model.PaymentStatusIds)), - new FilterParameter(nameof(Model.ShippingStatusIds)), - new FilterParameter(nameof(Model.StoreId)), - new FilterParameter(nameof(Model.VendorId)), - new FilterParameter(nameof(Model.WarehouseId)), - new FilterParameter(nameof(Model.BillingEmail)), - new FilterParameter(nameof(Model.BillingPhone)), - new FilterParameter(nameof(Model.BillingLastName)), - new FilterParameter(nameof(Model.BillingCountryId)), - new FilterParameter(nameof(Model.PaymentMethodSystemName)), - new FilterParameter(nameof(Model.ProductId)), - new FilterParameter(nameof(Model.OrderNotes)) - } - }; - gridModel.ColumnCollection = new List - { - new ColumnProperty(nameof(OrderModel.Id)) - { - IsMasterCheckBox = true, - Render = new RenderCheckBox("checkbox_orders"), - ClassName = NopColumnClassDefaults.CenterAll, - Width = "50" - }, - new ColumnProperty(nameof(OrderModel.CustomOrderNumber)) - { - Title = T("Admin.Orders.Fields.CustomOrderNumber").Text, - Width = "80" - } - }; - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModelExtended.IsMeasured)) - { - Title = T("Admin.Orders.Fields.IsMeasured").Text, - Width = "100", - Render = new RenderCustom("renderColumnIsMeasurable"), - ClassName = NopColumnClassDefaults.CenterAll - }); - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(IOrderDto.DateOfReceipt)) - { - Title = T("Admin.Orders.Fields.PickupDate").Text, - Width = "100", - Render = new RenderCustom("renderColumnPickupDateAndTime"), - ClassName = NopColumnClassDefaults.CenterAll - }); +
- //a vendor does not have access to this functionality - if (!Model.IsLoggedInAsVendor) - { - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.OrderStatus)) - { - Title = T("Admin.Orders.Fields.OrderStatus").Text, - Width = "100", - Render = new RenderCustom("renderColumnOrderStatus") - }); - } - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.PaymentStatus)) - { - Title = T("Admin.Orders.Fields.PaymentStatus").Text, - Width = "150" - }); - //a vendor does not have access to this functionality - if (!Model.IsLoggedInAsVendor) - { - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.ShippingStatus)) - { - Title = T("Admin.Orders.Fields.ShippingStatus").Text, - Width = "150" - }); - } - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.CustomerEmail)) - { - Title = T("Admin.Orders.Fields.Customer").Text, - Render = new RenderCustom("renderColumnCustomer") - }); - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.StoreName)) - { - Title = T("Admin.Orders.Fields.Store").Text, - Width = "100", - Visible = (await storeService.GetAllStoresAsync()).Count > 1 - }); - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.CreatedOn)) - { - Title = T("Admin.Orders.Fields.CreatedOn").Text, - Width = "120", - Render = new RenderDate() - }); - //a vendor does not have access to this functionality - if (!Model.IsLoggedInAsVendor) - { - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.OrderTotal)) - { - Title = T("Admin.Orders.Fields.OrderTotal").Text, - Width = "100", - }); - } - gridModel.ColumnCollection.Add(new ColumnProperty(nameof(OrderModel.Id)) - { - Title = T("Admin.Common.View").Text, - Width = "50", - ClassName = NopColumnClassDefaults.Button, - Render = new RenderButtonView(new DataUrl("~/Admin/Order/Edit")) - }); - var orderSummaryColumnNumber = 8; - } - @await Html.PartialAsync("Table", gridModel) +
+ - -
-
- - - -
-
+ return `${formatted}`; + } + + $(function() { + $("#@Html.IdFor(model => model.GoDirectlyToCustomOrderNumber)").keydown( + function(event) { + if (event.keyCode === 13) { + $("#go-to-order-by-number").trigger("click"); + return false; + } + }); + }); + function ordersfootercallback(tfoot, data, start, end, display) { + //update order totals summary + var postData = { + StartDate: $('#@Html.IdFor(model => model.StartDate)').val(), + EndDate: $('#@Html.IdFor(model => model.EndDate)').val(), + OrderStatusIds: $('#@Html.IdFor(model => model.OrderStatusIds)').val(), + PaymentStatusIds: $('#@Html.IdFor(model => model.PaymentStatusIds)').val(), + ShippingStatusIds: $('#@Html.IdFor(model => model.ShippingStatusIds)').val(), + StoreId: $('#@Html.IdFor(model => model.StoreId)').val(), + VendorId: $('#@Html.IdFor(model => model.VendorId)').val(), + WarehouseId: $('#@Html.IdFor(model => model.WarehouseId)').val(), + BillingEmail: $('#@Html.IdFor(model => model.BillingEmail)').val(), + BillingPhone: $('#@Html.IdFor(model => model.BillingPhone)').val(), + BillingLastName: $('#@Html.IdFor(model => model.BillingLastName)').val(), + BillingCountryId: $('#@Html.IdFor(model => model.BillingCountryId)').val(), + PaymentMethodSystemName: $('#@Html.IdFor(model => model.PaymentMethodSystemName)').val(), + ProductId: $('#@Html.IdFor(model => model.ProductId)').val(), + OrderNotes: $('#@Html.IdFor(model => model.OrderNotes)').val() + }; + addAntiForgeryToken(postData); + + $.ajax({ + cache: false, + type: "POST", + url: "@(Url.Action("ReportAggregates", "Order"))", + data: postData, + success: function (data, textStatus, jqXHR) { + if (data) { + for (var key in data) { + var reportSummary = '
@T("Admin.Orders.Report.Summary").Text
' + + '
@T("Admin.Orders.Report.Profit").Text ' + data['AggregatorProfit'] +'
' + + '
@T("Admin.Orders.Report.Shipping").Text ' + data['AggregatorShipping'] + '
' + + '
@T("Admin.Orders.Report.Tax").Text ' + data['AggregatorTax'] + '
' + + '
@T("Admin.Orders.Report.Total").Text ' + data['AggregatorTotal'] + '
' + var orderTotalsColumn = $('#orders-grid').DataTable().column(@(orderSummaryColumnNumber)); + $(orderTotalsColumn.footer()).html(reportSummary); + } + } + } + }); + } + + + + + + + + } @*export selected (XML). We don't use GET approach because it's limited to 2K-4K chars and won't work for large number of entities*@
- +
@*export selected (Excel). We don't use GET approach because it's limited to 2K-4K chars and won't work for large number of entities*@
- +
@*Print packaging slips selected (XML). We don't use GET approach because it's limited to 2K-4K chars and won't work for large number of entities*@
- +
@*import orders form*@ @*create new order form*@ \ No newline at end of file diff --git a/Nop.Plugin.Misc.AIPlugin/Factories/CustomOrderModelFactory.cs b/Nop.Plugin.Misc.AIPlugin/Factories/CustomOrderModelFactory.cs index 844463e..50b956b 100644 --- a/Nop.Plugin.Misc.AIPlugin/Factories/CustomOrderModelFactory.cs +++ b/Nop.Plugin.Misc.AIPlugin/Factories/CustomOrderModelFactory.cs @@ -171,6 +171,8 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Factories orderModelExtended.IsMeasurable = orderDto.IsMeasurable; orderModelExtended.DateOfReceipt = orderDto.DateOfReceipt; + orderModelExtended.CustomerCompany = orderDto.Customer.Company; + //orderModelExtended.IsMeasurable = await ShouldMarkAsNeedsMeasurementAsync(orderModel); //orderModelExtended.DateOfReceipt = await GetPickupDateTimeAsync(orderModel); diff --git a/Nop.Plugin.Misc.AIPlugin/Models/Orders/IOrderModelExtended.cs b/Nop.Plugin.Misc.AIPlugin/Models/Orders/IOrderModelExtended.cs index 69e803f..612e6ae 100644 --- a/Nop.Plugin.Misc.AIPlugin/Models/Orders/IOrderModelExtended.cs +++ b/Nop.Plugin.Misc.AIPlugin/Models/Orders/IOrderModelExtended.cs @@ -5,5 +5,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Models.Orders; public interface IOrderModelExtended : IMgOrderModelExtended, IMeasurable, IMeasured { - public DateTime? DateOfReceipt { get; set; } + DateTime? DateOfReceipt { get; set; } + string CustomerCompany { get; set; } } \ No newline at end of file diff --git a/Nop.Plugin.Misc.AIPlugin/Models/Orders/OrderModelExtended.cs b/Nop.Plugin.Misc.AIPlugin/Models/Orders/OrderModelExtended.cs index dabbceb..205b251 100644 --- a/Nop.Plugin.Misc.AIPlugin/Models/Orders/OrderModelExtended.cs +++ b/Nop.Plugin.Misc.AIPlugin/Models/Orders/OrderModelExtended.cs @@ -7,6 +7,8 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Models.Orders public bool IsMeasured { get; set; } public bool IsMeasurable { get; set; } public DateTime? DateOfReceipt { get; set; } - } + + public string CustomerCompany { get; set; } + } }