eab978188a
- Changed Protobuf imports from FrontOffice.BFF to CMSMicroservice in Profile components (EditAddressDialog, Index, PaymentCallback, Personal, Settings). - Updated CheckoutSummary, OrderDetail, OrderTracking, and Orders pages to use new UserOrder Protobuf definitions. - Refactored WalletService, PackageService, and other utility services to align with new Protobuf structure. - Adjusted appsettings.json for local development URL. - Removed unused validators and simplified validation logic in AuthDialog. - Enhanced ClubMembershipContractDialog to utilize new OtpToken service for OTP handling.
61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using System;
|
|
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
|
using FrontOffice.Main.Utilities;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Messages = CMSMicroservice.Protobuf.Protos;
|
|
using MudBlazor;
|
|
|
|
namespace FrontOffice.Main.Pages.Store;
|
|
|
|
public partial class Orders : ComponentBase
|
|
{
|
|
[Inject] private OrderService OrderService { get; set; } = default!;
|
|
[Inject] private VATService VAT { get; set; } = default!;
|
|
|
|
private List<GetUserOrderResponse> _orders = new();
|
|
private bool _loading;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
_loading = true;
|
|
try
|
|
{
|
|
_orders = await OrderService.GetOrdersAsync();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Snackbar.Add($"خطا در بارگذاری سفارشها: {ex.Message}", Severity.Error);
|
|
_orders = new List<GetUserOrderResponse>();
|
|
}
|
|
finally
|
|
{
|
|
_loading = false;
|
|
}
|
|
}
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
{
|
|
// بارگذاری نرخ VAT
|
|
await VAT.LoadAsync();
|
|
}
|
|
await base.OnAfterRenderAsync(firstRender);
|
|
}
|
|
|
|
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
|
|
|
|
|
|
private string GetStatusText(Messages.PaymentStatus contextPaymentStatus)
|
|
{
|
|
return contextPaymentStatus switch
|
|
{
|
|
Messages.PaymentStatus.Pending => "در انتظار پرداخت",
|
|
Messages.PaymentStatus.Success => "پرداخت شده",
|
|
Messages.PaymentStatus.Reject => "پرداخت ناموفق",
|
|
_ => "نامشخص",
|
|
};
|
|
}
|
|
}
|
|
|