diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/SuperAdmin/Merchants/MerchantDetail.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/SuperAdmin/Merchants/MerchantDetail.razor
index 2c57fdba..6ec36740 100644
--- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/SuperAdmin/Merchants/MerchantDetail.razor
+++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/SuperAdmin/Merchants/MerchantDetail.razor
@@ -141,6 +141,7 @@
else if (_activeTab == "subscription")
{
+ @* Current plan display *@
@@ -152,9 +153,46 @@
Gói hiện tại
-
- Tính năng nâng/hạ gói sẽ được phát triển trong phiên bản tiếp theo.
-
+
+ @* Plan selector *@
+
Đổi gói đăng ký
+
+ @foreach (var plan in _planOptions)
+ {
+ var isActive = plan.Id == (_detail.SubscriptionPlanId);
+
SelectPlan(plan.Id))"
+ style="padding:16px;border-radius:10px;cursor:pointer;border:2px solid @(isActive ? "var(--sa-blue-light)" : "var(--sa-border)");background:@(isActive ? "var(--sa-blue-bg)" : "var(--sa-bg-interactive)");transition:all 0.15s ease;">
+
@plan.Name
+
+ @(plan.Price > 0 ? $"{plan.Price:N0}đ/tháng" : plan.Name == "Enterprise" ? "Liên hệ" : "Miễn phí")
+
+
+ @plan.MaxShops cửa hàng • @plan.MaxStaff nhân viên
+
+ @if (isActive)
+ {
+
Hiện tại
+ }
+
+ }
+
+
+ @if (_selectedPlanId != _detail.SubscriptionPlanId)
+ {
+
+
+
+ @if (!string.IsNullOrEmpty(_planMessage))
+ {
+ @_planMessage
+ }
+
+ }
}
@@ -166,11 +204,44 @@
private SuperAdminApiService.MerchantDetailDto? _detail;
private string _activeTab = "info";
+ private int _selectedPlanId;
+ private string? _planMessage;
+ private bool _planSuccess;
+
+ private record PlanOption(int Id, string Name, decimal Price, int MaxShops, int MaxStaff);
+ private static readonly PlanOption[] _planOptions =
+ [
+ new(0, "Starter", 0, 1, 5),
+ new(1, "Growth", 299000, 3, 15),
+ new(2, "Pro", 799000, 10, 50),
+ new(3, "Enterprise", 0, 999, 999),
+ ];
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
_detail = await Api.GetMerchantDetailAsync(MerchantId);
+ if (_detail != null)
+ _selectedPlanId = _detail.SubscriptionPlanId;
+ }
+
+ private void SelectPlan(int planId) => _selectedPlanId = planId;
+
+ private async Task SavePlanAsync()
+ {
+ _planMessage = null;
+ var (ok, err) = await Api.UpdateMerchantPlanAsync(MerchantId, _selectedPlanId);
+ if (ok)
+ {
+ _planSuccess = true;
+ _planMessage = "Đã cập nhật gói đăng ký thành công!";
+ _detail = await Api.GetMerchantDetailAsync(MerchantId);
+ }
+ else
+ {
+ _planSuccess = false;
+ _planMessage = err ?? "Cập nhật thất bại";
+ }
}
private async Task ApproveAsync()
diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/SuperAdminApiService.cs b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/SuperAdminApiService.cs
index b4b35162..aa920f7a 100644
--- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/SuperAdminApiService.cs
+++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/SuperAdminApiService.cs
@@ -45,7 +45,8 @@ public class SuperAdminApiService
string? Status, string? VerificationStatus,
string? TaxCode, string? Address, string? City, string? District,
string? Email, string? Phone, string? Website,
- int ShopsCount, int StaffCount, string? PlanName,
+ int ShopsCount, int StaffCount,
+ int SubscriptionPlanId, string? SubscriptionPlanName, string? PlanName,
DateTime CreatedAt, DateTime? VerifiedAt, DateTime? LastLoginAt,
List