Completed Cart page design
continuous-integration/drone/pr Build is passing

This commit is contained in:
Khwezi Mngoma
2026-06-11 00:23:57 +02:00
parent 64e0fcba27
commit e7acb05027
7 changed files with 125 additions and 95 deletions
@@ -14,6 +14,9 @@ public sealed class CartService(LocalStorageService localStorage)
public event Action? OnCartChanged;
public static Func<Cart, long, int> GetCartItemQuantity = (shoppingCart, productPriceId) =>
shoppingCart.Items.FirstOrDefault(p => p.Price!.Id == productPriceId)?.Quantity ?? 1;
public Cart GetCart() => ShoppingCart;
public void NotifyStateChanged() => OnCartChanged?.Invoke();
@@ -123,7 +126,7 @@ public sealed class CartService(LocalStorageService localStorage)
{
if(ShoppingCart.CustomerId is not null || ShoppingCart.OrderId is not null)
{
ShoppingCart.TotalPrice = 0;
ShoppingCart.TotalAmount = 0;
ShoppingCart.TotalVat = 0;
ShoppingCart.Items.Clear();
@@ -143,8 +146,8 @@ public sealed class CartService(LocalStorageService localStorage)
if (!ShoppingCart.IsVatInclusive) ShoppingCart.TotalVat = gross * ShoppingCart.VatRate;
ShoppingCart.TotalPrice = gross + ShoppingCart.TotalVat;
ShoppingCart.TotalAmount = gross + ShoppingCart.TotalVat;
return ShoppingCart.TotalPrice;
return ShoppingCart.TotalAmount;
}
}
@@ -6,7 +6,7 @@ public sealed class Cart
public long? OrderId { get; set; }
public decimal TotalPrice { get; set; }
public decimal TotalAmount { get; set; }
public decimal TotalVat { get; set; }