{{ template "header.html" . }}

<div class="bg-gray-100 py-8">
                  <form action="/cart" method="POST">
    <div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
        <div class="flex flex-col md:flex-row -mx-4">
            <div class="md:flex-1 px-4">
                <div class="rounded-lg bg-gray-300 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">
    {{ if .loggedIn }}
                  <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 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 ">Add to Cart</button>
                    </div>
    {{ end }}

                    <div class="w-1/3 px-2">
                      <button type="button" class="w-full bg-blue-900 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 "><a href="/{{ .data.shopItem.Pdf }}">View</a></button>
                    </div>

    {{ if .isAdmin }}
                    <div class="w-1/3 px-2">
                      <button type="button" class="w-full bg-blue-900 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 "><a href="{{ .data.shopItem.ID }}/edit">Edit</a></button>
                    </div>

                    <div class="w-1/3 px-2">
                      <button type="button" class="w-full bg-red-900 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 "><a href="{{ .data.shopItem.ID }}/delete">Delete</a></button>
                    </div>
    {{ end }}
                </div>
            </div>
            <div class="md:flex-1 px-4">
              <h2 class="text-2xl font-bold text-gray-800 ">{{ .data.shopItem.Name }}</h2>
                <p class="text-gray-600 text-sm mb-4">
                  {{ .data.shopItem.Abstract }}
                </p>

    {{ if .loggedIn }}
                <div class="flex mb-4">
                    <label for="ItemVariantId" class="block mb-2 text-sm font-medium text-gray-900 "></label>
                      <select name="ItemVariantId" id="ItemVariantId" required class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 ">
                        <option selected value="">Choose a variant</option>
                  {{ range .data.shopItem.Variants }}
                    <option value="{{ .ID }}">{{ .Name }} - {{ .Price }}€</option>
                  {{ end }}
                      </select>
                </div>
    {{ end }}

                <div class="flex mb-4">
                    <div class="mr-4">
                        <span class="font-bold text-gray-700 ">Tags:</span>
                          <p class="mt-1 text-sm text-gray-500">
                            {{ range .data.shopItem.Tags }}
                            <a href="/tags/{{ .ID }}"><span class="bg-{{ .Color }}-100 text-{{ .Color }}-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-sm ">{{ .Name }}</span></a>
                            {{ end }}
                          </p>
                    </div>
                </div>
                <!--
                <div class="mb-4">
                    <span class="font-bold text-gray-700 ">Select Size:</span>
                    <div class="flex items-center mt-2">
                        <button class="bg-gray-300 text-gray-700 py-2 px-4 rounded-full font-bold mr-2 hover:bg-gray-400 ">Black/White</button>
                        <button class="bg-gray-300 text-gray-700 py-2 px-4 rounded-full font-bold mr-2 hover:bg-gray-400 ">Colored</button>
                        <button class="bg-gray-300 text-gray-700 py-2 px-4 rounded-full font-bold mr-2 hover:bg-gray-400 ">Colored Covering Page</button>
                    </div>
                </div>
                -->
                <div>
                    <span class="font-bold text-gray-700 ">Product Description:</span>
                    <p class="text-gray-600 text-sm mt-2">
                      {{ .data.shopItem.Description }}
                    </p>
                </div>
            </div>
        </div>
    </div>
                  </form>
</div>


{{ template "footer.html" . }}
