shopping-assistant-web-client/ShoppingAssistantWebClient.Web/Pages/Cart.razor
2023-11-23 20:59:19 +00:00

67 lines
2.2 KiB
Plaintext

@page "/cart/{currentWishlistId}"
@inject NavigationManager navigationManager;
<head>
<link rel="stylesheet" href="css/Cart.css" />
</head>
<div class="cart">
<div class="head">
<div id="button_open" class="open_menu">
<a class="button_open_menu">
<span></span>
<span></span>
<span></span>
</a>
</div>
<p class="header-text">Cart</p>
</div>
<div class="container">
@if (!isError) {
@if (Products.Count > 0) {
@foreach (var product in Products) {
<div class="product-div">
@if(product.ImagesUrls != null && product.ImagesUrls.Length > 0) {
<img class="product-img" src="@product.ImagesUrls[0]" alt="product image">
}
else {
<img class="product-img" alt="product image">
}
<label class="product-description">@product.Name</label>
<div class="button-row">
<img class="star" src="/images/star.svg" alt="star">
<label class="rating">@product.Rating</label>
<label class="price-label">@product.Price</label>
</div>
<button class="button-amazon">
<img src="/images/amazon.svg" alt="amazon">
</button>
</div>
}
}
else {
<p class="error">Cart is empty</p>
}
}
else
{
<p class="error">Something went wrong<br>We are having some trouble loading the cart</p>
}
</div>
</div>
<script>
document.getElementById('button_open').addEventListener('click', changetyle);
</script>
@code
{
[Parameter] public string currentWishlistId {get; set; }
[Parameter] public string chatId {get; set; }
private void NavigateToMainPage()
{
navigationManager.NavigateTo($"/chat/{chatId}");
}
}