feat: Add package management features and update checkout summary
- Added PackageService to handle package-related operations. - Introduced MyPackages and Packages pages for user package management. - Updated CheckoutSummary to display VAT calculations. - Enhanced OrderDetail to show financial details including VAT. - Added ChangePassword page for user profile management. - Implemented OrderTracking page for tracking order status. - Updated RouteConstants to include new routes for packages and password change.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace FrontOffice.Main.Pages.Profile;
|
||||
|
||||
public partial class ChangePassword : ComponentBase
|
||||
{
|
||||
private string _currentPassword = string.Empty;
|
||||
private string _newPassword = string.Empty;
|
||||
private string _confirmPassword = string.Empty;
|
||||
private string _error = string.Empty;
|
||||
private bool _saving;
|
||||
private bool _success;
|
||||
|
||||
private async Task ChangePasswordAsync()
|
||||
{
|
||||
_error = string.Empty;
|
||||
|
||||
// Validation
|
||||
if (string.IsNullOrWhiteSpace(_currentPassword))
|
||||
{
|
||||
_error = "رمز عبور فعلی را وارد کنید";
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(_newPassword))
|
||||
{
|
||||
_error = "رمز عبور جدید را وارد کنید";
|
||||
return;
|
||||
}
|
||||
|
||||
if (_newPassword.Length < 8)
|
||||
{
|
||||
_error = "رمز عبور جدید باید حداقل 8 کاراکتر باشد";
|
||||
return;
|
||||
}
|
||||
|
||||
if (_newPassword != _confirmPassword)
|
||||
{
|
||||
_error = "رمز عبور جدید و تکرار آن یکسان نیستند";
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentPassword == _newPassword)
|
||||
{
|
||||
_error = "رمز عبور جدید باید متفاوت از رمز فعلی باشد";
|
||||
return;
|
||||
}
|
||||
|
||||
_saving = true;
|
||||
try
|
||||
{
|
||||
// TODO: Call UserContract.ChangePasswordAsync when available
|
||||
// var request = new ChangePasswordRequest
|
||||
// {
|
||||
// CurrentPassword = _currentPassword,
|
||||
// NewPassword = _newPassword
|
||||
// };
|
||||
// await UserContract.ChangePasswordAsync(request);
|
||||
|
||||
// Simulate API call
|
||||
await Task.Delay(500);
|
||||
|
||||
_success = true;
|
||||
Snackbar.Add("رمز عبور با موفقیت تغییر کرد", Severity.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_error = ex.Message;
|
||||
Snackbar.Add($"خطا در تغییر رمز عبور: {ex.Message}", Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_saving = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user