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,70 @@
|
||||
using FrontOffice.Main.Utilities;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace FrontOffice.Main.Pages.Package;
|
||||
|
||||
public partial class MyPackages : ComponentBase
|
||||
{
|
||||
[Inject] private PackageService PackageService { get; set; } = default!;
|
||||
|
||||
private UserPackageStatusDto? _userStatus;
|
||||
private bool _isLoading = true;
|
||||
|
||||
private List<BreadcrumbItem> _breadcrumbItems = new()
|
||||
{
|
||||
new BreadcrumbItem("صفحه اصلی", RouteConstants.Main.MainPage),
|
||||
new BreadcrumbItem("پروفایل", RouteConstants.Profile.Index),
|
||||
new BreadcrumbItem("پکیجهای من", null, disabled: true)
|
||||
};
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadDataAsync();
|
||||
}
|
||||
|
||||
private async Task LoadDataAsync()
|
||||
{
|
||||
_isLoading = true;
|
||||
|
||||
try
|
||||
{
|
||||
_userStatus = await PackageService.GetUserPackageStatusAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine($"Error loading user package status: {ex.Message}");
|
||||
#endif
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetPurchaseMethodText(string? method)
|
||||
{
|
||||
return method switch
|
||||
{
|
||||
"DayaLoan" => "وام دایا",
|
||||
"DirectPurchase" => "پرداخت مستقیم",
|
||||
_ => "نامشخص"
|
||||
};
|
||||
}
|
||||
|
||||
private static Color GetPurchaseMethodColor(string? method)
|
||||
{
|
||||
return method switch
|
||||
{
|
||||
"DayaLoan" => Color.Info,
|
||||
"DirectPurchase" => Color.Success,
|
||||
_ => Color.Default
|
||||
};
|
||||
}
|
||||
|
||||
private static string FormatPrice(long price)
|
||||
{
|
||||
return string.Format("{0:N0} تومان", price);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user