diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor index 4f831cf8..a1ea7e3e 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor @@ -11,6 +11,7 @@ @inject IJSRuntime JS @inject WebClientTpos.Client.Services.AuthStateService AuthState @inject WebClientTpos.Client.Services.AuthService AuthSvc +@inject Microsoft.Extensions.Localization.IStringLocalizer L @using WebClientTpos.Client.Services @@ -39,7 +40,7 @@ @* Back to Admin *@ - Quay lại Admin + @L["Admin_Nav_BackToAdmin"] @* Shop Info Header *@ @@ -50,20 +51,20 @@
@_shopName
-
@ShopSidebarConfig.GetVerticalLabel(_shopCategory)
+
@L[ShopSidebarConfig.GetVerticalLabel(_shopCategory)]
@* Vertical-specific menu *@ - Quản lý + @L["Admin_Nav_SectionManage"] @foreach (var item in ShopSidebarConfig.GetMenuItems(_shopCategory)) { var route = $"/admin/shop/{_shopId}/{item.Route}"; var cssClass = item.IsSub ? "admin-nav-item admin-nav-item--sub" : "admin-nav-item"; - @item.Label + @L[item.Label] } } @@ -72,43 +73,43 @@ @* ═══ ADMIN LEVEL SIDEBAR ═══ *@ @* ── TỔNG QUAN ── *@ - Tổng quan + @L["Admin_Nav_SectionOverview"] Dashboard @* ── KINH DOANH ── *@ - Kinh doanh + @L["Admin_Nav_SectionBusiness"] - Cửa hàng + @L["Admin_Nav_Stores"] @* ── QUẢN TRỊ ── *@ - Quản trị + @L["Admin_Nav_SectionAdmin"] - Phân quyền + @L["Admin_Nav_Roles"] @* ── HỆ THỐNG ── *@ - Hệ thống + @L["Admin_Nav_SectionSystem"] - Nhật ký + @L["Admin_Nav_AuditLog"] - Thiết bị + @L["Admin_Nav_Devices"] - Tích hợp + @L["Admin_Nav_Integrations"] - Cài đặt + @L["Admin_Nav_Settings"] } @@ -120,7 +121,7 @@ @_userName @_userRole - @@ -145,11 +146,11 @@
-

Đã xảy ra lỗi

-

Trang gặp sự cố. Vui lòng tải lại.

+

@L["Admin_Error_Title"]

+

@L["Admin_Error_Subtitle"]

@@ -165,7 +166,7 @@ // VI: Phát hiện context cửa hàng — parse từ URL private bool _isShopContext = false; private string? _shopId; - private string _shopName = "Cửa hàng"; + private string _shopName = ""; private string? _shopCategory; protected override void OnInitialized() @@ -254,7 +255,7 @@ private string _userInitials => _userName.Length >= 2 ? _userName[..2].ToUpper() : _userName.ToUpper(); - private string _userRole => AuthState.IsAuthenticated ? "Admin" : "Khách"; + private string _userRole => AuthState.IsAuthenticated ? "Admin" : "Guest"; private async Task Logout() { diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopSidebarConfig.cs b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopSidebarConfig.cs index e7c4c932..c6d195e1 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopSidebarConfig.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopSidebarConfig.cs @@ -5,8 +5,10 @@ namespace WebClientTpos.Client.Services; /// /// EN: Static config for shop-level sidebar menus per vertical type. +/// Labels are i18n keys — resolved at render time via IStringLocalizer. /// VI: Cấu hình tĩnh cho menu sidebar cấp cửa hàng theo loại ngành hàng. -/// +/// Labels là i18n keys — được resolve lúc render qua IStringLocalizer. +/// /// Mỗi ngành hàng có menu khác nhau: /// - Café: Menu đồ uống, tồn kho nguyên liệu /// - Restaurant: Menu món ăn + Bàn + Bếp @@ -20,112 +22,108 @@ public static class ShopSidebarConfig /// /// EN: Get sidebar menu items for a specific shop vertical. + /// Labels are i18n keys (e.g. "Shop_Menu_Overview"). /// VI: Lấy danh sách menu sidebar cho ngành hàng cụ thể. + /// Labels là i18n keys (ví dụ "Shop_Menu_Overview"). /// public static List GetMenuItems(string? category) { var vertical = ShopVerticalHelper.NormalizeVertical(category); - return vertical switch + // EN: Shared menu items used by all verticals + // VI: Menu items dùng chung cho tất cả ngành hàng + List CommonTail() => new() + { + new("Shop_Menu_Finance", "trending-up", "finance"), + new("Shop_Menu_Staff", "users", "staff"), + new("Shop_Menu_Customers", "heart", "customers"), + new("Shop_Menu_Promotions", "tag", "promotions"), + new("Shop_Menu_Reports", "bar-chart-2", "reports"), + new("Shop_Menu_Settings", "settings", "settings"), + }; + + List items = vertical switch { "cafe" => new() { - new("Tổng quan", "layout-dashboard", "overview"), - new("POS Bán hàng", "monitor", "pos"), - new("Menu & Đồ uống", "coffee", "menu"), - new("Nguyên liệu", "flask-conical", "recipes"), - new("Ca làm việc", "clock-4", "shifts"), - new("Tồn kho", "warehouse", "inventory"), - new("Tài chính", "trending-up", "finance"), - new("Nhân sự", "users", "staff"), - new("Khách hàng", "heart", "customers"), - new("Khuyến mãi", "tag", "promotions"), - new("Báo cáo", "bar-chart-2", "reports"), - new("Thiết lập", "settings", "settings"), + new("Shop_Menu_Overview", "layout-dashboard", "overview"), + new("Shop_Menu_POS", "monitor", "pos"), + new("Shop_Menu_MenuDrinks", "coffee", "menu"), + new("Shop_Menu_Recipes", "flask-conical", "recipes"), + new("Shop_Menu_Shifts", "clock-4", "shifts"), + new("Shop_Menu_Inventory", "warehouse", "inventory"), }, "restaurant" => new() { - new("Tổng quan", "layout-dashboard", "overview"), - new("POS Bán hàng", "monitor", "pos"), - new("Menu & Món ăn", "utensils", "menu"), - new("Bàn / Table", "grid-3x3", "tables"), - new("Đặt bàn", "calendar-check", "reservations"), - new("Khu vực", "map-pin", "zones"), - new("Bếp (Kitchen)", "flame", "kitchen"), - new("Tồn kho", "warehouse", "inventory"), - new("Tài chính", "trending-up", "finance"), - new("Nhân sự", "users", "staff"), - new("Khách hàng", "heart", "customers"), - new("Khuyến mãi", "tag", "promotions"), - new("Báo cáo", "bar-chart-2", "reports"), - new("Thiết lập", "settings", "settings"), + new("Shop_Menu_Overview", "layout-dashboard", "overview"), + new("Shop_Menu_POS", "monitor", "pos"), + new("Shop_Menu_MenuFood", "utensils", "menu"), + new("Shop_Menu_Tables", "grid-3x3", "tables"), + new("Shop_Menu_Reservations", "calendar-check", "reservations"), + new("Shop_Menu_Zones", "map-pin", "zones"), + new("Shop_Menu_Kitchen", "flame", "kitchen"), + new("Shop_Menu_Inventory", "warehouse", "inventory"), }, "karaoke" => new() { - new("Tổng quan", "layout-dashboard", "overview"), - new("POS Bán hàng", "monitor", "pos"), - new("Phòng", "door-open", "rooms"), - new("Menu / Bar", "wine", "menu"), - new("Happy Hour", "clock", "happy-hour"), - new("Tồn kho", "warehouse", "inventory"), - new("Tài chính", "trending-up", "finance"), - new("Nhân sự", "users", "staff"), - new("Khách hàng", "heart", "customers"), - new("Khuyến mãi", "tag", "promotions"), - new("Báo cáo", "bar-chart-2", "reports"), - new("Thiết lập", "settings", "settings"), + new("Shop_Menu_Overview", "layout-dashboard", "overview"), + new("Shop_Menu_POS", "monitor", "pos"), + new("Shop_Menu_Rooms", "door-open", "rooms"), + new("Shop_Menu_MenuBar", "wine", "menu"), + new("Shop_Menu_HappyHour", "clock", "happy-hour"), + new("Shop_Menu_Inventory", "warehouse", "inventory"), }, "spa" => new() { - new("Tổng quan", "layout-dashboard", "overview"), - new("POS Bán hàng", "monitor", "pos"), - new("Lịch hẹn", "calendar", "appointments"), - new("Dịch vụ", "sparkles", "services"), - new("Gói dịch vụ", "gift", "packages"), - new("Combo dịch vụ", "layers", "combos"), - new("Tài nguyên", "door-open", "resources"), - new("Sản phẩm", "package", "products"), - new("Tài chính", "trending-up", "finance"), - new("Nhân sự", "users", "staff"), - new("Lịch làm việc", "calendar-clock", "schedule"), - new("Khách hàng", "heart", "customers"), - new("Khuyến mãi", "tag", "promotions"), - new("Báo cáo", "bar-chart-2", "reports"), - new("Thiết lập", "settings", "settings"), + new("Shop_Menu_Overview", "layout-dashboard", "overview"), + new("Shop_Menu_POS", "monitor", "pos"), + new("Shop_Menu_Appointments", "calendar", "appointments"), + new("Shop_Menu_Services", "sparkles", "services"), + new("Shop_Menu_Packages", "gift", "packages"), + new("Shop_Menu_Combos", "layers", "combos"), + new("Shop_Menu_Resources", "door-open", "resources"), + new("Shop_Menu_Products", "package", "products"), }, "beauty" => new() { - new("Tổng quan", "layout-dashboard", "overview"), - new("POS Bán hàng", "monitor", "pos"), - new("Lịch hẹn", "calendar", "appointments"), - new("Dịch vụ", "sparkles", "services"), - new("Liệu trình", "clipboard-list", "treatments"), - new("Cam kết KH", "file-check", "consent"), - new("Bác sĩ / CK", "stethoscope", "doctors"), - new("Tái khám", "calendar-heart", "followup"), - new("Tài nguyên", "door-open", "resources"), - new("Sản phẩm", "package", "products"), - new("Tài chính", "trending-up", "finance"), - new("Nhân sự", "users", "staff"), - new("Lịch làm việc", "calendar-clock", "schedule"), - new("Khách hàng", "heart", "customers"), - new("Khuyến mãi", "tag", "promotions"), - new("Báo cáo", "bar-chart-2", "reports"), - new("Thiết lập", "settings", "settings"), + new("Shop_Menu_Overview", "layout-dashboard", "overview"), + new("Shop_Menu_POS", "monitor", "pos"), + new("Shop_Menu_Appointments", "calendar", "appointments"), + new("Shop_Menu_Services", "sparkles", "services"), + new("Shop_Menu_Treatments", "clipboard-list", "treatments"), + new("Shop_Menu_Consent", "file-check", "consent"), + new("Shop_Menu_Doctors", "stethoscope", "doctors"), + new("Shop_Menu_FollowUp", "calendar-heart", "followup"), + new("Shop_Menu_Resources", "door-open", "resources"), + new("Shop_Menu_Products", "package", "products"), }, _ => new() { - new("Tổng quan", "layout-dashboard", "overview"), - new("POS Bán hàng", "monitor", "pos"), - new("Sản phẩm", "package", "menu"), - new("Tồn kho", "warehouse", "inventory"), - new("Tài chính", "trending-up", "finance"), - new("Nhân sự", "users", "staff"), - new("Khách hàng", "heart", "customers"), - new("Báo cáo", "bar-chart-2", "reports"), - new("Thiết lập", "settings", "settings"), + new("Shop_Menu_Overview", "layout-dashboard", "overview"), + new("Shop_Menu_POS", "monitor", "pos"), + new("Shop_Menu_Products", "package", "menu"), + new("Shop_Menu_Inventory", "warehouse", "inventory"), }, }; + + // EN: Append common tail items (spa/beauty have extra staff schedule) + // VI: Nối thêm menu items chung (spa/beauty có thêm lịch làm việc) + if (vertical is "spa" or "beauty") + { + items.Add(new("Shop_Menu_Finance", "trending-up", "finance")); + items.Add(new("Shop_Menu_Staff", "users", "staff")); + items.Add(new("Shop_Menu_Schedule", "calendar-clock", "schedule")); + items.Add(new("Shop_Menu_Customers", "heart", "customers")); + items.Add(new("Shop_Menu_Promotions", "tag", "promotions")); + items.Add(new("Shop_Menu_Reports", "bar-chart-2", "reports")); + items.Add(new("Shop_Menu_Settings", "settings", "settings")); + } + else + { + items.AddRange(CommonTail()); + } + + return items; } /// diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopVerticalHelper.cs b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopVerticalHelper.cs index 71dc3a28..06256e11 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopVerticalHelper.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/ShopVerticalHelper.cs @@ -49,13 +49,13 @@ public static class ShopVerticalHelper /// public static string GetLabel(string? category) => NormalizeVertical(category) switch { - "cafe" => "Café", - "restaurant" => "Nhà hàng / Bar", - "karaoke" => "Karaoke", - "spa" => "Spa & Wellness", - "beauty" => "Thẩm mỹ viện", - "retail" => "Bán lẻ", - _ => "Cửa hàng" + "cafe" => "Vertical_Cafe", + "restaurant" => "Vertical_Restaurant", + "karaoke" => "Vertical_Karaoke", + "spa" => "Vertical_Spa", + "beauty" => "Vertical_Beauty", + "retail" => "Vertical_Retail", + _ => "Vertical_Store" }; /// @@ -108,10 +108,10 @@ public static class ShopVerticalHelper /// public static string GetStatusLabel(string? status) => status?.ToLowerInvariant() switch { - "published" or "active" => "Đang mở", - "draft" or "setup" => "Thiết lập", - "inactive" or "paused" => "Tạm dừng", - "closed" => "Đã đóng", + "published" or "active" => "Status_Active", + "draft" or "setup" => "Status_Setup", + "inactive" or "paused" => "Status_Paused", + "closed" => "Status_Closed", _ => status ?? "—" }; diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json index 0c0a8aeb..93e3b11a 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json @@ -341,5 +341,63 @@ "Auth_Profile_Logout": "Sign Out", "Auth_Profile_Success": "Profile updated successfully", "Auth_Profile_PasswordSuccess": "Password changed successfully", - "Auth_Profile_Error": "Unable to update. Please try again." + "Auth_Profile_Error": "Unable to update. Please try again.", + "Admin_Nav_BackToAdmin": "Back to Admin", + "Admin_Nav_SectionManage": "Manage", + "Admin_Nav_SectionOverview": "Overview", + "Admin_Nav_SectionBusiness": "Business", + "Admin_Nav_SectionAdmin": "Administration", + "Admin_Nav_SectionSystem": "System", + "Admin_Nav_Stores": "Stores", + "Admin_Nav_Roles": "Permissions", + "Admin_Nav_AuditLog": "Audit Log", + "Admin_Nav_Devices": "Devices", + "Admin_Nav_Integrations": "Integrations", + "Admin_Nav_Settings": "Settings", + "Admin_Nav_Logout": "Sign Out", + "Admin_Error_Title": "Something went wrong", + "Admin_Error_Subtitle": "The page encountered an issue. Please reload.", + "Admin_Error_Reload": "Reload", + "Shop_Menu_Overview": "Overview", + "Shop_Menu_POS": "POS Sales", + "Shop_Menu_MenuDrinks": "Menu & Drinks", + "Shop_Menu_MenuFood": "Menu & Dishes", + "Shop_Menu_MenuBar": "Menu / Bar", + "Shop_Menu_Recipes": "Ingredients", + "Shop_Menu_Shifts": "Shifts", + "Shop_Menu_Inventory": "Inventory", + "Shop_Menu_Tables": "Tables", + "Shop_Menu_Reservations": "Reservations", + "Shop_Menu_Zones": "Zones", + "Shop_Menu_Kitchen": "Kitchen", + "Shop_Menu_Rooms": "Rooms", + "Shop_Menu_HappyHour": "Happy Hour", + "Shop_Menu_Appointments": "Appointments", + "Shop_Menu_Services": "Services", + "Shop_Menu_Packages": "Service Packages", + "Shop_Menu_Combos": "Service Combos", + "Shop_Menu_Resources": "Resources", + "Shop_Menu_Products": "Products", + "Shop_Menu_Treatments": "Treatments", + "Shop_Menu_Consent": "Client Consent", + "Shop_Menu_Doctors": "Doctors / Specialists", + "Shop_Menu_FollowUp": "Follow-up", + "Shop_Menu_Schedule": "Work Schedule", + "Shop_Menu_Finance": "Finance", + "Shop_Menu_Staff": "Staff", + "Shop_Menu_Customers": "Customers", + "Shop_Menu_Promotions": "Promotions", + "Shop_Menu_Reports": "Reports", + "Shop_Menu_Settings": "Settings", + "Vertical_Cafe": "Café", + "Vertical_Restaurant": "Restaurant / Bar", + "Vertical_Karaoke": "Karaoke", + "Vertical_Spa": "Spa & Wellness", + "Vertical_Beauty": "Beauty Clinic", + "Vertical_Retail": "Retail", + "Vertical_Store": "Store", + "Status_Active": "Open", + "Status_Setup": "Setting up", + "Status_Paused": "Paused", + "Status_Closed": "Closed" } \ No newline at end of file diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json index 5652824b..f7b942df 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json @@ -341,5 +341,63 @@ "Auth_Profile_Logout": "Đăng xuất", "Auth_Profile_Success": "Hồ sơ đã được cập nhật thành công", "Auth_Profile_PasswordSuccess": "Mật khẩu đã được thay đổi thành công", - "Auth_Profile_Error": "Không thể cập nhật. Vui lòng thử lại." + "Auth_Profile_Error": "Không thể cập nhật. Vui lòng thử lại.", + "Admin_Nav_BackToAdmin": "Quay lại Admin", + "Admin_Nav_SectionManage": "Quản lý", + "Admin_Nav_SectionOverview": "Tổng quan", + "Admin_Nav_SectionBusiness": "Kinh doanh", + "Admin_Nav_SectionAdmin": "Quản trị", + "Admin_Nav_SectionSystem": "Hệ thống", + "Admin_Nav_Stores": "Cửa hàng", + "Admin_Nav_Roles": "Phân quyền", + "Admin_Nav_AuditLog": "Nhật ký", + "Admin_Nav_Devices": "Thiết bị", + "Admin_Nav_Integrations": "Tích hợp", + "Admin_Nav_Settings": "Cài đặt", + "Admin_Nav_Logout": "Đăng xuất", + "Admin_Error_Title": "Đã xảy ra lỗi", + "Admin_Error_Subtitle": "Trang gặp sự cố. Vui lòng tải lại.", + "Admin_Error_Reload": "Tải lại", + "Shop_Menu_Overview": "Tổng quan", + "Shop_Menu_POS": "POS Bán hàng", + "Shop_Menu_MenuDrinks": "Menu & Đồ uống", + "Shop_Menu_MenuFood": "Menu & Món ăn", + "Shop_Menu_MenuBar": "Menu / Bar", + "Shop_Menu_Recipes": "Nguyên liệu", + "Shop_Menu_Shifts": "Ca làm việc", + "Shop_Menu_Inventory": "Tồn kho", + "Shop_Menu_Tables": "Bàn / Table", + "Shop_Menu_Reservations": "Đặt bàn", + "Shop_Menu_Zones": "Khu vực", + "Shop_Menu_Kitchen": "Bếp (Kitchen)", + "Shop_Menu_Rooms": "Phòng", + "Shop_Menu_HappyHour": "Happy Hour", + "Shop_Menu_Appointments": "Lịch hẹn", + "Shop_Menu_Services": "Dịch vụ", + "Shop_Menu_Packages": "Gói dịch vụ", + "Shop_Menu_Combos": "Combo dịch vụ", + "Shop_Menu_Resources": "Tài nguyên", + "Shop_Menu_Products": "Sản phẩm", + "Shop_Menu_Treatments": "Liệu trình", + "Shop_Menu_Consent": "Cam kết KH", + "Shop_Menu_Doctors": "Bác sĩ / CK", + "Shop_Menu_FollowUp": "Tái khám", + "Shop_Menu_Schedule": "Lịch làm việc", + "Shop_Menu_Finance": "Tài chính", + "Shop_Menu_Staff": "Nhân sự", + "Shop_Menu_Customers": "Khách hàng", + "Shop_Menu_Promotions": "Khuyến mãi", + "Shop_Menu_Reports": "Báo cáo", + "Shop_Menu_Settings": "Thiết lập", + "Vertical_Cafe": "Café", + "Vertical_Restaurant": "Nhà hàng / Bar", + "Vertical_Karaoke": "Karaoke", + "Vertical_Spa": "Spa & Wellness", + "Vertical_Beauty": "Thẩm mỹ viện", + "Vertical_Retail": "Bán lẻ", + "Vertical_Store": "Cửa hàng", + "Status_Active": "Đang mở", + "Status_Setup": "Thiết lập", + "Status_Paused": "Tạm dừng", + "Status_Closed": "Đã đóng" } \ No newline at end of file