u
This commit is contained in:
@@ -90,11 +90,20 @@
|
||||
<MudStack Spacing="1">
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||
<MudRadio T="long" Value="address.Id" Checked="@(_selectedAddress?.Id == address.Id)" />
|
||||
<MudText Typo="Typo.subtitle2" >@address.Title</MudText>
|
||||
@if (address.IsDefault)
|
||||
<MudText Typo="Typo.subtitle2">@address.Title</MudText>
|
||||
@if (address.IsDefault)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Variant="Variant.Filled" Size="Size.Small">پیشفرض</MudChip>
|
||||
}
|
||||
@if (!address.IsDefault)
|
||||
{
|
||||
<MudButton Variant="Variant.Text"
|
||||
Color="Color.Primary"
|
||||
Size="Size.Small"
|
||||
OnClick="() => SetAddressAsDefault(address.Id)">
|
||||
تنظیم به عنوان پیشفرض
|
||||
</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">@address.Address</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">کد پستی: @address.PostalCode</MudText>
|
||||
|
||||
@@ -102,6 +102,20 @@ public partial class Checkout
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task SetAddressAsDefault(long addressId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await UserAddressContract.SetAddressAsDefaultAsync(new() { Id = addressId });
|
||||
await LoadAddresses(); // Reload addresses to reflect the change
|
||||
Snackbar.Add("آدرس پیشفرض با موفقیت تغییر یافت.", Severity.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"خطا در تغییر آدرس پیشفرض: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ApplyDiscountCode()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_discountCode))
|
||||
|
||||
Reference in New Issue
Block a user