feat: add withdrawal requests feature and update VAT loading mechanism
Build and Deploy / build (push) Successful in 1m25s

This commit is contained in:
masoodafar-web
2025-12-20 04:03:11 +03:30
parent 9ee464b8b4
commit 025e8d3c3e
24 changed files with 961 additions and 398 deletions
+10 -1
View File
@@ -16,7 +16,16 @@ public partial class Cart : ComponentBase, IDisposable
// لود سبد خرید (فقط اگر کاربر لاگین کرده باشد)
await CartService.EnsureInitializedAsync();
CartService.OnChange += StateHasChanged;
await VAT.LoadAsync();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// بارگذاری نرخ VAT
await VAT.LoadAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
private async Task IncrementQty(long productId)
@@ -30,7 +30,16 @@ public partial class CheckoutSummary : ComponentBase
await Cart.EnsureInitializedAsync();
await LoadAddresses();
await LoadWalletBalance();
await VAT.LoadAsync();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// بارگذاری نرخ VAT
await VAT.LoadAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
private async Task LoadWalletBalance()
@@ -79,7 +88,7 @@ public partial class CheckoutSummary : ComponentBase
{
var request = new SubmitShopBuyOrderRequest
{
TotalAmount = Cart.Total
TotalAmount = VAT.AddVAT(Cart.Total)
};
var response = await UserOrderContract.SubmitShopBuyOrderAsync(request);
@@ -19,7 +19,6 @@ public partial class Orders : ComponentBase
_loading = true;
try
{
await VAT.LoadAsync();
_orders = await OrderService.GetOrdersAsync();
}
catch (Exception ex)
@@ -33,6 +32,16 @@ public partial class Orders : ComponentBase
}
}
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);
@@ -30,7 +30,7 @@ public partial class ProductDetail : ComponentBase, IDisposable
private IReadOnlyList<ProductCategoryPathInfo> _categoryPaths = Array.Empty<ProductCategoryPathInfo>();
private ProductGalleryImage? _selectedGalleryImage;
private readonly List<BreadcrumbItem> _breadcrumbItems = new();
private long TotalPrice => VAT.AddVAT((_product?.Price ?? 0) * _qty);
private long TotalPrice => (_product?.Price ?? 0) * _qty;
private bool HasDiscount => _product is { Discount: > 0 and < 100 };
private long? OriginalPrice => HasDiscount && _product is not null
@@ -55,8 +55,7 @@ public partial class ProductDetail : ComponentBase, IDisposable
await Cart.EnsureInitializedAsync();
Cart.OnChange += HandleCartChanged;
// بارگذاری نرخ VAT
await VAT.LoadAsync();
_loading = true;
_product = await ProductService.GetByIdAsync(id);
@@ -80,7 +79,15 @@ public partial class ProductDetail : ComponentBase, IDisposable
await base.OnInitializedAsync();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
if (firstRender)
{
// بارگذاری نرخ VAT
await VAT.LoadAsync();
}
}
private async Task AddToCart()
{
@@ -26,10 +26,19 @@ public partial class Products : ComponentBase, IDisposable
await Cart.EnsureInitializedAsync();
Cart.OnChange += StateHasChanged;
Navigation.LocationChanged += HandleLocationChanged;
await VAT.LoadAsync();
await Load();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// بارگذاری نرخ VAT
await VAT.LoadAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
private async Task Load()
{
_loading = true;