zmena barvz do kosiku

This commit is contained in:
maja
2026-11-04 18:17:49 +01:00
parent 962aad7c86
commit 1a8a3ee563
3 changed files with 87 additions and 92 deletions

View File

@@ -19,8 +19,6 @@ else if (product == null)
<h3>Produkt nebyl nalezen.</h3>
}
else
{
{
<div class="detail-container">
<a href="/katalog" class="back-link">← Zpět do katalogu</a>
@@ -56,9 +54,7 @@ else
</div>
</div>
<button class="detail-cart-button"
<button class="product-cart-button"
disabled="@(product.StockQuantity <= 0)"
@onclick="() => HandleAddToCart(product)">
🛒 Přidat do košíku
@@ -68,7 +64,6 @@ else
</div>
</div>
}
}
@code {
[Parameter]
@@ -76,17 +71,6 @@ else
private Product? product;
private bool loading = true;
protected override async Task OnParametersSetAsync()
{
loading = true;
product = await DbContext.Products
.Include(p => p.Category)
.FirstOrDefaultAsync(p => p.Id == Id);
loading = false;
}
private string? cartToken;
protected override async Task OnInitializedAsync()
@@ -102,6 +86,17 @@ protected override async Task OnInitializedAsync()
}
}
protected override async Task OnParametersSetAsync()
{
loading = true;
product = await DbContext.Products
.Include(p => p.Category)
.FirstOrDefaultAsync(p => p.Id == Id);
loading = false;
}
private async Task HandleAddToCart(Product product)
{
if (string.IsNullOrWhiteSpace(cartToken))