388 lines
20 KiB
C#
388 lines
20 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Routing;
|
|
using Nop.Plugin.Misc.FruitBankPlugin.Services;
|
|
using Nop.Web.Framework;
|
|
using Nop.Web.Framework.Mvc.Routing;
|
|
|
|
namespace Nop.Plugin.Misc.FruitBankPlugin.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// Represents plugin route provider
|
|
/// </summary>
|
|
public class RouteProvider : IRouteProvider
|
|
{
|
|
/// <summary>
|
|
/// Register routes
|
|
/// </summary>
|
|
/// <param name="endpointRouteBuilder">Route builder</param>
|
|
public void RegisterRoutes(IEndpointRouteBuilder endpointRouteBuilder)
|
|
{
|
|
endpointRouteBuilder.MapControllerRoute(name: "Plugin.Misc.FruitBankPlugin.Configure",
|
|
pattern: "Admin/FruitBankPlugin/Configure",
|
|
defaults: new { controller = "FruitBankPluginAdmin", action = "Configure", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Order.List",
|
|
pattern: "Admin/Order/List",
|
|
defaults: new { controller = "CustomOrder", action = "NewList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Order.OrderList",
|
|
pattern: "Admin/Order/OrderList",
|
|
defaults: new { controller = "CustomOrder", action = "OrderList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Order.FruitBankOrderList",
|
|
pattern: "Admin/CustomOrder/FruitBankOrderList",
|
|
defaults: new { controller = "CustomOrder", action = "FruitBankOrderList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Order.UpdateOrderField",
|
|
pattern: "Admin/CustomOrder/UpdateOrderField",
|
|
defaults: new { controller = "CustomOrder", action = "UpdateOrderField", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Order.Test",
|
|
pattern: "Admin/Order/Test",
|
|
defaults: new { controller = "CustomOrder", action = "Test", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Index",
|
|
pattern: "Admin",
|
|
defaults: new { controller = "CustomDashboard", action = "Index", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Shipping.List",
|
|
pattern: "Admin/Shipping/List",
|
|
defaults: new { controller = "Shipping", action = "List", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Shipping.ShippingList",
|
|
pattern: "Admin/Shipping/ShippingList",
|
|
defaults: new { controller = "Shipping", action = "ShippingList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Invoices.List",
|
|
pattern: "Admin/Invoices/List",
|
|
defaults: new { controller = "Invoice", action = "List", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Shipping.Create",
|
|
pattern: "Admin/Shipping/Create",
|
|
defaults: new { controller = "Shipping", action = "Create", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Shipping.Edit",
|
|
pattern: "Admin/Shipping/Edit",
|
|
defaults: new { controller = "Shipping", action = "Edit", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Shipping.UploadFile",
|
|
pattern: "Admin/Shipping/UploadFile",
|
|
defaults: new { controller = "Shipping", action = "UploadFile", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Shipping.ReloadPartialView",
|
|
pattern: "Admin/Shipping/ReloadPartialView",
|
|
defaults: new { controller = "Shipping", action = "ReloadPartialView", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Shipping.GetShippingDocumentsByShippingId",
|
|
pattern: "Admin/Shipping/GetShippingDocumentsByShippingId",
|
|
defaults: new { controller = "Shipping", action = "GetShippingDocumentsByShippingId", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.ManagementPage.Test",
|
|
pattern: "Admin/ManagementPage/Test",
|
|
defaults: new { controller = "ManagementPage", action = "Test", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.ManagementPage.GetShippings",
|
|
pattern: "Admin/ManagementPage/GetShippings",
|
|
defaults: new { controller = "ManagementPage", action = "GetShippings", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.ManagementPage.LoadPartial",
|
|
pattern: "Admin/ManagementPage/LoadPartial",
|
|
defaults: new { controller = "ManagementPage", action = "LoadPartial", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.ManagementPage.GetPartners",
|
|
pattern: "Admin/ManagementPage/GetPartners",
|
|
defaults: new { controller = "ManagementPage", action = "GetPartners", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.ManagementPage.LoadChildGrid",
|
|
pattern: "Admin/ManagementPage/LoadChildGrid",
|
|
defaults: new { controller = "ManagementPage", action = "LoadChildGrid", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Products.List",
|
|
pattern: "Admin/Product/List",
|
|
defaults: new { controller = "CustomProduct", action = "List", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Products.ProductList",
|
|
pattern: "Admin/Product/ProductList",
|
|
defaults: new { controller = "CustomProduct", action = "ProductList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Orders.SaveOrderAttributes",
|
|
pattern: "Admin/CustomOrder/SaveOrderAttributes",
|
|
defaults: new { controller = "CustomOrder", action = "SaveOrderAttributes", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Orders.AllowRevision",
|
|
pattern: "Admin/CustomOrder/AllowRevision",
|
|
defaults: new { controller = "CustomOrder", action = "AllowRevision", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Orders.CustomerSearchAutoComplete",
|
|
pattern: "Admin/CustomOrder/CustomerSearchAutoComplete",
|
|
defaults: new { controller = "CustomOrder", action = "CustomerSearchAutoComplete", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Invoice.CreateInvoice",
|
|
pattern: "Admin/Invoice/CreateInvoice",
|
|
defaults: new { controller = "Invoice", action = "CreateInvoice", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Order.Edit",
|
|
pattern: "Admin/Order/Edit/{id}",
|
|
defaults: new { controller = "CustomOrder", action = "Edit", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.Order.AddProduct",
|
|
pattern: "Admin/CustomOrder/FruitBankAddProductToOrder",
|
|
defaults: new { controller = "CustomOrder", action = "FruitBankAddProductToOrder", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.ManagementPage.ProcessShippingDocument",
|
|
pattern: "Admin/ManagamentPage/ProcessShippingDocument/{id}",
|
|
defaults: new { controller = "ManagementPage", action = "ProcessShippingdocument", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.AppDownload",
|
|
pattern: "Admin/AppDownload",
|
|
defaults: new { controller = "AppDownload", action = "Index", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.AppDownload.Download",
|
|
pattern: "Admin/AppDownload/Download/{version}/{fileName}",
|
|
defaults: new { controller = "AppDownload", action = "Download", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.FruitBankAudio",
|
|
pattern: "Admin/VoiceRecorder",
|
|
defaults: new { controller = "FruitBankAudio", action = "VoiceRecorder", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.ExtractText",
|
|
pattern: "Admin/ExtractText",
|
|
defaults: new { controller = "FileManager", action = "ImageTextExtraction", area = AreaNames.ADMIN });
|
|
|
|
// ── Customer Credit ──────────────────────────────────────────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.CustomerCredit.List",
|
|
pattern: "Admin/CustomerCredit/List",
|
|
defaults: new { controller = "CustomerCredit", action = "List", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.CustomerCredit.CustomerCreditList",
|
|
pattern: "Admin/CustomerCredit/CustomerCreditList",
|
|
defaults: new { controller = "CustomerCredit", action = "CustomerCreditList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Admin.CustomerCredit.UpdateCreditLimit",
|
|
pattern: "Admin/CustomerCredit/UpdateCreditLimit",
|
|
defaults: new { controller = "CustomerCredit", action = "UpdateCreditLimit", area = AreaNames.ADMIN });
|
|
|
|
// ── Admin: Preorder list ───────────────────────────────────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorders.List",
|
|
pattern: "Admin/Preorders",
|
|
defaults: new { controller = "PreorderAdmin", action = "List", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorders.PreorderList",
|
|
pattern: "Admin/Preorders/PreorderList",
|
|
defaults: new { controller = "PreorderAdmin", action = "PreorderList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorders.Detail",
|
|
pattern: "Admin/Preorders/Detail/{id:int}",
|
|
defaults: new { controller = "PreorderAdmin", action = "Detail", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorders.Cancel",
|
|
pattern: "Admin/Preorders/Cancel/{id:int}",
|
|
defaults: new { controller = "PreorderAdmin", action = "Cancel", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorders.CreatePreorder",
|
|
pattern: "Admin/Preorders/CreatePreorder",
|
|
defaults: new { controller = "PreorderAdmin", action = "CreatePreorder", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorders.DemandList",
|
|
pattern: "Admin/Preorders/DemandList",
|
|
defaults: new { controller = "PreorderAdmin", action = "DemandList", area = AreaNames.ADMIN });
|
|
|
|
// ── Admin: Preorder availability ─────────────────────────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.PreorderAvailability.Index",
|
|
pattern: "Admin/PreorderAvailability",
|
|
defaults: new { controller = "PreorderAvailability", action = "Index", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.PreorderAvailability.ProductList",
|
|
pattern: "Admin/PreorderAvailability/ProductList",
|
|
defaults: new { controller = "PreorderAvailability", action = "ProductList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.PreorderAvailability.AvailableTodayList",
|
|
pattern: "Admin/PreorderAvailability/AvailableTodayList",
|
|
defaults: new { controller = "PreorderAvailability", action = "AvailableTodayList", area = AreaNames.ADMIN });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.PreorderAvailability.SaveWindow",
|
|
pattern: "Admin/PreorderAvailability/SaveWindow",
|
|
defaults: new { controller = "PreorderAvailability", action = "SaveWindow", area = AreaNames.ADMIN });
|
|
|
|
// ── Public: Unified Order flow ─────────────────────────────────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.Index",
|
|
pattern: "rendeles",
|
|
defaults: new { controller = "Order", action = "Index" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.GetDeliveryDateTime",
|
|
pattern: "rendeles/szallitas-idopont",
|
|
defaults: new { controller = "Order", action = "GetDeliveryDateTime" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.SetDeliveryDateTime",
|
|
pattern: "rendeles/szallitas-idopont-beallitas",
|
|
defaults: new { controller = "Order", action = "SetDeliveryDateTime" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.GetAllProducts",
|
|
pattern: "rendeles/osszes-termek",
|
|
defaults: new { controller = "Order", action = "GetAllProducts" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.GetPreorderProducts",
|
|
pattern: "rendeles/elozetes-termekek",
|
|
defaults: new { controller = "Order", action = "GetPreorderProducts" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.SearchProducts",
|
|
pattern: "rendeles/kereses",
|
|
defaults: new { controller = "Order", action = "SearchProducts" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.TranscribeAndSearch",
|
|
pattern: "rendeles/hang",
|
|
defaults: new { controller = "Order", action = "TranscribeAndSearch" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.AddToCart",
|
|
pattern: "rendeles/kosarba",
|
|
defaults: new { controller = "Order", action = "AddToCart" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.GetCartItems",
|
|
pattern: "rendeles/kosar",
|
|
defaults: new { controller = "Order", action = "GetCartItems" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Order.PlacePreorder",
|
|
pattern: "rendeles/elozetes-leadás",
|
|
defaults: new { controller = "Order", action = "PlacePreorder" });
|
|
|
|
// ── Public: Help page ───────────────────────────────────────────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Help.Index",
|
|
pattern: "segitseg",
|
|
defaults: new { controller = "Help", action = "Index" });
|
|
|
|
// ── Public: Customer preorder list ───────────────────────────────────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.CustomerPreorder.List",
|
|
pattern: "fiokom/elorerendeles-aim",
|
|
defaults: new { controller = "CustomerPreorder", action = "List" });
|
|
|
|
// ── Public: Preorder (legacy, kept for backward compat) ───────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorder.Index",
|
|
pattern: "elozetes-rendeles",
|
|
defaults: new { controller = "Preorder", action = "Index" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorder.GetDeliveryDateTime",
|
|
pattern: "elozetes-rendeles/szallitas-idopont",
|
|
defaults: new { controller = "Preorder", action = "GetDeliveryDateTime" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorder.SetDeliveryDateTime",
|
|
pattern: "elozetes-rendeles/szallitas-idopont-beallitas",
|
|
defaults: new { controller = "Preorder", action = "SetDeliveryDateTime" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorder.GetAvailableProducts",
|
|
pattern: "elozetes-rendeles/termekek",
|
|
defaults: new { controller = "Preorder", action = "GetAvailableProducts" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.Preorder.PlacePreorder",
|
|
pattern: "elozetes-rendeles/leadás",
|
|
defaults: new { controller = "Preorder", action = "PlacePreorder" });
|
|
|
|
// ── Public: Quick Order ──────────────────────────────────────────────
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.Index",
|
|
pattern: "gyors-rendeles",
|
|
defaults: new { controller = "QuickOrder", action = "Index" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.GetAllProducts",
|
|
pattern: "gyors-rendeles/osszes-termek",
|
|
defaults: new { controller = "QuickOrder", action = "GetAllProducts" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.SearchProducts",
|
|
pattern: "gyors-rendeles/kereses",
|
|
defaults: new { controller = "QuickOrder", action = "SearchProducts" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.TranscribeAndSearch",
|
|
pattern: "gyors-rendeles/hang",
|
|
defaults: new { controller = "QuickOrder", action = "TranscribeAndSearch" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.AddToCart",
|
|
pattern: "gyors-rendeles/kosarba",
|
|
defaults: new { controller = "QuickOrder", action = "AddToCart" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.GetCartItems",
|
|
pattern: "gyors-rendeles/kosar",
|
|
defaults: new { controller = "QuickOrder", action = "GetCartItems" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.SetDeliveryDateTime",
|
|
pattern: "gyors-rendeles/szallitas-idopont",
|
|
defaults: new { controller = "QuickOrder", action = "SetDeliveryDateTime" });
|
|
|
|
endpointRouteBuilder.MapControllerRoute(
|
|
name: "Plugin.FruitBank.QuickOrder.GetDeliveryDateTime",
|
|
pattern: "gyors-rendeles/szallitas-idopont-lekerdezes",
|
|
defaults: new { controller = "QuickOrder", action = "GetDeliveryDateTime" });
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a priority of route provider
|
|
/// </summary>
|
|
public int Priority => 4000;
|
|
}
|