This commit is contained in:
MeysamMoghaddam
2025-10-13 09:23:10 +03:30
parent b9a0cdff83
commit 980bdb45be
4 changed files with 303 additions and 54 deletions

View File

@@ -64,7 +64,7 @@
<!-- Personal Information Tab -->
<MudTabPanel Text="اطلاعات شخصی" Icon="@Icons.Material.Filled.Person">
<div class="pa-4">
<MudForm @ref="_personalForm" Model="_userProfile" Validation="@((Func<object, IEnumerable<FluentValidation.Results.ValidationFailure>>)((model) => _personalValidator.Validate((UserProfile)model).Errors))">
<MudForm @ref="_personalForm" Model="_userProfile" Validation="@(_personalValidator.ValidateValue)">
<MudGrid Spacing="3">
<MudItem xs="12" md="6">
<MudTextField @bind-Value="_updateUserRequest.FirstName"
@@ -107,6 +107,82 @@
</div>
</MudTabPanel>
<!-- Address Management Tab -->
<MudTabPanel Text="آدرس‌ها" Icon="@Icons.Material.Filled.LocationOn">
<div class="pa-4">
<MudStack Spacing="4">
<!-- Add New Address Button -->
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
<MudText Typo="Typo.subtitle1" Class="fw-600">آدرس‌های شما</MudText>
<MudButton Variant="Variant.Filled"
Color="Color.Primary"
StartIcon="@Icons.Material.Filled.Add"
OnClick="OpenAddAddressDialog">
افزودن آدرس جدید
</MudButton>
</MudStack>
<!-- Address List -->
@if (_isLoadingAddresses)
{
<MudStack AlignItems="AlignItems.Center" Class="py-8">
<MudProgressCircular Color="Color.Primary" Indeterminate="true" Size="Size.Large" />
<MudText Typo="Typo.body1" Class="mud-text-secondary mt-2">در حال بارگذاری آدرس‌ها...</MudText>
</MudStack>
}
else if (_addresses.Any())
{
<MudStack Spacing="3">
@foreach (var address in _addresses)
{
<MudPaper Elevation="2" Class="pa-4 rounded-xl mud-theme-surface">
<MudStack Spacing="3">
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Start">
<MudStack Spacing="1">
<MudStack Row="true" Spacing="2" AlignItems="AlignItems.Center">
<MudText Typo="Typo.h6" Class="fw-600">@address.Title</MudText>
@if (address.IsDefault)
{
<MudChip T="string" Color="Color.Success" Variant="Variant.Filled" Size="Size.Small">پیش‌فرض</MudChip>
}
</MudStack>
<MudText Typo="Typo.body2" Class="mud-text-secondary">@address.Address</MudText>
<MudText Typo="Typo.caption" Class="mud-text-secondary">کد پستی: @address.PostalCode</MudText>
</MudStack>
<MudMenu Icon="@Icons.Material.Filled.MoreVert" Size="Size.Small" AnchorOrigin="Origin.TopRight">
<MudMenuItem OnClick="@(() => OpenEditAddressDialog(address))">ویرایش</MudMenuItem>
@if (!address.IsDefault)
{
<MudMenuItem OnClick="@(() => SetAsDefaultAddress(address.Id))">تنظیم به عنوان پیش‌فرض</MudMenuItem>
}
<MudDivider />
<MudMenuItem OnClick="@(() => DeleteAddress(address.Id))" Class="mud-text-error">حذف</MudMenuItem>
</MudMenu>
</MudStack>
</MudStack>
</MudPaper>
}
</MudStack>
}
else
{
<MudStack AlignItems="AlignItems.Center" Class="py-8">
<MudIcon Icon="@Icons.Material.Filled.LocationOff" Size="Size.Large" Color="Color.Default" />
<MudText Typo="Typo.body1" Class="mud-text-secondary mt-2">هنوز آدرسی ثبت نکرده‌اید.</MudText>
<MudButton Variant="Variant.Outlined"
Color="Color.Primary"
StartIcon="@Icons.Material.Filled.Add"
OnClick="OpenAddAddressDialog"
Class="mt-2">
افزودن اولین آدرس
</MudButton>
</MudStack>
}
</MudStack>
</div>
</MudTabPanel>
<!-- Account Settings Tab -->
<MudTabPanel Text="تنظیمات حساب" Icon="@Icons.Material.Filled.Settings">
<div class="pa-4">