feat: full FrontOffice updates - discount store, blog, payment gateway, UI improvements
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 4m55s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 4m55s
- Discount store pages (products, cart, orders, order detail) - Blog pages and services - Payment gateway callback page - AppImage component, EmptyState, LoadingState, PageHeader - DiscountCartService, DiscountOrderService, DiscountProductService - BlogCategoryService, BlogPostService, SitePageService, ImageCacheService - PhoneVerifyForm component - Profile Hub page - UI/UX improvements across all pages - landing.js for homepage - Config and routing updates
This commit is contained in:
@@ -22,10 +22,11 @@ public partial class Index
|
||||
[Inject] private UserAddressContract.UserAddressContractClient UserAddressContract { get; set; } = default!;
|
||||
[Inject] private PackageContract.PackageContractClient PackageContract { get; set; } = default!;
|
||||
[Inject] private AuthService AuthService { get; set; } = default!;
|
||||
[Inject] private BlogPostService BlogPostService { get; set; } = default!;
|
||||
|
||||
private GetUserResponse _userProfile = new();
|
||||
private UpdateUserRequest _updateUserRequest = new();
|
||||
private readonly UpdateUserRequestValidator _personalValidator = new();
|
||||
private GetUserForCustomerResponse _userProfile = new();
|
||||
private BlogPostCardDto? _latestPost;
|
||||
private UpdateCustomerProfileRequest _updateUserRequest = new();
|
||||
|
||||
private MudForm? _personalForm;
|
||||
|
||||
@@ -45,6 +46,22 @@ public partial class Index
|
||||
private bool _showPurchaseBottomSheet;
|
||||
private bool _isProcessingPayment;
|
||||
|
||||
// Dashboard Tiles
|
||||
private readonly List<DashTile> _dashTiles = new()
|
||||
{
|
||||
new(RouteConstants.Profile.Personal, Icons.Material.Filled.Person, "اطلاعات شخصی", "نمایش و ویرایش", "background:rgba(99,102,241,.12); color:#6366f1;"),
|
||||
new(RouteConstants.Profile.Addresses, Icons.Material.Filled.LocationOn, "آدرسها", "مدیریت آدرسها", "background:rgba(99,102,241,.12); color:#6366f1;"),
|
||||
new(RouteConstants.Profile.Tree, Icons.Material.Filled.AccountTree, "شجرهنامه", "ساختار تیم", "background:rgba(99,102,241,.12); color:#6366f1;"),
|
||||
new(RouteConstants.Gateway.StoreChooser, Icons.Material.Filled.Store, "فروشگاهها", "ورود به فروشگاه", "background:rgba(16,185,129,.12); color:#10b981;"),
|
||||
new(RouteConstants.Profile.Wallet, Icons.Material.Filled.AccountBalanceWallet, "کیف پول", "مدیریت و تاریخچه", "background:rgba(16,185,129,.12); color:#10b981;"),
|
||||
new(RouteConstants.Profile.WithdrawalRequests, Icons.Material.Filled.RequestPage, "درخواست برداشت", "ثبت و پیگیری", "background:rgba(245,158,11,.12); color:#f59e0b;"),
|
||||
new(RouteConstants.Club.Membership, Icons.Material.Filled.CardMembership, "باشگاه مشتریان", "عضویت و مزایا", "background:rgba(168,85,247,.12); color:#a855f7;"),
|
||||
new(RouteConstants.Network.Statistics, Icons.Material.Filled.Groups, "آمار باشگاه", "جزئیات باشگاه", "background:rgba(59,130,246,.12); color:#3b82f6;"),
|
||||
new(RouteConstants.Commission.Dashboard, Icons.Material.Filled.Payments, "پاداش", "درآمد و تاریخچه", "background:rgba(16,185,129,.12); color:#10b981;"),
|
||||
};
|
||||
|
||||
private record DashTile(string Href, string Icon, string Title, string Subtitle, string AvatarStyle);
|
||||
|
||||
// Address management
|
||||
private List<CustomerAddressModel> _addresses = new();
|
||||
private bool _isLoadingAddresses;
|
||||
@@ -64,6 +81,7 @@ public partial class Index
|
||||
await LoadUserProfile();
|
||||
await LoadAddresses();
|
||||
await LoadWallet();
|
||||
await LoadLatestPost();
|
||||
|
||||
// نمایش Modal قرارداد باشگاه اگر پکیج خریده ولی باشگاه فعال نشده
|
||||
await CheckAndShowClubContractModal();
|
||||
@@ -134,19 +152,47 @@ public partial class Index
|
||||
|
||||
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
|
||||
|
||||
private async Task LoadLatestPost()
|
||||
{
|
||||
try
|
||||
{
|
||||
var posts = await BlogPostService.GetFeaturedPostsAsync(1);
|
||||
if (!posts.Any())
|
||||
{
|
||||
var result = await BlogPostService.GetPublishedPostsAsync(page: 1, pageSize: 1);
|
||||
posts = result.Posts;
|
||||
}
|
||||
_latestPost = posts.FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
_latestPost = null;
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task LoadUserProfile()
|
||||
{
|
||||
try
|
||||
{
|
||||
_userProfile = await UserContract.GetUserAsync(request: new());
|
||||
_updateUserRequest = _userProfile.Adapt<UpdateUserRequest>();
|
||||
_userProfile = await UserContract.GetUserForCustomerAsync(new());
|
||||
_updateUserRequest = new UpdateCustomerProfileRequest
|
||||
{
|
||||
FirstName = _userProfile.FirstName,
|
||||
LastName = _userProfile.LastName,
|
||||
Email = _userProfile.Email,
|
||||
NationalCode = _userProfile.NationalCode,
|
||||
};
|
||||
if (_userProfile.BirthDate != null)
|
||||
{
|
||||
_date = _userProfile.BirthDate.ToDateTime();
|
||||
_updateUserRequest.BirthDate = _userProfile.BirthDate;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle the case when user is not authenticated or API fails
|
||||
_userProfile = new GetUserResponse();
|
||||
_userProfile = new GetUserForCustomerResponse();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
@@ -168,7 +214,7 @@ public partial class Index
|
||||
if (_date != null)
|
||||
_updateUserRequest.BirthDate = _date.Value.DateTimeToTimestamp();
|
||||
|
||||
await UserContract.UpdateUserAsync(request: _updateUserRequest);
|
||||
await UserContract.UpdateCustomerProfileAsync(request: _updateUserRequest);
|
||||
await LoadUserProfile();
|
||||
Snackbar.Add("اطلاعات شخصی با موفقیت ذخیره شد.", Severity.Success);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user