-
- @if (IsLoading)
- {
-
-
-
Đang tải thông tin cửa hàng...
-
- }
- else if (_shop == null)
- {
-
-
-
Không tìm thấy cửa hàng
-
Cửa hàng không tồn tại hoặc đã bị xóa.
-
-
- }
- else
- {
- @* ── Store Info Card ── *@
-
-
-
-
-
-
-
@_shop.Name
-
@_shop.Slug • @(_shop.Category ?? "—")
- @if (!string.IsNullOrEmpty(_shop.Description))
- {
-
@_shop.Description
- }
-
-
- @if (!string.IsNullOrEmpty(_shop.Phone))
- {
-
- @_shop.Phone
-
- }
- @if (!string.IsNullOrEmpty(_shop.Email))
- {
-
- @_shop.Email
-
- }
-
-
-
-
- @* ── KPI ROW (placeholder — chưa có dữ liệu order/revenue) ── *@
-
-
-
-
--
-
Doanh thu tháng
-
-
-
-
-
--
-
Đơn hàng tháng
-
-
-
-
-
--
-
Giá trị TB / đơn
-
-
-
-
-
- @* ── BOTTOM: Chart + Right Column ── *@
-
-
- @* LEFT: Revenue Chart Placeholder *@
-
-
-
-
-
-
Chưa có dữ liệu doanh thu
-
Dữ liệu sẽ hiển thị khi có đơn hàng
-
-
-
-
- @* RIGHT COLUMN *@
-
-
- @* Recent Orders Placeholder *@
-
-
-
-
-
Chưa có đơn hàng nào
-
-
-
- @* Shop Quick Info *@
-
-
-
-
- Trạng thái
- @GetStatusLabel(_shop.Status)
-
-
- Ngành hàng
- @(_shop.Category ?? "—")
-
-
- Slug
- @(_shop.Slug)
-
- @if (!string.IsNullOrEmpty(_shop.Phone))
- {
-
- Điện thoại
- @_shop.Phone
-
- }
- @if (!string.IsNullOrEmpty(_shop.Email))
- {
-
- Email
- @_shop.Email
-
- }
-
-
-
-
- }
-
-
-@code {
- [Parameter] public string Id { get; set; } = "";
-
- private PosDataService.ShopInfo? _shop;
-
- protected override async Task OnInitializedAsync()
- {
- IsLoading = true;
- try
- {
- if (Guid.TryParse(Id, out var shopId))
- {
- _shop = await DataService.GetShopByIdAsync(shopId);
- }
- }
- catch
- {
- _shop = null;
- }
- finally
- {
- IsLoading = false;
- }
- }
-
- private static string GetStatusBadgeClass(string? status) => status?.ToLowerInvariant() switch
- {
- "published" or "active" => "online",
- "draft" or "setup" => "setup",
- "inactive" or "paused" => "paused",
- _ => "setup"
- };
-
- private 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",
- _ => status ?? "—"
- };
-
- private static string GetShopIcon(string? category) => category?.ToLowerInvariant() switch
- {
- "foodbeverage" or "café" or "cafe" or "coffee" => "coffee",
- "restaurant" or "nhà hàng" => "utensils",
- "entertainment" or "karaoke" => "mic",
- "beauty" or "spa" => "sparkles",
- "retail" => "shopping-bag",
- _ => "store"
- };
-}
diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Store/StoreSettings.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Store/StoreSettings.razor
deleted file mode 100644
index 58bd137c..00000000
--- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Store/StoreSettings.razor
+++ /dev/null
@@ -1,364 +0,0 @@
-@page "/admin/stores/{Id}/settings"
-@layout AdminLayout
-@inherits AdminBase
-@inject PosDataService DataService
-@using WebClientTpos.Client.Services
-@using WebClientTpos.Shared.DTOs
-
-@*
- EN: Store settings — tabs for general, payment, receipts, integrations (real data from API).
- VI: Cài đặt cửa hàng — tabs cho chung, thanh toán, hóa đơn, tích hợp (dữ liệu thực từ API).
-*@
-
-
-
- @if (IsLoading)
- {
-
-
-
Đang tải cài đặt cửa hàng...
-
- }
- else if (_shop == null)
- {
-
-
-
Không tìm thấy cửa hàng
-
-
- }
- else
- {
- @if (_tab == "general")
- {
- @* General Settings *@
-
-
- @* Danger Zone *@
-
-
-
-
-
-
Tạm dừng cửa hàng
-
Cửa hàng sẽ ngừng hoạt động tạm thời
-
-
-
-
-
-
-
Đóng cửa hàng
-
Không thể hoàn tác, cửa hàng sẽ bị đóng vĩnh viễn
-
-
-
-
-
- }
-
- @if (_tab == "payment")
- {
- @* Payment Methods *@
-
-
-
- @foreach (var pm in _paymentMethods)
- {
-
- }
-
-
- }
-
- @if (_tab == "receipt")
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
- @if (_tab == "integrations")
- {
-
-
-
-
-
-
-
-
GrabFood
-
Đồng bộ đơn hàng delivery
-
-
-
-
-
-
-
-
-
ShopeeFood
-
Đồng bộ đơn hàng delivery
-
-
-
-
-
-
-
-
-
Kế toán (Misa)
-
Xuất hóa đơn điện tử
-
-
-
-
-
-
- }
- }
-
-
-@code {
- [Inject] private MerchantApiService MerchantApi { get; set; } = default!;
- [Parameter] public string Id { get; set; } = "";
-
- private PosDataService.ShopInfo? _shop;
- private string _tab = "general";
- private bool _isSaving = false;
- private string? _successMessage;
- private string? _errorMessage;
-
- // EN: Editable fields pre-filled from shop data
- // VI: Các trường có thể sửa, điền sẵn từ dữ liệu shop
- private string _editName = "";
- private string _editDescription = "";
- private string _editPhone = "";
- private string _editEmail = "";
-
- protected override async Task OnInitializedAsync()
- {
- IsLoading = true;
- try
- {
- if (Guid.TryParse(Id, out var shopId))
- {
- _shop = await DataService.GetShopByIdAsync(shopId);
- if (_shop != null)
- {
- _editName = _shop.Name;
- _editDescription = _shop.Description ?? "";
- _editPhone = _shop.Phone ?? "";
- _editEmail = _shop.Email ?? "";
- }
- }
- }
- catch
- {
- _shop = null;
- }
- finally
- {
- IsLoading = false;
- }
- }
-
- private async Task SaveSettings()
- {
- if (_isSaving || _shop == null) return;
- _isSaving = true;
- _successMessage = null;
- _errorMessage = null;
- StateHasChanged();
-
- var dto = new ShopUpdateDto
- {
- Name = _editName,
- Description = _editDescription,
- Phone = _editPhone,
- Email = _editEmail
- };
-
- var (success, error) = await MerchantApi.UpdateShopAsync(_shop.Id, dto);
- if (success)
- {
- _successMessage = "Đã lưu thành công!";
- // EN: Reload shop data to reflect changes
- // VI: Tải lại dữ liệu shop để phản ánh thay đổi
- _shop = await DataService.GetShopByIdAsync(_shop.Id);
- }
- else
- {
- _errorMessage = error ?? "Không thể lưu thay đổi";
- }
-
- _isSaving = false;
- }
-
- private 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",
- _ => status ?? "—"
- };
-
- private record PaymentMethod(string Name, string Icon, string Color, string Desc, bool Enabled);
- private readonly PaymentMethod[] _paymentMethods = new[]
- {
- new PaymentMethod("Tiền mặt", "banknote", "#22C55E", "Thanh toán trực tiếp", true),
- new PaymentMethod("Thẻ ngân hàng", "credit-card", "#3B82F6", "Visa, Mastercard, JCB", true),
- new PaymentMethod("QR Code", "qr-code", "#8B5CF6", "VNPay, MoMo, ZaloPay", true),
- new PaymentMethod("Chuyển khoản", "send", "#F59E0B", "Chuyển khoản ngân hàng", false),
- new PaymentMethod("Thẻ quà tặng", "gift", "#EC4899", "Gift card & voucher", false),
- };
-}