From f8c2e65d2b267606b0c680192712fde197919545 Mon Sep 17 00:00:00 2001 From: Ho Ngoc Hai Date: Sat, 28 Feb 2026 11:39:39 +0700 Subject: [PATCH] fix(admin): update remaining hardcoded /pos links to use dynamic ShopId in ShopOverview and ShopPage --- .../Pages/Admin/Shop/ShopOverview.razor | 13 ++++++++++++- .../Pages/Admin/Shop/ShopPage.razor | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopOverview.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopOverview.razor index 6f698324..c6028bbb 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopOverview.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopOverview.razor @@ -27,7 +27,7 @@ @GetStatusLabel(_shop.Status) } - + Mở POS @@ -222,6 +222,7 @@ [Parameter] public string ShopId { get; set; } = ""; private PosDataService.ShopInfo? _shop; + private string _posVertical = "cafe"; private List _orders = new(); private List _products = new(); @@ -239,6 +240,7 @@ _shop = await DataService.GetShopByIdAsync(id); if (_shop != null) { + _posVertical = MapCategoryToVertical(_shop.Category); Layout?.SetShopContext(ShopId, _shop.Name ?? "Cửa hàng", _shop.Category); } // EN: Load KPI data in parallel / VI: Tải dữ liệu KPI song song @@ -262,4 +264,13 @@ private static string GetStatusLabel(string? status) => ShopVerticalHelper.GetStatusLabel(status); + private static string MapCategoryToVertical(string? category) => (category?.ToLowerInvariant()) switch + { + "cafe" or "coffee" => "cafe", + "restaurant" or "nhahang" => "restaurant", + "karaoke" => "karaoke", + "spa" or "beauty" => "spa", + "retail" or "banle" => "retail", + _ => "cafe" + }; } diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopPage.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopPage.razor index 490ae7a6..8b32750d 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopPage.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopPage.razor @@ -117,7 +117,7 @@ @if (!_orders.Any()) { - @RenderEmpty("bar-chart-3", "#22C55E", "Chưa có dữ liệu tài chính", "Dữ liệu sẽ tự động cập nhật khi có đơn hàng", "monitor", "Mở POS bán hàng", "/pos") + @RenderEmpty("bar-chart-3", "#22C55E", "Chưa có dữ liệu tài chính", "Dữ liệu sẽ tự động cập nhật khi có đơn hàng", "monitor", "Mở POS bán hàng", $"/pos/{ShopId}/{_posVertical}") } else { @@ -184,7 +184,7 @@ case "customers": @if (!_members.Any()) { - @RenderEmpty("heart", "#EF4444", "Chưa có khách hàng", "Khách hàng sẽ hiển thị khi có giao dịch", "monitor", "Mở POS bán hàng", "/pos") + @RenderEmpty("heart", "#EF4444", "Chưa có khách hàng", "Khách hàng sẽ hiển thị khi có giao dịch", "monitor", "Mở POS bán hàng", $"/pos/{ShopId}/{_posVertical}") } else {