u
This commit is contained in:
@@ -70,18 +70,14 @@
|
||||
<MudTextField @bind-Value="_updateUserRequest.FirstName"
|
||||
For="@(() => _updateUserRequest.FirstName)"
|
||||
Label="نام"
|
||||
Variant="Variant.Outlined"
|
||||
Required="true"
|
||||
RequiredError="وارد کردن نام الزامی است." />
|
||||
Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField @bind-Value="_updateUserRequest.LastName"
|
||||
For="@(() => _updateUserRequest.LastName)"
|
||||
Label="نام خانوادگی"
|
||||
Variant="Variant.Outlined"
|
||||
Required="true"
|
||||
RequiredError="وارد کردن نام خانوادگی الزامی است." />
|
||||
Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" md="6">
|
||||
@@ -91,6 +87,15 @@
|
||||
Variant="Variant.Outlined"
|
||||
InputType="InputType.Text" />
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" md="6">
|
||||
<MudDatePicker Label="تاریخ تولد"
|
||||
@bind-Date="_date"
|
||||
OpenTo="OpenTo.Year"
|
||||
Variant="Variant.Outlined"
|
||||
Culture="@Extensions.GetPersianCulture()"
|
||||
TitleDateFormat="dddd, dd MMMM" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
||||
<MudStack Row="true" Spacing="2" Justify="Justify.FlexEnd" Class="mt-4">
|
||||
@@ -103,61 +108,66 @@
|
||||
</MudTabPanel>
|
||||
|
||||
<!-- Account Settings Tab -->
|
||||
@* <MudTabPanel Text="تنظیمات حساب" Icon="@Icons.Material.Filled.Settings">
|
||||
<div class="pa-4">
|
||||
<MudText Typo="Typo.h6" Class="mb-4 mud-typography-subtitle1">تنظیمات حساب</MudText>
|
||||
<MudTabPanel Text="تنظیمات حساب" Icon="@Icons.Material.Filled.Settings">
|
||||
<div class="pa-4">
|
||||
|
||||
<MudStack Spacing="4">
|
||||
<!-- Notification Settings -->
|
||||
<MudPaper Outlined="true" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-3 fw-600">اعلانها</MudText>
|
||||
<MudStack Spacing="2">
|
||||
<MudSwitch T="bool" @bind-Checked="_settings.EmailNotifications" Label="اعلانهای ایمیلی" />
|
||||
<MudSwitch T="bool" @bind-Checked="_settings.SmsNotifications" Label="اعلانهای پیامکی" />
|
||||
<MudSwitch T="bool" @bind-Checked="_settings.PushNotifications" Label="اعلانهای پوش" />
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
<MudStack Spacing="4">
|
||||
<!-- Notification Settings -->
|
||||
<MudPaper Outlined="true" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-3 fw-600">اعلانها</MudText>
|
||||
<MudStack Spacing="2">
|
||||
<MudSwitch T="bool"
|
||||
@bind-Value="_updateUserRequest.EmailNotifications"
|
||||
Color="Color.Primary"
|
||||
Label="اعلانهای ایمیلی" />
|
||||
<MudSwitch T="bool"
|
||||
@bind-Value="_updateUserRequest.SmsNotifications"
|
||||
Color="Color.Primary"
|
||||
Label="اعلانهای پیامکی" />
|
||||
<MudSwitch T="bool"
|
||||
@bind-Value="_updateUserRequest.PushNotifications"
|
||||
Color="Color.Primary"
|
||||
Label="اعلانهای پوش" />
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
@*
|
||||
<!-- Privacy Settings -->
|
||||
<MudPaper Outlined="true" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-3 fw-600">حریم خصوصی</MudText>
|
||||
<MudStack Spacing="2">
|
||||
<MudSwitch T="bool" @bind-Checked="_settings.ProfileVisibility" Label="نمایش پروفایل عمومی" />
|
||||
<MudSwitch T="bool" @bind-Checked="_settings.ShowOnlineStatus" Label="نمایش وضعیت آنلاین" />
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
|
||||
<!-- Privacy Settings -->
|
||||
<MudPaper Outlined="true" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-3 fw-600">حریم خصوصی</MudText>
|
||||
<MudStack Spacing="2">
|
||||
<MudSwitch T="bool" @bind-Checked="_settings.ProfileVisibility" Label="نمایش پروفایل عمومی" />
|
||||
<MudSwitch T="bool" @bind-Checked="_settings.ShowOnlineStatus" Label="نمایش وضعیت آنلاین" />
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
<!-- Language & Theme -->
|
||||
<MudPaper Outlined="true" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-3 fw-600">زبان و تم</MudText>
|
||||
<MudGrid Spacing="3">
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="_settings.Language" Label="زبان" Variant="Variant.Outlined">
|
||||
<MudSelectItem Value="@("fa")">فارسی</MudSelectItem>
|
||||
<MudSelectItem Value="@("en")">English</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="_settings.Theme" Label="تم" Variant="Variant.Outlined">
|
||||
<MudSelectItem Value="@("light")">روشن</MudSelectItem>
|
||||
<MudSelectItem Value="@("dark")">تیره</MudSelectItem>
|
||||
<MudSelectItem Value="@("auto")">خودکار</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper> *@
|
||||
|
||||
<!-- Language & Theme -->
|
||||
<MudPaper Outlined="true" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-3 fw-600">زبان و تم</MudText>
|
||||
<MudGrid Spacing="3">
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="_settings.Language" Label="زبان" Variant="Variant.Outlined">
|
||||
<MudSelectItem Value="@("fa")">فارسی</MudSelectItem>
|
||||
<MudSelectItem Value="@("en")">English</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="_settings.Theme" Label="تم" Variant="Variant.Outlined">
|
||||
<MudSelectItem Value="@("light")">روشن</MudSelectItem>
|
||||
<MudSelectItem Value="@("dark")">تیره</MudSelectItem>
|
||||
<MudSelectItem Value="@("auto")">خودکار</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
|
||||
<MudStack Row="true" Spacing="2" Justify="Justify.FlexEnd">
|
||||
<MudButton Variant="Variant.Outlined" Color="Color.Secondary" OnClick="CancelSettingsChanges">
|
||||
لغو
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="SaveSettings" Disabled="_isSettingsSaving">
|
||||
ذخیره تنظیمات
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</div>
|
||||
</MudTabPanel> *@
|
||||
<MudStack Row="true" Spacing="2" Justify="Justify.FlexEnd">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="SaveSettings" Disabled="_isSettingsSaving">
|
||||
ذخیره تنظیمات
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</div>
|
||||
</MudTabPanel>
|
||||
|
||||
<!-- Statistics Tab -->
|
||||
@* <MudTabPanel Text="آمار و اطلاعات" Icon="@Icons.Material.Filled.BarChart">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using FluentValidation;
|
||||
using FrontOffice.BFF.User.Protobuf.Protos.User;
|
||||
using FrontOffice.Main.Utilities;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
@@ -24,14 +25,13 @@ public partial class Index
|
||||
private string _copyMessage = string.Empty;
|
||||
|
||||
private readonly UserProfileValidator _personalValidator = new();
|
||||
|
||||
private DateTime? _date;
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
if(firstRender)
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadUserProfile();
|
||||
await LoadAccountSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public partial class Index
|
||||
{
|
||||
_userProfile = await UserContract.GetUserAsync(request: new());
|
||||
_updateUserRequest = _userProfile.Adapt<UpdateUserRequest>();
|
||||
if (_userProfile.BirthDate != null)
|
||||
_date = _userProfile.BirthDate.ToDateTime();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -51,21 +53,6 @@ public partial class Index
|
||||
}
|
||||
|
||||
|
||||
private async Task LoadAccountSettings()
|
||||
{
|
||||
// TODO: Load settings from API
|
||||
//_settings = new AccountSettings
|
||||
//{
|
||||
// EmailNotifications = true,
|
||||
// SmsNotifications = true,
|
||||
// PushNotifications = false,
|
||||
// ProfileVisibility = true,
|
||||
// ShowOnlineStatus = true,
|
||||
// Language = "fa",
|
||||
// Theme = "light"
|
||||
//};
|
||||
}
|
||||
|
||||
private async Task SavePersonalInfo()
|
||||
{
|
||||
if (_personalForm is null) return;
|
||||
@@ -77,6 +64,9 @@ public partial class Index
|
||||
|
||||
try
|
||||
{
|
||||
if (_date != null)
|
||||
_updateUserRequest.BirthDate = _date.Value.DateTimeToTimestamp();
|
||||
|
||||
await UserContract.UpdateUserAsync(request: _updateUserRequest);
|
||||
await LoadUserProfile();
|
||||
Snackbar.Add("اطلاعات شخصی با موفقیت ذخیره شد.", Severity.Success);
|
||||
@@ -105,8 +95,8 @@ public partial class Index
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: Save settings to API
|
||||
await Task.Delay(1000); // Simulate API call
|
||||
|
||||
await SavePersonalInfo();
|
||||
|
||||
Snackbar.Add("تنظیمات با موفقیت ذخیره شد.", Severity.Success);
|
||||
}
|
||||
@@ -121,12 +111,6 @@ public partial class Index
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelSettingsChanges()
|
||||
{
|
||||
// TODO: Reset settings to original values
|
||||
Snackbar.Add("تغییرات تنظیمات لغو شد.", Severity.Info);
|
||||
}
|
||||
|
||||
private async Task CopyReferralCode()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user