{# Adapted from the vendored Penguin UI component (penguinui-components/card/ecommerce-product-card.html): wired to our product data + i18n + htmx add-to-cart + toast. The demo rating stars, hardcoded title/price/description/image and the `max-w-sm` (which fights the shop grid) are dropped; the whole card links to the product page. #} {# Layout adapts to the `view` Alpine state set by _product_grid.html: 'grid' (default) → vertical card; 'list' → horizontal row. On pages without that state (e.g. home) `view` is undefined, so the grid layout applies. #}
{% if product.image %} {{ product.name }} {% endif %}

{{ product.name }}

{% if product.on_sale %}
Price{% if product.has_options %}{{ t(key="from-price", price=product.price, lang=lang | default(value='sk')) }}{% else %}{{ product.price }}{% endif %} {{ product.currency }} {{ product.regular_price }} {{ product.currency }}
{% else %} Price{% if product.has_options %}{{ t(key="from-price", price=product.price, lang=lang | default(value='sk')) }}{% else %}{{ product.price }}{% endif %} {{ product.currency }} {% endif %}
{% if product.has_options %} {# Multiple variants: customer must pick on the product page. #} {{ ui::button(label=t(key="choose-option", lang=lang | default(value='sk')), href="/shop/" ~ product.slug, extra="w-full") }} {% elif product.in_stock %}

{% if product.tracked %}{{ t(key="in-stock", lang=lang | default(value='sk')) }}: {{ product.stock }}{% else %}{{ t(key="available", lang=lang | default(value='sk')) }}{% endif %}

{{ ui::button(label=t(key="add-to-cart", lang=lang | default(value='sk')), type="submit", extra="w-full", icon='') }}
{% else %}

{{ t(key="out-of-stock", lang=lang | default(value='sk')) }}

{% endif %}