From 61d3b2089c9b0c0a414e30092d360c1e4cc29fc6 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 11 Dec 2025 18:30:56 +0100 Subject: [PATCH] extra features, after publish, before upgrade --- .../Controllers/CustomOrderController.cs | 67 +++++++-- .../Admin/Views/Extras/VoiceRecorder.cshtml | 69 ++++++++- .../Order/_CustomOrderDetails.Products.cshtml | 4 +- .../Factories/CustomOrderModelFactory.cs | 1 + .../Models/Orders/OrderModelExtended.cs | 1 + .../Views/OrderAttributes.cshtml | 132 +++++++++++++++++- 6 files changed, 256 insertions(+), 18 deletions(-) diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs index b253e2a..91aaba9 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs @@ -765,6 +765,48 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers // }; //} + + /// + /// Add a note to an order that will be displayed in the external application + /// + [HttpPost] + public async Task AddOrderNote(int orderId, string note) + { + if (!await _permissionService.AuthorizeAsync(StandardPermission.Orders.ORDERS_CREATE_EDIT_DELETE)) + return Json(new { success = false, message = "Access denied" }); + + if (orderId <= 0) + { + return Json(new { success = false, message = "Invalid order ID" }); + } + + if (string.IsNullOrWhiteSpace(note)) + { + return Json(new { success = false, message = "Note text is required" }); + } + + try + { + // Create and insert the order note + await InsertOrderNoteAsync(orderId, displayToCustomer: false, note); + + return Json(new + { + success = true, + message = "Order note added successfully" + }); + } + catch (Exception ex) + { + return Json(new + { + success = false, + message = $"Error adding order note: {ex.Message}" + }); + } + } + + private static OrderNote CreateOrderNote(int orderId, bool displayToCustomer, string note) { return new OrderNote @@ -878,7 +920,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers if (string.IsNullOrWhiteSpace(term) || term.Length < 2) return Json(new List()); - const int maxResults = 15; + const int maxResults = 30; // Search products by name or SKU var products = await _productService.SearchProductsAsync( @@ -892,16 +934,21 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers foreach (var product in products) { var productDto = productDtosById[product.Id]; - - result.Add(new + if (productDto != null) { - label = $"{product.Name} [RENDELHETŐ: {(product.StockQuantity + productDto.IncomingQuantity)}] [ÁR: {product.Price}]", - value = product.Id, - sku = product.Sku, - price = product.Price, - stockQuantity = product.StockQuantity, - incomingQuantity = productDto.IncomingQuantity, - }); + if(productDto.AvailableQuantity > 0) + { + result.Add(new + { + label = $"{product.Name} [RENDELHETŐ: {(product.StockQuantity + productDto.IncomingQuantity)}] [ÁR: {product.Price}]", + value = product.Id, + sku = product.Sku, + price = product.Price, + stockQuantity = product.StockQuantity, + incomingQuantity = productDto.IncomingQuantity, + }); + } + } } return Json(result); diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Extras/VoiceRecorder.cshtml b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Extras/VoiceRecorder.cshtml index 643d1bb..dfba28b 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Extras/VoiceRecorder.cshtml +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Extras/VoiceRecorder.cshtml @@ -1,4 +1,4 @@ -@{ +@{ Layout = "_ConfigurePlugin"; } @@ -13,6 +13,21 @@

Voice Recorder

Click the button below to start recording your voice message.

+
+ Important: When you click "Start Recording", your browser will ask for permission to use your microphone. Please click "Allow" to enable voice recording. +
+ + +
-
+

-
+
-
+
+
+ +
@@ -60,7 +65,7 @@
- + @@ -161,6 +166,40 @@
+ + +