fix(admin): update remaining hardcoded /pos links to use dynamic ShopId in ShopOverview and ShopPage

This commit is contained in:
Ho Ngoc Hai
2026-02-28 11:39:39 +07:00
parent 75bcff209b
commit f8c2e65d2b
2 changed files with 14 additions and 3 deletions

View File

@@ -27,7 +27,7 @@
@GetStatusLabel(_shop.Status)
</div>
}
<a href="/pos" class="admin-btn-primary" style="text-decoration:none;">
<a href="/pos/@ShopId/@(_posVertical)" class="admin-btn-primary" style="text-decoration:none;">
<i data-lucide="monitor"></i>
<span>Mở POS</span>
</a>
@@ -222,6 +222,7 @@
[Parameter] public string ShopId { get; set; } = "";
private PosDataService.ShopInfo? _shop;
private string _posVertical = "cafe";
private List<PosDataService.OrderInfo> _orders = new();
private List<PosDataService.AdminProductInfo> _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"
};
}

View File

@@ -117,7 +117,7 @@
</div>
@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
{