cartItem one2one relation to shopitem

This commit is contained in:
2025-03-04 11:30:26 +01:00
parent 5e22be5074
commit 23392cc5c1
6 changed files with 494 additions and 203 deletions

View File

@@ -7,13 +7,12 @@
<div class="h-[460px] rounded-lg bg-gray-300 dark:bg-gray-700 mb-4">
<img class="w-full h-full object-cover" src="/{{ .data.shopItem.Image}}" alt="Product Image">
</div>
<div class="flex -mx-2 mb-4">
<form action="/cart" method="POST">
<input type="hidden" id="{{ .data.shopItem.ID}}" name="ShopItemId" value="{{ .data.shopItem.ID }}">
<div class="flex -mx-2 mb-4">
<input type="hidden" id="{{ .data.shopItem.ID}}" name="ShopItemId" value="{{ .data.shopItem.ID }}">
<div class="w-1/3 px-2">
<button type="submit" class="w-full bg-gray-900 dark:bg-gray-600 text-white py-2 px-4 rounded-full font-bold hover:bg-gray-800 dark:hover:bg-gray-700">Add to Cart</button>
</div>
</form>
{{ if .loggedIn }}
<div class="w-1/3 px-2">
@@ -25,6 +24,7 @@
</div>
{{ end }}
</div>
</form>
</div>
<div class="md:flex-1 px-4">
<h2 class="text-2xl font-bold text-gray-800 dark:text-white mb-2">{{ .data.shopItem.Name }}</h2>