diff --git a/src/FrontOffice.Main/Pages/PackageDetail.razor.cs b/src/FrontOffice.Main/Pages/PackageDetail.razor.cs index 2cf5251..dd55752 100644 --- a/src/FrontOffice.Main/Pages/PackageDetail.razor.cs +++ b/src/FrontOffice.Main/Pages/PackageDetail.razor.cs @@ -123,23 +123,14 @@ public partial class PackageDetail : IDisposable private async Task LoadReviewsAsync() { - // TODO: Load reviews from API - _reviews = new List - { - new() { UserName = "علی احمدی", Rating = 5, Comment = "عالی! کارمزد رو دقیق حساب می‌کنه و گزارش‌ها کامل هستن.", Date = "۱۴۰۲/۱۰/۰۵" }, - new() { UserName = "مریم رضایی", Rating = 4, Comment = "رابط کاربری خوبی داره، فقط سرعت بارگذاری می‌تونه بهتر بشه.", Date = "۱۴۰۲/۰۹/۲۲" }, - new() { UserName = "حسن کریمی", Rating = 5, Comment = "پشتیبانی فوق‌العاده سریع و حرفه‌ای داشتن. پیشنهاد می‌کنم.", Date = "۱۴۰۲/۰۹/۱۵" } - }; + // TODO: Load reviews from API when endpoint is available + _reviews = new List(); } private async Task LoadRelatedPackagesAsync() { - // TODO: Load related packages from API - _relatedPackages = new List - { - new() { Id = "2", Title = "پکیج رشد", ShortDescription = "مناسب برای تیم‌های در حال توسعه", Image = "images/package1.jpg", Pricing = new PricingInfo { FinalPrice = 750000 } }, - new() { Id = "3", Title = "پکیج حرفه‌ای", ShortDescription = "برای کسب‌وکارهای بزرگ", Image = "images/package2.jpg", Pricing = new PricingInfo { FinalPrice = 1200000 } } - }; + // TODO: Load related packages from API when endpoint is available + _relatedPackages = new List(); } private async Task PurchasePackage() diff --git a/src/FrontOffice.Main/Utilities/ClubMembershipService.cs b/src/FrontOffice.Main/Utilities/ClubMembershipService.cs index ae80b82..ef31f55 100644 --- a/src/FrontOffice.Main/Utilities/ClubMembershipService.cs +++ b/src/FrontOffice.Main/Utilities/ClubMembershipService.cs @@ -35,12 +35,12 @@ public class ClubMembershipService } catch { - // Fallback to mock data if backend is unavailable + // Return empty membership if backend is unavailable return new ClubMembershipDto { - UserId = 1, + UserId = 0, IsActive = false, - Status = "Inactive", + Status = string.Empty, DaysRemaining = null }; } diff --git a/src/FrontOffice.Main/Utilities/CommissionService.cs b/src/FrontOffice.Main/Utilities/CommissionService.cs index f230771..b45c498 100644 --- a/src/FrontOffice.Main/Utilities/CommissionService.cs +++ b/src/FrontOffice.Main/Utilities/CommissionService.cs @@ -65,8 +65,8 @@ public class CommissionService } catch { - // Fallback to mock data if backend is unavailable - return GenerateMockWeekDefinitions(); + // Return empty list if backend is unavailable + return new List(); } } @@ -129,8 +129,14 @@ public class CommissionService } catch { - // Fallback to mock data if backend is unavailable - return GenerateMockPayoutsResponse(weekDefinitionId, status, pageNumber, pageSize); + // Return empty response if backend is unavailable + return new CommissionPayoutsResponseDto + { + Payouts = new List(), + TotalCount = 0, + PageNumber = pageNumber, + PageSize = pageSize + }; } } @@ -175,22 +181,22 @@ public class CommissionService }; } - return CreateMockWeeklyBalance(); + return CreateEmptyWeeklyBalance(); } catch { - return CreateMockWeeklyBalance(); + return CreateEmptyWeeklyBalance(); } } #region Helper Methods - private static WeeklyBalanceDto CreateMockWeeklyBalance() + private static WeeklyBalanceDto CreateEmptyWeeklyBalance() { return new WeeklyBalanceDto { WeekDefinitionId = 0, - WeekDisplayName = "داده‌ای یافت نشد", + WeekDisplayName = string.Empty, LeftBalance = 0, RightBalance = 0, MinBalance = 0, @@ -198,94 +204,10 @@ public class CommissionService CalculatedCommission = 0, LeftCarryover = 0, RightCarryover = 0, - StartDate = DateTime.Now.AddDays(-7), - EndDate = DateTime.Now + StartDate = DateTime.MinValue, + EndDate = DateTime.MinValue }; } - private static CommissionPayoutsResponseDto GenerateMockPayoutsResponse( - long? weekDefinitionId, string? status, int pageNumber, int pageSize) - { - var allPayouts = GenerateMockPayouts(50); - - var filtered = allPayouts.AsEnumerable(); - if (weekDefinitionId.HasValue) - filtered = filtered.Where(p => p.WeekDefinitionId == weekDefinitionId.Value); - if (!string.IsNullOrEmpty(status)) - filtered = filtered.Where(p => p.Status == status); - - var total = filtered.Count(); - var paged = filtered.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList(); - - return new CommissionPayoutsResponseDto - { - Payouts = paged, - TotalCount = total, - PageNumber = pageNumber, - PageSize = pageSize - }; - } - - private static List GenerateMockPayouts(int count) - { - var payouts = new List(); - var random = new Random(); - var statusTexts = new[] { "ایجاد شده", "پرداخت شده", "درخواست برداشت", "برداشت شده", "لغو شده" }; - var statusColors = new[] { "Info", "Success", "Warning", "Success", "Error" }; - - for (int i = 0; i < count; i++) - { - var statusIndex = random.Next(statusTexts.Length); - var weekNum = 50 - i; - var balances = random.Next(5, 20); - var amount = balances * 100_000; - - payouts.Add(new CommissionPayoutDto - { - Id = i + 1, - WeekDefinitionId = i + 1, - WeekDisplayName = $"هفته {weekNum} - سال 1404", - BalancesEarned = balances, - TotalAmount = amount, - AmountFormatted = $"{amount:N0} تومان", - Status = statusTexts[statusIndex], - StatusBadgeColor = statusColors[statusIndex], - DatePersian = DateTime.Now.AddDays(-i * 7).ToString("yyyy/MM/dd") - }); - } - - return payouts; - } - - private static List GenerateMockWeekDefinitions() - { - var weeks = new List(); - var persianOrdinals = new[] { "یکم", "دوم", "سوم", "چهارم", "پنجم", "ششم", "هفتم", "هشتم", "نهم", "دهم" }; - - // Generate 10 weeks starting from week 46 - for (int i = 0; i < 10; i++) - { - var weekOrder = i + 1; - var startDate = new DateTime(2025, 11, 8).AddDays(i * 7); - - weeks.Add(new WeekDefinitionDto - { - Id = i + 1, - WeekOrder = weekOrder, - DisplayName = weekOrder <= 10 ? $"هفته {persianOrdinals[weekOrder - 1]}" : $"هفته {weekOrder}", - StartDate = startDate, - EndDate = startDate.AddDays(6), - GregorianYear = 2025, - PersianYear = 1404, - IsActive = true, - IsCurrentWeek = weekOrder == 6, // Assume week 6 is current - StartDatePersian = $"1404/{8 + i}/17", - EndDatePersian = $"1404/{8 + i}/23" - }); - } - - return weeks; - } - #endregion } diff --git a/src/FrontOffice.Main/Utilities/NetworkMembershipService.cs b/src/FrontOffice.Main/Utilities/NetworkMembershipService.cs index 3e0db42..d5db454 100644 --- a/src/FrontOffice.Main/Utilities/NetworkMembershipService.cs +++ b/src/FrontOffice.Main/Utilities/NetworkMembershipService.cs @@ -36,8 +36,13 @@ public class NetworkMembershipService } catch { - // Fallback to mock data if backend is unavailable - return CreateMockTree(); + // Return empty tree if backend is unavailable + return new NetworkTreeDto + { + CurrentDepth = 0, + TotalMembers = 0, + RootNode = null + }; } } @@ -102,21 +107,15 @@ public class NetworkMembershipService } catch { - // Fallback to mock data if backend is unavailable + // Return empty statistics if backend is unavailable return new NetworkStatisticsDto { - LeftLegCount = 15, - RightLegCount = 12, - TotalMembers = 27, - TreeDepth = 4, - WeakerLeg = "Right", - LastMember = new LastMemberDto - { - UserId = 28, - FullName = "محمد رضایی", - Position = "Left", - JoinedAt = DateTime.Now.AddHours(-2) - } + LeftLegCount = 0, + RightLegCount = 0, + TotalMembers = 0, + TreeDepth = 0, + WeakerLeg = string.Empty, + LastMember = null }; } } @@ -144,76 +143,5 @@ public class NetworkMembershipService }; } - private static NetworkTreeDto CreateMockTree() - { - return new NetworkTreeDto - { - CurrentDepth = 3, - TotalMembers = 7, - RootNode = new NetworkNodeDto - { - UserId = 1, - FullName = "شما", - Mobile = "09121234567", - Position = "Root", - Level = 0, - IsActive = true, - IsClubActive = true, - LeftChild = new NetworkNodeDto - { - UserId = 2, - FullName = "علی محمدی", - Mobile = "09121234568", - Position = "Left", - Level = 1, - IsActive = true, - IsClubActive = true, - JoinedAt = DateTime.Now.AddDays(-30), - LeftChild = new NetworkNodeDto - { - UserId = 4, - FullName = "رضا کریمی", - Mobile = "09121234570", - Position = "Left", - Level = 2, - IsActive = true, - JoinedAt = DateTime.Now.AddDays(-15) - }, - RightChild = new NetworkNodeDto - { - UserId = 5, - FullName = "زهرا احمدی", - Mobile = "09121234571", - Position = "Right", - Level = 2, - IsActive = false, - JoinedAt = DateTime.Now.AddDays(-10) - } - }, - RightChild = new NetworkNodeDto - { - UserId = 3, - FullName = "فاطمه حسینی", - Mobile = "09121234569", - Position = "Right", - Level = 1, - IsActive = true, - JoinedAt = DateTime.Now.AddDays(-25), - LeftChild = new NetworkNodeDto - { - UserId = 6, - FullName = "محمد نوری", - Mobile = "09121234572", - Position = "Left", - Level = 2, - IsActive = true, - IsClubActive = true, - JoinedAt = DateTime.Now.AddDays(-5) - } - } - } - }; - } - #endregion } diff --git a/src/FrontOffice.Main/Utilities/PackageService.cs b/src/FrontOffice.Main/Utilities/PackageService.cs index d83d735..c79bc6c 100644 --- a/src/FrontOffice.Main/Utilities/PackageService.cs +++ b/src/FrontOffice.Main/Utilities/PackageService.cs @@ -104,12 +104,11 @@ public class PackageService } /// - /// Get user's package purchase status (Mock for now - needs BFF implementation) + /// Get user's package purchase status /// public Task GetUserPackageStatusAsync(CancellationToken ct = default) { // TODO: Connect to GetUserPackageStatus RPC when available in FrontOffice.BFF - // For now, return a mock status return Task.FromResult(new UserPackageStatusDto( HasPurchasedPackage: false, PurchaseMethod: null, diff --git a/src/FrontOffice.Main/Utilities/WalletService.cs b/src/FrontOffice.Main/Utilities/WalletService.cs index 6f03ef9..781729b 100644 --- a/src/FrontOffice.Main/Utilities/WalletService.cs +++ b/src/FrontOffice.Main/Utilities/WalletService.cs @@ -32,8 +32,8 @@ public class WalletService } catch { - // Fallback to mock data if backend is unavailable - return new WalletBalances(350_000, 0, 1_250_000); + // Return zero balances if backend is unavailable + return new WalletBalances(0, 0, 0); } } @@ -62,15 +62,8 @@ public class WalletService } catch { - // Fallback to mock data if backend is unavailable - var _transactions = new List - { - new(DateTime.Now.AddDays(-1).ToString(), 500_000, "درگاه بانکی", "شارژ کیف پول"), - new(DateTime.Now.AddDays(-2).ToString(), 200_000, "شبکه/معرف", "پاداش شبکه"), - new(DateTime.Now.AddDays(-4).ToString(), -120_000, "خرید", "برداشت بابت سفارش #1452"), - new(DateTime.Now.AddDays(-9).ToString(), 900_000, "کیف پول شرکای تجاری", "اعتبار خرید"), - }; - return _transactions.OrderByDescending(t => t.Date).ToList(); + // Return empty list if backend is unavailable + return new List(); } } @@ -158,7 +151,8 @@ public class WalletService } catch { - return new WithdrawalSettings(1_000_000); + // Return default settings if backend is unavailable + return new WithdrawalSettings(0); } } }